-
Notifications
You must be signed in to change notification settings - Fork 99
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 DistributionQuery::DelegatorWithdrawAddress
#442
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I just realize in cosmwasm (Rust) this should be
Addr
instead ofString
because we get a checked value from wasmd here.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.
In that case we cannot have the
Default
derive for theDelegatorWithdrawAddressResponse
and therefore also not theQueryResponseType
impl. Is that alright? I think we need to add a constructor function then, if we want to mock it in multi-test.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.
Uff, yeah, this problem again. We hit the exact same case with
ContractInfoResponse
. In essence: in normale cases a contract never constructs this and just consumes it. Just for testing frameworks we need a constructor outside of cosmwasm-std which means we need to either haveDefault
or give up#[non_exhaustive]
. Having Default allows constructing invalid instances. I don't like this situation but don't have a solution.Happy for any solution suggestion to this general problem but let's not block the release on it.
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.
I suppose in this case we could just drop the
non_exhaustive
, as I do not think another field will be added to this response in particular.I have some ideas on how to solve this in general:
#[doc(hidden)]
. This has similar drawbacks as theDefault
impl, except that we can demand parameters and clearly mark it as not for "normal" usage.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.
The second option means a non-stable constructor which I guess is fine. The other option between the two is a stable constructor which sets the newly added fields to some default value.
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.
Yes, a non-stable constructor or default values if the added fields allow for one, but realistically non-stable constructor should be fine if we hide it and clearly document it to be non-stable.
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.
Could you add those constructors for all query responses? Then we can remove Default here and make it Addr. I think we should favour the production use case over test framework convenience. And having a validated Addr save a call into the chain.