Skip to content

Commit 5036b50

Browse files
committed
fixup! feat(eth)!: add Eth APIs to /v2, fix minor incompatibilities
1 parent f59288c commit 5036b50

30 files changed

+8348
-313
lines changed

api/api_full.go

+14-30
Original file line numberDiff line numberDiff line change
@@ -841,19 +841,19 @@ type FullNode interface {
841841
// EthGetBlockTransactionCountByHash returns the number of messages in the TipSet
842842
EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) //perm:read
843843

844-
EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) //perm:read
845-
EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) //perm:read
846-
EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) //perm:read
847-
EthGetTransactionByHashLimited(ctx context.Context, txHash *ethtypes.EthHash, limit abi.ChainEpoch) (*ethtypes.EthTx, error) //perm:read
848-
EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*ethtypes.EthHash, error) //perm:read
849-
EthGetMessageCidByTransactionHash(ctx context.Context, txHash *ethtypes.EthHash) (*cid.Cid, error) //perm:read
850-
EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthUint64, error) //perm:read
851-
EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*EthTxReceipt, error) //perm:read
852-
EthGetBlockReceipts(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash) ([]*EthTxReceipt, error) //perm:read
853-
EthGetBlockReceiptsLimited(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash, limit abi.ChainEpoch) ([]*EthTxReceipt, error) //perm:read
854-
EthGetTransactionReceiptLimited(ctx context.Context, txHash ethtypes.EthHash, limit abi.ChainEpoch) (*EthTxReceipt, error) //perm:read
855-
EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error) //perm:read
856-
EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum string, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error) //perm:read
844+
EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) //perm:read
845+
EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) //perm:read
846+
EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) //perm:read
847+
EthGetTransactionByHashLimited(ctx context.Context, txHash *ethtypes.EthHash, limit abi.ChainEpoch) (*ethtypes.EthTx, error) //perm:read
848+
EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*ethtypes.EthHash, error) //perm:read
849+
EthGetMessageCidByTransactionHash(ctx context.Context, txHash *ethtypes.EthHash) (*cid.Cid, error) //perm:read
850+
EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthUint64, error) //perm:read
851+
EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*ethtypes.EthTxReceipt, error) //perm:read
852+
EthGetBlockReceipts(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash) ([]*ethtypes.EthTxReceipt, error) //perm:read
853+
EthGetBlockReceiptsLimited(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash, limit abi.ChainEpoch) ([]*ethtypes.EthTxReceipt, error) //perm:read
854+
EthGetTransactionReceiptLimited(ctx context.Context, txHash ethtypes.EthHash, limit abi.ChainEpoch) (*ethtypes.EthTxReceipt, error) //perm:read
855+
EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error) //perm:read
856+
EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum string, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error) //perm:read
857857

858858
EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error) //perm:read
859859
EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error) //perm:read
@@ -1452,20 +1452,4 @@ type HotGCOpts struct {
14521452
Moving bool
14531453
}
14541454

1455-
type EthTxReceipt struct {
1456-
TransactionHash ethtypes.EthHash `json:"transactionHash"`
1457-
TransactionIndex ethtypes.EthUint64 `json:"transactionIndex"`
1458-
BlockHash ethtypes.EthHash `json:"blockHash"`
1459-
BlockNumber ethtypes.EthUint64 `json:"blockNumber"`
1460-
From ethtypes.EthAddress `json:"from"`
1461-
To *ethtypes.EthAddress `json:"to"`
1462-
StateRoot ethtypes.EthHash `json:"root"`
1463-
Status ethtypes.EthUint64 `json:"status"`
1464-
ContractAddress *ethtypes.EthAddress `json:"contractAddress"`
1465-
CumulativeGasUsed ethtypes.EthUint64 `json:"cumulativeGasUsed"`
1466-
GasUsed ethtypes.EthUint64 `json:"gasUsed"`
1467-
EffectiveGasPrice ethtypes.EthBigInt `json:"effectiveGasPrice"`
1468-
LogsBloom ethtypes.EthBytes `json:"logsBloom"`
1469-
Logs []ethtypes.EthLog `json:"logs"`
1470-
Type ethtypes.EthUint64 `json:"type"`
1471-
}
1455+
type EthTxReceipt = ethtypes.EthTxReceipt // Deprecated: use ethtypes.EthTxReceipt instead

api/api_gateway.go

+17-10
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,11 @@ import (
3535
// * Generate openrpc blobs
3636

3737
type Gateway interface {
38-
MpoolPending(context.Context, types.TipSetKey) ([]*types.SignedMessage, error)
3938
ChainGetBlock(context.Context, cid.Cid) (*types.BlockHeader, error)
40-
MinerGetBaseInfo(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*MiningBaseInfo, error)
41-
StateMinerSectorCount(context.Context, address.Address, types.TipSetKey) (MinerSectors, error)
42-
GasEstimateGasPremium(context.Context, uint64, address.Address, int64, types.TipSetKey) (types.BigInt, error)
43-
StateReplay(context.Context, types.TipSetKey, cid.Cid) (*InvocResult, error)
4439
ChainHasObj(context.Context, cid.Cid) (bool, error)
4540
ChainPutObj(context.Context, blocks.Block) error
4641
ChainHead(ctx context.Context) (*types.TipSet, error)
42+
ChainGetEvents(context.Context, cid.Cid) ([]types.Event, error)
4743
ChainGetParentMessages(context.Context, cid.Cid) ([]Message, error)
4844
ChainGetParentReceipts(context.Context, cid.Cid) ([]*types.MessageReceipt, error)
4945
ChainGetMessagesInTipset(context.Context, types.TipSetKey) ([]Message, error)
@@ -56,15 +52,22 @@ type Gateway interface {
5652
ChainNotify(context.Context) (<-chan []*HeadChange, error)
5753
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
5854
ChainGetGenesis(context.Context) (*types.TipSet, error)
55+
56+
GasEstimateGasPremium(context.Context, uint64, address.Address, int64, types.TipSetKey) (types.BigInt, error)
5957
GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)
58+
6059
MpoolGetNonce(ctx context.Context, addr address.Address) (uint64, error)
60+
MpoolPending(context.Context, types.TipSetKey) ([]*types.SignedMessage, error)
6161
MpoolPush(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)
62+
6263
MsigGetAvailableBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.BigInt, error)
6364
MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*MsigTransaction, error)
6465
MsigGetVested(ctx context.Context, addr address.Address, start types.TipSetKey, end types.TipSetKey) (types.BigInt, error)
6566
MsigGetVestingSchedule(ctx context.Context, addr address.Address, tsk types.TipSetKey) (MsigVesting, error)
67+
6668
StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
6769
StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*InvocResult, error)
70+
StateReplay(context.Context, types.TipSetKey, cid.Cid) (*InvocResult, error)
6871
StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (DealCollateralBounds, error)
6972
StateDecodeParams(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error)
7073
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
@@ -83,16 +86,18 @@ type Gateway interface {
8386
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]Deadline, error)
8487
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
8588
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
89+
StateMinerSectorCount(context.Context, address.Address, types.TipSetKey) (MinerSectors, error)
8690
StateNetworkName(context.Context) (dtypes.NetworkName, error)
8791
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error)
8892
StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
8993
StateVerifierStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
9094
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
9195
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
9296
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
97+
98+
MinerGetBaseInfo(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*MiningBaseInfo, error)
99+
93100
WalletBalance(context.Context, address.Address) (types.BigInt, error)
94-
Version(context.Context) (APIVersion, error)
95-
Discover(context.Context) (apitypes.OpenRPCDocument, error)
96101

97102
EthAddressToFilecoinAddress(ctx context.Context, ethAddress ethtypes.EthAddress) (address.Address, error)
98103
FilecoinAddressToEthAddress(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthAddress, error)
@@ -106,8 +111,8 @@ type Gateway interface {
106111
EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*ethtypes.EthHash, error)
107112
EthGetMessageCidByTransactionHash(ctx context.Context, txHash *ethtypes.EthHash) (*cid.Cid, error)
108113
EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthUint64, error)
109-
EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*EthTxReceipt, error)
110-
EthGetBlockReceipts(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash) ([]*EthTxReceipt, error)
114+
EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*ethtypes.EthTxReceipt, error)
115+
EthGetBlockReceipts(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash) ([]*ethtypes.EthTxReceipt, error)
111116
EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
112117
EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
113118
EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBigInt, error)
@@ -140,8 +145,10 @@ type Gateway interface {
140145
EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, index ethtypes.EthUint64) (*ethtypes.EthTx, error)
141146
GetActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
142147
SubscribeActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)
143-
ChainGetEvents(context.Context, cid.Cid) ([]types.Event, error)
144148

145149
F3GetCertificate(ctx context.Context, instance uint64) (*certs.FinalityCertificate, error)
146150
F3GetLatestCertificate(ctx context.Context) (*certs.FinalityCertificate, error)
151+
152+
Version(context.Context) (APIVersion, error)
153+
Discover(context.Context) (apitypes.OpenRPCDocument, error)
147154
}

api/mocks/mock_full.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)