fix proto-gen

This commit is contained in:
Solovyov1796 2024-04-24 14:42:02 +08:00
parent d130229312
commit 5207a300ad
13 changed files with 278 additions and 40 deletions

View File

@ -7,7 +7,7 @@ proto-lint check-proto-lint: install-build-deps
proto-gen: install-build-deps
@echo "Generating go proto files"
@$(BUF) generate --template proto/buf.gen.gogo.yaml proto
@cp -r out/github.com/kava-labs/kava/* ./
@cp -r out/github.com/0glabs/0g-chain/* ./
@rm -rf out/github.com
.PHONY: check-proto-gen

View File

@ -0,0 +1,25 @@
// Copyright Tharsis Labs Ltd.(Evmos)
// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)
syntax = "proto3";
package crypto.vrf;
import "gogoproto/gogo.proto";
option go_package = "github.com/0glabs/0g-chain/crypto/vrf";
// PubKey defines a type alias for an vrf.PublicKey that implements
// Vrf's PubKey interface. It represents the 32-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 vrf.PrivateKey that implements
// Vrf's PrivateKey interface.
message PrivKey {
// key is the private key in byte form
bytes key = 1;
}

View File

@ -0,0 +1,52 @@
syntax = "proto3";
package zgc.committee.v1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/0glabs/0g-chain/x/committee/v1/types";
message Params {
uint64 committee_size = 1;
}
// GenesisState defines the committee module's genesis state.
message GenesisState {
option (gogoproto.goproto_getters) = false;
Params params = 1 [(gogoproto.nullable) = false];
uint64 voting_start_height = 2;
uint64 voting_period = 3;
uint64 current_committee_id = 4 [(gogoproto.customname) = "CurrentCommitteeID"];
repeated Committee committees = 5 [(gogoproto.nullable) = false];
}
message Committee {
uint64 id = 1 [(gogoproto.customname) = "ID"];
uint64 voting_start_height = 2;
uint64 start_height = 3;
uint64 end_height = 4;
repeated Vote votes = 5 [(gogoproto.nullable) = false];
repeated bytes members = 6 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress"
];
}
message Vote {
option (gogoproto.goproto_getters) = false;
uint64 committee_id = 1 [(gogoproto.customname) = "CommitteeID"];
bytes voter = 2 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress"
];
repeated Ballot ballots = 3;
}
message Ballot {
uint64 id = 1 [(gogoproto.customname) = "ID"];
bytes content = 2;
}

View File

@ -0,0 +1,34 @@
syntax = "proto3";
package zgc.committee.v1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "zgc/committee/v1/genesis.proto";
option go_package = "github.com/0glabs/0g-chain/x/committee/v1/types";
option (gogoproto.goproto_getters_all) = false;
// Query defines the gRPC querier service for committee module
service Query {
rpc CurrentCommitteeID(QueryCurrentCommitteeIDRequest) returns (QueryCurrentCommitteeIDResponse) {
option (google.api.http).get = "/0gchain/committee/v1/current-committee-id";
}
rpc RegisteredVoters(QueryRegisteredVotersRequest) returns (QueryRegisteredVotersResponse) {
option (google.api.http).get = "/0gchain/committee/v1/registered-voters";
}
}
message QueryCurrentCommitteeIDRequest {}
message QueryCurrentCommitteeIDResponse {
uint64 current_committee_id = 1 [(gogoproto.customname) = "CurrentCommitteeID"];
}
message QueryRegisteredVotersRequest {}
message QueryRegisteredVotersResponse {
repeated string voters = 1;
}

View File

@ -0,0 +1,31 @@
syntax = "proto3";
package zgc.committee.v1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "zgc/committee/v1/genesis.proto";
option go_package = "github.com/0glabs/0g-chain/x/committee/v1/types";
option (gogoproto.goproto_getters_all) = false;
// Msg defines the committee Msg service
service Msg {
rpc Register(MsgRegister) returns (MsgRegisterResponse);
rpc Vote(MsgVote) returns (MsgVoteResponse);
}
message MsgRegister {
string voter = 1;
bytes key = 2;
}
message MsgRegisterResponse {}
message MsgVote {
uint64 committee_id = 1 [(gogoproto.customname) = "CommitteeID"];
string voter = 2;
repeated Ballot ballots = 3;
}
message MsgVoteResponse {}

View File

@ -0,0 +1,37 @@
syntax = "proto3";
package zgc.das.v1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/0glabs/0g-chain/x/das/v1/types";
message Params {}
// GenesisState defines the das module's genesis state.
message GenesisState {
option (gogoproto.goproto_getters) = false;
Params params = 1 [(gogoproto.nullable) = false];
uint64 next_request_id = 2 [(gogoproto.customname) = "NextRequestID"];
repeated DASRequest requests = 3 [(gogoproto.nullable) = false];
repeated DASResponse responses = 4 [(gogoproto.nullable) = false];
}
message DASRequest {
uint64 id = 1 [(gogoproto.customname) = "ID"];
bytes stream_id = 2 [(gogoproto.customname) = "StreamID"];
bytes batch_header_hash = 3;
uint32 num_blobs = 4;
}
message DASResponse {
uint64 id = 1 [(gogoproto.customname) = "ID"];
bytes sampler = 2 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress"
];
repeated bool results = 3;
}

View File

@ -0,0 +1,24 @@
syntax = "proto3";
package zgc.das.v1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/0glabs/0g-chain/x/das/v1/types";
option (gogoproto.goproto_getters_all) = false;
// Query defines the gRPC querier service for the das module
service Query {
rpc NextRequestID(QueryNextRequestIDRequest) returns (QueryNextRequestIDResponse) {
option (google.api.http).get = "/0gchain/das/v1/next-request-id";
}
}
message QueryNextRequestIDRequest {}
message QueryNextRequestIDResponse {
uint64 next_request_id = 1 [(gogoproto.customname) = "NextRequestID"];
}

35
proto/zgc/das/v1/tx.proto Normal file
View File

@ -0,0 +1,35 @@
syntax = "proto3";
package zgc.das.v1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "zgc/das/v1/genesis.proto";
option go_package = "github.com/0glabs/0g-chain/x/das/v1/types";
option (gogoproto.goproto_getters_all) = false;
// Msg defines the das Msg service
service Msg {
rpc RequestDAS(MsgRequestDAS) returns (MsgRequestDASResponse);
rpc ReportDASResult(MsgReportDASResult) returns (MsgReportDASResultResponse);
}
message MsgRequestDAS {
string requester = 1 [(gogoproto.moretags) = "Requester"];
string stream_id = 2 [(gogoproto.customname) = "StreamID"];
string batch_header_hash = 3;
uint32 num_blobs = 4;
}
message MsgRequestDASResponse {
uint64 request_id = 1 [(gogoproto.customname) = "RequestID"];
}
message MsgReportDASResult {
uint64 request_id = 1 [(gogoproto.customname) = "RequestID"];
string sampler = 2;
repeated bool results = 3;
}
message MsgReportDASResultResponse {}

View File

@ -1,20 +1,20 @@
syntax = "proto3";
package kava.evmutil.v1beta1;
package zgc.evmutil.v1beta1;
import "gogoproto/gogo.proto";
option go_package = "github.com/kava-labs/kava/x/evmutil/types";
option go_package = "github.com/0glabs/0g-chain/x/evmutil/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;
// ConversionPair defines a Kava ERC20 address and corresponding denom that is
// ConversionPair defines a 0g-chain ERC20 address and corresponding denom that is
// allowed to be converted between ERC20 and sdk.Coin
message ConversionPair {
option (gogoproto.goproto_getters) = false;
// ERC20 address of the token on the Kava EVM
bytes kava_erc20_address = 1 [
(gogoproto.customname) = "KavaERC20Address",
// ERC20 address of the token on the 0g-chain EVM
bytes zgchain_erc20_address = 1 [
(gogoproto.customname) = "ZgchainERC20Address",
(gogoproto.casttype) = "HexBytes"
];

View File

@ -1,11 +1,11 @@
syntax = "proto3";
package kava.evmutil.v1beta1;
package zgc.evmutil.v1beta1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "kava/evmutil/v1beta1/conversion_pair.proto";
import "zgc/evmutil/v1beta1/conversion_pair.proto";
option go_package = "github.com/kava-labs/kava/x/evmutil/types";
option go_package = "github.com/0glabs/0g-chain/x/evmutil/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;
@ -28,7 +28,7 @@ message Account {
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
];
// balance indicates the amount of akava owned by the address.
// balance indicates the amount of neuron owned by the address.
string balance = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
@ -39,7 +39,7 @@ message Account {
// Params defines the evmutil module params
message Params {
// enabled_conversion_pairs defines the list of conversion pairs allowed to be
// converted between Kava ERC20 and sdk.Coin
// converted between 0g-chain ERC20 and sdk.Coin
repeated ConversionPair enabled_conversion_pairs = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "ConversionPairs"

View File

@ -1,23 +1,23 @@
syntax = "proto3";
package kava.evmutil.v1beta1;
package zgc.evmutil.v1beta1;
import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "kava/evmutil/v1beta1/genesis.proto";
import "zgc/evmutil/v1beta1/genesis.proto";
option go_package = "github.com/kava-labs/kava/x/evmutil/types";
option go_package = "github.com/0glabs/0g-chain/x/evmutil/types";
// Query defines the gRPC querier service for evmutil module
service Query {
// Params queries all parameters of the evmutil module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/kava/evmutil/v1beta1/params";
option (google.api.http).get = "/0g-chain/evmutil/v1beta1/params";
}
// DeployedCosmosCoinContracts queries a list cosmos coin denom and their deployed erc20 address
rpc DeployedCosmosCoinContracts(QueryDeployedCosmosCoinContractsRequest) returns (QueryDeployedCosmosCoinContractsResponse) {
option (google.api.http).get = "/kava/evmutil/v1beta1/deployed_cosmos_coin_contracts";
option (google.api.http).get = "/0g-chain/evmutil/v1beta1/deployed_cosmos_coin_contracts";
}
}

View File

@ -1,20 +1,20 @@
syntax = "proto3";
package kava.evmutil.v1beta1;
package zgc.evmutil.v1beta1;
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/kava-labs/kava/x/evmutil/types";
option go_package = "github.com/0glabs/0g-chain/x/evmutil/types";
option (gogoproto.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;
// Msg defines the evmutil Msg service.
service Msg {
// ConvertCoinToERC20 defines a method for converting sdk.Coin to Kava ERC20.
// ConvertCoinToERC20 defines a method for converting sdk.Coin to 0g-chain ERC20.
rpc ConvertCoinToERC20(MsgConvertCoinToERC20) returns (MsgConvertCoinToERC20Response);
// ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin.
// ConvertERC20ToCoin defines a method for converting 0g-chain ERC20 to sdk.Coin.
rpc ConvertERC20ToCoin(MsgConvertERC20ToCoin) returns (MsgConvertERC20ToCoinResponse);
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
@ -24,11 +24,11 @@ service Msg {
rpc ConvertCosmosCoinFromERC20(MsgConvertCosmosCoinFromERC20) returns (MsgConvertCosmosCoinFromERC20Response);
}
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20 for EVM-native assets.
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to 0g-chain ERC20 for EVM-native assets.
message MsgConvertCoinToERC20 {
// Kava bech32 address initiating the conversion.
// 0g-chain bech32 address initiating the conversion.
string initiator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// EVM 0x hex address that will receive the converted Kava ERC20 tokens.
// EVM 0x hex address that will receive the converted 0g-chain ERC20 tokens.
string receiver = 2;
// Amount is the sdk.Coin amount to convert.
cosmos.base.v1beta1.Coin amount = 3;
@ -37,14 +37,14 @@ message MsgConvertCoinToERC20 {
// MsgConvertCoinToERC20Response defines the response value from Msg/ConvertCoinToERC20.
message MsgConvertCoinToERC20Response {}
// MsgConvertERC20ToCoin defines a conversion from Kava ERC20 to sdk.Coin for EVM-native assets.
// MsgConvertERC20ToCoin defines a conversion from 0g-chain ERC20 to sdk.Coin for EVM-native assets.
message MsgConvertERC20ToCoin {
// EVM 0x hex address initiating the conversion.
string initiator = 1;
// Kava bech32 address that will receive the converted sdk.Coin.
// 0g-chain bech32 address that will receive the converted sdk.Coin.
string receiver = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// EVM 0x hex address of the ERC20 contract.
string kava_erc20_address = 3 [(gogoproto.customname) = "KavaERC20Address"];
string zgchain_erc20_address = 3 [(gogoproto.customname) = "ZgchainERC20Address"];
// ERC20 token amount to convert.
string amount = 4 [
(cosmos_proto.scalar) = "cosmos.Int",
@ -59,7 +59,7 @@ message MsgConvertERC20ToCoinResponse {}
// MsgConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20 for cosmos-native assets.
message MsgConvertCosmosCoinToERC20 {
// Kava bech32 address initiating the conversion.
// 0g-chain bech32 address initiating the conversion.
string initiator = 1;
// EVM hex address that will receive the ERC20 tokens.
string receiver = 2;
@ -74,7 +74,7 @@ message MsgConvertCosmosCoinToERC20Response {}
message MsgConvertCosmosCoinFromERC20 {
// EVM hex address initiating the conversion.
string initiator = 1;
// Kava bech32 address that will receive the cosmos coins.
// 0g-chain bech32 address that will receive the cosmos coins.
string receiver = 2;
// Amount is the amount to convert, expressed as a Cosmos coin.
cosmos.base.v1beta1.Coin amount = 3;

View File

@ -1,48 +1,48 @@
syntax = "proto3";
package kava.validatorvesting.v1beta1;
package zgc.validatorvesting.v1beta1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
option go_package = "github.com/kava-labs/kava/x/validator-vesting/types";
option go_package = "github.com/0glabs/0g-chain/x/validator-vesting/types";
option (gogoproto.goproto_getters_all) = false;
// Query defines the gRPC querier service for validator-vesting module
service Query {
// CirculatingSupply returns the total amount of kava tokens in circulation
// CirculatingSupply returns the total amount of 0g-chain tokens in circulation
rpc CirculatingSupply(QueryCirculatingSupplyRequest) returns (QueryCirculatingSupplyResponse) {
option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply";
option (google.api.http).get = "/0g-chain/validator-vesting/v1beta1/circulating_supply";
}
// TotalSupply returns the total amount of kava tokens
// TotalSupply returns the total amount of 0g-chain tokens
rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) {
option (google.api.http).get = "/kava/validator-vesting/v1beta1/total_supply";
option (google.api.http).get = "/0g-chain/validator-vesting/v1beta1/total_supply";
}
// CirculatingSupplyHARD returns the total amount of hard tokens in circulation
rpc CirculatingSupplyHARD(QueryCirculatingSupplyHARDRequest) returns (QueryCirculatingSupplyHARDResponse) {
option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply_hard";
option (google.api.http).get = "/0g-chain/validator-vesting/v1beta1/circulating_supply_hard";
}
// CirculatingSupplyUSDX returns the total amount of usdx tokens in circulation
rpc CirculatingSupplyUSDX(QueryCirculatingSupplyUSDXRequest) returns (QueryCirculatingSupplyUSDXResponse) {
option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply_usdx";
option (google.api.http).get = "/0g-chain/validator-vesting/v1beta1/circulating_supply_usdx";
}
// CirculatingSupplySWP returns the total amount of swp tokens in circulation
rpc CirculatingSupplySWP(QueryCirculatingSupplySWPRequest) returns (QueryCirculatingSupplySWPResponse) {
option (google.api.http).get = "/kava/validator-vesting/v1beta1/circulating_supply_swp";
option (google.api.http).get = "/0g-chain/validator-vesting/v1beta1/circulating_supply_swp";
}
// TotalSupplyHARD returns the total amount of hard tokens
rpc TotalSupplyHARD(QueryTotalSupplyHARDRequest) returns (QueryTotalSupplyHARDResponse) {
option (google.api.http).get = "/kava/validator-vesting/v1beta1/total_supply_hard";
option (google.api.http).get = "/0g-chain/validator-vesting/v1beta1/total_supply_hard";
}
// TotalSupplyUSDX returns the total amount of usdx tokens
rpc TotalSupplyUSDX(QueryTotalSupplyUSDXRequest) returns (QueryTotalSupplyUSDXResponse) {
option (google.api.http).get = "/kava/validator-vesting/v1beta1/total_supply_usdx";
option (google.api.http).get = "/0g-chain/validator-vesting/v1beta1/total_supply_usdx";
}
}