Assume two dependent transactions A and B. Transaction B depends on transaction A and will fail if transaction A has failed.
I would like to estimate the gas limit required for the success of both transactions if executed sequentially. Estimating gas for each transaction separately does not work. While there is no problem with estimating gas for transaction A, estimating gas for transaction B without actually executing transaction A might return a wrong result. Transaction A has not yet happened and the state not changed.
In other words, how to estimate the gas limit for transaction B, given transaction A has completed successfully.