-
Notifications
You must be signed in to change notification settings - Fork 3
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
OOB memory access test cases #34
Comments
I'm confused. The EVM behavior, and the behavior of existing clients, is not to trap but instead to just fill in the memory with zeroes as you suggested in ewasm/hera#221. If Hera exhibits different behavior then existing EVM tests will fail. Which behavior should we be testing for? In particular, since Hera traps, all remaining gas gets consumed, which is not what EVM does. CC @jwasinger @axic |
EVM behavior of RETURNDATACOPY is different from CALLDATACOPY. callDataCopy will copy zero bytes if given offsets beyond the calldata size. RETURNDATACOPY will throw an exception: https://github.com/ethereum/EIPs/blob/06df3ce690e5c214e02d720658cd2b326f1db6cc/EIPS/eip-211.md
|
So we want to match the EVM behavior here as well, right? |
It looks like codecopy and extcodecopy do not trap, only returndatacopy. I'll add tests for all of this expected behavior. |
I'm still a little confused by @axic's comments in ewasm/hera#222:
Are we mimicking EVM behavior as discussed in this thread or are we "breaking away"? And if so what does that mean? |
Yes, the idea would be to do copy the logic from Though the test cases should match what Hera is doing and then we can change Hera. That change should trigger a test failure (showing that the tests indeed are useful) and we can adjust them. |
Test both fully and partially OOB cases. Revert to existing Hera behavior (trapping) per ewasm#34 rather than expecting zero padding.
Test both fully and partially OOB cases. Revert to existing Hera behavior (trapping) per ewasm#34 rather than expecting zero padding.
* Adds new codeCopyOOB test Tests the effect of copying code from out-of-bounds location. * Add new extCodeCopyOOB test Test behavior of out-of-bounds extCodeCopy. Contains two checks, one for totally out of bounds copy and one for partial out of bounds copy. * WIP: writing returnDataCopyOOB test Writing one test that runs a series of other contracts, each of which calls returnDataCopy out-of-bounds in slightly different ways, to make sure each call fails. Running into a hera issue now with the first such test. * Split codeCopyOOB into two tests Test both fully and partially OOB cases. Revert to existing Hera behavior (trapping) per #34 rather than expecting zero padding. * Fix typo * Split extCodeCopyOOB test into two simpler tests Tests both fully and partially OOB cases. Expect hera to trap, even though it currently zero-pads. * Delete old fillers * Remove debugging * Rework the returnDataCopy test and split it up Split this complex multi-level test into three separate, simpler tests * Update filled tests
* Adds new codeCopyOOB test Tests the effect of copying code from out-of-bounds location. * Add new extCodeCopyOOB test Test behavior of out-of-bounds extCodeCopy. Contains two checks, one for totally out of bounds copy and one for partial out of bounds copy. * WIP: writing returnDataCopyOOB test Writing one test that runs a series of other contracts, each of which calls returnDataCopy out-of-bounds in slightly different ways, to make sure each call fails. Running into a hera issue now with the first such test. * Split codeCopyOOB into two tests Test both fully and partially OOB cases. Revert to existing Hera behavior (trapping) per #34 rather than expecting zero padding. * Fix typo * Split extCodeCopyOOB test into two simpler tests Tests both fully and partially OOB cases. Expect hera to trap, even though it currently zero-pads. * Delete old fillers * Remove debugging * Rework the returnDataCopy test and split it up Split this complex multi-level test into three separate, simpler tests * Update filled tests
As we are deviating from EVM1 with regards to how the EEI treats reads from OOB memory (see ewasm/hera#222), we need test cases that capture this spec change.
externalCodeCopy
,codeCopy
andreturnDataCopy
need to have test cases to make sure that: copying from OOB memory traps.Cf: ewasm/evm2wasm#250
The text was updated successfully, but these errors were encountered: