feat(EVM-1178): add point evaluation test vectors#540
feat(EVM-1178): add point evaluation test vectors#5400xVolosnikov wants to merge 1 commit intodevfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds explicit test vectors to lock in fee-accounting (ERGs/native) and error semantics for the point-evaluation system function, preventing regressions in EVM-1178-related charging behavior.
Changes:
- Added a cost-vector test harness (
assert_cost_vector) and a consolidated valid input fixture for point evaluation. - Added test cases covering valid execution and several invalid-input scenarios while asserting constant resource charging.
- Removed a stale TODO comment related to point-evaluation native cost constants.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
basic_system/src/system_functions/point_evaluation.rs |
Adds new tests asserting expected outputs/errors and fixed ERGs/native charging across valid/invalid inputs. |
basic_system/src/cost_constants.rs |
Removes an outdated TODO near point-evaluation native cost constant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert_cost_vector( | ||
| &vec![0u8; 191], |
There was a problem hiding this comment.
&vec![0u8; 191] allocates a Vec just to pass a slice. Consider using a fixed-size byte array/slice (e.g., &[0u8; 191]) or binding the Vec to a local variable before borrowing, to avoid an unnecessary heap allocation in this test.
| assert_cost_vector( | |
| &vec![0u8; 191], | |
| let invalid_input_too_short = [0u8; 191]; | |
| assert_cost_vector( | |
| &invalid_input_too_short, |
| let modulus = [ | ||
| 0x73, 0xed, 0xa7, 0x53, 0x29, 0x9d, 0x7d, 0x48, 0x33, 0x39, 0xd8, 0x08, 0x09, 0xa1, | ||
| 0xd8, 0x05, 0x53, 0xbd, 0xa4, 0x02, 0xff, 0xfe, 0x5b, 0xfe, 0xff, 0xff, 0xff, 0xff, | ||
| 0x00, 0x00, 0x00, 0x01, | ||
| ]; | ||
| invalid_scalar_z[32..64].copy_from_slice(&modulus); |
There was a problem hiding this comment.
The BLS12-381 scalar field modulus byte array is duplicated here (and also appears in other tests in this module, e.g. test_point_evaluation_invalid_scalar_z). Consider factoring it into a shared const/helper to avoid divergence if the value ever needs to change or be reused elsewhere.
Benchmark report
|
|
Doesn't actually cover the task |
What ❔
Why ❔
Is this a breaking change?
Checklist