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

Made admin field optional in MsgInstantiateContract #115

Merged

Conversation

jstuczyn
Copy link
Contributor

@jstuczyn jstuczyn commented Aug 4, 2021

I've run into my own omission from the previous pull request - as the comment suggests, the admin field should be optional.

Comment on lines +177 to +181
let admin = if proto.admin.is_empty() {
None
} else {
Some(proto.admin.parse())
};
Copy link
Member

Choose a reason for hiding this comment

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

Any reason you didn't write this as...

Suggested change
let admin = if proto.admin.is_empty() {
None
} else {
Some(proto.admin.parse())
};
let admin = proto.admin.map(|admin| admin.parse());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, didn't think of it at the time, good catch! I've applied the suggestion in the next commit and moved it directly to field assignment to keep it all more compact.

Copy link
Member

Choose a reason for hiding this comment

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

Oh whoops, now I see why: it's a String, and you do want the original behavior. My bad.

Unfortunately we don't really have a good helper for that either. The closest thing is probably tendermint_proto::serializers::optional_from_str, although I wouldn't suggest using that.

Mind reverting? Sorry again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely. I'm also sorry for not properly checking the suggestion myself. I forgot to pass features=cosmwasm and assumed it was all fine...

@jstuczyn jstuczyn force-pushed the jstuczyn/bugfix/optional-cosmwasm-admin branch from 4f72f7e to 20d9b10 Compare August 4, 2021 14:34
@tony-iqlusion tony-iqlusion merged commit ba012bd into cosmos:main Aug 4, 2021
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.

2 participants