cleanup proto

This commit is contained in:
Federico Kunze 2021-04-19 09:10:57 +02:00
parent 6f7470c2e0
commit 4a9d63356e
No known key found for this signature in database
GPG Key ID: 655F93A970080A30
23 changed files with 1703 additions and 7894 deletions

View File

@ -364,9 +364,6 @@ proto-swagger-gen:
proto-format: proto-format:
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \; find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh
proto-lint: proto-lint:
@$(DOCKER_BUF) check lint --error-format=json @$(DOCKER_BUF) check lint --error-format=json

View File

@ -7,7 +7,7 @@
}, },
"apis": [ "apis": [
{ {
"url": "./tmp-swagger-gen/ethermint/evm/v1beta1/query.swagger.json", "url": "./tmp-swagger-gen/ethermint/evm/v1alpha1/query.swagger.json",
"operationIds": { "operationIds": {
"rename": { "rename": {
"Params": "EvmParams" "Params": "EvmParams"

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -16,4 +16,6 @@ message PubKey {
// PrivKey defines a type alias for an ecdsa.PrivateKey that implements // PrivKey defines a type alias for an ecdsa.PrivateKey that implements
// Tendermint's PrivateKey interface. // Tendermint's PrivateKey interface.
message PrivKey { bytes key = 1; } message PrivKey {
bytes key = 1;
}

View File

@ -17,10 +17,7 @@ message Params {
// enable_call toggles state transitions that use the vm.Call function // 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 // extra_eips defines the additional EIPs for the vm.Config
repeated int64 extra_eips = 4 [ repeated int64 extra_eips = 4 [(gogoproto.customname) = "ExtraEIPs", (gogoproto.moretags) = "yaml:\"extra_eips\""];
(gogoproto.customname) = "ExtraEIPs",
(gogoproto.moretags) = "yaml:\"extra_eips\""
];
} }
// ChainConfig defines the Ethereum ChainConfig parameters using sdk.Int values // ChainConfig defines the Ethereum ChainConfig parameters using sdk.Int values
@ -49,10 +46,8 @@ message ChainConfig {
(gogoproto.nullable) = false (gogoproto.nullable) = false
]; ];
// Whether the nodes supports or opposes the DAO hard-fork // Whether the nodes supports or opposes the DAO hard-fork
bool dao_fork_support = 3 [ bool dao_fork_support = 3
(gogoproto.customname) = "DAOForkSupport", [(gogoproto.customname) = "DAOForkSupport", (gogoproto.moretags) = "yaml:\"dao_fork_support\""];
(gogoproto.moretags) = "yaml:\"dao_fork_support\""
];
// EIP150 implements the Gas price changes // EIP150 implements the Gas price changes
// (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (< 0 no fork) // (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (< 0 no fork)
string eip150_block = 4 [ string eip150_block = 4 [
@ -62,10 +57,7 @@ message ChainConfig {
(gogoproto.nullable) = false (gogoproto.nullable) = false
]; ];
// EIP150 HF hash (needed for header only clients as only gas pricing changed) // EIP150 HF hash (needed for header only clients as only gas pricing changed)
string eip150_hash = 5 [ string eip150_hash = 5 [(gogoproto.customname) = "EIP150Hash", (gogoproto.moretags) = "yaml:\"byzantium_block\""];
(gogoproto.customname) = "EIP150Hash",
(gogoproto.moretags) = "yaml:\"byzantium_block\""
];
// EIP155Block HF block // EIP155Block HF block
string eip155_block = 6 [ string eip155_block = 6 [
(gogoproto.customname) = "EIP155Block", (gogoproto.customname) = "EIP155Block",
@ -192,16 +184,12 @@ message TxResult {
// contract_address contains the ethereum address of the created contract (if // 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 // any). If the state transition is an evm.Call, the contract address will be
// empty. // empty.
string contract_address = 1 string contract_address = 1 [(gogoproto.moretags) = "yaml:\"contract_address\""];
[ (gogoproto.moretags) = "yaml:\"contract_address\"" ];
// bloom represents the bloom filter bytes // bloom represents the bloom filter bytes
bytes bloom = 2; bytes bloom = 2;
// tx_logs contains the transaction hash and the proto-compatible ethereum // tx_logs contains the transaction hash and the proto-compatible ethereum
// logs. // logs.
TransactionLogs tx_logs = 3 [ TransactionLogs tx_logs = 3 [(gogoproto.moretags) = "yaml:\"tx_logs\"", (gogoproto.nullable) = false];
(gogoproto.moretags) = "yaml:\"tx_logs\"",
(gogoproto.nullable) = false
];
// ret defines the bytes from the execution. // ret defines the bytes from the execution.
bytes ret = 4; bytes ret = 4;
// reverted flag is set to true when the call has been reverted // reverted flag is set to true when the call has been reverted
@ -218,18 +206,12 @@ message TxData {
// nonce corresponds to the account nonce (transaction sequence). // nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 1 [(gogoproto.customname) = "AccountNonce"]; uint64 nonce = 1 [(gogoproto.customname) = "AccountNonce"];
// price defines the unsigned integer value of the gas price in bytes. // price defines the unsigned integer value of the gas price in bytes.
bytes price = 2 [ bytes price = 2 [(gogoproto.jsontag) = "gasPrice"];
(gogoproto.jsontag) = "gasPrice"
];
// gas defines the gas limit defined for the transaction. // gas defines the gas limit defined for the transaction.
uint64 gas = 3 [(gogoproto.customname) = "GasLimit"]; uint64 gas = 3 [(gogoproto.customname) = "GasLimit"];
bytes to = 4 [ bytes to = 4 [(gogoproto.customname) = "Recipient"];
(gogoproto.customname) = "Recipient"
];
// value defines the unsigned integer value of the transaction amount. // value defines the unsigned integer value of the transaction amount.
bytes value = 5 [ bytes value = 5 [(gogoproto.customname) = "Amount"];
(gogoproto.customname) = "Amount"
];
// input defines the data payload bytes of the transaction. // input defines the data payload bytes of the transaction.
bytes input = 6 [(gogoproto.customname) = "Payload"]; bytes input = 6 [(gogoproto.customname) = "Payload"];
// v defines the signature value // v defines the signature value

View File

@ -11,17 +11,11 @@ message GenesisState {
// accounts is an array containing the ethereum genesis accounts. // accounts is an array containing the ethereum genesis accounts.
repeated GenesisAccount accounts = 1 [(gogoproto.nullable) = false]; repeated GenesisAccount accounts = 1 [(gogoproto.nullable) = false];
// chain_config defines the Ethereum chain configuration. // chain_config defines the Ethereum chain configuration.
ChainConfig chain_config = 2 [ ChainConfig chain_config = 2 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false];
(gogoproto.moretags) = "yaml:\"chain_config\"",
(gogoproto.nullable) = false
];
// params defines all the paramaters of the module. // params defines all the paramaters of the module.
Params params = 3 [(gogoproto.nullable) = false]; Params params = 3 [(gogoproto.nullable) = false];
repeated TransactionLogs txs_logs = 4 [ repeated TransactionLogs txs_logs = 4 [(gogoproto.moretags) = "yaml:\"txs_logs\"", (gogoproto.nullable) = false];
(gogoproto.moretags) = "yaml:\"txs_logs\"",
(gogoproto.nullable) = false
];
} }
// GenesisAccount defines an account to be initialized in the genesis state. // GenesisAccount defines an account to be initialized in the genesis state.
@ -33,8 +27,5 @@ message GenesisAccount {
// code defines the hex bytes of the account code. // code defines the hex bytes of the account code.
string code = 2; string code = 2;
// storage defines the set of state key values for the account. // storage defines the set of state key values for the account.
repeated State storage = 3 [ repeated State storage = 3 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "Storage"];
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "Storage"
];
} }

View File

@ -27,8 +27,7 @@ service Query {
// Storage queries the balance of all coins for a single account. // Storage queries the balance of all coins for a single account.
rpc Storage(QueryStorageRequest) returns (QueryStorageResponse) { rpc Storage(QueryStorageRequest) returns (QueryStorageResponse) {
option (google.api.http).get = option (google.api.http).get = "/ethermint/evm/v1alpha1/storage/{address}/{key}";
"/ethermint/evm/v1alpha1/storage/{address}/{key}";
} }
// Code queries the balance of all coins for a single account. // Code queries the balance of all coins for a single account.
@ -242,7 +241,9 @@ message QueryBlockLogsResponse {
// QueryBlockBloomRequest is the request type for the Query/BlockBloom RPC // QueryBlockBloomRequest is the request type for the Query/BlockBloom RPC
// method. // method.
message QueryBlockBloomRequest { int64 height = 1; } message QueryBlockBloomRequest {
int64 height = 1;
}
// QueryBlockBloomResponse is the response type for the Query/BlockBloom RPC // QueryBlockBloomResponse is the response type for the Query/BlockBloom RPC
// method. // method.

View File

@ -42,10 +42,7 @@ message MsgEthereumTxResponse {
bytes bloom = 2; bytes bloom = 2;
// tx_logs contains the transaction hash and the proto-compatible ethereum // tx_logs contains the transaction hash and the proto-compatible ethereum
// logs. // logs.
TransactionLogs tx_logs = 3 [ TransactionLogs tx_logs = 3 [(gogoproto.moretags) = "yaml:\"tx_logs\"", (gogoproto.nullable) = false];
(gogoproto.moretags) = "yaml:\"tx_logs\"",
(gogoproto.nullable) = false
];
// ret defines the bytes from the execution. // ret defines the bytes from the execution.
bytes ret = 4; bytes ret = 4;
// reverted flag is set to true when the call has been reverted // reverted flag is set to true when the call has been reverted

View File

@ -14,12 +14,9 @@ message EthAccount {
option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_stringer) = false;
option (gogoproto.equal) = false; option (gogoproto.equal) = false;
option (cosmos_proto.implements_interface) = option (cosmos_proto.implements_interface) = "github.com/cosmos/cosmos-sdk/x/auth/types.AccountI";
"github.com/cosmos/cosmos-sdk/x/auth/types.AccountI";
cosmos.auth.v1beta1.BaseAccount base_account = 1 [ cosmos.auth.v1beta1.BaseAccount base_account = 1
(gogoproto.embed) = true, [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""];
(gogoproto.moretags) = "yaml:\"base_account\""
];
bytes code_hash = 2 [(gogoproto.moretags) = "yaml:\"code_hash\""]; bytes code_hash = 2 [(gogoproto.moretags) = "yaml:\"code_hash\""];
} }

View File

@ -3,18 +3,18 @@
set -eo pipefail set -eo pipefail
mkdir -p ./tmp-swagger-gen mkdir -p ./tmp-swagger-gen
proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) proto_dirs=$(find ./proto ./third_party/proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do for dir in $proto_dirs; do
# generate swagger files (filter query files) # generate swagger files (filter query files)
query_file=$(find "${dir}" -maxdepth 1 -name 'query.proto') query_file=$(find "${dir}" -maxdepth 1 -name 'query.proto')
if [[ ! -z "$query_file" ]]; then if [[ ! -z "$query_file" ]]; then
buf protoc \ protoc \
-I "proto" \ -I "proto" \
-I "third_party/proto" \ -I "third_party/proto" \
"$query_file" \ "$query_file" \
--swagger_out=./tmp-swagger-gen \ --swagger_out ./tmp-swagger-gen \
--swagger_opt=logtostderr=true --swagger_opt=fqn_for_swagger_name=true --swagger_opt=simple_operation_ids=true --swagger_opt logtostderr=true --swagger_opt fqn_for_swagger_name=true --swagger_opt simple_operation_ids=true
fi fi
done done
@ -25,3 +25,6 @@ swagger-combine ./client/docs/config.json -o ./client/docs/swagger-ui/swagger.ya
# clean swagger files # clean swagger files
rm -rf ./tmp-swagger-gen rm -rf ./tmp-swagger-gen
# generate binary for static server
statik -src=./client/docs/swagger-ui -dest=./client/docs

View File

@ -11,4 +11,6 @@ extend google.protobuf.MessageOptions {
string implements_interface = 93002; string implements_interface = 93002;
} }
extend google.protobuf.FieldOptions { string accepts_interface = 93001; } extend google.protobuf.FieldOptions {
string accepts_interface = 93001;
}

View File

@ -53,7 +53,9 @@ option optimize_for = SPEED;
// The protocol compiler can output a FileDescriptorSet containing the .proto // The protocol compiler can output a FileDescriptorSet containing the .proto
// files it parses. // files it parses.
message FileDescriptorSet { repeated FileDescriptorProto file = 1; } message FileDescriptorSet {
repeated FileDescriptorProto file = 1;
}
// Describes a complete .proto file. // Describes a complete .proto file.
message FileDescriptorProto { message FileDescriptorProto {
@ -693,8 +695,7 @@ message MethodOptions {
NO_SIDE_EFFECTS = 1; // implies idempotent NO_SIDE_EFFECTS = 1; // implies idempotent
IDEMPOTENT = 2; // idempotent, but may have side effects IDEMPOTENT = 2; // idempotent, but may have side effects
} }
optional IdempotencyLevel idempotency_level = 34 optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
[ default = IDEMPOTENCY_UNKNOWN ];
// The parser stores options it doesn't recognize here. See above. // The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999; repeated UninterpretedOption uninterpreted_option = 999;

View File

@ -58,8 +58,7 @@ message RequestSetOption {
} }
message RequestInitChain { message RequestInitChain {
google.protobuf.Timestamp time = 1 google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
string chain_id = 2; string chain_id = 2;
ConsensusParams consensus_params = 3; ConsensusParams consensus_params = 3;
repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false];
@ -102,8 +101,7 @@ message RequestEndBlock {
message RequestCommit {} message RequestCommit {}
// lists available snapshots // lists available snapshots
message RequestListSnapshots { message RequestListSnapshots {}
}
// offers a snapshot to the application // offers a snapshot to the application
message RequestOfferSnapshot { message RequestOfferSnapshot {
@ -198,8 +196,7 @@ message ResponseQuery {
} }
message ResponseBeginBlock { message ResponseBeginBlock {
repeated Event events = 1 repeated Event events = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
} }
message ResponseCheckTx { message ResponseCheckTx {
@ -209,8 +206,7 @@ message ResponseCheckTx {
string info = 4; // nondeterministic string info = 4; // nondeterministic
int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_wanted = 5 [json_name = "gas_wanted"];
int64 gas_used = 6 [json_name = "gas_used"]; int64 gas_used = 6 [json_name = "gas_used"];
repeated Event events = 7 repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
string codespace = 8; string codespace = 8;
} }
@ -221,17 +217,14 @@ message ResponseDeliverTx {
string info = 4; // nondeterministic string info = 4; // nondeterministic
int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_wanted = 5 [json_name = "gas_wanted"];
int64 gas_used = 6 [json_name = "gas_used"]; int64 gas_used = 6 [json_name = "gas_used"];
repeated Event events = 7 repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
string codespace = 8; string codespace = 8;
} }
message ResponseEndBlock { message ResponseEndBlock {
repeated ValidatorUpdate validator_updates = 1 repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false];
[(gogoproto.nullable) = false];
ConsensusParams consensus_param_updates = 2; ConsensusParams consensus_param_updates = 2;
repeated Event events = 3 repeated Event events = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
} }
message ResponseCommit { message ResponseCommit {
@ -306,10 +299,7 @@ message LastCommitInfo {
// Later, transactions may be queried using these events. // Later, transactions may be queried using these events.
message Event { message Event {
string type = 1; string type = 1;
repeated EventAttribute attributes = 2 [ repeated EventAttribute attributes = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "attributes,omitempty"];
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "attributes,omitempty"
];
} }
// EventAttribute is a single key-value pair, associated with an event. // EventAttribute is a single key-value pair, associated with an event.
@ -364,10 +354,7 @@ message Evidence {
// The height when the offense occurred // The height when the offense occurred
int64 height = 3; int64 height = 3;
// The corresponding time where the offense occurred // The corresponding time where the offense occurred
google.protobuf.Timestamp time = 4 [ google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true
];
// Total voting power of the validator set in case the ABCI application does // Total voting power of the validator set in case the ABCI application does
// not store historical validators. // not store historical validators.
// https://github.com/tendermint/tendermint/issues/4581 // https://github.com/tendermint/tendermint/issues/4581

View File

@ -45,8 +45,7 @@ message EvidenceParams {
// It should correspond with an app's "unbonding period" or other similar // It should correspond with an app's "unbonding period" or other similar
// mechanism for handling [Nothing-At-Stake // mechanism for handling [Nothing-At-Stake
// attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed).
google.protobuf.Duration max_age_duration = 2 google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
// This sets the maximum size of total evidence in bytes that can be committed in a single block. // This sets the maximum size of total evidence in bytes that can be committed in a single block.
// and should fall comfortably under the max block bytes. // and should fall comfortably under the max block bytes.

View File

@ -95,10 +95,8 @@ message Vote {
SignedMsgType type = 1; SignedMsgType type = 1;
int64 height = 2; int64 height = 2;
int32 round = 3; int32 round = 3;
BlockID block_id = 4 BlockID block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil.
[(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
google.protobuf.Timestamp timestamp = 5
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
bytes validator_address = 6; bytes validator_address = 6;
int32 validator_index = 7; int32 validator_index = 7;
bytes signature = 8; bytes signature = 8;
@ -116,8 +114,7 @@ message Commit {
message CommitSig { message CommitSig {
BlockIDFlag block_id_flag = 1; BlockIDFlag block_id_flag = 1;
bytes validator_address = 2; bytes validator_address = 2;
google.protobuf.Timestamp timestamp = 3 google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
bytes signature = 4; bytes signature = 4;
} }
@ -127,8 +124,7 @@ message Proposal {
int32 round = 3; int32 round = 3;
int32 pol_round = 4; int32 pol_round = 4;
BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
google.protobuf.Timestamp timestamp = 6 google.protobuf.Timestamp timestamp = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
bytes signature = 7; bytes signature = 7;
} }

View File

@ -18,13 +18,13 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
&MsgEthereumTx{}, &MsgEthereumTx{},
) )
registry.RegisterInterface("injective.evm.v1beta1.ExtensionOptionsEthereumTx", (*ExtensionOptionsEthereumTxI)(nil)) registry.RegisterInterface("injective.evm.v1alpha1.ExtensionOptionsEthereumTx", (*ExtensionOptionsEthereumTxI)(nil))
registry.RegisterImplementations( registry.RegisterImplementations(
(*ExtensionOptionsEthereumTxI)(nil), (*ExtensionOptionsEthereumTxI)(nil),
&ExtensionOptionsEthereumTx{}, &ExtensionOptionsEthereumTx{},
) )
registry.RegisterInterface("injective.evm.v1beta1.ExtensionOptionsWeb3Tx", (*ExtensionOptionsWeb3TxI)(nil)) registry.RegisterInterface("injective.evm.v1alpha1.ExtensionOptionsWeb3Tx", (*ExtensionOptionsWeb3TxI)(nil))
registry.RegisterImplementations( registry.RegisterImplementations(
(*ExtensionOptionsWeb3TxI)(nil), (*ExtensionOptionsWeb3TxI)(nil),
&ExtensionOptionsWeb3Tx{}, &ExtensionOptionsWeb3Tx{},