feat: fee market module (#491)

* feat: fee market module

* update proto

* queriers: CLI + gRPC

* gov params

* genesis

* enable height

* fixes

* fix app
This commit is contained in:
Federico Kunze Küllmer
2021-08-26 10:08:11 +00:00
committed by GitHub
parent 4b11ac66c4
commit f469db94ef
34 changed files with 3544 additions and 647 deletions
-2
View File
@@ -26,8 +26,6 @@ message Params {
(gogoproto.moretags) = "yaml:\"chain_config\"",
(gogoproto.nullable) = false
];
// no base fee forces the EIP-1559 base fee to 0 (needed for 0 price calls)
bool no_base_fee = 6 [ (gogoproto.moretags) = "yaml:\"no_base_fee\"" ];
}
// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values
+1 -6
View File
@@ -67,12 +67,7 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/ethermint/evm/v1/params";
}
// BaseFee queries the base fee of the parent block of the current block.
rpc BaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) {
option (google.api.http).get = "/ethermint/evm/v1/base_fee";
}
// EthCall implements the `eth_call` rpc api
rpc EthCall(EthCallRequest) returns (MsgEthereumTxResponse) {
option (google.api.http).get = "/ethermint/evm/v1/eth_call";
@@ -0,0 +1,20 @@
syntax = "proto3";
package ethermint.feemarket.v1;
import "gogoproto/gogo.proto";
option go_package = "github.com/tharsis/ethermint/x/feemarket/types";
// Params defines the EVM module parameters
message Params {
// no base fee forces the EIP-1559 base fee to 0 (needed for 0 price calls)
bool no_base_fee = 1;
// base fee change denominator bounds the amount the base fee can change between blocks.
uint32 base_fee_change_denominator = 2;
// elasticity multiplier bounds the maximum gas limit an EIP-1559 block may have.
uint32 elasticity_multiplier = 3;
// initial base fee for EIP-1559 blocks.
int64 initial_base_fee = 4;
// height at which the base fee calculation is enabled.
int64 enable_height = 5;
}
@@ -0,0 +1,22 @@
syntax = "proto3";
package ethermint.feemarket.v1;
import "gogoproto/gogo.proto";
import "ethermint/feemarket/v1/feemarket.proto";
option go_package = "github.com/tharsis/ethermint/x/feemarket/types";
// GenesisState defines the feemarket module's genesis state.
message GenesisState {
// params defines all the paramaters of the module.
Params params = 1 [(gogoproto.nullable) = false];
// base fee is the exported value from previous software version.
// Zero by default.
string base_fee = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// block gas is the amount of gas used on the last block before the upgrade.
// Zero by default.
uint64 block_gas = 3;
}
+58
View File
@@ -0,0 +1,58 @@
syntax = "proto3";
package ethermint.feemarket.v1;
import "gogoproto/gogo.proto";
// import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
import "ethermint/feemarket/v1/feemarket.proto";
option go_package = "github.com/tharsis/ethermint/x/feemarket/types";
// Query defines the gRPC querier service.
service Query {
// Params queries the parameters of x/feemarket module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/feemarket/evm/v1/params";
}
// BaseFee queries the base fee of the parent block of the current block.
rpc BaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) {
option (google.api.http).get = "/feemarket/evm/v1/base_fee";
}
// BlockGas queries the gas used at a given block height
rpc BlockGas(QueryBlockGasRequest) returns (QueryBlockGasResponse) {
option (google.api.http).get = "/feemarket/evm/v1/block_gas";
}
}
// QueryParamsRequest defines the request type for querying x/evm parameters.
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 ];
}
// QueryBaseFeeRequest defines the request type for querying the EIP1559 base
// fee.
message QueryBaseFeeRequest {}
// BaseFeeResponse returns the EIP1559 base fee.
message QueryBaseFeeResponse {
string base_fee = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
// QueryBlockGasRequest defines the request type for querying the EIP1559 base
// fee.
message QueryBlockGasRequest {}
// QueryBlockGasResponse returns block gas used for a given height.
message QueryBlockGasResponse {
int64 gas = 1;
}