-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add slow VM validation for calldata offset checks #107
base: master
Are you sure you want to change the base?
Conversation
1712602
to
7b6a8ee
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #107 +/- ##
==========================================
- Coverage 61.89% 61.78% -0.11%
==========================================
Files 27 27
Lines 4091 4098 +7
==========================================
Hits 2532 2532
- Misses 1427 1432 +5
- Partials 132 134 +2 ☔ View full report in Codecov by Sentry. |
rvgo/slow/vm.go
Outdated
@@ -122,6 +122,12 @@ func Step(calldata []byte, po PreimageOracle) (stateHash common.Hash, outErr err | |||
} | |||
|
|||
stateContentOffset := uint8(4 + 32 + 32 + 32 + 32) |
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.
Can we make stateContentOffset
a uint16
by default? or is it used elsewhere as a uint8
that I'm missing
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.
No other intent! I changed stateContentOffset
to uint16
by default :)
Description
The slow VM implementation is supposed to replicate the Solidity implementation. It takes as input the same
calldata
and process them.However, the slow VM implementation lacks calldata offset checks for the
_stateData
and_proof
parameters.This can lead the same calldata payload to succeed on the slow implementation but revert on the Solidity implementation.
The Solidity implementation ensures that the
_stateData.offset == 132
and that_proof.offset == 548
.But, Go slow implementation does not check those.
Thus, this implements the same offsets check in the Go slow implementation.