evm: dynamic fee tx (#384)

* evm: dynamic fee tx

* proto message

* fix

* lint
This commit is contained in:
Federico Kunze Küllmer
2021-07-30 11:40:17 +00:00
committed by GitHub
parent c4aa8fafab
commit 9b9c835266
14 changed files with 1242 additions and 123 deletions
+33 -26
View File
@@ -17,13 +17,18 @@ service Query {
}
// CosmosAccount queries an Ethereum account's Cosmos Address.
rpc CosmosAccount(QueryCosmosAccountRequest) returns (QueryCosmosAccountResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/cosmos_account/{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}";
// 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
@@ -34,7 +39,8 @@ service Query {
// Storage queries the balance of all coins for a single account.
rpc Storage(QueryStorageRequest) returns (QueryStorageResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/storage/{address}/{key}";
option (google.api.http).get =
"/ethermint/evm/v1alpha1/storage/{address}/{key}";
}
// Code queries the balance of all coins for a single account.
@@ -76,12 +82,11 @@ service Query {
rpc EstimateGas(EthCallRequest) returns (EstimateGasResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/estimate_gas";
}
}
// QueryAccountRequest is the request type for the Query/Account RPC method.
message QueryAccountRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the ethereum hex address to query the account for.
@@ -98,16 +103,18 @@ message QueryAccountResponse {
uint64 nonce = 3;
}
// QueryCosmosAccountRequest is the request type for the Query/CosmosAccount RPC method.
// QueryCosmosAccountRequest is the request type for the Query/CosmosAccount RPC
// method.
message QueryCosmosAccountRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the ethereum hex address to query the account for.
string address = 1;
}
// QueryCosmosAccountResponse is the response type for the Query/CosmosAccount RPC method.
// QueryCosmosAccountResponse is the response type for the Query/CosmosAccount
// RPC method.
message QueryCosmosAccountResponse {
// cosmos_address is the cosmos address of the account.
string cosmos_address = 1;
@@ -117,16 +124,18 @@ message QueryCosmosAccountResponse {
uint64 account_number = 3;
}
// QueryValidatorAccountRequest is the request type for the Query/ValidatorAccount RPC method.
// QueryValidatorAccountRequest is the request type for the
// Query/ValidatorAccount RPC method.
message QueryValidatorAccountRequest {
option (gogoproto.equal) = false;
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.
// 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;
@@ -138,7 +147,7 @@ message QueryValidatorAccountResponse {
// QueryBalanceRequest is the request type for the Query/Balance RPC method.
message QueryBalanceRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the ethereum hex address to query the balance for.
@@ -153,7 +162,7 @@ message QueryBalanceResponse {
// QueryStorageRequest is the request type for the Query/Storage RPC method.
message QueryStorageRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
/// address is the ethereum hex address to query the storage state for.
@@ -172,7 +181,7 @@ message QueryStorageResponse {
// QueryCodeRequest is the request type for the Query/Code RPC method.
message QueryCodeRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the ethereum hex address to query the code for.
@@ -188,7 +197,7 @@ message QueryCodeResponse {
// QueryTxLogsRequest is the request type for the Query/TxLogs RPC method.
message QueryTxLogsRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// hash is the ethereum transaction hex hash to query the logs for.
@@ -203,7 +212,7 @@ message QueryTxLogsResponse {
// QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method.
message QueryBlockLogsRequest {
option (gogoproto.equal) = false;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// hash is the block hash to query the logs for.
@@ -215,7 +224,7 @@ message QueryBlockLogsRequest {
// QueryTxLogs is the response type for the Query/BlockLogs RPC method.
message QueryBlockLogsResponse {
// 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;
}
@@ -225,8 +234,8 @@ message QueryBlockLogsResponse {
message QueryBlockBloomRequest {
// height of the block which we want to query the bloom filter.
// Tendermint always replace the query request header by the current context
// header, height cannot be extracted from there, so we need to explicitly pass
// it in parameter.
// header, height cannot be extracted from there, so we need to explicitly
// pass it in parameter.
int64 height = 1;
}
@@ -243,7 +252,7 @@ message QueryParamsRequest {}
// QueryParamsResponse defines the response type for querying x/evm parameters.
message QueryParamsResponse {
// params define the evm module parameters.
Params params = 1 [(gogoproto.nullable) = false];
Params params = 1 [ (gogoproto.nullable) = false ];
}
// QueryStaticCallRequest defines static call request
@@ -255,9 +264,7 @@ message QueryStaticCallRequest {
}
// QueryStaticCallRequest defines static call response
message QueryStaticCallResponse {
bytes data = 1;
}
message QueryStaticCallResponse { bytes data = 1; }
// EthCallRequest defines EthCall request
message EthCallRequest {
+68 -25
View File
@@ -23,12 +23,12 @@ message MsgEthereumTx {
// caches
// encoded storage size of the transaction
double size = 2 [(gogoproto.jsontag) = "-"];
double size = 2 [ (gogoproto.jsontag) = "-" ];
// transaction hash in hex format
string hash = 3 [(gogoproto.moretags) = "rlp:\"-\""];
// ethereum signer address in hex format. This address value is checked against
// the address derived from the signature (V, R, S) using the secp256k1
// elliptic curve
string hash = 3 [ (gogoproto.moretags) = "rlp:\"-\"" ];
// ethereum signer address in hex format. This address value is checked
// against the address derived from the signature (V, R, S) using the
// secp256k1 elliptic curve
string from = 4;
}
@@ -40,11 +40,10 @@ message LegacyTx {
// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 1;
// gas price defines the value for each gas unit
string gas_price = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
string gas_price = 2
[ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ];
// gas defines the gas limit defined for the transaction.
uint64 gas = 3 [(gogoproto.customname) = "GasLimit"];
uint64 gas = 3 [ (gogoproto.customname) = "GasLimit" ];
// hex formatted address of the recipient
string to = 4;
// value defines the unsigned integer value of the transaction amount.
@@ -53,7 +52,7 @@ message LegacyTx {
(gogoproto.customname) = "Amount"
];
// input defines the data payload bytes of the transaction.
bytes data = 6;
bytes data = 6;
// v defines the signature value
bytes v = 7;
// r defines the signature value
@@ -62,7 +61,6 @@ message LegacyTx {
bytes s = 9;
}
// AccessListTx is the data of EIP-2930 access list transactions.
message AccessListTx {
option (gogoproto.goproto_getters) = false;
@@ -72,16 +70,15 @@ message AccessListTx {
string chain_id = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID"
(gogoproto.jsontag) = "chainID"
];
// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 2;
// gas price defines the value for each gas unit
string gas_price = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
string gas_price = 3
[ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ];
// gas defines the gas limit defined for the transaction.
uint64 gas = 4 [(gogoproto.customname) = "GasLimit"];
uint64 gas = 4 [ (gogoproto.customname) = "GasLimit" ];
// hex formatted address of the recipient
string to = 5;
// value defines the unsigned integer value of the transaction amount.
@@ -90,9 +87,12 @@ message AccessListTx {
(gogoproto.customname) = "Amount"
];
// input defines the data payload bytes of the transaction.
bytes data = 7;
repeated AccessTuple accesses = 8
[(gogoproto.castrepeated) = "AccessList", (gogoproto.jsontag) = "accessList", (gogoproto.nullable) = false];
bytes data = 7;
repeated AccessTuple accesses = 8 [
(gogoproto.castrepeated) = "AccessList",
(gogoproto.jsontag) = "accessList",
(gogoproto.nullable) = false
];
// v defines the signature value
bytes v = 9;
// r defines the signature value
@@ -101,25 +101,68 @@ message AccessListTx {
bytes s = 11;
}
// DynamicFeeTx is the data of EIP-1559 dinamic fee transactions.
message DynamicFeeTx {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "TxData";
// destination EVM chain ID
string chain_id = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID"
];
// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 2;
// gas tip cap defines the max value for the gas tip
string gas_tip_cap = 3
[ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ];
// gas fee cap defines the max value for the gas fee
string gas_fee_cap = 4
[ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" ];
// gas defines the gas limit defined for the transaction.
uint64 gas = 5 [ (gogoproto.customname) = "GasLimit" ];
// hex formatted address of the recipient
string to = 6;
// value defines the the transaction amount.
string value = 7 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "Amount"
];
// input defines the data payload bytes of the transaction.
bytes data = 8;
repeated AccessTuple accesses = 9 [
(gogoproto.castrepeated) = "AccessList",
(gogoproto.jsontag) = "accessList",
(gogoproto.nullable) = false
];
// v defines the signature value
bytes v = 10;
// r defines the signature value
bytes r = 11;
// s define the signature value
bytes s = 12;
}
message ExtensionOptionsEthereumTx {
option (gogoproto.goproto_getters) = false;
}
message ExtensionOptionsWeb3Tx {
option (gogoproto.goproto_getters) = false;
}
message ExtensionOptionsWeb3Tx { option (gogoproto.goproto_getters) = false; }
// MsgEthereumTxResponse defines the Msg/EthereumTx response type.
message MsgEthereumTxResponse {
option (gogoproto.goproto_getters) = false;
// ethereum transaction hash in hex format. This hash differs from the Tendermint sha256 hash of the transaction
// bytes. See https://github.com/tendermint/tendermint/issues/6539 for reference
// ethereum transaction hash in hex format. This hash differs from the
// Tendermint sha256 hash of the transaction bytes. See
// https://github.com/tendermint/tendermint/issues/6539 for reference
string hash = 1;
// logs contains the transaction hash and the proto-compatible ethereum
// logs.
repeated Log logs = 2;
// returned data from evm function (result or data supplied with revert opcode)
// returned data from evm function (result or data supplied with revert
// opcode)
bytes ret = 3;
// vm error is the error returned by vm execution
string vm_error = 4;