Sample: Align isOperator and CanOperatorPass checks - #8159
Merged
Amaury Chamayou (achamayou) merged 2 commits intoAug 14, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an authorization/counting mismatch in the sample operator constitution by ensuring that “operator-only” proposals cannot add a member flagged as an operator while also assigning them a recovery (encryption) public key, which would otherwise exclude them from operator counting and allow vote-inflation.
Changes:
- Tighten
canOperatorPass()forset_memberso it only treats adding/setting an operator as “operator-passable” whenencryption_pub_keyis not provided (== null). - Aligns the
canOperatorPasseligibility criteria withisOperator()’s “operators cannot be recovery members” rule.
Custom instructions used:
.github/copilot-instructions.md.github/instructions/reviewing.instructions.md
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Amaury Chamayou (achamayou)
approved these changes
Aug 14, 2026
Eddy Ashton (eddyashton)
approved these changes
Aug 14, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In the sample constitution it was possible for an operator to add a new operator with a recovery key.
Specifically
isOperator == !has_recovery_key && data.is_operatorwhilecanOperatorPass == data.is_operator.Thus an operator could add an operator who has a recovery key, which is fine for canOperatorPass, but is not an operator for membership counting reasons.
So an operator could use this to add N+1 'operator recovery members' and hence pass their own ballots.
This PR aligns these two constraints.
To clarify this just fixes up a sample, not anything which is released.