Add carry-tree escalation game for forked carry deposits#309
Merged
Conversation
- 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
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.
Summary
EscalationGameCarryTreeperipheral contract implementing fork-aware carry-over via a branch-based carry tree and MMR-backed deposit commitments.SecurityPoolForkerand related forker migration/interaction contracts to support the new carry-tree escrow flow for forked deposits.Testing
solidity/ts/tests/escalationGame.test.tsupdated/expanded for the new carry-tree behavior.solidity/ts/tests/peripherals.test.tsupdated for forker-peripheral interactions.ui/ts/tests/contracts.test.tsupdated for new contract type/signatures.ui/ts/tests/forkAuctionChildPoolRecovery.test.tsxupdated.ui/ts/tests/forkAuctionSection.test.tsxupdated.ui/ts/tests/securityPoolWorkflowSection.test.tsxupdated.ui/ts/tests/securityPoolsSection.test.tsupdated.bun run tsc,bun run test,bun run format,bun run check,bun run knip(not executed in this turn).