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

Use gov v1 instead of v1beta1 for new proposals #1269

Merged
merged 13 commits into from
Mar 30, 2023
Merged

Conversation

pinosu
Copy link
Contributor

@pinosu pinosu commented Mar 16, 2023

Part of #1246

With this PR, the v1beta1 wasm proposal types are removed from CLI and types and methods are deprecated.
In-flight proposals can still be executed but no new ones added.

In order to make use of the new gov v1 types, you can use the new wizard wasmd tx gov draft-proposal to create a template.

Update:

The proposal template generator is not really a good fit with for wasm proposals due to their more complex fields. We will follow up on this

Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good start. This is not a trivial task 👍

proto/cosmwasm/wasm/v1/proposal.proto Show resolved Hide resolved
proto/cosmwasm/wasm/v1/tx.proto Outdated Show resolved Hide resolved
proto/cosmwasm/wasm/v1/tx.proto Show resolved Hide resolved
proto/cosmwasm/wasm/v1/tx.proto Outdated Show resolved Hide resolved
proto/cosmwasm/wasm/v1/tx.proto Outdated Show resolved Hide resolved
proto/cosmwasm/wasm/v1/tx.proto Outdated Show resolved Hide resolved
proto/cosmwasm/wasm/v1/tx.proto Outdated Show resolved Hide resolved
x/wasm/simulation/proposals.go Outdated Show resolved Hide resolved
x/wasm/simulation/proposals.go Outdated Show resolved Hide resolved
@faddat
Copy link
Contributor

faddat commented Mar 17, 2023

Very good start. This is not a trivial task 👍

Indeed, @alpe is right, this is absolutely not a trivial task. Thanks for taking this on.

Base automatically changed from develop_sdk47 to main March 20, 2023 09:32
@pinosu pinosu force-pushed the deprecate_proposal_types branch from 3c1bd4e to a6d571b Compare March 20, 2023 21:48
Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! I added some minor ones.
Looking forward to see the integration with the keeper for the gov process

x/wasm/types/tx.go Show resolved Hide resolved
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
return errorsmod.Wrap(err, "authority")
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ValidateVerificationInfo(p.Source, p.Builder, p.CodeHash) as in StoreAndInstantiateContractProposal for optional fields

x/wasm/types/tx.go Outdated Show resolved Hide resolved
x/wasm/keeper/msg_server.go Outdated Show resolved Hide resolved
x/wasm/keeper/msg_server.go Outdated Show resolved Hide resolved
@pinosu pinosu changed the title [WIP] Deprecate proposal types Deprecate proposal types Mar 22, 2023
@pinosu pinosu marked this pull request as ready for review March 22, 2023 09:37
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #1269 (b58c320) into main (7e936c7) will increase coverage by 3.98%.
The diff coverage is 54.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1269      +/-   ##
==========================================
+ Coverage   59.49%   63.47%   +3.98%     
==========================================
  Files          57       56       -1     
  Lines        7320     6971     -349     
==========================================
+ Hits         4355     4425      +70     
+ Misses       2652     2218     -434     
- Partials      313      328      +15     
Impacted Files Coverage Δ
app/app.go 86.27% <ø> (ø)
x/wasm/client/cli/new_tx.go 0.00% <0.00%> (ø)
x/wasm/client/cli/tx.go 10.49% <0.00%> (-2.77%) ⬇️
x/wasm/keeper/proposal_handler.go 64.82% <ø> (ø)
x/wasm/module.go 39.02% <0.00%> (ø)
x/wasm/types/tx.go 46.52% <47.72%> (+1.62%) ⬆️
x/wasm/keeper/msg_server.go 60.97% <67.04%> (+35.59%) ⬆️
x/wasm/types/codec.go 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@pinosu pinosu marked this pull request as draft March 22, 2023 13:17
@pinosu pinosu marked this pull request as ready for review March 27, 2023 09:22
Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work! Thanks for driving this forward. 🥇

I have added some minor nits and comments. Almost good to go 👏

}, nil
}

func (m msgServer) selectAuthorizationPolicy(actor string) AuthorizationPolicy {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -44,6 +44,7 @@ const (
flagMaxFunds = "max-funds"
flagAllowAllMsgs = "allow-all-messages"
flagNoTokenTransfer = "no-token-transfer" //nolint:gosec
flagAuthority = "authority"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this flag is unused now and can be removed

govclient.NewProposalHandler(cli.ProposalStoreAndInstantiateContractCmd),
govclient.NewProposalHandler(cli.ProposalInstantiateContract2Cmd),
}
var ProposalHandlers = []govclient.ProposalHandler{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's get rid of this, too.

@@ -20,6 +20,8 @@ func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.Prop
}

// NewWasmProposalHandlerX creates a new governance Handler for wasm proposals
//
//nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add Deprecated annotation here and NewWasmProposalHandler to mark this

@@ -63,6 +65,7 @@ func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []t
}
}

//nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -38,6 +38,7 @@ const (

// WasmKeeper is a subset of the wasm keeper used by simulations
type WasmKeeper interface {
GetAuthority() string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

&MsgSudoContract{},
&MsgPinCodes{},
&MsgUnpinCodes{},
&MsgStoreAndInstantiateContract{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

cdc.RegisterConcrete(&MsgSudoContract{}, "wasm/MsgSudoContract", nil)
cdc.RegisterConcrete(&MsgPinCodes{}, "wasm/MsgPinCodes", nil)
cdc.RegisterConcrete(&MsgUnpinCodes{}, "wasm/MsgUnpinCodes", nil)
cdc.RegisterConcrete(&MsgStoreAndInstantiateContract{}, "wasm/MsgStoreAndInstantiateContract", nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 still required

}
})
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice to see all these tests! This will give high confidence that things work as expected. Thanks for taking care!

Can you add a test for UpdateInstantiateConfig so that we have this covered, too?

@@ -60,65 +57,3 @@ func TestParseAccessConfigFlags(t *testing.T) {
})
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for the new messages ValidateBasic for regression?

  • MsgUpdateParams
  • MsgPinCodes
  • MsgUnpinCodes
  • MsgSudoContract
  • MsgStoreAndInstantiateContract

@alpe alpe changed the title Deprecate proposal types Use gov v1 instead of v1beta1 for new proposals Mar 29, 2023
@pinosu pinosu merged commit 674eceb into main Mar 30, 2023
alpe added a commit that referenced this pull request Mar 31, 2023
* main:
  Bump bufbuild/buf-setup-action from 1.15.1 to 1.16.0
  Use gov v1 instead of v1beta1 for new proposals (#1269)
  Update OnRecvPacket method to panic when an error is returned (#1298)
  Bump actions/checkout from 3.4.0 to 3.5.0
  Add source for Wasm magic number
@alpe alpe deleted the deprecate_proposal_types branch May 10, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants