From abcfc9a6bae4a97fd0e0ae94e54668cd2e264256 Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Mon, 31 May 2021 10:54:59 -0400 Subject: [PATCH] evm: error and block hash map updates (#60) * evm: error and block hash map updates * evm: update tests --- docs/core/proto-docs.md | 35 +- ethereum/rpc/eth_api.go | 12 +- proto/ethermint/evm/v1alpha1/query.proto | 25 +- x/evm/keeper/abci.go | 11 +- x/evm/keeper/grpc_query.go | 67 ++- x/evm/keeper/grpc_query_test.go | 72 +-- x/evm/keeper/keeper.go | 63 +-- x/evm/keeper/msg_server.go | 29 +- x/evm/keeper/statedb.go | 10 +- x/evm/types/chain_config_test.go | 6 - x/evm/types/errors.go | 71 ++- x/evm/types/interfaces.go | 1 + x/evm/types/journal.go | 5 + x/evm/types/key.go | 31 +- x/evm/types/logs.go | 3 +- x/evm/types/msg.go | 6 +- x/evm/types/msg_test.go | 2 +- x/evm/types/params.go | 11 +- x/evm/types/params_test.go | 4 - x/evm/types/query.pb.go | 667 +++++++---------------- x/evm/types/query.pb.gw.go | 114 +--- x/evm/types/statedb.go | 14 +- 22 files changed, 395 insertions(+), 864 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 2ac1422d..5b953b03 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -47,8 +47,6 @@ - [QueryTxLogsResponse](#ethermint.evm.v1alpha1.QueryTxLogsResponse) - [QueryTxReceiptRequest](#ethermint.evm.v1alpha1.QueryTxReceiptRequest) - [QueryTxReceiptResponse](#ethermint.evm.v1alpha1.QueryTxReceiptResponse) - - [QueryTxReceiptsByBlockHashRequest](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashRequest) - - [QueryTxReceiptsByBlockHashResponse](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashResponse) - [QueryTxReceiptsByBlockHeightRequest](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest) - [QueryTxReceiptsByBlockHeightResponse](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightResponse) @@ -507,6 +505,7 @@ QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `hash` | [string](#string) | | hash is the block hash to query the logs for. | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | @@ -522,6 +521,7 @@ QueryTxLogs is the response type for the Query/BlockLogs RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `tx_logs` | [TransactionLogs](#ethermint.evm.v1alpha1.TransactionLogs) | repeated | logs represents the ethereum logs generated at the given block hash. | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | @@ -739,36 +739,6 @@ QueryTxReceiptResponse is the response type for the Query/TxReceipt RPC method. - - -### QueryTxReceiptsByBlockHashRequest -QueryTxReceiptsByBlockHashRequest is the request type for the Query/TxReceiptsByBlockHash RPC method. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `hash` | [string](#string) | | hash is the ethereum transaction hex hash to query the receipt for. | - - - - - - - - -### QueryTxReceiptsByBlockHashResponse -QueryTxReceiptsByBlockHashResponse is the response type for the Query/TxReceiptsByBlockHash RPC method. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `receipts` | [TxReceipt](#ethermint.evm.v1alpha1.TxReceipt) | repeated | tx receipts list for the block | - - - - - - ### QueryTxReceiptsByBlockHeightRequest @@ -815,7 +785,6 @@ Query defines the gRPC querier service. | `TxLogs` | [QueryTxLogsRequest](#ethermint.evm.v1alpha1.QueryTxLogsRequest) | [QueryTxLogsResponse](#ethermint.evm.v1alpha1.QueryTxLogsResponse) | TxLogs queries ethereum logs from a transaction. | GET|/ethermint/evm/v1alpha1/tx_logs/{hash}| | `TxReceipt` | [QueryTxReceiptRequest](#ethermint.evm.v1alpha1.QueryTxReceiptRequest) | [QueryTxReceiptResponse](#ethermint.evm.v1alpha1.QueryTxReceiptResponse) | TxReceipt queries a receipt by a transaction hash. | GET|/ethermint/evm/v1alpha1/tx_receipt/{hash}| | `TxReceiptsByBlockHeight` | [QueryTxReceiptsByBlockHeightRequest](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest) | [QueryTxReceiptsByBlockHeightResponse](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightResponse) | TxReceiptsByBlockHeight queries tx receipts by a block height. | GET|/ethermint/evm/v1alpha1/tx_receipts_block| -| `TxReceiptsByBlockHash` | [QueryTxReceiptsByBlockHashRequest](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashRequest) | [QueryTxReceiptsByBlockHashResponse](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashResponse) | TxReceiptsByBlockHash queries tx receipts by a block hash. | GET|/ethermint/evm/v1alpha1/tx_receipts_block_hash/{hash}| | `BlockLogs` | [QueryBlockLogsRequest](#ethermint.evm.v1alpha1.QueryBlockLogsRequest) | [QueryBlockLogsResponse](#ethermint.evm.v1alpha1.QueryBlockLogsResponse) | BlockLogs queries all the ethereum logs for a given block hash. | GET|/ethermint/evm/v1alpha1/block_logs/{hash}| | `BlockBloom` | [QueryBlockBloomRequest](#ethermint.evm.v1alpha1.QueryBlockBloomRequest) | [QueryBlockBloomResponse](#ethermint.evm.v1alpha1.QueryBlockBloomResponse) | BlockBloom queries the block bloom filter bytes at a given height. | GET|/ethermint/evm/v1alpha1/block_bloom| | `Params` | [QueryParamsRequest](#ethermint.evm.v1alpha1.QueryParamsRequest) | [QueryParamsResponse](#ethermint.evm.v1alpha1.QueryParamsResponse) | Params queries the parameters of x/evm module. | GET|/ethermint/evm/v1alpha1/params| diff --git a/ethereum/rpc/eth_api.go b/ethereum/rpc/eth_api.go index 134ced69..8db74208 100644 --- a/ethereum/rpc/eth_api.go +++ b/ethereum/rpc/eth_api.go @@ -678,12 +678,14 @@ func (e *PublicEthAPI) GetTransactionByHash(hash common.Hash) (*rpctypes.RPCTran func (e *PublicEthAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) { e.logger.Debugln("eth_getTransactionByHashAndIndex", "hash", hash.Hex(), "index", idx) - resp, err := e.queryClient.TxReceiptsByBlockHash(e.ctx, &evmtypes.QueryTxReceiptsByBlockHashRequest{ - Hash: hash.Hex(), - }) + header, err := e.backend.HeaderByHash(hash) if err != nil { - err = errors.Wrap(err, "failed to query tx receipts by block hash") - return nil, err + return nil, errors.Wrapf(err, "failed retrieve block from hash") + } + + resp, err := e.queryClient.TxReceiptsByBlockHeight(rpctypes.ContextWithHeight(header.Number.Int64()), &evmtypes.QueryTxReceiptsByBlockHeightRequest{}) + if err != nil { + return nil, errors.Wrap(err, "failed to query tx receipts by block height") } return e.getReceiptByIndex(resp.Receipts, hash, idx) diff --git a/proto/ethermint/evm/v1alpha1/query.proto b/proto/ethermint/evm/v1alpha1/query.proto index db3521f9..d2b4ca95 100644 --- a/proto/ethermint/evm/v1alpha1/query.proto +++ b/proto/ethermint/evm/v1alpha1/query.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package ethermint.evm.v1alpha1; import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; import "ethermint/evm/v1alpha1/evm.proto"; @@ -50,11 +51,6 @@ service Query { option (google.api.http).get = "/ethermint/evm/v1alpha1/tx_receipts_block"; } - // TxReceiptsByBlockHash queries tx receipts by a block hash. - rpc TxReceiptsByBlockHash(QueryTxReceiptsByBlockHashRequest) returns (QueryTxReceiptsByBlockHashResponse) { - option (google.api.http).get = "/ethermint/evm/v1alpha1/tx_receipts_block_hash/{hash}"; - } - // BlockLogs queries all the ethereum logs for a given block hash. rpc BlockLogs(QueryBlockLogsRequest) returns (QueryBlockLogsResponse) { option (google.api.http).get = "/ethermint/evm/v1alpha1/block_logs/{hash}"; @@ -204,21 +200,6 @@ message QueryTxReceiptsByBlockHeightResponse { repeated TxReceipt receipts = 1; } -// QueryTxReceiptsByBlockHashRequest is the request type for the Query/TxReceiptsByBlockHash RPC method. -message QueryTxReceiptsByBlockHashRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // hash is the ethereum transaction hex hash to query the receipt for. - string hash = 1; -} - -// QueryTxReceiptsByBlockHashResponse is the response type for the Query/TxReceiptsByBlockHash RPC method. -message QueryTxReceiptsByBlockHashResponse { - // tx receipts list for the block - repeated TxReceipt receipts = 1; -} - // QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method. message QueryBlockLogsRequest { option (gogoproto.equal) = false; @@ -226,12 +207,16 @@ message QueryBlockLogsRequest { // hash is the block hash to query the logs for. string hash = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; } // QueryTxLogs is the response type for the Query/BlockLogs RPC method. message QueryBlockLogsResponse { // logs represents the ethereum logs generated at the given block hash. repeated TransactionLogs tx_logs = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryBlockBloomRequest is the request type for the Query/BlockBloom RPC diff --git a/x/evm/keeper/abci.go b/x/evm/keeper/abci.go index 8325cca6..e772944a 100644 --- a/x/evm/keeper/abci.go +++ b/x/evm/keeper/abci.go @@ -19,6 +19,7 @@ import ( // and resets the Bloom filter and the transaction count to 0. func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) + k.WithContext(ctx) if req.Header.Height < 1 { return @@ -27,12 +28,12 @@ func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { // Gas costs are handled within msg handler so costs should be ignored ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) - // TODO: why do we have so many hash -> height mappings - k.SetBlockHash(ctx, req.Hash, req.Header.Height) - k.SetBlockHeightToHash(ctx, common.BytesToHash(req.Hash), req.Header.Height) + k.headerHash = common.BytesToHash(req.Hash) - // special setter for csdb - k.SetHeightHash(ctx, uint64(req.Header.Height), common.BytesToHash(req.Hash)) + // set height -> hash + + // TODO: prune + k.SetHeaderHash(ctx, req.Header.Height, k.headerHash) } // EndBlock updates the accounts and commits state objects to the KV Store, while diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index d4355dad..45c4163b 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -9,7 +9,9 @@ import ( tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" ethcmn "github.com/ethereum/go-ethereum/common" @@ -120,6 +122,13 @@ func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*typ ) } + if ethermint.IsEmptyHash(req.Key) { + return nil, status.Errorf( + codes.InvalidArgument, + types.ErrEmptyHash.Error(), + ) + } + ctx := sdk.UnwrapSDKContext(c) k.CommitStateDB.WithContext(ctx) @@ -127,9 +136,16 @@ func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*typ key := ethcmn.HexToHash(req.Key) state := k.CommitStateDB.GetState(address, key) + stateHex := state.Hex() + + if ethermint.IsEmptyHash(stateHex) { + return nil, status.Error( + codes.NotFound, "contract code not found for given address", + ) + } return &types.QueryStorageResponse{ - Value: state.String(), + Value: stateHex, }, nil } @@ -219,35 +235,12 @@ func (k Keeper) TxReceipt(c context.Context, req *types.QueryTxReceiptRequest) ( func (k Keeper) TxReceiptsByBlockHeight(c context.Context, _ *types.QueryTxReceiptsByBlockHeightRequest) (*types.QueryTxReceiptsByBlockHeightResponse, error) { ctx := sdk.UnwrapSDKContext(c) - receipts := k.GetTxReceiptsByBlockHeight(ctx, ctx.BlockHeight()) + receipts := k.GetTxReceiptsByBlockHeight(ctx, uint64(ctx.BlockHeight())) return &types.QueryTxReceiptsByBlockHeightResponse{ Receipts: receipts, }, nil } -// TxReceiptsByBlockHash implements the Query/TxReceiptsByBlockHash gRPC method -func (k Keeper) TxReceiptsByBlockHash(c context.Context, req *types.QueryTxReceiptsByBlockHashRequest) (*types.QueryTxReceiptsByBlockHashResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if ethermint.IsEmptyHash(req.Hash) { - return nil, status.Error( - codes.InvalidArgument, - types.ErrEmptyHash.Error(), - ) - } - - ctx := sdk.UnwrapSDKContext(c) - - hash := ethcmn.HexToHash(req.Hash) - receipts := k.GetTxReceiptsByBlockHash(ctx, hash) - - return &types.QueryTxReceiptsByBlockHashResponse{ - Receipts: receipts, - }, nil -} - // BlockLogs implements the Query/BlockLogs gRPC method func (k Keeper) BlockLogs(c context.Context, req *types.QueryBlockLogsRequest) (*types.QueryBlockLogsResponse, error) { if req == nil { @@ -263,10 +256,30 @@ func (k Keeper) BlockLogs(c context.Context, req *types.QueryBlockLogsRequest) ( ctx := sdk.UnwrapSDKContext(c) - txLogs := k.GetAllTxLogs(ctx) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLogs) + txLogs := []types.TransactionLogs{} + + pageRes, err := query.FilteredPaginate(store, req.Pagination, func(_, value []byte, accumulate bool) (bool, error) { + var txLog types.TransactionLogs + k.cdc.MustUnmarshalBinaryBare(value, &txLog) + + if len(txLog.Logs) > 0 && txLog.Logs[0].BlockHash == req.Hash { + if accumulate { + txLogs = append(txLogs, txLog) + } + return true, nil + } + + return false, nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } return &types.QueryBlockLogsResponse{ - TxLogs: txLogs, + TxLogs: txLogs, + Pagination: pageRes, }, nil } diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index 9c9277da..acc22d4a 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -236,10 +236,8 @@ func (suite *KeeperTestSuite) TestQueryStorage() { Address: suite.address.String(), Key: ethcmn.Hash{}.String(), } - exp := &types.QueryStorageResponse{Value: "0x0000000000000000000000000000000000000000000000000000000000000000"} - expValue = exp.Value }, - true, + false, }, { "success", @@ -649,74 +647,6 @@ func (suite *KeeperTestSuite) TestQueryTxReceiptByBlockHeight() { } } -func (suite *KeeperTestSuite) TestQueryTxReceiptByBlockHash() { - var ( - req *types.QueryTxReceiptsByBlockHashRequest - expRes *types.QueryTxReceiptsByBlockHashResponse - ) - - testCases := []struct { - msg string - malleate func() - expPass bool - }{ - {"empty block hash", - func() { - req = &types.QueryTxReceiptsByBlockHashRequest{ - Hash: "", - } - }, - false, - }, - {"success", - func() { - hash := ethcmn.BytesToHash([]byte("thash")) - blockHash := ethcmn.BytesToHash([]byte("bhash")) - - receipt := &types.TxReceipt{ - Hash: hash.Hex(), - From: suite.address.Hex(), - BlockHeight: uint64(suite.ctx.BlockHeight()), - BlockHash: blockHash.Hex(), - } - - suite.app.EvmKeeper.SetBlockHash(suite.ctx, blockHash.Bytes(), suite.ctx.BlockHeight()) - suite.app.EvmKeeper.AddTxHashToBlock(suite.ctx, suite.ctx.BlockHeight(), hash) - suite.app.EvmKeeper.SetTxReceiptToHash(suite.ctx, hash, receipt) - - req = &types.QueryTxReceiptsByBlockHashRequest{ - Hash: blockHash.Hex(), - } - - expRes = &types.QueryTxReceiptsByBlockHashResponse{ - Receipts: []*types.TxReceipt{receipt}, - } - }, - true, - }, - } - - for _, tc := range testCases { - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - suite.SetupTest() // reset - - tc.malleate() - ctx := sdk.WrapSDKContext(suite.ctx) - - res, err := suite.queryClient.TxReceiptsByBlockHash(ctx, req) - - if tc.expPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) - - suite.Require().Equal(expRes, res) - } else { - suite.Require().Error(err) - } - }) - } -} - func (suite *KeeperTestSuite) TestQueryBlockBloom() { var ( req *types.QueryBlockBloomRequest diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 2fa7b9b5..3b39e276 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -39,7 +39,9 @@ type Keeper struct { ctx sdk.Context // chain ID number obtained from the context's chain id eip155ChainID *big.Int + debug bool + // TODO: deprecate // Ethermint concrete implementation on the EVM StateDB interface CommitStateDB *types.CommitStateDB @@ -48,6 +50,9 @@ type Keeper struct { // TODO: (@fedekunze) for how long should we persist the entries in the access list? // same block (i.e Transient Store)? 2 or more (KVStore with module Parameter which resets the state after that window)? accessList *types.AccessListMappings + + // hash header for the current height. Reset during abci.RequestBeginBlock + headerHash common.Hash } // NewKeeper generates new evm module keeper @@ -148,40 +153,24 @@ func (k Keeper) SetBlockBloomTransient(bloom *big.Int) { // Block // ---------------------------------------------------------------------------- -// GetBlockHash gets block height from block consensus hash -func (k Keeper) GetBlockHashFromHeight(ctx sdk.Context, height int64) (common.Hash, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyBlockHeightHash(uint64(height))) +// GetHeaderHash gets the header hash from a given height +func (k Keeper) GetHeaderHash(ctx sdk.Context, height int64) common.Hash { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixHeightToHeaderHash) + key := sdk.Uint64ToBigEndian(uint64(height)) + + bz := store.Get(key) if len(bz) == 0 { - return common.Hash{}, false + return common.Hash{} } - return common.BytesToHash(bz), true + return common.BytesToHash(bz) } -// SetBlockHash sets the mapping from block consensus hash to block height -func (k Keeper) SetBlockHash(ctx sdk.Context, hash []byte, height int64) { - store := ctx.KVStore(k.storeKey) - bz := sdk.Uint64ToBigEndian(uint64(height)) - store.Set(types.KeyBlockHash(common.BytesToHash(hash)), bz) -} - -// GetBlockHash gets block height from block consensus hash -func (k Keeper) GetBlockHeightByHash(ctx sdk.Context, hash common.Hash) (int64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyBlockHash(hash)) - if len(bz) == 0 { - return 0, false - } - - height := sdk.BigEndianToUint64(bz) - return int64(height), true -} - -// SetBlockHash sets the mapping from block consensus hash to block height -func (k Keeper) SetBlockHeightToHash(ctx sdk.Context, hash common.Hash, height int64) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyBlockHeightHash(uint64(height)), hash.Bytes()) +// SetBlockHash sets the mapping from heigh -> header hash +func (k Keeper) SetHeaderHash(ctx sdk.Context, height int64, hash common.Hash) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixHeightToHeaderHash) + key := sdk.Uint64ToBigEndian(uint64(height)) + store.Set(key, hash.Bytes()) } // SetTxReceiptToHash sets the mapping from tx hash to tx receipt @@ -266,8 +255,8 @@ func (k Keeper) AddTxHashToBlock(ctx sdk.Context, blockHeight int64, txHash comm } // GetTxsFromBlock returns list of tx hash in the block by height. -func (k Keeper) GetTxsFromBlock(ctx sdk.Context, blockHeight int64) []common.Hash { - key := types.KeyBlockHeightTxs(uint64(blockHeight)) +func (k Keeper) GetTxsFromBlock(ctx sdk.Context, blockHeight uint64) []common.Hash { + key := types.KeyBlockHeightTxs(blockHeight) store := ctx.KVStore(k.storeKey) data := store.Get(key) @@ -287,7 +276,7 @@ func (k Keeper) GetTxsFromBlock(ctx sdk.Context, blockHeight int64) []common.Has } // GetTxReceiptsByBlockHeight gets tx receipts by block height. -func (k Keeper) GetTxReceiptsByBlockHeight(ctx sdk.Context, blockHeight int64) []*types.TxReceipt { +func (k Keeper) GetTxReceiptsByBlockHeight(ctx sdk.Context, blockHeight uint64) []*types.TxReceipt { txs := k.GetTxsFromBlock(ctx, blockHeight) if len(txs) == 0 { return nil @@ -312,16 +301,6 @@ func (k Keeper) GetTxReceiptsByBlockHeight(ctx sdk.Context, blockHeight int64) [ return receipts } -// GetTxReceiptsByBlockHash gets tx receipts by block hash. -func (k Keeper) GetTxReceiptsByBlockHash(ctx sdk.Context, hash common.Hash) []*types.TxReceipt { - blockHeight, ok := k.GetBlockHeightByHash(ctx, hash) - if !ok { - return nil - } - - return k.GetTxReceiptsByBlockHeight(ctx, blockHeight) -} - // ---------------------------------------------------------------------------- // Log // ---------------------------------------------------------------------------- diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index a6208c1d..ea4f68e7 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -54,7 +54,6 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t txHash := tmtypes.Tx(ctx.TxBytes()).Hash() ethHash := ethcmn.BytesToHash(txHash) - blockHash, _ := k.GetBlockHashFromHeight(ctx, ctx.BlockHeight()) st := &types.StateTransition{ Message: ethMsg, @@ -69,7 +68,7 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t // other nodes, causing a consensus error if !st.Simulate { // Prepare db for logs - k.CommitStateDB.Prepare(ethHash, blockHash, int(k.GetTxIndexTransient())) + k.CommitStateDB.Prepare(ethHash, k.headerHash, int(k.GetTxIndexTransient())) k.IncreaseTxIndexTransient() } @@ -85,7 +84,7 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t From: sender.Hex(), Data: msg.Data, BlockHeight: uint64(ctx.BlockHeight()), - BlockHash: blockHash.Hex(), + BlockHash: k.headerHash.Hex(), Result: &types.TxResult{ ContractAddress: executionResult.Response.ContractAddress, Bloom: executionResult.Response.Bloom, @@ -118,14 +117,13 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t panic(err) } - blockHash, _ := k.GetBlockHashFromHeight(ctx, ctx.BlockHeight()) k.SetTxReceiptToHash(ctx, ethHash, &types.TxReceipt{ Hash: ethHash.Hex(), From: sender.Hex(), Data: msg.Data, Index: uint64(st.Csdb.TxIndex()), BlockHeight: uint64(ctx.BlockHeight()), - BlockHash: blockHash.Hex(), + BlockHash: k.headerHash.Hex(), Result: &types.TxResult{ ContractAddress: executionResult.Response.ContractAddress, Bloom: executionResult.Response.Bloom, @@ -154,12 +152,20 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t ) }() + attrs := []sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyAmount, st.Message.Value().String()), + sdk.NewAttribute(types.AttributeKeyTxHash, ethcmn.BytesToHash(txHash).Hex()), + } + + if len(msg.Data.To) > 0 { + attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyRecipient, msg.Data.To)) + } + // emit events ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeEthereumTx, - sdk.NewAttribute(sdk.AttributeKeyAmount, st.Message.Value().String()), - sdk.NewAttribute(types.AttributeKeyTxHash, ethcmn.BytesToHash(txHash).Hex()), + attrs..., ), sdk.NewEvent( sdk.EventTypeMessage, @@ -168,14 +174,5 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t ), }) - if len(msg.Data.To) > 0 { - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeEthereumTx, - sdk.NewAttribute(types.AttributeKeyRecipient, msg.Data.To), - ), - ) - } - return executionResult.Response, nil } diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go index eb1a50ec..ccf06c9d 100644 --- a/x/evm/keeper/statedb.go +++ b/x/evm/keeper/statedb.go @@ -454,11 +454,6 @@ func (k *Keeper) Empty(addr common.Address) bool { // // This method should only be called if Yolov3/Berlin/2929+2930 is applicable at the current number. func (k *Keeper) PrepareAccessList(sender common.Address, dest *common.Address, precompiles []common.Address, txAccesses ethtypes.AccessList) { - // NOTE: only update the access list during DeliverTx - if k.ctx.IsCheckTx() || k.ctx.IsReCheckTx() { - return - } - k.AddAddressToAccessList(sender) if dest != nil { k.AddAddressToAccessList(*dest) @@ -532,11 +527,8 @@ func (k *Keeper) RevertToSnapshot(_ int) {} // to store. func (k *Keeper) AddLog(log *ethtypes.Log) { txHash := common.BytesToHash(tmtypes.Tx(k.ctx.TxBytes()).Hash()) - blockHash, found := k.GetBlockHashFromHeight(k.ctx, k.ctx.BlockHeight()) - if found { - log.BlockHash = blockHash - } + log.BlockHash = k.headerHash log.TxHash = txHash log.TxIndex = uint(k.GetTxIndexTransient()) diff --git a/x/evm/types/chain_config_test.go b/x/evm/types/chain_config_test.go index 3a26ef50..03ac32a9 100644 --- a/x/evm/types/chain_config_test.go +++ b/x/evm/types/chain_config_test.go @@ -245,9 +245,3 @@ func TestChainConfigValidate(t *testing.T) { } } } - -func TestChainConfig_String(t *testing.T) { - configStr := `homestead_block:"0" dao_fork_block:"0" dao_fork_support:true eip150_block:"0" eip150_hash:"0x0000000000000000000000000000000000000000000000000000000000000000" eip155_block:"0" eip158_block:"0" byzantium_block:"0" constantinople_block:"0" petersburg_block:"0" istanbul_block:"-1" muir_glacier_block:"-1" yolo_v3_block:"-1" ewasm_block:"-1" catalyst_block:"-1" ` - config := DefaultChainConfig() - require.Equal(t, configStr, config.String()) -} diff --git a/x/evm/types/errors.go b/x/evm/types/errors.go index a35971d6..c9f0b2f1 100644 --- a/x/evm/types/errors.go +++ b/x/evm/types/errors.go @@ -2,44 +2,77 @@ package types import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/vm" ) -// NOTE: We can't use 1 since that error code is reserved for internal errors. +const ( + codeErrInvalidState = uint32(iota) + 2 // NOTE: code 1 is reserved for internal errors + codeErrExecutionReverted // IMPORTANT: Do not move this error as it complies with the JSON-RPC error standard + codeErrChainConfigNotFound + codeErrInvalidChainConfig + codeErrZeroAddress + codeErrEmptyHash + codeErrBloomNotFound + codeErrTxReceiptNotFound + codeErrCreateDisabled + codeErrCallDisabled + codeErrInvalidAmount + codeErrInvalidGasPrice + codeErrVMExecution +) var ( // ErrInvalidState returns an error resulting from an invalid Storage State. - ErrInvalidState = sdkerrors.Register(ModuleName, 2, "invalid storage state") + ErrInvalidState = sdkerrors.Register(ModuleName, codeErrInvalidState, "invalid storage state") + + // ErrExecutionReverted returns an error resulting from an error in EVM execution. + ErrExecutionReverted = sdkerrors.Register(ModuleName, codeErrExecutionReverted, vm.ErrExecutionReverted.Error()) // ErrChainConfigNotFound returns an error if the chain config cannot be found on the store. - ErrChainConfigNotFound = sdkerrors.Register(ModuleName, 3, "chain configuration not found") + ErrChainConfigNotFound = sdkerrors.Register(ModuleName, codeErrChainConfigNotFound, "chain configuration not found") // ErrInvalidChainConfig returns an error resulting from an invalid ChainConfig. - ErrInvalidChainConfig = sdkerrors.Register(ModuleName, 4, "invalid chain configuration") + ErrInvalidChainConfig = sdkerrors.Register(ModuleName, codeErrInvalidChainConfig, "invalid chain configuration") // ErrZeroAddress returns an error resulting from an zero (empty) ethereum Address. - ErrZeroAddress = sdkerrors.Register(ModuleName, 5, "invalid zero address") + ErrZeroAddress = sdkerrors.Register(ModuleName, codeErrZeroAddress, "invalid zero address") // ErrEmptyHash returns an error resulting from an empty ethereum Hash. - ErrEmptyHash = sdkerrors.Register(ModuleName, 6, "empty hash") + ErrEmptyHash = sdkerrors.Register(ModuleName, codeErrEmptyHash, "empty hash") // ErrBloomNotFound returns an error if the block bloom cannot be found on the store. - ErrBloomNotFound = sdkerrors.Register(ModuleName, 7, "block bloom not found") - - // ErrInvalidValue returns an error resulting from an invalid value. - ErrInvalidValue = sdkerrors.Register(ModuleName, 8, "invalid value") - - // ErrInvalidChainID returns an error resulting from an invalid chain ID. - ErrInvalidChainID = sdkerrors.Register(ModuleName, 9, "invalid chain ID") - - // ErrVMExecution returns an error resulting from an error in EVM execution. - ErrVMExecution = sdkerrors.Register(ModuleName, 10, "error while executing evm transaction") + ErrBloomNotFound = sdkerrors.Register(ModuleName, codeErrBloomNotFound, "block bloom not found") // ErrTxReceiptNotFound returns an error if the transaction receipt could not be found - ErrTxReceiptNotFound = sdkerrors.Register(ModuleName, 11, "transaction receipt not found") + ErrTxReceiptNotFound = sdkerrors.Register(ModuleName, codeErrTxReceiptNotFound, "transaction receipt not found") // ErrCreateDisabled returns an error if the EnableCreate parameter is false. - ErrCreateDisabled = sdkerrors.Register(ModuleName, 12, "EVM Create operation is disabled") + ErrCreateDisabled = sdkerrors.Register(ModuleName, codeErrCreateDisabled, "EVM Create operation is disabled") // ErrCallDisabled returns an error if the EnableCall parameter is false. - ErrCallDisabled = sdkerrors.Register(ModuleName, 13, "EVM Call operation is disabled") + ErrCallDisabled = sdkerrors.Register(ModuleName, codeErrCallDisabled, "EVM Call operation is disabled") + + // ErrInvalidAmount returns an error if a tx contains an invalid amount. + ErrInvalidAmount = sdkerrors.Register(ModuleName, codeErrInvalidAmount, "invalid transaction amount") + + // ErrInvalidGasPrice returns an error if an invalid gas price is provided to the tx. + ErrInvalidGasPrice = sdkerrors.Register(ModuleName, codeErrInvalidGasPrice, "invalid gas price") + + // ErrVMExecution returns an error resulting from an error in EVM execution. + ErrVMExecution = sdkerrors.Register(ModuleName, codeErrVMExecution, "evm transaction execution failed") ) + +// NewExecErrorWithReson unpacks the revert return bytes and returns a wrapped error +// with the return reason. +func NewExecErrorWithReson(revertReason []byte) error { + hexValue := hexutil.Encode(revertReason) + reason, errUnpack := abi.UnpackRevert(revertReason) + if errUnpack == nil { + return sdkerrors.Wrapf(ErrExecutionReverted, "%s: %s", reason, hexValue) + } + + return sdkerrors.Wrapf(ErrExecutionReverted, "%s", hexValue) +} diff --git a/x/evm/types/interfaces.go b/x/evm/types/interfaces.go index 5337352c..012212e4 100644 --- a/x/evm/types/interfaces.go +++ b/x/evm/types/interfaces.go @@ -19,6 +19,7 @@ type AccountKeeper interface { // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) error SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) error SetBalance(ctx sdk.Context, addr sdk.AccAddress, balance sdk.Coin) error diff --git a/x/evm/types/journal.go b/x/evm/types/journal.go index f7446dbf..20f28595 100644 --- a/x/evm/types/journal.go +++ b/x/evm/types/journal.go @@ -18,6 +18,11 @@ type journalEntry interface { dirtied() *ethcmn.Address } +type revision struct { + id int + journalIndex int +} + // journal contains the list of state modifications applied since the last state // commit. These are tracked to be able to be reverted in case of an execution // exception or revertal request. diff --git a/x/evm/types/key.go b/x/evm/types/key.go index 744fd3f9..dc69ad99 100644 --- a/x/evm/types/key.go +++ b/x/evm/types/key.go @@ -25,13 +25,12 @@ const ( ) const ( - prefixBlockHash = iota + 1 + prefixHeightToHeaderHash = iota + 1 prefixBloom prefixLogs prefixCode prefixStorage prefixChainConfig - prefixBlockHeightHash prefixHashTxReceipt prefixBlockHeightTxs ) @@ -45,15 +44,14 @@ const ( // KVStore key prefixes var ( - KeyPrefixBlockHash = []byte{prefixBlockHash} - KeyPrefixBloom = []byte{prefixBloom} - KeyPrefixLogs = []byte{prefixLogs} - KeyPrefixCode = []byte{prefixCode} - KeyPrefixStorage = []byte{prefixStorage} - KeyPrefixChainConfig = []byte{prefixChainConfig} - KeyPrefixBlockHeightHash = []byte{prefixBlockHeightHash} - KeyPrefixHashTxReceipt = []byte{prefixHashTxReceipt} - KeyPrefixBlockHeightTxs = []byte{prefixBlockHeightTxs} + KeyPrefixHeightToHeaderHash = []byte{prefixHeightToHeaderHash} + KeyPrefixBloom = []byte{prefixBloom} + KeyPrefixLogs = []byte{prefixLogs} + KeyPrefixCode = []byte{prefixCode} + KeyPrefixStorage = []byte{prefixStorage} + KeyPrefixChainConfig = []byte{prefixChainConfig} + KeyPrefixHashTxReceipt = []byte{prefixHashTxReceipt} + KeyPrefixBlockHeightTxs = []byte{prefixBlockHeightTxs} ) var ( @@ -79,17 +77,6 @@ func StateKey(address ethcmn.Address, key []byte) []byte { return append(AddressStoragePrefix(address), key...) } -// KeyBlockHash returns a key for accessing block hash data. -func KeyBlockHash(hash ethcmn.Hash) []byte { - return append(KeyPrefixBlockHash, hash.Bytes()...) -} - -// KeyBlockHash returns a key for accessing block hash data. -func KeyBlockHeightHash(height uint64) []byte { - heightBytes := sdk.Uint64ToBigEndian(height) - return append(KeyPrefixBlockHeightHash, heightBytes...) -} - // KeyHashTxReceipt returns a key for accessing tx receipt data by hash. func KeyHashTxReceipt(hash ethcmn.Hash) []byte { return append(KeyPrefixHashTxReceipt, hash.Bytes()...) diff --git a/x/evm/types/logs.go b/x/evm/types/logs.go index 17ae94db..6e0545fd 100644 --- a/x/evm/types/logs.go +++ b/x/evm/types/logs.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "errors" "fmt" @@ -36,7 +35,7 @@ func NewTransactionLogsFromEth(hash ethcmn.Hash, ethlogs []*ethtypes.Log) Transa // Validate performs a basic validation of a GenesisAccount fields. func (tx TransactionLogs) Validate() error { - if bytes.Equal(ethcmn.Hex2Bytes(tx.Hash), ethcmn.Hash{}.Bytes()) { + if ethermint.IsEmptyHash(tx.Hash) { return fmt.Errorf("hash cannot be the empty %s", tx.Hash) } diff --git a/x/evm/types/msg.go b/x/evm/types/msg.go index e9fee9c1..72d4292f 100644 --- a/x/evm/types/msg.go +++ b/x/evm/types/msg.go @@ -100,13 +100,13 @@ func (msg MsgEthereumTx) Type() string { return TypeMsgEthereumTx } func (msg MsgEthereumTx) ValidateBasic() error { gasPrice := new(big.Int).SetBytes(msg.Data.GasPrice) if gasPrice.Sign() == -1 { - return sdkerrors.Wrapf(ErrInvalidValue, "gas price cannot be negative %s", gasPrice) + return sdkerrors.Wrapf(ErrInvalidGasPrice, "gas price cannot be negative %s", gasPrice) } // Amount can be 0 amount := new(big.Int).SetBytes(msg.Data.Amount) if amount.Sign() == -1 { - return sdkerrors.Wrapf(ErrInvalidValue, "amount cannot be negative %s", amount) + return sdkerrors.Wrapf(ErrInvalidAmount, "amount cannot be negative %s", amount) } if msg.Data.To != "" { @@ -218,7 +218,7 @@ func (msg *MsgEthereumTx) DecodeRLP(s *rlp.Stream) error { // the sender is not registered on the keyring func (msg *MsgEthereumTx) Sign(chainID *big.Int, signer keyring.Signer) error { from := msg.GetFrom() - if from == nil { + if from.Empty() { return fmt.Errorf("sender address not defined for message") } diff --git a/x/evm/types/msg_test.go b/x/evm/types/msg_test.go index 6d43e703..13749202 100644 --- a/x/evm/types/msg_test.go +++ b/x/evm/types/msg_test.go @@ -71,7 +71,7 @@ func (suite *MsgsTestSuite) TestMsgEthereumTx_ValidateBasic() { }{ {msg: "pass with recipient", to: &suite.to, amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true}, {msg: "pass contract", to: nil, amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true}, - {msg: "invalid recipient", to: ðcmn.Address{}, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true}, + {msg: "invalid recipient", to: ðcmn.Address{}, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: false}, // NOTE: these can't be effectively tested because the SetBytes function from big.Int only sets // the absolute value {msg: "negative amount", to: &suite.to, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true}, diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 17e49af3..aac92fc7 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -46,7 +46,7 @@ func DefaultParams() Params { EvmDenom: DefaultEVMDenom, EnableCreate: true, EnableCall: true, - ExtraEIPs: []int64(nil), // TODO: define default values from: [2929, 2200, 1884, 1344] + ExtraEIPs: []int64{2929, 2200, 1884, 1344}, } } @@ -75,6 +75,15 @@ func (p Params) Validate() error { return validateEIPs(p.ExtraEIPs) } +// EIPs returns the ExtraEips as a int slice +func (p Params) EIPs() []int { + eips := make([]int, len(p.ExtraEIPs)) + for i, eip := range p.ExtraEIPs { + eips[i] = int(eip) + } + return eips +} + func validateEVMDenom(i interface{}) error { denom, ok := i.(string) if !ok { diff --git a/x/evm/types/params_test.go b/x/evm/types/params_test.go index 896e4d41..b7e1908d 100644 --- a/x/evm/types/params_test.go +++ b/x/evm/types/params_test.go @@ -59,7 +59,3 @@ func TestParamsValidatePriv(t *testing.T) { require.Error(t, validateEIPs("")) require.NoError(t, validateEIPs([]int64{1884})) } - -func TestParams_String(t *testing.T) { - require.Equal(t, "evm_denom: aphoton\nenable_create: true\nenable_call: true\nextra_eips: []\n", DefaultParams().String()) -} diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index 71913faa..4a84b534 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -747,102 +748,19 @@ func (m *QueryTxReceiptsByBlockHeightResponse) GetReceipts() []*TxReceipt { return nil } -// QueryTxReceiptsByBlockHashRequest is the request type for the Query/TxReceiptsByBlockHash RPC method. -type QueryTxReceiptsByBlockHashRequest struct { - // hash is the ethereum transaction hex hash to query the receipt for. - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` -} - -func (m *QueryTxReceiptsByBlockHashRequest) Reset() { *m = QueryTxReceiptsByBlockHashRequest{} } -func (m *QueryTxReceiptsByBlockHashRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTxReceiptsByBlockHashRequest) ProtoMessage() {} -func (*QueryTxReceiptsByBlockHashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{16} -} -func (m *QueryTxReceiptsByBlockHashRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTxReceiptsByBlockHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTxReceiptsByBlockHashRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryTxReceiptsByBlockHashRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTxReceiptsByBlockHashRequest.Merge(m, src) -} -func (m *QueryTxReceiptsByBlockHashRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryTxReceiptsByBlockHashRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTxReceiptsByBlockHashRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTxReceiptsByBlockHashRequest proto.InternalMessageInfo - -// QueryTxReceiptsByBlockHashResponse is the response type for the Query/TxReceiptsByBlockHash RPC method. -type QueryTxReceiptsByBlockHashResponse struct { - // tx receipts list for the block - Receipts []*TxReceipt `protobuf:"bytes,1,rep,name=receipts,proto3" json:"receipts,omitempty"` -} - -func (m *QueryTxReceiptsByBlockHashResponse) Reset() { *m = QueryTxReceiptsByBlockHashResponse{} } -func (m *QueryTxReceiptsByBlockHashResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTxReceiptsByBlockHashResponse) ProtoMessage() {} -func (*QueryTxReceiptsByBlockHashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{17} -} -func (m *QueryTxReceiptsByBlockHashResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTxReceiptsByBlockHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTxReceiptsByBlockHashResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryTxReceiptsByBlockHashResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTxReceiptsByBlockHashResponse.Merge(m, src) -} -func (m *QueryTxReceiptsByBlockHashResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTxReceiptsByBlockHashResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTxReceiptsByBlockHashResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTxReceiptsByBlockHashResponse proto.InternalMessageInfo - -func (m *QueryTxReceiptsByBlockHashResponse) GetReceipts() []*TxReceipt { - if m != nil { - return m.Receipts - } - return nil -} - // QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method. type QueryBlockLogsRequest struct { // hash is the block hash to query the logs for. Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryBlockLogsRequest) Reset() { *m = QueryBlockLogsRequest{} } func (m *QueryBlockLogsRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlockLogsRequest) ProtoMessage() {} func (*QueryBlockLogsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{18} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{16} } func (m *QueryBlockLogsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -875,13 +793,15 @@ var xxx_messageInfo_QueryBlockLogsRequest proto.InternalMessageInfo type QueryBlockLogsResponse struct { // logs represents the ethereum logs generated at the given block hash. TxLogs []TransactionLogs `protobuf:"bytes,1,rep,name=tx_logs,json=txLogs,proto3" json:"tx_logs"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryBlockLogsResponse) Reset() { *m = QueryBlockLogsResponse{} } func (m *QueryBlockLogsResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlockLogsResponse) ProtoMessage() {} func (*QueryBlockLogsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{19} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{17} } func (m *QueryBlockLogsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -917,6 +837,13 @@ func (m *QueryBlockLogsResponse) GetTxLogs() []TransactionLogs { return nil } +func (m *QueryBlockLogsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + // QueryBlockBloomRequest is the request type for the Query/BlockBloom RPC // method. type QueryBlockBloomRequest struct { @@ -926,7 +853,7 @@ func (m *QueryBlockBloomRequest) Reset() { *m = QueryBlockBloomRequest{} func (m *QueryBlockBloomRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlockBloomRequest) ProtoMessage() {} func (*QueryBlockBloomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{20} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{18} } func (m *QueryBlockBloomRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -966,7 +893,7 @@ func (m *QueryBlockBloomResponse) Reset() { *m = QueryBlockBloomResponse func (m *QueryBlockBloomResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlockBloomResponse) ProtoMessage() {} func (*QueryBlockBloomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{21} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{19} } func (m *QueryBlockBloomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1010,7 +937,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{22} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{20} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1049,7 +976,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{23} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{21} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1097,7 +1024,7 @@ func (m *QueryStaticCallRequest) Reset() { *m = QueryStaticCallRequest{} func (m *QueryStaticCallRequest) String() string { return proto.CompactTextString(m) } func (*QueryStaticCallRequest) ProtoMessage() {} func (*QueryStaticCallRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{24} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{22} } func (m *QueryStaticCallRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1149,7 +1076,7 @@ func (m *QueryStaticCallResponse) Reset() { *m = QueryStaticCallResponse func (m *QueryStaticCallResponse) String() string { return proto.CompactTextString(m) } func (*QueryStaticCallResponse) ProtoMessage() {} func (*QueryStaticCallResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8bbc79ec2b6c5cb2, []int{25} + return fileDescriptor_8bbc79ec2b6c5cb2, []int{23} } func (m *QueryStaticCallResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1202,8 +1129,6 @@ func init() { proto.RegisterType((*QueryTxReceiptResponse)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptResponse") proto.RegisterType((*QueryTxReceiptsByBlockHeightRequest)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest") proto.RegisterType((*QueryTxReceiptsByBlockHeightResponse)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightResponse") - proto.RegisterType((*QueryTxReceiptsByBlockHashRequest)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashRequest") - proto.RegisterType((*QueryTxReceiptsByBlockHashResponse)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashResponse") proto.RegisterType((*QueryBlockLogsRequest)(nil), "ethermint.evm.v1alpha1.QueryBlockLogsRequest") proto.RegisterType((*QueryBlockLogsResponse)(nil), "ethermint.evm.v1alpha1.QueryBlockLogsResponse") proto.RegisterType((*QueryBlockBloomRequest)(nil), "ethermint.evm.v1alpha1.QueryBlockBloomRequest") @@ -1219,78 +1144,79 @@ func init() { } var fileDescriptor_8bbc79ec2b6c5cb2 = []byte{ - // 1130 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0xbd, 0x89, 0x13, 0x27, 0xaf, 0x0d, 0x0a, 0x83, 0xdb, 0x86, 0x2d, 0x72, 0xd2, 0x29, - 0x69, 0x9c, 0x26, 0xf5, 0x36, 0x46, 0xa5, 0xf4, 0x97, 0x50, 0x5c, 0xa9, 0x8a, 0x44, 0x85, 0xc0, - 0x81, 0x0b, 0x17, 0x33, 0x5e, 0x8f, 0xd6, 0x56, 0xd6, 0x3b, 0xae, 0x67, 0x1d, 0x25, 0x8a, 0x7a, - 0xe1, 0x80, 0x40, 0xe2, 0x00, 0xe2, 0x00, 0x42, 0x42, 0xea, 0x9f, 0xc0, 0x7f, 0x41, 0x2f, 0x48, - 0x15, 0x5c, 0x38, 0x21, 0x94, 0x70, 0xe0, 0xcf, 0x40, 0x33, 0xfb, 0xd6, 0xde, 0x4d, 0xbc, 0xd9, - 0x4d, 0xc4, 0x6d, 0x67, 0xfc, 0x7e, 0x7c, 0xe6, 0xcd, 0xcc, 0xfb, 0x8e, 0x81, 0x72, 0xbf, 0xcd, - 0xfb, 0xdd, 0x8e, 0xe7, 0x5b, 0x7c, 0xb7, 0x6b, 0xed, 0x6e, 0x30, 0xb7, 0xd7, 0x66, 0x1b, 0xd6, - 0xb3, 0x01, 0xef, 0xef, 0x57, 0x7a, 0x7d, 0x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x9a, 0x98, 0x92, 0x9a, 0x6b, 0x99, 0x6c, 0x11, 0xaa, 0xa2, 0xa1, 0xca, 0xe4, 0x46, 0x12, 0x14, - 0x76, 0x46, 0xeb, 0x40, 0xb5, 0x53, 0xbd, 0x85, 0xb3, 0xc3, 0xa6, 0x4c, 0x6e, 0xa5, 0xa4, 0x8a, - 0x8b, 0xac, 0x59, 0xc9, 0x6a, 0x9e, 0xf5, 0xc2, 0xfa, 0x7b, 0x0d, 0x94, 0x85, 0x90, 0xef, 0x57, - 0x03, 0xae, 0x24, 0xe8, 0x24, 0x79, 0x90, 0x2d, 0xfd, 0x58, 0x11, 0x36, 0x1f, 0x9e, 0xcf, 0xf9, - 0xec, 0x2b, 0x91, 0x8d, 0xa6, 0x0a, 0x40, 0x7e, 0x33, 0xe0, 0xd2, 0x58, 0x1d, 0x25, 0xf7, 0xce, - 0x88, 0x32, 0x92, 0x6f, 0xf3, 0xfe, 0x79, 0x5c, 0x71, 0x0d, 0x8f, 0xf4, 0x1a, 0xee, 0x92, 0x3b, - 0x99, 0xd7, 0xa0, 0xff, 0x28, 0x44, 0x4f, 0xce, 0x50, 0x7b, 0x53, 0x4e, 0xce, 0x71, 0x69, 0x4f, - 0x39, 0x39, 0x27, 0x24, 0x3d, 0xbd, 0xde, 0x01, 0x5f, 0xf4, 0x64, 0xff, 0x64, 0x00, 0x8c, 0xf4, - 0x99, 0x64, 0xc8, 0x18, 0x95, 0x78, 0xd3, 0xca, 0x6c, 0x8f, 0x88, 0x6b, 0x1a, 0x71, 0x99, 0x5c, - 0x3f, 0x1d, 0x51, 0xbf, 0x07, 0xc8, 0xd7, 0x06, 0x4c, 0x07, 0xea, 0x9d, 0xd2, 0x0a, 0x62, 0x0f, - 0x86, 0x94, 0x56, 0x10, 0x7f, 0x46, 0xd0, 0x1b, 0x1a, 0x68, 0x89, 0x94, 0x92, 0x80, 0x82, 0x07, - 0x83, 0x2e, 0xd4, 0x48, 0xe2, 0x53, 0x0a, 0x75, 0xe2, 0x55, 0x91, 0x52, 0xa8, 0x93, 0x6f, 0x87, - 0xf4, 0x42, 0x49, 0xed, 0xd3, 0xb0, 0x99, 0xeb, 0xd6, 0x36, 0x5f, 0x1e, 0x96, 0x8c, 0x57, 0x87, - 0x25, 0xe3, 0xef, 0xc3, 0x92, 0xf1, 0xed, 0x51, 0x29, 0xf7, 0xea, 0xa8, 0x94, 0xfb, 0xf3, 0xa8, - 0x94, 0xfb, 0x6c, 0xc5, 0xe9, 0xf8, 0xed, 0x41, 0xb3, 0x62, 0x8b, 0x2e, 0x8a, 0x67, 0x24, 0xde, - 0x9e, 0x8e, 0xe8, 0xef, 0xf7, 0xb8, 0x6c, 0x4e, 0xeb, 0x7f, 0xd6, 0xef, 0xfc, 0x17, 0x00, 0x00, - 0xff, 0xff, 0x0c, 0x87, 0xad, 0x46, 0xed, 0x0f, 0x00, 0x00, + // 1141 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x97, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xc7, 0xbd, 0x89, 0x13, 0x27, 0x4f, 0x1a, 0x28, 0x83, 0x69, 0xc3, 0x16, 0x39, 0x61, 0x4b, + 0x12, 0xe7, 0xa5, 0xbb, 0xb5, 0x11, 0xaf, 0x2d, 0x42, 0x71, 0xa5, 0x10, 0x89, 0x0a, 0x15, 0x07, + 0x2e, 0x5c, 0xac, 0xf1, 0x7a, 0xb4, 0xb6, 0xb2, 0xde, 0x71, 0xbd, 0xeb, 0x28, 0x51, 0x94, 0x4b, + 0x0f, 0x08, 0x24, 0x0e, 0x20, 0x0e, 0x20, 0x24, 0xa4, 0x5e, 0xb9, 0xf1, 0x2d, 0xe8, 0xb1, 0x12, + 0x17, 0x4e, 0x08, 0x25, 0x1c, 0xf8, 0x18, 0x68, 0x66, 0x9e, 0xb5, 0x77, 0x63, 0x6f, 0x76, 0xd3, + 0xdb, 0xce, 0xf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, 0x3d, 0x2b, 0x45, 0xcc, 0x0b, 0x2e, 0x65, 0x54, 0x25, + 0xe0, 0x36, 0xd9, 0x4c, 0x02, 0x44, 0xd3, 0xf2, 0x23, 0x68, 0xbf, 0x6a, 0x50, 0x40, 0xbb, 0x49, + 0x41, 0x8b, 0x3b, 0x5c, 0x0a, 0xda, 0x05, 0x07, 0x33, 0xde, 0x93, 0x68, 0x15, 0x62, 0x25, 0xa1, + 0xf9, 0x2a, 0x61, 0x44, 0x66, 0x9d, 0x1c, 0xb0, 0xe3, 0x53, 0xf2, 0x9d, 0x06, 0x79, 0x61, 0x54, + 0xa4, 0x9c, 0xb2, 0x63, 0x43, 0x0f, 0xd4, 0x37, 0x32, 0x44, 0x22, 0x96, 0x25, 0xb1, 0x36, 0xc8, + 0x7a, 0xf2, 0x96, 0xb6, 0x62, 0x72, 0xfd, 0xa0, 0xc1, 0xac, 0xb2, 0x36, 0xb2, 0x79, 0x69, 0x9b, + 0x98, 0x67, 0xea, 0x5b, 0x99, 0x62, 0x11, 0xca, 0x94, 0x50, 0x65, 0xb2, 0x96, 0x04, 0x85, 0x4f, + 0xac, 0x75, 0x22, 0x1e, 0x78, 0xb9, 0x85, 0xf3, 0x43, 0x9b, 0x20, 0x77, 0x52, 0x5a, 0xc5, 0xed, + 0x54, 0x37, 0xb3, 0x86, 0x67, 0xbd, 0xb0, 0xc1, 0x51, 0x03, 0x8d, 0x2a, 0xe4, 0xfb, 0x43, 0x83, + 0x9b, 0x09, 0x8e, 0x48, 0xee, 0x65, 0x6b, 0x3f, 0xd1, 0x6e, 0xf5, 0xfb, 0x2f, 0x96, 0x7c, 0xf5, + 0x95, 0xf8, 0x8d, 0xa6, 0x28, 0x20, 0x95, 0x1e, 0x9a, 0x5e, 0x8a, 0xd2, 0x17, 0xcd, 0x39, 0x45, + 0xe9, 0x31, 0x2f, 0x4d, 0xe7, 0x93, 0x4c, 0xb1, 0x93, 0xf0, 0x8b, 0x06, 0x30, 0xf2, 0x33, 0x92, + 0xa1, 0x63, 0xd4, 0x12, 0x75, 0x2b, 0x73, 0x3c, 0x22, 0x6e, 0x49, 0xc4, 0x55, 0x72, 0xfb, 0x72, + 0x44, 0xe9, 0x9f, 0xe4, 0x5b, 0x0d, 0x66, 0x95, 0xdb, 0xa5, 0x5c, 0x9d, 0x98, 0xc1, 0xa6, 0x5c, + 0x9d, 0xb8, 0xed, 0x1a, 0x6b, 0x12, 0x68, 0x85, 0x94, 0x92, 0x80, 0x94, 0xc1, 0x4a, 0xa1, 0x46, + 0x96, 0x98, 0x22, 0xd4, 0x98, 0x0b, 0xa7, 0x08, 0x35, 0xee, 0xb5, 0xe9, 0x42, 0xf9, 0x32, 0xa7, + 0x61, 0x53, 0xd7, 0xad, 0xed, 0x3c, 0x3b, 0x2b, 0x69, 0xcf, 0xcf, 0x4a, 0xda, 0x3f, 0x67, 0x25, + 0xed, 0xfb, 0xf3, 0x52, 0xee, 0xf9, 0x79, 0x29, 0xf7, 0xd7, 0x79, 0x29, 0xf7, 0xd5, 0xba, 0xd3, + 0x09, 0xda, 0x83, 0xa6, 0x69, 0xf3, 0x2e, 0x9a, 0x4d, 0xa4, 0xde, 0x91, 0xac, 0x18, 0x1c, 0xf7, + 0x98, 0xdf, 0x9c, 0x95, 0xff, 0x39, 0xdf, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x64, 0x1a, 0x51, + 0x62, 0x33, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1322,8 +1248,6 @@ type QueryClient interface { TxReceipt(ctx context.Context, in *QueryTxReceiptRequest, opts ...grpc.CallOption) (*QueryTxReceiptResponse, error) // TxReceiptsByBlockHeight queries tx receipts by a block height. TxReceiptsByBlockHeight(ctx context.Context, in *QueryTxReceiptsByBlockHeightRequest, opts ...grpc.CallOption) (*QueryTxReceiptsByBlockHeightResponse, error) - // TxReceiptsByBlockHash queries tx receipts by a block hash. - TxReceiptsByBlockHash(ctx context.Context, in *QueryTxReceiptsByBlockHashRequest, opts ...grpc.CallOption) (*QueryTxReceiptsByBlockHashResponse, error) // BlockLogs queries all the ethereum logs for a given block hash. BlockLogs(ctx context.Context, in *QueryBlockLogsRequest, opts ...grpc.CallOption) (*QueryBlockLogsResponse, error) // BlockBloom queries the block bloom filter bytes at a given height. @@ -1414,15 +1338,6 @@ func (c *queryClient) TxReceiptsByBlockHeight(ctx context.Context, in *QueryTxRe return out, nil } -func (c *queryClient) TxReceiptsByBlockHash(ctx context.Context, in *QueryTxReceiptsByBlockHashRequest, opts ...grpc.CallOption) (*QueryTxReceiptsByBlockHashResponse, error) { - out := new(QueryTxReceiptsByBlockHashResponse) - err := c.cc.Invoke(ctx, "/ethermint.evm.v1alpha1.Query/TxReceiptsByBlockHash", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) BlockLogs(ctx context.Context, in *QueryBlockLogsRequest, opts ...grpc.CallOption) (*QueryBlockLogsResponse, error) { out := new(QueryBlockLogsResponse) err := c.cc.Invoke(ctx, "/ethermint.evm.v1alpha1.Query/BlockLogs", in, out, opts...) @@ -1478,8 +1393,6 @@ type QueryServer interface { TxReceipt(context.Context, *QueryTxReceiptRequest) (*QueryTxReceiptResponse, error) // TxReceiptsByBlockHeight queries tx receipts by a block height. TxReceiptsByBlockHeight(context.Context, *QueryTxReceiptsByBlockHeightRequest) (*QueryTxReceiptsByBlockHeightResponse, error) - // TxReceiptsByBlockHash queries tx receipts by a block hash. - TxReceiptsByBlockHash(context.Context, *QueryTxReceiptsByBlockHashRequest) (*QueryTxReceiptsByBlockHashResponse, error) // BlockLogs queries all the ethereum logs for a given block hash. BlockLogs(context.Context, *QueryBlockLogsRequest) (*QueryBlockLogsResponse, error) // BlockBloom queries the block bloom filter bytes at a given height. @@ -1518,9 +1431,6 @@ func (*UnimplementedQueryServer) TxReceipt(ctx context.Context, req *QueryTxRece func (*UnimplementedQueryServer) TxReceiptsByBlockHeight(ctx context.Context, req *QueryTxReceiptsByBlockHeightRequest) (*QueryTxReceiptsByBlockHeightResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TxReceiptsByBlockHeight not implemented") } -func (*UnimplementedQueryServer) TxReceiptsByBlockHash(ctx context.Context, req *QueryTxReceiptsByBlockHashRequest) (*QueryTxReceiptsByBlockHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TxReceiptsByBlockHash not implemented") -} func (*UnimplementedQueryServer) BlockLogs(ctx context.Context, req *QueryBlockLogsRequest) (*QueryBlockLogsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BlockLogs not implemented") } @@ -1682,24 +1592,6 @@ func _Query_TxReceiptsByBlockHeight_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _Query_TxReceiptsByBlockHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTxReceiptsByBlockHashRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).TxReceiptsByBlockHash(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethermint.evm.v1alpha1.Query/TxReceiptsByBlockHash", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TxReceiptsByBlockHash(ctx, req.(*QueryTxReceiptsByBlockHashRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_BlockLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryBlockLogsRequest) if err := dec(in); err != nil { @@ -1808,10 +1700,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "TxReceiptsByBlockHeight", Handler: _Query_TxReceiptsByBlockHeight_Handler, }, - { - MethodName: "TxReceiptsByBlockHash", - Handler: _Query_TxReceiptsByBlockHash_Handler, - }, { MethodName: "BlockLogs", Handler: _Query_BlockLogs_Handler, @@ -2354,73 +2242,6 @@ func (m *QueryTxReceiptsByBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } -func (m *QueryTxReceiptsByBlockHashRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryTxReceiptsByBlockHashRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTxReceiptsByBlockHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryTxReceiptsByBlockHashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryTxReceiptsByBlockHashResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTxReceiptsByBlockHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Receipts) > 0 { - for iNdEx := len(m.Receipts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Receipts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *QueryBlockLogsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2441,6 +2262,18 @@ func (m *QueryBlockLogsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Hash) > 0 { i -= len(m.Hash) copy(dAtA[i:], m.Hash) @@ -2471,6 +2304,18 @@ func (m *QueryBlockLogsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.TxLogs) > 0 { for iNdEx := len(m.TxLogs) - 1; iNdEx >= 0; iNdEx-- { { @@ -2900,7 +2745,7 @@ func (m *QueryTxReceiptsByBlockHeightResponse) Size() (n int) { return n } -func (m *QueryTxReceiptsByBlockHashRequest) Size() (n int) { +func (m *QueryBlockLogsRequest) Size() (n int) { if m == nil { return 0 } @@ -2910,32 +2755,8 @@ func (m *QueryTxReceiptsByBlockHashRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - return n -} - -func (m *QueryTxReceiptsByBlockHashResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Receipts) > 0 { - for _, e := range m.Receipts { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryBlockLogsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -2953,6 +2774,10 @@ func (m *QueryBlockLogsResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4495,178 +4320,6 @@ func (m *QueryTxReceiptsByBlockHeightResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryTxReceiptsByBlockHashRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryTxReceiptsByBlockHashRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTxReceiptsByBlockHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTxReceiptsByBlockHashResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryTxReceiptsByBlockHashResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTxReceiptsByBlockHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Receipts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Receipts = append(m.Receipts, &TxReceipt{}) - if err := m.Receipts[len(m.Receipts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryBlockLogsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4728,6 +4381,42 @@ func (m *QueryBlockLogsRequest) Unmarshal(dAtA []byte) error { } m.Hash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4815,6 +4504,42 @@ func (m *QueryBlockLogsResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/evm/types/query.pb.gw.go b/x/evm/types/query.pb.gw.go index fb2ce0e7..d4e356ef 100644 --- a/x/evm/types/query.pb.gw.go +++ b/x/evm/types/query.pb.gw.go @@ -449,59 +449,9 @@ func local_request_Query_TxReceiptsByBlockHeight_0(ctx context.Context, marshale } -func request_Query_TxReceiptsByBlockHash_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTxReceiptsByBlockHashRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["hash"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") - } - - protoReq.Hash, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) - } - - msg, err := client.TxReceiptsByBlockHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_TxReceiptsByBlockHash_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTxReceiptsByBlockHashRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["hash"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") - } - - protoReq.Hash, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) - } - - msg, err := server.TxReceiptsByBlockHash(ctx, &protoReq) - return msg, metadata, err - -} +var ( + filter_Query_BlockLogs_0 = &utilities.DoubleArray{Encoding: map[string]int{"hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_BlockLogs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryBlockLogsRequest @@ -525,6 +475,13 @@ func request_Query_BlockLogs_0(ctx context.Context, marshaler runtime.Marshaler, return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlockLogs_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.BlockLogs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -552,6 +509,13 @@ func local_request_Query_BlockLogs_0(ctx context.Context, marshaler runtime.Mars return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlockLogs_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.BlockLogs(ctx, &protoReq) return msg, metadata, err @@ -795,26 +759,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_TxReceiptsByBlockHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_TxReceiptsByBlockHash_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_TxReceiptsByBlockHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_BlockLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1096,26 +1040,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_TxReceiptsByBlockHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_TxReceiptsByBlockHash_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_TxReceiptsByBlockHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_BlockLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1216,8 +1140,6 @@ var ( pattern_Query_TxReceiptsByBlockHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1alpha1", "tx_receipts_block"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_TxReceiptsByBlockHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1alpha1", "tx_receipts_block_hash", "hash"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_BlockLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1alpha1", "block_logs", "hash"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_BlockBloom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1alpha1", "block_bloom"}, "", runtime.AssumeColonVerbOpt(true))) @@ -1244,8 +1166,6 @@ var ( forward_Query_TxReceiptsByBlockHeight_0 = runtime.ForwardResponseMessage - forward_Query_TxReceiptsByBlockHash_0 = runtime.ForwardResponseMessage - forward_Query_BlockLogs_0 = runtime.ForwardResponseMessage forward_Query_BlockBloom_0 = runtime.ForwardResponseMessage diff --git a/x/evm/types/statedb.go b/x/evm/types/statedb.go index e8a20cc3..4b41d00a 100644 --- a/x/evm/types/statedb.go +++ b/x/evm/types/statedb.go @@ -25,11 +25,6 @@ var ( zeroBalance = sdk.ZeroInt().BigInt() ) -type revision struct { - id int - journalIndex int -} - // CommitStateDB implements the Geth state.StateDB interface. Instead of using // a trie and database for querying and persistence, the Keeper uses KVStores // and an AccountKeeper to facilitate state transitions. @@ -122,9 +117,8 @@ func (csdb *CommitStateDB) WithContext(ctx sdk.Context) *CommitStateDB { // SetHeightHash sets the block header hash associated with a given height. func (csdb *CommitStateDB) SetHeightHash(height uint64, hash ethcmn.Hash) { - store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixBlockHeightHash) - key := KeyBlockHeightHash(height) - store.Set(key, hash.Bytes()) + store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixHeightToHeaderHash) + store.Set(sdk.Uint64ToBigEndian(height), hash.Bytes()) } // SetParams sets the evm parameters to the param space. @@ -326,8 +320,8 @@ func (csdb *CommitStateDB) PrepareAccessList(sender ethcmn.Address, dst *ethcmn. // GetHeightHash returns the block header hash associated with a given block height and chain epoch number. func (csdb *CommitStateDB) GetHeightHash(height uint64) ethcmn.Hash { - store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixBlockHeightHash) - key := KeyBlockHeightHash(height) + store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixHeightToHeaderHash) + key := sdk.Uint64ToBigEndian(height) bz := store.Get(key) if len(bz) == 0 { return ethcmn.Hash{}