Fast state revert for single-tx bundles
Rationale
Currently we are copying the state every time we are about to apply a bundle, as multi-tx bundles can't be handled with a revert to snapshort. It should be beneficial to have a special case for single-tx bundles that avoids the state copy.
Hello !
I'm looking into this issue, and I hope I can contribute somehow :)
I have a question please. I can't wrap my head around why it doesn't work to take a snapshot of the state before applying any bundle transactions and then revert to this snapshot if any one of the transactions fail. Why do we copy the state n times, right before applying every transaction?
Thanks :)
Hello :)
why it doesn't work to take a snapshot of the state before applying any bundle transactions and then revert to this snapshot if any one of the transactions fail
It could, but geth only allows reverts before you commit. So you'd have to not commit any of the intermediate transactions, and either revert or commit at the end. I think it's the best way, but there are a couple of corner cases (deleting empty objects in particular). Try it out and see where it fails right now!