Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
534bed70
Commit
534bed70
authored
Jan 03, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cannot finalize withdrawal twice invariant
parent
61e85ede
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
OptimismPortal.t.sol
...ts-bedrock/contracts/test/invariants/OptimismPortal.t.sol
+37
-0
No files found.
packages/contracts-bedrock/contracts/test/invariants/OptimismPortal.t.sol
View file @
534bed70
...
@@ -88,3 +88,40 @@ contract OptimismPortal_CannotTimeTravel is OptimismPortal_Invariant_Harness {
...
@@ -88,3 +88,40 @@ contract OptimismPortal_CannotTimeTravel is OptimismPortal_Invariant_Harness {
op.finalizeWithdrawalTransaction(_defaultTx);
op.finalizeWithdrawalTransaction(_defaultTx);
}
}
}
}
contract OptimismPortal_CannotFinalizeTwice is OptimismPortal_Invariant_Harness {
function setUp() public override {
super.setUp();
// Prove the withdrawal transaction
op.proveWithdrawalTransaction(
_defaultTx,
_proposedOutputIndex,
_outputRootProof,
_withdrawalProof
);
// Warp passed the finalization period.
vm.warp(block.timestamp + op.FINALIZATION_PERIOD_SECONDS() + 1);
// Finalize the withdrawal transaction.
op.finalizeWithdrawalTransaction(_defaultTx);
// Set the target contract to the portal proxy
targetContract(address(op));
// Exclude the proxy multisig from the senders so that the proxy cannot be upgraded
excludeSender(address(multisig));
}
/**
* @custom:invariant `finalizeWithdrawalTransaction` should revert if the withdrawal
* has already been finalized.
*
* Ensures that there is no chain of calls that can be made that allows a withdrawal
* to be finalized twice.
*/
function invariant_cannotFinalizeTwice() external {
vm.expectRevert();
op.finalizeWithdrawalTransaction(_defaultTx);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment