evm: EIP1559 & go-ethereum related updates (#469)

* updates

* more changes

* proto updates

* tidy

* v1beta1

* update buf

* lint

* comments

* typo
This commit is contained in:
Federico Kunze Küllmer
2021-08-25 14:45:51 +00:00
committed by GitHub
parent f732774992
commit 1ad9b4c1a5
31 changed files with 1115 additions and 926 deletions
+55 -41
View File
@@ -11,15 +11,23 @@ message Params {
// evm denom represents the token denomination used to run the EVM state
// transitions.
string evm_denom = 1 [(gogoproto.moretags) = "yaml:\"evm_denom\""];
string evm_denom = 1 [ (gogoproto.moretags) = "yaml:\"evm_denom\"" ];
// enable create toggles state transitions that use the vm.Create function
bool enable_create = 2 [(gogoproto.moretags) = "yaml:\"enable_create\""];
bool enable_create = 2 [ (gogoproto.moretags) = "yaml:\"enable_create\"" ];
// enable call toggles state transitions that use the vm.Call function
bool enable_call = 3 [(gogoproto.moretags) = "yaml:\"enable_call\""];
bool enable_call = 3 [ (gogoproto.moretags) = "yaml:\"enable_call\"" ];
// extra eips defines the additional EIPs for the vm.Config
repeated int64 extra_eips = 4 [(gogoproto.customname) = "ExtraEIPs", (gogoproto.moretags) = "yaml:\"extra_eips\""];
repeated int64 extra_eips = 4 [
(gogoproto.customname) = "ExtraEIPs",
(gogoproto.moretags) = "yaml:\"extra_eips\""
];
// chain config defines the EVM chain configuration parameters
ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false];
ChainConfig chain_config = 5 [
(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
@@ -28,89 +36,91 @@ message ChainConfig {
// Homestead switch block (nil no fork, 0 = already homestead)
string homestead_block = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"homestead_block\""
(gogoproto.moretags) = "yaml:\"homestead_block\""
];
// TheDAO hard-fork switch block (nil no fork)
string dao_fork_block = 2 [
(gogoproto.customname) = "DAOForkBlock",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"dao_fork_block\""
(gogoproto.moretags) = "yaml:\"dao_fork_block\""
];
// Whether the nodes supports or opposes the DAO hard-fork
bool dao_fork_support = 3
[(gogoproto.customname) = "DAOForkSupport", (gogoproto.moretags) = "yaml:\"dao_fork_support\""];
bool dao_fork_support = 3 [
(gogoproto.customname) = "DAOForkSupport",
(gogoproto.moretags) = "yaml:\"dao_fork_support\""
];
// EIP150 implements the Gas price changes
// (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork)
string eip150_block = 4 [
(gogoproto.customname) = "EIP150Block",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"eip150_block\""
(gogoproto.moretags) = "yaml:\"eip150_block\""
];
// EIP150 HF hash (needed for header only clients as only gas pricing changed)
string eip150_hash = 5 [(gogoproto.customname) = "EIP150Hash", (gogoproto.moretags) = "yaml:\"byzantium_block\""];
string eip150_hash = 5 [
(gogoproto.customname) = "EIP150Hash",
(gogoproto.moretags) = "yaml:\"byzantium_block\""
];
// EIP155Block HF block
string eip155_block = 6 [
(gogoproto.customname) = "EIP155Block",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"eip155_block\""
(gogoproto.moretags) = "yaml:\"eip155_block\""
];
// EIP158 HF block
string eip158_block = 7 [
(gogoproto.customname) = "EIP158Block",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"eip158_block\""
(gogoproto.moretags) = "yaml:\"eip158_block\""
];
// Byzantium switch block (nil no fork, 0 = already on byzantium)
string byzantium_block = 8 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"byzantium_block\""
(gogoproto.moretags) = "yaml:\"byzantium_block\""
];
// Constantinople switch block (nil no fork, 0 = already activated)
string constantinople_block = 9 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"constantinople_block\""
(gogoproto.moretags) = "yaml:\"constantinople_block\""
];
// Petersburg switch block (nil same as Constantinople)
string petersburg_block = 10 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"petersburg_block\""
(gogoproto.moretags) = "yaml:\"petersburg_block\""
];
// Istanbul switch block (nil no fork, 0 = already on istanbul)
string istanbul_block = 11 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"istanbul_block\""
(gogoproto.moretags) = "yaml:\"istanbul_block\""
];
// Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated)
string muir_glacier_block = 12 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"muir_glacier_block\""
(gogoproto.moretags) = "yaml:\"muir_glacier_block\""
];
// Berlin switch block (nil = no fork, 0 = already on berlin)
string berlin_block = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"berlin_block\""
];
// YOLO v3: Gas repricings
string yolo_v3_block = 14 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"yolo_v3_block\""
];
// EWASM switch block (nil no fork, 0 = already activated)
string ewasm_block = 15 [
(gogoproto.customname) = "EWASMBlock",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"ewasm_block\""
(gogoproto.moretags) = "yaml:\"berlin_block\""
];
// DEPRECATED: EWASM and YOLOV3 block have been deprecated
reserved 14, 15;
reserved "yolo_v3_block", "ewasm_block";
// Catalyst switch block (nil = no fork, 0 = already on catalyst)
string catalyst_block = 16 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"catalyst_block\""
(gogoproto.moretags) = "yaml:\"catalyst_block\""
];
// London switch block (nil = no fork, 0 = already on london)
string london_block = 17 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"london_block\""
];
}
// State represents a single Storage key value pair item.
message State {
string key = 1;
string key = 1;
string value = 2;
}
@@ -118,7 +128,7 @@ message State {
// with a given hash. It it used for import/export data as transactions are not
// persisted on blockchain state after an upgrade.
message TransactionLogs {
string hash = 1;
string hash = 1;
repeated Log logs = 2;
}
@@ -139,15 +149,15 @@ message Log {
// but not secured by consensus.
// block in which the transaction was included
uint64 block_number = 4 [(gogoproto.jsontag) = "blockNumber"];
uint64 block_number = 4 [ (gogoproto.jsontag) = "blockNumber" ];
// hash of the transaction
string tx_hash = 5 [(gogoproto.jsontag) = "transactionHash"];
string tx_hash = 5 [ (gogoproto.jsontag) = "transactionHash" ];
// index of the transaction in the block
uint64 tx_index = 6 [(gogoproto.jsontag) = "transactionIndex"];
uint64 tx_index = 6 [ (gogoproto.jsontag) = "transactionIndex" ];
// hash of the block in which the transaction was included
string block_hash = 7 [(gogoproto.jsontag) = "blockHash"];
string block_hash = 7 [ (gogoproto.jsontag) = "blockHash" ];
// index of the log in the block
uint64 index = 8 [(gogoproto.jsontag) = "logIndex"];
uint64 index = 8 [ (gogoproto.jsontag) = "logIndex" ];
// The Removed field is true if this log was reverted due to a chain
// reorganisation. You must pay attention to this field if you receive logs
@@ -162,12 +172,16 @@ message TxResult {
// contract_address contains the ethereum address of the created contract (if
// any). If the state transition is an evm.Call, the contract address will be
// empty.
string contract_address = 1 [(gogoproto.moretags) = "yaml:\"contract_address\""];
string contract_address = 1
[ (gogoproto.moretags) = "yaml:\"contract_address\"" ];
// bloom represents the bloom filter bytes
bytes bloom = 2;
// tx_logs contains the transaction hash and the proto-compatible ethereum
// logs.
TransactionLogs tx_logs = 3 [(gogoproto.moretags) = "yaml:\"tx_logs\"", (gogoproto.nullable) = false];
TransactionLogs tx_logs = 3 [
(gogoproto.moretags) = "yaml:\"tx_logs\"",
(gogoproto.nullable) = false
];
// ret defines the bytes from the execution.
bytes ret = 4;
// reverted flag is set to true when the call has been reverted
@@ -183,5 +197,5 @@ message AccessTuple {
// hex formatted ethereum address
string address = 1;
// hex formatted hashes of the storage keys
repeated string storage_keys = 2 [(gogoproto.jsontag) = "storageKeys"];
repeated string storage_keys = 2 [ (gogoproto.jsontag) = "storageKeys" ];
}
+13 -9
View File
@@ -68,9 +68,9 @@ service Query {
option (google.api.http).get = "/ethermint/evm/v1/params";
}
// StaticCall queries the static call value of x/evm module.
rpc StaticCall(QueryStaticCallRequest) returns (QueryStaticCallResponse) {
option (google.api.http).get = "/ethermint/evm/v1/static_call";
// 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
@@ -255,12 +255,16 @@ message QueryParamsResponse {
Params params = 1 [ (gogoproto.nullable) = false ];
}
// QueryStaticCallRequest defines static call request
message QueryStaticCallRequest {
// address is the ethereum contract hex address to for static call.
string address = 1;
// static call input generated from abi
bytes input = 2;
// 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
];
}
// QueryStaticCallRequest defines static call response
+25
View File
@@ -0,0 +1,25 @@
syntax = "proto3";
package ethermint.types.v1;
import "gogoproto/gogo.proto";
option go_package = "github.com/tharsis/ethermint/types";
message ExtensionOptionsWeb3Tx {
option (gogoproto.goproto_getters) = false;
// typed data chain id used only in EIP712 Domain and should match
// Ethereum network ID in a Web3 provider (e.g. Metamask).
uint64 typed_data_chain_id = 1 [
(gogoproto.jsontag) = "typedDataChainID,omitempty",
(gogoproto.customname) = "TypedDataChainID"
];
// fee payer is an account address for the fee payer. It will be validated
// during EIP712 signature checking.
string fee_payer = 2 [(gogoproto.jsontag) = "feePayer,omitempty"];
// fee payer sig is a signature data from the fee paying account,
// allows to perform fee delegation when using EIP712 Domain.
bytes fee_payer_sig = 3 [(gogoproto.jsontag) = "feePayerSig,omitempty"];
}
-22
View File
@@ -1,22 +0,0 @@
syntax = "proto3";
package ethermint.types.v1;
import "gogoproto/gogo.proto";
option go_package = "github.com/tharsis/ethermint/types";
message ExtensionOptionsWeb3Tx {
option (gogoproto.goproto_getters) = false;
// typedDataChainID used only in EIP712 Domain and should match
// Ethereum network ID in a Web3 provider (e.g. Metamask).
uint64 typedDataChainID = 1;
// feePayer is an account address for the fee payer. It will be validated
// during EIP712 signature checking.
string feePayer = 2;
// feePayerSig is a signature data from the fee paying account,
// allows to perform fee delegation when using EIP712 Domain.
bytes feePayerSig = 3;
}