Skip to content

Commit 97860f9

Browse files
committed
feat: support override for both evm and cosmos states
add proto mock
1 parent 6921258 commit 97860f9

File tree

8 files changed

+6014
-2397
lines changed

8 files changed

+6014
-2397
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [\#658](https://github.com/cosmos/evm/pull/658) Fix race condition between legacypool's RemoveTx and runReorg.
2222
- [\#687](https://github.com/cosmos/evm/pull/687) Avoid blocking node shutdown when evm indexer is enabled, log startup failures instead of using errgroup.
2323
- [\#689](https://github.com/cosmos/evm/pull/689) Align debug addr for hex address.
24+
- [\#713](https://github.com/cosmos/evm/pull/713) Support cosmos state overrides in eth_call for dynamic precompiles.
2425
- [\#668](https://github.com/cosmos/evm/pull/668) Fix panic in legacy mempool when Reset() was called with a skipped header between old and new block.
2526
- [\#723](https://github.com/cosmos/evm/pull/723) Fix TransactionIndex in receipt generation to use actual EthTxIndex instead of loop index.
2627
- [\#729](https://github.com/cosmos/evm/pull/729) Remove non-deterministic state mutation from EVM pre-blocker.

api/cosmos/evm/vm/v1/query.pulsar.go

Lines changed: 4558 additions & 2157 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/cosmos/evm/vm/v1/query_grpc.pb.go

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/cosmos/evm/vm/v1/query.proto

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ service Query {
9292
option (google.api.http).get = "/cosmos/evm/vm/v1/config";
9393
}
9494

95+
// Precompile queries if an address is a precompile (static or dynamic)
96+
rpc Precompile(QueryPrecompileRequest) returns (QueryPrecompileResponse) {
97+
option (google.api.http).get = "/cosmos/evm/vm/v1/precompile/{address}";
98+
}
99+
95100
// GlobalMinGasPrice queries the MinGasPrice
96101
// it's similar to feemarket module's method,
97102
// but makes the conversion to 18 decimals
@@ -111,6 +116,20 @@ message QueryConfigResponse {
111116
ChainConfig config = 1;
112117
}
113118

119+
// QueryPrecompileRequest defines the request type for querying if an address is a precompile
120+
message QueryPrecompileRequest {
121+
// address is the ethereum hex address to check
122+
string address = 1;
123+
}
124+
125+
// QueryPrecompileResponse returns information about whether the address is a precompile
126+
message QueryPrecompileResponse {
127+
// is_precompile indicates if the address is a precompile contract
128+
bool is_precompile = 1;
129+
// is_static indicates if it's a static precompile (true) or dynamic precompile (false)
130+
bool is_static = 2;
131+
}
132+
114133
// QueryAccountRequest is the request type for the Query/Account RPC method.
115134
message QueryAccountRequest {
116135
option (gogoproto.equal) = false;
@@ -251,6 +270,19 @@ message QueryParamsResponse {
251270
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
252271
}
253272

273+
// StateEntry defines a single state change operation
274+
message StateEntry {
275+
bytes key = 1;
276+
bytes value = 2;
277+
bool delete = 3;
278+
}
279+
280+
// StoreStateDiff defines a set of state changes for a single store
281+
message StoreStateDiff {
282+
string name = 1;
283+
repeated StateEntry entries = 2 [ (gogoproto.nullable) = false ];
284+
}
285+
254286
// EthCallRequest defines EthCall request
255287
message EthCallRequest {
256288
// args uses the same json format as the json rpc api.
@@ -265,6 +297,8 @@ message EthCallRequest {
265297
int64 chain_id = 4;
266298
// state overrides encoded as json
267299
bytes overrides = 5;
300+
// state_overrides represents the state overrides before executing the call
301+
repeated StoreStateDiff state_overrides = 6 [ (gogoproto.nullable) = false ];
268302
}
269303

270304
// EstimateGasResponse defines EstimateGas response

rpc/backend/mocks/evm_query_client.go

Lines changed: 78 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)