Open
Conversation
…t tracking and aggregator bond management
… from RoundTrainerRegistry
…y-related functions
…stryV2, enhancing privacy commitment tracking and aggregator bond management
Mick00
reviewed
Dec 19, 2025
Collaborator
Mick00
left a comment
There was a problem hiding this comment.
Thanks for this contribution, it is a really interesting feature!
If I am not mistaken, I think the only thing missing would be an end to end round test.
Then we can merge this PR and start working on the integration with the Python side of things
Updated: - SwarmV2.sol: Renamed public function - SwarmV2.t.sol: Updated test calls - FullCyclePrivacy.t.sol: Updated test call
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.
Privacy-Enhanced Trainer Commitments (Swarm V2 Upgrade)
Highlights
Contract Changes
forge/src/swarm/registry/RoundTrainerRegistryV2.solReplaces the simple trainer registry with namespaced storage for both trainer metadata and privacy commitments.
Implements
_commitTrainerPrivacy,_revealTrainerPrivacy,_slashTrainerCommitment, bond accounting, and configuration setters.Exposes read helpers for trainer info, bond state, pending commitment counts, and privacy configuration.
forge/src/swarm/SwarmV2.solExtends Swarm by inheriting the new
RoundTrainerRegistryV2with commitment lifecycle helpers.Adds aggregator-only APIs:
registerRoundContributionPrivacy,revealTrainerCommitment,slashTrainerCommitment,configureTrainerPrivacy, bond deposit/withdraw, and a privacy-mode toggle.Guards evaluator assignments and reward calculations to include pending commitments so tasks scale with unrevealed trainers.
forge/src/swarm/SwarmV2Factory.solScripts & Demo Assets
forge/test/training/DemoParams.sol,forge/test/training/FullCyclePrivacy.t.sol) now orchestrates a privacy-enabled round: commitments, evaluator registration, reveals, deliberate missed reveal, slashing, and reward distribution.Tests
forge/test/swarm/SwarmV2.t.solforge/test/swarm/registry/RoundTrainerRegistryV2.t.solforge/test/training/FullCyclePrivacy.t.solTesting Guidance
forge test --match-contract SwarmV2Testforge test --match-contract RoundTrainerRegistryTestforge test --match-contract FullCyclePrivacy