Skip to content

Commit

Permalink
Merge pull request #710 from neutron-org/feat/choose-cron-blocker-2
Browse files Browse the repository at this point in the history
Cron improvements
  • Loading branch information
pr0n00gler authored Sep 16, 2024
2 parents 5bea9ef + 6df5f6b commit be8f358
Show file tree
Hide file tree
Showing 30 changed files with 2,702 additions and 162 deletions.
2 changes: 2 additions & 0 deletions app/proposals_allowlisting.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ func isSdkMessageWhitelisted(msg sdk.Msg) bool {
*feeburnertypes.MsgUpdateParams,
*feerefundertypes.MsgUpdateParams,
*crontypes.MsgUpdateParams,
*crontypes.MsgAddSchedule,
*crontypes.MsgRemoveSchedule,
*contractmanagertypes.MsgUpdateParams,
*dextypes.MsgUpdateParams,
*banktypes.MsgUpdateParams,
Expand Down
2 changes: 1 addition & 1 deletion proto/neutron/cron/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "neutron/cron/schedule.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// GenesisState defines the cron module's genesis state.
// Defines the cron module's genesis state.
message GenesisState {
repeated Schedule scheduleList = 2 [(gogoproto.nullable) = false];
Params params = 1 [(gogoproto.nullable) = false];
Expand Down
2 changes: 1 addition & 1 deletion proto/neutron/cron/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Params defines the parameters for the module.
// Defines the parameters for the module.
message Params {
option (gogoproto.goproto_stringer) = false;
// Security address that can remove schedules
Expand Down
8 changes: 7 additions & 1 deletion proto/neutron/cron/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "neutron/cron/schedule.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Query defines the gRPC querier service.
// Defines the gRPC querier service.
service Query {
// Queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
Expand All @@ -30,25 +30,31 @@ service Query {
// this line is used by starport scaffolding # 2
}

// The request type for the Query/Params RPC method.
message QueryParamsRequest {}

// The response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false];
}

// The request type for the Query/Schedule RPC method.
message QueryGetScheduleRequest {
string name = 1;
}

// The response type for the Query/Params RPC method.
message QueryGetScheduleResponse {
Schedule schedule = 1 [(gogoproto.nullable) = false];
}

// The request type for the Query/Schedules RPC method.
message QuerySchedulesRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// The response type for the Query/Params RPC method.
message QuerySchedulesResponse {
repeated Schedule schedules = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
Expand Down
21 changes: 17 additions & 4 deletions proto/neutron/cron/schedule.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,38 @@ import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Defines when messages will be executed in the block
enum ExecutionStage {
// Execution at the end of the block
EXECUTION_STAGE_END_BLOCKER = 0;
// Execution at the beginning of the block
EXECUTION_STAGE_BEGIN_BLOCKER = 1;
}

// Defines the schedule for execution
message Schedule {
// Name of schedule
string name = 1;
// Period in blocks
uint64 period = 2;
// Msgs that will be executed every period amount of time
// Msgs that will be executed every certain number of blocks, specified in the `period` field
repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false];
// Last execution's block height
uint64 last_execute_height = 4;
// Stage when messages will be executed
ExecutionStage execution_stage = 5;
}

// Defines the contract and the message to pass
message MsgExecuteContract {
// Contract is the address of the smart contract
// The address of the smart contract
string contract = 1;
// Msg is json encoded message to be passed to the contract
// JSON encoded message to be passed to the contract
string msg = 2;
}

// Defines the number of current schedules
message ScheduleCount {
// Count is the number of current schedules
// The number of current schedules
int32 count = 1;
}
51 changes: 45 additions & 6 deletions proto/neutron/cron/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,72 @@ import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "neutron/cron/params.proto";
import "neutron/cron/schedule.proto";

// this line is used by starport scaffolding # proto/tx/import

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Msg defines the Msg service.
// Defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;

// Adds new schedule.
rpc AddSchedule(MsgAddSchedule) returns (MsgAddScheduleResponse);
// Removes schedule.
rpc RemoveSchedule(MsgRemoveSchedule) returns (MsgRemoveScheduleResponse);
// Updates the module parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

// The MsgAddSchedule request type.
message MsgAddSchedule {
option (amino.name) = "cron/MsgAddSchedule";
option (cosmos.msg.v1.signer) = "authority";

// The address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Name of the schedule
string name = 2;
// Period in blocks
uint64 period = 3;
// Msgs that will be executed every certain number of blocks, specified in the `period` field
repeated MsgExecuteContract msgs = 4 [(gogoproto.nullable) = false];
// Stage when messages will be executed
ExecutionStage execution_stage = 5;
}

// Defines the response structure for executing a MsgAddSchedule message.
message MsgAddScheduleResponse {}

// The MsgRemoveSchedule request type.
message MsgRemoveSchedule {
option (amino.name) = "cron/MsgRemoveSchedule";
option (cosmos.msg.v1.signer) = "authority";

// The address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Name of the schedule
string name = 2;
}

// Defines the response structure for executing a MsgRemoveSchedule message.
message MsgRemoveScheduleResponse {}

// this line is used by starport scaffolding # proto/tx/message

// MsgUpdateParams is the MsgUpdateParams request type.
// The MsgUpdateParams request type.
//
// Since: 0.47
message MsgUpdateParams {
option (amino.name) = "cron/MsgUpdateParams";
option (cosmos.msg.v1.signer) = "authority";

// Authority is the address of the governance account.
// The address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the x/cron parameters to update.
// Defines the x/cron parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [
Expand All @@ -40,8 +80,7 @@ message MsgUpdateParams {
];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
// Defines the response structure for executing a MsgUpdateParams message.
//
// Since: 0.47
message MsgUpdateParamsResponse {}
32 changes: 32 additions & 0 deletions proto/neutron/cron/v1/schedule.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";
package neutron.cron.v1;

import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types/v1";

// Defines the schedule for execution
message Schedule {
// Name of schedule
string name = 1;
// Period in blocks
uint64 period = 2;
// Msgs that will be executed every certain number of blocks, specified in the `period` field
repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false];
// Last execution's block height
uint64 last_execute_height = 4;
}

// Defines the contract and the message to pass
message MsgExecuteContract {
// The address of the smart contract
string contract = 1;
// JSON encoded message to be passed to the contract
string msg = 2;
}

// Defines the number of current schedules
message ScheduleCount {
// The number of current schedules
int32 count = 1;
}
44 changes: 44 additions & 0 deletions third_party/proto/ibc/core/client/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";

package ibc.core.client.v1;

option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types";

import "ibc/core/client/v1/client.proto";
import "gogoproto/gogo.proto";

// GenesisState defines the ibc client submodule's genesis state.
message GenesisState {
// client states with their corresponding identifiers
repeated IdentifiedClientState clients = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"];
// consensus states from each client
repeated ClientConsensusStates clients_consensus = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "ClientsConsensusStates"];
// metadata from each client
repeated IdentifiedGenesisMetadata clients_metadata = 3 [(gogoproto.nullable) = false];
Params params = 4 [(gogoproto.nullable) = false];
// Deprecated: create_localhost has been deprecated.
// The localhost client is automatically created at genesis.
bool create_localhost = 5 [deprecated = true];
// the sequence for the next generated client identifier
uint64 next_client_sequence = 6;
}

// GenesisMetadata defines the genesis type for metadata that clients may return
// with ExportMetadata
message GenesisMetadata {
option (gogoproto.goproto_getters) = false;

// store key of metadata without clientID-prefix
bytes key = 1;
// metadata value
bytes value = 2;
}

// IdentifiedGenesisMetadata has the client metadata with the corresponding
// client id.
message IdentifiedGenesisMetadata {
string client_id = 1;
repeated GenesisMetadata client_metadata = 2 [(gogoproto.nullable) = false];
}
39 changes: 39 additions & 0 deletions third_party/proto/ibc/core/commitment/v1/commitment.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
syntax = "proto3";

package ibc.core.commitment.v1;

option go_package = "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types";

import "gogoproto/gogo.proto";
import "cosmos/ics23/v1/proofs.proto";

// MerkleRoot defines a merkle root hash.
// In the Cosmos SDK, the AppHash of a block header becomes the root.
message MerkleRoot {
option (gogoproto.goproto_getters) = false;

bytes hash = 1;
}

// MerklePrefix is merkle path prefixed to the key.
// The constructed key from the Path and the key will be append(Path.KeyPath,
// append(Path.KeyPrefix, key...))
message MerklePrefix {
bytes key_prefix = 1;
}

// MerklePath is the path used to verify commitment proofs, which can be an
// arbitrary structured object (defined by a commitment type).
// MerklePath is represented from root-to-leaf
message MerklePath {
repeated string key_path = 1;
}

// MerkleProof is a wrapper type over a chain of CommitmentProofs.
// It demonstrates membership or non-membership for an element or set of
// elements, verifiable in conjunction with a known commitment root. Proofs
// should be succinct.
// MerkleProofs are ordered from leaf-to-root
message MerkleProof {
repeated cosmos.ics23.v1.CommitmentProof proofs = 1;
}
7 changes: 4 additions & 3 deletions wasmbinding/bindings/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ type ForceTransfer struct {

// AddSchedule adds new schedule to the cron module
type AddSchedule struct {
Name string `json:"name"`
Period uint64 `json:"period"`
Msgs []MsgExecuteContract `json:"msgs"`
Name string `json:"name"`
Period uint64 `json:"period"`
Msgs []MsgExecuteContract `json:"msgs"`
ExecutionStage string `json:"execution_stage"`
}

// AddScheduleResponse holds response AddSchedule
Expand Down
Loading

0 comments on commit be8f358

Please sign in to comment.