-
Notifications
You must be signed in to change notification settings - Fork 6
Add ABI version #5
base: main
Are you sure you want to change the base?
Conversation
31432f4
to
097c04e
Compare
%macro get_input() | ||
%push0() | ||
calldataload | ||
push1 4 # [4] |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calldataload puts 32 bytes from calldata on stack, and item on stack is the offset?
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.
This does not load function selector but it loads the timestamp input from calldata BTW
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)