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

Modify check for no guardians & add tests #15

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

JohnGuilding
Copy link
Collaborator

@JohnGuilding JohnGuilding commented Jul 1, 2024

Builds upon changes slightly from ca7d21c and adds tests

  1. Only calls setupGuardians if guardians.length, weights.length, and threshold are all 0. It felt appropriate that no guardian weights should be passed in if the guardians themselves are not known. And passing the threshold also felt like it could be redundant without knowledge of guardian count and weights. The logic added in commit ca7d21c failed when running a test with no guardians passed in because of conflicting checks in setupGuardians. Permitting weight and threshold also be zero and adding the check in configureRecovery keeps the setupGuardian function simple.

  2. Adds guardianConfig.initialized checks in existing tests

  3. Adds tests for new logic in configureRecovery.t.sol

@JohnGuilding JohnGuilding marked this pull request as ready for review July 1, 2024 19:20
@JohnGuilding JohnGuilding requested a review from SoraSuegami July 1, 2024 20:25
@@ -49,7 +49,7 @@ library GuardianUtils {
revert IncorrectNumberOfWeights();
}

if (threshold == 0 && guardianCount > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You removed && guardianCount > 0 because setupGuardians will be never called in configureRecovery when no guardian is set, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes exactly

@JohnGuilding JohnGuilding merged commit b36a78d into main Jul 2, 2024
3 checks passed
@JohnGuilding JohnGuilding deleted the feat/test-configuration-with-no-guardians branch July 2, 2024 10:25
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