Rework weight_consensus onto contract Backend protocol - #1667
Closed
LandynDev wants to merge 1 commit into
Closed
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.
Part of repo-registration phase 2a (task 2a-4). Stacked on #1666 (python client) — merge order #1665 -> #1666 -> this.
Re-lands the consensus core from the closed commitments-based attempt (#1651's successor branch) reworked onto an injected Backend protocol with the repos-v0 contract as transport:
backend.py—ConsensusBackendprotocol: fetch_registry / fetch_baskets / fetch_own_basket / publish_basket / fetch_stakes_and_permits (spec S4; metagraph reads behind the same protocol per S5)contract_backend.py—ContractBackendoverRepoRegistryContractClient; snapshot block number resolves to a block hash once and every childstate read pins to it (S1 — closes the reorg gap the spec calls out), publish viaset_basketsigned by hotkey (S3)consensus.py— cherry-picked verbatim except the input seam: structured baskets +validate_prefsreplace bytes +decode_prefs(R3: second decode site is now validate-only)codec.py—canonicalize_prefskept verbatim (R4); zlib wire format, SCALE payload walker,CONSENSUS_MAX_PAYLOAD_BYTES,CONSENSUS_FRESH_WINDOW_BLOCKSdeletedchain.py(commitments transport) deleted;mirror_sync.pyNOT re-landed — mirror reconciliation moved to das-github-mirror fix: repo names #229; validator has zero mirror-write responsibilities,MirrorClientstays read-onlyneurons/validator.py— consensus manager init is failure-safe: missing contract address or init error degrades to baked weights, never blocks startupapply_consensus, postgres storage unchanged per specDecisions flagged for review (details in code):
Tests: +67 (golden aggregation vectors, fallback ladder via FakeBackend, pinned-hash propagation, validate-only decode, publisher edges); full suite 1104 passed; ruff clean.