-
Notifications
You must be signed in to change notification settings - Fork 340
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
feat(invariants): add several invariants across modules #1514
Conversation
// check module balance is equal | ||
moduleAcc := k.accountK.GetModuleAccount(ctx, types.ModuleName) | ||
balances := k.bankKeeper.GetAllBalances(ctx, moduleAcc.GetAddress()) | ||
if 1 < len(balances) { |
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.
nit: maybe len(balances) > 1
is better?
1 < len(balances)
broke my brain for a second haha
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.
haha the amount of times this style broke my brain also.. 🫠
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.
broskis
There is some research paper somewhere that says most people prefer the way I do 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.
don't you learn in school the numbers start with zero at the left and positive infinity to the right 😄
maybe hebrew is different
But you have no excuse @keruch
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 guess it's how you read it: left to right. Would you also say "two is less than how many apples I have"?
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.
Fair I guess peoples brains have a different preference, linguistic or spatial, when reading
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.
@danwt actually when i saw this if
, i also imagined a straight line with numbers increasing to the right. but anyway as Alex pointed out, the other way around sounds more natural (at least to me) when you "read" the code.
// check module balance is equal | ||
moduleAcc := k.accountK.GetModuleAccount(ctx, types.ModuleName) | ||
balances := k.bankKeeper.GetAllBalances(ctx, moduleAcc.GetAddress()) | ||
if 1 < len(balances) { |
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 guess it's how you read it: left to right. Would you also say "two is less than how many apples I have"?
Co-authored-by: zale144 <[email protected]>
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.
LGTM!
Co-authored-by: zale144 <[email protected]> (cherry picked from commit 3109e57)
Description
Adds hi prio invariants according to https://docs.google.com/spreadsheets/d/1uEvOizwu1RSLoUoQxdp5apVPo61QOKoQBOm4F5y0S9A/edit?gid=0#gid=0
Relevant for #1484
Closes #XXX
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.
PR review checkboxes:
I have...
Unreleased
section inCHANGELOG.md
godoc
commentsSDK Checklist
map
time.Now()
sendCoin
and notSendCoins
Full security checklist here
For Reviewer:
After reviewer approval: