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

Add unpin code flag to store code proposal #979

Merged

Conversation

jhernandezb
Copy link
Contributor

@jhernandezb jhernandezb commented Sep 5, 2022

This should close #972 if you think it makes sense to have it as part of a governance proposal.

@jhernandezb jhernandezb requested a review from alpe as a code owner September 5, 2022 16:35
@codecov
Copy link

codecov bot commented Sep 5, 2022

Codecov Report

Merging #979 (352e408) into main (1fdd378) will decrease coverage by 0.03%.
The diff coverage is 28.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #979      +/-   ##
==========================================
- Coverage   59.36%   59.32%   -0.04%     
==========================================
  Files          51       51              
  Lines        6231     6238       +7     
==========================================
+ Hits         3699     3701       +2     
- Misses       2266     2271       +5     
  Partials      266      266              
Impacted Files Coverage Δ
x/wasm/client/cli/gov_tx.go 0.00% <0.00%> (ø)
x/wasm/client/cli/tx.go 25.00% <ø> (ø)
x/wasm/keeper/proposal_handler.go 68.00% <100.00%> (+0.43%) ⬆️

Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Looks good. Only real comment is on the default.

x/wasm/client/cli/gov_tx.go Outdated Show resolved Hide resolved
@alpe alpe changed the title add pin code flag to store code proposal Add pin code flag to store code proposal Sep 6, 2022
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! 🏅
Please change the proto field name and cli/ gov handler accordingly to complete this.

x/wasm/keeper/proposal_integration_test.go Outdated Show resolved Hide resolved
proto/cosmwasm/wasm/v1/proposal.proto Outdated Show resolved Hide resolved
@@ -68,7 +68,10 @@ func handleStoreCodeProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types
if err != nil {
return err
}
return k.PinCode(ctx, codeID)
if p.PinCode {
Copy link
Contributor

Choose a reason for hiding this comment

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

This would become if !p.Unpinned (or similar name)

Copy link
Contributor Author

@jhernandezb jhernandezb Sep 6, 2022

Choose a reason for hiding this comment

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

switched to early return instead

        // if code should not be pinned return earlier
	if p.UnpinCode {
		return nil
	}

I think it has better readability, double negation logic confuses me a bit personally 😅 but I can change it if there is a preference.

@ethanfrey
Copy link
Member

If you can get this fixed up by Wednesday, happy to include this in the v0.29 release.
We want to cut by end of the week.
Otherwise, it will come in v0.30.0

@jhernandezb jhernandezb changed the title Add pin code flag to store code proposal Add unpin code flag to store code proposal Sep 6, 2022
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Minor issue in the rest client.
Otherwise, this looks great and ready to merge.

Please adjust those fields and mention me

x/wasm/client/rest/gov.go Outdated Show resolved Hide resolved
@jhernandezb jhernandezb requested review from alpe and ethanfrey and removed request for alpe and ethanfrey September 6, 2022 14:19
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Looking good

x/wasm/client/rest/gov.go Show resolved Hide resolved
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.

🏇 Awesome

@ethanfrey ethanfrey merged commit f430ca3 into CosmWasm:main Sep 6, 2022
@ethanfrey ethanfrey added this to the v0.29.0 milestone Sep 6, 2022
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.

Make contract pinning an optional field in StoreCode proposals
3 participants