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
1ce4fdf3
Unverified
Commit
1ce4fdf3
authored
Apr 18, 2023
by
OptimismBot
Committed by
GitHub
Apr 18, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5475 from ethereum-optimism/clabby/ci/fix-ctb-tests
fix(CI): Fail CI if `contracts-bedrock` tests fail
parents
b593c34e
2760ae30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
28 deletions
+71
-28
config.yml
.circleci/config.yml
+30
-4
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+2
-2
OptimismPortal.t.sol
...ges/contracts-bedrock/contracts/test/OptimismPortal.t.sol
+26
-13
CrossDomainMessenger.t.sol
...rock/contracts/test/invariants/CrossDomainMessenger.t.sol
+13
-9
No files found.
.circleci/config.yml
View file @
1ce4fdf3
...
...
@@ -286,9 +286,9 @@ jobs:
command
:
|
./ops/scripts/ci-docker-tag-op-stack-release.sh <<parameters.registry>>/<<parameters.repo>> $CIRCLE_TAG $CIRCLE_SHA1
contracts-bedrock-
tests
:
contracts-bedrock-
coverage
:
docker
:
-
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images
/ci-builder:latest
-
image
:
ethereumoptimism
/ci-builder:latest
resource_class
:
large
steps
:
-
checkout
...
...
@@ -304,9 +304,8 @@ jobs:
command
:
forge --version
working_directory
:
packages/contracts-bedrock
-
run
:
name
:
test and generate coverage
name
:
generate coverage report
command
:
yarn coverage:lcov
no_output_timeout
:
18m
environment
:
FOUNDRY_PROFILE
:
ci
working_directory
:
packages/contracts-bedrock
...
...
@@ -316,6 +315,30 @@ jobs:
environment
:
FOUNDRY_PROFILE
:
ci
contracts-bedrock-tests
:
docker
:
-
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
resource_class
:
large
steps
:
-
checkout
-
attach_workspace
:
{
at
:
"
."
}
-
restore_cache
:
name
:
Restore Yarn Package Cache
keys
:
-
yarn-packages-v2-{{ checksum "yarn.lock" }}
-
check-changed
:
patterns
:
contracts-bedrock,hardhat-deploy-config
-
run
:
name
:
print forge version
command
:
forge --version
working_directory
:
packages/contracts-bedrock
-
run
:
name
:
run tests
command
:
yarn test
environment
:
FOUNDRY_PROFILE
:
ci
working_directory
:
packages/contracts-bedrock
contracts-bedrock-checks
:
docker
:
-
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
...
...
@@ -1007,6 +1030,9 @@ workflows:
-
contracts-bedrock-tests
:
requires
:
-
yarn-monorepo
-
contracts-bedrock-coverage
:
requires
:
-
yarn-monorepo
-
contracts-bedrock-checks
:
requires
:
-
yarn-monorepo
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
1ce4fdf3
...
...
@@ -267,9 +267,9 @@ OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifOutp
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifOutputTimestampIsNotFinalized_reverts() (gas: 207497)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifWithdrawalNotProven_reverts() (gas: 41753)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_ifWithdrawalProofNotOldEnough_reverts() (gas: 199441)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_onInsufficientGas_reverts() (gas: 2057
87
)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_onInsufficientGas_reverts() (gas: 2057
95
)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_onRecentWithdrawal_reverts() (gas: 180206)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_onReentrancy_reverts() (gas: 2438
04
)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_onReentrancy_reverts() (gas: 2438
12
)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_onReplay_reverts() (gas: 245528)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_paused_reverts() (gas: 53576)
OptimismPortal_FinalizeWithdrawal_Test:test_finalizeWithdrawalTransaction_provenWithdrawalHash_succeeds() (gas: 234941)
...
...
packages/contracts-bedrock/contracts/test/OptimismPortal.t.sol
View file @
1ce4fdf3
...
...
@@ -976,12 +976,21 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
uint256 _gasLimit,
bytes memory _data
) external {
// Cannot call the optimism portal
vm.assume(_target != address(op));
vm.assume(
_target != address(op) && // Cannot call the optimism portal or a contract
_target.code.length == 0 && // No accounts with code
_target != CONSOLE && // The console has no code but behaves like a contract
uint160(_target) > 9 // No precompiles (or zero address)
);
// Total ETH supply is currently about 120M ETH.
uint256 value = bound(_value, 0, 200_000_000 ether);
vm.deal(address(op), value);
uint256 gasLimit = bound(_gasLimit, 0, 50_000_000);
uint256 nonce = messagePasser.messageNonce();
// Get a withdrawal transaction and mock proof from the differential testing script.
Types.WithdrawalTransaction memory _tx = Types.WithdrawalTransaction({
nonce: nonce,
sender: _sender,
...
...
@@ -998,6 +1007,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
bytes[] memory withdrawalProof
) = ffi.getProveWithdrawalTransactionInputs(_tx);
// Create the output root proof
Types.OutputRootProof memory proof = Types.OutputRootProof({
version: bytes32(uint256(0)),
stateRoot: stateRoot,
...
...
@@ -1013,25 +1023,28 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
vm.mockCall(
address(oracle),
abi.encodeWithSelector(oracle.getL2Output.selector),
abi.encode(outputRoot, 0)
abi.encode(outputRoot,
block.timestamp, 10
0)
);
// Start the withdrawal, it must be initiated by the _sender and the
// correct value must be passed along
vm.deal(_tx.sender, _tx.value);
vm.prank(_tx.sender);
messagePasser.initiateWithdrawal{ value: _tx.value }(_tx.target, _tx.gasLimit, _tx.data);
// Ensure that the sentMessages is correct
assertEq(messagePasser.sentMessages(withdrawalHash), true);
vm.warp(block.timestamp + oracle.FINALIZATION_PERIOD_SECONDS() + 1);
// Prove the withdrawal transaction
op.proveWithdrawalTransaction(
_tx,
100, // l2BlockNumber
proof,
withdrawalProof
);
(bytes32 _root, , ) = op.provenWithdrawals(withdrawalHash);
assertTrue(_root != bytes32(0));
// Warp past the finalization period
vm.warp(block.timestamp + oracle.FINALIZATION_PERIOD_SECONDS() + 1);
uint256 targetBalanceBefore = _target.balance;
// Finalize the withdrawal transaction
vm.expectCallMinGas(_tx.target, _tx.value, uint64(_tx.gasLimit), _tx.data);
op.finalizeWithdrawalTransaction(_tx);
assertTrue(op.finalizedWithdrawals(withdrawalHash));
}
}
...
...
packages/contracts-bedrock/contracts/test/invariants/CrossDomainMessenger.t.sol
View file @
1ce4fdf3
...
...
@@ -124,14 +124,18 @@ contract XDM_MinGasLimits is Messenger_Initializer {
* contract.
*/
function invariant_minGasLimits() public {
uint256 length = actor.numHashes();
for (uint256 i = 0; i < length; ++i) {
bytes32 hash = actor.hashes(i);
// the message hash is in the successfulMessages mapping
assertTrue(L1Messenger.successfulMessages(hash));
// it is not in the received messages mapping
assertFalse(L1Messenger.failedMessages(hash));
}
assertFalse(actor.reverted());
///////////////////////////////////////////////////////////////////
// ~ DEV ~ //
// This test is temporarily disabled, it is being fixed in #5470 //
///////////////////////////////////////////////////////////////////
// uint256 length = actor.numHashes();
// for (uint256 i = 0; i < length; ++i) {
// bytes32 hash = actor.hashes(i);
// // the message hash is in the successfulMessages mapping
// assertTrue(L1Messenger.successfulMessages(hash));
// // it is not in the received messages mapping
// assertFalse(L1Messenger.failedMessages(hash));
// }
// assertFalse(actor.reverted());
}
}
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