Repository navigation
History
Showing
with
554 additions
and 295 deletions.
- +36 −16 Aggregator.md
- +44 −17 Auditor.md
- +33 −19 Client.md
- +19 −15 DIN-CLI.md
- +21 −51 DIN-DAO.md
- +5 −3 DIN-Daemon.md
- +5 −3 DIN-Indexer.md
- +9 −4 DIN-Node.md
- +87 −25 DIN-Representative.md
- +4 −2 DIN-SDK.md
- +2 −0 Home.md
- +13 −3 IPFS-Layer.md
- +62 −29 Model-Owner.md
- +13 −9 Overview.md
- +97 −47 Platform-Contracts.md
- +93 −44 Task-Contracts.md
- +7 −4 Worker-Node.md
- +4 −4 _Sidebar.md
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,67 @@ | ||
| # Aggregator | ||
|
|
||
| > 🚧 **This wiki describes DevNet 2.0, soon to be launched.** It follows the contracts and `dincli` on the [`develop`](https://github.com/InfiniteZeroFoundation/DevNet/tree/develop) branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: [#102](https://github.com/InfiniteZeroFoundation/DevNet/discussions/102). | ||
| Aggregators do the network's **model building**. They are staked validators who combine the auditor-approved local models into the new global model at the end of each [Global Iteration](Task-Contracts#the-global-iteration-lifecycle). [Auditors](Auditor) decide *what goes in*; aggregators produce *what comes out*. | ||
|
|
||
| Like auditors, they have skin in the game: DIN tokens staked in [`DinValidatorStake`](Platform-Contracts#dinvalidatorstake), which can be slashed if they miss assigned work or submit a result that disagrees with their peers. In return they earn a share of every GI's reward pool. | ||
|
|
||
| ## Becoming an aggregator | ||
|
|
||
| ```bash | ||
| dincli aggregator dintoken buy <amount_eth> # exchange ETH for DIN | ||
| dincli aggregator dintoken stake <amount> # approve and stake in one command | ||
| dincli aggregator register <model_id> # register for the current GI (window must be open) | ||
| ``` | ||
|
|
||
| Staking is done once and topped up as needed. Each stake call is at least 10 DIN, and exiting has a default 7-day unbonding period. Registration is **per model, per Global Iteration**, and only while the aggregator registration window is open. The same conditions as for auditors apply: | ||
| - you must be an active validator; | ||
| - your stake must meet the model's stake floor; | ||
| - you need room under the concurrent-registration cap; | ||
| - at most 300 aggregators can register per GI. | ||
|
|
||
| ## The job: two-tier aggregation | ||
|
|
||
| Once evaluation closes, a future-block seed is locked (anyone can do it: `dincli aggregator lock-seed <model_id>`). The registered aggregators and approved local models are then shuffled into batches: | ||
|
|
||
| - **Tier 1 (T1).** Approved models are split into sub-batches of 3 (the last batch may have 2), and each sub-batch is assigned to 3 aggregators. Each aggregator independently combines its batch's models by running the model owner's aggregation function in a sandboxed [Worker Node](Worker-Node). | ||
| - **Tier 2 (T2).** A single final batch of the **next 3 shuffled aggregators** combines the finalized T1 outputs into the **new global model**, which seeds the next GI. | ||
|
|
||
| Every submission is **commit-then-reveal**: | ||
| - **Commit.** The aggregator first commits a hash of its result CID, bound to its address, the GI, the tier and the batch. | ||
| - **Reveal.** After the model owner opens the reveal phase, it reveals the CID, using the same `dincli` cache it committed from. | ||
|
|
||
| No CID is visible while commits are open, so a late aggregator can't copy an earlier one. | ||
|
|
||
| ```bash | ||
| dincli aggregator show-t1-batches <model_id> --detailed # see your T1 assignment | ||
| dincli aggregator aggregate-t1 <model_id> --submit # aggregate and commit | ||
| dincli aggregator reveal-t1 <model_id> # after the owner opens T1 reveals | ||
| dincli aggregator show-t2-batches <model_id> --detailed # if assigned to the final tier | ||
| dincli aggregator aggregate-t2 <model_id> --submit | ||
| dincli aggregator reveal-t2 <model_id> | ||
| ``` | ||
|
|
||
| **Honesty is enforced by redundancy.** Every aggregator in a batch runs the same deterministic computation, so the same inputs give the same output and the same CID. The batch's final CID is the one **revealed most often**, and at least 2 of the 3 must reveal. An aggregator who computes correctly lands in the majority. One who deviates, whether lazily, faultily or maliciously, produces a lone CID that loses. | ||
|
|
||
| ## Rewards | ||
|
|
||
| When the GI ends, **15% of its reward pool** is shared among aggregators. Every assigned aggregator of each finalized batch gets one unit. Rewards are pulled on-chain: call `claimReward(gi)`, then `claimRewards()`, on the model's `DINTaskAuditor`. `dincli` doesn't have a claim command yet. | ||
|
|
||
| ## What gets an aggregator slashed | ||
|
|
||
| At the end of the GI, the model owner triggers slashing. The model's `DINTaskCoordinator` slashes aggregators who: | ||
|
|
||
| - **missed their submission:** they were assigned a T1 or T2 batch but didn't reveal, including committing without ever revealing. This is a partial slash, 30% of the minimum stake by default (S2), and repeat offences escalate under S5 to a full slash plus a jail period. | ||
| - **revealed a losing CID:** their result disagreed with the batch's winning CID. This is a full minimum-stake slash. | ||
|
|
||
| **Aggregation disputes (S4).** Within a window after a batch is finalized, any active validator can post a 100 DIN bond and dispute the result. The model owner adjudicates, and a confirmed dispute slashes the aggregators who produced the bad result. | ||
|
|
||
| Slashes reach stake in the unbonding queue too. | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [Aggregator command reference](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/roles/aggregators.md) | ||
| - [Task Contracts](Task-Contracts): batch formation, commit-reveal, CID voting and finalization on-chain | ||
| - [Platform Contracts](Platform-Contracts): staking, unbonding and slashing mechanics | ||
| - [Auditor](Auditor): the validator role upstream, deciding which models reach aggregation |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,73 @@ | ||
| # Auditor | ||
|
|
||
| > 🚧 **This wiki describes DevNet 2.0, soon to be launched.** It follows the contracts and `dincli` on the [`develop`](https://github.com/InfiniteZeroFoundation/DevNet/tree/develop) branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: [#102](https://github.com/InfiniteZeroFoundation/DevNet/discussions/102). | ||
| Auditors are the network's **quality control**. They are staked validators who evaluate the local models that [Clients](Client) submit, and decide by score and vote which contributions are good enough to enter the global model. Without them, one poisoned submission could corrupt the model everyone shares. The audit phase is what makes open participation safe. | ||
|
|
||
| Like [Aggregators](Aggregator), auditors have skin in the game. They stake DIN tokens in [`DinValidatorStake`](Platform-Contracts#dinvalidatorstake), and failing to vote on an assigned batch is punished by slashing that stake. In return they earn a share of every GI's reward pool. | ||
|
|
||
| ## Becoming an auditor | ||
|
|
||
| ```bash | ||
| dincli auditor dintoken buy <amount_eth> # exchange ETH for DIN | ||
| dincli auditor dintoken stake <amount> # approve and stake in one command | ||
| dincli auditor register <model_id> # register for the current GI (window must be open) | ||
| ``` | ||
|
|
||
| You stake once and top up as needed: each stake call needs at least 10 DIN, and exiting takes a 7-day unbonding period by default. Registration is **per model, per Global Iteration**, and only while the model owner has the auditor registration window open. To register, you must: | ||
| - be an active validator; | ||
| - meet the model's stake floor, if it has one; | ||
| - have room under the concurrent-registration cap; | ||
| - register before the GI's 300-auditor cap is reached. | ||
|
|
||
| **Encryption key.** Audit test data is encrypted to each auditor. So an auditor needs an X25519 key pair: the public key registered on `DinValidatorStake` (`registerEncryptionKey`), and the private key at `auditor_x25519.key` in the `dincli` config directory. `dincli` doesn't yet have a command to register the key. If an assigned auditor has no key, the owner can't assign test data to that batch. | ||
|
|
||
| ## The job: evaluate a batch | ||
|
|
||
| After the LMS phase closes, a future-block seed is locked (anyone can do it: `dincli auditor lock-seed <model_id>`), and the model owner shuffles the submitted local models into **audit batches** of 3 auditors × 3 models. For each batch the owner publishes the test dataset encrypted, with a key for each of the batch's auditors. | ||
|
|
||
| For each model in the batch, the auditor: | ||
|
|
||
| 1. fetches the local model and the encrypted test data from IPFS, decrypts its key, and checks the owner's signature on the dataset; | ||
| 2. runs the model owner's scoring function against the test data, in a sandboxed [Worker Node](Worker-Node); | ||
| 3. **commits** on-chain a hash of its **score (0–100)** and **eligibility vote**, bound to its address and the slot; | ||
| 4. after the model owner opens the reveal phase, **reveals** the score and vote. | ||
|
|
||
| ```bash | ||
| dincli auditor lms-evaluation show-batch <model_id> # see your assignment | ||
| dincli auditor lms-evaluation evaluate <model_id> --submit # evaluate and commit | ||
| dincli auditor lms-evaluation reveal <model_id> # after the owner opens reveals | ||
| ``` | ||
|
|
||
| `evaluate --submit` saves the salt locally before sending each commit. Rerunning it skips models you have already committed, so your saved reveal data stays valid. | ||
|
|
||
| A local model is **approved for aggregation** when at least 2 of its batch's auditors have revealed, at least 2 voted it eligible, and its **median** score meets the GI's pass score. Several independent auditors per model means no single auditor decides anything, and every vote is visible on-chain once revealed. | ||
|
|
||
| ## Rewards | ||
|
|
||
| When the GI ends, **20% of its reward pool** is shared among auditors in proportion to how many votes each revealed. Rewards are pulled on-chain with `claimReward(gi)`, then `claimRewards()`, on the model's `DINTaskAuditor`. There is no `dincli` claim command yet. | ||
|
|
||
| ## What gets an auditor slashed | ||
|
|
||
| The model's `DINTaskAuditor` carries out auditor slashing itself, when the model owner triggers it at the end of the GI: | ||
|
|
||
| - **Missed vote (S1).** You registered and were assigned a batch, but didn't reveal a vote. This includes committing and never revealing. The penalty is a partial slash, 30% of the minimum stake by default. Repeat offences escalate under S5 to a full slash plus a jail period. | ||
| - **Score deviation (S3).** Scoring far from your batch's median is designed as a full slash, but it ships **disabled** (shadow mode) on DevNet 2.0. | ||
|
|
||
| Slashes reach stake in the unbonding queue too, so exiting doesn't dodge a penalty. | ||
|
|
||
| ## Disputing bad test data | ||
|
|
||
| If the test data for your batch can't be decrypted or doesn't match the owner's commitment, any auditor of that batch can open a **test-data dispute** by posting a 100 DIN bond, before the GI's rewards are settled. The owner then has about one day to reveal the dataset key. | ||
|
|
||
| - **The key checks out:** the bond is forfeited. | ||
| - **It doesn't, or the owner stays silent:** the dispute is upheld. The bond is returned, the owner forfeits 25% of the GI reward pool (unless the GI settled in the meantime), and the batch is reassigned. | ||
|
|
||
| There's no `dincli` command for disputes yet. | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [Auditor command reference](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/roles/auditors.md) | ||
| - [Task Contracts](Task-Contracts): `DINTaskAuditor`, where batches, scores, approval and rewards live | ||
| - [Platform Contracts](Platform-Contracts): staking, unbonding and slashing mechanics | ||
| - [Aggregator](Aggregator): the other validator role, downstream of the auditors' verdict |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,51 @@ | ||
| # Client | ||
|
|
||
| > 🚧 **This wiki describes DevNet 2.0, soon to be launched.** It follows the contracts and `dincli` on the [`develop`](https://github.com/InfiniteZeroFoundation/DevNet/tree/develop) branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: [#102](https://github.com/InfiniteZeroFoundation/DevNet/discussions/102). | ||
| Clients (model trainees) are the network's data holders, and the reason DIN exists. They train the current global model on their **own private data** and contribute only the resulting local model. The raw data never leaves their device. That is the protocol's founding constraint, not a feature flag. | ||
|
|
||
| Unlike [Auditors](Auditor) and [Aggregators](Aggregator), clients are not staked validators: participating needs only a wallet and a dataset. Quality control comes from the other side: auditors score every submitted local model before it can enter aggregation. Clients whose models are approved earn the largest share of each round's rewards. | ||
|
|
||
| ## How a contribution works | ||
|
|
||
| In each [Global Iteration](Task-Contracts#the-global-iteration-lifecycle), while the Local Model Submission (LMS) window is open: | ||
|
|
||
| 1. **Fetch.** `dincli` downloads the current global model (the genesis model in GI 1) and the model's training service code from IPFS, by CID. | ||
| 2. **Train locally.** The model owner's `client.py` training function runs on the client's dataset inside a sandboxed [Worker Node](Worker-Node) container. | ||
| 3. **Submit.** The trained local model is uploaded to IPFS and its CID is recorded on-chain in `DINTaskAuditor`. Each client gets one submission per GI. | ||
| 4. **Get audited.** Auditors score the submission against encrypted test data. It is approved and aggregated into the next global model if at least 2 auditors vote it eligible and its median score meets the GI's pass score. | ||
|
|
||
| ```bash | ||
| dincli client create-client-dataset-dir <model_id> # creates the expected dataset folder | ||
| dincli client train-lms <model_id> # train locally | ||
| dincli client submit-lm <model_id> # upload and record on-chain | ||
| dincli client lms show-models <model_id> # verify it landed | ||
| ``` | ||
|
|
||
| The client's dataset goes at the path `dincli` expects: `<CACHE_DIR>/<network>/model_<model_id>/dataset/clients/<address>/data.pt`. The model owner defines the required format, preprocessing and training hyperparameters **for each model**, in the model's client instructions. For the reference MNIST-style model, the dataset is a list of `(tensor, label)` tuples ([full spec](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/guides/client-onboarding.md)). | ||
|
|
||
| ## Rewards | ||
|
|
||
| When the GI ends, **60% of its reward pool** goes to clients, shared in proportion to the median score of each approved local model. Rewards are pulled on-chain: call `claimReward(gi)` on the model's `DINTaskAuditor`, then `claimRewards()` to withdraw. `dincli` doesn't have a claim command yet. | ||
|
|
||
| ## What protects the client | ||
|
|
||
| Trust runs in both directions here, and both directions are enforced mechanically: | ||
|
|
||
| - **The network never sees the data.** Only trained weights are submitted, as IPFS CIDs. A model can also enable **differential privacy** in its manifest's `dp` block. By default it adds calibrated noise after training (`post_training_gaussian`), so even the submitted weights reveal less. | ||
| - **The client never trusts the model owner's code.** The training function is the model owner's Python, so it runs in the [Worker Node](Worker-Node) sandbox: no network access, capped resources, no wallet or secrets. It can't exfiltrate the data it trains on. | ||
|
|
||
| ## What protects the network from a client | ||
|
|
||
| A malicious client can submit garbage or poisoned weights, which is exactly what the audit phase is for: | ||
| - Every submission is scored by several independent staked auditors against held-out test data. | ||
| - It needs an eligibility majority **and** a passing median score. | ||
| - Anything below the threshold never reaches aggregation, and earns nothing. | ||
| - Submissions are capped at one per client per GI, which keeps spam bounded. | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [Client command reference](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/roles/clients.md): commands, dataset path and workflow | ||
| - [Client instructions (reference model)](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/guides/client-onboarding.md): dataset format and hyperparameters for the MNIST-style example | ||
| - [Task Contracts](Task-Contracts): where LMS, evaluation and rewards live on-chain | ||
| - [Auditor](Auditor): the role that scores client submissions |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,35 @@ | ||
| # DIN DAO | ||
|
|
||
| > 🚧 **This wiki describes DevNet 2.0, soon to be launched.** It follows the contracts and `dincli` on the [`develop`](https://github.com/InfiniteZeroFoundation/DevNet/tree/develop) branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: [#102](https://github.com/InfiniteZeroFoundation/DevNet/discussions/102). | ||
| > ⏸️ **Status: deferred to post-mainnet.** Design decision [DD-3](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Developer/design/DESIGN_DECISIONS.md) (resolved 2026-08-04) moved all DIN-DAO work out of active scope, Stages A through D. That includes the earlier work on [PR #27](https://github.com/InfiniteZeroFoundation/DevNet/pull/27) and [issue #23](https://github.com/InfiniteZeroFoundation/DevNet/issues/23). DevNet 2.0 launches **without** on-chain governance. This page records the long-term direction, not a schedule. | ||
| ## How DIN is governed today | ||
|
|
||
| During DevNet 2.0, governance runs **off-chain**, following Ethereum's model: team coordination and public discussion (forums and GitHub discussions, the equivalent of All Core Devs calls). No multisig sits between the community and protocol changes. | ||
|
|
||
| - The [DIN-Representative](DIN-Representative) holds a single admin key and is the `owner()` of the [Platform Contracts](Platform-Contracts). It uses that key for fee parameters, model admission, slasher authorization, blacklisting and contract upgrades. | ||
| - The CLI commands for this role are `dincli dinrep …`. There is no `dincli dindao`. | ||
| - If a multisig is used in the near term, it is a plain Safe for **treasury funds only**, never for protocol roles. | ||
| - The contracts' owner-controlled setters are simply how the protocol is run for now. They are not a stepping stone to a particular on-chain design. | ||
|
|
||
| ## The long-term direction | ||
|
|
||
| DIN is a protocol with shared rules, incentives and security assumptions. As long as those rules sit behind one admin key, participants must trust the operator: economic policy can change unilaterally, and blacklist, slashing and upgrade authority are a standing centralization risk. A DAO doesn't remove governance risk, but it makes authority **transparent, rule-bound, auditable and contestable**. | ||
|
|
||
| When governance work resumes after mainnet, the [governance design doc](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Developer/issues/decentralized-governance.md) is the starting point. It explored: | ||
|
|
||
| - **Multisig and timelock.** These would replace single-key admin actions with N-of-M approval, and make every governance action visible on-chain before it runs, with a window to cancel it. | ||
| - **Governance staking.** Voting power would come from **locked DIN** (non-transferable, measured at a snapshot, delegable), not from raw wallet balances. | ||
| - **Governor.** On-chain proposals, voting, quorum and execution. | ||
| - **Guardian.** A narrow emergency path whose actions expire unless normal governance ratifies them. | ||
|
|
||
| The design doc also recommends against raw quadratic voting, because transferable tokens make Sybil-splitting trivial, and against free-balance voting. How voting power is measured (DD-1, DD-2) is still an **open, deferred decision**. | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [Design decisions](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Developer/design/DESIGN_DECISIONS.md): DD-1, DD-2 and DD-3, with the reasoning behind the deferral | ||
| - [Governance design doc](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Developer/issues/decentralized-governance.md): governance domains, the rationale for voting power, and the proposal lifecycle | ||
| - [DIN-Representative guide](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/roles/dinrep.md): the admin surface as it exists today | ||
| - [DIN-Representative](DIN-Representative): the role holding that authority | ||
| - [Platform Contracts](Platform-Contracts): the contracts a future DAO would govern |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,118 @@ | ||
| # DIN-Representative | ||
|
|
||
| > 🚧 **This wiki describes DevNet 2.0, soon to be launched.** It follows the contracts and `dincli` on the [`develop`](https://github.com/InfiniteZeroFoundation/DevNet/tree/develop) branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: [#102](https://github.com/InfiniteZeroFoundation/DevNet/discussions/102). | ||
| The DIN-Representative is the network's **governance and admission authority**: the entity that operates the [Platform Contracts](Platform-Contracts) on behalf of the protocol. Today it is a single admin key, held by a trusted representative of the InfiniteZero Foundation, and it is the `owner()` of the platform contracts. On-chain DIN-DAO governance is **deferred to post-mainnet**. Until then, governance happens off-chain (see [DIN DAO](DIN-DAO)). | ||
|
|
||
| The role's philosophy: the DIN-Representative controls **who and what enters the network** and never touches the training itself. Model owners run their models, validators stake and work, and clients keep their data. The Representative guards the perimeter. | ||
|
|
||
| Its commands live under **`dincli dinrep`**. | ||
|
|
||
| ## Responsibilities | ||
|
|
||
| ### Platform deployment | ||
|
|
||
| The Representative deploys the seven platform contracts (`DinTreasury`, `DinToken`, `DinFeeRouter`, `DinCoordinator`, `DinValidatorStake`, `DINModelRegistry`, `DinEmission`), each behind an OpenZeppelin Transparent Proxy, with the Foundry script `foundry/script/DeployPlatform.s.sol`. The script deploys, initializes and wires everything in 22 transactions, then writes the addresses to `foundry/deployments/<network>.json`. That file is then imported into `dincli`: | ||
|
|
||
| ```bash | ||
| cd foundry && npm ci && forge clean | ||
| forge script script/DeployPlatform.s.sol --rpc-url <rpc> --broadcast --account <keystore> --sender <din_rep_address> | ||
| cd .. && dincli --network <network> system import-deployments | ||
| ``` | ||
|
|
||
| The deploying address becomes the owner of every platform contract and every ProxyAdmin. A native `dincli dinrep deploy` is planned but not implemented. | ||
|
|
||
| ### Protocol parameters | ||
|
|
||
| The Representative administers the platform's economic settings. Most are owner calls on the contracts, with no `dincli` command yet: | ||
|
|
||
| - **DIN supply:** | ||
| - `dinPerEth`, the ETH → DIN purchase rate (default 1,000,000 DIN per ETH); | ||
| - `mintCap`, the total supply cap (0 = uncapped); | ||
| - `retireFaucet()`, which permanently ends both minting paths (one-way). | ||
| - **Staking:** the minimum stake, the unbonding period, and the S5 repeat-offence settings on `DinValidatorStake`. | ||
| - **Fee routing:** the `DinFeeRouter` splits and its fee-source allowlist. | ||
| - **Emission:** the `DinEmission` schedule (initial per-GI emission, decay, epoch length, max epochs). | ||
|
|
||
| ### Slasher authorization: the gate before the gate | ||
|
|
||
| Before any model can even request registration, its [Task Contracts](Task-Contracts) must be authorized as slashers on `DinValidatorStake`. The model owner asks off-chain (Discord, Telegram or email). The Representative **reviews before authorizing**: | ||
|
|
||
| - both contracts were deployed by the stated model-owner address; | ||
| - the coordinator implements the expected interface and references the correct stake contract; | ||
| - the auditor contract is correctly linked to the coordinator; | ||
| - there is no malicious or unauthorized slashing logic. | ||
|
|
||
| Only then does the Representative authorize them: | ||
|
|
||
| ```bash | ||
| dincli dinrep add-slasher --taskCoordinator # or --taskAuditor, or --contract <address> | ||
| ``` | ||
|
|
||
| This review is what stops an arbitrary contract from gaining the power to slash validators' stakes. | ||
|
|
||
| ### Model and manifest admission | ||
|
|
||
| Every model registration and every manifest update is a **request the Representative approves or rejects**: | ||
|
|
||
| ```bash | ||
| dincli dinrep registry list-pending-requests [-t model|manifest] | ||
| dincli dinrep registry explore-request -t model <requestId> | ||
| dincli dinrep registry approve-registration-request <requestId> | ||
| dincli dinrep registry reject-registration-request <requestId> | ||
| dincli dinrep registry approve-manifest-update <requestId> | ||
| dincli dinrep registry reject-manifest-update <requestId> | ||
| dincli dinrep registry total-models | ||
| ``` | ||
|
|
||
| Approval re-validates the task contracts at execution time. If they have lost slasher status or changed owner since the request, the approval reverts. Fees are kept whether a request is approved or rejected, which protects against spam. | ||
|
|
||
| ### Disabling a model | ||
|
|
||
| ```bash | ||
| dincli dinrep registry disable-model <modelId> | ||
| dincli dinrep registry enable-model <modelId> | ||
| ``` | ||
|
|
||
| Disabling blocks new manifest update requests and approvals for the model. Nothing is deleted, on-chain history is preserved, and the model can be re-enabled. The task contracts **don't read** this flag, so disabling a model does not stop its running GIs, submissions or slashing. | ||
|
|
||
| ### Fees | ||
|
|
||
| The four registry fees (open-source and proprietary, for registration and for updates) can be set individually or atomically in one transaction: | ||
|
|
||
| ```bash | ||
| dincli dinrep registry set-open-source-fee <eth> # also: set-proprietary-fee, set-open-source-update-fee, set-proprietary-update-fee | ||
| dincli dinrep registry set-fees --open-source <eth> --proprietary <eth> --open-source-update <eth> --proprietary-update <eth> | ||
| ``` | ||
|
|
||
| Collected ETH stays where it was received until the Representative **sweeps it to `DinFeeRouter`**. There is no `withdraw()`: | ||
|
|
||
| ```bash | ||
| dincli dinrep registry sweep-fees # registration and manifest-update fees | ||
| dincli dinrep coordinator sweep-fees # ETH received from DIN purchases (depositAndMint) | ||
| ``` | ||
|
|
||
| The router splits each sweep. With the default split (95% validator pool, 5% treasury), only the treasury share reaches `DinTreasury` today. The rest stays in the router until the contracts that will consume it ship. | ||
|
|
||
| ### Validator discipline | ||
|
|
||
| Beyond the automated per-GI slashing that task contracts carry out, the Representative can **blacklist** a validator address directly on `DinValidatorStake`, which blocks staking, exits and withdrawal claims, and can unblacklist it. | ||
|
|
||
| ## What the Representative cannot do | ||
|
|
||
| Some limits are worth stating explicitly: | ||
|
|
||
| - **It cannot slash arbitrarily.** Only authorized task contracts slash, by their on-chain rules. The Representative authorizes contracts, not individual penalties. | ||
| - **It cannot mint DIN directly.** DIN is minted only through `DinCoordinator.depositAndMint()` (ETH deposits at the published rate) and `mintEmission()` (called only by `DinEmission` on its schedule). Both are bounded by `mintCap` and end for good at `retireFaucet()`. The Representative's control over supply is limited to setting those parameters. | ||
| - **It cannot touch training data or artifacts.** Data never leaves clients' devices, and models live on IPFS under CIDs recorded by the participants' own submissions. | ||
|
|
||
| ## Ownership and the path forward | ||
|
|
||
| There is no single `set-admin` switch. Each platform contract changes owner with OpenZeppelin `transferOwnership`, and each of the seven ProxyAdmins has its own owner. On-chain governance (the [DIN DAO](DIN-DAO)) is deferred to post-mainnet under design decision DD-3. Until then the owner-controlled setters are how the protocol is run, and any near-term multisig would hold treasury funds only, not protocol roles. Contact channels for model onboarding are listed in the [Model Workflow](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/workflows/model-workflow.md#official-contact-channels). | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [DIN-Representative guide](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/roles/dinrep.md): every `dincli dinrep` command, plus the local and Optimism Sepolia deploy flows | ||
| - [DeployPlatform script reference](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/foundry/script/DeployPlatform.md): the tokenomics keys and their defaults | ||
| - [Platform Contracts](Platform-Contracts): the contracts this role deploys and administers | ||
| - [Model Owner](Model-Owner): the counterpart role in the admission flow |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,80 +1,130 @@ | ||
| # Platform Contracts | ||
|
|
||
| > 🚧 **This wiki describes DevNet 2.0, soon to be launched.** It follows the contracts and `dincli` on the [`develop`](https://github.com/InfiniteZeroFoundation/DevNet/tree/develop) branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: [#102](https://github.com/InfiniteZeroFoundation/DevNet/discussions/102). | ||
| The platform contracts are the foundation of the DIN Protocol. They are seven Solidity contracts, deployed **once per network** by the [DIN-Representative](DIN-Representative), and every model, validator and client on the network builds on them. The live DevNet runs on **Optimism Sepolia** (chainId 11155420). | ||
|
|
||
| They are distinct from the [Task Contracts](Task-Contracts), which each model owner deploys **per model**. | ||
|
|
||
| Each platform contract sits behind an OpenZeppelin **Transparent Proxy** with its own ProxyAdmin, so it can be upgraded without changing its address. The deployer, normally the DIN-Representative key, becomes the `owner()` of all seven contracts and all seven ProxyAdmins. | ||
|
|
||
| ``` | ||
| DIN-Representative (owner of all seven) | ||
| ETH ──depositAndMint──► DinCoordinator ──mint──► DinToken | ||
| │ ▲ │ | ||
| authorizes │ │ └──ETH sweep──┐ | ||
| slashers │ mintEmission ▼ | ||
| ▼ │ DinFeeRouter ──treasury share──► DinTreasury | ||
| DinValidatorStake DinEmission ▲ | ||
| ▲ (funds GI │ ETH sweep | ||
| slash() │ reward pools) │ | ||
| │ DINModelRegistry ◄── model owners | ||
| Task contracts (per model) (requests + fees) | ||
| ``` | ||
|
|
||
| ## DinCoordinator | ||
|
|
||
| The protocol's entry point, minting gateway and slasher registry. It does **not** hold the treasury. | ||
|
|
||
| - **Buying DIN.** Anyone can call `depositAndMint()` with ETH and receive newly minted DIN at the current rate, `dinPerEth` (default **1 ETH → 1,000,000 DIN**). This is a one-way faucet: there is no redeem path back to ETH. The intent is for a DEX to take over price discovery later. | ||
| - **Emission gateway.** `mintEmission()` is the only other way DIN is minted. Only the configured `DinEmission` contract can call it. | ||
| - **Supply guards.** Both minting paths respect `mintCap` (0 means uncapped) and stop permanently once the owner calls `retireFaucet()`, which is one-way. | ||
| - **Fees.** ETH received from DIN purchases stays in the coordinator until the DIN-Representative sweeps it to `DinFeeRouter` (`sweepFeesToRouter`, or `dincli dinrep coordinator sweep-fees`). There is no `withdraw()`. | ||
| - **Slasher management.** It is the only address allowed to add or remove slasher contracts on `DinValidatorStake`. This is how the DIN-Representative authorizes a model's task contracts to slash misbehaving validators. | ||
|
|
||
| Owner-only settings: `updateDinPerEth`, `setMintCap`, `retireFaucet`, `setEmissionContract`, `setFeeRouter` and `updateValidatorStakeContract`. | ||
|
|
||
| ## DinToken | ||
|
|
||
| The network's ERC-20 utility token: **"DIN Token"**, symbol **DIN**, 18 decimals, no pre-mint. | ||
|
|
||
| - **Minting** is restricted to `DinCoordinator`. The owner binds the coordinator once, with `setCoordinator`, during deployment. | ||
| - **Burning:** any holder can `burn()` their own tokens. The protocol burns DIN too, for example half of every slash. | ||
|
|
||
| DIN is the staking, slashing and reward currency. Validators buy it with ETH and lock it in `DinValidatorStake`. Models fund their per-GI reward pools in DIN. | ||
|
|
||
| ## DinValidatorStake | ||
|
|
||
| The staking ledger for validators (auditors and aggregators). It holds staked DIN, tracks each validator's lifecycle, and lets authorized slasher contracts penalize misbehaviour. | ||
|
|
||
| - **Minimum stake.** Each `stake()` must be at least `minStake` (default **10 DIN**, owner-settable). A validator can work only while `Active`. A model can also set a higher per-model stake floor. | ||
| - **Unbonding.** Unstaking starts an unbonding period (default **7 days**, owner-settable) before funds can be claimed. Pending withdrawals **remain slashable** until claimed, so a validator can't dodge a penalty by exiting. | ||
| - **Slashing.** Only registered slasher contracts (a model's `DINTaskCoordinator` and `DINTaskAuditor`) can slash. Of every slash, **50% is burned and 50% goes to the slash treasury**. | ||
| - **Repeat offences (S5).** Liveness faults (missed votes or submissions) are partial slashes. A validator who repeats them within the S5 window gets a full `minStake` slash and is **jailed** (default 7 days), after which it can reactivate. | ||
| - **Blacklisting.** The owner can blacklist a validator address, which blocks staking, exits and withdrawal claims. | ||
| - **Encryption keys.** Auditors register an X25519 public key here (`registerEncryptionKey`), so model owners can send them encrypted test data. | ||
|
|
||
| Validator status moves through `None → Active → Exiting`, plus `Jailed` and `Blacklisted`. If active stake falls below the minimum, the validator stops being `Active`. | ||
|
|
||
| ## DINModelRegistry | ||
|
|
||
| The governed admission gateway for models. Every model on the network is registered here and gets a unique ID. Admission works by **request and approval**: | ||
|
|
||
| - **Two-phase registration.** The model owner submits a registration request. The DIN-Representative reviews it and approves or rejects it. Only approved models receive an ID. | ||
| - **Two-phase manifest updates.** Changing a model's manifest CID, which can change its training logic and parameters, follows the same request and approval flow. | ||
| - **Prerequisite.** The model's `DINTaskCoordinator` and `DINTaskAuditor` must already be slashers on `DinValidatorStake`. Approval checks this again at execution time. | ||
| - **Two model types.** | ||
| - **Open-source models:** anyone may use the trained model freely. | ||
| - **Proprietary models:** the trained model belongs to the owner and can be used commercially. Their fees are higher. | ||
| - **Fees.** Small ETH fees are charged per request and kept whether the request is approved or rejected. The DIN-Representative sets them and sweeps the collected ETH to `DinFeeRouter`: | ||
|
|
||
| | Fee | Open-source | Proprietary | | ||
| |---|---|---| | ||
| | Registration | 0.000001 ETH | 0.00001 ETH | | ||
| | Manifest update | 0.0000001 ETH | 0.000001 ETH | | ||
|
|
||
| - **Disable / enable.** The DIN-Representative can disable a model. This blocks new manifest update requests and approvals for it. The task contracts don't read this flag, so a disabled model's running GIs, submissions and slashing continue. | ||
|
|
||
| ## DinFeeRouter | ||
|
|
||
| Splits protocol fees across four buckets: **validator pool, treasury, storage and public goods**. DIN fees can also have a burn share. | ||
|
|
||
| - Only allowlisted fee sources can route fees. The deploy script allowlists `DinCoordinator` and `DINModelRegistry`. | ||
| - The default ETH split is **95% validator pool / 5% treasury**. The treasury share can't exceed a 20% ceiling. | ||
| - Only the treasury share leaves the router today. The validator-pool, storage and public-goods shares accrue in the router until the contracts that will consume them ship. | ||
|
|
||
| ## DinTreasury | ||
|
|
||
| A custodial holding contract for ETH and ERC-20 assets, with no split logic of its own. It receives the router's treasury share. The owner can withdraw from it with `withdrawETH` and `withdrawERC20`. | ||
|
|
||
| ## DinEmission | ||
|
|
||
| The per-GI **reward subsidy**. It funds a model's GI reward pool on a geometric decay schedule: | ||
| - Each epoch (a fixed number of completed GIs) keeps a set fraction of the previous epoch's emission. | ||
| - After `maxEpochs`, emission stops. This is an explicit retirement, not an endless tail. | ||
| - Progress is tracked **per model**, because every model has its own GI counter. | ||
|
|
||
| It mints only through `DinCoordinator.mintEmission()`, so emission can't bypass `mintCap` or faucet retirement. | ||
|
|
||
| ## Deployment | ||
|
|
||
| The Foundry script [`foundry/script/DeployPlatform.s.sol`](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/foundry/script/DeployPlatform.s.sol) deploys and wires all seven contracts in one run: 22 transactions (seven implementations, seven proxies and eight wiring calls). | ||
|
|
||
| ``` | ||
| 1. DinTreasury proxy | ||
| 2. DinToken proxy | ||
| 3. DinFeeRouter proxy (token, treasury) | ||
| 4. DinCoordinator proxy (token) | ||
| → DinToken.setCoordinator · DinCoordinator.setFeeRouter · DinFeeRouter.addFeeSource(coordinator) | ||
| 5. DinValidatorStake proxy (token, coordinator) | ||
| → DinCoordinator.updateValidatorStakeContract · DinValidatorStake.setSlashTreasury(treasury) | ||
| 6. DINModelRegistry proxy (stake) | ||
| → DinFeeRouter.addFeeSource(registry) · DINModelRegistry.setFeeRouter | ||
| 7. DinEmission proxy | ||
| → DinCoordinator.setEmissionContract | ||
| 8. Tokenomics overrides from the environment (DIN_PER_ETH, MINT_CAP, EMISSION_*, MIN_STAKE, S5_*, …) | ||
| 9. Write foundry/deployments/<network>.json, then: dincli system import-deployments | ||
| ``` | ||
|
|
||
| Later, for each model: the DIN-Representative runs `dincli dinrep add-slasher` for its coordinator and auditor, the model owner requests registration, and the DIN-Representative approves it. | ||
|
|
||
| **Ownership.** Each contract changes owner with OpenZeppelin `transferOwnership`, and each ProxyAdmin has its own owner. There is no single `set-admin` switch. Upgrades go through `foundry/script/UpgradePlatform.s.sol`. | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [DIN-Representative guide](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/roles/dinrep.md): deploying, importing, approvals, fees and slashers, with every command | ||
| - [DeployPlatform script reference](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/foundry/script/DeployPlatform.md): every tokenomics key and its default | ||
| - Technical references: [DinCoordinator](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DinCoordinator.md) · [DinToken](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DinToken.md) · [DinValidatorStake](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DinValidatorStake.md) · [DINModelRegistry](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DINModelRegistry.md) | ||
| - [DevNet 2.0 mechanism design](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Developer/design/MECHANISM_DESIGN.md): staking, slashing, rewards, tokenomics and fees | ||
| - [Task Contracts](Task-Contracts): the per-model layer these contracts authorize |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,81 +1,130 @@ | ||
| # Task Contracts | ||
|
|
||
| > 🚧 **This wiki describes DevNet 2.0, soon to be launched.** It follows the contracts and `dincli` on the [`develop`](https://github.com/InfiniteZeroFoundation/DevNet/tree/develop) branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: [#102](https://github.com/InfiniteZeroFoundation/DevNet/discussions/102). | ||
| The [Platform Contracts](Platform-Contracts) are deployed once for the whole network. The task contracts are deployed **per model, by the model owner**. Every model trained on DIN gets its own pair, `DINTaskCoordinator` and `DINTaskAuditor`, which run the federated-learning lifecycle and the reward pool for that model. | ||
|
|
||
| ``` | ||
| Model owner (Ownable) | ||
| ├── deploys & drives ──► DINTaskCoordinator ◄──── aggregators (register, commit/reveal T1/T2) | ||
| │ │ │ | ||
| │ delegates │ │ slash() aggregators | ||
| │ ▼ ▼ | ||
| └── deploys ───────────► DINTaskAuditor ──slash() auditors──► DinValidatorStake | ||
| ▲ │ | ||
| │ └── reward pool (DIN): settled at GI end, claimed by participants | ||
| clients (submit local models) · auditors (register, commit/reveal scores) | ||
| ``` | ||
|
|
||
| Both contracts must be authorized as **slashers** on `DinValidatorStake` before the model can be registered in `DINModelRegistry`, because both carry out slashes: | ||
| - the coordinator slashes aggregators; | ||
| - the auditor contract slashes auditors. | ||
|
|
||
| The model owner requests authorization from the DIN-Representative off-chain. The DIN-Representative checks the deployment and then runs `dincli dinrep add-slasher`. | ||
|
|
||
| The task contracts are plain `Ownable` contracts. They are **not upgradeable**: a new version means a new deployment. | ||
|
|
||
| ## DINTaskCoordinator | ||
|
|
||
| The central orchestration contract for a model's training. It drives the **26-state Global Iteration (GI) state machine**, runs two-tier aggregation, and slashes aggregators. | ||
|
|
||
| - **Lifecycle.** The model owner opens and closes every phase of a GI explicitly. Other participants can act only while their phase is open, and only for the current GI. | ||
| - **Aggregator registration.** Any active validator can register while the window is open, if: | ||
| - its stake is at or above the model's stake floor; | ||
| - its stake leaves room under the concurrent-registration cap; | ||
| - fewer than 300 aggregators have registered this GI. | ||
| - **Batch seeds.** Batches are shuffled with a seed taken from a *future* block hash. The seed is anchored when the previous phase closes, and anyone can lock it once that block is mined (`lockAuditSeed`, `lockAggSeed`). | ||
| - **Two-tier aggregation.** | ||
| - **Tier-1 batches:** 3 aggregators each combine a sub-batch of 3 approved local models. | ||
| - **Tier-2:** one batch of the next 3 shuffled aggregators combines the T1 results into the new global model. | ||
| - **Commit, then reveal.** Aggregators first *commit* a hash bound to their CID, address, GI, tier and batch, then *reveal* the CID once the owner opens reveals. So no one can copy a peer's result. | ||
| - **Choosing the winner.** The winning CID per batch is the one revealed most often. At least 2 of 3 aggregators must reveal. | ||
| - **Aggregator slashing.** Every slash below is capped at the validator's slashable stake. | ||
| - **Missed submission:** an aggregator who doesn't reveal for its batch, including one who committed and never revealed, gets a partial slash (30% of the minimum stake; S2, which escalates under S5). | ||
| - **Losing CID:** an aggregator who revealed a CID other than the winner gets a full minimum-stake slash. | ||
| - **Aggregation disputes (S4).** Within a window after a batch is finalized, any active validator can post a bond and dispute the result. The owner adjudicates. A recomputation that confirms the dispute slashes the original aggregators. | ||
| - It holds the **genesis model CID** (set once before GI 1) and each GI's finalized global model CID. | ||
|
|
||
| ## DINTaskAuditor | ||
|
|
||
| The evaluation, quality-control and reward contract: the gatekeeper deciding which client contributions reach the global model, and who gets paid. | ||
|
|
||
| - **Auditor registration.** Active validators register for the current GI, under the same stake floor, concurrency and 300-per-GI caps as aggregators. | ||
| - **Local Model Submission (LMS).** Clients submit the IPFS CID of their locally trained model. Each client gets one submission per GI, and a GI takes at most 10,000. | ||
| - **Audit batches.** Submitted models are shuffled, from the locked audit seed, into batches of 3 auditors × 3 models. | ||
| - **Encrypted test data.** For each batch, the owner publishes: | ||
| - an AES-GCM-encrypted test-dataset CID; | ||
| - a key for each auditor, encrypted to that auditor's registered X25519 key; | ||
| - a commitment to the dataset's content. | ||
|
|
||
| Only the batch's auditors can read the test data. | ||
| - **Scoring: commit, then reveal.** Each auditor evaluates every model in its batch, then *commits* a hash of its score (0–100) and eligibility vote. The hash is bound to the auditor's address and the slot. The auditor *reveals* once the owner opens reveals. | ||
| - **Finalization.** A model is **approved for aggregation** when at least 2 auditors vote it eligible and its **median** score is at or above the GI's pass score. The model owner sets the pass score when starting each GI. | ||
| - **Auditor slashing.** | ||
| - **Missed vote:** an auditor who doesn't reveal a vote, including one who committed and never revealed, gets a partial slash (30% of the minimum stake; S1, which escalates under S5). | ||
| - **Score deviation:** scoring far from the median (S3) is a full slash. It ships **disabled** (shadow mode). | ||
| - **Test-data disputes.** An auditor of a batch can dispute its test data by posting a 100 DIN bond, as long as the GI's rewards haven't been settled yet. The owner must answer within the window (7,200 blocks, about one day) by revealing the dataset key. | ||
| - **The key matches:** the bond is forfeited. | ||
| - **The key doesn't match, or the owner stays silent:** the dispute is upheld. The bond is returned, 25% of the GI reward pool is forfeited (no penalty if the GI settled while the dispute was open), and the batch must be reassigned. | ||
|
|
||
| ## Rewards | ||
|
|
||
| Each GI has a **reward pool in DIN**, held by `DINTaskAuditor`. | ||
| - **Funding.** The pool must be funded before the GI can start, with `depositRewards(gi, amount)`. Anyone can fund it, and `DinEmission` can subsidise it. | ||
| - **Settlement.** When the owner ends the GI, the pool is split: | ||
|
|
||
| | Share | Default | Distributed by | | ||
| |---|---|---| | ||
| | Clients | 60% | median score of each approved local model | | ||
| | Auditors | 20% | number of revealed votes | | ||
| | Aggregators | 15% | one unit per assigned aggregator of each finalized batch | | ||
| | Treasury | 5% | sent to the protocol treasury | | ||
|
|
||
| Rewards are **pulled**: each participant calls `claimReward(gi)`, then `claimRewards()` to withdraw. `dincli` has no commands yet for depositing or claiming rewards; these are direct contract calls for now. | ||
|
|
||
| ## The Global Iteration lifecycle | ||
|
|
||
| A GI is one full training round. The coordinator's state machine enforces the order. Owner steps are `dincli model-owner …` commands; the others belong to the role shown. | ||
|
|
||
| ``` | ||
| Setup (once): set auditor contract → confirm both slashers → submit genesis model | ||
| │ | ||
| ┌────────────────────────────────────────────────────────────────┘ | ||
| ▼ | ||
| 0. Fund the GI reward pool (depositRewards — required before start) | ||
| 1. GI started (sets the pass score) | ||
| 2. Aggregator registration (open → aggregators register → close) | ||
| 3. Auditor registration (open → auditors register → close) | ||
| 4. Local Model Submission (open → clients train locally & submit CIDs → close; anchors audit seed) | ||
| 5. Audit batches (lock audit seed → create batches → assign encrypted test data) | ||
| 6. Score commit → reveal (auditors commit → owner opens reveal → auditors reveal → close; anchors agg seed) | ||
| 7. T1/T2 batches (lock aggregation seed → create batches) | ||
| 8. T1 commit → reveal (aggregators commit → owner opens reveal → aggregators reveal → finalize) | ||
| 9. T2 commit → reveal (same, producing the new global model) | ||
| 10. Slashing (slash auditors → slash aggregators) | ||
| 11. GI ended (reward pool settled; next GI starts from the new global model) | ||
| ``` | ||
|
|
||
| Only model artifacts move between participants. Raw training data never leaves a client's device. All artifacts (the genesis model, local models, aggregated models and encrypted test datasets) live on IPFS, and the contracts store and vote on their CIDs. | ||
|
|
||
| ## Deploying a model's task contracts | ||
|
|
||
| The model owner deploys and connects both contracts through `dincli`: | ||
|
|
||
| ```bash | ||
| dincli model-owner deploy task-coordinator --artifact <DINTaskCoordinator.json> | ||
| dincli model-owner deploy task-auditor --artifact <DINTaskAuditor.json> # also links it to the coordinator | ||
| # then: request slasher authorization from the DIN-Representative, | ||
| # confirm it, submit the genesis model, and register the model | ||
| ``` | ||
|
|
||
| > ⚠️ **Known gap:** the DevNet 2.0 task contracts take the model's `modelId` as a constructor argument, but `dincli model-owner deploy` still passes the older argument list. It has to be updated before model owners can deploy through `dincli` (see [DINTaskCoordinator.md §10](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DINTaskCoordinator.md)). | ||
| The full step-by-step guide, including the slasher authorization request channels and the manifest and services setup, is in the [Model Workflow](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/workflows/model-workflow.md). | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [Model Workflow](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/public/workflows/model-workflow.md): the complete per-model walkthrough | ||
| - Technical references: [DINTaskCoordinator](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DINTaskCoordinator.md) · [DINTaskAuditor](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DINTaskAuditor.md) · [DINShared](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Documentation/technical/contracts/DINShared.md) (the GI state enum and shared interfaces) | ||
| - [DevNet 2.0 mechanism design](https://github.com/InfiniteZeroFoundation/DevNet/blob/develop/Developer/design/MECHANISM_DESIGN.md): the slashing conditions (S1–S6), rewards and scoring | ||
| - [Platform Contracts](Platform-Contracts): the network-wide layer that authorizes these contracts |
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
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