Eth JSON-RPC API: implement eth_getCode and eth_getStorageAt (#9397)

This commit is contained in:
raulk 2022-09-29 23:55:13 +01:00 committed by Alfonso de la Rocha
parent 9d1208c9ff
commit 653af01235
4 changed files with 26 additions and 26 deletions

View File

@ -149,7 +149,7 @@ type FullNode interface {
// ChainGetPath returns a set of revert/apply operations needed to get from // ChainGetPath returns a set of revert/apply operations needed to get from
// one tipset to another, for example: // one tipset to another, for example:
//``` // ```
// to // to
// ^ // ^
// from tAA // from tAA
@ -158,7 +158,7 @@ type FullNode interface {
// ^---*--^ // ^---*--^
// ^ // ^
// tRR // tRR
//``` // ```
// Would return `[revert(tBA), apply(tAB), apply(tAA)]` // Would return `[revert(tBA), apply(tAB), apply(tAA)]`
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*HeadChange, error) //perm:read 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 ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmarket.DealID) error //perm:write
// ClientUnimport removes references to the specified file from filestore // ClientUnimport removes references to the specified file from filestore
//ClientUnimport(path string) // ClientUnimport(path string)
// ClientListImports lists imported files and their root CIDs // ClientListImports lists imported files and their root CIDs
ClientListImports(ctx context.Context) ([]Import, error) //perm:write ClientListImports(ctx context.Context) ([]Import, error) //perm:write
//ClientListAsks() []Ask // ClientListAsks() []Ask
// MethodGroup: State // MethodGroup: State
// The State methods are used to query, inspect, and interact with chain 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: <multisig address>, <start epoch>, <end epoch> // It takes the following params: <multisig address>, <start epoch>, <end epoch>
MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error) //perm:read MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error) //perm:read
//MsigGetPending returns pending transactions for the given multisig // MsigGetPending returns pending transactions for the given multisig
//wallet. Once pending transactions are fully approved, they will no longer // wallet. Once pending transactions are fully approved, they will no longer
//appear here. // appear here.
MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*MsigTransaction, error) //perm:read MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*MsigTransaction, error) //perm:read
// MsigCreate creates a multisig wallet // MsigCreate creates a multisig wallet
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration> // It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
//<initial balance>, <sender address of the create msg>, <gas price> // <initial balance>, <sender address of the create msg>, <gas price>
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (*MessagePrototype, error) //perm:sign MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (*MessagePrototype, error) //perm:sign
// MsigPropose proposes a multisig message // MsigPropose proposes a multisig message

View File

@ -425,7 +425,7 @@ func ExampleValue(method string, t, parent reflect.Type) interface{} {
case reflect.Ptr: case reflect.Ptr:
if t.Elem().Kind() == reflect.Struct { if t.Elem().Kind() == reflect.Struct {
es := exampleStruct(method, t.Elem(), t) es := exampleStruct(method, t.Elem(), t)
//ExampleValues[t] = es // ExampleValues[t] = es
return es return es
} }
case reflect.Interface: case reflect.Interface:

View File

@ -7,7 +7,7 @@ import (
mathbig "math/big" mathbig "math/big"
"golang.org/x/crypto/sha3" "golang.org/x/crypto/sha3"
xerrors "golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
gocrypto "github.com/filecoin-project/go-crypto" gocrypto "github.com/filecoin-project/go-crypto"
@ -23,19 +23,19 @@ import (
) )
type EthTx struct { type EthTx struct {
ChainID EthInt `json:"chainId"` ChainID EthUint64 `json:"chainId"`
Nonce EthInt `json:"nonce"` Nonce EthUint64 `json:"nonce"`
Hash EthHash `json:"hash"` Hash EthHash `json:"hash"`
BlockHash EthHash `json:"blockHash"` BlockHash EthHash `json:"blockHash"`
BlockNumber EthInt `json:"blockNumber"` BlockNumber EthUint64 `json:"blockNumber"`
TransactionIndex EthInt `json:"transacionIndex"` TransactionIndex EthUint64 `json:"transacionIndex"`
From EthAddress `json:"from"` From EthAddress `json:"from"`
To *EthAddress `json:"to"` To *EthAddress `json:"to"`
Value EthBigInt `json:"value"` Value EthBigInt `json:"value"`
Type EthInt `json:"type"` Type EthUint64 `json:"type"`
Input EthBytes `json:"input"` Input EthBytes `json:"input"`
Gas EthInt `json:"gas"` Gas EthUint64 `json:"gas"`
GasLimit *EthInt `json:"gasLimit,omitempty"` GasLimit *EthUint64 `json:"gasLimit,omitempty"`
MaxFeePerGas EthBigInt `json:"maxFeePerGas"` MaxFeePerGas EthBigInt `json:"maxFeePerGas"`
MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"` MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"`
V EthBytes `json:"v"` V EthBytes `json:"v"`
@ -436,7 +436,7 @@ func parseInt(v interface{}) (int, error) {
var value int64 var value int64
r := bytes.NewReader(append(make([]byte, 8-len(data)), data...)) r := bytes.NewReader(append(make([]byte, 8-len(data)), data...))
if err := binary.Read(r, binary.BigEndian, &value); err != nil { 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 return int(value), nil
} }

View File

@ -140,7 +140,7 @@ type FullNode interface {
// ChainGetPath returns a set of revert/apply operations needed to get from // ChainGetPath returns a set of revert/apply operations needed to get from
// one tipset to another, for example: // one tipset to another, for example:
//``` // ```
// to // to
// ^ // ^
// from tAA // from tAA
@ -149,7 +149,7 @@ type FullNode interface {
// ^---*--^ // ^---*--^
// ^ // ^
// tRR // tRR
//``` // ```
// Would return `[revert(tBA), apply(tAB), apply(tAA)]` // Would return `[revert(tBA), apply(tAB), apply(tAA)]`
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*api.HeadChange, error) //perm:read 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 ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmarket.DealID) error //perm:write
// ClientUnimport removes references to the specified file from filestore // ClientUnimport removes references to the specified file from filestore
//ClientUnimport(path string) // ClientUnimport(path string)
// ClientListImports lists imported files and their root CIDs // ClientListImports lists imported files and their root CIDs
ClientListImports(ctx context.Context) ([]api.Import, error) //perm:write ClientListImports(ctx context.Context) ([]api.Import, error) //perm:write
//ClientListAsks() []Ask // ClientListAsks() []Ask
// MethodGroup: State // MethodGroup: State
// The State methods are used to query, inspect, and interact with chain 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: <multisig address>, <start epoch>, <end epoch> // It takes the following params: <multisig address>, <start epoch>, <end epoch>
MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error) //perm:read MsigGetVested(context.Context, address.Address, types.TipSetKey, types.TipSetKey) (types.BigInt, error) //perm:read
//MsigGetPending returns pending transactions for the given multisig // MsigGetPending returns pending transactions for the given multisig
//wallet. Once pending transactions are fully approved, they will no longer // wallet. Once pending transactions are fully approved, they will no longer
//appear here. // appear here.
MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*api.MsigTransaction, error) //perm:read MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*api.MsigTransaction, error) //perm:read
// MsigCreate creates a multisig wallet // MsigCreate creates a multisig wallet
// It takes the following params: <required number of senders>, <approving addresses>, <unlock duration> // It takes the following params: <required number of senders>, <approving addresses>, <unlock duration>
//<initial balance>, <sender address of the create msg>, <gas price> // <initial balance>, <sender address of the create msg>, <gas price>
MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (cid.Cid, error) //perm:sign MsigCreate(context.Context, uint64, []address.Address, abi.ChainEpoch, types.BigInt, address.Address, types.BigInt) (cid.Cid, error) //perm:sign
// MsigPropose proposes a multisig message // MsigPropose proposes a multisig message
// It takes the following params: <multisig address>, <recipient address>, <value to transfer>, // It takes the following params: <multisig address>, <recipient address>, <value to transfer>,