We've recently added an ability to run multiple soroban operations per transaction. Every operation is 'standalone' and uses its own ledger footprint.
Now that we're adding more resource accounting (such as CPU instructions and IO), I wanted to revisit this.
On a high level I see two options:
- keep operations standalone, i.e. add the resource consumption data to the operations similar to footprints. it makes it easy to batch operations together. it is a bit more expensive though, as the transaction size would be larger. there also will be some double-counting (e.g. if you write an entry and then read it in the next operation, you'd need to pay both for read and for write). the transaction itself will be a bit larger as well (though the difference is marginal)
- move everything (including footprints) to the transaction level. this could make multi-operation transactions cheaper if we eliminate double-counting. another benefit is that resources are carried over between the operations, which is a bit better for operations with volatile cost. however, this might be trickier implementation-wise - e.g. I'm not sure if we can get rid of IO double-counting while also emitting the sane per-operation ledger change meta. so it seems to me that this approach would work better if we came back to the idea of only allowing a single operation, but allow it to invoke multiple host fns. this way we'll get all the cost-related benefits 'for free'.
I've also considered in-between options (like do per-operation footprint, but tx-level instructions), but I don't like them because of inconsistency.
any thoughts?