Skip to content

feat(factory): use CREATE2 for deterministic game proxy deployment#250

Open
leopoldjoy wants to merge 2 commits intomainfrom
feat/deterministic-game-proxy-deployment
Open

feat(factory): use CREATE2 for deterministic game proxy deployment#250
leopoldjoy wants to merge 2 commits intomainfrom
feat/deterministic-game-proxy-deployment

Conversation

@leopoldjoy
Copy link
Copy Markdown
Contributor

Summary

  • Switches DisputeGameFactory._createGameImpl() from LibClone.clone() (CREATE) to LibClone.cloneDeterministic() (CREATE2), using the game UUID as the salt
  • Moves the GameAlreadyExists duplicate check from _finalizeGameCreation into _createGameImpl so it runs before deployment (cleaner revert vs raw CREATE2 failure)

Motivation

With CREATE2, game proxy addresses become deterministic — computable locally from (gameType, rootClaim, extraData) without any RPC calls. This unblocks the multiproof proposer from doing batch-concurrent games() lookups to verify the on-chain game chain, instead of the current sequential factory scan + forward walk approach. It also eliminates an edge case where the proposer gets stuck if an invalid game appears before a valid one at the same block number (since the correct game can now be looked up directly by its inputs rather than iterated over).

Changes

src/dispute/DisputeGameFactory.sol

  • _createGameImpl: computes UUID, checks GameAlreadyExists, then calls cloneDeterministic(data, uuid) instead of clone(data) — for both the no-args and with-args CWIA paths
  • _finalizeGameCreation: removed the now-redundant GameAlreadyExists check (UUID is still computed here for storage)

snapshots/semver-lock.json

  • Regenerated via just semver-lock

Testing

All 25 existing DisputeGameFactory tests pass, including the testFuzz_create_sameUUID_reverts test that exercises the duplicate-rejection path.

Switch DisputeGameFactory from LibClone.clone() to
LibClone.cloneDeterministic() using the game UUID as the CREATE2 salt.
This makes proxy addresses locally computable from (gameType, rootClaim,
extraData), enabling the proposer to batch-verify game existence via
concurrent UUID lookups instead of sequential factory scans.

Also moves the GameAlreadyExists duplicate check into _createGameImpl so
it runs before deployment, giving a clean revert instead of a raw CREATE2
failure on duplicate submissions.
@cb-heimdall
Copy link
Copy Markdown
Collaborator

cb-heimdall commented Apr 13, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

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.

2 participants