From 653af0123525f76036c00d6e81723c9d8d757327 Mon Sep 17 00:00:00 2001 From: raulk Date: Thu, 29 Sep 2022 23:55:13 +0100 Subject: [PATCH] Eth JSON-RPC API: implement eth_getCode and eth_getStorageAt (#9397) --- api/api_full.go | 16 ++++++++-------- api/docgen/docgen.go | 2 +- api/eth_transactions.go | 18 +++++++++--------- api/v0api/full.go | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/api/api_full.go b/api/api_full.go index 155601fc8..f9f1ac9a7 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -149,7 +149,7 @@ type FullNode interface { // ChainGetPath returns a set of revert/apply operations needed to get from // one tipset to another, for example: - //``` + // ``` // to // ^ // from tAA @@ -158,7 +158,7 @@ type FullNode interface { // ^---*--^ // ^ // tRR - //``` + // ``` // Would return `[revert(tBA), apply(tAB), apply(tAA)]` ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*HeadChange, error) //perm:read @@ -386,12 +386,12 @@ type FullNode interface { ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmarket.DealID) error //perm:write // ClientUnimport removes references to the specified file from filestore - //ClientUnimport(path string) + // ClientUnimport(path string) // ClientListImports lists imported files and their root CIDs ClientListImports(ctx context.Context) ([]Import, error) //perm:write - //ClientListAsks() []Ask + // ClientListAsks() []Ask // MethodGroup: State // The State methods are used to query, inspect, and interact with chain state. @@ -627,14 +627,14 @@ type FullNode interface { // It takes the following params: , , MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error) //perm:read - //MsigGetPending returns pending transactions for the given multisig - //wallet. Once pending transactions are fully approved, they will no longer - //appear here. + // MsigGetPending returns pending transactions for the given multisig + // wallet. Once pending transactions are fully approved, they will no longer + // appear here. MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*MsigTransaction, error) //perm:read // MsigCreate creates a multisig wallet // It takes the following params: , , - //, , + // , , MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (*MessagePrototype, error) //perm:sign // MsigPropose proposes a multisig message diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index cd1f03337..bb5085be3 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -425,7 +425,7 @@ func ExampleValue(method string, t, parent reflect.Type) interface{} { case reflect.Ptr: if t.Elem().Kind() == reflect.Struct { es := exampleStruct(method, t.Elem(), t) - //ExampleValues[t] = es + // ExampleValues[t] = es return es } case reflect.Interface: diff --git a/api/eth_transactions.go b/api/eth_transactions.go index 333f12692..5dc630af6 100644 --- a/api/eth_transactions.go +++ b/api/eth_transactions.go @@ -7,7 +7,7 @@ import ( mathbig "math/big" "golang.org/x/crypto/sha3" - xerrors "golang.org/x/xerrors" + "golang.org/x/xerrors" "github.com/filecoin-project/go-address" gocrypto "github.com/filecoin-project/go-crypto" @@ -23,19 +23,19 @@ import ( ) type EthTx struct { - ChainID EthInt `json:"chainId"` - Nonce EthInt `json:"nonce"` + ChainID EthUint64 `json:"chainId"` + Nonce EthUint64 `json:"nonce"` Hash EthHash `json:"hash"` BlockHash EthHash `json:"blockHash"` - BlockNumber EthInt `json:"blockNumber"` - TransactionIndex EthInt `json:"transacionIndex"` + BlockNumber EthUint64 `json:"blockNumber"` + TransactionIndex EthUint64 `json:"transacionIndex"` From EthAddress `json:"from"` To *EthAddress `json:"to"` Value EthBigInt `json:"value"` - Type EthInt `json:"type"` + Type EthUint64 `json:"type"` Input EthBytes `json:"input"` - Gas EthInt `json:"gas"` - GasLimit *EthInt `json:"gasLimit,omitempty"` + Gas EthUint64 `json:"gas"` + GasLimit *EthUint64 `json:"gasLimit,omitempty"` MaxFeePerGas EthBigInt `json:"maxFeePerGas"` MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"` V EthBytes `json:"v"` @@ -436,7 +436,7 @@ func parseInt(v interface{}) (int, error) { var value int64 r := bytes.NewReader(append(make([]byte, 8-len(data)), data...)) if err := binary.Read(r, binary.BigEndian, &value); err != nil { - return 0, xerrors.Errorf("cannot parse interface to EthInt: %w", err) + return 0, xerrors.Errorf("cannot parse interface to EthUint64: %w", err) } return int(value), nil } diff --git a/api/v0api/full.go b/api/v0api/full.go index 3600663b4..a0656c3fc 100644 --- a/api/v0api/full.go +++ b/api/v0api/full.go @@ -140,7 +140,7 @@ type FullNode interface { // ChainGetPath returns a set of revert/apply operations needed to get from // one tipset to another, for example: - //``` + // ``` // to // ^ // from tAA @@ -149,7 +149,7 @@ type FullNode interface { // ^---*--^ // ^ // tRR - //``` + // ``` // Would return `[revert(tBA), apply(tAB), apply(tAA)]` ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*api.HeadChange, error) //perm:read @@ -366,12 +366,12 @@ type FullNode interface { ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmarket.DealID) error //perm:write // ClientUnimport removes references to the specified file from filestore - //ClientUnimport(path string) + // ClientUnimport(path string) // ClientListImports lists imported files and their root CIDs ClientListImports(ctx context.Context) ([]api.Import, error) //perm:write - //ClientListAsks() []Ask + // ClientListAsks() []Ask // MethodGroup: State // The State methods are used to query, inspect, and interact with chain state. @@ -630,14 +630,14 @@ type FullNode interface { // It takes the following params: , , MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error) //perm:read - //MsigGetPending returns pending transactions for the given multisig - //wallet. Once pending transactions are fully approved, they will no longer - //appear here. + // MsigGetPending returns pending transactions for the given multisig + // wallet. Once pending transactions are fully approved, they will no longer + // appear here. MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*api.MsigTransaction, error) //perm:read // MsigCreate creates a multisig wallet // It takes the following params: , , - //, , + // , , MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (cid.Cid, error) //perm:sign // MsigPropose proposes a multisig message // It takes the following params: , , ,