stargate: proto files (#679)

* stargate: proto files

* third party proto files

* third party proto files

* add annotations

* rm proto-gen-any

* rm script any
This commit is contained in:
Federico Kunze
2021-01-07 18:45:32 -03:00
committed by GitHub
parent ffbb207655
commit ed313c9482
23 changed files with 2155 additions and 59 deletions
@@ -0,0 +1,19 @@
syntax = "proto3";
package ethermint.crypto.v1alpha1.ethsecp256k1;
import "gogoproto/gogo.proto";
option go_package = "github.com/cosmos/ethermint/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;
bytes key = 1;
}
// PrivKey defines a type alias for an ecdsa.PrivateKey that implements
// Tendermint's PrivateKey interface.
message PrivKey { bytes key = 1; }
+173
View File
@@ -0,0 +1,173 @@
syntax = "proto3";
package ethermint.evm.v1alpha1;
import "gogoproto/gogo.proto";
option go_package = "github.com/cosmos/ethermint/x/evm/types";
// Params defines the EVM module parameters
message Params {
option (gogoproto.goproto_stringer) = false;
// 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
repeated int64 extra_eips = 4 [
(gogoproto.customname) = "ExtraEIPs",
(gogoproto.moretags) = "yaml:\"extra_eips\""
];
}
// ChainConfig defines the Ethereum ChainConfig parameters using sdk.Int values
// instead of big.Int.
//
// NOTE 1: Since empty/uninitialized Ints (i.e with a nil big.Int value) are
// parsed to zero, we need to manually specify that negative Int values will be
// considered as nil. See getBlockValue for reference.
//
// NOTE 2: This type is not a configurable Param since the SDK does not allow
// for validation against a previous stored parameter values or the current
// block height (retrieved from context). If you want to update the config
// values, use an software upgrade procedure.
message ChainConfig {
// Homestead switch block (< 0 no fork, 0 = already homestead)
string homestead_block = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"homestead_block\"",
(gogoproto.nullable) = false
];
// TheDAO hard-fork switch block (< 0 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.nullable) = false
];
// 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 implements the Gas price changes
// (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (< 0 no fork)
string eip150_block = 4 [
(gogoproto.customname) = "EIP150Block",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"eip150_block\"",
(gogoproto.nullable) = false
];
// 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\""
];
// 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.nullable) = false
];
// 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.nullable) = false
];
// Byzantium switch block (< 0 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.nullable) = false
];
// Constantinople switch block (< 0 no fork, 0 = already activated)
string constantinople_block = 9 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"constantinople_block\"",
(gogoproto.nullable) = false
];
// Petersburg switch block (< 0 same as Constantinople)
string petersburg_block = 10 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"petersburg_block\"",
(gogoproto.nullable) = false
];
// Istanbul switch block (< 0 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.nullable) = false
];
// Eip-2384 (bomb delay) switch block (< 0 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.nullable) = false
];
// YOLO v2: https://github.com/ethereum/EIPs/pull/2657 (Ephemeral testnet)
string yolo_v2_block = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"yolo_v2_block\"",
(gogoproto.nullable) = false
];
// EWASM switch block (< 0 no fork, 0 = already activated)
string ewasm_block = 14 [
(gogoproto.customname) = "EWASMBlock",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"ewasm_block\"",
(gogoproto.nullable) = false
];
}
// State represents a single Storage key value pair item.
message State {
string key = 1;
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 {
string hash = 1;
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.
message Log {
// Consensus fields:
// address of the contract that generated the event
string address = 1;
// list of topics provided by the contract.
repeated string topics = 2;
// supplied by the contract, usually ABI-encoded
bytes data = 3;
// Derived fields. These fields are filled in by the node
// but not secured by consensus.
// block in which the transaction was included
uint64 block_number = 4 [ (gogoproto.jsontag) = "blockNumber" ];
// hash of the transaction
string tx_hash = 5 [ (gogoproto.jsontag) = "transactionHash" ];
// index of the transaction in the block
uint64 tx_index = 6 [ (gogoproto.jsontag) = "transactionIndex" ];
// 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" ];
// 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
// through a filter query.
bool removed = 9;
}
@@ -0,0 +1,45 @@
syntax = "proto3";
package ethermint.evm.v1alpha1;
import "gogoproto/gogo.proto";
import "ethermint/evm/v1alpha1/evm.proto";
option go_package = "github.com/cosmos/ethermint/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 ];
// chain_config defines the Ethereum chain configuration.
ChainConfig chain_config = 2 [
(gogoproto.moretags) = "yaml:\"chain_config\"",
(gogoproto.nullable) = false
];
// params defines all the paramaters of the module.
Params params = 3 [ (gogoproto.nullable) = false ];
repeated TransactionLogs txs_logs = 4 [
(gogoproto.moretags) = "yaml:\"txs_logs\"",
(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;
// balance defines the available evm tokens for the account
string balance = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// code defines the hex bytes of the account code.
string code = 3;
// storage defines the set of state key values for the account.
repeated State storage = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "Storage"
];
}
+172
View File
@@ -0,0 +1,172 @@
syntax = "proto3";
package ethermint.evm.v1alpha1;
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "ethermint/evm/v1alpha1/evm.proto";
option go_package = "github.com/cosmos/ethermint/x/evm/types";
// Query defines the gRPC querier service.
service Query {
// Account queries an Ethereum account.
rpc Account(QueryAccountRequest) returns (QueryAccountResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/account/{address}";
}
// Balance queries the balance of a the EVM denomination for a single
// EthAccount.
rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/balances/{address}";
}
// 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}";
}
// Code queries the balance of all coins for a single account.
rpc Code(QueryCodeRequest) returns (QueryCodeResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/codes/{address}";
}
// TxLogs queries ethereum logs from a transaction.
rpc TxLogs(QueryTxLogsRequest) returns (QueryTxLogsResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/tx_logs/{hash}";
}
// BlockLogs queries all the ethereum logs for a given block hash.
rpc BlockLogs(QueryBlockLogsRequest) returns (QueryBlockLogsResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/block_logs/{hash}";
}
// BlockBloom queries the block bloom filter bytes at a given height.
rpc BlockBloom(QueryBlockBloomRequest) returns (QueryBlockBloomResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/block_bloom";
}
// Params queries the parameters of x/evm module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/ethermint/evm/v1alpha1/params";
}
}
// QueryAccountRequest is the request type for the Query/Account RPC method.
message QueryAccountRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the ethereum hex address to query the account for.
string address = 1;
}
// QueryAccountResponse is the response type for the Query/Account RPC method.
message QueryAccountResponse {
// balance is the balance of the EVM denomination.
string balance = 1;
// code_hash is the code bytes from the EOA.
bytes code_hash = 2;
// nonce is the account's sequence number.
uint64 nonce = 3;
}
// QueryBalanceRequest is the request type for the Query/Balance RPC method.
message QueryBalanceRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the ethereum hex address to query the balance for.
string address = 1;
}
// QueryBalanceResponse is the response type for the Query/Balance RPC method.
message QueryBalanceResponse {
// balance is the balance of the EVM denomination.
string balance = 1;
}
// QueryStorageRequest is the request type for the Query/Storage RPC method.
message QueryStorageRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
/// address is the ethereum hex address to query the storage state for.
string address = 1;
// key defines the key of the storage state
string key = 2;
}
// QueryStorageResponse is the response type for the Query/Storage RPC
// method.
message QueryStorageResponse {
// key defines the storage state value hash associated with the given key.
string value = 1;
}
// QueryCodeRequest is the request type for the Query/Code RPC method.
message QueryCodeRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the ethereum hex address to query the code for.
string address = 1;
}
// QueryCodeResponse is the response type for the Query/Code RPC
// method.
message QueryCodeResponse {
// code represents the code bytes from an ethereum address.
bytes code = 1;
}
// QueryTxLogsRequest is the request type for the Query/TxLogs RPC method.
message QueryTxLogsRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// hash is the ethereum transaction hex hash to query the logs for.
string hash = 1;
}
// QueryTxLogs is the response type for the Query/TxLogs RPC method.
message QueryTxLogsResponse {
// logs represents the ethereum logs generated from the given transaction.
repeated Log logs = 1;
}
// QueryBlockLogsRequest is the request type for the Query/BlockLogs RPC method.
message QueryBlockLogsRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// hash is the block hash to query the logs for.
string hash = 1;
}
// 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 ];
}
// QueryBlockBloomRequest is the request type for the Query/BlockBloom RPC
// method.
message QueryBlockBloomRequest {}
// QueryBlockBloomResponse is the response type for the Query/BlockBloom RPC
// method.
message QueryBlockBloomResponse {
// bloom represents bloom filter for the given block hash.
bytes bloom = 1;
}
// 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 ];
}
+106
View File
@@ -0,0 +1,106 @@
syntax = "proto3";
package ethermint.evm.v1alpha1;
import "gogoproto/gogo.proto";
import "ethermint/evm/v1alpha1/evm.proto";
option go_package = "github.com/cosmos/ethermint/x/evm/types";
// Msg defines the evm Msg service.
service Msg {
// EthereumTx defines a method submitting Ethereum transactions.
rpc EthereumTx(MsgEthereumTx) returns (MsgEthereumTxResponse);
}
// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message.
message MsgEthereumTx {
option (gogoproto.goproto_getters) = false;
TxData data = 1;
// caches
double size = 2 [ (gogoproto.jsontag) = "-" ];
SigCache from = 3 [ (gogoproto.jsontag) = "-" ];
}
// MsgEthereumTxResponse defines the Msg/EthereumTx response type.
message MsgEthereumTxResponse {
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;
}
// TxData implements the Ethereum transaction data structure. It is used
// solely as intended in Ethereum abiding by the protocol.
message TxData {
option (gogoproto.goproto_getters) = false;
// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 1 [(gogoproto.customname) = "AccountNonce"];
// price defines the unsigned integer value of the gas price in bytes.
string price = 2 [
(gogoproto.jsontag) = "gasPrice",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// gas defines the gas limit defined for the transaction.
uint64 gas = 3 [(gogoproto.customname) = "GasLimit"];
Recipient to = 4 [
(gogoproto.customname) = "Recipient",
(gogoproto.moretags) = "rlp:\"nil\""
];
// value defines the unsigned integer value of the transaction amount.
string value = 5 [
(gogoproto.customname) = "Amount",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// input defines the data payload bytes of the transaction.
bytes input = 6 [(gogoproto.customname) = "Payload"];
// v defines the signature value
bytes v = 7;
// r defines the signature value
bytes r = 8;
// s define the signature value
bytes s = 9;
// hash defines the tx data hash, which is only used when marshaling to JSON.
string hash = 10 [ (gogoproto.moretags) = "rlp:\"-\"" ];
}
// Recipient defines a protobuf-compatible wrapper for an Ethereum address
// pointer. It is required for RLP encoding.
message Recipient {
option (gogoproto.goproto_getters) = false;
// address defines the hex-formated ethereum address of the recipient
string address = 1;
}
// SigCache is used to cache the derived sender and contains the signer used
// to derive it.
message SigCache {
option (gogoproto.goproto_getters) = false;
EIP155Signer signer = 1;
string address = 2;
}
// EIP155Transaction implements Signer using the EIP155 rules.
message EIP155Signer {
option (gogoproto.goproto_getters) = false;
bytes chain_id = 1 [(gogoproto.customname) = "chainId"];
bytes chain_id_mul = 2 [(gogoproto.customname) = "chainIdMul"];
}
@@ -0,0 +1,25 @@
syntax = "proto3";
package ethermint.types.v1alpha1;
import "cosmos/auth/v1beta1/auth.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/cosmos/ethermint/types";
// EthAccount implements the authtypes.AccountI interface and embeds an
// authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.
message EthAccount {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.equal) = false;
option (cosmos_proto.implements_interface) =
"github.com/cosmos/cosmos-sdk/x/auth/types.AccountI";
cosmos.auth.v1beta1.BaseAccount base_account = 1 [
(gogoproto.embed) = true,
(gogoproto.moretags) = "yaml:\"base_account\""
];
bytes code_hash = 2 [ (gogoproto.moretags) = "yaml:\"code_hash\"" ];
}