Investigate (and fix) complex cases of batch transfers
Description
It looks like in some cases we compute burn-cap
and fees incorrectly. I don't have concrete and easy instructions to reproduce it, but the idea is quite clear.
Steps to reproduce
Make an operation consisting of two transactions, both calling some smart contract. Let's say the contract has foo
entrypoint with unit
argument and stores a list
. When it's empty (and we start with empty), it puts a long list into the storage. When it's not empty (i. e. the storage is not empty), it does nothing. We call foo
twice in one batch.
Prerequisites (if needed):
Expected behaviour
Both transactions succeed and behave as if they were sent separately.
Actual behaviour
We will try to emulate foo
twice on the same (initial, empty) storage and the second call will fail because we will pass 0 burn-cap there but burn-cap for empty storage in not 0.
Basically the problem is that if we simulate [transaction1, transaction2]
on storage s0
, we will apply transaction2
to s0
instead of applying it to the result of applying transaction1
to s0
.
Environment
- Archlinux, manually built
- 5d2fedd4