diff --git a/execution/gethexec/api.go b/execution/gethexec/api.go index d3ff209e64..c58fbe7a1e 100644 --- a/execution/gethexec/api.go +++ b/execution/gethexec/api.go @@ -334,24 +334,26 @@ func (api *ArbTraceForwarderAPI) forward(ctx context.Context, method string, arg return resp, nil } -func (api *ArbTraceForwarderAPI) ClipToPostNitroGenesis(blockNumOrHash json.RawMessage) (json.RawMessage, error) { +func (api *ArbTraceForwarderAPI) blockSupportedByClassicNode(blockNumOrHash json.RawMessage) error { var bnh rpc.BlockNumberOrHash err := bnh.UnmarshalJSON(blockNumOrHash) if err != nil { - return nil, err + return err } blockNum, isNum := bnh.Number() if !isNum { - return blockNumOrHash, nil + return nil } blockNum, _ = api.blockchain.ClipToPostNitroGenesis(blockNum) - bnh.BlockNumber = &blockNum - return json.Marshal(bnh) + if blockNum < 0 || blockNum > rpc.BlockNumber(api.blockchain.Config().ArbitrumChainParams.GenesisBlockNum) { + return fmt.Errorf("block number %v is not supported by classic node", blockNum) + } + return nil } func (api *ArbTraceForwarderAPI) Call(ctx context.Context, callArgs json.RawMessage, traceTypes json.RawMessage, blockNumOrHash json.RawMessage) (*json.RawMessage, error) { var err error - blockNumOrHash, err = api.ClipToPostNitroGenesis(blockNumOrHash) + err = api.blockSupportedByClassicNode(blockNumOrHash) if err != nil { return nil, err } @@ -360,7 +362,7 @@ func (api *ArbTraceForwarderAPI) Call(ctx context.Context, callArgs json.RawMess func (api *ArbTraceForwarderAPI) CallMany(ctx context.Context, calls json.RawMessage, blockNumOrHash json.RawMessage) (*json.RawMessage, error) { var err error - blockNumOrHash, err = api.ClipToPostNitroGenesis(blockNumOrHash) + err = api.blockSupportedByClassicNode(blockNumOrHash) if err != nil { return nil, err } @@ -369,7 +371,7 @@ func (api *ArbTraceForwarderAPI) CallMany(ctx context.Context, calls json.RawMes func (api *ArbTraceForwarderAPI) ReplayBlockTransactions(ctx context.Context, blockNumOrHash json.RawMessage, traceTypes json.RawMessage) (*json.RawMessage, error) { var err error - blockNumOrHash, err = api.ClipToPostNitroGenesis(blockNumOrHash) + err = api.blockSupportedByClassicNode(blockNumOrHash) if err != nil { return nil, err } @@ -390,7 +392,7 @@ func (api *ArbTraceForwarderAPI) Get(ctx context.Context, txHash json.RawMessage func (api *ArbTraceForwarderAPI) Block(ctx context.Context, blockNumOrHash json.RawMessage) (*json.RawMessage, error) { var err error - blockNumOrHash, err = api.ClipToPostNitroGenesis(blockNumOrHash) + err = api.blockSupportedByClassicNode(blockNumOrHash) if err != nil { return nil, err }