Conversation
31432f4 to
097c04e
Compare
| %macro get_input() | ||
| %push0() | ||
| calldataload | ||
| push1 4 # [4] |
There was a problem hiding this comment.
oh this is 4 words, you'll actually need to load 1 word and mask out the upper 4 bytes. you can see how to do that here: https://github.com/lightclient/erc20/blob/7b0d75d60f4e746c697a9ff88c62da411ac3f3b5/src/jump_table.etk#L20-L23
There was a problem hiding this comment.
Calldataload puts 32 bytes from calldata on stack, and item on stack is the offset?
There was a problem hiding this comment.
This does not load function selector but it loads the timestamp input from calldata BTW
There was a problem hiding this comment.
oh this is 4 words
Nope, the calldataload offset is a byte-offset, not word-offset
func opCallDataLoad(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
x := scope.Stack.peek()
if offset, overflow := x.Uint64WithOverflow(); !overflow {
data := getData(scope.Contract.Input, offset, 32)
x.SetBytes(data)So it's correct
There was a problem hiding this comment.
ah you're right i got confused with how i was mloading the data in the other project!
|
Also merged master |
This PR checks if the user input matches the ABI of
get(uint256)