Commit 571b89fb authored by Adrian Sutton's avatar Adrian Sutton

Update stub to support batch calls.

parent b00a3d12
......@@ -161,7 +161,7 @@ func setup(t *testing.T) (*test.AbiBasedRpc, *FaultDisputeGameContract) {
address := common.HexToAddress("0x24112842371dFC380576ebb09Ae16Cb6B6caD7CB")
stubRpc := test.NewAbiBasedRpc(t, fdgAbi, address)
caller := batching.NewMultiCaller(stubRpc, 1)
caller := batching.NewMultiCaller(stubRpc, 100)
game, err := NewFaultDisputeGameContract(address, caller)
require.NoError(t, err)
return stubRpc, game
......
......@@ -3,6 +3,7 @@ package test
import (
"context"
"encoding/json"
"errors"
"fmt"
"testing"
......@@ -59,8 +60,13 @@ func (l *AbiBasedRpc) SetResponse(method string, expected []interface{}, output
})
}
func (l *AbiBasedRpc) BatchCallContext(_ context.Context, b []rpc.BatchElem) error {
panic("Not implemented")
func (l *AbiBasedRpc) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error {
var errs []error
for _, elem := range b {
elem.Error = l.CallContext(ctx, elem.Result, elem.Method, elem.Args...)
errs = append(errs, elem.Error)
}
return errors.Join(errs...)
}
func (l *AbiBasedRpc) CallContext(_ context.Context, out interface{}, method string, args ...interface{}) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment