Update EIP-8141: atomic-batch unroll rolls back the approval context - #9
Draft
Marchhill wants to merge 1 commit into
Draft
Update EIP-8141: atomic-batch unroll rolls back the approval context#9Marchhill wants to merge 1 commit into
Marchhill wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pins down what happens to the transaction-scoped approval context (
payer,sender_approved) when the frame that modified it is discarded — on an individual frame revert and on an atomic-batch unroll.Problem
ethereum#11955 settled the
VERIFYcase: "If the frame reverts, the transaction is invalid. This would unroll any effects ofAPPROVE." The batch-unroll rule, however, only says the state "must be rolled back to the condition it was immediately before the atomic batch began" and is silent on the approval context, which the spec defines as transaction-scoped variables distinct from state.The combination is reachable: approval-scope flags are valid with any mode, and the batch constraints only exclude
VERIFYframes, so aDEFAULTorSENDERframe inside a batch may carryAPPROVE_PAYMENTscope and its target's code may callAPPROVE(APPROVE_PAYMENT)(oncesender_approvedis true). If a later frame in the batch then fails, the nonce increment andmax_costcollection are state changes and roll back with the batch — but whetherpayerstays set is undefined. If it did stay set, fee settlement would returnpayer_refundto a payer whosemax_costcollection was rolled back, and the sender nonce would remain unconsumed: an unintended value-creation and replay path.Fix
Apply the direction the spec already took for
VERIFYreverts (ethereum#11955) and for the transaction-scopedrefund_counter(whose changes "by a reverted frame, or by frames unrolled as part of a failed atomic batch, are discarded together with that frame's state changes"): approval-context changes are discarded whenever the frame that made them is discarded.APPROVEis unrolled (nonce increment andmax_costcollection included), and that a transaction left withpayerunset is invalid per the existing end-of-frames check.No behavior changes for transactions that approve payment outside a batch, and public-mempool handling is unaffected (the validation prefix already may not contain
ATOMIC_BATCH_FLAGframes).