From d4997af3e89c576cf06c84e10ca31982a9222565 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 10 Jun 2024 10:04:12 +0200 Subject: [PATCH] add check --- x/gov/CHANGELOG.md | 1 + x/gov/proto/cosmos/gov/v1/gov.proto | 2 +- x/gov/types/v1/params.go | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/x/gov/CHANGELOG.md b/x/gov/CHANGELOG.md index eb792c01ed2b..e8c81fe3639e 100644 --- a/x/gov/CHANGELOG.md +++ b/x/gov/CHANGELOG.md @@ -55,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#18762](https://github.com/cosmos/cosmos-sdk/pull/18762) Add multiple choice proposals. * [#18856](https://github.com/cosmos/cosmos-sdk/pull/18856) Add `ProposalCancelMaxPeriod` parameters. * [#19167](https://github.com/cosmos/cosmos-sdk/pull/19167) Add `YesQuorum` parameter. +* [#20348](https://github.com/cosmos/cosmos-sdk/pull/20348) Limit gov exectution of proposals to a max gas limit. The limit was added to parameters and can be modified ### Client Breaking Changes diff --git a/x/gov/proto/cosmos/gov/v1/gov.proto b/x/gov/proto/cosmos/gov/v1/gov.proto index 0f1446023685..d6cb26ce8d30 100644 --- a/x/gov/proto/cosmos/gov/v1/gov.proto +++ b/x/gov/proto/cosmos/gov/v1/gov.proto @@ -344,7 +344,7 @@ message Params { // considered valid for an expedited proposal. string expedited_quorum = 21 [(cosmos_proto.scalar) = "cosmos.Dec", (cosmos_proto.field_added_in) = "x/gov v1.0.0"]; - uint64 proposal_execution_gas = 22 [(cosmos_proto.field_added_in) = "x/gov v1.0.0"]; + uint64 proposal_execution_gas = 22 [(cosmos_proto.field_added_in) = "x/gov v0.2.0"]; } // MessageBasedParams defines the parameters of specific messages in a proposal. diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index aa16eb0681c3..0bddd772fb3f 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -270,6 +270,10 @@ func (p Params) ValidateBasic(addressCodec address.Codec) error { } } + if p.ProposalExecutionGas == 0 { + return fmt.Errorf("proposal execution gas must be positive: %d", p.ProposalExecutionGas) + } + return nil }