-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Optimistic ZK Game Contract #11
Conversation
…optimism into zach/optimistic-zk-tests
// Validate public values passed to the verifier: The real L1 block root matches the passed l1Root. | ||
// @todo verify relevant L1 block root matches _publicValues.l1Root | ||
|
||
// Validate public values passed to the verifier: The real commitment to the blob matches the passed blobKzgCommitment. | ||
// @todo access correct kzg commitment to verify against _publicValues.blobKzgCommitment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After building the STF, come back to finalize these commitments to ensure data is accurate.
// Require that the gap between the reference block and the block being proven is less than MAX_BLOCK_GAP. | ||
// This is used to avoid attacks where such a large gap is used that the game cannot be completed. | ||
if (anchorStateRoot.l2BlockNumber + MAX_BLOCK_GAP < l2BlockNumber()) revert InvalidBlockNumber(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to think more about these limits to ensure that up to 7 days later, the necessary data will be available via the EVM to prove against.
* feat: introduce OptimismSuperchainERC20 * fix: contract fixes * feat: add snapshots and semver * test: add supports interface tests * test: add invariant test * feat: add parameters to the RelayERC20 event * fix: typo * fix: from param description * fix: event signature and interface pragma * feat: add initializer * feat: use unstructured storage and OZ v5 * feat: update superchain erc20 interfaces * fix: adapt storage to ERC7201 * test: add initializable OZ v5 test * fix: invariant docs * fix: ERC165 implementation * test: improve superc20 invariant (#11) * fix: gas snapshot --------- Co-authored-by: 0xng <ng@defi.sucks> Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>
First draft of an Optimistic ZK Contract for the bridge:
MAX_GAME_DURATION
to complete a challenge (expect 7 days)MAX_PROPOSER_DURATION
(expect 3.5 days)This contract attempts to model a lot of the patterns, types and interfaces of the existing game contracts, which can feel a little clunky in some areas, but works.
This is still a WIP. Sharing here for early feedback.
Note: Pausing work on this contract to focus on implementing the state transition function in the zkVM. After that's done, will come back to it to tackle: