-
Notifications
You must be signed in to change notification settings - Fork 355
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
Subkeys 2 #28
Conversation
Still need to 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.
Nice tests. I propose some cleanup of variables, maybe I just do that then merge
&initial_expirations, | ||
); | ||
|
||
// Check allowances work for accounts with 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.
Nice tests
|
||
// Add a third (new) admin | ||
let msg = HandleMsg::UpdateAdmins { | ||
admins: [&config.admins[..], &[admin3.clone()]].concat(), |
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 use of the spread and concat operators. But somehow, I would prefer to see this more explicit.
let new_admins = vec![owner.clone(), admin2.clone(), admin3.clone()]
let msg = HandleMsg::UpdateAdmins { admins: new_admins.clone() };
// ...
assert_eq!(config, ConfigResponse { admins: new_admins, mutable: true });
This is the exact same functionality you have written but easier to read. And key in test cases is legibility (performance is not an issue)
Going through this code again, not the PR, I notice there is no test for execute, that the allowances work as they are supposed to. |
I realized key execute tests were missing. Cannot approve yet
Yes. I'll write the |
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.
Almost there
e => panic!("unexpected error: {}", e), | ||
} | ||
|
||
// Owner / admins can do anything (at the contract level) |
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 test case.
Can you add another where the spender (with allowance) tries to send a message besides BankMsg::Send
. Anything else to show it fails.
Just one more test and this is 👍
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.
Will do.
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.
Looks good. Thanks for the fixes
Improved test cases after previous PR comments.
Added the two remaining test cases.