diff --git a/.circleci/config.yml b/.circleci/config.yml index ce4a4f3bb33..5b3a56c7c03 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -764,21 +764,21 @@ workflows: suite: itest-dup_mpool_messages target: "./itests/dup_mpool_messages_test.go" + - test: + name: test-itest-eth_account_abstraction + suite: itest-eth_account_abstraction + target: "./itests/eth_account_abstraction_test.go" + - test: name: test-itest-eth_filter suite: itest-eth_filter target: "./itests/eth_filter_test.go" - + - test: name: test-itest-fevm_events suite: itest-fevm_events target: "./itests/fevm_events_test.go" - - - test: - name: test-itest-eth_account_abstraction - suite: itest-eth_account_abstraction - target: "./itests/eth_account_abstraction_test.go" - + - test: name: test-itest-fevm suite: itest-fevm diff --git a/api/api_full.go b/api/api_full.go index 409f617f9da..3d4812a2fcb 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -1344,6 +1344,6 @@ type EthTxReceipt struct { GasUsed ethtypes.EthUint64 `json:"gasUsed"` EffectiveGasPrice ethtypes.EthBigInt `json:"effectiveGasPrice"` LogsBloom ethtypes.EthBytes `json:"logsBloom"` - Logs []string `json:"logs"` + Logs []ethtypes.EthLog `json:"logs"` Type ethtypes.EthUint64 `json:"type"` } diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index 755dee1f8ec..cb20015d65d 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -387,16 +387,16 @@ func init() { addExample(&uuid.UUID{}) - filterid, _ := api.EthHashFromHex("0x5CbEeC012345673f25E309Cc264f240bb0664031") - addExample(api.EthFilterID(filterid)) + filterid, _ := ethtypes.EthHashFromHex("0x5CbEeC012345673f25E309Cc264f240bb0664031") + addExample(ethtypes.EthFilterID(filterid)) - subid, _ := api.EthHashFromHex("0x5CbEeCF99d3fDB301234567c264f240bb0664031") - addExample(api.EthSubscriptionID(subid)) + subid, _ := ethtypes.EthHashFromHex("0x5CbEeCF99d3fDB301234567c264f240bb0664031") + addExample(ethtypes.EthSubscriptionID(subid)) pstring := func(s string) *string { return &s } - addExample(&api.EthFilterSpec{ + addExample(ðtypes.EthFilterSpec{ FromBlock: pstring("2301220"), - Address: []api.EthAddress{ethaddr}, + Address: []ethtypes.EthAddress{ethaddr}, }) } diff --git a/api/mocks/mock_full.go b/api/mocks/mock_full.go index ad8540bdf66..10ff250e6da 100644 --- a/api/mocks/mock_full.go +++ b/api/mocks/mock_full.go @@ -1133,10 +1133,10 @@ func (mr *MockFullNodeMockRecorder) EthGetCode(arg0, arg1, arg2 interface{}) *go } // EthGetFilterChanges mocks base method. -func (m *MockFullNode) EthGetFilterChanges(arg0 context.Context, arg1 api.EthFilterID) (*api.EthFilterResult, error) { +func (m *MockFullNode) EthGetFilterChanges(arg0 context.Context, arg1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetFilterChanges", arg0, arg1) - ret0, _ := ret[0].(*api.EthFilterResult) + ret0, _ := ret[0].(*ethtypes.EthFilterResult) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1148,10 +1148,10 @@ func (mr *MockFullNodeMockRecorder) EthGetFilterChanges(arg0, arg1 interface{}) } // EthGetFilterLogs mocks base method. -func (m *MockFullNode) EthGetFilterLogs(arg0 context.Context, arg1 api.EthFilterID) (*api.EthFilterResult, error) { +func (m *MockFullNode) EthGetFilterLogs(arg0 context.Context, arg1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetFilterLogs", arg0, arg1) - ret0, _ := ret[0].(*api.EthFilterResult) + ret0, _ := ret[0].(*ethtypes.EthFilterResult) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1163,10 +1163,10 @@ func (mr *MockFullNodeMockRecorder) EthGetFilterLogs(arg0, arg1 interface{}) *go } // EthGetLogs mocks base method. -func (m *MockFullNode) EthGetLogs(arg0 context.Context, arg1 *api.EthFilterSpec) (*api.EthFilterResult, error) { +func (m *MockFullNode) EthGetLogs(arg0 context.Context, arg1 *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetLogs", arg0, arg1) - ret0, _ := ret[0].(*api.EthFilterResult) + ret0, _ := ret[0].(*ethtypes.EthFilterResult) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1283,10 +1283,10 @@ func (mr *MockFullNodeMockRecorder) EthMaxPriorityFeePerGas(arg0 interface{}) *g } // EthNewBlockFilter mocks base method. -func (m *MockFullNode) EthNewBlockFilter(arg0 context.Context) (api.EthFilterID, error) { +func (m *MockFullNode) EthNewBlockFilter(arg0 context.Context) (ethtypes.EthFilterID, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthNewBlockFilter", arg0) - ret0, _ := ret[0].(api.EthFilterID) + ret0, _ := ret[0].(ethtypes.EthFilterID) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1298,10 +1298,10 @@ func (mr *MockFullNodeMockRecorder) EthNewBlockFilter(arg0 interface{}) *gomock. } // EthNewFilter mocks base method. -func (m *MockFullNode) EthNewFilter(arg0 context.Context, arg1 *api.EthFilterSpec) (api.EthFilterID, error) { +func (m *MockFullNode) EthNewFilter(arg0 context.Context, arg1 *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthNewFilter", arg0, arg1) - ret0, _ := ret[0].(api.EthFilterID) + ret0, _ := ret[0].(ethtypes.EthFilterID) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1313,10 +1313,10 @@ func (mr *MockFullNodeMockRecorder) EthNewFilter(arg0, arg1 interface{}) *gomock } // EthNewPendingTransactionFilter mocks base method. -func (m *MockFullNode) EthNewPendingTransactionFilter(arg0 context.Context) (api.EthFilterID, error) { +func (m *MockFullNode) EthNewPendingTransactionFilter(arg0 context.Context) (ethtypes.EthFilterID, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthNewPendingTransactionFilter", arg0) - ret0, _ := ret[0].(api.EthFilterID) + ret0, _ := ret[0].(ethtypes.EthFilterID) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1358,10 +1358,10 @@ func (mr *MockFullNodeMockRecorder) EthSendRawTransaction(arg0, arg1 interface{} } // EthSubscribe mocks base method. -func (m *MockFullNode) EthSubscribe(arg0 context.Context, arg1 string, arg2 *api.EthSubscriptionParams) (<-chan api.EthSubscriptionResponse, error) { +func (m *MockFullNode) EthSubscribe(arg0 context.Context, arg1 string, arg2 *ethtypes.EthSubscriptionParams) (<-chan ethtypes.EthSubscriptionResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthSubscribe", arg0, arg1, arg2) - ret0, _ := ret[0].(<-chan api.EthSubscriptionResponse) + ret0, _ := ret[0].(<-chan ethtypes.EthSubscriptionResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1373,7 +1373,7 @@ func (mr *MockFullNodeMockRecorder) EthSubscribe(arg0, arg1, arg2 interface{}) * } // EthUninstallFilter mocks base method. -func (m *MockFullNode) EthUninstallFilter(arg0 context.Context, arg1 api.EthFilterID) (bool, error) { +func (m *MockFullNode) EthUninstallFilter(arg0 context.Context, arg1 ethtypes.EthFilterID) (bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthUninstallFilter", arg0, arg1) ret0, _ := ret[0].(bool) @@ -1388,7 +1388,7 @@ func (mr *MockFullNodeMockRecorder) EthUninstallFilter(arg0, arg1 interface{}) * } // EthUnsubscribe mocks base method. -func (m *MockFullNode) EthUnsubscribe(arg0 context.Context, arg1 api.EthSubscriptionID) (bool, error) { +func (m *MockFullNode) EthUnsubscribe(arg0 context.Context, arg1 ethtypes.EthSubscriptionID) (bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthUnsubscribe", arg0, arg1) ret0, _ := ret[0].(bool) diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 8552b17460c..d308533e947 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -36,8 +36,8 @@ import ( builtinactors "github.com/filecoin-project/lotus/chain/actors/builtin" lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/chain/types/ethtypes" "github.com/filecoin-project/lotus/journal/alerting" - _ "github.com/filecoin-project/lotus/lib/sigs/delegated" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo/imports" "github.com/filecoin-project/lotus/storage/pipeline/sealiface" @@ -221,67 +221,67 @@ type FullNodeStruct struct { CreateBackup func(p0 context.Context, p1 string) error `perm:"admin"` - EthAccounts func(p0 context.Context) ([]EthAddress, error) `perm:"read"` + EthAccounts func(p0 context.Context) ([]ethtypes.EthAddress, error) `perm:"read"` - EthBlockNumber func(p0 context.Context) (EthUint64, error) `perm:"read"` + EthBlockNumber func(p0 context.Context) (ethtypes.EthUint64, error) `perm:"read"` - EthCall func(p0 context.Context, p1 EthCall, p2 string) (EthBytes, error) `perm:"read"` + EthCall func(p0 context.Context, p1 ethtypes.EthCall, p2 string) (ethtypes.EthBytes, error) `perm:"read"` - EthChainId func(p0 context.Context) (EthUint64, error) `perm:"read"` + EthChainId func(p0 context.Context) (ethtypes.EthUint64, error) `perm:"read"` - EthEstimateGas func(p0 context.Context, p1 EthCall) (EthUint64, error) `perm:"read"` + EthEstimateGas func(p0 context.Context, p1 ethtypes.EthCall) (ethtypes.EthUint64, error) `perm:"read"` - EthFeeHistory func(p0 context.Context, p1 EthUint64, p2 string, p3 []float64) (EthFeeHistory, error) `perm:"read"` + EthFeeHistory func(p0 context.Context, p1 ethtypes.EthUint64, p2 string, p3 []float64) (ethtypes.EthFeeHistory, error) `perm:"read"` - EthGasPrice func(p0 context.Context) (EthBigInt, error) `perm:"read"` + EthGasPrice func(p0 context.Context) (ethtypes.EthBigInt, error) `perm:"read"` - EthGetBalance func(p0 context.Context, p1 EthAddress, p2 string) (EthBigInt, error) `perm:"read"` + EthGetBalance func(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthBigInt, error) `perm:"read"` - EthGetBlockByHash func(p0 context.Context, p1 EthHash, p2 bool) (EthBlock, error) `perm:"read"` + EthGetBlockByHash func(p0 context.Context, p1 ethtypes.EthHash, p2 bool) (ethtypes.EthBlock, error) `perm:"read"` - EthGetBlockByNumber func(p0 context.Context, p1 string, p2 bool) (EthBlock, error) `perm:"read"` + EthGetBlockByNumber func(p0 context.Context, p1 string, p2 bool) (ethtypes.EthBlock, error) `perm:"read"` - EthGetBlockTransactionCountByHash func(p0 context.Context, p1 EthHash) (EthUint64, error) `perm:"read"` + EthGetBlockTransactionCountByHash func(p0 context.Context, p1 ethtypes.EthHash) (ethtypes.EthUint64, error) `perm:"read"` - EthGetBlockTransactionCountByNumber func(p0 context.Context, p1 EthUint64) (EthUint64, error) `perm:"read"` + EthGetBlockTransactionCountByNumber func(p0 context.Context, p1 ethtypes.EthUint64) (ethtypes.EthUint64, error) `perm:"read"` - EthGetCode func(p0 context.Context, p1 EthAddress, p2 string) (EthBytes, error) `perm:"read"` + EthGetCode func(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthBytes, error) `perm:"read"` - EthGetFilterChanges func(p0 context.Context, p1 EthFilterID) (*EthFilterResult, error) `perm:"write"` + EthGetFilterChanges func(p0 context.Context, p1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) `perm:"write"` - EthGetFilterLogs func(p0 context.Context, p1 EthFilterID) (*EthFilterResult, error) `perm:"write"` + EthGetFilterLogs func(p0 context.Context, p1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) `perm:"write"` - EthGetLogs func(p0 context.Context, p1 *EthFilterSpec) (*EthFilterResult, error) `perm:"read"` + EthGetLogs func(p0 context.Context, p1 *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) `perm:"read"` - EthGetStorageAt func(p0 context.Context, p1 EthAddress, p2 EthBytes, p3 string) (EthBytes, error) `perm:"read"` + EthGetStorageAt func(p0 context.Context, p1 ethtypes.EthAddress, p2 ethtypes.EthBytes, p3 string) (ethtypes.EthBytes, error) `perm:"read"` - EthGetTransactionByBlockHashAndIndex func(p0 context.Context, p1 EthHash, p2 EthUint64) (EthTx, error) `perm:"read"` + EthGetTransactionByBlockHashAndIndex func(p0 context.Context, p1 ethtypes.EthHash, p2 ethtypes.EthUint64) (ethtypes.EthTx, error) `perm:"read"` - EthGetTransactionByBlockNumberAndIndex func(p0 context.Context, p1 EthUint64, p2 EthUint64) (EthTx, error) `perm:"read"` + EthGetTransactionByBlockNumberAndIndex func(p0 context.Context, p1 ethtypes.EthUint64, p2 ethtypes.EthUint64) (ethtypes.EthTx, error) `perm:"read"` - EthGetTransactionByHash func(p0 context.Context, p1 *EthHash) (*EthTx, error) `perm:"read"` + EthGetTransactionByHash func(p0 context.Context, p1 *ethtypes.EthHash) (*ethtypes.EthTx, error) `perm:"read"` - EthGetTransactionCount func(p0 context.Context, p1 EthAddress, p2 string) (EthUint64, error) `perm:"read"` + EthGetTransactionCount func(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthUint64, error) `perm:"read"` - EthGetTransactionReceipt func(p0 context.Context, p1 EthHash) (*EthTxReceipt, error) `perm:"read"` + EthGetTransactionReceipt func(p0 context.Context, p1 ethtypes.EthHash) (*EthTxReceipt, error) `perm:"read"` - EthMaxPriorityFeePerGas func(p0 context.Context) (EthBigInt, error) `perm:"read"` + EthMaxPriorityFeePerGas func(p0 context.Context) (ethtypes.EthBigInt, error) `perm:"read"` - EthNewBlockFilter func(p0 context.Context) (EthFilterID, error) `perm:"write"` + EthNewBlockFilter func(p0 context.Context) (ethtypes.EthFilterID, error) `perm:"write"` - EthNewFilter func(p0 context.Context, p1 *EthFilterSpec) (EthFilterID, error) `perm:"write"` + EthNewFilter func(p0 context.Context, p1 *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) `perm:"write"` - EthNewPendingTransactionFilter func(p0 context.Context) (EthFilterID, error) `perm:"write"` + EthNewPendingTransactionFilter func(p0 context.Context) (ethtypes.EthFilterID, error) `perm:"write"` - EthProtocolVersion func(p0 context.Context) (EthUint64, error) `perm:"read"` + EthProtocolVersion func(p0 context.Context) (ethtypes.EthUint64, error) `perm:"read"` - EthSendRawTransaction func(p0 context.Context, p1 EthBytes) (EthHash, error) `perm:"read"` + EthSendRawTransaction func(p0 context.Context, p1 ethtypes.EthBytes) (ethtypes.EthHash, error) `perm:"read"` - EthSubscribe func(p0 context.Context, p1 string, p2 *EthSubscriptionParams) (<-chan EthSubscriptionResponse, error) `perm:"write"` + EthSubscribe func(p0 context.Context, p1 string, p2 *ethtypes.EthSubscriptionParams) (<-chan ethtypes.EthSubscriptionResponse, error) `perm:"write"` - EthUninstallFilter func(p0 context.Context, p1 EthFilterID) (bool, error) `perm:"write"` + EthUninstallFilter func(p0 context.Context, p1 ethtypes.EthFilterID) (bool, error) `perm:"write"` - EthUnsubscribe func(p0 context.Context, p1 EthSubscriptionID) (bool, error) `perm:"write"` + EthUnsubscribe func(p0 context.Context, p1 ethtypes.EthSubscriptionID) (bool, error) `perm:"write"` GasEstimateFeeCap func(p0 context.Context, p1 *types.Message, p2 int64, p3 types.TipSetKey) (types.BigInt, error) `perm:"read"` @@ -1875,344 +1875,344 @@ func (s *FullNodeStub) CreateBackup(p0 context.Context, p1 string) error { return ErrNotSupported } -func (s *FullNodeStruct) EthAccounts(p0 context.Context) ([]EthAddress, error) { +func (s *FullNodeStruct) EthAccounts(p0 context.Context) ([]ethtypes.EthAddress, error) { if s.Internal.EthAccounts == nil { - return *new([]EthAddress), ErrNotSupported + return *new([]ethtypes.EthAddress), ErrNotSupported } return s.Internal.EthAccounts(p0) } -func (s *FullNodeStub) EthAccounts(p0 context.Context) ([]EthAddress, error) { - return *new([]EthAddress), ErrNotSupported +func (s *FullNodeStub) EthAccounts(p0 context.Context) ([]ethtypes.EthAddress, error) { + return *new([]ethtypes.EthAddress), ErrNotSupported } -func (s *FullNodeStruct) EthBlockNumber(p0 context.Context) (EthUint64, error) { +func (s *FullNodeStruct) EthBlockNumber(p0 context.Context) (ethtypes.EthUint64, error) { if s.Internal.EthBlockNumber == nil { - return *new(EthUint64), ErrNotSupported + return *new(ethtypes.EthUint64), ErrNotSupported } return s.Internal.EthBlockNumber(p0) } -func (s *FullNodeStub) EthBlockNumber(p0 context.Context) (EthUint64, error) { - return *new(EthUint64), ErrNotSupported +func (s *FullNodeStub) EthBlockNumber(p0 context.Context) (ethtypes.EthUint64, error) { + return *new(ethtypes.EthUint64), ErrNotSupported } -func (s *FullNodeStruct) EthCall(p0 context.Context, p1 EthCall, p2 string) (EthBytes, error) { +func (s *FullNodeStruct) EthCall(p0 context.Context, p1 ethtypes.EthCall, p2 string) (ethtypes.EthBytes, error) { if s.Internal.EthCall == nil { - return *new(EthBytes), ErrNotSupported + return *new(ethtypes.EthBytes), ErrNotSupported } return s.Internal.EthCall(p0, p1, p2) } -func (s *FullNodeStub) EthCall(p0 context.Context, p1 EthCall, p2 string) (EthBytes, error) { - return *new(EthBytes), ErrNotSupported +func (s *FullNodeStub) EthCall(p0 context.Context, p1 ethtypes.EthCall, p2 string) (ethtypes.EthBytes, error) { + return *new(ethtypes.EthBytes), ErrNotSupported } -func (s *FullNodeStruct) EthChainId(p0 context.Context) (EthUint64, error) { +func (s *FullNodeStruct) EthChainId(p0 context.Context) (ethtypes.EthUint64, error) { if s.Internal.EthChainId == nil { - return *new(EthUint64), ErrNotSupported + return *new(ethtypes.EthUint64), ErrNotSupported } return s.Internal.EthChainId(p0) } -func (s *FullNodeStub) EthChainId(p0 context.Context) (EthUint64, error) { - return *new(EthUint64), ErrNotSupported +func (s *FullNodeStub) EthChainId(p0 context.Context) (ethtypes.EthUint64, error) { + return *new(ethtypes.EthUint64), ErrNotSupported } -func (s *FullNodeStruct) EthEstimateGas(p0 context.Context, p1 EthCall) (EthUint64, error) { +func (s *FullNodeStruct) EthEstimateGas(p0 context.Context, p1 ethtypes.EthCall) (ethtypes.EthUint64, error) { if s.Internal.EthEstimateGas == nil { - return *new(EthUint64), ErrNotSupported + return *new(ethtypes.EthUint64), ErrNotSupported } return s.Internal.EthEstimateGas(p0, p1) } -func (s *FullNodeStub) EthEstimateGas(p0 context.Context, p1 EthCall) (EthUint64, error) { - return *new(EthUint64), ErrNotSupported +func (s *FullNodeStub) EthEstimateGas(p0 context.Context, p1 ethtypes.EthCall) (ethtypes.EthUint64, error) { + return *new(ethtypes.EthUint64), ErrNotSupported } -func (s *FullNodeStruct) EthFeeHistory(p0 context.Context, p1 EthUint64, p2 string, p3 []float64) (EthFeeHistory, error) { +func (s *FullNodeStruct) EthFeeHistory(p0 context.Context, p1 ethtypes.EthUint64, p2 string, p3 []float64) (ethtypes.EthFeeHistory, error) { if s.Internal.EthFeeHistory == nil { - return *new(EthFeeHistory), ErrNotSupported + return *new(ethtypes.EthFeeHistory), ErrNotSupported } return s.Internal.EthFeeHistory(p0, p1, p2, p3) } -func (s *FullNodeStub) EthFeeHistory(p0 context.Context, p1 EthUint64, p2 string, p3 []float64) (EthFeeHistory, error) { - return *new(EthFeeHistory), ErrNotSupported +func (s *FullNodeStub) EthFeeHistory(p0 context.Context, p1 ethtypes.EthUint64, p2 string, p3 []float64) (ethtypes.EthFeeHistory, error) { + return *new(ethtypes.EthFeeHistory), ErrNotSupported } -func (s *FullNodeStruct) EthGasPrice(p0 context.Context) (EthBigInt, error) { +func (s *FullNodeStruct) EthGasPrice(p0 context.Context) (ethtypes.EthBigInt, error) { if s.Internal.EthGasPrice == nil { - return *new(EthBigInt), ErrNotSupported + return *new(ethtypes.EthBigInt), ErrNotSupported } return s.Internal.EthGasPrice(p0) } -func (s *FullNodeStub) EthGasPrice(p0 context.Context) (EthBigInt, error) { - return *new(EthBigInt), ErrNotSupported +func (s *FullNodeStub) EthGasPrice(p0 context.Context) (ethtypes.EthBigInt, error) { + return *new(ethtypes.EthBigInt), ErrNotSupported } -func (s *FullNodeStruct) EthGetBalance(p0 context.Context, p1 EthAddress, p2 string) (EthBigInt, error) { +func (s *FullNodeStruct) EthGetBalance(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthBigInt, error) { if s.Internal.EthGetBalance == nil { - return *new(EthBigInt), ErrNotSupported + return *new(ethtypes.EthBigInt), ErrNotSupported } return s.Internal.EthGetBalance(p0, p1, p2) } -func (s *FullNodeStub) EthGetBalance(p0 context.Context, p1 EthAddress, p2 string) (EthBigInt, error) { - return *new(EthBigInt), ErrNotSupported +func (s *FullNodeStub) EthGetBalance(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthBigInt, error) { + return *new(ethtypes.EthBigInt), ErrNotSupported } -func (s *FullNodeStruct) EthGetBlockByHash(p0 context.Context, p1 EthHash, p2 bool) (EthBlock, error) { +func (s *FullNodeStruct) EthGetBlockByHash(p0 context.Context, p1 ethtypes.EthHash, p2 bool) (ethtypes.EthBlock, error) { if s.Internal.EthGetBlockByHash == nil { - return *new(EthBlock), ErrNotSupported + return *new(ethtypes.EthBlock), ErrNotSupported } return s.Internal.EthGetBlockByHash(p0, p1, p2) } -func (s *FullNodeStub) EthGetBlockByHash(p0 context.Context, p1 EthHash, p2 bool) (EthBlock, error) { - return *new(EthBlock), ErrNotSupported +func (s *FullNodeStub) EthGetBlockByHash(p0 context.Context, p1 ethtypes.EthHash, p2 bool) (ethtypes.EthBlock, error) { + return *new(ethtypes.EthBlock), ErrNotSupported } -func (s *FullNodeStruct) EthGetBlockByNumber(p0 context.Context, p1 string, p2 bool) (EthBlock, error) { +func (s *FullNodeStruct) EthGetBlockByNumber(p0 context.Context, p1 string, p2 bool) (ethtypes.EthBlock, error) { if s.Internal.EthGetBlockByNumber == nil { - return *new(EthBlock), ErrNotSupported + return *new(ethtypes.EthBlock), ErrNotSupported } return s.Internal.EthGetBlockByNumber(p0, p1, p2) } -func (s *FullNodeStub) EthGetBlockByNumber(p0 context.Context, p1 string, p2 bool) (EthBlock, error) { - return *new(EthBlock), ErrNotSupported +func (s *FullNodeStub) EthGetBlockByNumber(p0 context.Context, p1 string, p2 bool) (ethtypes.EthBlock, error) { + return *new(ethtypes.EthBlock), ErrNotSupported } -func (s *FullNodeStruct) EthGetBlockTransactionCountByHash(p0 context.Context, p1 EthHash) (EthUint64, error) { +func (s *FullNodeStruct) EthGetBlockTransactionCountByHash(p0 context.Context, p1 ethtypes.EthHash) (ethtypes.EthUint64, error) { if s.Internal.EthGetBlockTransactionCountByHash == nil { - return *new(EthUint64), ErrNotSupported + return *new(ethtypes.EthUint64), ErrNotSupported } return s.Internal.EthGetBlockTransactionCountByHash(p0, p1) } -func (s *FullNodeStub) EthGetBlockTransactionCountByHash(p0 context.Context, p1 EthHash) (EthUint64, error) { - return *new(EthUint64), ErrNotSupported +func (s *FullNodeStub) EthGetBlockTransactionCountByHash(p0 context.Context, p1 ethtypes.EthHash) (ethtypes.EthUint64, error) { + return *new(ethtypes.EthUint64), ErrNotSupported } -func (s *FullNodeStruct) EthGetBlockTransactionCountByNumber(p0 context.Context, p1 EthUint64) (EthUint64, error) { +func (s *FullNodeStruct) EthGetBlockTransactionCountByNumber(p0 context.Context, p1 ethtypes.EthUint64) (ethtypes.EthUint64, error) { if s.Internal.EthGetBlockTransactionCountByNumber == nil { - return *new(EthUint64), ErrNotSupported + return *new(ethtypes.EthUint64), ErrNotSupported } return s.Internal.EthGetBlockTransactionCountByNumber(p0, p1) } -func (s *FullNodeStub) EthGetBlockTransactionCountByNumber(p0 context.Context, p1 EthUint64) (EthUint64, error) { - return *new(EthUint64), ErrNotSupported +func (s *FullNodeStub) EthGetBlockTransactionCountByNumber(p0 context.Context, p1 ethtypes.EthUint64) (ethtypes.EthUint64, error) { + return *new(ethtypes.EthUint64), ErrNotSupported } -func (s *FullNodeStruct) EthGetCode(p0 context.Context, p1 EthAddress, p2 string) (EthBytes, error) { +func (s *FullNodeStruct) EthGetCode(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthBytes, error) { if s.Internal.EthGetCode == nil { - return *new(EthBytes), ErrNotSupported + return *new(ethtypes.EthBytes), ErrNotSupported } return s.Internal.EthGetCode(p0, p1, p2) } -func (s *FullNodeStub) EthGetCode(p0 context.Context, p1 EthAddress, p2 string) (EthBytes, error) { - return *new(EthBytes), ErrNotSupported +func (s *FullNodeStub) EthGetCode(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthBytes, error) { + return *new(ethtypes.EthBytes), ErrNotSupported } -func (s *FullNodeStruct) EthGetFilterChanges(p0 context.Context, p1 EthFilterID) (*EthFilterResult, error) { +func (s *FullNodeStruct) EthGetFilterChanges(p0 context.Context, p1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { if s.Internal.EthGetFilterChanges == nil { return nil, ErrNotSupported } return s.Internal.EthGetFilterChanges(p0, p1) } -func (s *FullNodeStub) EthGetFilterChanges(p0 context.Context, p1 EthFilterID) (*EthFilterResult, error) { +func (s *FullNodeStub) EthGetFilterChanges(p0 context.Context, p1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { return nil, ErrNotSupported } -func (s *FullNodeStruct) EthGetFilterLogs(p0 context.Context, p1 EthFilterID) (*EthFilterResult, error) { +func (s *FullNodeStruct) EthGetFilterLogs(p0 context.Context, p1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { if s.Internal.EthGetFilterLogs == nil { return nil, ErrNotSupported } return s.Internal.EthGetFilterLogs(p0, p1) } -func (s *FullNodeStub) EthGetFilterLogs(p0 context.Context, p1 EthFilterID) (*EthFilterResult, error) { +func (s *FullNodeStub) EthGetFilterLogs(p0 context.Context, p1 ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) { return nil, ErrNotSupported } -func (s *FullNodeStruct) EthGetLogs(p0 context.Context, p1 *EthFilterSpec) (*EthFilterResult, error) { +func (s *FullNodeStruct) EthGetLogs(p0 context.Context, p1 *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) { if s.Internal.EthGetLogs == nil { return nil, ErrNotSupported } return s.Internal.EthGetLogs(p0, p1) } -func (s *FullNodeStub) EthGetLogs(p0 context.Context, p1 *EthFilterSpec) (*EthFilterResult, error) { +func (s *FullNodeStub) EthGetLogs(p0 context.Context, p1 *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) { return nil, ErrNotSupported } -func (s *FullNodeStruct) EthGetStorageAt(p0 context.Context, p1 EthAddress, p2 EthBytes, p3 string) (EthBytes, error) { +func (s *FullNodeStruct) EthGetStorageAt(p0 context.Context, p1 ethtypes.EthAddress, p2 ethtypes.EthBytes, p3 string) (ethtypes.EthBytes, error) { if s.Internal.EthGetStorageAt == nil { - return *new(EthBytes), ErrNotSupported + return *new(ethtypes.EthBytes), ErrNotSupported } return s.Internal.EthGetStorageAt(p0, p1, p2, p3) } -func (s *FullNodeStub) EthGetStorageAt(p0 context.Context, p1 EthAddress, p2 EthBytes, p3 string) (EthBytes, error) { - return *new(EthBytes), ErrNotSupported +func (s *FullNodeStub) EthGetStorageAt(p0 context.Context, p1 ethtypes.EthAddress, p2 ethtypes.EthBytes, p3 string) (ethtypes.EthBytes, error) { + return *new(ethtypes.EthBytes), ErrNotSupported } -func (s *FullNodeStruct) EthGetTransactionByBlockHashAndIndex(p0 context.Context, p1 EthHash, p2 EthUint64) (EthTx, error) { +func (s *FullNodeStruct) EthGetTransactionByBlockHashAndIndex(p0 context.Context, p1 ethtypes.EthHash, p2 ethtypes.EthUint64) (ethtypes.EthTx, error) { if s.Internal.EthGetTransactionByBlockHashAndIndex == nil { - return *new(EthTx), ErrNotSupported + return *new(ethtypes.EthTx), ErrNotSupported } return s.Internal.EthGetTransactionByBlockHashAndIndex(p0, p1, p2) } -func (s *FullNodeStub) EthGetTransactionByBlockHashAndIndex(p0 context.Context, p1 EthHash, p2 EthUint64) (EthTx, error) { - return *new(EthTx), ErrNotSupported +func (s *FullNodeStub) EthGetTransactionByBlockHashAndIndex(p0 context.Context, p1 ethtypes.EthHash, p2 ethtypes.EthUint64) (ethtypes.EthTx, error) { + return *new(ethtypes.EthTx), ErrNotSupported } -func (s *FullNodeStruct) EthGetTransactionByBlockNumberAndIndex(p0 context.Context, p1 EthUint64, p2 EthUint64) (EthTx, error) { +func (s *FullNodeStruct) EthGetTransactionByBlockNumberAndIndex(p0 context.Context, p1 ethtypes.EthUint64, p2 ethtypes.EthUint64) (ethtypes.EthTx, error) { if s.Internal.EthGetTransactionByBlockNumberAndIndex == nil { - return *new(EthTx), ErrNotSupported + return *new(ethtypes.EthTx), ErrNotSupported } return s.Internal.EthGetTransactionByBlockNumberAndIndex(p0, p1, p2) } -func (s *FullNodeStub) EthGetTransactionByBlockNumberAndIndex(p0 context.Context, p1 EthUint64, p2 EthUint64) (EthTx, error) { - return *new(EthTx), ErrNotSupported +func (s *FullNodeStub) EthGetTransactionByBlockNumberAndIndex(p0 context.Context, p1 ethtypes.EthUint64, p2 ethtypes.EthUint64) (ethtypes.EthTx, error) { + return *new(ethtypes.EthTx), ErrNotSupported } -func (s *FullNodeStruct) EthGetTransactionByHash(p0 context.Context, p1 *EthHash) (*EthTx, error) { +func (s *FullNodeStruct) EthGetTransactionByHash(p0 context.Context, p1 *ethtypes.EthHash) (*ethtypes.EthTx, error) { if s.Internal.EthGetTransactionByHash == nil { return nil, ErrNotSupported } return s.Internal.EthGetTransactionByHash(p0, p1) } -func (s *FullNodeStub) EthGetTransactionByHash(p0 context.Context, p1 *EthHash) (*EthTx, error) { +func (s *FullNodeStub) EthGetTransactionByHash(p0 context.Context, p1 *ethtypes.EthHash) (*ethtypes.EthTx, error) { return nil, ErrNotSupported } -func (s *FullNodeStruct) EthGetTransactionCount(p0 context.Context, p1 EthAddress, p2 string) (EthUint64, error) { +func (s *FullNodeStruct) EthGetTransactionCount(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthUint64, error) { if s.Internal.EthGetTransactionCount == nil { - return *new(EthUint64), ErrNotSupported + return *new(ethtypes.EthUint64), ErrNotSupported } return s.Internal.EthGetTransactionCount(p0, p1, p2) } -func (s *FullNodeStub) EthGetTransactionCount(p0 context.Context, p1 EthAddress, p2 string) (EthUint64, error) { - return *new(EthUint64), ErrNotSupported +func (s *FullNodeStub) EthGetTransactionCount(p0 context.Context, p1 ethtypes.EthAddress, p2 string) (ethtypes.EthUint64, error) { + return *new(ethtypes.EthUint64), ErrNotSupported } -func (s *FullNodeStruct) EthGetTransactionReceipt(p0 context.Context, p1 EthHash) (*EthTxReceipt, error) { +func (s *FullNodeStruct) EthGetTransactionReceipt(p0 context.Context, p1 ethtypes.EthHash) (*EthTxReceipt, error) { if s.Internal.EthGetTransactionReceipt == nil { return nil, ErrNotSupported } return s.Internal.EthGetTransactionReceipt(p0, p1) } -func (s *FullNodeStub) EthGetTransactionReceipt(p0 context.Context, p1 EthHash) (*EthTxReceipt, error) { +func (s *FullNodeStub) EthGetTransactionReceipt(p0 context.Context, p1 ethtypes.EthHash) (*EthTxReceipt, error) { return nil, ErrNotSupported } -func (s *FullNodeStruct) EthMaxPriorityFeePerGas(p0 context.Context) (EthBigInt, error) { +func (s *FullNodeStruct) EthMaxPriorityFeePerGas(p0 context.Context) (ethtypes.EthBigInt, error) { if s.Internal.EthMaxPriorityFeePerGas == nil { - return *new(EthBigInt), ErrNotSupported + return *new(ethtypes.EthBigInt), ErrNotSupported } return s.Internal.EthMaxPriorityFeePerGas(p0) } -func (s *FullNodeStub) EthMaxPriorityFeePerGas(p0 context.Context) (EthBigInt, error) { - return *new(EthBigInt), ErrNotSupported +func (s *FullNodeStub) EthMaxPriorityFeePerGas(p0 context.Context) (ethtypes.EthBigInt, error) { + return *new(ethtypes.EthBigInt), ErrNotSupported } -func (s *FullNodeStruct) EthNewBlockFilter(p0 context.Context) (EthFilterID, error) { +func (s *FullNodeStruct) EthNewBlockFilter(p0 context.Context) (ethtypes.EthFilterID, error) { if s.Internal.EthNewBlockFilter == nil { - return *new(EthFilterID), ErrNotSupported + return *new(ethtypes.EthFilterID), ErrNotSupported } return s.Internal.EthNewBlockFilter(p0) } -func (s *FullNodeStub) EthNewBlockFilter(p0 context.Context) (EthFilterID, error) { - return *new(EthFilterID), ErrNotSupported +func (s *FullNodeStub) EthNewBlockFilter(p0 context.Context) (ethtypes.EthFilterID, error) { + return *new(ethtypes.EthFilterID), ErrNotSupported } -func (s *FullNodeStruct) EthNewFilter(p0 context.Context, p1 *EthFilterSpec) (EthFilterID, error) { +func (s *FullNodeStruct) EthNewFilter(p0 context.Context, p1 *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) { if s.Internal.EthNewFilter == nil { - return *new(EthFilterID), ErrNotSupported + return *new(ethtypes.EthFilterID), ErrNotSupported } return s.Internal.EthNewFilter(p0, p1) } -func (s *FullNodeStub) EthNewFilter(p0 context.Context, p1 *EthFilterSpec) (EthFilterID, error) { - return *new(EthFilterID), ErrNotSupported +func (s *FullNodeStub) EthNewFilter(p0 context.Context, p1 *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) { + return *new(ethtypes.EthFilterID), ErrNotSupported } -func (s *FullNodeStruct) EthNewPendingTransactionFilter(p0 context.Context) (EthFilterID, error) { +func (s *FullNodeStruct) EthNewPendingTransactionFilter(p0 context.Context) (ethtypes.EthFilterID, error) { if s.Internal.EthNewPendingTransactionFilter == nil { - return *new(EthFilterID), ErrNotSupported + return *new(ethtypes.EthFilterID), ErrNotSupported } return s.Internal.EthNewPendingTransactionFilter(p0) } -func (s *FullNodeStub) EthNewPendingTransactionFilter(p0 context.Context) (EthFilterID, error) { - return *new(EthFilterID), ErrNotSupported +func (s *FullNodeStub) EthNewPendingTransactionFilter(p0 context.Context) (ethtypes.EthFilterID, error) { + return *new(ethtypes.EthFilterID), ErrNotSupported } -func (s *FullNodeStruct) EthProtocolVersion(p0 context.Context) (EthUint64, error) { +func (s *FullNodeStruct) EthProtocolVersion(p0 context.Context) (ethtypes.EthUint64, error) { if s.Internal.EthProtocolVersion == nil { - return *new(EthUint64), ErrNotSupported + return *new(ethtypes.EthUint64), ErrNotSupported } return s.Internal.EthProtocolVersion(p0) } -func (s *FullNodeStub) EthProtocolVersion(p0 context.Context) (EthUint64, error) { - return *new(EthUint64), ErrNotSupported +func (s *FullNodeStub) EthProtocolVersion(p0 context.Context) (ethtypes.EthUint64, error) { + return *new(ethtypes.EthUint64), ErrNotSupported } -func (s *FullNodeStruct) EthSendRawTransaction(p0 context.Context, p1 EthBytes) (EthHash, error) { +func (s *FullNodeStruct) EthSendRawTransaction(p0 context.Context, p1 ethtypes.EthBytes) (ethtypes.EthHash, error) { if s.Internal.EthSendRawTransaction == nil { - return *new(EthHash), ErrNotSupported + return *new(ethtypes.EthHash), ErrNotSupported } return s.Internal.EthSendRawTransaction(p0, p1) } -func (s *FullNodeStub) EthSendRawTransaction(p0 context.Context, p1 EthBytes) (EthHash, error) { - return *new(EthHash), ErrNotSupported +func (s *FullNodeStub) EthSendRawTransaction(p0 context.Context, p1 ethtypes.EthBytes) (ethtypes.EthHash, error) { + return *new(ethtypes.EthHash), ErrNotSupported } -func (s *FullNodeStruct) EthSubscribe(p0 context.Context, p1 string, p2 *EthSubscriptionParams) (<-chan EthSubscriptionResponse, error) { +func (s *FullNodeStruct) EthSubscribe(p0 context.Context, p1 string, p2 *ethtypes.EthSubscriptionParams) (<-chan ethtypes.EthSubscriptionResponse, error) { if s.Internal.EthSubscribe == nil { return nil, ErrNotSupported } return s.Internal.EthSubscribe(p0, p1, p2) } -func (s *FullNodeStub) EthSubscribe(p0 context.Context, p1 string, p2 *EthSubscriptionParams) (<-chan EthSubscriptionResponse, error) { +func (s *FullNodeStub) EthSubscribe(p0 context.Context, p1 string, p2 *ethtypes.EthSubscriptionParams) (<-chan ethtypes.EthSubscriptionResponse, error) { return nil, ErrNotSupported } -func (s *FullNodeStruct) EthUninstallFilter(p0 context.Context, p1 EthFilterID) (bool, error) { +func (s *FullNodeStruct) EthUninstallFilter(p0 context.Context, p1 ethtypes.EthFilterID) (bool, error) { if s.Internal.EthUninstallFilter == nil { return false, ErrNotSupported } return s.Internal.EthUninstallFilter(p0, p1) } -func (s *FullNodeStub) EthUninstallFilter(p0 context.Context, p1 EthFilterID) (bool, error) { +func (s *FullNodeStub) EthUninstallFilter(p0 context.Context, p1 ethtypes.EthFilterID) (bool, error) { return false, ErrNotSupported } -func (s *FullNodeStruct) EthUnsubscribe(p0 context.Context, p1 EthSubscriptionID) (bool, error) { +func (s *FullNodeStruct) EthUnsubscribe(p0 context.Context, p1 ethtypes.EthSubscriptionID) (bool, error) { if s.Internal.EthUnsubscribe == nil { return false, ErrNotSupported } return s.Internal.EthUnsubscribe(p0, p1) } -func (s *FullNodeStub) EthUnsubscribe(p0 context.Context, p1 EthSubscriptionID) (bool, error) { +func (s *FullNodeStub) EthUnsubscribe(p0 context.Context, p1 ethtypes.EthSubscriptionID) (bool, error) { return false, ErrNotSupported } diff --git a/build/openrpc/full.json.gz b/build/openrpc/full.json.gz index 850d11dd027..df5b7dd956b 100644 Binary files a/build/openrpc/full.json.gz and b/build/openrpc/full.json.gz differ diff --git a/chain/types/ethtypes/eth_types.go b/chain/types/ethtypes/eth_types.go index 69546844b65..cb629f8d54e 100644 --- a/chain/types/ethtypes/eth_types.go +++ b/chain/types/ethtypes/eth_types.go @@ -19,6 +19,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/big" builtintypes "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/lotus/build" ) @@ -191,24 +192,6 @@ func (c *EthCall) UnmarshalJSON(b []byte) error { return nil } -type EthTxReceipt struct { - TransactionHash EthHash `json:"transactionHash"` - TransactionIndex EthUint64 `json:"transactionIndex"` - BlockHash EthHash `json:"blockHash"` - BlockNumber EthUint64 `json:"blockNumber"` - From EthAddress `json:"from"` - To *EthAddress `json:"to"` - StateRoot EthHash `json:"root"` - Status EthUint64 `json:"status"` - ContractAddress *EthAddress `json:"contractAddress"` - CumulativeGasUsed EthUint64 `json:"cumulativeGasUsed"` - GasUsed EthUint64 `json:"gasUsed"` - EffectiveGasPrice EthBigInt `json:"effectiveGasPrice"` - LogsBloom EthBytes `json:"logsBloom"` - Logs []EthLog `json:"logs"` - Type EthUint64 `json:"type"` -} - const ( EthAddressLength = 20 EthHashLength = 32 diff --git a/chain/types/message_receipt.go b/chain/types/message_receipt.go index d133c84ce47..0507ac576f3 100644 --- a/chain/types/message_receipt.go +++ b/chain/types/message_receipt.go @@ -54,6 +54,6 @@ func (mr *MessageReceipt) Version() MessageReceiptVersion { } func (mr *MessageReceipt) Equals(o *MessageReceipt) bool { - return mr.version == mr.version && mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed && + return mr.version == o.version && mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed && (mr.EventsRoot == o.EventsRoot || (mr.EventsRoot != nil && o.EventsRoot != nil && *mr.EventsRoot == *o.EventsRoot)) } diff --git a/cli/chain.go b/cli/chain.go index 4da3273d5ac..dced1a1f8a8 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -1784,6 +1784,9 @@ var ChainInvokeEVMCmd = &cli.Command{ if err := evt.UnmarshalCBOR(bytes.NewReader(deferred.Raw)); err != nil { return err } + if err != nil { + return err + } fmt.Printf("\tEmitter ID: %s\n", evt.Emitter) for _, e := range evt.Entries { value, err := cbg.ReadByteArray(bytes.NewBuffer(e.Value), uint64(len(e.Value))) diff --git a/documentation/en/api-v1-unstable-methods.md b/documentation/en/api-v1-unstable-methods.md index ce6e4eca157..2f9ccf0d017 100644 --- a/documentation/en/api-v1-unstable-methods.md +++ b/documentation/en/api-v1-unstable-methods.md @@ -2443,6 +2443,7 @@ Response: "blockNumber": "0x0", "from": "0x0707070707070707070707070707070707070707", "to": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031", + "root": "0x0000000000000000000000000000000000000000000000000000000000000000", "status": "0x5", "contractAddress": null, "cumulativeGasUsed": "0x0", diff --git a/extern/filecoin-ffi b/extern/filecoin-ffi index 02ebb2d6169..21217875e44 160000 --- a/extern/filecoin-ffi +++ b/extern/filecoin-ffi @@ -1 +1 @@ -Subproject commit 02ebb2d6169131cfe489e1063e896f14982c463d +Subproject commit 21217875e44f50c3851615de3ced674a6fdc386c diff --git a/itests/eth_filter_test.go b/itests/eth_filter_test.go index edb7c6a87fe..afc3c97ccf0 100644 --- a/itests/eth_filter_test.go +++ b/itests/eth_filter_test.go @@ -12,6 +12,8 @@ import ( "testing" "time" + "github.com/filecoin-project/lotus/chain/types/ethtypes" + "github.com/stretchr/testify/require" "golang.org/x/xerrors" @@ -211,7 +213,7 @@ func TestEthNewFilterCatchAll(t *testing.T) { t.Logf("actor ID address is %s", idAddr) // install filter - filterID, err := client.EthNewFilter(ctx, &api.EthFilterSpec{}) + filterID, err := client.EthNewFilter(ctx, ðtypes.EthFilterSpec{}) require.NoError(err) const iterations = 10 @@ -271,9 +273,9 @@ func TestEthNewFilterCatchAll(t *testing.T) { t.Errorf("timeout to wait for pack messages") } - received := make(map[api.EthHash]msgInTipset) + received := make(map[ethtypes.EthHash]msgInTipset) for m := range msgChan { - eh, err := api.NewEthHashFromCid(m.msg.Cid) + eh, err := ethtypes.NewEthHashFromCid(m.msg.Cid) require.NoError(err) received[eh] = m } @@ -285,7 +287,7 @@ func TestEthNewFilterCatchAll(t *testing.T) { actor, err := client.StateGetActor(ctx, idAddr, ts.Key()) require.NoError(err) require.NotNil(actor.Address) - ethContractAddr, err := api.EthAddressFromFilecoinAddress(*actor.Address) + ethContractAddr, err := ethtypes.EthAddressFromFilecoinAddress(*actor.Address) require.NoError(err) // collect filter results @@ -295,11 +297,11 @@ func TestEthNewFilterCatchAll(t *testing.T) { // expect to have seen iteration number of events require.Equal(iterations, len(res.Results)) - topic1 := api.EthBytes(leftpad32([]byte{0x11, 0x11})) - topic2 := api.EthBytes(leftpad32([]byte{0x22, 0x22})) - topic3 := api.EthBytes(leftpad32([]byte{0x33, 0x33})) - topic4 := api.EthBytes(leftpad32([]byte{0x44, 0x44})) - data1 := api.EthBytes(leftpad32([]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88})) + topic1 := ethtypes.EthBytes(leftpad32([]byte{0x11, 0x11})) + topic2 := ethtypes.EthBytes(leftpad32([]byte{0x22, 0x22})) + topic3 := ethtypes.EthBytes(leftpad32([]byte{0x33, 0x33})) + topic4 := ethtypes.EthBytes(leftpad32([]byte{0x44, 0x44})) + data1 := ethtypes.EthBytes(leftpad32([]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88})) for _, r := range res.Results { // since response is a union and Go doesn't support them well, go-jsonrpc won't give us typed results @@ -310,7 +312,7 @@ func TestEthNewFilterCatchAll(t *testing.T) { require.NoError(err) require.Equal(ethContractAddr, elog.Address, "event address") - require.Equal(api.EthUint64(0), elog.TransactionIndex, "transaction index") // only one message per tipset + require.Equal(ethtypes.EthUint64(0), elog.TransactionIndex, "transaction index") // only one message per tipset msg, exists := received[elog.TransactionHash] require.True(exists, "message seen on chain") @@ -318,7 +320,7 @@ func TestEthNewFilterCatchAll(t *testing.T) { tsCid, err := msg.ts.Key().Cid() require.NoError(err) - tsCidHash, err := api.NewEthHashFromCid(tsCid) + tsCidHash, err := ethtypes.NewEthHashFromCid(tsCid) require.NoError(err) require.Equal(tsCidHash, elog.BlockHash, "block hash") @@ -334,18 +336,18 @@ func TestEthNewFilterCatchAll(t *testing.T) { } } -func ParseEthLog(in map[string]interface{}) (*api.EthLog, error) { - el := &api.EthLog{} +func ParseEthLog(in map[string]interface{}) (*ethtypes.EthLog, error) { + el := ðtypes.EthLog{} - ethHash := func(k string, v interface{}) (api.EthHash, error) { + ethHash := func(k string, v interface{}) (ethtypes.EthHash, error) { s, ok := v.(string) if !ok { - return api.EthHash{}, xerrors.Errorf(k + " not a string") + return ethtypes.EthHash{}, xerrors.Errorf(k + " not a string") } - return api.EthHashFromHex(s) + return ethtypes.EthHashFromHex(s) } - ethUint64 := func(k string, v interface{}) (api.EthUint64, error) { + ethUint64 := func(k string, v interface{}) (ethtypes.EthUint64, error) { s, ok := v.(string) if !ok { return 0, xerrors.Errorf(k + " not a string") @@ -354,7 +356,7 @@ func ParseEthLog(in map[string]interface{}) (*api.EthLog, error) { if err != nil { return 0, err } - return api.EthUint64(parsedInt), nil + return ethtypes.EthUint64(parsedInt), nil } var err error @@ -379,7 +381,7 @@ func ParseEthLog(in map[string]interface{}) (*api.EthLog, error) { if !ok { return nil, xerrors.Errorf(k + ": not a string") } - el.Address, err = api.EthAddressFromHex(s) + el.Address, err = ethtypes.EthAddressFromHex(s) if err != nil { return nil, xerrors.Errorf("%s: %w", k, err) } @@ -453,7 +455,7 @@ type msgInTipset struct { reverted bool } -func invokeContractAndWaitUntilAllOnChain(t *testing.T, client *kit.TestFullNode, iterations int) (api.EthAddress, map[api.EthHash]msgInTipset) { +func invokeContractAndWaitUntilAllOnChain(t *testing.T, client *kit.TestFullNode, iterations int) (ethtypes.EthAddress, map[ethtypes.EthHash]msgInTipset) { require := require.New(t) ctx, cancel := context.WithTimeout(context.Background(), time.Minute) @@ -525,9 +527,9 @@ func invokeContractAndWaitUntilAllOnChain(t *testing.T, client *kit.TestFullNode t.Errorf("timeout to wait for pack messages") } - received := make(map[api.EthHash]msgInTipset) + received := make(map[ethtypes.EthHash]msgInTipset) for m := range msgChan { - eh, err := api.NewEthHashFromCid(m.msg.Cid) + eh, err := ethtypes.NewEthHashFromCid(m.msg.Cid) require.NoError(err) received[eh] = m } @@ -539,7 +541,7 @@ func invokeContractAndWaitUntilAllOnChain(t *testing.T, client *kit.TestFullNode actor, err := client.StateGetActor(ctx, idAddr, head.Key()) require.NoError(err) require.NotNil(actor.Address) - ethContractAddr, err := api.EthAddressFromFilecoinAddress(*actor.Address) + ethContractAddr, err := ethtypes.EthAddressFromFilecoinAddress(*actor.Address) require.NoError(err) return ethContractAddr, received @@ -558,16 +560,16 @@ func TestEthGetLogsAll(t *testing.T) { ethContractAddr, received := invokeContractAndWaitUntilAllOnChain(t, client, 10) - topic1 := api.EthBytes(leftpad32([]byte{0x11, 0x11})) - topic2 := api.EthBytes(leftpad32([]byte{0x22, 0x22})) - topic3 := api.EthBytes(leftpad32([]byte{0x33, 0x33})) - topic4 := api.EthBytes(leftpad32([]byte{0x44, 0x44})) - data1 := api.EthBytes(leftpad32([]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88})) + topic1 := ethtypes.EthBytes(leftpad32([]byte{0x11, 0x11})) + topic2 := ethtypes.EthBytes(leftpad32([]byte{0x22, 0x22})) + topic3 := ethtypes.EthBytes(leftpad32([]byte{0x33, 0x33})) + topic4 := ethtypes.EthBytes(leftpad32([]byte{0x44, 0x44})) + data1 := ethtypes.EthBytes(leftpad32([]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88})) pstring := func(s string) *string { return &s } // get all logs - res, err := client.EthGetLogs(context.Background(), &api.EthFilterSpec{ + res, err := client.EthGetLogs(context.Background(), ðtypes.EthFilterSpec{ FromBlock: pstring("0x0"), }) require.NoError(err) @@ -584,7 +586,7 @@ func TestEthGetLogsAll(t *testing.T) { require.NoError(err) require.Equal(ethContractAddr, elog.Address, "event address") - require.Equal(api.EthUint64(0), elog.TransactionIndex, "transaction index") // only one message per tipset + require.Equal(ethtypes.EthUint64(0), elog.TransactionIndex, "transaction index") // only one message per tipset msg, exists := received[elog.TransactionHash] require.True(exists, "message seen on chain") @@ -592,7 +594,7 @@ func TestEthGetLogsAll(t *testing.T) { tsCid, err := msg.ts.Key().Cid() require.NoError(err) - tsCidHash, err := api.NewEthHashFromCid(tsCid) + tsCidHash, err := ethtypes.NewEthHashFromCid(tsCid) require.NoError(err) require.Equal(tsCidHash, elog.BlockHash, "block hash") @@ -623,14 +625,14 @@ func TestEthGetLogsByTopic(t *testing.T) { ethContractAddr, received := invokeContractAndWaitUntilAllOnChain(t, client, invocations) - topic1 := api.EthBytes(leftpad32([]byte{0x11, 0x11})) - topic2 := api.EthBytes(leftpad32([]byte{0x22, 0x22})) - topic3 := api.EthBytes(leftpad32([]byte{0x33, 0x33})) - topic4 := api.EthBytes(leftpad32([]byte{0x44, 0x44})) - data1 := api.EthBytes(leftpad32([]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88})) + topic1 := ethtypes.EthBytes(leftpad32([]byte{0x11, 0x11})) + topic2 := ethtypes.EthBytes(leftpad32([]byte{0x22, 0x22})) + topic3 := ethtypes.EthBytes(leftpad32([]byte{0x33, 0x33})) + topic4 := ethtypes.EthBytes(leftpad32([]byte{0x44, 0x44})) + data1 := ethtypes.EthBytes(leftpad32([]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88})) // find log by known topic1 - var spec api.EthFilterSpec + var spec ethtypes.EthFilterSpec err := json.Unmarshal([]byte(`{"fromBlock":"0x0","topics":["0x0000000000000000000000000000000000000000000000000000000000001111"]}`), &spec) require.NoError(err) @@ -648,7 +650,7 @@ func TestEthGetLogsByTopic(t *testing.T) { require.NoError(err) require.Equal(ethContractAddr, elog.Address, "event address") - require.Equal(api.EthUint64(0), elog.TransactionIndex, "transaction index") // only one message per tipset + require.Equal(ethtypes.EthUint64(0), elog.TransactionIndex, "transaction index") // only one message per tipset msg, exists := received[elog.TransactionHash] require.True(exists, "message seen on chain") @@ -656,7 +658,7 @@ func TestEthGetLogsByTopic(t *testing.T) { tsCid, err := msg.ts.Key().Cid() require.NoError(err) - tsCidHash, err := api.NewEthHashFromCid(tsCid) + tsCidHash, err := ethtypes.NewEthHashFromCid(tsCid) require.NoError(err) require.Equal(tsCidHash, elog.BlockHash, "block hash") @@ -704,7 +706,7 @@ func TestEthSubscribeLogs(t *testing.T) { respCh, err := client.EthSubscribe(ctx, "logs", nil) require.NoError(err) - subResponses := []api.EthSubscriptionResponse{} + subResponses := []ethtypes.EthSubscriptionResponse{} go func() { for resp := range respCh { subResponses = append(subResponses, resp) @@ -774,9 +776,9 @@ func TestEthSubscribeLogs(t *testing.T) { require.True(ok, "unsubscribed") } - received := make(map[api.EthHash]msgInTipset) + received := make(map[ethtypes.EthHash]msgInTipset) for m := range msgChan { - eh, err := api.NewEthHashFromCid(m.msg.Cid) + eh, err := ethtypes.NewEthHashFromCid(m.msg.Cid) require.NoError(err) received[eh] = m }