evm: error and block hash map updates (#60)

* evm: error and block hash map updates

* evm: update tests
This commit is contained in:
Federico Kunze 2021-05-31 10:54:59 -04:00 committed by GitHub
parent 9a5654f70d
commit abcfc9a6ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 395 additions and 864 deletions

View File

@ -47,8 +47,6 @@
- [QueryTxLogsResponse](#ethermint.evm.v1alpha1.QueryTxLogsResponse) - [QueryTxLogsResponse](#ethermint.evm.v1alpha1.QueryTxLogsResponse)
- [QueryTxReceiptRequest](#ethermint.evm.v1alpha1.QueryTxReceiptRequest) - [QueryTxReceiptRequest](#ethermint.evm.v1alpha1.QueryTxReceiptRequest)
- [QueryTxReceiptResponse](#ethermint.evm.v1alpha1.QueryTxReceiptResponse) - [QueryTxReceiptResponse](#ethermint.evm.v1alpha1.QueryTxReceiptResponse)
- [QueryTxReceiptsByBlockHashRequest](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashRequest)
- [QueryTxReceiptsByBlockHashResponse](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashResponse)
- [QueryTxReceiptsByBlockHeightRequest](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest) - [QueryTxReceiptsByBlockHeightRequest](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest)
- [QueryTxReceiptsByBlockHeightResponse](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightResponse) - [QueryTxReceiptsByBlockHeightResponse](#ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightResponse)
@ -507,6 +505,7 @@ QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method.
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `hash` | [string](#string) | | hash is the block hash to query the logs for. | | `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 | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `tx_logs` | [TransactionLogs](#ethermint.evm.v1alpha1.TransactionLogs) | repeated | logs represents the ethereum logs generated at the given block hash. | | `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.
<a name="ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashRequest"></a>
### 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. |
<a name="ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHashResponse"></a>
### 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 |
<a name="ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest"></a> <a name="ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest"></a>
### QueryTxReceiptsByBlockHeightRequest ### 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}| | `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}| | `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| | `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}| | `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| | `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| | `Params` | [QueryParamsRequest](#ethermint.evm.v1alpha1.QueryParamsRequest) | [QueryParamsResponse](#ethermint.evm.v1alpha1.QueryParamsResponse) | Params queries the parameters of x/evm module. | GET|/ethermint/evm/v1alpha1/params|

View File

@ -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) { func (e *PublicEthAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) {
e.logger.Debugln("eth_getTransactionByHashAndIndex", "hash", hash.Hex(), "index", idx) e.logger.Debugln("eth_getTransactionByHashAndIndex", "hash", hash.Hex(), "index", idx)
resp, err := e.queryClient.TxReceiptsByBlockHash(e.ctx, &evmtypes.QueryTxReceiptsByBlockHashRequest{ header, err := e.backend.HeaderByHash(hash)
Hash: hash.Hex(),
})
if err != nil { if err != nil {
err = errors.Wrap(err, "failed to query tx receipts by block hash") return nil, errors.Wrapf(err, "failed retrieve block from hash")
return nil, err }
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) return e.getReceiptByIndex(resp.Receipts, hash, idx)

View File

@ -2,6 +2,7 @@ syntax = "proto3";
package ethermint.evm.v1alpha1; package ethermint.evm.v1alpha1;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "ethermint/evm/v1alpha1/evm.proto"; import "ethermint/evm/v1alpha1/evm.proto";
@ -50,11 +51,6 @@ service Query {
option (google.api.http).get = "/ethermint/evm/v1alpha1/tx_receipts_block"; 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. // BlockLogs queries all the ethereum logs for a given block hash.
rpc BlockLogs(QueryBlockLogsRequest) returns (QueryBlockLogsResponse) { rpc BlockLogs(QueryBlockLogsRequest) returns (QueryBlockLogsResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/block_logs/{hash}"; option (google.api.http).get = "/ethermint/evm/v1alpha1/block_logs/{hash}";
@ -204,21 +200,6 @@ message QueryTxReceiptsByBlockHeightResponse {
repeated TxReceipt receipts = 1; 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. // QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method.
message QueryBlockLogsRequest { message QueryBlockLogsRequest {
option (gogoproto.equal) = false; option (gogoproto.equal) = false;
@ -226,12 +207,16 @@ message QueryBlockLogsRequest {
// hash is the block hash to query the logs for. // hash is the block hash to query the logs for.
string hash = 1; 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. // QueryTxLogs is the response type for the Query/BlockLogs RPC method.
message QueryBlockLogsResponse { message QueryBlockLogsResponse {
// logs represents the ethereum logs generated at the given block hash. // logs represents the ethereum logs generated at the given block hash.
repeated TransactionLogs tx_logs = 1 [(gogoproto.nullable) = false]; 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 // QueryBlockBloomRequest is the request type for the Query/BlockBloom RPC

View File

@ -19,6 +19,7 @@ import (
// and resets the Bloom filter and the transaction count to 0. // and resets the Bloom filter and the transaction count to 0.
func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)
k.WithContext(ctx)
if req.Header.Height < 1 { if req.Header.Height < 1 {
return 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 // Gas costs are handled within msg handler so costs should be ignored
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
// TODO: why do we have so many hash -> height mappings k.headerHash = common.BytesToHash(req.Hash)
k.SetBlockHash(ctx, req.Hash, req.Header.Height)
k.SetBlockHeightToHash(ctx, common.BytesToHash(req.Hash), req.Header.Height)
// special setter for csdb // set height -> hash
k.SetHeightHash(ctx, uint64(req.Header.Height), common.BytesToHash(req.Hash))
// TODO: prune
k.SetHeaderHash(ctx, req.Header.Height, k.headerHash)
} }
// EndBlock updates the accounts and commits state objects to the KV Store, while // EndBlock updates the accounts and commits state objects to the KV Store, while

View File

@ -9,7 +9,9 @@ import (
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
ethcmn "github.com/ethereum/go-ethereum/common" 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) ctx := sdk.UnwrapSDKContext(c)
k.CommitStateDB.WithContext(ctx) k.CommitStateDB.WithContext(ctx)
@ -127,9 +136,16 @@ func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*typ
key := ethcmn.HexToHash(req.Key) key := ethcmn.HexToHash(req.Key)
state := k.CommitStateDB.GetState(address, 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{ return &types.QueryStorageResponse{
Value: state.String(), Value: stateHex,
}, nil }, 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) { func (k Keeper) TxReceiptsByBlockHeight(c context.Context, _ *types.QueryTxReceiptsByBlockHeightRequest) (*types.QueryTxReceiptsByBlockHeightResponse, error) {
ctx := sdk.UnwrapSDKContext(c) ctx := sdk.UnwrapSDKContext(c)
receipts := k.GetTxReceiptsByBlockHeight(ctx, ctx.BlockHeight()) receipts := k.GetTxReceiptsByBlockHeight(ctx, uint64(ctx.BlockHeight()))
return &types.QueryTxReceiptsByBlockHeightResponse{ return &types.QueryTxReceiptsByBlockHeightResponse{
Receipts: receipts, Receipts: receipts,
}, nil }, 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 // BlockLogs implements the Query/BlockLogs gRPC method
func (k Keeper) BlockLogs(c context.Context, req *types.QueryBlockLogsRequest) (*types.QueryBlockLogsResponse, error) { func (k Keeper) BlockLogs(c context.Context, req *types.QueryBlockLogsRequest) (*types.QueryBlockLogsResponse, error) {
if req == nil { if req == nil {
@ -263,10 +256,30 @@ func (k Keeper) BlockLogs(c context.Context, req *types.QueryBlockLogsRequest) (
ctx := sdk.UnwrapSDKContext(c) 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{ return &types.QueryBlockLogsResponse{
TxLogs: txLogs, TxLogs: txLogs,
Pagination: pageRes,
}, nil }, nil
} }

View File

@ -236,10 +236,8 @@ func (suite *KeeperTestSuite) TestQueryStorage() {
Address: suite.address.String(), Address: suite.address.String(),
Key: ethcmn.Hash{}.String(), Key: ethcmn.Hash{}.String(),
} }
exp := &types.QueryStorageResponse{Value: "0x0000000000000000000000000000000000000000000000000000000000000000"}
expValue = exp.Value
}, },
true, false,
}, },
{ {
"success", "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() { func (suite *KeeperTestSuite) TestQueryBlockBloom() {
var ( var (
req *types.QueryBlockBloomRequest req *types.QueryBlockBloomRequest

View File

@ -39,7 +39,9 @@ type Keeper struct {
ctx sdk.Context ctx sdk.Context
// chain ID number obtained from the context's chain id // chain ID number obtained from the context's chain id
eip155ChainID *big.Int eip155ChainID *big.Int
debug bool
// TODO: deprecate
// Ethermint concrete implementation on the EVM StateDB interface // Ethermint concrete implementation on the EVM StateDB interface
CommitStateDB *types.CommitStateDB CommitStateDB *types.CommitStateDB
@ -48,6 +50,9 @@ type Keeper struct {
// TODO: (@fedekunze) for how long should we persist the entries in the access list? // 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)? // same block (i.e Transient Store)? 2 or more (KVStore with module Parameter which resets the state after that window)?
accessList *types.AccessListMappings accessList *types.AccessListMappings
// hash header for the current height. Reset during abci.RequestBeginBlock
headerHash common.Hash
} }
// NewKeeper generates new evm module keeper // NewKeeper generates new evm module keeper
@ -148,40 +153,24 @@ func (k Keeper) SetBlockBloomTransient(bloom *big.Int) {
// Block // Block
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// GetBlockHash gets block height from block consensus hash // GetHeaderHash gets the header hash from a given height
func (k Keeper) GetBlockHashFromHeight(ctx sdk.Context, height int64) (common.Hash, bool) { func (k Keeper) GetHeaderHash(ctx sdk.Context, height int64) common.Hash {
store := ctx.KVStore(k.storeKey) store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixHeightToHeaderHash)
bz := store.Get(types.KeyBlockHeightHash(uint64(height))) key := sdk.Uint64ToBigEndian(uint64(height))
bz := store.Get(key)
if len(bz) == 0 { 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 // SetBlockHash sets the mapping from heigh -> header hash
func (k Keeper) SetBlockHash(ctx sdk.Context, hash []byte, height int64) { func (k Keeper) SetHeaderHash(ctx sdk.Context, height int64, hash common.Hash) {
store := ctx.KVStore(k.storeKey) store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixHeightToHeaderHash)
bz := sdk.Uint64ToBigEndian(uint64(height)) key := sdk.Uint64ToBigEndian(uint64(height))
store.Set(types.KeyBlockHash(common.BytesToHash(hash)), bz) store.Set(key, hash.Bytes())
}
// 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())
} }
// SetTxReceiptToHash sets the mapping from tx hash to tx receipt // 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. // GetTxsFromBlock returns list of tx hash in the block by height.
func (k Keeper) GetTxsFromBlock(ctx sdk.Context, blockHeight int64) []common.Hash { func (k Keeper) GetTxsFromBlock(ctx sdk.Context, blockHeight uint64) []common.Hash {
key := types.KeyBlockHeightTxs(uint64(blockHeight)) key := types.KeyBlockHeightTxs(blockHeight)
store := ctx.KVStore(k.storeKey) store := ctx.KVStore(k.storeKey)
data := store.Get(key) 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. // 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) txs := k.GetTxsFromBlock(ctx, blockHeight)
if len(txs) == 0 { if len(txs) == 0 {
return nil return nil
@ -312,16 +301,6 @@ func (k Keeper) GetTxReceiptsByBlockHeight(ctx sdk.Context, blockHeight int64) [
return receipts 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 // Log
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -54,7 +54,6 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
txHash := tmtypes.Tx(ctx.TxBytes()).Hash() txHash := tmtypes.Tx(ctx.TxBytes()).Hash()
ethHash := ethcmn.BytesToHash(txHash) ethHash := ethcmn.BytesToHash(txHash)
blockHash, _ := k.GetBlockHashFromHeight(ctx, ctx.BlockHeight())
st := &types.StateTransition{ st := &types.StateTransition{
Message: ethMsg, Message: ethMsg,
@ -69,7 +68,7 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
// other nodes, causing a consensus error // other nodes, causing a consensus error
if !st.Simulate { if !st.Simulate {
// Prepare db for logs // Prepare db for logs
k.CommitStateDB.Prepare(ethHash, blockHash, int(k.GetTxIndexTransient())) k.CommitStateDB.Prepare(ethHash, k.headerHash, int(k.GetTxIndexTransient()))
k.IncreaseTxIndexTransient() k.IncreaseTxIndexTransient()
} }
@ -85,7 +84,7 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
From: sender.Hex(), From: sender.Hex(),
Data: msg.Data, Data: msg.Data,
BlockHeight: uint64(ctx.BlockHeight()), BlockHeight: uint64(ctx.BlockHeight()),
BlockHash: blockHash.Hex(), BlockHash: k.headerHash.Hex(),
Result: &types.TxResult{ Result: &types.TxResult{
ContractAddress: executionResult.Response.ContractAddress, ContractAddress: executionResult.Response.ContractAddress,
Bloom: executionResult.Response.Bloom, Bloom: executionResult.Response.Bloom,
@ -118,14 +117,13 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
panic(err) panic(err)
} }
blockHash, _ := k.GetBlockHashFromHeight(ctx, ctx.BlockHeight())
k.SetTxReceiptToHash(ctx, ethHash, &types.TxReceipt{ k.SetTxReceiptToHash(ctx, ethHash, &types.TxReceipt{
Hash: ethHash.Hex(), Hash: ethHash.Hex(),
From: sender.Hex(), From: sender.Hex(),
Data: msg.Data, Data: msg.Data,
Index: uint64(st.Csdb.TxIndex()), Index: uint64(st.Csdb.TxIndex()),
BlockHeight: uint64(ctx.BlockHeight()), BlockHeight: uint64(ctx.BlockHeight()),
BlockHash: blockHash.Hex(), BlockHash: k.headerHash.Hex(),
Result: &types.TxResult{ Result: &types.TxResult{
ContractAddress: executionResult.Response.ContractAddress, ContractAddress: executionResult.Response.ContractAddress,
Bloom: executionResult.Response.Bloom, 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 // emit events
ctx.EventManager().EmitEvents(sdk.Events{ ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent( sdk.NewEvent(
types.EventTypeEthereumTx, types.EventTypeEthereumTx,
sdk.NewAttribute(sdk.AttributeKeyAmount, st.Message.Value().String()), attrs...,
sdk.NewAttribute(types.AttributeKeyTxHash, ethcmn.BytesToHash(txHash).Hex()),
), ),
sdk.NewEvent( sdk.NewEvent(
sdk.EventTypeMessage, 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 return executionResult.Response, nil
} }

View File

@ -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. // 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) { 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) k.AddAddressToAccessList(sender)
if dest != nil { if dest != nil {
k.AddAddressToAccessList(*dest) k.AddAddressToAccessList(*dest)
@ -532,11 +527,8 @@ func (k *Keeper) RevertToSnapshot(_ int) {}
// to store. // to store.
func (k *Keeper) AddLog(log *ethtypes.Log) { func (k *Keeper) AddLog(log *ethtypes.Log) {
txHash := common.BytesToHash(tmtypes.Tx(k.ctx.TxBytes()).Hash()) 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.TxHash = txHash
log.TxIndex = uint(k.GetTxIndexTransient()) log.TxIndex = uint(k.GetTxIndexTransient())

View File

@ -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())
}

View File

@ -2,44 +2,77 @@ package types
import ( import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" 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 ( var (
// ErrInvalidState returns an error resulting from an invalid Storage State. // 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 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 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 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 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 returns an error if the block bloom cannot be found on the store.
ErrBloomNotFound = sdkerrors.Register(ModuleName, 7, "block bloom not found") ErrBloomNotFound = sdkerrors.Register(ModuleName, codeErrBloomNotFound, "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")
// ErrTxReceiptNotFound returns an error if the transaction receipt could not be 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 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 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)
}

View File

@ -19,6 +19,7 @@ type AccountKeeper interface {
// BankKeeper defines the expected interface needed to retrieve account balances. // BankKeeper defines the expected interface needed to retrieve account balances.
type BankKeeper interface { type BankKeeper interface {
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin 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 AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) error
SubtractCoins(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 SetBalance(ctx sdk.Context, addr sdk.AccAddress, balance sdk.Coin) error

View File

@ -18,6 +18,11 @@ type journalEntry interface {
dirtied() *ethcmn.Address dirtied() *ethcmn.Address
} }
type revision struct {
id int
journalIndex int
}
// journal contains the list of state modifications applied since the last state // 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 // commit. These are tracked to be able to be reverted in case of an execution
// exception or revertal request. // exception or revertal request.

View File

@ -25,13 +25,12 @@ const (
) )
const ( const (
prefixBlockHash = iota + 1 prefixHeightToHeaderHash = iota + 1
prefixBloom prefixBloom
prefixLogs prefixLogs
prefixCode prefixCode
prefixStorage prefixStorage
prefixChainConfig prefixChainConfig
prefixBlockHeightHash
prefixHashTxReceipt prefixHashTxReceipt
prefixBlockHeightTxs prefixBlockHeightTxs
) )
@ -45,13 +44,12 @@ const (
// KVStore key prefixes // KVStore key prefixes
var ( var (
KeyPrefixBlockHash = []byte{prefixBlockHash} KeyPrefixHeightToHeaderHash = []byte{prefixHeightToHeaderHash}
KeyPrefixBloom = []byte{prefixBloom} KeyPrefixBloom = []byte{prefixBloom}
KeyPrefixLogs = []byte{prefixLogs} KeyPrefixLogs = []byte{prefixLogs}
KeyPrefixCode = []byte{prefixCode} KeyPrefixCode = []byte{prefixCode}
KeyPrefixStorage = []byte{prefixStorage} KeyPrefixStorage = []byte{prefixStorage}
KeyPrefixChainConfig = []byte{prefixChainConfig} KeyPrefixChainConfig = []byte{prefixChainConfig}
KeyPrefixBlockHeightHash = []byte{prefixBlockHeightHash}
KeyPrefixHashTxReceipt = []byte{prefixHashTxReceipt} KeyPrefixHashTxReceipt = []byte{prefixHashTxReceipt}
KeyPrefixBlockHeightTxs = []byte{prefixBlockHeightTxs} KeyPrefixBlockHeightTxs = []byte{prefixBlockHeightTxs}
) )
@ -79,17 +77,6 @@ func StateKey(address ethcmn.Address, key []byte) []byte {
return append(AddressStoragePrefix(address), key...) 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. // KeyHashTxReceipt returns a key for accessing tx receipt data by hash.
func KeyHashTxReceipt(hash ethcmn.Hash) []byte { func KeyHashTxReceipt(hash ethcmn.Hash) []byte {
return append(KeyPrefixHashTxReceipt, hash.Bytes()...) return append(KeyPrefixHashTxReceipt, hash.Bytes()...)

View File

@ -1,7 +1,6 @@
package types package types
import ( import (
"bytes"
"errors" "errors"
"fmt" "fmt"
@ -36,7 +35,7 @@ func NewTransactionLogsFromEth(hash ethcmn.Hash, ethlogs []*ethtypes.Log) Transa
// Validate performs a basic validation of a GenesisAccount fields. // Validate performs a basic validation of a GenesisAccount fields.
func (tx TransactionLogs) Validate() error { 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) return fmt.Errorf("hash cannot be the empty %s", tx.Hash)
} }

View File

@ -100,13 +100,13 @@ func (msg MsgEthereumTx) Type() string { return TypeMsgEthereumTx }
func (msg MsgEthereumTx) ValidateBasic() error { func (msg MsgEthereumTx) ValidateBasic() error {
gasPrice := new(big.Int).SetBytes(msg.Data.GasPrice) gasPrice := new(big.Int).SetBytes(msg.Data.GasPrice)
if gasPrice.Sign() == -1 { 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 can be 0
amount := new(big.Int).SetBytes(msg.Data.Amount) amount := new(big.Int).SetBytes(msg.Data.Amount)
if amount.Sign() == -1 { 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 != "" { if msg.Data.To != "" {
@ -218,7 +218,7 @@ func (msg *MsgEthereumTx) DecodeRLP(s *rlp.Stream) error {
// the sender is not registered on the keyring // the sender is not registered on the keyring
func (msg *MsgEthereumTx) Sign(chainID *big.Int, signer keyring.Signer) error { func (msg *MsgEthereumTx) Sign(chainID *big.Int, signer keyring.Signer) error {
from := msg.GetFrom() from := msg.GetFrom()
if from == nil { if from.Empty() {
return fmt.Errorf("sender address not defined for message") return fmt.Errorf("sender address not defined for message")
} }

View File

@ -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 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: "pass contract", to: nil, amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true},
{msg: "invalid recipient", to: &ethcmn.Address{}, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true}, {msg: "invalid recipient", to: &ethcmn.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 // NOTE: these can't be effectively tested because the SetBytes function from big.Int only sets
// the absolute value // the absolute value
{msg: "negative amount", to: &suite.to, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true}, {msg: "negative amount", to: &suite.to, amount: big.NewInt(-1), gasPrice: big.NewInt(1000), expectPass: true},

View File

@ -46,7 +46,7 @@ func DefaultParams() Params {
EvmDenom: DefaultEVMDenom, EvmDenom: DefaultEVMDenom,
EnableCreate: true, EnableCreate: true,
EnableCall: 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) 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 { func validateEVMDenom(i interface{}) error {
denom, ok := i.(string) denom, ok := i.(string)
if !ok { if !ok {

View File

@ -59,7 +59,3 @@ func TestParamsValidatePriv(t *testing.T) {
require.Error(t, validateEIPs("")) require.Error(t, validateEIPs(""))
require.NoError(t, validateEIPs([]int64{1884})) 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())
}

View File

@ -6,6 +6,7 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc" grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
@ -747,102 +748,19 @@ func (m *QueryTxReceiptsByBlockHeightResponse) GetReceipts() []*TxReceipt {
return nil 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. // QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method.
type QueryBlockLogsRequest struct { type QueryBlockLogsRequest struct {
// hash is the block hash to query the logs for. // hash is the block hash to query the logs for.
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` 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) Reset() { *m = QueryBlockLogsRequest{} }
func (m *QueryBlockLogsRequest) String() string { return proto.CompactTextString(m) } func (m *QueryBlockLogsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBlockLogsRequest) ProtoMessage() {} func (*QueryBlockLogsRequest) ProtoMessage() {}
func (*QueryBlockLogsRequest) Descriptor() ([]byte, []int) { func (*QueryBlockLogsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{18} return fileDescriptor_8bbc79ec2b6c5cb2, []int{16}
} }
func (m *QueryBlockLogsRequest) XXX_Unmarshal(b []byte) error { func (m *QueryBlockLogsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -875,13 +793,15 @@ var xxx_messageInfo_QueryBlockLogsRequest proto.InternalMessageInfo
type QueryBlockLogsResponse struct { type QueryBlockLogsResponse struct {
// logs represents the ethereum logs generated at the given block hash. // 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"` 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) Reset() { *m = QueryBlockLogsResponse{} }
func (m *QueryBlockLogsResponse) String() string { return proto.CompactTextString(m) } func (m *QueryBlockLogsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBlockLogsResponse) ProtoMessage() {} func (*QueryBlockLogsResponse) ProtoMessage() {}
func (*QueryBlockLogsResponse) Descriptor() ([]byte, []int) { func (*QueryBlockLogsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{19} return fileDescriptor_8bbc79ec2b6c5cb2, []int{17}
} }
func (m *QueryBlockLogsResponse) XXX_Unmarshal(b []byte) error { func (m *QueryBlockLogsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -917,6 +837,13 @@ func (m *QueryBlockLogsResponse) GetTxLogs() []TransactionLogs {
return nil 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 // QueryBlockBloomRequest is the request type for the Query/BlockBloom RPC
// method. // method.
type QueryBlockBloomRequest struct { type QueryBlockBloomRequest struct {
@ -926,7 +853,7 @@ func (m *QueryBlockBloomRequest) Reset() { *m = QueryBlockBloomRequest{}
func (m *QueryBlockBloomRequest) String() string { return proto.CompactTextString(m) } func (m *QueryBlockBloomRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBlockBloomRequest) ProtoMessage() {} func (*QueryBlockBloomRequest) ProtoMessage() {}
func (*QueryBlockBloomRequest) Descriptor() ([]byte, []int) { func (*QueryBlockBloomRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{20} return fileDescriptor_8bbc79ec2b6c5cb2, []int{18}
} }
func (m *QueryBlockBloomRequest) XXX_Unmarshal(b []byte) error { func (m *QueryBlockBloomRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -966,7 +893,7 @@ func (m *QueryBlockBloomResponse) Reset() { *m = QueryBlockBloomResponse
func (m *QueryBlockBloomResponse) String() string { return proto.CompactTextString(m) } func (m *QueryBlockBloomResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBlockBloomResponse) ProtoMessage() {} func (*QueryBlockBloomResponse) ProtoMessage() {}
func (*QueryBlockBloomResponse) Descriptor() ([]byte, []int) { func (*QueryBlockBloomResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{21} return fileDescriptor_8bbc79ec2b6c5cb2, []int{19}
} }
func (m *QueryBlockBloomResponse) XXX_Unmarshal(b []byte) error { func (m *QueryBlockBloomResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -1010,7 +937,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) { func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{22} return fileDescriptor_8bbc79ec2b6c5cb2, []int{20}
} }
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -1049,7 +976,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) { func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{23} return fileDescriptor_8bbc79ec2b6c5cb2, []int{21}
} }
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -1097,7 +1024,7 @@ func (m *QueryStaticCallRequest) Reset() { *m = QueryStaticCallRequest{}
func (m *QueryStaticCallRequest) String() string { return proto.CompactTextString(m) } func (m *QueryStaticCallRequest) String() string { return proto.CompactTextString(m) }
func (*QueryStaticCallRequest) ProtoMessage() {} func (*QueryStaticCallRequest) ProtoMessage() {}
func (*QueryStaticCallRequest) Descriptor() ([]byte, []int) { func (*QueryStaticCallRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{24} return fileDescriptor_8bbc79ec2b6c5cb2, []int{22}
} }
func (m *QueryStaticCallRequest) XXX_Unmarshal(b []byte) error { func (m *QueryStaticCallRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -1149,7 +1076,7 @@ func (m *QueryStaticCallResponse) Reset() { *m = QueryStaticCallResponse
func (m *QueryStaticCallResponse) String() string { return proto.CompactTextString(m) } func (m *QueryStaticCallResponse) String() string { return proto.CompactTextString(m) }
func (*QueryStaticCallResponse) ProtoMessage() {} func (*QueryStaticCallResponse) ProtoMessage() {}
func (*QueryStaticCallResponse) Descriptor() ([]byte, []int) { func (*QueryStaticCallResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_8bbc79ec2b6c5cb2, []int{25} return fileDescriptor_8bbc79ec2b6c5cb2, []int{23}
} }
func (m *QueryStaticCallResponse) XXX_Unmarshal(b []byte) error { func (m *QueryStaticCallResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -1202,8 +1129,6 @@ func init() {
proto.RegisterType((*QueryTxReceiptResponse)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptResponse") proto.RegisterType((*QueryTxReceiptResponse)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptResponse")
proto.RegisterType((*QueryTxReceiptsByBlockHeightRequest)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest") proto.RegisterType((*QueryTxReceiptsByBlockHeightRequest)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightRequest")
proto.RegisterType((*QueryTxReceiptsByBlockHeightResponse)(nil), "ethermint.evm.v1alpha1.QueryTxReceiptsByBlockHeightResponse") 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((*QueryBlockLogsRequest)(nil), "ethermint.evm.v1alpha1.QueryBlockLogsRequest")
proto.RegisterType((*QueryBlockLogsResponse)(nil), "ethermint.evm.v1alpha1.QueryBlockLogsResponse") proto.RegisterType((*QueryBlockLogsResponse)(nil), "ethermint.evm.v1alpha1.QueryBlockLogsResponse")
proto.RegisterType((*QueryBlockBloomRequest)(nil), "ethermint.evm.v1alpha1.QueryBlockBloomRequest") proto.RegisterType((*QueryBlockBloomRequest)(nil), "ethermint.evm.v1alpha1.QueryBlockBloomRequest")
@ -1219,78 +1144,79 @@ func init() {
} }
var fileDescriptor_8bbc79ec2b6c5cb2 = []byte{ var fileDescriptor_8bbc79ec2b6c5cb2 = []byte{
// 1130 bytes of a gzipped FileDescriptorProto // 1141 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0xcf, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x97, 0x4d, 0x6f, 0x1b, 0x45,
0x14, 0xc7, 0xbd, 0x89, 0x13, 0x27, 0xaf, 0x0d, 0x0a, 0x83, 0xdb, 0x86, 0x2d, 0x72, 0xd2, 0x29, 0x18, 0xc7, 0xbd, 0x89, 0x13, 0x27, 0x4f, 0x1a, 0x28, 0x83, 0x69, 0xc3, 0x16, 0x39, 0x61, 0x4b,
0x69, 0x9c, 0x26, 0xf5, 0x36, 0x46, 0xa5, 0xf4, 0x97, 0x50, 0x5c, 0xa9, 0x8a, 0x44, 0x85, 0xc0, 0x12, 0xe7, 0xa5, 0xbb, 0xb5, 0x11, 0xaf, 0x2d, 0x42, 0x71, 0xa5, 0x10, 0x89, 0x0a, 0x15, 0x07,
0x81, 0x0b, 0x17, 0x33, 0x5e, 0x8f, 0xd6, 0x56, 0xd6, 0x3b, 0xae, 0x67, 0x1d, 0x25, 0x8a, 0x7a, 0x2e, 0x5c, 0xac, 0xf1, 0x7a, 0xb4, 0xb6, 0xb2, 0xde, 0x71, 0xb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0xed, 0x51, 0x29, 0xf7, 0xea, 0xa8, 0x94, 0xfb, 0xf3, 0xa8, 0x61, 0x53, 0xd7, 0xad, 0xed, 0x3c, 0x3b, 0x2b, 0x69, 0xcf, 0xcf, 0x4a, 0xda, 0x3f, 0x67, 0x25,
0x94, 0xfb, 0x6c, 0xc5, 0xe9, 0xf8, 0xed, 0x41, 0xb3, 0x62, 0x8b, 0x2e, 0x8a, 0x67, 0x24, 0xde, 0xed, 0xfb, 0xf3, 0x52, 0xee, 0xf9, 0x79, 0x29, 0xf7, 0xd7, 0x79, 0x29, 0xf7, 0xd5, 0xba, 0xd3,
0x9e, 0x8e, 0xe8, 0xef, 0xf7, 0xb8, 0x6c, 0x4e, 0xeb, 0x7f, 0xd6, 0xef, 0xfc, 0x17, 0x00, 0x00, 0x09, 0xda, 0x83, 0xa6, 0x69, 0xf3, 0x2e, 0x9a, 0x4d, 0xa4, 0xde, 0x91, 0xac, 0x18, 0x1c, 0xf7,
0xff, 0xff, 0x0c, 0x87, 0xad, 0x46, 0xed, 0x0f, 0x00, 0x00, 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. // 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) TxReceipt(ctx context.Context, in *QueryTxReceiptRequest, opts ...grpc.CallOption) (*QueryTxReceiptResponse, error)
// TxReceiptsByBlockHeight queries tx receipts by a block height. // TxReceiptsByBlockHeight queries tx receipts by a block height.
TxReceiptsByBlockHeight(ctx context.Context, in *QueryTxReceiptsByBlockHeightRequest, opts ...grpc.CallOption) (*QueryTxReceiptsByBlockHeightResponse, error) 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 queries all the ethereum logs for a given block hash.
BlockLogs(ctx context.Context, in *QueryBlockLogsRequest, opts ...grpc.CallOption) (*QueryBlockLogsResponse, error) BlockLogs(ctx context.Context, in *QueryBlockLogsRequest, opts ...grpc.CallOption) (*QueryBlockLogsResponse, error)
// BlockBloom queries the block bloom filter bytes at a given height. // 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 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) { func (c *queryClient) BlockLogs(ctx context.Context, in *QueryBlockLogsRequest, opts ...grpc.CallOption) (*QueryBlockLogsResponse, error) {
out := new(QueryBlockLogsResponse) out := new(QueryBlockLogsResponse)
err := c.cc.Invoke(ctx, "/ethermint.evm.v1alpha1.Query/BlockLogs", in, out, opts...) 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) TxReceipt(context.Context, *QueryTxReceiptRequest) (*QueryTxReceiptResponse, error)
// TxReceiptsByBlockHeight queries tx receipts by a block height. // TxReceiptsByBlockHeight queries tx receipts by a block height.
TxReceiptsByBlockHeight(context.Context, *QueryTxReceiptsByBlockHeightRequest) (*QueryTxReceiptsByBlockHeightResponse, error) 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 queries all the ethereum logs for a given block hash.
BlockLogs(context.Context, *QueryBlockLogsRequest) (*QueryBlockLogsResponse, error) BlockLogs(context.Context, *QueryBlockLogsRequest) (*QueryBlockLogsResponse, error)
// BlockBloom queries the block bloom filter bytes at a given height. // 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) { func (*UnimplementedQueryServer) TxReceiptsByBlockHeight(ctx context.Context, req *QueryTxReceiptsByBlockHeightRequest) (*QueryTxReceiptsByBlockHeightResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TxReceiptsByBlockHeight not implemented") 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) { func (*UnimplementedQueryServer) BlockLogs(ctx context.Context, req *QueryBlockLogsRequest) (*QueryBlockLogsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BlockLogs not implemented") 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) 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) { func _Query_BlockLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryBlockLogsRequest) in := new(QueryBlockLogsRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -1808,10 +1700,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "TxReceiptsByBlockHeight", MethodName: "TxReceiptsByBlockHeight",
Handler: _Query_TxReceiptsByBlockHeight_Handler, Handler: _Query_TxReceiptsByBlockHeight_Handler,
}, },
{
MethodName: "TxReceiptsByBlockHash",
Handler: _Query_TxReceiptsByBlockHash_Handler,
},
{ {
MethodName: "BlockLogs", MethodName: "BlockLogs",
Handler: _Query_BlockLogs_Handler, Handler: _Query_BlockLogs_Handler,
@ -2354,73 +2242,6 @@ func (m *QueryTxReceiptsByBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte)
return len(dAtA) - i, nil 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) { func (m *QueryBlockLogsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -2441,6 +2262,18 @@ func (m *QueryBlockLogsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = 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 { if len(m.Hash) > 0 {
i -= len(m.Hash) i -= len(m.Hash)
copy(dAtA[i:], m.Hash) copy(dAtA[i:], m.Hash)
@ -2471,6 +2304,18 @@ func (m *QueryBlockLogsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
_ = i _ = i
var l int var l int
_ = l _ = 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 { if len(m.TxLogs) > 0 {
for iNdEx := len(m.TxLogs) - 1; iNdEx >= 0; iNdEx-- { for iNdEx := len(m.TxLogs) - 1; iNdEx >= 0; iNdEx-- {
{ {
@ -2900,34 +2745,6 @@ func (m *QueryTxReceiptsByBlockHeightResponse) Size() (n int) {
return n return n
} }
func (m *QueryTxReceiptsByBlockHashRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Hash)
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) { func (m *QueryBlockLogsRequest) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
@ -2938,6 +2755,10 @@ func (m *QueryBlockLogsRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovQuery(uint64(l)) n += 1 + l + sovQuery(uint64(l))
} }
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n return n
} }
@ -2953,6 +2774,10 @@ func (m *QueryBlockLogsResponse) Size() (n int) {
n += 1 + l + sovQuery(uint64(l)) n += 1 + l + sovQuery(uint64(l))
} }
} }
if m.Pagination != nil {
l = m.Pagination.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n return n
} }
@ -4495,178 +4320,6 @@ func (m *QueryTxReceiptsByBlockHeightResponse) Unmarshal(dAtA []byte) error {
} }
return nil 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 { func (m *QueryBlockLogsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
@ -4728,6 +4381,42 @@ func (m *QueryBlockLogsRequest) Unmarshal(dAtA []byte) error {
} }
m.Hash = string(dAtA[iNdEx:postIndex]) m.Hash = string(dAtA[iNdEx:postIndex])
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: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:]) skippy, err := skipQuery(dAtA[iNdEx:])
@ -4815,6 +4504,42 @@ func (m *QueryBlockLogsResponse) Unmarshal(dAtA []byte) error {
return err return err
} }
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.PageResponse{}
}
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:]) skippy, err := skipQuery(dAtA[iNdEx:])

View File

@ -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 (
var protoReq QueryTxReceiptsByBlockHashRequest filter_Query_BlockLogs_0 = &utilities.DoubleArray{Encoding: map[string]int{"hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
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
}
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) { 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 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) 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)) msg, err := client.BlockLogs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err 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) 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) msg, err := server.BlockLogs(ctx, &protoReq)
return msg, metadata, err 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) { mux.Handle("GET", pattern_Query_BlockLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() 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) { mux.Handle("GET", pattern_Query_BlockLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() 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_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_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))) 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_TxReceiptsByBlockHeight_0 = runtime.ForwardResponseMessage
forward_Query_TxReceiptsByBlockHash_0 = runtime.ForwardResponseMessage
forward_Query_BlockLogs_0 = runtime.ForwardResponseMessage forward_Query_BlockLogs_0 = runtime.ForwardResponseMessage
forward_Query_BlockBloom_0 = runtime.ForwardResponseMessage forward_Query_BlockBloom_0 = runtime.ForwardResponseMessage

View File

@ -25,11 +25,6 @@ var (
zeroBalance = sdk.ZeroInt().BigInt() zeroBalance = sdk.ZeroInt().BigInt()
) )
type revision struct {
id int
journalIndex int
}
// CommitStateDB implements the Geth state.StateDB interface. Instead of using // CommitStateDB implements the Geth state.StateDB interface. Instead of using
// a trie and database for querying and persistence, the Keeper uses KVStores // a trie and database for querying and persistence, the Keeper uses KVStores
// and an AccountKeeper to facilitate state transitions. // 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. // SetHeightHash sets the block header hash associated with a given height.
func (csdb *CommitStateDB) SetHeightHash(height uint64, hash ethcmn.Hash) { func (csdb *CommitStateDB) SetHeightHash(height uint64, hash ethcmn.Hash) {
store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixBlockHeightHash) store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixHeightToHeaderHash)
key := KeyBlockHeightHash(height) store.Set(sdk.Uint64ToBigEndian(height), hash.Bytes())
store.Set(key, hash.Bytes())
} }
// SetParams sets the evm parameters to the param space. // 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. // GetHeightHash returns the block header hash associated with a given block height and chain epoch number.
func (csdb *CommitStateDB) GetHeightHash(height uint64) ethcmn.Hash { func (csdb *CommitStateDB) GetHeightHash(height uint64) ethcmn.Hash {
store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixBlockHeightHash) store := prefix.NewStore(csdb.ctx.KVStore(csdb.storeKey), KeyPrefixHeightToHeaderHash)
key := KeyBlockHeightHash(height) key := sdk.Uint64ToBigEndian(height)
bz := store.Get(key) bz := store.Get(key)
if len(bz) == 0 { if len(bz) == 0 {
return ethcmn.Hash{} return ethcmn.Hash{}