Repository navigation
[Update] Check that each contribution is signed by a consortium member and unchanged since signing - #344
Merged
deanwampler merged 1 commit intoNov 25, 2026
Conversation
The base fingerprint a node declares is a plain field, so anyone can attach the right digest to any weights: a node outside the consortium, or someone changing a member's contribution on the way. Nothing ties the declaration to the sender or to the weights it comes with. A node can now sign a manifest naming its identity, the round, the base it trained from, a fingerprint of the contributed tensors, and the quality score and token count the merge weights depend on. Given a roster of member Ed25519 public keys, the validator and the gate reject a contribution that is unsigned, sent by a node outside the roster, signed with the wrong key, or whose weights, score, round or base differ from what was signed. Each case is its own finding. Without a roster nothing changes. A signature proves who made a claim, not that it is true, so a member that signs a false base declaration is still admitted, though the claim is now attributable to it. Key distribution and rotation are left to the central node work in The-AI-Alliance#114. Ed25519 comes from the cryptography package, added as a dependency. Refs The-AI-Alliance#273. Signed-off-by: Manisha Chand <chandmanisha00@gmail.com>
1 task done
Member
|
@build4me2 , it just occurred to me that the description for the PR would be great to add to the design docs, so it's not "lost" now that this PR is closed. Could you add this content to a new file under |
3 tasks done
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.
Description of the PR
Why. The contribution validator (the check that runs on each node's update before it is merged into the shared model) relies on the node to say which shared base it trained from. That statement is a plain field. Anyone can copy the right value onto any weights: a node outside the consortium, someone using a member's name, or someone changing a member's update on the way. The validator accepts all of these. This is the gap #273 describes.
What. Each node can now sign a short statement about its update: who it is, which round, which base it trained from, a fingerprint of its weights, and the quality score and token count that merge weights can depend on. Give the gate the members' public keys, and it admits an update only if a member signed it for this round and nothing changed afterwards. Each kind of failure gets its own finding in the round record. Without keys, nothing changes.
Please look closely: this touches authentication, and it adds a dependency (
cryptography) to the rootpyproject.toml.flowchart LR N[/"Node signs manifest<br/>id · round · base · weights · score"/]:::evidence G{"Signed by a member?<br/>Unchanged? This round?"}:::gate V["Existing checks<br/>shape · dtype · NaN · limits"]:::verify M["Outer merge"]:::weights R["Rejected, with a<br/>manifest-* finding"]:::dimensions N --> G G -->|yes| V --> M G -.->|no| R classDef evidence fill:#fff2cc,stroke:#d6b656,color:#5d4b00,stroke-width:2px classDef gate fill:#b23a48,stroke:#8e2e39,color:#fff,stroke-width:2px classDef verify fill:#ede7f6,stroke:#7b1fa2,color:#4a148c,stroke-width:2px classDef weights fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332,stroke-width:2px classDef dimensions fill:#fff,stroke:#546e7a,color:#263238,stroke-width:2pxWhat it does not do. A signature proves who made a claim, not that the claim is true. A member that trains from the wrong base and signs the correct value is still admitted, but the false claim now carries its signature. A test pins this behaviour, and the README says so.
Related Issues
If Code Changes Are Included
Description of Code Changes
pyproject.toml: addscryptography(Apache-2.0 or BSD-3-Clause) for Ed25519. The standard library cannot sign, and nothing in the repo provided it. I put it in the root project instead of giving the contrib its ownpyproject.toml, which would mean a second torch install. I can move it if you prefer.contrib/build4me2-contribution-validator/contribution_validator/manifest.py(new):ContributionManifest: the signed fields, with a canonical encoding (compact JSON, sorted keys, and a format tag so the signature cannot be reused for another message).sign_contribution()andSigningNode, for the node side.verify_manifest(), which returns findings. It stops at the first of: no manifest, unknown sender, or bad signature. After that it reports every signed field that differs.validator.py:ContributionValidatortakes optional keyword-onlymember_keysandround_num. With keys,validate()checks the manifest first, andvalidate_state()raises, because a raw state has no manifest.gate.py:ValidatingConsortiumCoordinatortakesmember_keysand passes it, with the current round, to each round's validator. A wrong key type fails at construction.findings.py: addsmanifest-missing,manifest-signer-unknown,manifest-signature-invalidandmanifest-mismatch(whosedetails["field"]names the field).README.md: a "Signed manifests" section, the four rows in the checks table, the tested guarantees, and the limitations.Of the 548 added lines, 193 are
manifest.py, 211 are its tests, and about 60 are the README.#273 says the format and algorithm need a decision. These are the choices made here, and I'm happy to change them:
Testing Performed
14 new tests in
tests/test_manifest.py(one per module, as the layout guide asks). They cover: a member's signed update is accepted; unsigned, unknown sender, impersonation, an edited manifest, weights or score changed after signing, and replay in a later round are each rejected with the expected finding; a manifest that cannot be encoded, or a non-tensor value, gives a finding instead of an exception; bad configuration fails early; in the gate, an impersonator is rejected and recorded in the summary while the other member merges.The example from [Code] Verify contribution manifests with signatures, not self-declared fingerprints #273 and related cases.
develophas no signatures, so there each row is the same contribution with only a declared fingerprint:developmanifest-missingmanifest-signature-invalidmanifest-signer-unknownmanifest-mismatchmanifest-mismatchThe existing 61 validator tests pass unchanged.
manifest.py,validator.pyandgate.pyare at 100% line coverage.make contribution-validator-demoruns.make before-prcompletes successfully on this commit in 3 of 4 runs. The other run failed two Hypothesis tests insrc/tests/tapestry/training/consortium/test_node.pythat exceeded their 200 ms deadline (261 ms and 380 ms). The same file fails the same way on cleandevelop(2 of 5 runs), and this PR changes nothing undersrc/.Example Usage
Checklist
For code changes:
make before-prcompletes successfully. (See the note on timing under Testing.)