fix(tests): clamp reserve balance threshold at zero - #43
Merged
Conversation
Assert that a sender whose gas fees exceed the reserve can empty. Co-Authored-By: Claude <claude-opus-5[1m]>
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.
MERGE after #42.
Add a spec test that a sender whose gas fees exceed the reserve can empty.
Also throw a meaningful assertion error on txs impossible to come from consensus, when gas fees exceed reserve but sender cannot empty.
Both were missed in the original reserve balance implementation (in
execution-specsthat is), and the implementation would just throw anOverflowErrorin both cases (U256 underflow to be precise)Greptile Summary
The PR clamps the sender reserve threshold at zero when gas fees equal or exceed the reserve and adds an assertion for transactions that consensus should not sequence.
Confidence Score: 5/5
The PR appears safe to merge with no actionable correctness or security issues identified.
The clamp prevents unsigned subtraction underflow for senders allowed to empty their balance, while the assertion preserves the stated consensus restriction for other senders and the new tests cover the relevant fee boundaries.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(spec-specs, tests): clamp reserve ba..." | Re-trigger Greptile