Merge pull request #10534 from filecoin-project/raulk/fix-parse-block-param-error

fix: Eth RPC: do not occlude block param errors.
This commit is contained in:
ZenGround0 2023-05-08 11:51:39 -04:00 committed by GitHub
commit ed7d1ef493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -387,7 +387,7 @@ func (a *EthModule) EthGetTransactionCount(ctx context.Context, sender ethtypes.
ts, err := a.parseBlkParam(ctx, blkParam, false) ts, err := a.parseBlkParam(ctx, blkParam, false)
if err != nil { if err != nil {
return ethtypes.EthUint64(0), xerrors.Errorf("cannot parse block param: %s", blkParam) return ethtypes.EthUint64(0), xerrors.Errorf("failed to process block param: %s; %w", blkParam, err)
} }
// First, handle the case where the "sender" is an EVM actor. // First, handle the case where the "sender" is an EVM actor.
@ -475,7 +475,7 @@ func (a *EthModule) EthGetCode(ctx context.Context, ethAddr ethtypes.EthAddress,
ts, err := a.parseBlkParam(ctx, blkParam, false) ts, err := a.parseBlkParam(ctx, blkParam, false)
if err != nil { if err != nil {
return nil, xerrors.Errorf("cannot parse block param: %s", blkParam) return nil, xerrors.Errorf("failed to process block param: %s; %w", blkParam, err)
} }
// StateManager.Call will panic if there is no parent // StateManager.Call will panic if there is no parent
@ -554,7 +554,7 @@ func (a *EthModule) EthGetCode(ctx context.Context, ethAddr ethtypes.EthAddress,
func (a *EthModule) EthGetStorageAt(ctx context.Context, ethAddr ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) { func (a *EthModule) EthGetStorageAt(ctx context.Context, ethAddr ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) {
ts, err := a.parseBlkParam(ctx, blkParam, false) ts, err := a.parseBlkParam(ctx, blkParam, false)
if err != nil { if err != nil {
return nil, xerrors.Errorf("cannot parse block param: %s", blkParam) return nil, xerrors.Errorf("failed to process block param: %s; %w", blkParam, err)
} }
l := len(position) l := len(position)
@ -650,7 +650,7 @@ func (a *EthModule) EthGetBalance(ctx context.Context, address ethtypes.EthAddre
ts, err := a.parseBlkParam(ctx, blkParam, false) ts, err := a.parseBlkParam(ctx, blkParam, false)
if err != nil { if err != nil {
return ethtypes.EthBigInt{}, xerrors.Errorf("cannot parse block param: %s", blkParam) return ethtypes.EthBigInt{}, xerrors.Errorf("failed to process block param: %s; %w", blkParam, err)
} }
st, _, err := a.StateManager.TipSetState(ctx, ts) st, _, err := a.StateManager.TipSetState(ctx, ts)
@ -1081,7 +1081,7 @@ func (a *EthModule) EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam s
ts, err := a.parseBlkParam(ctx, blkParam, false) ts, err := a.parseBlkParam(ctx, blkParam, false)
if err != nil { if err != nil {
return nil, xerrors.Errorf("cannot parse block param: %s", blkParam) return nil, xerrors.Errorf("failed to process block param: %s; %w", blkParam, err)
} }
invokeResult, err := a.applyMessage(ctx, msg, ts.Key()) invokeResult, err := a.applyMessage(ctx, msg, ts.Key())