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
bcb6ef90
Unverified
Commit
bcb6ef90
authored
Dec 23, 2024
by
Maurelian
Committed by
GitHub
Dec 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Readability improvements to Setup.sol (#13511)
parent
590fc814
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
Setup.sol
packages/contracts-bedrock/test/setup/Setup.sol
+24
-15
No files found.
packages/contracts-bedrock/test/setup/Setup.sol
View file @
bcb6ef90
...
...
@@ -131,35 +131,44 @@ contract Setup {
/// This is a hack as we are pushing solidity to the edge.
function setUp() public virtual {
console.log("Setup: L1 setup start!");
if (vm.envOr("FORK_TEST", false)) {
string memory forkUrl = vm.envString("FORK_RPC_URL");
_isForkTest = true;
vm.createSelectFork(forkUrl, vm.envUint("FORK_BLOCK_NUMBER"));
// Optimistically etch, label and allow cheatcodes for the Deploy.s.sol contract
vm.etch(address(deploy), vm.getDeployedCode("Deploy.s.sol:Deploy"));
vm.label(address(deploy), "Deploy");
vm.allowCheatcodes(address(deploy));
_isForkTest = vm.envOr("FORK_TEST", false);
if (_isForkTest) {
vm.createSelectFork(vm.envString("FORK_RPC_URL"), vm.envUint("FORK_BLOCK_NUMBER"));
require(
block.chainid == Chains.Sepolia || block.chainid == Chains.Mainnet,
"Setup: ETH_RPC_URL must be set to a production (Sepolia or Mainnet) RPC URL"
);
// Overwrite the Deploy.s.sol contract with the ForkLive.s.sol contract
vm.etch(address(deploy), vm.getDeployedCode("ForkLive.s.sol:ForkLive"));
} else {
vm.etch(address(deploy), vm.getDeployedCode("Deploy.s.sol:Deploy"));
vm.label(address(deploy), "ForkLive");
}
vm.allowCheatcodes(address(deploy));
// deploy.setUp() will either:
// 1. deploy a fresh system or
// 2. fork from L1
// It will then save the appropriate name/address pairs to disk using Artifacts.save()
deploy.setUp();
console.log("Setup: L1 setup done!");
// Return early if this is a fork test
if (_isForkTest) {
console.log("Setup: fork test detected, skipping L2 setup");
} else {
console.log("Setup: fork test detected, skipping L2 genesis generation");
return;
}
console.log("Setup: L2 setup start!");
vm.etch(address(l2Genesis), vm.getDeployedCode("L2Genesis.s.sol:L2Genesis"));
vm.allowCheatcodes(address(l2Genesis));
l2Genesis.setUp();
console.log("Setup: L2 setup done!");
}
}
/// @dev Skips tests when running against a forked production network.
function skipIfForkTest(string memory message) public {
...
...
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