-
Notifications
You must be signed in to change notification settings - Fork 387
[rpc] State override assertion violation tests #1900
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
base: main
Are you sure you want to change the base?
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.
Pull Request Overview
This PR adds comprehensive death tests to verify assertion violations for state override functions in the RPC executor. The tests ensure that the C API properly validates inputs and fails gracefully when given invalid parameters.
- Adds 22 test cases covering null pointers, invalid lengths, operations on non-existent addresses, and duplicate insertions
- Uses GoogleTest's
EXPECT_DEATHframework with the "DeathTest" naming convention to safely test assertion failures - Validates all state override API functions including
add_override_address,set_override_balance,set_override_nonce,set_override_code,set_override_state, andset_override_state_diff
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ec67687 to
86f4076
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| evmc::bytes const code = evmc::from_hex("0x00").value(); |
Copilot
AI
Nov 11, 2025
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.
[nitpick] The code variable is declared in the outer scope but is only used for testing set_override_code within the loop. Consider moving this declaration inside the loop where it's used (around line 3605-3608), or alternatively, moving it outside the block entirely to line 3582 if it's meant to be shared across multiple test sections. This would improve code clarity and scope management.
| delete[] value; | ||
| } | ||
|
|
||
| // Test 14: set state diff overwrite existing key overwrite |
Copilot
AI
Nov 11, 2025
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.
[nitpick] The comment contains redundant wording with "overwrite" appearing twice. Consider simplifying to "Test 14: attempt to overwrite existing state diff key" or "Test 14: set state diff with existing key".
| // Test 14: set state diff overwrite existing key overwrite | |
| // Test 14: attempt to overwrite existing state diff key |
| delete[] value; | ||
| } | ||
|
|
||
| // Test 20: set state overwrite existing key overwrite |
Copilot
AI
Nov 11, 2025
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.
[nitpick] The comment contains redundant wording with "overwrite" appearing twice. Consider simplifying to "Test 20: attempt to overwrite existing state key" or "Test 20: set state with existing key".
| // Test 20: set state overwrite existing key overwrite | |
| // Test 20: attempt to overwrite existing state key |
No description provided.