Skip to content

Commit

Permalink
chore: make compatible-all
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Nov 4, 2024
1 parent f7cff68 commit 70c210a
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 38 deletions.
4 changes: 2 additions & 2 deletions app/submodule/eth/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 4 additions & 14 deletions app/submodule/eth/eth_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions venus-devtool/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions venus-devtool/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion venus-shared/api/chain/v1/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions venus-shared/api/chain/v1/mock/mock_fullnode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions venus-shared/api/chain/v1/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion venus-shared/compatible-checks/api-checksum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions venus-shared/compatible-checks/api-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}}
Expand Down
1 change: 0 additions & 1 deletion venus-shared/compatible-checks/api-perm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions venus-shared/types/api_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 70c210a

Please sign in to comment.