-
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 2 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 |
---|---|---|
|
@@ -5,3 +5,4 @@ export.json | |
export/ | ||
gen/ | ||
typechain/ | ||
deployments/ | ||
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -11,14 +11,14 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | |||||||||||
const { log } = deployments | ||||||||||||
const { deployer } = await getNamedAccounts() | ||||||||||||
|
||||||||||||
const mezoPortal = await deployments.getOrNull("MezoPortal") | ||||||||||||
let mezoPortal = await deployments.getOrNull("MezoPortal") | ||||||||||||
if (hre.network.name === "integration") { | ||||||||||||
mezoPortal = await deployments.getArtifact("MezoPortal") | ||||||||||||
} | ||||||||||||
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. If we use
Suggested change
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. |
||||||||||||
|
||||||||||||
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" | ||||||||||||
) { | ||||||||||||
} else if ((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. For integration tests we want the script to fail if the deployment artifact is not found, we need to make sure it doesn't deploy the stub.
Suggested change
We should also introduce a similar change in other scripts. 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. |
||||||||||||
throw new Error("deployed MezoPortal contract not found") | ||||||||||||
} else { | ||||||||||||
log("deploying Mezo Portal contract stub") | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { | |
} else { | ||
log("deploying TBTCVault contract stub") | ||
|
||
const tbtc = await deployments.get("TBTC") | ||
let tbtc = await deployments.getOrNull("TBTC") | ||
if (hre.network.name === "integration") { | ||
tbtc = await deployments.getArtifact("TBTC") | ||
} | ||
|
||
const bridge = await deployments.get("Bridge") | ||
|
||
const deployment = await deployments.deploy("TBTCVault", { | ||
|
@@ -34,12 +38,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 | ||
---|---|---|---|---|
|
@@ -29,6 +29,10 @@ const config: HardhatUserConfig = { | |||
hardhat: { | ||||
tags: ["allowStubs"], | ||||
}, | ||||
integration: { | ||||
url: "http://localhost:8545", | ||||
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. I believe we could remove this tag.
Suggested change
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. |
||||
}, | ||||
sepolia: { | ||||
url: process.env.CHAIN_API_URL || "", | ||||
chainId: 11155111, | ||||
|
@@ -48,9 +52,18 @@ const config: HardhatUserConfig = { | |||
}, | ||||
|
||||
external: { | ||||
contracts: | ||||
process.env.INTEGRATION_TEST === "true" | ||||
? [ | ||||
{ | ||||
artifacts: "./external/mainnet", | ||||
}, | ||||
] | ||||
: undefined, | ||||
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 it if we add 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. |
||||
deployments: { | ||||
sepolia: ["./external/sepolia"], | ||||
mainnet: ["./external/mainnet"], | ||||
integration: ["./external/mainnet"], | ||||
}, | ||||
}, | ||||
|
||||
|
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": "INTEGRATION_TEST=true hardhat test ./test/integration/*.test.ts --network integration" | ||||||
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. If we add
Suggested change
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. That's nice, way cleaner! 718a723 |
||||||
}, | ||||||
"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.
Let's ignore only the specific network artifacts (
deployments/integration/
), as we don't want to ignoredeployments/mainnet/
anddeployments/sepolia/
directories.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.
After I ran the tests locally I noticed there was no output under the
deployments/
directory. Maybe we don't need this entry added to.gitignore
at all?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.
You're right, turns out it's not needed 2e88d5d. Must've been a leftover after some changes during implementation. Removed.