Merge pull request #10111 from filecoin-project/asr/fix-eth-get-storage

fix: EthAPI: Drop hack in GetStorageAt
This commit is contained in:
Aayush Rajasekaran 2023-01-25 11:20:31 -05:00 committed by GitHub
commit 1c2446da16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -500,18 +500,8 @@ func (a *EthModule) EthGetStorageAt(ctx context.Context, ethAddr ethtypes.EthAdd
return nil, fmt.Errorf("failed to construct system sender address: %w", err)
}
// TODO super duper hack (raulk). The EVM runtime actor uses the U256 parameter type in
// GetStorageAtParams, which serializes as a hex-encoded string. It should serialize
// as bytes. We didn't get to fix in time for Iron, so for now we just pass
// through the hex-encoded value passed through the Eth JSON-RPC API, by remarshalling it.
// We don't fix this at origin (builtin-actors) because we are not updating the bundle
// for Iron.
tmp, err := position.MarshalJSON()
if err != nil {
panic(err)
}
params, err := actors.SerializeParams(&evm.GetStorageAtParams{
StorageKey: tmp[1 : len(tmp)-1], // TODO strip the JSON-encoding quotes -- yuck
StorageKey: position,
})
if err != nil {
return nil, fmt.Errorf("failed to serialize parameters: %w", err)