-
Notifications
You must be signed in to change notification settings - Fork 409
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 msg update contract label #1640
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1640 +/- ##
==========================================
- Coverage 56.03% 55.96% -0.07%
==========================================
Files 64 64
Lines 8996 9062 +66
==========================================
+ Hits 5041 5072 +31
- Misses 3514 3546 +32
- Partials 441 444 +3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. 🎸
Only minor nits. Feel free to merge when you are happy with the code.
I would add the backport label to the PR but the backport will need some work from you, too
@@ -157,3 +157,31 @@ func UpdateInstantiateConfigCmd() *cobra.Command { | |||
flags.AddTxFlagsToCmd(cmd) | |||
return cmd | |||
} | |||
|
|||
// UpdateContractLabelCmd sets an new label for a contract | |||
func UpdateContractLabelCmd() *cobra.Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
types.EventTypeUpdateContractLabel, | ||
sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), | ||
sdk.NewAttribute(types.AttributeKeyNewLabel, newLabel), | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
"update label - gov policy": { | ||
newLabel: "new label", | ||
policy: GovAuthorizationPolicy{}, | ||
caller: example.CreatorAddr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you use a random caller address, then it would ensure the different behaviour of the gov policy
assert.Equal(t, exp, attrsToStringMap(em.Events()[0].Attributes)) | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good tests! For bonus points, there is also the unknown contract address scenario that must not panic.
return nil, err | ||
} | ||
|
||
return &types.MsgUpdateContractLabelResponse{}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
straight forward 👍
addr: myAddress.String(), | ||
expErr: false, | ||
}, | ||
"other address cannot update contract label": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 good to have the scenarios covered but there is some overlap with the keeper tests.
The integration tests give more confidence on the whole process. If you see value in both, then we can keep them.
addr: otherAddr.String(), | ||
expErr: true, | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check for invalid data
} | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test!
@@ -79,6 +80,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { | |||
&MsgAddCodeUploadParamsAddresses{}, | |||
&MsgRemoveCodeUploadParamsAddresses{}, | |||
&MsgStoreAndMigrateContract{}, | |||
&MsgUpdateContractLabel{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important!
expErr: true, | ||
}, | ||
} | ||
for msg, spec := range specs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellet!
* Add msg update contract label * fix tests (cherry picked from commit e654808) # Conflicts: # x/wasm/keeper/keeper.go # x/wasm/types/tx.pb.go
* Add msg update contract label (#1640) * Add msg update contract label * fix tests (cherry picked from commit e654808) # Conflicts: # x/wasm/keeper/keeper.go # x/wasm/types/tx.pb.go * Fix conflicts --------- Co-authored-by: pinosu <95283998+pinosu@users.noreply.github.com> Co-authored-by: Pino' Surace <pino.surace@live.it>
Resolves #1601