Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
879318f
fix: chain-id in grpc query is not initialized without abci event
Oct 27, 2022
704273f
Update CHANGELOG.md
Oct 27, 2022
7d9871d
only override if input is not empty
Oct 27, 2022
b21fa51
Merge remote-tracking branch 'fork/main'
Oct 27, 2022
879178b
add comment to chain id
Oct 27, 2022
7315adf
pass chain-id to state transition
Oct 28, 2022
9b9fab0
Merge branch 'main' into main
Oct 28, 2022
d286dca
Update x/evm/keeper/grpc_query.go
Oct 28, 2022
ff915fa
Apply suggestions from code review
Oct 28, 2022
3f34c7b
fix golang lint
Oct 28, 2022
c3a7177
Merge remote-tracking branch 'fork/main'
Oct 28, 2022
eb55c9f
Merge branch 'main' into main
Oct 28, 2022
de63d8d
update gomod2nix.toml
Oct 28, 2022
34fe936
Merge remote-tracking branch 'fork/main'
Oct 28, 2022
9fecbd1
fix unit tests
Oct 29, 2022
17aa02d
update gomod2nix
Oct 29, 2022
de2ee2c
Merge branch 'main' into main
Oct 31, 2022
710d811
api breaking changelog
Oct 31, 2022
86773b6
add unit tests, and fix TraceBlock by the way
Oct 31, 2022
dd00580
Update CHANGELOG.md
fedekunze Nov 1, 2022
5ee7bd1
Merge branch 'main' into main
fedekunze Nov 2, 2022
b7c9824
Merge remote-tracking branch 'origin/main'
Nov 9, 2022
f3fda5b
Merge branch 'main' into main
Nov 10, 2022
ecf8f89
test --grpc-only mode in integration tests
Nov 10, 2022
5ce1586
Merge remote-tracking branch 'fork/main'
Nov 10, 2022
08a63ea
Merge branch 'main' into main
Nov 10, 2022
94d98c9
remove tmp var
Nov 10, 2022
a2b1259
Merge remote-tracking branch 'fork/main'
Nov 10, 2022
0e38258
Update tests/integration_tests/test_grpc_only.py
Nov 10, 2022
16a50a1
Update x/evm/keeper/grpc_query_test.go
Nov 11, 2022
e8ac732
Merge branch 'main' into main
Nov 11, 2022
f70990b
Merge branch 'main' into main
facs95 Nov 14, 2022
d029534
fix linters
Nov 15, 2022
2d4de7e
Merge branch 'main' into main
facs95 Nov 17, 2022
ca38164
fix nil pointer in tests
facs95 Nov 17, 2022
abfb0a3
Merge branch 'main' into yihuang/main
facs95 Nov 17, 2022
e4636be
fix conflicts
facs95 Nov 17, 2022
9e0d9e5
fix conflicts
facs95 Nov 17, 2022
929c790
fixes
facs95 Nov 18, 2022
749d981
fix lint
Nov 18, 2022
6d17c66
fix unit test
facs95 Nov 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (cli) [#1362](https://github.com/evmos/ethermint/pull/1362) Fix `index-eth-tx` error when the indexer db is empty.
* (state) [#1320](https://github.com/evmos/ethermint/pull/1320) Fix codehash check mismatch when the code has been deleted in the evm state.
* (rpc) [#1392](https://github.com/evmos/ethermint/pull/1392) Allow fill the proposer address in json-rpc through tendermint api, and pass explicitly to grpc query handler.
* (rpc) [#1405](https://github.com/evmos/ethermint/pull/1405) Pass chain-id to grpc query through request, otherwise it's not initialized if abci event don't happens.

## [v0.19.2] - 2022-08-29

Expand Down
3 changes: 3 additions & 0 deletions docs/api/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ EthCallRequest defines EthCall request
| `args` | [bytes](#bytes) | | same json format as the json rpc api. |
| `gas_cap` | [uint64](#uint64) | | the default gas cap to be used |
| `proposer_address` | [bytes](#bytes) | | the proposer of the requested block |
| `chain_id` | [string](#string) | | |



Expand Down Expand Up @@ -793,6 +794,7 @@ QueryTraceBlockRequest defines TraceTx request
| `block_hash` | [string](#string) | | block hex hash |
| `block_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | block time |
| `proposer_address` | [bytes](#bytes) | | the proposer of the requested block |
| `chain_id` | [string](#string) | | |



Expand Down Expand Up @@ -829,6 +831,7 @@ QueryTraceTxRequest defines TraceTx request
| `block_hash` | [string](#string) | | block hex hash of requested transaction |
| `block_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | block time of requested transaction |
| `proposer_address` | [bytes](#bytes) | | the proposer of the requested block |
| `chain_id` | [string](#string) | | |



Expand Down
3 changes: 3 additions & 0 deletions proto/ethermint/evm/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ message EthCallRequest {
uint64 gas_cap = 2;
// the proposer of the requested block
bytes proposer_address = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"];
string chain_id = 4;
}

// EstimateGasResponse defines EstimateGas response
Expand Down Expand Up @@ -251,6 +252,7 @@ message QueryTraceTxRequest {
google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// the proposer of the requested block
bytes proposer_address = 8 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"];
string chain_id = 9;
}

// QueryTraceTxResponse defines TraceTx response
Expand All @@ -273,6 +275,7 @@ message QueryTraceBlockRequest {
google.protobuf.Timestamp block_time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// the proposer of the requested block
bytes proposer_address = 8 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"];
string chain_id = 9;
}

// QueryTraceBlockResponse defines TraceBlock response
Expand Down
2 changes: 2 additions & 0 deletions rpc/backend/call_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rp
Args: bz,
GasCap: b.RPCGasCap(),
ProposerAddress: sdk.ConsAddress(header.Block.ProposerAddress),
ChainId: header.Block.ChainID,
}

// From ContextWithHeight: if the provided height is 0,
Expand Down Expand Up @@ -339,6 +340,7 @@ func (b *Backend) DoCall(
Args: bz,
GasCap: b.RPCGasCap(),
ProposerAddress: sdk.ConsAddress(header.Block.ProposerAddress),
ChainId: header.Block.ChainID,
}

// From ContextWithHeight: if the provided height is 0,
Expand Down
2 changes: 2 additions & 0 deletions rpc/backend/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfi
BlockTime: blk.Block.Time,
BlockHash: common.Bytes2Hex(blk.BlockID.Hash),
ProposerAddress: sdk.ConsAddress(blk.Block.ProposerAddress),
ChainId: blk.Block.ChainID,
}

if config != nil {
Expand Down Expand Up @@ -162,6 +163,7 @@ func (b *Backend) TraceBlock(height rpctypes.BlockNumber,
BlockTime: block.Block.Time,
BlockHash: common.Bytes2Hex(block.BlockID.Hash),
ProposerAddress: sdk.ConsAddress(block.Block.ProposerAddress),
ChainId: block.Block.ChainID,
}

res, err := b.queryClient.TraceBlock(ctxWithHeight, traceBlockRequest)
Expand Down
18 changes: 18 additions & 0 deletions x/evm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.Ms
}

ctx := sdk.UnwrapSDKContext(c)
if len(req.ChainId) > 0 {
ctx = ctx.WithChainID(req.ChainId)
k.WithChainID(ctx)
}

var args types.TransactionArgs
err := json.Unmarshal(req.Args, &args)
Expand Down Expand Up @@ -256,6 +260,10 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
}

ctx := sdk.UnwrapSDKContext(c)
if len(req.ChainId) > 0 {
ctx = ctx.WithChainID(req.ChainId)
k.WithChainID(ctx)
}

if req.GasCap < ethparams.TxGas {
return nil, status.Error(codes.InvalidArgument, "gas cap cannot be lower than 21,000")
Expand Down Expand Up @@ -374,6 +382,11 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
ctx = ctx.WithBlockHeight(contextHeight)
ctx = ctx.WithBlockTime(req.BlockTime)
ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash))
if len(req.ChainId) > 0 {
ctx = ctx.WithChainID(req.ChainId)
k.WithChainID(ctx)
}

cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress))
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to load evm config: %s", err.Error())
Expand Down Expand Up @@ -441,6 +454,11 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest)
ctx = ctx.WithBlockHeight(contextHeight)
ctx = ctx.WithBlockTime(req.BlockTime)
ctx = ctx.WithHeaderHash(common.Hex2Bytes(req.BlockHash))
if len(req.ChainId) > 0 {
ctx = ctx.WithChainID(req.ChainId)
k.WithChainID(ctx)
}

cfg, err := k.EVMConfig(ctx, GetProposerAddress(ctx, req.ProposerAddress))
if err != nil {
return nil, status.Error(codes.Internal, "failed to load evm config")
Expand Down
6 changes: 4 additions & 2 deletions x/evm/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ func EstimateGas(ctx *simulateContext, from, to *common.Address, data *hexutil.B
}

res, err := ctx.keeper.EstimateGas(sdk.WrapSDKContext(ctx.context), &types.EthCallRequest{
Args: args,
GasCap: gasCap,
Args: args,
GasCap: gasCap,
ProposerAddress: ctx.context.BlockHeader().ProposerAddress,
ChainId: ctx.context.ChainID(),
})
if err != nil {
return 0, err
Expand Down
Loading