builder icon indicating copy to clipboard operation
builder copied to clipboard

Fast state revert for single-tx bundles

Open Ruteri opened this issue 3 years ago • 2 comments

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.

Ruteri avatar Nov 22 '22 10:11 Ruteri

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 :)

simon-saliba avatar Nov 25 '22 22:11 simon-saliba

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!

Ruteri avatar Nov 28 '22 08:11 Ruteri