change_operation stringclasses 3
values | faulty_code_source stringclasses 3
values | change_context stringclasses 3
values | quorum_constraints listlengths 4 4 | validation_outcome stringclasses 1
value | root_cause_analysis stringclasses 3
values | validation_code_source stringclasses 3
values | repair_consistency_assessment stringclasses 3
values | configuration_transition_summary stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|
成员移除 | def can_commit_removal(acks, old_voters, new_voters):
required = len(new_voters) // 2 + 1
return len(set(acks) & new_voters) >= required
| A five-voter configuration {a, b, c, d, e} is being reduced to {a, b, c}. The removal decision receives acknowledgements from only {a, b}; this is a majority of the proposed configuration but not of the currently active five-voter configuration. | [
"For a five-voter old configuration, at least three old voters must acknowledge the transition.",
"For a three-voter new configuration, at least two new voters must acknowledge the transition.",
"During joint transition, require both majorities rather than substituting the new quorum for the old quorum.",
"Do... | 未执行 | The faulty function uses only the proposed configuration's quorum to authorize the removal. Because the proposed set is smaller, two acknowledgements suffice even though the old configuration requires three. The new configuration is therefore allowed to authorize its own activation without the old configuration's requi... | import unittest
def can_commit_removal_fixed(acks, old_voters, new_voters):
acknowledgements = set(acks)
old_majority = len(old_voters) // 2 + 1
new_majority = len(new_voters) // 2 + 1
return (len(acknowledgements & old_voters) >= old_majority
and len(acknowledgements & new_voters) >= new_m... | Static review indicates that the candidate predicate preserves the old quorum requirement while also requiring the new quorum. The tests encode the premature-activation regression and a successful joint-quorum case, but they have not been executed. | The old configuration must remain part of the authorization rule while the change is in transition. The candidate predicate requires majorities of both old and new sets before the transition can be committed; only afterward can the new set govern subsequent decisions. |
成员加入 | def has_quorum(acks, voters, learners):
members = voters | learners
required = len(members) // 2 + 1
return len(set(acks) & members) >= required
| A new node d has joined as a learner and is not yet eligible to vote. The active voter set is {a, b, c}. If only a and b acknowledge a decision, they form a voter majority; an acknowledgement from d must not affect the quorum calculation. | [
"Compute the majority threshold from voting members only.",
"Count acknowledgements only from the active voter set.",
"A learner must not increase the quorum threshold or substitute for a voter.",
"Update the voter set only when the membership protocol commits the learner's promotion."
] | 未执行 | The faulty function merges learners into the voting set before computing both the threshold and the acknowledgements. This incorrectly raises the threshold from two to three and also allows a learner's acknowledgement to count toward that threshold. | import unittest
def has_quorum_fixed(acks, voters):
required = len(voters) // 2 + 1
return len(set(acks) & voters) >= required
class LearnerPromotionTests(unittest.TestCase):
def test_learner_does_not_increase_voting_threshold(self):
voters = {'a', 'b', 'c'}
learners = {'d'}
acknow... | Static review shows that the candidate function derives both the threshold and acknowledgement count solely from voters, so learner acknowledgements cannot change the result. The regression tests have not been run, and no runtime verification is claimed. | Adding a learner does not change the active voter configuration. The voter set remains {a, b, c} until an explicit promotion transition; only then may the new node participate in quorum calculations under the applicable configuration rules. |
联合共识 | def has_joint_quorum(acks, old_voters, new_voters):
required = max(len(old_voters) // 2 + 1, len(new_voters) // 2 + 1)
return len(set(acks) & (old_voters | new_voters)) >= required
| During a joint-consensus transition, the old voter set is {a, b, c} and the new voter set is {c, d, e, f, g}. Acknowledgements from {a, b, d} reach the larger of the two majority thresholds when counted across the union, but do not form a majority in the new configuration. | [
"Count acknowledgements from each configuration independently.",
"Require at least floor(|old_voters| / 2) + 1 acknowledgements from the old configuration.",
"Require at least floor(|new_voters| / 2) + 1 acknowledgements from the new configuration.",
"Do not finalize a transition based solely on a majority of... | 未执行 | The faulty predicate counts distinct acknowledgements across the union of both configurations and compares that total with only the larger majority threshold. Joint consensus requires a separate majority from each configuration; a large union count can conceal a shortage in one side. | import unittest
def has_joint_quorum_fixed(acks, old_voters, new_voters):
acknowledgements = set(acks)
old_majority = len(old_voters) // 2 + 1
new_majority = len(new_voters) // 2 + 1
return (len(acknowledgements & old_voters) >= old_majority
and len(acknowledgements & new_voters) >= new_maj... | Static review of the candidate predicate shows that it independently enforces both majorities, including when the sets overlap. The included regression tests have not been run, so runtime behavior is not claimed as verified. | The old and new voter sets remain jointly authoritative during the transition. A decision must satisfy both sets' quorum rules before the system can finalize the new configuration; the union must not be treated as a single voter set. |
Consensus Membership Change Code Verification Dataset
This dataset covers source code for member additions, removals, and configuration changes in distributed consensus systems. It focuses on quorum calculations, configuration state transitions, and joint consensus logic, pairing faulty code with code for reproducing issues or validating behavior. Structured scenario details support coding agent training for diagnosing membership-change failures and checking whether repairs preserve consistency constraints.
Technical Specifications
| Field | Type | Description |
|---|---|---|
| change_context | string | Input context and triggering conditions for a membership change, configuration transition, or joint consensus scenario. |
| change_operation | string | The operation represented in the code, such as adding or removing a member, changing a configuration, or using joint consensus. |
| faulty_code_source | string | Source code containing defects related to member additions, removals, or configuration changes. |
| quorum_constraints | array | Quorum calculation rules and consistency constraints that must be met during membership changes. |
| validation_outcome | string | Summary of validation execution results and whether the fix passes the relevant checks. |
| root_cause_analysis | string | Analysis of the underlying cause of a membership-change failure based on the faulty code and scenario. |
| validation_code_source | string | Test and validation code used to reproduce failures or assess fixes for membership changes. |
| repair_consistency_assessment | string | Assessment of whether the repair preserves correct configuration transitions, quorum requirements, and consistency constraints. |
| configuration_transition_summary | string | Summary of the relationship between the old, new, and intermediate configurations and the state transition process. |
Compliance Statement
| Authorization Type | CC-BY-NC-SA 4.0 (Attribution–NonCommercial–ShareAlike) |
| Commercial Use | Requires exclusive subscription or authorization contract (monthly or per-invocation charging) |
| Privacy and Anonymization | No PII, no real company names, simulated scenarios follow industry standards |
| Compliance System | Compliant with China's Data Security Law / EU GDPR / supports enterprise data access logs |
Source & Contact
- Downloads last month
- 21