rpc, evm: fix eth_coinbase endpoint to return ethereum address of the validator node (#153)

* fix coinbase rpc endpoint to return ethereum address of the validator

* update changelog

* fix lint

* clean code and simplify logic

* fix changelog

* change request variable name and type

* add test

* fix proto comments

* fix proto comments

* Update x/evm/keeper/grpc_query.go

* Update x/evm/keeper/grpc_query.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Thomas Nguy
2021-06-22 06:14:40 -04:00
committed by GitHub
co-authored by Federico Kunze
parent 4ca7c43b62
commit fada59551d
11 changed files with 857 additions and 91 deletions
+25 -1
View File
@@ -15,11 +15,16 @@ service Query {
option (google.api.http).get = "/ethermint/evm/v1alpha1/account/{address}";
}
// Account queries an Ethereum account's Cosmos Address.
// CosmosAccount queries an Ethereum account's Cosmos Address.
rpc CosmosAccount(QueryCosmosAccountRequest) returns (QueryCosmosAccountResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/cosmos_account/{address}";
}
// ValidatorAccount queries an Ethereum account's from a validator consensus Address.
rpc ValidatorAccount(QueryValidatorAccountRequest) returns (QueryValidatorAccountResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/validator_account/{cons_address}";
}
// Balance queries the balance of a the EVM denomination for a single
// EthAccount.
rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {
@@ -100,6 +105,25 @@ message QueryCosmosAccountResponse {
uint64 account_number = 3;
}
// QueryValidatorAccountRequest is the request type for the Query/ValidatorAccount RPC method.
message QueryValidatorAccountRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// cons_address is the validator cons address to query the account for.
string cons_address = 1;
}
// QueryValidatorAccountResponse is the response type for the Query/ValidatorAccount RPC method.
message QueryValidatorAccountResponse {
// account_address is the cosmos address of the account in bech32 format.
string account_address = 1;
// sequence is the account's sequence number.
uint64 sequence = 2;
// account_number is the account number
uint64 account_number = 3;
}
// QueryBalanceRequest is the request type for the Query/Balance RPC method.
message QueryBalanceRequest {
option (gogoproto.equal) = false;