Skip to content

Commit

Permalink
Fix old cork proposals having blank message name (#328)
Browse files Browse the repository at this point in the history
* Attempt 2, add old cork protos and regen their bindings

* Make sure XXX_MessageName is present for old cork types
  • Loading branch information
cbrit authored Nov 13, 2024
1 parent 8ceebb8 commit 1f5c6ce
Show file tree
Hide file tree
Showing 13 changed files with 416 additions and 159 deletions.
4 changes: 2 additions & 2 deletions proto/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: e7f8d366f5264595bcc4cd4139af9973
digest: shake256:e5e5f1c12f82e028ea696faa43b4f9dc6258a6d1226282962a8c8b282e10946281d815884f574bd279ebd9cd7588629beb3db17b892af6c33b56f92f8f67f509
commit: 553fd4b4b3a640be9b69a3fa0c17b383
digest: shake256:e30e3247f84b7ff9d09941ce391eb4b6f04734e1e5fae796bfc471f167e6f90813630cc39397ee46b8bc0ea7d6935c416d15c219cc5732d9778cbfdf73a1ed6e
26 changes: 26 additions & 0 deletions proto/cork/v1/cork.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";
package cork.v1;

option go_package = "github.com/peggyjv/sommelier/v8/x/cork/types/v1";

message Cork {
// call body containing the ABI encoded bytes to send to the contract
bytes encoded_contract_call = 1;
// address of the contract to send the call
string target_contract_address = 2;
}

message ValidatorCork {
Cork cork = 1;
string validator = 2;
}

message ScheduledCork {
Cork cork = 1;
uint64 block_height = 2;
string validator = 3;
}

message CellarIDSet {
repeated string ids = 1;
}
35 changes: 35 additions & 0 deletions proto/cork/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
syntax = "proto3";
package cork.v1;

import "cork/v1/tx.proto";
import "cork/v1/cork.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/peggyjv/sommelier/v8/x/cork/types/v1";


// GenesisState - all cork state that must be provided at genesis
message GenesisState {
Params params = 1 [
(gogoproto.nullable) = false
];
CellarIDSet cellar_ids = 2 [
(gogoproto.nullable) = false
];
uint64 invalidation_nonce = 3;
repeated ValidatorCork corks = 4;
repeated ScheduledCork scheduled_corks = 5;
}

// Params cork parameters
message Params {
// VotePeriod defines the number of blocks to wait for votes before attempting to tally
int64 vote_period = 1 [(gogoproto.moretags) = "yaml:\"vote_period\""];

// VoteThreshold defines the percentage of bonded stake required to vote each period
string vote_threshold = 2 [
(gogoproto.moretags) = "yaml:\"vote_threshold\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
39 changes: 39 additions & 0 deletions proto/cork/v1/proposal.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
syntax = "proto3";
package cork.v1;

import "cork/v1/cork.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/peggyjv/sommelier/v8/x/cork/types/v1";

message AddManagedCellarIDsProposal {
option (gogoproto.messagename) = true;
string title = 1;
string description = 2;
CellarIDSet cellar_ids = 3;
}

// AddManagedCellarIDsProposalWithDeposit is a specific definition for CLI commands
message AddManagedCellarIDsProposalWithDeposit {
option (gogoproto.messagename) = true;
string title = 1;
string description = 2;
repeated string cellar_ids = 3;
string deposit = 4;
}

message RemoveManagedCellarIDsProposal {
option (gogoproto.messagename) = true;
string title = 1;
string description = 2;
CellarIDSet cellar_ids = 3;
}

// RemoveManagedCellarIDsProposalWithDeposit is a specific definition for CLI commands
message RemoveManagedCellarIDsProposalWithDeposit {
option (gogoproto.messagename) = true;
string title = 1;
string description = 2;
repeated string cellar_ids = 3;
string deposit = 4;
}
111 changes: 111 additions & 0 deletions proto/cork/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
syntax = "proto3";
package cork.v1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cork/v1/genesis.proto";
import "cork/v1/cork.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

option go_package = "github.com/peggyjv/sommelier/v8/x/cork/types/v1";

// Query defines the gRPC query service for the cork module.
service Query {
// QueryParams queries the allocation module parameters.
rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/sommelier/cork/v1/params";
}
// QuerySubmittedCorks queries the submitted corks awaiting vote
rpc QuerySubmittedCorks(QuerySubmittedCorksRequest) returns (QuerySubmittedCorksResponse) {
option (google.api.http).get = "/sommelier/cork/v1/submitted";
}
// QueryCommitPeriod queries the heights for the current voting period (current, start and end)
rpc QueryCommitPeriod(QueryCommitPeriodRequest) returns (QueryCommitPeriodResponse) {
option (google.api.http).get = "/sommelier/cork/v1/commit_period";
}
// QueryCellarIDs returns all cellars and current tick ranges
rpc QueryCellarIDs(QueryCellarIDsRequest) returns (QueryCellarIDsResponse) {
option (google.api.http).get = "/sommelier/cork/v1/cellar_ids";
}
// QueryScheduledCorks returns all scheduled corks
rpc QueryScheduledCorks(QueryScheduledCorksRequest) returns (QueryScheduledCorksResponse) {
option (google.api.http).get = "/sommelier/cork/v1/scheduled_corks";
}
// QueryScheduledBlockHeights returns all scheduled block heights
rpc QueryScheduledBlockHeights(QueryScheduledBlockHeightsRequest) returns (QueryScheduledBlockHeightsResponse) {
option (google.api.http).get = "/sommelier/cork/v1/scheduled_block_heights";
}

// QueryScheduledCorks returns all scheduled corks at a block height
rpc QueryScheduledCorksByBlockHeight(QueryScheduledCorksByBlockHeightRequest) returns (QueryScheduledCorksByBlockHeightResponse) {
option (google.api.http).get = "/sommelier/cork/v1/scheduled_corks_by_block_height/{block_height}";
}
}

// QueryParamsRequest is the request type for the Query/Params gRPC method.
message QueryParamsRequest {}

// QueryParamsRequest is the response type for the Query/Params gRPC method.
message QueryParamsResponse {
// allocation parameters
Params params = 1 [(gogoproto.nullable) = false];
}

// QuerySubmittedCorksRequest is the request type for the Query/QuerySubmittedCorks gRPC query method.
message QuerySubmittedCorksRequest {}

// QuerySubmittedCorksResponse is the response type for the Query/QuerySubmittedCorks gRPC query method.
message QuerySubmittedCorksResponse {
// corks in keeper awaiting vote
repeated Cork corks = 1;
}


// QueryCommitPeriodRequest is the request type for the Query/QueryCommitPeriod gRPC method.
message QueryCommitPeriodRequest {}

// QueryCommitPeriodResponse is the response type for the Query/QueryCommitPeriod gRPC method.
message QueryCommitPeriodResponse {
// block height at which the query was processed
int64 current_height = 1;
// latest vote period start block height
int64 vote_period_start = 2;
// block height at which the current voting period ends
int64 vote_period_end = 3;
}


// QueryCellarIDsRequest is the request type for Query/QueryCellarIDs gRPC method.
message QueryCellarIDsRequest {}

// QueryCellarIDsResponse is the response type for Query/QueryCellars gRPC method.
message QueryCellarIDsResponse {
repeated string cellar_ids = 1;
}

// QueryScheduledCorksRequest
message QueryScheduledCorksRequest {}

// QueryScheduledCorksResponse
message QueryScheduledCorksResponse {
repeated ScheduledCork corks = 1;
}

// QueryScheduledBlockHeightsRequest
message QueryScheduledBlockHeightsRequest {}

// QueryScheduledBlockHeightsResponse
message QueryScheduledBlockHeightsResponse {
repeated uint64 block_heights = 1;
}

// QueryScheduledCorksByBlockHeightRequest
message QueryScheduledCorksByBlockHeightRequest {
uint64 block_height = 1;
}

// QueryScheduledCorksByBlockHeightResponse
message QueryScheduledCorksByBlockHeightResponse {
repeated ScheduledCork corks = 1;
}
34 changes: 34 additions & 0 deletions proto/cork/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
syntax = "proto3";
package cork.v1;

import "cork/v1/cork.proto";

option go_package = "github.com/peggyjv/sommelier/v8/x/cork/types/v1";

// MsgService defines the msgs that the cork module handles
service Msg {
rpc SubmitCork (MsgSubmitCorkRequest) returns (MsgSubmitCorkResponse);
rpc ScheduleCork (MsgScheduleCorkRequest) returns (MsgScheduleCorkResponse);
}

// MsgSubmitCorkRequest - sdk.Msg for submitting calls to Ethereum through the gravity bridge contract
message MsgSubmitCorkRequest {
// the cork to send across the bridge
Cork cork = 1;
// signer account address
string signer = 2;
}

message MsgSubmitCorkResponse {}

// MsgScheduleCorkRequest - sdk.Msg for scheduling a cork request for on or after a specific block height
message MsgScheduleCorkRequest {
// the scheduled cork
Cork cork = 1;
// the block height that must be reached
uint64 block_height = 2;
// signer account address
string signer = 3;
}

message MsgScheduleCorkResponse {}
2 changes: 1 addition & 1 deletion x/cork/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r

// RegisterInterfaces implements app module basic
func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
v1types.RegisterInterfaces(registry)
types.RegisterInterfaces(registry)
v1types.RegisterInterfaces(registry)
}

// AppModule implements an application module for the cork module.
Expand Down
46 changes: 22 additions & 24 deletions x/cork/types/v1/cork.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 28 additions & 28 deletions x/cork/types/v1/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1f5c6ce

Please sign in to comment.