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

chore: transfer tests to era test node #1534

Merged
merged 5 commits into from
Nov 8, 2024
Merged
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
87 changes: 11 additions & 76 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,12 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: pnpm

- uses: actions/checkout@v3
with:
repository: matter-labs/local-setup
path: local-setup

- name: Run server
run: |
cd local-setup
./start.sh &>../server.log &
- name: Run Era Test Node
uses: dutterbutter/era-test-node-action@latest

- name: Wait until server is up
run: |
while ! curl -s -X POST -d '{"jsonrpc":"2.0","method":"net_version","id":1}' -H 'Content-Type: application/json' 0.0.0.0:3050; do sleep 1; done

- name: Run fixture-projects script
run: |
cd e2e
Expand All @@ -116,15 +108,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
with:
repository: matter-labs/local-setup
path: local-setup

- name: Run server
run: |
cd local-setup
./start.sh &>../server.log &
- name: Run Era Test Node
uses: dutterbutter/era-test-node-action@latest

- uses: pnpm/action-setup@v3

Expand All @@ -138,10 +123,6 @@ jobs:
pnpm install
pnpm build

- name: Wait until server is up
run: |
while ! curl -s -X POST -d '{"jsonrpc":"2.0","method":"net_version","id":1}' -H 'Content-Type: application/json' 0.0.0.0:3050; do sleep 1; done

- name: Test zksolc example
run: |
cd examples/basic-example
Expand Down Expand Up @@ -216,11 +197,6 @@ jobs:
pnpm hardhat compile
pnpm hardhat deploy-zksync

- name: Show logs
if: always()
run: |
cat server.log

upgradable:
strategy:
matrix:
Expand All @@ -232,15 +208,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
with:
repository: matter-labs/local-setup
path: local-setup

- name: Run server
run: |
cd local-setup
./start.sh &>../server.log &
- name: Run Era Test Node
uses: dutterbutter/era-test-node-action@latest

- uses: pnpm/action-setup@v3

Expand All @@ -254,10 +223,6 @@ jobs:
pnpm install
pnpm build

- name: Wait until server is up
run: |
while ! curl -s -X POST -d '{"jsonrpc":"2.0","method":"net_version","id":1}' -H 'Content-Type: application/json' 0.0.0.0:3050; do sleep 1; done

- name: Test zksync upgradable plugin
run: |
cd packages/hardhat-zksync-upgradable
Expand Down Expand Up @@ -330,15 +295,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
with:
repository: matter-labs/local-setup
path: local-setup

- name: Run server
run: |
cd local-setup
./start.sh &>../server.log &
- name: Run Era Test Node
uses: dutterbutter/era-test-node-action@latest

- uses: pnpm/action-setup@v3

Expand All @@ -352,20 +310,11 @@ jobs:
pnpm install
pnpm build

- name: Wait until server is up
run: |
while ! curl -s -X POST -d '{"jsonrpc":"2.0","method":"net_version","id":1}' -H 'Content-Type: application/json' 0.0.0.0:3050; do sleep 1; done

- name: Test deploy package
run: |
cd packages/hardhat-zksync-deploy
pnpm test

- name: Show logs
if: always()
run: |
cat server.log

zksync-ethers:
strategy:
matrix:
Expand All @@ -378,14 +327,9 @@ jobs:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
with:
repository: matter-labs/local-setup
path: local-setup

- name: Run server
run: |
cd local-setup
./start.sh &>../server.log &
- name: Run Era Test Node
uses: dutterbutter/era-test-node-action@latest

- uses: pnpm/action-setup@v3

Expand All @@ -399,20 +343,11 @@ jobs:
pnpm install
pnpm build

- name: Wait until server is up
run: |
while ! curl -s -X POST -d '{"jsonrpc":"2.0","method":"net_version","id":1}' -H 'Content-Type: application/json' 0.0.0.0:3050; do sleep 1; done

- name: Test zksync-ethers example
run: |
cd packages/hardhat-zksync-ethers
pnpm test

- name: Show logs
if: always()
run: |
cat server.log

node:
strategy:
matrix:
Expand Down
6 changes: 6 additions & 0 deletions e2e/fixture-projects/clean/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ const config = {
},
}
},
defaultNework: 'inMemoryNode',
networks: {
hardhat: {
zksync: true,
},
inMemoryNode: {
url: "http://0.0.0.0:8011",
ethNetwork: "",
zksync: true,
},
},
// Docker image only works for solidity ^0.8.0.
// For earlier versions you need to use binary releases of zksolc.
Expand Down
4 changes: 2 additions & 2 deletions e2e/fixture-projects/clean/preprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cat <<EOF > "$SCRIPT_DIR/package.json"
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.0.1",
"ethers": "^6.12.2",
"zksync-ethers": "^6.8.0",
"zksync-ethers": "^6.15.0",
"hardhat": "^2.22.5",
"ts-node": "^10.9.2",
"prettier": "^3.3.0",
Expand All @@ -79,7 +79,7 @@ cat <<EOF > "$SCRIPT_DIR/package.json"
"peerDependencies": {
"hardhat": "^2.22.5",
"ethers": "^6.12.2",
"zksync-ethers": "^6.8.0"
"zksync-ethers": "^6.15.0"
},
"prettier": {
"tabWidth": 4,
Expand Down
8 changes: 2 additions & 6 deletions e2e/fixture-projects/compatability-check/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ const config = {
},
}
},
defaultNetwork: 'inMemoryNode',
networks: {
hardhat: {
zksync: true,
},
inMemoryNode: {
url: "http://0.0.0.0:8011",
ethNetwork: "",
zksync: true,
},
dockerizedNode: {
url: "http://0.0.0.0:3050",
ethNetwork: "http://0.0.0.0:8545",
zksync: true,
},
},
},
solidity: {
version: '0.8.17',
Expand Down
6 changes: 3 additions & 3 deletions e2e/fixture-projects/compatability-check/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ echo "Running compatability-check"

run_test_and_handle_failure "pnpm hardhat compile" 0

pnpm hardhat deploy-zksync:libraries --network dockerizedNode
pnpm hardhat deploy-zksync:libraries

pnpm hardhat compile

pnpm hardhat deploy-zksync --network dockerizedNode
pnpm hardhat deploy-zksync

assert_directory_exists "artifacts-zk"
assert_directory_exists "cache-zk"

pnpm hardhat run scripts/deploy-factory-uups.ts --network dockerizedNode
pnpm hardhat run scripts/deploy-factory-uups.ts



6 changes: 6 additions & 0 deletions e2e/fixture-projects/compile-fail/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ const config = {
},
}
},
defaultNetwork: 'inMemoryNode',
networks: {
hardhat: {
zksync: true,
},
inMemoryNode: {
url: "http://0.0.0.0:8011",
ethNetwork: "",
zksync: true,
},
},
// Docker image only works for solidity ^0.8.0.
// For earlier versions you need to use binary releases of zksolc.
Expand Down
4 changes: 2 additions & 2 deletions e2e/fixture-projects/compile-fail/preprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cat <<EOF > "$SCRIPT_DIR/package.json"
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.0.1",
"ethers": "^6.12.2",
"zksync-ethers": "^6.8.0",
"zksync-ethers": "^6.15.0",
"hardhat": "^2.22.5",
"ts-node": "^10.9.2",
"prettier": "^3.3.0",
Expand All @@ -79,7 +79,7 @@ cat <<EOF > "$SCRIPT_DIR/package.json"
"peerDependencies": {
"hardhat": "^2.22.5",
"ethers": "^6.12.2",
"zksync-ethers": "^6.8.0"
"zksync-ethers": "^6.15.0"
},
"prettier": {
"tabWidth": 4,
Expand Down
1 change: 1 addition & 0 deletions e2e/fixture-projects/mixed/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const config: HardhatUserConfig = {
},
}
},
defaultNetwork: 'inMemoryNode',
networks: {
hardhat: {
zksync: true,
Expand Down
4 changes: 2 additions & 2 deletions e2e/fixture-projects/mixed/preprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ cat <<EOF > "$SCRIPT_DIR/package.json"
"@matterlabs/hardhat-zksync-solc": "1.1.4",
"@matterlabs/hardhat-zksync-node":"1.0.2",
"@matterlabs/hardhat-zksync-upgradable":"1.3.1",
"@matterlabs/hardhat-zksync-vyper": "1.0.8",
"@matterlabs/hardhat-zksync-vyper": "1.1.1",
"@nomiclabs/hardhat-vyper": "^3.0.5",
"chalk": "4.1.2",
"hardhat": "^2.22.5",
"ethers": "^6.12.2",
"zksync-ethers": "^6.8.0",
"zksync-ethers": "^6.15.0",
"@matterlabs/zksync-contracts": "^0.6.1",
"@openzeppelin/contracts": "^4.9.2",
"@openzeppelin/contracts-upgradeable": "^4.9.2"
Expand Down
8 changes: 4 additions & 4 deletions e2e/fixture-projects/mixed/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ assert_directory_exists "artifacts-zk/contracts/Constant.sol"
assert_directory_not_empty "artifacts-zk"
assert_directory_not_empty "cache-zk"

DEPLOY_GREETER_OUTPUT=$(pnpm hardhat run scripts/deploy-greeter.ts --network dockerizedNode)
DEPLOY_GREETER_OUTPUT=$(pnpm hardhat run scripts/deploy-greeter.ts)

check_log_value "$DEPLOY_GREETER_OUTPUT" "Successful greeting from the contract"

DEPLOY_BOX_OUTPUT=$(pnpm hardhat run scripts/deploy-box-proxy.ts --network dockerizedNode)
DEPLOY_BOX_OUTPUT=$(pnpm hardhat run scripts/deploy-box-proxy.ts)

check_log_value "$DEPLOY_BOX_OUTPUT" "Box value is: 42n"

UPGRADE_BOX_OUTPUT=$(pnpm hardhat run scripts/upgrade-box.ts --network dockerizedNode)
UPGRADE_BOX_OUTPUT=$(pnpm hardhat run scripts/upgrade-box.ts)

check_log_value "$UPGRADE_BOX_OUTPUT" "Successfully upgraded Box to BoxV2"

DEPLOY_VOTING_OUTPUT=$(pnpm hardhat deploy-zksync --network dockerizedNode)
DEPLOY_VOTING_OUTPUT=$(pnpm hardhat deploy-zksync)

check_log_value "$DEPLOY_VOTING_OUTPUT" "Voting sucessfull!"
6 changes: 0 additions & 6 deletions e2e/fixture-projects/node/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,10 @@ const config: HardhatUserConfig = {
},
}
},
defaultNetwork:'inMemoryNode',
networks: {
hardhat: {
zksync: true,
},
inMemoryNode: {
url: "http://0.0.0.0:8011",
ethNetwork: "",
zksync: true,
},
},
solidity: {
version: '0.8.17',
Expand Down
7 changes: 5 additions & 2 deletions e2e/fixture-projects/node/preprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ cat <<EOF > "$SCRIPT_DIR/package.json"
],
"dependencies": {
"@matterlabs/hardhat-zksync-solc": "^1.1.4",
"@matterlabs/hardhat-zksync-node": "^1.1.1",
"axios": "^1.7.2",
"chalk": "^4.1.2",
"fs-extra": "^11.2.0",
Expand Down Expand Up @@ -74,12 +75,14 @@ cat <<EOF > "$SCRIPT_DIR/package.json"
"rimraf": "^5.0.7",
"ts-node": "^10.9.2",
"typescript": "^5.3.0",
"zksync-ethers": "^6.8.0",
"zksync-ethers": "^6.15.0",
"ethers": "^6.12.2",
"c8": "^9.1.0"
},
"peerDependencies": {
"hardhat": "^2.22.5",
"zksync-ethers": "^6.8.0"
"zksync-ethers": "^6.15.0",
"ethers": "^6.12.2"
},
"prettier": {
"tabWidth": 4,
Expand Down
6 changes: 0 additions & 6 deletions e2e/fixture-projects/node/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ set -e

echo "Running node"

# Kill any existing process on port 8011
kill_process_on_port 8011

pnpm add @matterlabs/[email protected]
pnpm add [email protected]

pnpm hardhat node-zksync &

sleep 3
Expand Down
Loading
Loading