Skip to content

Introduces fast forwarding in L2 integration tests #1343

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 35 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
db25332
Basic fast forwarding in L2 integration tests
eternauta1337 Jun 17, 2021
5fc2d94
Replaced 'ignore' utils with fast forwarding in integration tests
eternauta1337 Jun 17, 2021
9e82766
Clean install
eternauta1337 Jun 17, 2021
b9979f0
Merge branch 'develop' into ops-time-shifting
eternauta1337 Jun 17, 2021
270f786
Undo changes to package lock file
eternauta1337 Jun 17, 2021
169a6ec
Pin ops version
eternauta1337 Jun 17, 2021
3982c9c
Merge branch 'develop' into ops-time-shifting
eternauta1337 Jun 17, 2021
d01c401
Avoid redundant heartbeats
eternauta1337 Jun 17, 2021
9070bb7
Fix and improve integration tests
eternauta1337 Jun 18, 2021
f8be473
Merge branch 'develop' into ops-time-shifting
eternauta1337 Jun 18, 2021
e923917
Add comment to test
eternauta1337 Jun 18, 2021
04bf5d5
Update ops image
eternauta1337 Jun 18, 2021
da83c20
Clear ops cache in CI
eternauta1337 Jun 18, 2021
660f22a
Update watchers dep
eternauta1337 Jun 18, 2021
4383a04
Hotfix for Optimism watchers
eternauta1337 Jun 18, 2021
3f06e2a
Clean install
eternauta1337 Jun 18, 2021
9e43f2f
Update to hardhat 2.3.x
eternauta1337 Jun 18, 2021
d0f5c18
Clear ops tool cache
eternauta1337 Jun 18, 2021
6c7a131
Unpin ops
eternauta1337 Jun 18, 2021
6447ec6
Merge branch 'develop' of github.com:Synthetixio/synthetix into ops-t…
eternauta1337 Jun 18, 2021
e09f90a
Update ops cache
eternauta1337 Jun 18, 2021
cb4bc09
Attach ops output
eternauta1337 Jun 18, 2021
3c4949c
Debugging Optimism messenger watchers
eternauta1337 Jun 21, 2021
1f74911
Listen to interactions with messenger on blocks
eternauta1337 Jun 21, 2021
50f2ba2
Keep withdraw tests open
eternauta1337 Jun 21, 2021
582181d
Implementing a completely patched ops watcher
eternauta1337 Jun 22, 2021
b703e7a
Tidy ups
eternauta1337 Jun 22, 2021
d6b9a45
remove only in tests
eternauta1337 Jun 22, 2021
a982309
Disabled ops cache
eternauta1337 Jun 22, 2021
089f39b
Restored ops caching
eternauta1337 Jun 22, 2021
cd265cf
Quiet
eternauta1337 Jun 22, 2021
e1f0be6
Bugfix
eternauta1337 Jun 22, 2021
d8ba29f
Debug optimism in l2 standalone integration tests
eternauta1337 Jun 22, 2021
d2006c0
Merge branch 'develop' of github.com:Synthetixio/synthetix into ops-t…
eternauta1337 Jun 22, 2021
56a537f
Cleanups
eternauta1337 Jun 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ jobs:
at: .
- restore_cache:
keys:
- optimism-build
- v2-optimism-build-
- run:
name: Build docker containers if necessary
command: |
if [ ! -d ./optimism ]; then
npx hardhat ops --fresh --build --build-ops --optimism-path ./optimism
npx hardhat ops --fresh --build --build-ops
fi;
- save_cache:
key: optimism-build
key: v2-optimism-build-
paths:
- ./optimism
- run:
name: Start docker chains
background: true
command: |
npx hardhat ops --start --optimism-path ./optimism
npx hardhat ops --start
- cmd-wait-for-port:
port: 8545
- cmd-wait-for-port:
Expand Down
8 changes: 4 additions & 4 deletions .circleci/src/jobs/job-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ steps:
at: .
- restore_cache:
keys:
- optimism-build
- v2-optimism-build-{{ checksum "package-lock.json" }}
- run:
name: Build docker containers if necessary
command: |
if [ ! -d ./optimism ]; then
npx hardhat ops --fresh --build --build-ops --optimism-path ./optimism
npx hardhat ops --fresh --build --build-ops
fi;
- save_cache:
key: optimism-build
key: v2-optimism-build-{{ checksum "package-lock.json" }}
paths:
- ./optimism
- run:
name: Start docker chains
background: true
command: |
npx hardhat ops --start --optimism-path ./optimism
npx hardhat ops --start
- cmd-wait-for-port:
port: 8545
- cmd-wait-for-port:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ process.yml
*.csv

.db

optimism
24 changes: 15 additions & 9 deletions hardhat/tasks/task-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ task('ops', 'Run Optimism chain')
.addFlag('start', 'Start the latest build')
.addFlag('stop', 'Stop optimism chain')
.addFlag('detached', 'Detach the chain from the console')
.addOptionalParam('optimismPath', 'Path to optmism repository folder', '~/optimism')
.addOptionalParam('optimismPath', 'Path to optmism repository folder', './optimism')
.addOptionalParam('optimismBranch', 'Branch to checkout', 'master')
.addOptionalParam(
'optimismCommit',
'Commit to checkout',
undefined // Define here to pin to that specific commit
'd9fd67d2502a590e116ffdb6c1c53003a045e318'
)
.setAction(async (taskArguments, hre, runSuper) => {
taskArguments.maxMemory = true;

const opsPath = taskArguments.optimismPath.replace('~', homedir);
const opsBranch = 'regenesis/0.4.0';
const opsCommit = taskArguments.optimismCommit;
const opsDetached = taskArguments.detached ? '-d' : '';

console.log(gray('optimism branch:', opsBranch));
console.log(gray('optimism commit:', opsCommit));
console.log(gray('optimism folder:', opsPath));

if (taskArguments.stop) {
Expand All @@ -55,14 +61,14 @@ task('ops', 'Run Optimism chain')
_fresh({ opsPath });
}

_build({ opsPath, opsCommit });
_build({ opsPath, opsCommit, opsBranch });
}

if (taskArguments.buildOps || (taskArguments.fresh && taskArguments.start)) {
console.log(yellow('building ops'));
if (!fs.existsSync(opsPath)) {
_fresh({ opsPath });
_build({ opsPath, opsCommit });
_build({ opsPath, opsCommit, opsBranch });
}
_buildOps({ opsPath });
}
Expand All @@ -76,10 +82,10 @@ task('ops', 'Run Optimism chain')

if (!fs.existsSync(opsPath)) {
_fresh({ opsPath });
_build({ opsPath, opsCommit });
_build({ opsPath, opsCommit, opsBranch });
_buildOps({ opsPath });
} else if (!_imagesExist()) {
_build({ opsPath, opsCommit });
_build({ opsPath, opsCommit, opsBranch });
_buildOps({ opsPath });
}
await _start({ opsPath, opsDetached });
Expand Down Expand Up @@ -135,11 +141,11 @@ function _fresh({ opsPath }) {
]);
}

function _build({ opsPath, opsCommit }) {
function _build({ opsPath, opsCommit, opsBranch }) {
console.log(gray(' checkout commit:', opsCommit));
execa.sync('sh', ['-c', `cd ${opsPath} && git fetch `]);
execa.sync('sh', ['-c', `cd ${opsPath} && git checkout master `]);
execa.sync('sh', ['-c', `cd ${opsPath} && git pull origin master `]);
execa.sync('sh', ['-c', `cd ${opsPath} && git checkout ${opsBranch} `]);
execa.sync('sh', ['-c', `cd ${opsPath} && git pull origin ${opsBranch} `]);
if (opsCommit) {
execa.sync('sh', ['-c', `cd ${opsPath} && git checkout ${opsCommit}`]);
}
Expand Down
16 changes: 13 additions & 3 deletions hardhat/tasks/task-test-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ task('test:integration:l1', 'run isolated layer 1 production tests')
});

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')
.setAction(async (taskArguments, hre) => {
hre.config.paths.tests = './test/integration/l2/';
hre.config.debugOptimism = taskArguments.debugOptimism;

_commonIntegrationTestSettings({ hre, taskArguments });

const providerUrl = (hre.config.providerUrl = 'http://localhost');
const providerPort = (hre.config.providerPort = '8545');
hre.config.providerPortL1 = '9545';
const providerPortL2 = (hre.config.providerPortL2 = '8545');
const useOvm = true;
const buildPath = path.join(__dirname, '..', '..', `${BUILD_FOLDER}-ovm`);

Expand All @@ -74,7 +77,7 @@ task('test:integration:l2', 'run isolated layer 2 production tests')
await deployInstance({
useOvm,
providerUrl,
providerPort,
providerPort: providerPortL2,
buildPath,
});
}
Expand All @@ -83,10 +86,12 @@ task('test:integration:l2', 'run isolated layer 2 production tests')
});

task('test:integration:dual', 'run integrated layer 1 and layer 2 production tests')
.addFlag('debugOptimism', 'Debug Optimism activity')
.addFlag('compile', 'Compile the l1 instance before running the tests')
.addFlag('deploy', 'Deploy the l1 instance before running the tests')
.setAction(async (taskArguments, hre) => {
hre.config.paths.tests = './test/integration/dual/';
hre.config.debugOptimism = taskArguments.debugOptimism;

_commonIntegrationTestSettings({ hre, taskArguments });

Expand Down Expand Up @@ -117,7 +122,12 @@ task('test:integration:dual', 'run integrated layer 1 and layer 2 production tes
});
}

await connectInstances({ providerUrl, providerPortL1, providerPortL2 });
await connectInstances({
providerUrl,
providerPortL1,
providerPortL2,
quiet: !taskArguments.debugOptimism,
});

await hre.run('test', taskArguments);
});
Expand Down
Loading