Skip to content

Commit

Permalink
Make stateContentOffset uint16 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mininny committed Jan 23, 2025
1 parent 88dd659 commit 7e7bffe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rvgo/slow/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func Step(calldata []byte, po PreimageOracle) (stateHash common.Hash, outErr err
panic("invalid function selector")
}

stateContentOffset := uint8(4 + 32 + 32 + 32 + 32)
if iszero(eq(add(b32asBEWord(calldataload(byteToU64(4))), shortToU256(32+4)), shortToU256(uint16(stateContentOffset)))) {
stateContentOffset := uint16(4 + 32 + 32 + 32 + 32)
if iszero(eq(add(b32asBEWord(calldataload(byteToU64(4))), shortToU256(32+4)), shortToU256(stateContentOffset))) {
// _stateData.offset = _stateData.pointer + 32 + 4
// 32*4+4 = 132 expected state data offset
panic("invalid state offset input")
Expand All @@ -139,9 +139,9 @@ func Step(calldata []byte, po PreimageOracle) (stateHash common.Hash, outErr err
panic("invalid state size input")
}

proofContentOffset := shortToU64(uint16(stateContentOffset) + paddedStateSize + 32)
proofContentOffset := shortToU64(stateContentOffset + paddedStateSize + 32)

if mod(b32asBEWord(calldataload(shortToU64(uint16(stateContentOffset)+paddedStateSize))), shortToU256(60*32)) != byteToU256(0) {
if mod(b32asBEWord(calldataload(shortToU64(stateContentOffset+paddedStateSize))), shortToU256(60*32)) != byteToU256(0) {
// proof offset must be stateContentOffset+paddedStateSize+32
// proof size: 64-5+1=60 * 32 byte leaf,
// but multiple memProof can be used, so the proofSize must be a multiple of 60
Expand Down

0 comments on commit 7e7bffe

Please sign in to comment.