Skip to content

docs: full audit & sync to protocol main + whitepaper v1.0#21

Open
0xkkkn wants to merge 2 commits into
mainfrom
chore/docs-audit-protocol-sync
Open

docs: full audit & sync to protocol main + whitepaper v1.0#21
0xkkkn wants to merge 2 commits into
mainfrom
chore/docs-audit-protocol-sync

Conversation

@0xkkkn

@0xkkkn 0xkkkn commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Page-by-page audit of every public docs route against the protocol codebase on platform-web3-protocol/main and the Whitepaper v1.0 draft. The previous content drifted in three main ways: (1) the SDK address book had grown a plain-mode mainnet path that no docs page mentioned, (2) plugin interfaces had stale signatures (IConditionResolver was missing getConditionFee; IUnderwriterPolicy was shown with FHE return types on the plain variant), and (3) several pages framed v1.0-mainnet posture (immutable contracts, LayerZero rail "Live", zero-fee post-activation arithmetic) as already shipped.

26 pages updated, 2 orphaned pages deleted, build / lint clean.

Reference (5 pages)

  • Contracts: restructure to dual-mode (plain mainnet path + confidential FHE path); add the 6 plain-mode addresses from packages/sdk/src/constants/addresses.ts; add deployment-posture explanation (UUPS testnet vs immutable mainnet v1.0); add "Specified, not yet deployed" section (StrategyRouter, OperatorSlashingManager, OperatorSubsidyManager, CoordinatorRegistry, cUSDT, LZ handler family, ParticipationBond); fix IConditionResolver (add getConditionFee 3rd method, mark is IERC165); split IUnderwriterPolicy into Plain (uint256/bool) and Confidential (euint64/ebool) variants.
  • SDK: document all 6 modules (sdk.escrow + escrowPlain, sdk.insurance + insurancePlain, sdk.bridge, sdk.events); fix viem helper signature (walletClientToSigner is async); network type accepts mainnet too.
  • EscrowModule: subtitle clarifies FHE + plain dual-mode; fix waitForFunded return type (SettlementResult, not void); expand static methods (get/exists/total/redeemMultiple/build).
  • InsuranceModule: dual-mode note; expose createPool extras (initialManager, guardian, isOpen) + four-role separation callout + CoverageInvite note (closed pools).
  • McpServer: fix get_docs sections list (was overview/guides/protocol/reference/whitepaper/litepaper; actual is …/whitepaper/root); switch links from legacy /get-started/reineira-code to canonical /developer-tools/reineira-code.

Operate (2 pages)

  • CoordinatorNetwork: replace "single stake-weighted quorum" claim with the actual four-stage slashing pipeline (5% bond → 3-day challenge → 4-day vote → 14-day expiry, QUORUM_BPS = 1000) per Whitepaper §8.6 and OperatorSlashingManager.sol.
  • RunOperator: add chaos-net zero-fee callout (FeeManager pinned to zero bytecode-level until MAINNET_ACTIVATION_BLOCK; operator income comes from OperatorSubsidyManager during chaos-net); fix arithmetic (35 bps + 15 bps = 50 deducted on 10 k USDC, 9,950 remaining — was wrongly stated as 50 + 30 = 80 deducted, 9,920 remaining).

Build (7 pages)

  • EscrowLifecycle: full event list (FeeStamped + FeeDistributed instead of nonexistent FeeSet; add ConditionSet, CoverageManagerSet); add 4th redeem check (paidAmount >= amount); fix fundFrom signature (escrowId, euint64 amount) — was incorrectly (escrowId, amount, payer); add MAX_BATCH_SIZE = 20 cap note.
  • ConditionPlugins (Condition Resolvers): add is IERC165 + getConditionFee 3rd method to the interface block and table; callout explaining the no-op fee stub required for each example; fix /developers/reineira-code/developer-tools/reineira-code.
  • InsurancePolicies (Underwriter Policies): show both interface variants (plain IUnderwriterPolicy with uint256/bool returns, FHE IConfidentialUnderwriterPolicy with euint64/ebool); make P2P example import the confidential variant since it uses FHE types.
  • InsurancePools: add four-role separation callout (Whitepaper §7.2 — Creator / Manager / Guardian / Operator); rewrite privacy section to match Whitepaper Prop 7.2 disclosure bound (per-buyer values encrypted; policy / pool addresses + lifecycle events public).
  • CrossChain: downgrade LayerZero OFT rail from "Live" to Spec'd v1.0-track (LZOFTHandler family is whitepaper-spec, not in code today); add chaos-net zero-fee callout; fix the same 10 k-USDC arithmetic.
  • GasPerformance: add plain-mode disclaimer (chaos-net launches plain; expect 40–60 % of the FHE-mode gas figures).

RSS (5 pages)

  • RssWhatIs: note that chaos-net retains the legacy privara.storage.* slot prefix per Whitepaper §6.2; reineira.storage.* becomes canonical at v1.0 mainnet.
  • RssLicensing: replace "cofhejs glue" with "@cofhe/sdk integration" (post-migration name from cofhejs@0.3@cofhe/sdk@0.5).

Learn (6 pages)

  • MentalModel: fix IConditionResolver interface block (add IERC165, add getConditionFee); relabel IUnderwriterPolicy as IConfidentialUnderwriterPolicy (block shows FHE types); update license header to Apache-2.0 per actual source.
  • Architecture: replace cofhejs with @cofhe/sdk and use the encryptInputs([...]).execute() pattern; remove cleartext exists field from the Escrow struct (not present in ConfidentialEscrow.sol); split storage section to acknowledge testnet UUPS vs mainnet-v1.0 immutable posture; note privara.storage.* legacy slot prefix; downgrade LayerZero OFT description.
  • Security: expand single-quorum description to the actual four-stage pipeline; mark UUPS row as "testnet only" with mainnet-immutable posture; mention Safe + TimelockController deploy posture (Whitepaper §10.6); add chaos-net unaudited limitation + Phase 7 review counts + external-audit gate; add CoFHE single-substrate trust limitation (TA2, Open Problem 4.1).
  • Resilience: refine "always-true resolver" response — the protocol's encrypted predicate still binds owner == msg.senderpaidAmount >= amount!isRedeemed, so an always-true resolver weakens conditionality but cannot redirect funds; update proxy-admin trust row to reflect Safe + Timelock testnet posture + immutable mainnet posture.

Project Status + Get Started (5 pages)

  • DocsHub: hero copy now lists the four primitives correctly (Escrow / Gate / Insurance / operator-secured cross-chain), no more "Shields" leftover.
  • Status: replace LZ Handler row "chaos-net Live" with Spec'd v1.0-track (LZOFTHandler family not in repo today); refine OperatorSlashingManager note to the four-stage pipeline parameters; clean up CoordinatorRegistry description.

Developer Tools (4 pages)

  • BuilderJourney: reineira-code stack updated to Foundry/Hardhat + Solidity + @cofhe/sdk (was Hardhat + Solidity + cofhejs).
  • ReineiraCode: test harness uses @cofhe/sdk mocks (was cofhejs mocks).
  • PlatformModules: add missing third package (landing, Next.js + React 19) per platform-modules workspace; clarify app starter has passkey + smart-account auth.

Research (1 page)

  • AgenticComposition: align LZOFTHandler row with Whitepaper §9.2 — not in repo today; family is Spec'd v1.0-track.

Cleanup

  • Delete two orphaned pages with no route and no nav entry: Governance.tsx (its content is now covered by the RSS section + Status + Risk pages) and EnterpriseChecklist.tsx (covered by Status + Risk).

Sources of truth used

Surface Source on protocol/main
Whitepaper §3, §4, §6, §7, §8, §9, §10, §11, §12, §14 docs/whitepaper/*.md
Escrow lifecycle / events / constants packages/escrow/contracts/core/ConfidentialEscrow.sol, packages/shared/contracts/interfaces/core/IEscrowEvents.sol
Plugin interfaces (3 total) packages/shared/contracts/interfaces/plugins/IConditionResolver.sol, IUnderwriterPolicy.sol, IConfidentialUnderwriterPolicy.sol
Slashing parameters packages/orchestration/contracts/core/OperatorSlashingManager.sol
Plain + confidential deployed addresses (testnet) packages/sdk/src/constants/addresses.ts
MCP tool surface and categories packages/mcp-docs/src/server.ts, src/content/contracts.generated.ts, src/content/docs.generated.ts
Per-layer licensing LICENSE
Platform-modules packages platform-modules/packages/{app,backend,landing}/package.json

Test plan

  • npm install (one missing dep: react-helmet-async resolved as part of the install).
  • npm run build — 37 per-route HTML stubs generated by the route-stubs plugin, no Rollup warnings on doc pages.
  • npm run lint — clean.
  • Manual smoke: open /reference/contracts, /build/escrow-lifecycle, /operate/operator-network, /status, /risk in preview and confirm tables / interface blocks render.
  • Confirm legacy redirects (/build/condition-plugins, /operate/coordinator-network, etc.) still work.

0xkkkn added 2 commits May 28, 2026 19:54
Page-by-page review of every public docs route against the protocol
codebase (platform-web3-protocol main) and Whitepaper v1.0 draft.

## Reference (5 pages)

- Contracts: restructure to dual-mode (plain mainnet path + confidential
  FHE path); add SDK-canonical plain-mode addresses (Escrow, receiver,
  PolicyRegistry, CoverageManager, PoolFactory, InsurancePool template);
  add deployment-posture explanation (UUPS testnet vs immutable mainnet
  v1.0); add "Specified, not yet deployed" section (StrategyRouter,
  OperatorSlashingManager, OperatorSubsidyManager, CoordinatorRegistry,
  cUSDT, LZ handler family, ParticipationBond); fix IConditionResolver
  (add getConditionFee 3rd method, mark IERC165); split
  IUnderwriterPolicy into Plain (uint256/bool) and Confidential
  (euint64/ebool) variants.
- SDK: document all 6 modules (sdk.escrow + escrowPlain, sdk.insurance +
  insurancePlain, sdk.bridge, sdk.events); fix viem helper signature
  (walletClientToSigner is async); network type accepts mainnet too.
- EscrowModule: subtitle clarifies FHE + plain dual-mode; fix
  waitForFunded return type (SettlementResult, not void); expand static
  methods (get/exists/total/redeemMultiple/build).
- InsuranceModule: dual-mode note; expose createPool extras
  (initialManager, guardian, isOpen) + four-role separation note +
  CoverageInvite (closed pools).
- McpServer: fix get_docs sections list (was overview/guides/protocol/
  reference/whitepaper/litepaper; actual is overview/guides/protocol/
  reference/whitepaper/root); switch links from legacy
  /get-started/reineira-code to canonical /developer-tools/reineira-code.

## Operate (2 pages)

- CoordinatorNetwork: replace "single stake-weighted quorum" claim with
  the actual four-stage slashing pipeline (5% bond -> 3-day challenge
  -> 4-day vote -> 14-day expiry, QUORUM_BPS = 1000) per Whitepaper §8.6
  and OperatorSlashingManager source.
- RunOperator: add chaos-net zero-fee callout (FeeManager pinned to zero
  bytecode-level until MAINNET_ACTIVATION_BLOCK; operator income comes
  from OperatorSubsidyManager during chaos-net); fix arithmetic error
  (35 bps + 15 bps = 50 deducted on 10k USDC, 9,950 remaining — was
  wrongly stated as 50+30=80 deducted, 9,920 remaining).

## Build (7 pages)

- EscrowLifecycle: full event list (FeeStamped + FeeDistributed instead
  of nonexistent FeeSet; add ConditionSet, CoverageManagerSet); add 4th
  redeem check (paidAmount >= amount); fix fundFrom signature
  (escrowId, euint64 amount) — was incorrectly (escrowId, amount, payer);
  add MAX_BATCH_SIZE = 20 cap note.
- ConditionPlugins (Condition Resolvers): add IERC165 inheritance + 3rd
  method getConditionFee to the interface block + table; callout
  explaining the no-op fee stub required for each example; fix
  /developers/reineira-code -> /developer-tools/reineira-code.
- InsurancePolicies (Underwriter Policies): show both interface
  variants (plain IUnderwriterPolicy with uint256/bool returns, FHE
  IConfidentialUnderwriterPolicy with euint64/ebool); make P2P example
  import the confidential variant since it uses FHE types.
- InsurancePools: add four-role separation callout (Whitepaper §7.2 —
  Creator/Manager/Guardian/Operator); rewrite privacy section to match
  Whitepaper Prop 7.2 disclosure bound (per-buyer values encrypted;
  policy/pool addresses & lifecycle events public).
- CrossChain: downgrade LayerZero OFT rail from "Live" to Spec'd v1.0
  (handler family is whitepaper-spec, not in code); add chaos-net
  zero-fee callout; fix same 10k-USDC arithmetic.
- GasPerformance: add plain-mode disclaimer (chaos-net launches plain;
  expect 40-60% of the FHE-mode gas figures).

## RSS (5 pages)

- RssWhatIs: note implementation reality — chaos-net retains the legacy
  privara.storage.* prefix per Whitepaper §6.2; reineira.storage.*
  becomes canonical at v1.0 mainnet.
- RssLicensing: replace "cofhejs glue" with "@cofhe/sdk integration"
  (post-migration name from cofhejs@0.3 -> @cofhe/sdk@0.5).

## Learn (6 pages)

- MentalModel: fix IConditionResolver interface block (add IERC165,
  add getConditionFee); relabel IUnderwriterPolicy as
  IConfidentialUnderwriterPolicy (block shows FHE types); update
  license header to Apache-2.0 per actual source.
- Architecture: replace cofhejs with @cofhe/sdk and use
  encryptInputs([...]).execute() pattern; remove cleartext exists
  field from Escrow struct (not present in actual code); split
  storage section to acknowledge testnet UUPS posture vs
  mainnet-v1.0 immutable posture; note privara.storage.* legacy slot
  prefix; downgrade LayerZero OFT description.
- Security: expand single-quorum description to the actual four-stage
  pipeline; mark UUPS row as "testnet only" with mainnet immutable
  posture; mention Safe + TimelockController deploy posture (Whitepaper
  §10.6); add chaos-net unaudited limitation + Phase 7 review counts +
  external-audit gate; add CoFHE single-substrate trust limitation
  (TA2, Open Problem 4.1).
- Resilience: refine "always-true resolver" response — the protocol's
  encrypted predicate still binds owner == msg.sender + paidAmount >=
  amount + !isRedeemed, so an always-true resolver weakens
  conditionality but cannot redirect funds; update proxy-admin trust
  row to reflect Safe + TimelockController testnet posture +
  immutable mainnet posture.

## Project Status + Get Started (5 pages)

- DocsHub: hero copy now lists the four primitives correctly
  (Escrow / Gate / Insurance / operator-secured cross-chain), no more
  "Shields" leftover.
- Status: replace LZ Handler row "chaos-net Live" with Spec'd v1.0-track
  (LZOFTHandler family not in repo today); refine
  OperatorSlashingManager note to the four-stage pipeline parameters;
  clean CoordinatorRegistry description.

## Developer Tools (4 pages)

- BuilderJourney: reineira-code stack updated to Foundry/Hardhat +
  Solidity + @cofhe/sdk (was Hardhat + Solidity + cofhejs).
- ReineiraCode: test harness uses @cofhe/sdk mocks (was cofhejs mocks).
- PlatformModules: add missing third package (landing, Next.js + React
  19) per platform-modules workspace; clarify app starter has
  passkey + smart-account auth.

## Research (1 page)

- AgenticComposition: align LZOFTHandler row with Whitepaper §9.2 —
  not in repo today; family is Spec'd v1.0-track.

## Cleanup

- Delete two orphaned pages with no route and no nav entry:
  Governance.tsx (replaced by RSS / Status / Risk coverage) and
  EnterpriseChecklist.tsx (replaced by Status / Risk coverage).

## Verification

- npm install + npm run build: passes (37 per-route HTML stubs
  generated by route-stubs plugin — no broken routes).
- npm run lint: clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant