Skip to content

Commit

Permalink
chore: upgrades local test network to cancun+deneb compatible one (ma…
Browse files Browse the repository at this point in the history
…tter-labs#580)

## What ❔

Upgrades local testnet to `Cancun+Deneb` compatible one. So far:

Cancun gets enabled:

```
2023-12-01 21:57:49 INFO [12-01|20:57:49.152] Merge configured: 
2023-12-01 21:57:49 INFO [12-01|20:57:49.152]  - Hard-fork specification:    https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md 
2023-12-01 21:57:49 INFO [12-01|20:57:49.152]  - Network known to be merged: true 
2023-12-01 21:57:49 INFO [12-01|20:57:49.152]  - Total terminal difficulty:  0 
2023-12-01 21:57:49 INFO [12-01|20:57:49.152]  
2023-12-01 21:57:49 INFO [12-01|20:57:49.152] Post-Merge hard forks (timestamp based): 
2023-12-01 21:57:49 INFO [12-01|20:57:49.152]  - Shanghai:                    @1701464272 (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md) 
2023-12-01 21:57:49 INFO [12-01|20:57:49.152]  - Cancun:                      @1701464272 
```

New network has been built into CI workflows.


## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `cargo spellcheck
--cfg=./spellcheck/era.cfg --code 1`.
  • Loading branch information
montekki authored Dec 8, 2023
1 parent 7c99232 commit 1e9e3bd
Show file tree
Hide file tree
Showing 19 changed files with 257 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: start-services
run: |
echo "IMAGE_TAG_SUFFIX=${{ env.IMAGE_TAG_SUFFIX }}" >> .env
docker-compose -f docker-compose-runner.yml up -d zk geth postgres
ci_localnet_up
ci_run sccache --start-server
- name: init
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-external-node-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: start-services
run: |
docker-compose -f docker-compose-runner.yml up -d zk geth postgres
ci_localnet_up
- name: init
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-local-node-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: start-services
run: |
docker-compose -f docker-compose-runner.yml up -d zk geth postgres
ci_localnet_up
- name: init
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-core-lint-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ jobs:
- name: Start services
run: |
docker-compose -f docker-compose-runner.yml pull
docker-compose -f docker-compose-runner.yml up --build -d zk
ci_localnet_up
ci_run sccache --start-server
- name: Setup db
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
- name: Start services
run: |
docker-compose -f docker-compose-runner.yml pull
docker-compose -f docker-compose-runner.yml up --build -d geth zk postgres
ci_localnet_up
ci_run sccache --start-server
- name: Init
Expand Down Expand Up @@ -63,8 +62,7 @@ jobs:
- name: Start services
run: |
docker-compose -f docker-compose-runner.yml pull
docker-compose -f docker-compose-runner.yml up --build -d geth zk postgres
ci_localnet_up
ci_run sccache --start-server
- name: Init
Expand Down Expand Up @@ -92,7 +90,6 @@ jobs:
ci_run cat server.log
ci_run sccache --show-stats
ci_run cat /tmp/sccache_log.txt
integration:
runs-on: [matterlabs-ci-runner]

Expand Down Expand Up @@ -135,8 +132,7 @@ jobs:
- name: Start services
run: |
docker-compose -f docker-compose-runner.yml pull
docker-compose -f docker-compose-runner.yml up --build -d geth zk postgres
ci_localnet_up
ci_run sccache --start-server
- name: Init
Expand Down Expand Up @@ -233,8 +229,7 @@ jobs:
- name: Start services
run: |
docker-compose -f docker-compose-runner.yml pull
docker-compose -f docker-compose-runner.yml up --build -d geth zk postgres
ci_localnet_up
ci_run sccache --start-server
- name: Init
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-docs-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ jobs:
- name: Start services
run: |
docker-compose -f docker-compose-runner.yml pull
docker-compose -f docker-compose-runner.yml up --build -d zk
ci_localnet_up
- name: Lints
run: |
Expand Down
12 changes: 12 additions & 0 deletions bin/ci_localnet_up
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

cd $ZKSYNC_HOME

mkdir -p ./volumes/postgres ./volumes/geth/keystore ./volumes/prysm/beacon ./volumes/prysm/validator
cp ./docker/prysm/config.yml ./volumes/prysm/config.yml
cp ./docker/geth/jwtsecret ./volumes/geth/jwtsecret
cp ./docker/geth/password.sec ./volumes/geth/password.sec
cp ./docker/geth/keystore/UTC--2019-04-06T21-13-27.692266000Z--8a91dc2d28b689474298d91899f0c1baf62cb85b ./volumes/geth/keystore/
docker-compose -f docker-compose-local-genesis.yml up
docker-compose -f docker-compose-local-genesis.yml rm -f
docker-compose --profile runner up -d --wait
2 changes: 1 addition & 1 deletion bin/ci_run
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Runs the command from within CI docker-compose environment.
cd $ZKSYNC_HOME
compose_file="${RUNNER_COMPOSE_FILE:-docker-compose-runner.yml}"
compose_file="${RUNNER_COMPOSE_FILE:-docker-compose.yml}"

# Pass environment variables explicitly if specified
if [ ! -z "$PASSED_ENV_VARS" ]; then
Expand Down
4 changes: 2 additions & 2 deletions core/tests/loadnext/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ impl TransactionWeights {
impl Default for TransactionWeights {
fn default() -> Self {
Self {
deposit: 0.1,
deposit: 0.05,
withdrawal: 0.5,
l1_transactions: 0.1,
l1_transactions: 0.05,
l2_transactions: 1.0,
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/tests/ts-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"private": true,
"scripts": {
"test": "zk f jest --forceExit --testTimeout 60000",
"test": "zk f jest --forceExit --testTimeout 120000",
"long-running-test": "zk f jest",
"fee-test": "RUN_FEE_TEST=1 zk f jest -- fees.test.ts",
"api-test": "zk f jest -- api/web3.test.ts api/debug.test.ts",
Expand Down
4 changes: 2 additions & 2 deletions core/tests/ts-integration/tests/custom-erc20-bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ describe('Tests for the custom bridge behavior', () => {

let l1bridge2 = new L1ERC20BridgeFactory(alice._signerL1()).attach(l1BridgeProxy.address);

const maxAttempts = 5;
const maxAttempts = 200;
let ready = false;
for (let i = 0; i < maxAttempts; ++i) {
const l2Bridge = await l1bridge2.l2Bridge();
if (l2Bridge != ethers.constants.AddressZero) {
const code = await alice._providerL2().getCode(l2Bridge);
if (code.length > 0) {
if (code.length > 2) {
ready = true;
break;
}
Expand Down
20 changes: 20 additions & 0 deletions core/tests/ts-integration/tests/system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ describe('System behavior checks', () => {
alice = testMaster.mainAccount();
});

test('Network should be supporting Cancun+Deneb', async () => {
const address_a = '0x000000000000000000000000000000000000000A';
const address_b = '0x000000000000000000000000000000000000000b';

const transaction_a = {
to: address_a,
data: '0x'
};

await expect(alice.providerL1!.call(transaction_a)).rejects.toThrow();

const transaction_b = {
to: address_b,
data: '0x'
};

const result_b = await alice.providerL1!.call(transaction_b);
expect(result_b).toEqual('0x');
});

test('Should check that system contracts and SDK create same CREATE/CREATE2 addresses', async () => {
const deployerContract = new zksync.Contract(
zksync.utils.CONTRACT_DEPLOYER_ADDRESS,
Expand Down
2 changes: 1 addition & 1 deletion core/tests/upgrade-test/tests/upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('Upgrade test', function () {
).wait();

// Wait for server to process L1 event.
await utils.sleep(10);
await utils.sleep(30);
});

step('Check bootloader is updated on L2', async () => {
Expand Down
141 changes: 133 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,147 @@
version: '3.2'
services:
create-beacon-chain-genesis:
image: "gcr.io/prysmaticlabs/prysm/cmd/prysmctl:latest"
command:
- testnet
- generate-genesis
- --fork=deneb
- --num-validators=64
- --genesis-time-delay=5
- --output-ssz=/consensus/genesis.ssz
- --chain-config-file=/prysm/config.yml
- --geth-genesis-json-in=/geth/standard-dev.json
- --geth-genesis-json-out=/execution/genesis.json
volumes:
- ./docker/geth:/geth/:ro
- ./docker/prysm:/prysm/:ro
- ./volumes/geth:/execution
- ./volumes/prysm:/consensus
geth-genesis:
image: "ethereum/client-go:v1.13.5"
command: --datadir=/execution init /execution/genesis.json
volumes:
- ./volumes/geth:/execution
depends_on:
create-beacon-chain-genesis:
condition: service_completed_successfully
geth:
image: "matterlabs/geth:latest"
image: "ethereum/client-go:v1.13.5"
ports:
- 8551:8551
- 8545:8545
- 8546:8546
volumes:
- ./volumes/geth:/var/lib/geth/data
- ./docker/geth/:/geth/:ro
command:
- --networkid=9
- --datadir=/var/lib/geth/data
- --http
- --http.api=engine,eth,web3,personal,net,debug
- --http.addr=0.0.0.0
- --http.corsdomain=*
- --http.vhosts=*
- --ws
- --ws.addr=0.0.0.0
- --ws.port=8546
- --ws.origins=*
- --nodiscover
- --authrpc.addr=0.0.0.0
- --authrpc.vhosts=*
- --authrpc.jwtsecret=/var/lib/geth/data/jwtsecret
- --allow-insecure-unlock
- --unlock=0x8a91dc2d28b689474298d91899f0c1baf62cb85b
- --password=/var/lib/geth/data/password.sec
- --syncmode=full
depends_on:
beacon:
condition: service_started
geth-genesis:
condition: service_completed_successfully
beacon:
image: "gcr.io/prylabs-dev/prysm/beacon-chain:v4.1.1"
command:
- --datadir=/consensus/beacon/
- --min-sync-peers=0
- --genesis-state=/consensus/genesis.ssz
- --bootstrap-node=
- --interop-eth1data-votes
- --chain-config-file=/consensus/config.yml
- --contract-deployment-block=0
- --chain-id=9
- --rpc-host=0.0.0.0
- --grpc-gateway-host=0.0.0.0
- --execution-endpoint=http://geth:8551
- --accept-terms-of-use
- --jwt-secret=/execution/jwtsecret
- --suggested-fee-recipient=0x8a91dc2d28b689474298d91899f0c1baf62cb85b
- --minimum-peers-per-subnet=0
- --enable-debug-rpc-endpoints
ports:
- "8545:8545"
- "8546:8546"
- 4000:4000
- 3500:3500
- 8080:8080
- 6060:6060
- 9090:9090
volumes:
- type: bind
source: ./volumes/geth
target: /var/lib/geth/data
- ./volumes/prysm:/consensus
- ./volumes/geth:/execution
depends_on:
create-beacon-chain-genesis:
condition: service_completed_successfully
validator:
image: "gcr.io/prylabs-dev/prysm/validator:v4.1.1"
command:
- --beacon-rpc-provider=beacon:4000
- --datadir=/consensus/validatordata
- --accept-terms-of-use
- --interop-num-validators=64
- --interop-start-index=0
- --chain-config-file=/consensus/config.yml
depends_on:
beacon:
condition: service_started
volumes:
- ./volumes/prysm:/consensus
postgres:
image: "postgres:14"
ports:
- "5432:5432"
- 5432:5432
volumes:
- type: bind
source: ./volumes/postgres
target: /var/lib/postgresql/data
environment:
- POSTGRES_HOST_AUTH_METHOD=trust


# This is specific to runner
zk:
image: "matterlabs/zk-environment:latest2.0-lightweight"
depends_on:
- geth
- postgres
- beacon
- validator
security_opt:
- seccomp:unconfined
command: tail -f /dev/null
volumes:
- .:/usr/src/zksync
- /usr/src/cache:/usr/src/cache
- /var/run/docker.sock:/var/run/docker.sock
environment:
- CACHE_DIR=/usr/src/cache
- SCCACHE_CACHE_SIZE=50g
- SCCACHE_GCS_BUCKET=matterlabs-infra-sccache-storage
- SCCACHE_GCS_SERVICE_ACCOUNT=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com
- SCCACHE_ERROR_LOG=/tmp/sccache_log.txt
- SCCACHE_GCS_RW_MODE=READ_WRITE
- CI=1
- GITHUB_WORKSPACE=$GITHUB_WORKSPACE
env_file:
- ./.env
extra_hosts:
- "host:host-gateway"
profiles:
- runner
1 change: 1 addition & 0 deletions docker/geth/jwtsecret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xfad2709d0bb03bf0e8ba3c99bea194575d3e98863133d1af638ed056d1d59345
Loading

0 comments on commit 1e9e3bd

Please sign in to comment.