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

feat(scripts): adds an easy way to start/stop protocol locally #13502

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
985a54a
fix networks file path
clemsos Jan 8, 2024
6c8634d
postgres fix for graph node
clemsos Jan 11, 2024
8d79de6
fix env file
clemsos Mar 14, 2024
98d8c1f
fix locally run stack
clemsos Mar 14, 2024
9b0e8d4
basic `yarn start` for the whole repo
clemsos Mar 14, 2024
162d0d1
lcolahost network on the flight
clemsos Mar 14, 2024
82e89ab
yarn stop/start
clemsos Mar 14, 2024
04c70c5
better logs and shutdown
clemsos Mar 14, 2024
d938750
use version 13 for now
clemsos Mar 14, 2024
84682ed
revert subgraph version change - moved to #13501
clemsos Mar 21, 2024
055c1ed
spli into several scripts
clemsos Mar 21, 2024
f7e892f
use scripts in integration tests
clemsos Mar 21, 2024
716fad5
remove duplicate command
clemsos Mar 21, 2024
84bde31
split infra and apps scripts
clemsos Mar 21, 2024
45fb848
add simple logs command
clemsos Mar 21, 2024
29d585e
simplify local test
clemsos Mar 21, 2024
f7053cb
simplify test run
clemsos Mar 21, 2024
761b0ea
feat(hardhat-plugin): remove needs for fs-extra
clemsos Mar 21, 2024
eb95673
copy packages to eth-node (fix #13498)
clemsos May 7, 2024
2f51919
copy packages to eth-node (fix #13498)
clemsos Mar 21, 2024
e61eaef
use yarn node-modules
clemsos Mar 21, 2024
898b837
integration tests deploy latest versions
clemsos Mar 21, 2024
c7f0b08
check eth-node .yarn folder
clemsos Mar 21, 2024
bf4de74
use infra script in tests
clemsos Mar 21, 2024
fc71038
remove run dockerized
clemsos Mar 21, 2024
f2b5e17
source env vars
clemsos Mar 21, 2024
d4cbe43
use relative path
clemsos Mar 22, 2024
0d65e25
ignore networks file
clemsos May 7, 2024
3df2550
bring back pg args
clemsos May 7, 2024
b4321bb
rebuild packages on start
clemsos May 7, 2024
4f7834b
hh plugin: check if network
clemsos May 7, 2024
fbc2ccc
bring back hardhat plugin
clemsos May 7, 2024
ec7035f
contracts: build docs only on prepublish
clemsos May 7, 2024
55b6c0c
Merge branch 'master' of github.com:unlock-protocol/unlock into start…
clemsos May 7, 2024
10d3e92
de-dockerize integration tests
clemsos May 7, 2024
054cdfb
add prepare repo integration steps
clemsos May 7, 2024
a7cce73
tests uses node 20
clemsos May 7, 2024
3e03e4d
Merge branch 'master' into start-stop-protocol
clemsos May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/_tests.yml
Expand Up @@ -54,6 +54,11 @@ jobs:
BUILDKIT_PROGRESS: plain
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Prepare repo
run: yarn && yarn build
- name: Run Integration Tests
run: scripts/integration-tests.sh
- name: Archive production artifacts
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -38,3 +38,6 @@ yarn-error.log
.netlify
.vercel
governance/.openzeppelin/unknown-31337.json

# log files
nohup.out
4 changes: 3 additions & 1 deletion docker/development/eth-node/.dockerignore
@@ -1,3 +1,5 @@
node_modules
**/node_modules
cache
.yarn
.yarn/cache
.yarn/install-state.gz
18 changes: 16 additions & 2 deletions docker/development/eth-node/.gitignore
@@ -1,3 +1,17 @@
# local deps
packages
networks.json

# contracts
cache
.yarn
networks.json

# yarn
.yarn/*
.yarn/install-state.gz
.pnp.js
# !.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
893 changes: 893 additions & 0 deletions docker/development/eth-node/.yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docker/development/eth-node/.yarnrc.yml
@@ -0,0 +1,2 @@
yarnPath: .yarn/releases/yarn-4.1.1.cjs
nodeLinker: node-modules
7 changes: 5 additions & 2 deletions docker/development/eth-node/Dockerfile
Expand Up @@ -11,10 +11,13 @@ WORKDIR /app
# install deps
COPY --chown=node package.json package.json
COPY --chown=node yarn.lock yarn.lock
RUN yarn install --pure-lockfile
COPY --chown=node .yarn .yarn
COPY --chown=node .yarnrc.yml .yarnrc.yml

# add files
COPY --chown=node . .

RUN yarn

EXPOSE 8545
CMD [ "yarn", "hardhat", "node", "--hostname", "0.0.0.0" ]
CMD [ "yarn", "hardhat", "node", "--hostname", "0.0.0.0" ]
13 changes: 11 additions & 2 deletions docker/development/eth-node/package.json
Expand Up @@ -3,17 +3,26 @@
"description": "Simple ETH node for development purposes",
"private": true,
"scripts": {
"packages:clean": "yarn packages --parallel run clean",
"packages:build": "yarn packages --topological-dev run build",
"build": "yarn packages:clean && yarn packages:build",
"lint:fix": "yarn lint --fix",
"lint": "eslint --resolve-plugins-relative-to ../eslint-config --ext .tsx,.ts,.js scripts/",
"packages": "yarn workspaces foreach --recursive --from '{@unlock-protocol/types,@unlock-protocol/core,@unlock-protocol/eslint-config,@unlock-protocol/hardhat-helpers,@unlock-protocol/express,@unlock-protocol/contracts,@unlock-protocol/networks,@unlock-protocol/paywall,@unlock-protocol/unlock-js,@unlock-protocol/crypto-icon,@unlock-protocol/ui,@unlock-protocol/hardhat-plugin,@unlock-protocol/email-templates}'",
"provision": "hardhat run scripts/provision.ts",
"start": "hardhat node"
},
"workspaces": [
"packages/**"
],
"dependencies": {
"@nomicfoundation/hardhat-ethers": "3.0.5",
"@unlock-protocol/contracts": "latest",
"@unlock-protocol/hardhat-plugin": "latest",
"@unlock-protocol/contracts": "workspace:^",
"@unlock-protocol/hardhat-plugin": "workspace:^",
"@unlock-protocol/networks": "workspace:^",
"eslint": "8.57.0",
"ethers": "6.10.0",
"fs-extra": "11.2.0",
"hardhat": "2.22.3",
"hardhat-erc1820": "0.1.0",
"ts-node": "10.9.2",
Expand Down
11 changes: 8 additions & 3 deletions docker/development/eth-node/scripts/provision.ts
Expand Up @@ -76,7 +76,13 @@ async function main() {
* 3. Deploy UNLOCK contracts
*/
const { unlock: unlockContract } = await unlock.deployProtocol()
log('UNLOCK PROTOCOL DEPLOYED')
const [publicLockVersion, unlockVersion] = await Promise.all([
await unlockContract.publicLockLatestVersion(),
await unlockContract.unlockVersion(),
])
log(
`UNLOCK PROTOCOL DEPLOYED : Unlock v${unlockVersion}, PublicLock v${publicLockVersion}`
)

// grant Unlock minting permissions
await udt.addMinter(await unlockContract.getAddress())
Expand All @@ -100,8 +106,7 @@ async function main() {
// Finally, deploy locks and for each of them, if it's an ERC20, approve it for locksmith purchases
await Promise.all(
locksArgs(erc20Address).map(async (lockParams) => {
const { lock } = await unlock.createLock(lockParams)

const { lock } = await unlock.createLock({ ...lockParams })
log(
`LOCK "${await lockParams.name}" DEPLOYED TO ${await lock.getAddress()}`
)
Expand Down