-
Notifications
You must be signed in to change notification settings - Fork 606
Optimism Forking with Hardhat #1656
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3f78a06
add support
dbeal-eth 05769a1
fork tests are mostly working, but some tests fail for misc reasons
dbeal-eth 63d2d06
test on ci
dbeal-eth 390ceee
progress
dbeal-eth 569e345
Merge remote-tracking branch 'origin/develop' into hardhat-fork-optimism
dbeal-eth a1566b2
more fixes
dbeal-eth b1c363c
fixes for ci
dbeal-eth 6fb9e1e
fork tests ovm was msising from the mix
dbeal-eth ac6775f
fix infura key and ports
dbeal-eth e5b1bb1
reset deployment files
dbeal-eth e3909f0
Merge branch 'develop' into hardhat-fork-optimism
jjgonecrypto 0ddab60
have to fix the build path
dbeal-eth 8f42493
Merge branch 'hardhat-fork-optimism' of https://github.com/Synthetixi…
dbeal-eth ac40e49
add fixes
dbeal-eth a21fe89
fix WrapperFactory fail
dbeal-eth 672bbbb
grr
dbeal-eth a306e66
fix build path for dual tests
dbeal-eth d591388
Merge branch 'develop' into hardhat-fork-optimism
jjgonecrypto 60ceac1
fix deployer once again
dbeal-eth 08b1355
Merge branch 'hardhat-fork-optimism' of https://github.com/Synthetixi…
dbeal-eth 67c1c3c
fix final comments, change to use fork checks for skip
dbeal-eth 205594e
fix fork things again
dbeal-eth 950d018
going in circles
dbeal-eth a5d9530
apparently can't use arrow func
dbeal-eth 7702c03
Merge branch 'develop' into hardhat-fork-optimism
jjgonecrypto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Starts a fork of OVM, deploys the latest release, and runs L2 integration tests | ||
{{> job-header-node.yml}} | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
command: npm run fork:ovm | ||
background: true | ||
- cmd-wait-for-port: | ||
port: 8545 | ||
- run: | ||
name: Run integration tests on l2 | ||
command: | | ||
# Only compile and deploy when there are new contracts | ||
NEW_CONTRACTS=$(node bin.js sips --layer=base --unreleased --with-sources) | ||
if [ -z "$NEW_CONTRACTS" ]; then | ||
npx hardhat test:integration:l2 --use-fork | ||
else | ||
npx hardhat test:integration:l2 --compile --deploy --use-sips --use-fork | ||
fi; |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,13 @@ task('test:integration:l2', 'run isolated layer 2 production tests') | |
.addFlag('debugOptimism', 'Debug Optimism activity') | ||
.addFlag('compile', 'Compile an l2 instance before running the tests') | ||
.addFlag('deploy', 'Deploy an l2 instance before running the tests') | ||
.addFlag('useSips', 'Use sources from SIPs directly, instead of releases') | ||
.addFlag('useFork', 'Run the tests against a fork of mainnet') | ||
.addOptionalParam( | ||
'providerPort', | ||
'The target port for the running local chain to test on', | ||
'8545' | ||
) | ||
.setAction(async (taskArguments, hre) => { | ||
hre.config.paths.tests = './test/integration/l2/'; | ||
hre.config.debugOptimism = taskArguments.debugOptimism; | ||
|
@@ -89,25 +96,47 @@ task('test:integration:l2', 'run isolated layer 2 production tests') | |
|
||
const providerUrl = (hre.config.providerUrl = 'http://localhost'); | ||
hre.config.providerPortL1 = '9545'; | ||
const providerPortL2 = (hre.config.providerPortL2 = '8545'); | ||
const providerPortL2 = (hre.config.providerPortL2 = taskArguments.providerPort); | ||
const useOvm = true; | ||
const buildPath = path.join(__dirname, '..', '..', `${BUILD_FOLDER}-ovm`); | ||
const buildPath = path.join(__dirname, '..', '..', BUILD_FOLDER); | ||
|
||
if (taskArguments.compile) { | ||
await compileInstance({ useOvm, buildPath }); | ||
} | ||
if (taskArguments.useFork) { | ||
hre.config.fork = true; | ||
} | ||
|
||
if (taskArguments.deploy) { | ||
const network = 'local'; | ||
await prepareDeploy({ network, synthsToAdd, useOvm }); | ||
await deployInstance({ | ||
addNewSynths: true, | ||
buildPath, | ||
network, | ||
providerPort: providerPortL2, | ||
providerUrl, | ||
useOvm, | ||
}); | ||
if (taskArguments.useFork) { | ||
await prepareDeploy({ | ||
network: 'mainnet', | ||
synthsToAdd, | ||
useOvm, | ||
useSips: taskArguments.useSips, | ||
}); | ||
await deployInstance({ | ||
addNewSynths: true, | ||
buildPath, | ||
freshDeploy: false, | ||
network: 'mainnet', | ||
providerPort: providerPortL2, | ||
providerUrl, | ||
useFork: true, | ||
useOvm, | ||
}); | ||
} else { | ||
const network = 'local'; | ||
await prepareDeploy({ network, synthsToAdd, useOvm, useReleases: false, useSips: false }); | ||
await deployInstance({ | ||
addNewSynths: true, | ||
buildPath, | ||
network, | ||
providerPort: providerPortL2, | ||
providerUrl, | ||
useOvm, | ||
}); | ||
} | ||
hre.config.addedSynths = synthsToAdd; | ||
} | ||
|
||
|
@@ -127,27 +156,25 @@ task('test:integration:dual', 'run integrated layer 1 and layer 2 production tes | |
const providerUrl = (hre.config.providerUrl = 'http://localhost'); | ||
const providerPortL1 = (hre.config.providerPortL1 = '9545'); | ||
const providerPortL2 = (hre.config.providerPortL2 = '8545'); | ||
const buildPathEvm = path.join(__dirname, '..', '..', BUILD_FOLDER); | ||
const buildPathOvm = path.join(__dirname, '..', '..', `${BUILD_FOLDER}-ovm`); | ||
const buildPath = path.join(__dirname, '..', '..', BUILD_FOLDER); | ||
|
||
if (taskArguments.compile) { | ||
await compileInstance({ useOvm: false, buildPath: buildPathEvm }); | ||
await compileInstance({ useOvm: true, buildPath: buildPathOvm }); | ||
await compileInstance({ useOvm: false, buildPath: buildPath }); | ||
} | ||
|
||
if (taskArguments.deploy) { | ||
await deployInstance({ | ||
useOvm: false, | ||
providerUrl, | ||
providerPort: providerPortL1, | ||
buildPath: buildPathEvm, | ||
buildPath: buildPath, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [np] can just use |
||
}); | ||
|
||
await deployInstance({ | ||
useOvm: true, | ||
providerUrl, | ||
providerPort: providerPortL2, | ||
buildPath: buildPathOvm, | ||
buildPath: buildPath, | ||
}); | ||
} | ||
|
||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.