-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
refactor(gov)!: use collections for Proposal state management (part 1) #16171
Conversation
suite.Require().Nil(err) | ||
suite.Require().Equal(proposal, gotProposal) | ||
} | ||
} | ||
|
||
// TODO(tip): remove this |
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.
to remove
@@ -18,6 +14,7 @@ import ( | |||
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" | |||
) | |||
|
|||
// TODO(tip): remove this |
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.
to remove
@@ -60,11 +60,8 @@ func (keeper Keeper) IterateDeposits(ctx context.Context, proposalID uint64, cb | |||
// Activates voting period when appropriate and returns true in that case, else returns false. | |||
func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) { | |||
// Checks to see if proposal exists | |||
proposal, err := keeper.GetProposal(ctx, proposalID) | |||
proposal, err := keeper.Proposals.Get(ctx, proposalID) | |||
if err != 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.
Do you think it isn't necessary to do a check of collections.ErrNotFound
for keeping the same behavior?
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 think we can use the ErrNotFound
of collections which is more descriptive and standardized. This breaks consensus but it does not break state compatibility so I think it should be fine, it also allowed us to remove some errors from gov which I think are a little overkill.
If you think this is not good I can revert the changes in a PR.
Description
Partially Closes: #16172
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change