From 70c210a1832729f836c16e1fd50880f7fa59ef57 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:08:40 +0800 Subject: [PATCH] chore: make compatible-all --- app/submodule/eth/dummy.go | 4 ++-- app/submodule/eth/eth_api.go | 18 ++++-------------- venus-devtool/go.mod | 4 ++-- venus-devtool/go.sum | 8 ++++---- venus-shared/api/chain/v1/eth.go | 2 +- .../api/chain/v1/mock/mock_fullnode.go | 4 ++-- venus-shared/api/chain/v1/proxy_gen.go | 4 ++-- .../compatible-checks/api-checksum.txt | 3 ++- venus-shared/compatible-checks/api-diff.txt | 2 -- venus-shared/compatible-checks/api-perm.txt | 1 - venus-shared/types/api_types.go | 14 +++++++------- 11 files changed, 26 insertions(+), 38 deletions(-) diff --git a/app/submodule/eth/dummy.go b/app/submodule/eth/dummy.go index a9b537c550..81a626ed0a 100644 --- a/app/submodule/eth/dummy.go +++ b/app/submodule/eth/dummy.go @@ -53,8 +53,8 @@ func (e *ethAPIDummy) EthGetBlockByHash(ctx context.Context, blkHash types.EthHa return types.EthBlock{}, ErrModuleDisabled } -func (e *ethAPIDummy) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (*types.EthBlock, error) { - return nil, ErrModuleDisabled +func (e *ethAPIDummy) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (types.EthBlock, error) { + return types.EthBlock{}, ErrModuleDisabled } func (e *ethAPIDummy) EthGetTransactionByHash(ctx context.Context, txHash *types.EthHash) (*types.EthTx, error) { diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index 4fbe107fb3..d5d89ff144 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -273,23 +273,13 @@ func (a *ethAPI) parseBlkParam(ctx context.Context, blkParam string, strict bool } } -func (a *ethAPI) EthGetBlockByNumber(ctx context.Context, blkParam string, fullTxInfo bool) (*types.EthBlock, error) { - // Get the tipset for the specified block parameter - ts, err := a.parseBlkParam(ctx, blkParam, true) +func (a *ethAPI) EthGetBlockByNumber(ctx context.Context, blkParam string, fullTxInfo bool) (types.EthBlock, error) { + ts, err := getTipsetByBlockNumber(ctx, a.em.chainModule.ChainReader, blkParam, true) if err != nil { - if err == ErrNullRound { - // Return nil for null rounds - return nil, nil - } - return nil, fmt.Errorf("failed to get tipset: %w", err) - } - // Create an Ethereum block from the Filecoin tipset - block, err := newEthBlockFromFilecoinTipSet(ctx, ts, fullTxInfo, a.em.chainModule.MessageStore, a.em.chainModule.Stmgr) - if err != nil { - return nil, fmt.Errorf("failed to create Ethereum block: %w", err) + return types.EthBlock{}, err } - return &block, nil + return newEthBlockFromFilecoinTipSet(ctx, ts, fullTxInfo, a.em.chainModule.MessageStore, a.em.chainModule.Stmgr) } func (a *ethAPI) EthGetTransactionByHash(ctx context.Context, txHash *types.EthHash) (*types.EthTx, error) { diff --git a/venus-devtool/go.mod b/venus-devtool/go.mod index ce5240254a..d716734a0a 100644 --- a/venus-devtool/go.mod +++ b/venus-devtool/go.mod @@ -8,11 +8,11 @@ require ( github.com/filecoin-project/go-address v1.2.0 github.com/filecoin-project/go-bitfield v0.2.4 github.com/filecoin-project/go-data-transfer/v2 v2.0.0-rc7 - github.com/filecoin-project/go-f3 v0.7.0 + github.com/filecoin-project/go-f3 v0.7.1 github.com/filecoin-project/go-fil-markets v1.28.3 github.com/filecoin-project/go-jsonrpc v0.6.0 github.com/filecoin-project/go-state-types v0.15.0-rc1 - github.com/filecoin-project/lotus v1.30.0-rc2 + github.com/filecoin-project/lotus v1.30.0-rc3 github.com/filecoin-project/venus v0.0.0-00010101000000-000000000000 github.com/google/uuid v1.6.0 github.com/ipfs/go-block-format v0.2.0 diff --git a/venus-devtool/go.sum b/venus-devtool/go.sum index b82a5ef687..7950fdd4cc 100644 --- a/venus-devtool/go.sum +++ b/venus-devtool/go.sum @@ -250,8 +250,8 @@ github.com/filecoin-project/go-data-transfer/v2 v2.0.0-rc7 h1:v+zJS5B6pA3ptWZS4t github.com/filecoin-project/go-data-transfer/v2 v2.0.0-rc7/go.mod h1:V3Y4KbttaCwyg1gwkP7iai8CbQx4mZUGjd3h9GZWLKE= github.com/filecoin-project/go-ds-versioning v0.1.2 h1:to4pTadv3IeV1wvgbCbN6Vqd+fu+7tveXgv/rCEZy6w= github.com/filecoin-project/go-ds-versioning v0.1.2/go.mod h1:C9/l9PnB1+mwPa26BBVpCjG/XQCB0yj/q5CK2J8X1I4= -github.com/filecoin-project/go-f3 v0.7.0 h1:JNo39SAELT5hEn+rmQZbSJQBJfmGJtp70RfyWJrIayY= -github.com/filecoin-project/go-f3 v0.7.0/go.mod h1:QoxuoK4aktNZD1R/unlhNbhV6TnlNTAbA/QODCnAjak= +github.com/filecoin-project/go-f3 v0.7.1 h1:3xCxKgVtlQVTZooeUWIL1isk5MK/BGcdrhZlR0ZbIIU= +github.com/filecoin-project/go-f3 v0.7.1/go.mod h1:QoxuoK4aktNZD1R/unlhNbhV6TnlNTAbA/QODCnAjak= github.com/filecoin-project/go-fil-commcid v0.2.0 h1:B+5UX8XGgdg/XsdUpST4pEBviKkFOw+Fvl2bLhSKGpI= github.com/filecoin-project/go-fil-commcid v0.2.0/go.mod h1:8yigf3JDIil+/WpqR5zoKyP0jBPCOGtEqq/K1CcMy9Q= github.com/filecoin-project/go-fil-commp-hashhash v0.2.0 h1:HYIUugzjq78YvV3vC6rL95+SfC/aSTVSnZSZiDV5pCk= @@ -284,8 +284,8 @@ github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4 github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= github.com/filecoin-project/go-statestore v0.2.0 h1:cRRO0aPLrxKQCZ2UOQbzFGn4WDNdofHZoGPjfNaAo5Q= github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lIXjLlYyPor80aU7t7a/Kspo= -github.com/filecoin-project/lotus v1.30.0-rc2 h1:LLzMnb6dqxN5QHj4IAvDpFPYp8InXY8fvcTGr4uhpnw= -github.com/filecoin-project/lotus v1.30.0-rc2/go.mod h1:gXQFTK6OpJIjg2yWnYsf0awszREDffb/X+LPCDmZkwI= +github.com/filecoin-project/lotus v1.30.0-rc3 h1:pRMWd2TMWJbpWfj4jF4lbrnb7LD8+dcUonR0C0bLRw0= +github.com/filecoin-project/lotus v1.30.0-rc3/go.mod h1:A48LDh6u4h60SpcUQHgzKS66qA35hJNHut6uDvTO6ew= github.com/filecoin-project/pubsub v1.0.0 h1:ZTmT27U07e54qV1mMiQo4HDr0buo8I1LDHBYLXlsNXM= github.com/filecoin-project/pubsub v1.0.0/go.mod h1:GkpB33CcUtUNrLPhJgfdy4FDx4OMNR9k+46DHx/Lqrg= github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao= diff --git a/venus-shared/api/chain/v1/eth.go b/venus-shared/api/chain/v1/eth.go index 4ffd177113..a5c0693a3e 100644 --- a/venus-shared/api/chain/v1/eth.go +++ b/venus-shared/api/chain/v1/eth.go @@ -32,7 +32,7 @@ type IETH interface { EthGetBlockTransactionCountByHash(ctx context.Context, blkHash types.EthHash) (types.EthUint64, error) //perm:read EthGetBlockByHash(ctx context.Context, blkHash types.EthHash, fullTxInfo bool) (types.EthBlock, error) //perm:read - EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (*types.EthBlock, error) //perm:read + EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (types.EthBlock, error) //perm:read EthGetTransactionByHash(ctx context.Context, txHash *types.EthHash) (*types.EthTx, error) //perm:read EthGetTransactionByHashLimited(ctx context.Context, txHash *types.EthHash, limit abi.ChainEpoch) (*types.EthTx, error) //perm:read EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*types.EthHash, error) //perm:read diff --git a/venus-shared/api/chain/v1/mock/mock_fullnode.go b/venus-shared/api/chain/v1/mock/mock_fullnode.go index ba26845c47..32cdd84e26 100644 --- a/venus-shared/api/chain/v1/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v1/mock/mock_fullnode.go @@ -610,10 +610,10 @@ func (mr *MockFullNodeMockRecorder) EthGetBlockByHash(arg0, arg1, arg2 interface } // EthGetBlockByNumber mocks base method. -func (m *MockFullNode) EthGetBlockByNumber(arg0 context.Context, arg1 string, arg2 bool) (*types.EthBlock, error) { +func (m *MockFullNode) EthGetBlockByNumber(arg0 context.Context, arg1 string, arg2 bool) (types.EthBlock, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EthGetBlockByNumber", arg0, arg1, arg2) - ret0, _ := ret[0].(*types.EthBlock) + ret0, _ := ret[0].(types.EthBlock) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/venus-shared/api/chain/v1/proxy_gen.go b/venus-shared/api/chain/v1/proxy_gen.go index 59e7288dba..a8787434df 100644 --- a/venus-shared/api/chain/v1/proxy_gen.go +++ b/venus-shared/api/chain/v1/proxy_gen.go @@ -884,7 +884,7 @@ type IETHStruct struct { EthGasPrice func(ctx context.Context) (types.EthBigInt, error) `perm:"read"` EthGetBalance func(ctx context.Context, address types.EthAddress, blkParam types.EthBlockNumberOrHash) (types.EthBigInt, error) `perm:"read"` EthGetBlockByHash func(ctx context.Context, blkHash types.EthHash, fullTxInfo bool) (types.EthBlock, error) `perm:"read"` - EthGetBlockByNumber func(ctx context.Context, blkNum string, fullTxInfo bool) (*types.EthBlock, error) `perm:"read"` + EthGetBlockByNumber func(ctx context.Context, blkNum string, fullTxInfo bool) (types.EthBlock, error) `perm:"read"` EthGetBlockReceipts func(ctx context.Context, blkParam types.EthBlockNumberOrHash) ([]*types.EthTxReceipt, error) `perm:"read"` EthGetBlockReceiptsLimited func(ctx context.Context, blkParam types.EthBlockNumberOrHash, limit abi.ChainEpoch) ([]*types.EthTxReceipt, error) `perm:"read"` EthGetBlockTransactionCountByHash func(ctx context.Context, blkHash types.EthHash) (types.EthUint64, error) `perm:"read"` @@ -945,7 +945,7 @@ func (s *IETHStruct) EthGetBalance(p0 context.Context, p1 types.EthAddress, p2 t func (s *IETHStruct) EthGetBlockByHash(p0 context.Context, p1 types.EthHash, p2 bool) (types.EthBlock, error) { return s.Internal.EthGetBlockByHash(p0, p1, p2) } -func (s *IETHStruct) EthGetBlockByNumber(p0 context.Context, p1 string, p2 bool) (*types.EthBlock, error) { +func (s *IETHStruct) EthGetBlockByNumber(p0 context.Context, p1 string, p2 bool) (types.EthBlock, error) { return s.Internal.EthGetBlockByNumber(p0, p1, p2) } func (s *IETHStruct) EthGetBlockReceipts(p0 context.Context, p1 types.EthBlockNumberOrHash) ([]*types.EthTxReceipt, error) { diff --git a/venus-shared/compatible-checks/api-checksum.txt b/venus-shared/compatible-checks/api-checksum.txt index 9e5f1e77ac..b95f352a00 100644 --- a/venus-shared/compatible-checks/api-checksum.txt +++ b/venus-shared/compatible-checks/api-checksum.txt @@ -242,7 +242,7 @@ api.FullNode: EthGasPrice: In=1, Out=2, CheckSum=e2f5588dddfc36a9cdef0fad6f4db93e EthGetBalance: In=3, Out=2, CheckSum=80912669b93ebbd53024dbc6b4f39d94 EthGetBlockByHash: In=3, Out=2, CheckSum=606bca6c962d8e2d4e0b8bb14e8fa0a9 - EthGetBlockByNumber: In=3, Out=2, CheckSum=06d77a6c80b11ea456c9207a10459abe + EthGetBlockByNumber: In=3, Out=2, CheckSum=9d82b96bb03c2de85dc7a31e7d4c45d2 EthGetBlockReceipts: In=2, Out=2, CheckSum=e2817ae4c1a093339a0fd251150de95a EthGetBlockReceiptsLimited: In=3, Out=2, CheckSum=f5992631f35a54511e4a494b84e66b33 EthGetBlockTransactionCountByHash: In=2, Out=2, CheckSum=aea75f99eaccb878b97512a29568c204 @@ -284,6 +284,7 @@ api.FullNode: F3GetOrRenewParticipationTicket: In=4, Out=2, CheckSum=f025742e52bb59e839db5182af1a829a F3GetProgress: In=1, Out=2, CheckSum=47af12f74b39fcca4877ebed425b6558 F3IsRunning: In=1, Out=2, CheckSum=de305c848673f2b095e6cfdecdaf85c3 + F3ListParticipants: In=1, Out=2, CheckSum=9811f07369b67dc95919328bed3b6a62 F3Participate: In=2, Out=2, CheckSum=a09f021cb508b413dddcfae6eb535db4 FilecoinAddressToEthAddress: In=2, Out=2, CheckSum=59affa319c910c555ee5f1d194049f53 GasEstimateFeeCap: In=4, Out=2, CheckSum=0fcac02de1d21c9ac6e10696a6499eba diff --git a/venus-shared/compatible-checks/api-diff.txt b/venus-shared/compatible-checks/api-diff.txt index a7a3c14816..c9803f0ff0 100644 --- a/venus-shared/compatible-checks/api-diff.txt +++ b/venus-shared/compatible-checks/api-diff.txt @@ -106,8 +106,6 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v1.FullNode <> github.c - Discover - EthSendRawTransactionUntrusted > EthTraceReplayBlockTransactions {[func(context.Context, string, []string) ([]*types.EthTraceReplayBlockTransaction, error) <> func(context.Context, string, []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error)] base=func out type: #0 input; nested={[[]*types.EthTraceReplayBlockTransaction <> []*ethtypes.EthTraceReplayBlockTransaction] base=slice element; nested={[*types.EthTraceReplayBlockTransaction <> *ethtypes.EthTraceReplayBlockTransaction] base=pointed type; nested={[types.EthTraceReplayBlockTransaction <> ethtypes.EthTraceReplayBlockTransaction] base=struct field; nested={[types.EthTraceReplayBlockTransaction <> ethtypes.EthTraceReplayBlockTransaction] base=exported field name: #4 field, VMTrace != VmTrace; nested=nil}}}}} - + F3ListParticipants - > F3Participate {[func(context.Context, types.F3ParticipationTicket) (types.F3ParticipationLease, error) <> func(context.Context, api.F3ParticipationTicket) (api.F3ParticipationLease, error)] base=func out type: #0 input; nested={[types.F3ParticipationLease <> api.F3ParticipationLease] base=struct field; nested={[types.F3ParticipationLease <> api.F3ParticipationLease] base=exported field type: #1 field named Issuer; nested={[string <> peer.ID] base=codec marshaler implementations for codec JSON: false != true; nested=nil}}}} > FilecoinAddressToEthAddress {[func(context.Context, address.Address) (types.EthAddress, error) <> func(context.Context, jsonrpc.RawParams) (ethtypes.EthAddress, error)] base=func in type: #1 input; nested={[address.Address <> jsonrpc.RawParams] base=type kinds: struct != slice; nested=nil}} + GasBatchEstimateMessageGas > GasEstimateMessageGas {[func(context.Context, *types.Message, *types.MessageSendSpec, types.TipSetKey) (*types.Message, error) <> func(context.Context, *types.Message, *api.MessageSendSpec, types.TipSetKey) (*types.Message, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported field name: #1 field, GasOverEstimation != MsgUuid; nested=nil}}}} diff --git a/venus-shared/compatible-checks/api-perm.txt b/venus-shared/compatible-checks/api-perm.txt index 9aaf5afb78..9c3dc6ae5b 100644 --- a/venus-shared/compatible-checks/api-perm.txt +++ b/venus-shared/compatible-checks/api-perm.txt @@ -68,7 +68,6 @@ v1: github.com/filecoin-project/venus/venus-shared/api/chain/v1 <> github.com/fi - IMinerState.StateMinerSectorSize - IMinerState.StateMinerWorkerAddress - EthSubscriber.EthSubscription - - IF3.F3ListParticipants - IMessagePool.GasBatchEstimateMessageGas - IMessagePool.MpoolDeleteByAdress - IMessagePool.MpoolPublishByAddr diff --git a/venus-shared/types/api_types.go b/venus-shared/types/api_types.go index 5941584ecb..36c6e0087a 100644 --- a/venus-shared/types/api_types.go +++ b/venus-shared/types/api_types.go @@ -543,22 +543,22 @@ type F3Participant struct { var ( // ErrF3Disabled signals that F3 consensus process is disabled. - ErrF3Disabled = errF3Disabled{} + ErrF3Disabled = &errF3Disabled{} // ErrF3ParticipationTicketInvalid signals that F3ParticipationTicket cannot be decoded. - ErrF3ParticipationTicketInvalid = errF3ParticipationTicketInvalid{} + ErrF3ParticipationTicketInvalid = &errF3ParticipationTicketInvalid{} // ErrF3ParticipationTicketExpired signals that the current GPBFT instance as surpassed the expiry of the ticket. - ErrF3ParticipationTicketExpired = errF3ParticipationTicketExpired{} + ErrF3ParticipationTicketExpired = &errF3ParticipationTicketExpired{} // ErrF3ParticipationIssuerMismatch signals that the ticket is not issued by the current node. - ErrF3ParticipationIssuerMismatch = errF3ParticipationIssuerMismatch{} + ErrF3ParticipationIssuerMismatch = &errF3ParticipationIssuerMismatch{} // ErrF3ParticipationTooManyInstances signals that participation ticket cannot be // issued because it asks for too many instances. - ErrF3ParticipationTooManyInstances = errF3ParticipationTooManyInstances{} + ErrF3ParticipationTooManyInstances = &errF3ParticipationTooManyInstances{} // ErrF3ParticipationTicketStartBeforeExisting signals that participation ticket // is before the start instance of an existing lease held by the miner. - ErrF3ParticipationTicketStartBeforeExisting = errF3ParticipationTicketStartBeforeExisting{} + ErrF3ParticipationTicketStartBeforeExisting = &errF3ParticipationTicketStartBeforeExisting{} // ErrF3NotReady signals that the F3 instance isn't ready for participation yet. The caller // should back off and try again later. - ErrF3NotReady = errF3NotReady{} + ErrF3NotReady = &errF3NotReady{} _ error = (*ErrOutOfGas)(nil) // _ error = (*ErrActorNotFound)(nil)