From 16c4c67fbf5aa6e98e8d674fdfcb37294b0dd0cc Mon Sep 17 00:00:00 2001 From: Po Date: Sun, 27 Oct 2024 22:08:34 +0800 Subject: [PATCH] op-challenger: address comments --- op-challenger/game/fault/contracts/faultdisputegame2.go | 2 +- op-service/sources/batching/test/event_stub.go | 5 ++++- op-service/sources/batching/test/tx_stub.go | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/op-challenger/game/fault/contracts/faultdisputegame2.go b/op-challenger/game/fault/contracts/faultdisputegame2.go index bad905dd24d66..edeea0764c6d6 100644 --- a/op-challenger/game/fault/contracts/faultdisputegame2.go +++ b/op-challenger/game/fault/contracts/faultdisputegame2.go @@ -36,7 +36,7 @@ func (f *FaultDisputeGameContractLatest) GetSubClaims(ctx context.Context, block // todo: replace hardcoded method name txCall := batching.NewTxGetByHash(f.contract.Abi(), txHash, "move") - result, err := f.multiCaller.SingleCall(ctx, rpcblock.Latest, txCall) + result, err := f.multiCaller.SingleCall(ctx, block, txCall) if err != nil { return nil, fmt.Errorf("failed to load claim calldata: %w", err) } diff --git a/op-service/sources/batching/test/event_stub.go b/op-service/sources/batching/test/event_stub.go index 4c08284dba2bd..6b46d385f8191 100644 --- a/op-service/sources/batching/test/event_stub.go +++ b/op-service/sources/batching/test/event_stub.go @@ -25,7 +25,10 @@ func (c *expectedFilterLogsCall) Matches(rpcMethod string, args ...interface{}) return fmt.Errorf("expected rpcMethod eth_getFilterLogs but was %v", rpcMethod) } - topics := args[0].([][]common.Hash) + topics, ok := args[0].([][]common.Hash) + if !ok { + return fmt.Errorf("arg 0 is not [][]common.Hash") + } if !reflect.DeepEqual(topics, c.topics) { return fmt.Errorf("expected topics %v but was %v", c.topics, topics) diff --git a/op-service/sources/batching/test/tx_stub.go b/op-service/sources/batching/test/tx_stub.go index a513a215e68f6..4b14a7592781c 100644 --- a/op-service/sources/batching/test/tx_stub.go +++ b/op-service/sources/batching/test/tx_stub.go @@ -21,7 +21,10 @@ func (c *expectedGetTxByHashCall) Matches(rpcMethod string, args ...interface{}) return fmt.Errorf("expected rpcMethod eth_getTransactionByHash but was %v", rpcMethod) } - txhash := args[0].(common.Hash) + txhash, ok := args[0].(common.Hash) + if !ok { + return fmt.Errorf("arg 0 is not common.Hash") + } if txhash != c.txHash { return fmt.Errorf("expected txHash %v but was %v", c.txHash, txhash)