Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add msgs per tx to proposals #365

Merged
merged 5 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
cosmossdk.io/math v1.0.0-beta.4
github.com/CosmWasm/wasmd v0.29.2
github.com/client9/misspell v0.3.4
github.com/cometbft/cometbft-db v0.7.0
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.11
github.com/cosmos/ibc-go/v5 v5.2.0
Expand Down Expand Up @@ -56,7 +57,6 @@ require (
github.com/butuzov/ireturn v0.1.1 // indirect
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.10.1 // indirect
github.com/denis-tingaikin/go-header v0.4.3 // indirect
Expand Down Expand Up @@ -288,7 +288,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/subosito/gotenv v1.4.2 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.5.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions proto/quicksilver/interchainstaking/v1/proposals.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ message RegisterZoneProposal {
[ (gogoproto.moretags) = "yaml:\"account_prefix\"" ];
bool multi_send = 7;
bool liquidity_module = 8;
int64 messages_per_tx = 9;
}

message RegisterZoneProposalWithDeposit {
Expand All @@ -40,6 +41,7 @@ message RegisterZoneProposalWithDeposit {
bool liquidity_module = 8
[ (gogoproto.moretags) = "yaml:\"liquidity_module\"" ];
string deposit = 9 [ (gogoproto.moretags) = "yaml:\"deposit\"" ];
int64 messages_per_tx = 10;
}

message UpdateZoneProposal {
Expand Down
5 changes: 5 additions & 0 deletions x/interchainstaking/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Where proposal.json contains:
"account_prefix": "cosmos",
"multi_send": true,
"liquidity_module": false,
"messages_per_tx": "5",
"deposit": "512000000uqck"
}
`),
Expand All @@ -163,6 +164,10 @@ Where proposal.json contains:
return err
}

if proposal.MessagesPerTx < 1 {
return errors.New("messages_per_tx must be a positive non-zero integer")
}

deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit)
if err != nil {
return err
Expand Down
10 changes: 10 additions & 0 deletions x/interchainstaking/keeper/proposal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ func HandleUpdateZoneProposal(ctx sdk.Context, k Keeper, p *types.UpdateZoneProp
}
zone.LiquidityModule = boolValue

case "messages_per_tx":
intVal, err := strconv.Atoi(change.Value)
if err != nil {
return err
}
if intVal < 1 {
return errors.New("invalid value for messages_per_tx")
}
zone.MessagesPerTx = int64(intVal)

case "connection_id":
if !strings.HasPrefix(change.Value, "connection-") {
return errors.New("unexpected connection format")
Expand Down
8 changes: 7 additions & 1 deletion x/interchainstaking/types/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ func (m RegisterZoneProposal) ValidateBasic() error {
return errors.New("account prefix must be at least 2 characters") // ki is shortest to date.
}

// validate messages_per_tx
if m.MessagesPerTx < 1 {
return errors.New("messages_per_tx must be a positive non-zero integer")
}

joe-bowman marked this conversation as resolved.
Show resolved Hide resolved
if m.LiquidityModule {
return errors.New("liquidity module is unsupported")
}
Expand All @@ -71,7 +76,8 @@ func (m RegisterZoneProposal) String() string {
Local Denom: %s
Multi Send Enabled: %t
Liquidity Staking Module Enabled: %t
`, m.Title, m.Description, m.ConnectionId, m.BaseDenom, m.LocalDenom, m.MultiSend, m.LiquidityModule)
Messages per Tx: %d
`, m.Title, m.Description, m.ConnectionId, m.BaseDenom, m.LocalDenom, m.MultiSend, m.LiquidityModule, m.MessagesPerTx)
}

func NewUpdateZoneProposal(title string, description string, chainID string, changes []*UpdateZoneValue) *UpdateZoneProposal {
Expand Down
164 changes: 111 additions & 53 deletions x/interchainstaking/types/proposals.pb.go

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