-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: eth: correctly decode EthGetStorageAt output #10284
Conversation
We cbor-encode it. Also: 1. Actually use the passed block param. 2. Check if the target actor is an EVM actor to avoid nonsense outputs. fixes filecoin-project/ref-fvm#1621
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.
A dedicated test would be nice that goes over the different cases here:
- Actor is an evm smart contract and has the storage slot filled => return value.
- Actor is an evm smart contract and does not have the storage slot filled => return 32-byte padded 0.
- Actor is not an evm smart contract => ^^
- Actor does not exist => ^^
(I volunteer to write it tomorrow if you'd like me to.)
node/impl/full/eth.go
Outdated
l := len(position) | ||
if l > 32 { | ||
return nil, fmt.Errorf("supplied storage key is too long") | ||
} | ||
|
||
// pad with zero bytes if smaller than 32 bytes | ||
position = append(make([]byte, 32-l, 32-l), position...) | ||
position = append(make([]byte, 32-l), position...) |
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.
supernit: Could move this below to where it's used.
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.
I have that there to put it next to the length check. I kept the length check at the top to fail early when passed an invalid parameter.
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.
Other than the above, LGTM now.
Test issue: #10407 |
Related Issues
fixes filecoin-project/ref-fvm#1621
(probably)
Proposed Changes
Correctly decode actor output in EthGetStorageAt, and test it.
Also: