Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix: chain-id in grpc query is not initialized without abci event #1405

Merged
merged 41 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from 29 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
yihuang Oct 27, 2022
704273f
Update CHANGELOG.md
yihuang Oct 27, 2022
7d9871d
only override if input is not empty
yihuang Oct 27, 2022
b21fa51
Merge remote-tracking branch 'fork/main'
yihuang Oct 27, 2022
879178b
add comment to chain id
yihuang Oct 27, 2022
7315adf
pass chain-id to state transition
yihuang Oct 28, 2022
9b9fab0
Merge branch 'main' into main
yihuang Oct 28, 2022
d286dca
Update x/evm/keeper/grpc_query.go
yihuang Oct 28, 2022
ff915fa
Apply suggestions from code review
yihuang Oct 28, 2022
3f34c7b
fix golang lint
yihuang Oct 28, 2022
c3a7177
Merge remote-tracking branch 'fork/main'
yihuang Oct 28, 2022
eb55c9f
Merge branch 'main' into main
yihuang Oct 28, 2022
de63d8d
update gomod2nix.toml
yihuang Oct 28, 2022
34fe936
Merge remote-tracking branch 'fork/main'
yihuang Oct 28, 2022
9fecbd1
fix unit tests
yihuang Oct 29, 2022
17aa02d
update gomod2nix
yihuang Oct 29, 2022
de2ee2c
Merge branch 'main' into main
yihuang Oct 31, 2022
710d811
api breaking changelog
yihuang Oct 31, 2022
86773b6
add unit tests, and fix TraceBlock by the way
yihuang 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'
yihuang Nov 9, 2022
f3fda5b
Merge branch 'main' into main
yihuang Nov 10, 2022
ecf8f89
test --grpc-only mode in integration tests
yihuang Nov 10, 2022
5ce1586
Merge remote-tracking branch 'fork/main'
yihuang Nov 10, 2022
08a63ea
Merge branch 'main' into main
yihuang Nov 10, 2022
94d98c9
remove tmp var
yihuang Nov 10, 2022
a2b1259
Merge remote-tracking branch 'fork/main'
yihuang Nov 10, 2022
0e38258
Update tests/integration_tests/test_grpc_only.py
yihuang Nov 10, 2022
16a50a1
Update x/evm/keeper/grpc_query_test.go
yihuang Nov 11, 2022
e8ac732
Merge branch 'main' into main
yihuang Nov 11, 2022
f70990b
Merge branch 'main' into main
facs95 Nov 14, 2022
d029534
fix linters
yihuang 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
yihuang 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking

* (ante) [#1214](https://github.com/evmos/ethermint/pull/1214) Set mempool priority to EVM transactions.
* (evm) [#1405](https://github.com/evmos/ethermint/pull/1405) Add parameter `chainID` to evm keeper's `EVMConfig` method, so caller can choose to not use the cached `eip155ChainID`.

### Improvements

Expand Down Expand Up @@ -81,6 +82,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (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) [#1431](https://github.com/evmos/ethermint/pull/1431) Align hex-strings proof fields in `eth_getProof` as Ethereum.
* (rpc) [#1405](https://github.com/evmos/ethermint/pull/1405) Fix uninitialized chain ID field in gRPC requests.

## [v0.19.3] - 2022-10-14

Expand Down
9 changes: 5 additions & 4 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

127 changes: 101 additions & 26 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,18 @@ paths:
required: false
type: string
format: uint64
- name: proposer_address
description: the proposer of the requested block.
in: query
required: false
type: string
format: byte
- name: chain_id
description: the eip155 chain id parsed from the requested block header.
in: query
required: false
type: string
format: int64
tags:
- Query
/ethermint/evm/v1/eth_call:
Expand Down Expand Up @@ -1599,6 +1611,18 @@ paths:
required: false
type: string
format: uint64
- name: proposer_address
description: the proposer of the requested block.
in: query
required: false
type: string
format: byte
- name: chain_id
description: the eip155 chain id parsed from the requested block header.
in: query
required: false
type: string
format: int64
tags:
- Query
/ethermint/evm/v1/params:
Expand Down Expand Up @@ -1713,11 +1737,16 @@ paths:
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 =
already activated)
merge_fork_block:
gray_glacier_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 =
already in merge proceedings)
EIP-5133 (bomb delay) switch block (nil = no fork, 0 =
already activated)
merge_netsplit_block:
type: string
title: >-
Virtual fork after The Merge to use as a network
splitter
description: >-
ChainConfig defines the Ethereum ChainConfig parameters
using *sdk.Int values
Expand All @@ -1727,7 +1756,7 @@ paths:
type: boolean
description: >-
Allow unprotected transactions defines if replay-protected
(i.e non EIP155
(i.e non EIP155

signed) transactions can be executed on the state machine.
title: Params defines the EVM module parameters
Expand Down Expand Up @@ -2481,10 +2510,15 @@ paths:
in: query
required: false
type: string
- name: trace_config.overrides.merge_fork_block
- name: trace_config.overrides.gray_glacier_block
description: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings).
EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already
activated).
in: query
required: false
type: string
- name: trace_config.overrides.merge_netsplit_block
description: Virtual fork after The Merge to use as a network splitter.
in: query
required: false
type: string
Expand Down Expand Up @@ -2515,6 +2549,18 @@ paths:
required: false
type: string
format: date-time
- name: proposer_address
description: the proposer of the requested block.
in: query
required: false
type: string
format: byte
- name: chain_id
description: the eip155 chain id parsed from the requested block header.
in: query
required: false
type: string
format: int64
tags:
- Query
/ethermint/evm/v1/trace_tx:
Expand Down Expand Up @@ -2783,7 +2829,7 @@ paths:
type: string
format: byte
- name: msg.size
description: encoded storage size of the transaction.
description: 'DEPRECATED: encoded storage size of the transaction.'
in: query
required: false
type: number
Expand Down Expand Up @@ -2927,10 +2973,15 @@ paths:
in: query
required: false
type: string
- name: trace_config.overrides.merge_fork_block
- name: trace_config.overrides.gray_glacier_block
description: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings).
EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already
activated).
in: query
required: false
type: string
- name: trace_config.overrides.merge_netsplit_block
description: Virtual fork after The Merge to use as a network splitter.
in: query
required: false
type: string
Expand Down Expand Up @@ -2961,6 +3012,18 @@ paths:
required: false
type: string
format: date-time
- name: proposer_address
description: the proposer of the requested block.
in: query
required: false
type: string
format: byte
- name: chain_id
description: the eip155 chain id parsed from the requested block header.
in: query
required: false
type: string
format: int64
tags:
- Query
/ethermint/evm/v1/validator_account/{cons_address}:
Expand Down Expand Up @@ -14111,11 +14174,14 @@ definitions:
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
gray_glacier_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in merge
proceedings)
EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_netsplit_block:
type: string
title: Virtual fork after The Merge to use as a network splitter
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int
values
Expand Down Expand Up @@ -14344,7 +14410,7 @@ definitions:
size:
type: number
format: double
title: encoded storage size of the transaction
title: 'DEPRECATED: encoded storage size of the transaction'
hash:
type: string
title: transaction hash in hex format
Expand Down Expand Up @@ -14515,11 +14581,14 @@ definitions:
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
gray_glacier_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings)
EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_netsplit_block:
type: string
title: Virtual fork after The Merge to use as a network splitter
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int
values
Expand All @@ -14529,7 +14598,7 @@ definitions:
type: boolean
description: >-
Allow unprotected transactions defines if replay-protected (i.e non
EIP155
EIP155

signed) transactions can be executed on the state machine.
title: Params defines the EVM module parameters
Expand Down Expand Up @@ -14684,11 +14753,14 @@ definitions:
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
gray_glacier_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already
in merge proceedings)
EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_netsplit_block:
type: string
title: Virtual fork after The Merge to use as a network splitter
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using
*sdk.Int values
Expand All @@ -14698,7 +14770,7 @@ definitions:
type: boolean
description: >-
Allow unprotected transactions defines if replay-protected (i.e
non EIP155
non EIP155

signed) transactions can be executed on the state machine.
title: Params defines the EVM module parameters
Expand Down Expand Up @@ -14839,11 +14911,14 @@ definitions:
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
gray_glacier_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings)
EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_netsplit_block:
type: string
title: Virtual fork after The Merge to use as a network splitter
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int
values
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` | [int64](#int64) | | the eip155 chain id parsed from the requested block header |



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` | [int64](#int64) | | the eip155 chain id parsed from the requested block header |



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` | [int64](#int64) | | the eip155 chain id parsed from the requested block header |



Expand Down
6 changes: 6 additions & 0 deletions proto/ethermint/evm/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ 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"];
// the eip155 chain id parsed from the requested block header
int64 chain_id = 4;
}

// EstimateGasResponse defines EstimateGas response
Expand Down Expand Up @@ -251,6 +253,8 @@ 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"];
// the eip155 chain id parsed from the requested block header
int64 chain_id = 9;
}

// QueryTraceTxResponse defines TraceTx response
Expand All @@ -273,6 +277,8 @@ 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"];
// the eip155 chain id parsed from the requested block header
int64 chain_id = 9;
}

// QueryTraceBlockResponse defines TraceBlock response
Expand Down
13 changes: 13 additions & 0 deletions rpc/backend/call_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,16 @@ func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rp
return 0, errors.New("header not found")
}

chainID, err := ethermint.ParseChainID(header.Block.ChainID)
if err != nil {
return 0, sdkerrors.Wrapf(err, "failed to parse chainID: %s", header.Block.ChainID)
}

req := evmtypes.EthCallRequest{
Args: bz,
GasCap: b.RPCGasCap(),
ProposerAddress: sdk.ConsAddress(header.Block.ProposerAddress),
ChainId: chainID.Int64(),
}

// From ContextWithHeight: if the provided height is 0,
Expand All @@ -335,10 +341,17 @@ func (b *Backend) DoCall(
// the error message imitates geth behavior
return nil, errors.New("header not found")
}

chainID, err := ethermint.ParseChainID(header.Block.ChainID)
if err != nil {
return nil, sdkerrors.Wrapf(err, "failed to parse chainID: %s", header.Block.ChainID)
}

req := evmtypes.EthCallRequest{
Args: bz,
GasCap: b.RPCGasCap(),
ProposerAddress: sdk.ConsAddress(header.Block.ProposerAddress),
ChainId: chainID.Int64(),
}

// From ContextWithHeight: if the provided height is 0,
Expand Down
Loading