Skip to content
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

Add publish testable scripts #1769

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ To prepare for system upgrades, this repository is used to release new versions

- Ensure you have the latest version of [Cannon](https://usecannon.com) installed: `@usecannon/cli` and `hardhat-cannon` are upgraded to the latest through the repository (use `yarn upgrade-interactive` command).
- After installing for the first time, run `yarn cannon:setup` to configure IPFS and a reliable RPC endpoint to communicate with the Cannon package registry.
- Unless `npm whoami` returns an npm account with publishing permissions for the `@synthetixio` organization, confirm an `@synthetixio` npm publishing key is set as `$NPM_TOKEN` in the `.env` file.
- Unless `npm whoami` returns an npm account with publishing permissions for the `@synthetixio` organization, confirm a `@synthetixio` npm publishing key is set as `$NPM_TOKEN` in the `.env` file.
- Confirm you are on the `main` branch and there are no git changes `git diff --exit-code .`
- Publish the release with `yarn publish:dev` for the pre-release (no git tag, version looks like `1.2.3-<GIT_SHA>.0`)> and `yarn publish:release` for the proper semver release.
- If you aren't using [Frame](https://frame.sh/), prepend `CANNON_REGISTRY_PROVIDER_URL=<MAINNET_RPC> CANNON_PRIVATE_KEY=<PRIVATE_KEY>` to the commands above.
- In case Cannon publish fails you can run `yarn publish-contracts` in the root to retry publishing all Cannon packages. Or run `yarn publish-contracts` in each failed package separately.
- In all of the package.json files, revert dependencies' version changes back to "workspaces:*"` (leaving the change to `gitHead`, if applicable), commit, and push.
- In case Cannon publish fails you can run `yarn publish-contracts` (and/or `yarn publish-testable`) in the root to retry publishing all Cannon packages. Or run `yarn publish-contracts` (and/or `yarn publish-testable`) in each failed package separately.
- In all package.json files, revert dependencies' version changes back to "workspaces:*"` (leaving the change to `gitHead`, if applicable), commit, and push.
8 changes: 4 additions & 4 deletions markets/perps-market/cannonfile.test.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "synthetix-perps-market"
version = "<%= package.version %>-testable"
name = "synthetix-perps-market-testable"
version = "<%= package.version %>"
description = "Perps market implementation"

[setting.coreProxyOwner]
Expand All @@ -11,10 +11,10 @@ description = "perps market owner"
defaultValue = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"

[setting.synthetixPackage]
defaultValue = "synthetix:<%= package.version %>-testable"
defaultValue = "synthetix-testable:<%= package.version %>"

[setting.spotMarketPackage]
defaultValue = "synthetix-spot-market:<%= package.version %>-testable"
defaultValue = "synthetix-spot-market-testable:<%= package.version %>"

[import.synthetix]
source = "<%= settings.synthetixPackage %>"
Expand Down
3 changes: 2 additions & 1 deletion markets/perps-market/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"coverage1": "hardhat coverage --network hardhat",
"compile-contracts": "hardhat compile",
"publish-contracts": "yarn build && cannon publish synthetix-perps-market:$(node -p 'require(`./package.json`).version') --quiet",
"publish-testable": "yarn build-testable && cannon publish synthetix-perps-market-testable:$(node -p 'require(`./package.json`).version') --quiet",
"size-contracts": "hardhat compile && hardhat size-contracts",
"postpack": "yarn publish-contracts",
"postpack": "yarn publish-contracts && yarn publish-testable",
"docgen": "hardhat docgen"
},
"keywords": [],
Expand Down
6 changes: 3 additions & 3 deletions markets/spot-market/cannonfile.test.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "synthetix-spot-market"
version = "<%= package.version %>-testable"
name = "synthetix-spot-market-testable"
version = "<%= package.version %>"
description = "Spot market implementation"

[setting.coreProxyOwner]
Expand All @@ -11,7 +11,7 @@ description = "spot market owner"
defaultValue = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"

[setting.synthetixPackage]
defaultValue = "synthetix:<%= package.version %>-testable"
defaultValue = "synthetix-testable:<%= package.version %>"

[import.synthetix]
source = "<%= settings.synthetixPackage %>"
Expand Down
3 changes: 2 additions & 1 deletion markets/spot-market/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"coverage1": "hardhat coverage --network hardhat",
"compile-contracts": "hardhat compile",
"publish-contracts": "yarn build && cannon publish synthetix-spot-market:$(node -p 'require(`./package.json`).version') --quiet",
"publish-testable": "yarn build-testable && cannon publish synthetix-spot-market-testable:$(node -p 'require(`./package.json`).version') --quiet",
"size-contracts": "hardhat compile && hardhat size-contracts",
"postpack": "yarn publish-contracts",
"postpack": "yarn publish-contracts && yarn publish-testable",
"docgen": "hardhat docgen"
},
"keywords": [],
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"scripts": {
"clean": "yarn workspaces foreach --parallel --verbose run clean",
"build-prerelease-dev": "git diff --exit-code && yarn lerna exec -- npm version prepatch --no-git-tag-version --no-workspaces-update && yarn && yarn build && git stash && yarn",
"build-testable": "yarn workspaces foreach --topological-dev --verbose run build-testable",
"build": "yarn workspaces foreach --topological-dev --verbose run build",
"test": "yarn workspaces foreach --parallel --verbose run test",
"coverage": "yarn workspaces foreach --verbose run coverage",
Expand All @@ -36,6 +37,7 @@
"publish:release": "lerna publish --force-publish",
"publish:dev": "lerna publish --force-publish --canary --dist-tag dev --preid dev.$(git rev-parse --short HEAD)",
"publish-contracts": "yarn workspaces foreach --verbose run publish-contracts",
"publish-testable": "yarn workspaces foreach --topological-dev --verbose run publish-testable",
"prepublishOnly": "node ./prepublishOnly.js",
"docgen": "yarn workspaces foreach --verbose run docgen && yarn docgen:contracts",
"docgen:contracts": "yarn workspace @synthetixio/docgen docgen:contracts",
Expand Down
3 changes: 2 additions & 1 deletion protocol/oracle-manager/cannonfile.test.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version = "<%= package.version %>-testable"
name = "oracle-manager-testable"
version = "<%= package.version %>"

include = [
"cannonfile.toml"
Expand Down
1 change: 1 addition & 0 deletions protocol/oracle-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"compile-contracts": "hardhat compile",
"size-contracts": "hardhat compile && hardhat size-contracts",
"publish-contracts": "yarn build && cannon publish oracle-manager:$(node -p 'require(`./package.json`).version') --quiet",
"publish-testable": "yarn build-testable && cannon publish oracle-manager-testable:$(node -p 'require(`./package.json`).version') --quiet",
"postpack": "yarn publish-contracts",
"docgen": "hardhat docgen"
},
Expand Down
5 changes: 3 additions & 2 deletions protocol/synthetix/cannonfile.test.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# overrides to create a testable deployment of the core system

version = "<%= package.version %>-testable"
name = "synthetix-testable"
version = "<%= package.version %>"

include = [
"cannonfile.toml"
Expand Down Expand Up @@ -166,4 +167,4 @@ args = [[
"0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('createPool'), true]).slice(2) %>",
]]

depends = ["invoke.upgrade_core_proxy"]
depends = ["invoke.upgrade_core_proxy"]
3 changes: 2 additions & 1 deletion protocol/synthetix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"compile-contracts": "hardhat compile",
"size-contracts": "hardhat compile && hardhat size-contracts",
"publish-contracts": "yarn build && cannon publish synthetix:$(node -p 'require(`./package.json`).version') --quiet",
"postpack": "yarn publish-contracts",
"publish-testable": "yarn build-testable && cannon publish synthetix-testable:$(node -p 'require(`./package.json`).version') --quiet",
"postpack": "yarn publish-contracts && yarn publish-testable",
"docgen": "hardhat docgen"
},
"keywords": [],
Expand Down