Changes to support DKG resharing - #374
Open
hsaleemsupra wants to merge 2 commits into
Open
Conversation
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.
Move framework support for DKG resharing
Adds the on-chain layer for DKG resharing: restricting the dealer set of a resharing DKG to validators that hold prior key material, rejecting invalid resharing configs at proposal time, and exposing the view/accessor functions the node software and integration tests need.
Companion Rust-side changes (per-committee dealer opt-out, runner fixes, and the integration test suite) land separately in
smr-moonshot, which pins this revision.Problem
A dealer in a resharing DKG must hold secret shares from the last completed session — that is only true of validators that were receivers in that session. Without restriction, a newly joined validator gets selected as a dealer, has no prior share on disk, and the DKG degrades or stalls. Additionally, nothing prevented governance from enabling
is_resharingbefore any DKG had ever completed, which would abort deep insidereconfiguration_with_dkg::try_startat epoch transition instead of failing at proposal time.Changes
configs/dkg_config.moveERESHARING_WITHOUT_PRIOR_SESSION (3):set_for_next_epochnow rejects any config containingis_resharing = truewhensupra_dkg::last_completed_session()isNone. Checked once per proposal (only readsDKGStatewhen some receiver actually enables resharing).ERESHARING_FOR_NONEXISTENT_THRESHOLD_TYPE) is unchanged.test_set_for_next_epoch_resharing_without_prior_session_failsasserts thenew guard (abort code
196611=error::invalid_state(3)).reconfiguration_with_dkg.movetry_startnow branches on whether any receiver committee hasis_resharing = true:supra_dkg::last_completed_receivers_addresses()(see below), via new private helperfilter_consensus_infos_by_addresses(preserves input order — committee indexing is positional).ENO_PRIOR_DKG_FOR_RESHARING (1)— unreachable in practice because of the proposal-time guard above; protects against state corruption only.supra_dkg.movelast_completed_receivers_addresses(): Option<vector<address>>— the intersection of member addresses across all receiver committees of the last completed session. Intersection because the framework builds a single dealer committee that must satisfy every reshared committee's prior-data requirement simultaneously (today all receiver committees share membership, so this equals any one of them; the intersection future-proofs divergent configs).#[view] last_completed_threshold_pubkeys(): vector<vector<u8>>— returns(threshold_type || pubkey_bytes)per receiver committee of the last completed session. Used by integration tests to assert the resharing invariant (threshold pubkey preserved across reshares).#[test_only] setup_fake_last_completed_session_for_test(...)so downstream module tests can satisfy the proposal-time guard without running a real DKG.dkg_committee.moveget_is_resharing(&ReceiverCommittee): boolandget_receiver_dkg_committee(&ReceiverCommittee): &DkgCommitteefor the two modules above.doc/*.mdDesign decisions
stake::cur_validator_consensus_infos(), avoiding staledkg_pubkeys after mid-epoch key rotation.leave_validator_setstayspending_inactiveuntilon_new_epoch(leaving is blocked during reconfiguration), so it still appears incur_validator_consensus_infos()for the duration of the DKG.set_for_next_epochrather than halting the epoch transition later.Testing
dkg_config.movecover the new guard (positive + expected-failure paths).