Repository navigation
Conversation
Collaborator
🟡 Heimdall Review Status
|
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.
What changed? Why?
Adds a Foundry invariant suite for
OptimismPortal2intest/invariants/OptimismPortal2.t.sol. It drives the deploy-script proxies (OptimismPortal2,SystemConfig,AnchorStateRegistry,DisputeGameFactory, andAggregateVerifier) through randomized call sequences against independent ghost state. Tests only; nosrc/files change.What the suite checks:
finalizeCount[hash] <= 1) andfinalizedWithdrawals(hash)matches the handler count.provenWithdrawals(hash, submitter)andnumProofSubmitters(hash)match independent ghost state across direct and external-proof flows, catching broken proof-timer resets on re-prove.proveandfinalizeverify exact revert selectors for pause (OptimismPortal_CallPaused), unsafe target (OptimismPortal_BadTarget), improper game (OptimismPortal_ImproperDisputeGame), invalid game (OptimismPortal_InvalidDisputeGame), invalid proof timestamp (OptimismPortal_InvalidProofTimestamp), mismatched output root (OptimismPortal_InvalidOutputRootProof), replay (OptimismPortal_AlreadyFinalized), unproven withdrawal (OptimismPortal_Unproven), proof maturity (OptimismPortal_ProofNotOldEnough), and invalid root claim (OptimismPortal_InvalidRootClaim).ReentrantWithdrawalTargetchecksl2Sender()during callback execution, verifies that reentrant finalization reverts withOptimismPortal_NoReentrancy, andinvariant_optimismPortal2assertsl2Sender()resets toDEFAULT_L2_SENDER.initial + deposited - withdrawnacrossdepositTransaction,receive,donateETH, accepting targets, and rejecting targets, rollingblock.numberwhen per-blockResourceMeteringgas headroom is reached.changePauseandinvalidateGamecheckPAUSE_EXPIRYboundaries,SystemConfigandAnchorStateRegistryaccess control selectors, and keep game-creation headroom beforeupdateRetirementTimestampso retirement does not stall the rest of a run.Notes to reviewers
OptimismPortal2_Invariant_Test.setUp()(the five fixture withdrawals) andinvariant_optimismPortal2(), then read_expectedProveRevertand_expectedFinalizeRevertinOptimismPortal2_Invariant_Harness.git revertremoves the test file and leaves no state behind.FOUNDRY_PROFILE=ci).How has it been tested?
FOUNDRY_PROFILE=ci forge test --offline --match-path test/invariants/OptimismPortal2.t.sol(64 runs, 2048 calls, 0 reverts): pass in 1.81s.forge test --offline --match-path test/invariants/OptimismPortal2.t.sol(64 runs, 32000 calls, 0 reverts): pass in 11.23s.just lint-check(forge fmt --check): pass.go run ./scripts/checks/test-validation: pass.src/L1/OptimismPortal2.solmutations underFOUNDRY_PROFILE=ci(each reverted before committing): removingOptimismPortal_NoReentrancy(FAIL: reentrant finalization succeeded), skipping proof-timer reset on re-prove (FAIL: prove: provenWithdrawals disagrees with ghost state), removing_isUnsafeTargetinproveWithdrawalTransaction(FAIL: prove: unexpected revert selector), and removingrootClaim != hashOutputRootProof(FAIL: prove: ineligible proof succeeded).