You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR title type suggestion: This PR is missing a conventional commit type prefix. Since it's fixing source code to resolve a test flakiness issue, the type should be fix:
Suggested title: fix: resolve flaky test in running state
Fixes a flaky test (process_new_parameters_proposal__should_accept_empty_per_domain_overlay) in crates/contract/src/state/running.rs. The test was signing with state.parameters.participants()[0], but gen_valid_params_proposal keeps only a random subset of current participants (size [threshold, current_n]), so participant [0] could be absent from the proposal — causing AuthenticatedAccountId::new(proposal.participants()) inside process_new_parameters_proposal to fail with NotParticipant. The fix picks a signer present in both the current and proposed sets.
Changes:
In the should_accept_empty_per_domain_overlay test, replace the unconditional participants()[0] signer with one selected from the proposal that is also a current participant.
Adds a clear comment explaining the overlap-set requirement.
Reviewed changes
Per-file summary
File
Description
crates/contract/src/state/running.rs
Pick a signer in proposal ∩ current_participants so AuthenticatedAccountId::new always succeeds; previously used current_participants[0] which may not be in the random subset retained by gen_valid_params_proposal.
Findings
I verified:
gen_valid_params_proposal keeps n_old_participants ∈ [current_k, current_n] of the existing participants, and gen_threshold_params enforces k ≥ 2, so the retained overlap is non-empty and the .expect(...) is unreachable in practice.
The sibling tests that did not need fixing (should_reject_overlay_with_unknown_domain_id, should_apply_overlay_to_threshold_validation) hit overlay/threshold validation in process_new_parameters_proposalbefore the AuthenticatedAccountId::new signer check, so they are correctly unaffected by the same randomness.
No blocking issues.
Non-blocking (nits, optional):
crates/contract/src/state/running.rs:561 — minor: iter().map(...).find(...) could be iter().find_map(|(account_id, _, _)| ...) to avoid the eager clone() on every candidate before the predicate. Not worth a re-spin on its own.
✅ Approved
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
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.
Fixing a flaky test.
[Description to be added]