-
Notifications
You must be signed in to change notification settings - Fork 167
feat(benchmark): create pure ether transfer worst case #1742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(benchmark): create pure ether transfer worst case #1742
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some comments.
72e8741
to
ad65d97
Compare
@marioevz Thanks for the review, I had some update and left a few questions. |
ad65d97
to
939fb53
Compare
Just echoing the discussion we had in person a few minutes ago: The solution to not having to know the exact balance at the start of the test is to have a contract call at the start of the block that simply records the starting balance, and then a final contract call after all eth send transactions to get the new balance and store the difference: from ethereum_test_tools import Conditional
Conditional(
condition=Op.ISZERO(Op.BALANCE(Op.CALLER)),
if_true=Op.SSTORE(0, Op.BALANCE(Op.CALLER)), # First tx, store the starting balance
if_false=Op.SSTORE(0, Op.SUB(Op.SLOAD(0), Op.BALANCE(Op.CALLER))), # Second tx, store the diff
) It would add two transactions to the test, but I feel like preserving the ability for a test to be fillable and executable is important. EDIT: This solution is broken, see my other comment. |
@marioevz Thanks for your explanation, I've updated with
|
6011b76
to
d0687c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks so much!
I've reviewed the logs and it seems to work exactly as expected.
🗒️ Description
In Nethermind’s test case, a block is filled with simple Ether transfer transactions, each transferring 1 wei. The purpose of this PR is to reproduce a specific scenario and expand test coverage. Four scenarios are included, as outlined below:
🔗 Related Issues
Issue #1734
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.