-
Notifications
You must be signed in to change notification settings - Fork 1
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
wip: vm opcodes: Implement RETURNDATASIZE and RETURNDATACOPY #15
base: vm-opcodes
Are you sure you want to change the base?
Conversation
9f9a4f8
to
492f904
Compare
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.
Reviewed 10 of 10 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @whilei)
core/vm/instructions.go, line 307 at r1 (raw file):
) end := new(big.Int).Add(cOff, l)
Lol, looks like add(cOff, 1)
(add one) not add(cOff, l)
(add lowercase L). Rename l
to len
or something.
core/vm/instructions.go, line 308 at r1 (raw file):
end := new(big.Int).Add(cOff, l) if end.BitLen() > 64 || uint64(len(env.ReturnData())) < end.Uint64() {
Actually, if 2^32 <= end <= 2^64
, we're doing unnecessary work ;) (as len
returns int). This is not a big issue.
Another thing - I would use end.
IsUint64()
for clarity.
core/vm/jump_table.go, line 26 at r1 (raw file):
writes bool // returns determines whether the operation sets the return data returns bool
Same as with writes
in previous review - I would create a function IsReturning(op OpCode) bool
, and list the 5 opcodes there, instead of adding this to jumpPtr
.
core/vm/runtime/env.go, line 44 at r1 (raw file):
getHashFn func(uint64) common.Hash readOnly bool // Whether to throw on stateful modifications
readOnly
and returnData
is repeated in 3 "Env" structs. This doesn't look good.nnn
492f904
to
9f48f45
Compare
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.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @whilei)
core/vm/instructions.go, line 307 at r1 (raw file):
Previously, tzdybal (Tomasz Zdybał) wrote…
Lol, looks like
add(cOff, 1)
(add one) notadd(cOff, l)
(add lowercase L). Renamel
tolen
or something.
Doing.
core/vm/instructions.go, line 308 at r1 (raw file):
Previously, tzdybal (Tomasz Zdybał) wrote…
Actually, if
2^32 <= end <= 2^64
, we're doing unnecessary work ;) (aslen
returns int). This is not a big issue.
Another thing - I would useend.
IsUint64()
for clarity.
Roger, doing the IsUint64
core/vm/jump_table.go, line 26 at r1 (raw file):
Previously, tzdybal (Tomasz Zdybał) wrote…
Same as with
writes
in previous review - I would create a functionIsReturning(op OpCode) bool
, and list the 5 opcodes there, instead of adding this tojumpPtr
.
Doing.
This change is