Skip to content

Add carry-tree escalation game for forked carry deposits#309

Merged
KillariDev merged 11 commits into
mainfrom
t3code/79a55b33
Jun 11, 2026
Merged

Add carry-tree escalation game for forked carry deposits#309
KillariDev merged 11 commits into
mainfrom
t3code/79a55b33

Conversation

@KillariDev

Copy link
Copy Markdown
Collaborator

Summary

  • Adds new EscalationGameCarryTree peripheral contract implementing fork-aware carry-over via a branch-based carry tree and MMR-backed deposit commitments.
  • Updates forking flow to create and manage branch state, including branch creation/activation, carried totals, unresolved carried tracking, and carried-deposit registration/claims.
  • Updates SecurityPoolForker and related forker migration/interaction contracts to support the new carry-tree escrow flow for forked deposits.
  • Updates peripheral interfaces and factory wiring so forked carry deposits use the new game model.
  • Extends simulator contract helpers/deployment utilities to point at the new carry-tree escalation path in test scaffolding.
  • Updates UI contract wiring and fork-auction hooks to use new contract shape and branch behavior.
  • Adds/updates Solidity and UI tests covering carry-tree escalation behavior, fork flow, and fork-auction/security-pool section interactions.

Testing

  • solidity/ts/tests/escalationGame.test.ts updated/expanded for the new carry-tree behavior.
  • solidity/ts/tests/peripherals.test.ts updated for forker-peripheral interactions.
  • ui/ts/tests/contracts.test.ts updated for new contract type/signatures.
  • ui/ts/tests/forkAuctionChildPoolRecovery.test.tsx updated.
  • ui/ts/tests/forkAuctionSection.test.tsx updated.
  • ui/ts/tests/securityPoolWorkflowSection.test.tsx updated.
  • ui/ts/tests/securityPoolsSection.test.ts updated.
  • Not run: bun run tsc, bun run test, bun run format, bun run check, bun run knip (not executed in this turn).

- Add new `EscalationGameCarryTree` contract and branch-aware carry/claim bookkeeping
- Update forker and factory contracts plus interfaces to route forked game migration through the new carry-tree flow
- Extend simulator and deployment utilities for new carry-tree game contract wiring
- Update UI contracts/hooks/tests to support carried-branch deposit import, export, and recovery paths
- Add carry snapshot initialization and inherited MMR/nullifier roots for forked carry-tree games
- Add CarriedDepositProof-based withdraw/forfeit/export flow for carried deposits in forks
- Wire forker to hydrate child games from parent carry roots, totals, and nullifier state
- Update SecurityPool settlement to apply forked carried deposit proofs with shared ownership delta
- Extend TS/UI contract bindings and tests for new forked carry APIs
- Remove branch-specific carry bookkeeping, eager import rows, and fork-branch helpers in EscalationGameCarryTree
- Track inherited and current carry via persisted snapshot/current MMR peaks, leaf counts, and roots
- Require carried export/winnings flows to use provided proofs and nullifier-based consumption
- Update peripheral contracts, tests, and UI hooks/types to match the new carry export and retrieval APIs
- Refactor `EscalationGame` to migrate fork carry accounting from imported deposit rows to per-outcome carry-tree nodes, roots, and nullifier proofs
- Remove legacy `EscalationGameCarryTree` module and update fork continuation lifecycle, proof consumption, and payout paths for carried deposits
- Extend contract interfaces/types and simulator helpers/tests to expose carry roots, leaf pages, and proof-verifiable export/forfeit flows
- Consolidate carry and nullifier tracking into per-outcome `OutcomeState` storage and node map.
- Rename carry-tree structs/constants and use `MerkleMountainRange` helpers for clearer naming and consistency.
- Update fork carry snapshot, deposit, proof, and rebuild logic to operate on outcome-local state.
- Rename test security-pool harness contract API and align TS tests/contracts bindings with new contract identifiers
- Rename internal magic constants to uppercase style and replace all callers
- Convert several `BinaryOutcome.None` callers from hard reverts to safe zero-value responses
- Clarify and stabilize attrition computation flow with scaled constants and edge-case handling
- Add `MerkleMountainRange` library file and consume it from `EscalationGame`
- Replace per-field carry getters with `getOutcomeState`/`getForkCarrySnapshot` view APIs
- Update forker contracts to fetch carry snapshot via one call instead of four separate calls
- Rename carry-tree proof test contract artifact to `EscalationGameProofTestSecurityPool` and align TypeScript test helpers/usages
- Expose `nodes` mapping directly and remove dedicated `getNode`/legacy helper calls
- Update generated contract mapping in `ui/ts/contracts.ts` for renamed test contract
- Remove inherited nullifier-root storage from both outcome structs and related view fields
- Replace explicit fork booleans with derived state checks based on `forkResumedAt` and `outcomeState` data
- Replace helper balance access with direct reads from `outcomeState[index].balance` across resolution, threshold, binding, and reward paths
- Keep behavior unchanged while simplifying state initialization and state exposure in fork carry snapshot flow
- Refactor carry state to store snapshot roots/peaks and reconstruct current carry trees lazily
- Restrict privileged calls with a dedicated Security Pool/Forker modifier and immutable game config fields
- Update deposit/withdraw/carry-leaf pagination APIs and migrate related Solidity and UI contract tests
- Merge carried withdrawal paths into `withdrawDeposit` and remove branch-specific forks
- Add strict winning-outcome check in `claimDepositForWinning`
- Update `SecurityPool`/tests to use unified proof withdrawal API and add finalization/revert coverage
- Remove `ESCALATION_TIME_LENGTH` formatting issue and rename constant for style consistency
- Delete `getUnsettledDepositIndexesByOutcomeAndDepositor` and `previewLeafHash` contract helpers
- Replace test reliance on removed helpers with local hash/scan logic using deposits and ABI hashing helpers
- Update fork-continuation timing helper to advance by computed attrition-cost target instead of fixed 1 second
- Keep claim/settlement behavior intact while shifting assertions to public contract state views
@KillariDev KillariDev merged commit e624dc2 into main Jun 11, 2026
0 of 6 checks passed
@KillariDev KillariDev deleted the t3code/79a55b33 branch June 11, 2026 19:59
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