IPC-506: Fix GetCode and GetStorageAt for ethaccount#511
Conversation
There was a problem hiding this comment.
This is rather brittle and not very future-proof, e.g. what if this Eth address is a masked ID address for a Wasm or built-in actor that does support the method number? IMO the correct solution is to obtain the type of the actor from the state tree, and act differently. This is what Lotus does for these two methods.
There is also a third edge case in the Eth API that requires the actor type:
Let me submit a draft PR with the solution I've been working on.
|
You are right that if someone uses a masked ID then they can get some strange results. Most likely they will get an error, because either the input or the output will not parse correctly, resulting in some kind of error code which is not 22, so they will correctly see the error message in the response. |
4ee1ab6 to
b98a561
Compare
|
Thank you for the link to the |
|
Ah, okay, I see there is a separate |
b98a561 to
a3eec26
Compare
|
@raulk I suggest we merge this and its tests, so that at least the bug is squashed, and then you have time to finish your version with the manifest without having to point at different branches. |
raulk
left a comment
There was a problem hiding this comment.
Good enough for an intermediate fix.
Fixes #506
This is an alternative for #507 that makes 22 exit code work like a
PLACEHOLDERaccount by returningNonefromread_evm_actor.I think it's sufficient indication that we're dealing with
ETHACCOUNT, because:read_evm_actoris an internal method to the Ethereum API facade, it's only ever called withH160addresses and two well known method numbers (GetCodeandGetStorageAt), never with user inputMessagewill go to anf410address constructed from the 20 byte address hash, and if that exists, it's some sort of Ethereum account or contract (if it didn't exist we wouldn't get code 22)