Do not return interface{} from trace api methods

This commit is contained in:
Fridrik Asmundsson
2023-08-28 17:48:22 +00:00
parent ebb54bc381
commit 4068e0710d
10 changed files with 137 additions and 77 deletions
+2 -2
View File
@@ -871,9 +871,9 @@ type FullNode interface {
// TraceAPI related methods
//
// Returns traces created at given block
TraceBlock(ctx context.Context, blkNum string) (interface{}, error) //perm:read
TraceBlock(ctx context.Context, blkNum string) ([]*ethtypes.TraceBlock, error) //perm:read
// Replays all transactions in a block returning the requested traces for each transaction
TraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) (interface{}, error) //perm:read
TraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.TraceReplayBlockTransaction, error) //perm:read
// CreateBackup creates node backup onder the specified file name. The
// method requires that the lotus daemon is running with the
+2 -2
View File
@@ -127,6 +127,6 @@ type Gateway interface {
EthSubscribe(ctx context.Context, params jsonrpc.RawParams) (ethtypes.EthSubscriptionID, error)
EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error)
Web3ClientVersion(ctx context.Context) (string, error)
TraceBlock(ctx context.Context, blkNum string) (interface{}, error)
TraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) (interface{}, error)
TraceBlock(ctx context.Context, blkNum string) ([]*ethtypes.TraceBlock, error)
TraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.TraceReplayBlockTransaction, error)
}
+4 -4
View File
@@ -4024,10 +4024,10 @@ func (mr *MockFullNodeMockRecorder) SyncValidateTipset(arg0, arg1 interface{}) *
}
// TraceBlock mocks base method.
func (m *MockFullNode) TraceBlock(arg0 context.Context, arg1 string) (interface{}, error) {
func (m *MockFullNode) TraceBlock(arg0 context.Context, arg1 string) ([]*ethtypes.TraceBlock, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TraceBlock", arg0, arg1)
ret0, _ := ret[0].(interface{})
ret0, _ := ret[0].([]*ethtypes.TraceBlock)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@@ -4039,10 +4039,10 @@ func (mr *MockFullNodeMockRecorder) TraceBlock(arg0, arg1 interface{}) *gomock.C
}
// TraceReplayBlockTransactions mocks base method.
func (m *MockFullNode) TraceReplayBlockTransactions(arg0 context.Context, arg1 string, arg2 []string) (interface{}, error) {
func (m *MockFullNode) TraceReplayBlockTransactions(arg0 context.Context, arg1 string, arg2 []string) ([]*ethtypes.TraceReplayBlockTransaction, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TraceReplayBlockTransactions", arg0, arg1, arg2)
ret0, _ := ret[0].(interface{})
ret0, _ := ret[0].([]*ethtypes.TraceReplayBlockTransaction)
ret1, _ := ret[1].(error)
return ret0, ret1
}
+20 -20
View File
@@ -596,9 +596,9 @@ type FullNodeMethods struct {
SyncValidateTipset func(p0 context.Context, p1 types.TipSetKey) (bool, error) `perm:"read"`
TraceBlock func(p0 context.Context, p1 string) (interface{}, error) `perm:"read"`
TraceBlock func(p0 context.Context, p1 string) ([]*ethtypes.TraceBlock, error) `perm:"read"`
TraceReplayBlockTransactions func(p0 context.Context, p1 string, p2 []string) (interface{}, error) `perm:"read"`
TraceReplayBlockTransactions func(p0 context.Context, p1 string, p2 []string) ([]*ethtypes.TraceReplayBlockTransaction, error) `perm:"read"`
WalletBalance func(p0 context.Context, p1 address.Address) (types.BigInt, error) `perm:"read"`
@@ -818,9 +818,9 @@ type GatewayMethods struct {
StateWaitMsg func(p0 context.Context, p1 cid.Cid, p2 uint64, p3 abi.ChainEpoch, p4 bool) (*MsgLookup, error) ``
TraceBlock func(p0 context.Context, p1 string) (interface{}, error) ``
TraceBlock func(p0 context.Context, p1 string) ([]*ethtypes.TraceBlock, error) ``
TraceReplayBlockTransactions func(p0 context.Context, p1 string, p2 []string) (interface{}, error) ``
TraceReplayBlockTransactions func(p0 context.Context, p1 string, p2 []string) ([]*ethtypes.TraceReplayBlockTransaction, error) ``
Version func(p0 context.Context) (APIVersion, error) ``
@@ -4005,26 +4005,26 @@ func (s *FullNodeStub) SyncValidateTipset(p0 context.Context, p1 types.TipSetKey
return false, ErrNotSupported
}
func (s *FullNodeStruct) TraceBlock(p0 context.Context, p1 string) (interface{}, error) {
func (s *FullNodeStruct) TraceBlock(p0 context.Context, p1 string) ([]*ethtypes.TraceBlock, error) {
if s.Internal.TraceBlock == nil {
return nil, ErrNotSupported
return *new([]*ethtypes.TraceBlock), ErrNotSupported
}
return s.Internal.TraceBlock(p0, p1)
}
func (s *FullNodeStub) TraceBlock(p0 context.Context, p1 string) (interface{}, error) {
return nil, ErrNotSupported
func (s *FullNodeStub) TraceBlock(p0 context.Context, p1 string) ([]*ethtypes.TraceBlock, error) {
return *new([]*ethtypes.TraceBlock), ErrNotSupported
}
func (s *FullNodeStruct) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) (interface{}, error) {
func (s *FullNodeStruct) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) ([]*ethtypes.TraceReplayBlockTransaction, error) {
if s.Internal.TraceReplayBlockTransactions == nil {
return nil, ErrNotSupported
return *new([]*ethtypes.TraceReplayBlockTransaction), ErrNotSupported
}
return s.Internal.TraceReplayBlockTransactions(p0, p1, p2)
}
func (s *FullNodeStub) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) (interface{}, error) {
return nil, ErrNotSupported
func (s *FullNodeStub) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) ([]*ethtypes.TraceReplayBlockTransaction, error) {
return *new([]*ethtypes.TraceReplayBlockTransaction), ErrNotSupported
}
func (s *FullNodeStruct) WalletBalance(p0 context.Context, p1 address.Address) (types.BigInt, error) {
@@ -5160,26 +5160,26 @@ func (s *GatewayStub) StateWaitMsg(p0 context.Context, p1 cid.Cid, p2 uint64, p3
return nil, ErrNotSupported
}
func (s *GatewayStruct) TraceBlock(p0 context.Context, p1 string) (interface{}, error) {
func (s *GatewayStruct) TraceBlock(p0 context.Context, p1 string) ([]*ethtypes.TraceBlock, error) {
if s.Internal.TraceBlock == nil {
return nil, ErrNotSupported
return *new([]*ethtypes.TraceBlock), ErrNotSupported
}
return s.Internal.TraceBlock(p0, p1)
}
func (s *GatewayStub) TraceBlock(p0 context.Context, p1 string) (interface{}, error) {
return nil, ErrNotSupported
func (s *GatewayStub) TraceBlock(p0 context.Context, p1 string) ([]*ethtypes.TraceBlock, error) {
return *new([]*ethtypes.TraceBlock), ErrNotSupported
}
func (s *GatewayStruct) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) (interface{}, error) {
func (s *GatewayStruct) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) ([]*ethtypes.TraceReplayBlockTransaction, error) {
if s.Internal.TraceReplayBlockTransactions == nil {
return nil, ErrNotSupported
return *new([]*ethtypes.TraceReplayBlockTransaction), ErrNotSupported
}
return s.Internal.TraceReplayBlockTransactions(p0, p1, p2)
}
func (s *GatewayStub) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) (interface{}, error) {
return nil, ErrNotSupported
func (s *GatewayStub) TraceReplayBlockTransactions(p0 context.Context, p1 string, p2 []string) ([]*ethtypes.TraceReplayBlockTransaction, error) {
return *new([]*ethtypes.TraceReplayBlockTransaction), ErrNotSupported
}
func (s *GatewayStruct) Version(p0 context.Context) (APIVersion, error) {