-
Notifications
You must be signed in to change notification settings - Fork 2
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
Integration tests against Mezo Portal #372
Changes from 6 commits
e07a9e3
f7293bd
2e88d5d
718a723
0a2a2d8
0ced354
32062d6
962d173
bfe755c
e221554
ce77495
8c94145
f68e51f
90f1e64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -16,8 +16,8 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | |||||||
if (mezoPortal && isNonZeroAddress(mezoPortal.address)) { | ||||||||
log(`using MezoPortal contract at ${mezoPortal.address}`) | ||||||||
} else if ( | ||||||||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled && | ||||||||
hre.network.name !== "hardhat" | ||||||||
hre.network.name === "integration" || | ||||||||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled | ||||||||
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. Since we're not using hardhat forking network and we want the stubs to be deployed only for unit tests maybe we could modify this check in all deployment scripts and throw the error when
Suggested change
This way the stub will be deployed only for 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. We certainly can do that 962d173 |
||||||||
) { | ||||||||
throw new Error("deployed MezoPortal contract not found") | ||||||||
} else { | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | |
if (tbtc && isNonZeroAddress(tbtc.address)) { | ||
log(`using TBTC contract at ${tbtc.address}`) | ||
} else if ( | ||
hre.network.name === "integration" || | ||
!hre.network.tags.allowStubs || | ||
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. We could remove the 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. |
||
(hre.network.config as HardhatNetworkConfig)?.forking?.enabled | ||
) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,12 +34,14 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | |
waitConfirmations: waitConfirmationsNumber(hre), | ||
}) | ||
|
||
await deployments.execute( | ||
"TBTC", | ||
{ from: deployer, log: true }, | ||
"setOwner", | ||
deployment.address, | ||
) | ||
if (hre.network.name === "hardhat") { | ||
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. We're in the 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. |
||
await deployments.execute( | ||
"TBTC", | ||
{ from: deployer, log: true }, | ||
"setOwner", | ||
deployment.address, | ||
) | ||
} | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
"scripts": { | ||
"clean": "hardhat clean && rm -rf cache/ export/ gen/ export.json", | ||
"build": "hardhat compile", | ||
"deploy": "hardhat deploy --export export.json", | ||
"deployment": "hardhat deploy --export export.json", | ||
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. I'd keep 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. It's not me not liking the
Having said that, I figured I change it to 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. It will work if you execute it with 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. Ah, I see, I didn't know that and assumed all the commands are triggered as |
||
"docs": "hardhat docgen", | ||
"format": "npm run lint:js && npm run lint:sol && npm run lint:config", | ||
"format:fix": "npm run lint:js:fix && npm run lint:sol:fix && npm run lint:config:fix", | ||
|
@@ -26,7 +26,8 @@ | |
"lint:sol:fix": "solhint 'contracts/**/*.sol' --fix && prettier --write 'contracts/**/*.sol'", | ||
"lint:config": "prettier --check '**/*.@(json)'", | ||
"lint:config:fix": "prettier --write '**/*.@(json)'", | ||
"test": "hardhat test" | ||
"test": "hardhat test ./test/*.test.ts", | ||
"test:integration": "hardhat test --deploy-fixture ./test/integration/*.test.ts --network integration" | ||
}, | ||
"devDependencies": { | ||
"@keep-network/hardhat-helpers": "^0.7.1", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another idea to simplify setup is to include the node configuration in the hardhat config file and define a script, so to run the node for testing we will only need to run
pnpm run test:node-forking
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not blocking this PR. I'll create a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, that might work. We'll need to provide a key for CHAIN_API_URL because we probably don't want to make it public. Or even assemble everything into one bash script to run the tests like
./scripts/run-integration-tests.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#380