Skip to content

Commit

Permalink
chore: add ethermint protos to own folder (evmos#1305)
Browse files Browse the repository at this point in the history
* fix: add ethermint protos to own folder

* chore: modify buf.yaml and generate proto files

* fix: added missing files and protos

---------

Co-authored-by: Federico Kunze Küllmer <[email protected]>
  • Loading branch information
Vvaradinov and fedekunze committed Jan 31, 2023
1 parent 969d81d commit 8bc5b06
Show file tree
Hide file tree
Showing 38 changed files with 24,080 additions and 7 deletions.
3 changes: 2 additions & 1 deletion proto/buf.gen.gogo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ version: v1
plugins:
- name: gocosmos
out: .
opt: plugins=grpc
opt:
- plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
- name: grpc-gateway
out: .
opt: logtostderr=true,allow_colon_final_segments=true
2 changes: 1 addition & 1 deletion proto/buf.gen.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins:
- name: gocosmos
out: .
opt:
- plugins=grpc
- plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types

- name: grpc-gateway
out: .
Expand Down
4 changes: 0 additions & 4 deletions proto/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ deps:
owner: cosmos
repository: gogo-proto
commit: 34d970b699f84aa382f3c29773a60836
- remote: buf.build
owner: evmos
repository: ethermint
commit: f0f1df1cd49a49d9b03eadd4235481af
- remote: buf.build
owner: googleapis
repository: googleapis
Expand Down
1 change: 0 additions & 1 deletion proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ deps:
- buf.build/cosmos/cosmos-sdk
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto
- buf.build/evmos/ethermint
- buf.build/googleapis/googleapis
lint:
use:
Expand Down
23 changes: 23 additions & 0 deletions proto/ethermint/crypto/v1/ethsecp256k1/keys.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";
package ethermint.crypto.v1.ethsecp256k1;

import "gogoproto/gogo.proto";

option go_package = "github.com/evmos/evmos/v11/crypto/ethsecp256k1";

// PubKey defines a type alias for an ecdsa.PublicKey that implements
// Tendermint's PubKey interface. It represents the 33-byte compressed public
// key format.
message PubKey {
option (gogoproto.goproto_stringer) = false;

// key is the public key in byte form
bytes key = 1;
}

// PrivKey defines a type alias for an ecdsa.PrivateKey that implements
// Tendermint's PrivateKey interface.
message PrivKey {
// key is the private key in byte form
bytes key = 1;
}
44 changes: 44 additions & 0 deletions proto/ethermint/evm/v1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";
package ethermint.evm.v1;

option go_package = "github.com/evmos/evmos/v11/x/evm/types";

// EventEthereumTx defines the event for an Ethereum transaction
message EventEthereumTx {
// amount
string amount = 1;
// eth_hash is the Ethereum hash of the transaction
string eth_hash = 2;
// index of the transaction in the block
string index = 3;
// gas_used is the amount of gas used by the transaction
string gas_used = 4;
// hash is the Tendermint hash of the transaction
string hash = 5;
// recipient of the transaction
string recipient = 6;
// eth_tx_failed contains a VM error should it occur
string eth_tx_failed = 7;
}

// EventTxLog defines the event for an Ethereum transaction log
message EventTxLog {
// tx_logs is an array of transaction logs
repeated string tx_logs = 1;
}

// EventMessage
message EventMessage {
// module which emits the event
string module = 1;
// sender of the message
string sender = 2;
// tx_type is the type of the message
string tx_type = 3;
}

// EventBlockBloom defines an Ethereum block bloom filter event
message EventBlockBloom {
// bloom is the bloom filter of the block
string bloom = 1;
}
252 changes: 252 additions & 0 deletions proto/ethermint/evm/v1/evm.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
syntax = "proto3";
package ethermint.evm.v1;

import "gogoproto/gogo.proto";

option go_package = "github.com/evmos/evmos/v11/x/evm/types";

// Params defines the EVM module parameters
message Params {
// evm_denom represents the token denomination used to run the EVM state
// transitions.
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\""];
// enable_call toggles state transitions that use the vm.Call function
bool enable_call = 3 [(gogoproto.moretags) = "yaml:\"enable_call\""];
// extra_eips defines the additional EIPs for the vm.Config
ExtraEIPs extra_eips = 4 [
(gogoproto.customname) = "ExtraEIPs",
(gogoproto.moretags) = "yaml:\"extra_eips\"",
(gogoproto.nullable) = false
];
// chain_config defines the EVM chain configuration parameters
ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false];
// allow_unprotected_txs defines if replay-protected (i.e non EIP155
// signed) transactions can be executed on the state machine.
bool allow_unprotected_txs = 6;
}

// ExtraEIPs represents extra EIPs for the vm.Config
message ExtraEIPs {
// eips defines the additional EIPs for the vm.Config
repeated int64 eips = 1 [(gogoproto.customname) = "EIPs", (gogoproto.moretags) = "yaml:\"eips\""];
}

// ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values
// instead of *big.Int.
message ChainConfig {
// homestead_block switch (nil no fork, 0 = already homestead)
string homestead_block = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"homestead_block\""
];
// dao_fork_block corresponds to 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\""
];
// dao_fork_support defines whether the nodes supports or opposes the DAO hard-fork
bool dao_fork_support = 3
[(gogoproto.customname) = "DAOForkSupport", (gogoproto.moretags) = "yaml:\"dao_fork_support\""];
// eip150_block: 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\""
];
// eip150_hash: 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\""];
// eip155_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\""
];
// eip158_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\""
];
// byzantium_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\""
];
// constantinople_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\""
];
// petersburg_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\""
];
// istanbul_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\""
];
// muir_glacier_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\""
];
// berlin_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\""
];
// DEPRECATED: EWASM, YOLOV3 and Catalyst block have been deprecated
reserved 14, 15, 16;
reserved "yolo_v3_block", "ewasm_block", "catalyst_block";
// london_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\""
];
// arrow_glacier_block: Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated)
string arrow_glacier_block = 18 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"arrow_glacier_block\""
];
// DEPRECATED: merge fork block was deprecated: https://github.com/ethereum/go-ethereum/pull/24904
reserved 19;
reserved "merge_fork_block";
// gray_glacier_block: EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already activated)
string gray_glacier_block = 20 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"gray_glacier_block\""
];
// merge_netsplit_block: Virtual fork after The Merge to use as a network splitter
string merge_netsplit_block = 21 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"merge_netsplit_block\""
];
// shanghai_block switch block (nil = no fork, 0 = already on shanghai)
string shanghai_block = 22 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"shanghai_block\""
];
// cancun_block switch block (nil = no fork, 0 = already on cancun)
string cancun_block = 23 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"cancun_block\""
];
}

// State represents a single Storage key value pair item.
message State {
// key is the stored key
string key = 1;
// value is the stored value for the given key
string value = 2;
}

// TransactionLogs define the logs generated from a transaction execution
// with a given hash. It it used for import/export data as transactions are not
// persisted on blockchain state after an upgrade.
message TransactionLogs {
// hash of the transaction
string hash = 1;
// logs is an array of Logs for the given transaction hash
repeated Log logs = 2;
}

// Log represents an protobuf compatible Ethereum Log that defines a contract
// log event. These events are generated by the LOG opcode and stored/indexed by
// the node.
//
// NOTE: address, topics and data are consensus fields. The rest of the fields
// are derived, i.e. filled in by the nodes, but not secured by consensus.
message Log {
// address of the contract that generated the event
string address = 1;
// topics is a list of topics provided by the contract.
repeated string topics = 2;
// data which is supplied by the contract, usually ABI-encoded
bytes data = 3;

// block_number of the block in which the transaction was included
uint64 block_number = 4 [(gogoproto.jsontag) = "blockNumber"];
// tx_hash is the transaction hash
string tx_hash = 5 [(gogoproto.jsontag) = "transactionHash"];
// tx_index of the transaction in the block
uint64 tx_index = 6 [(gogoproto.jsontag) = "transactionIndex"];
// block_hash of the block in which the transaction was included
string block_hash = 7 [(gogoproto.jsontag) = "blockHash"];
// index of the log in the block
uint64 index = 8 [(gogoproto.jsontag) = "logIndex"];

// removed is true if this log was reverted due to a chain
// reorganisation. You must pay attention to this field if you receive logs
// through a filter query.
bool removed = 9;
}

// TxResult stores results of Tx execution.
message TxResult {
option (gogoproto.goproto_getters) = false;

// 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\""];
// 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];
// ret defines the bytes from the execution.
bytes ret = 4;
// reverted flag is set to true when the call has been reverted
bool reverted = 5;
// gas_used notes the amount of gas consumed while execution
uint64 gas_used = 6;
}

// AccessTuple is the element type of an access list.
message AccessTuple {
option (gogoproto.goproto_getters) = false;

// address is a hex formatted ethereum address
string address = 1;
// storage_keys are hex formatted hashes of the storage keys
repeated string storage_keys = 2 [(gogoproto.jsontag) = "storageKeys"];
}

// TraceConfig holds extra parameters to trace functions.
message TraceConfig {
// DEPRECATED: DisableMemory and DisableReturnData have been renamed to
// Enable*.
reserved 4, 7;
reserved "disable_memory", "disable_return_data";

// tracer is a custom javascript tracer
string tracer = 1;
// timeout overrides the default timeout of 5 seconds for JavaScript-based tracing
// calls
string timeout = 2;
// reexec defines the number of blocks the tracer is willing to go back
uint64 reexec = 3;
// disable_stack switches stack capture
bool disable_stack = 5 [(gogoproto.jsontag) = "disableStack"];
// disable_storage switches storage capture
bool disable_storage = 6 [(gogoproto.jsontag) = "disableStorage"];
// debug can be used to print output during capture end
bool debug = 8;
// limit defines the maximum length of output, but zero means unlimited
int32 limit = 9;
// overrides can be used to execute a trace using future fork rules
ChainConfig overrides = 10;
// enable_memory switches memory capture
bool enable_memory = 11 [(gogoproto.jsontag) = "enableMemory"];
// enable_return_data switches the capture of return data
bool enable_return_data = 12 [(gogoproto.jsontag) = "enableReturnData"];
// tracer_json_config configures the tracer using a JSON string
string tracer_json_config = 13 [(gogoproto.jsontag) = "tracerConfig"];
}
27 changes: 27 additions & 0 deletions proto/ethermint/evm/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";
package ethermint.evm.v1;

import "ethermint/evm/v1/evm.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/evmos/evmos/v11/x/evm/types";

// GenesisState defines the evm module's genesis state.
message GenesisState {
// accounts is an array containing the ethereum genesis accounts.
repeated GenesisAccount accounts = 1 [(gogoproto.nullable) = false];
// params defines all the parameters of the module.
Params params = 2 [(gogoproto.nullable) = false];
}

// GenesisAccount defines an account to be initialized in the genesis state.
// Its main difference between with Geth's GenesisAccount is that it uses a
// custom storage type and that it doesn't contain the private key field.
message GenesisAccount {
// address defines an ethereum hex formated address of an account
string address = 1;
// code defines the hex bytes of the account code.
string code = 2;
// storage defines the set of state key values for the account.
repeated State storage = 3 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "Storage"];
}
Loading

0 comments on commit 8bc5b06

Please sign in to comment.