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: Added support for validium and custom base token #23

Merged
merged 12 commits into from
May 13, 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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ Will start a hyperchain with 3 L2s, L1 and necessary explorers.
To run:

```shell
# to fetch the latest images
docker compose -f hyperchain-docker-compose.yml pull

docker compose -f hyperchain-docker-compose.yml up -d
```

Afterwards, you'll have explorers available at http://localhost:15000 http://localhost:15001 and http://localhost:15005


### Manual transfer to hyperchains
Expand Down
4 changes: 2 additions & 2 deletions explorer_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const e = [
{
apiUrl: "http://localhost:15202", bridgeUrl: "http://localhost:3000/bridge", hostnames: [
"localhost"
], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 272, l2NetworkName: "Slave", maintenance: !1, name: "local_slave1", published: !0, rpcUrl: "http://localhost:15200"
], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 272, l2NetworkName: "CustomBase", maintenance: !1, name: "local_custombase", published: !0, rpcUrl: "http://localhost:15200"
},
{
apiUrl: "http://localhost:15302", bridgeUrl: "http://localhost:3000/bridge", hostnames: [
"localhost"
], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 273, l2NetworkName: "Slave2", maintenance: !1, name: "local_slave2", published: !0, rpcUrl: "http://localhost:15300"
], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 273, l2NetworkName: "Validium", maintenance: !1, name: "local_validium", published: !0, rpcUrl: "http://localhost:15300"
}

]; var s = {
Expand Down
108 changes: 66 additions & 42 deletions hyperchain-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# - L1 (reth) with explorer (blockscout)
# - a single postgres (with all the databases)
# - 3 zksync chains (with ids 270, 272, 273) - 'master', 'slave', 'slave2'
# - 3 zksync chains (with ids 270, 272, 273) - 'master', 'custombase', 'validium'
# - together with their explorers
# - hyperexplorer to merge it all together.

Expand All @@ -19,7 +19,7 @@
# - 15101 - ws
# - 15102 - explorer api
#
# So 15100 - 'master', 15200 - 'slave', 15300 - 'slave2'
# So 15100 - 'master', 15200 - 'custombase', 15300 - 'validium'

# Database is on 15432
# pgAdmin to manage PostgreSQL DB is on 15430
Expand Down Expand Up @@ -77,6 +77,7 @@ services:
start_period: 30s
volumes:
- shared_config:/etc/env/target
- shared_tokens:/etc/tokens
depends_on:
- reth
- postgres
Expand All @@ -90,57 +91,76 @@ services:



zksync_slave:
zksync_custombase:
stdin_open: true
tty: true
image: matterlabs/local-node:hyperlocal
depends_on:
- reth
- postgres
- zksync
reth:
condition: service_started
postgres:
condition: service_started
zksync:
condition: service_healthy
healthcheck:
test: curl --fail http://localhost:3071/health || exit 1
interval: 10s
timeout: 5s
retries: 200
start_period: 30s
volumes:
- shared_config:/etc/master_env
- shared_tokens:/etc/tokens:ro
ports:
- 127.0.0.1:15200:3050 # JSON RPC HTTP port
- 127.0.0.1:15201:3051 # JSON RPC WS port
environment:
- DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_slave
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_slave
- DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_custombase
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_custombase
- ETH_CLIENT_WEB3_URL=http://reth:8545
- CHAIN_ETH_ZKSYNC_NETWORK_ID=272
- IN_DOCKER=true
- MASTER_URL=http://zksync:3050
- MASTER_HEALTH_URL=http://zksync:3071/health
- MASTER_ENV_FILE=/etc/master_env/dev.env
- CUSTOM_BASE_TOKEN=BAT

zksync_slave2:
zksync_validium:
stdin_open: true
tty: true
image: matterlabs/local-node:hyperlocal
depends_on:
- reth
- postgres
- zksync
- zksync_slave # daisy chain
reth:
condition: service_started
postgres:
condition: service_started
zksync:
condition: service_healthy
zksync_custombase: # daisy chain
condition: service_healthy
healthcheck:
test: curl --fail http://localhost:3071/health || exit 1
interval: 10s
timeout: 5s
retries: 200
start_period: 30s
volumes:
- shared_config:/etc/master_env
- shared_tokens:/etc/tokens:ro
ports:
- 127.0.0.1:15300:3050 # JSON RPC HTTP port
- 127.0.0.1:15301:3051 # JSON RPC WS port
environment:
- DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_slave2
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_slave2
- DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_validium
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_validium
- ETH_CLIENT_WEB3_URL=http://reth:8545
- CHAIN_ETH_ZKSYNC_NETWORK_ID=273
- IN_DOCKER=true
- MASTER_URL=http://zksync:3050
- MASTER_HEALTH_URL=http://zksync_slave:3071/health ## daisy chain
- MASTER_HEALTH_URL=http://zksync_custombase:3071/health ## daisy chain
- MASTER_ENV_FILE=/etc/master_env/dev.env





- CHAIN_STATE_KEEPER_L1_BATCH_COMMIT_DATA_GENERATOR_MODE=Validium
- VALIDIUM_MODE=1

data-fetcher_main:
platform: linux/amd64
Expand All @@ -152,24 +172,24 @@ services:
- BLOCKCHAIN_RPC_URL=http://zksync:3050
restart: unless-stopped

data-fetcher_slave:
data-fetcher_custombase:
platform: linux/amd64
image: "matterlabs/block-explorer-data-fetcher:latest"
environment:
- PORT=3040
- LOG_LEVEL=verbose
- NODE_ENV=development
- BLOCKCHAIN_RPC_URL=http://zksync_slave:3050
- BLOCKCHAIN_RPC_URL=http://zksync_custombase:3050
restart: unless-stopped

data-fetcher_slave2:
data-fetcher_validium:
platform: linux/amd64
image: "matterlabs/block-explorer-data-fetcher:latest"
environment:
- PORT=3040
- LOG_LEVEL=verbose
- NODE_ENV=development
- BLOCKCHAIN_RPC_URL=http://zksync_slave2:3050
- BLOCKCHAIN_RPC_URL=http://zksync_validium:3050
restart: unless-stopped


Expand All @@ -190,7 +210,7 @@ services:
- BATCHES_PROCESSING_POLLING_INTERVAL=1000
restart: unless-stopped

worker_slave:
worker_custombase:
platform: linux/amd64
image: "matterlabs/block-explorer-worker:latest"
environment:
Expand All @@ -200,14 +220,14 @@ services:
- DATABASE_HOST=postgres
- DATABASE_USER=postgres
- DATABASE_PASSWORD=notsecurepassword
- DATABASE_NAME=block-explorer_slave
- BLOCKCHAIN_RPC_URL=http://zksync_slave:3050
- DATA_FETCHER_URL=http://data-fetcher_slave:3040
- DATABASE_NAME=block-explorer_custombase
- BLOCKCHAIN_RPC_URL=http://zksync_custombase:3050
- DATA_FETCHER_URL=http://data-fetcher_custombase:3040
- BATCHES_PROCESSING_POLLING_INTERVAL=1000
restart: unless-stopped


worker_slave2:
worker_validium:
platform: linux/amd64
image: "matterlabs/block-explorer-worker:latest"
environment:
Expand All @@ -217,9 +237,9 @@ services:
- DATABASE_HOST=postgres
- DATABASE_USER=postgres
- DATABASE_PASSWORD=notsecurepassword
- DATABASE_NAME=block-explorer_slave2
- BLOCKCHAIN_RPC_URL=http://zksync_slave2:3050
- DATA_FETCHER_URL=http://data-fetcher_slave2:3040
- DATABASE_NAME=block-explorer_validium
- BLOCKCHAIN_RPC_URL=http://zksync_validium:3050
- DATA_FETCHER_URL=http://data-fetcher_validium:3040
- BATCHES_PROCESSING_POLLING_INTERVAL=1000
restart: unless-stopped

Expand All @@ -240,35 +260,35 @@ services:
restart: unless-stopped


api_slave:
api_custombase:
platform: linux/amd64
image: "matterlabs/block-explorer-api:latest"
environment:
- PORT=3020
- METRICS_PORT=3005
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_slave
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_custombase
ports:
- '127.0.0.1:15202:3020'
depends_on:
- worker_slave
- worker_custombase
restart: unless-stopped


api_slave2:
api_validium:
platform: linux/amd64
image: "matterlabs/block-explorer-api:latest"
environment:
- PORT=3020
- METRICS_PORT=3005
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_slave2
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_validium
ports:
- '127.0.0.1:15302:3020'
depends_on:
- worker_slave2
- worker_validium
restart: unless-stopped

app:
Expand All @@ -282,8 +302,8 @@ services:
- '127.0.0.1:15005:3010'
depends_on:
- api_main
- api_slave
- api_slave2
- api_custombase
- api_validium
restart: unless-stopped


Expand Down Expand Up @@ -364,7 +384,10 @@ services:
depends_on:
zksync:
condition: service_healthy

zksync_validium:
condition: service_healthy
zksync_custombase:
condition: service_healthy
image: ghcr.io/mm-zk/zksync_tools:latest
ports:
- 127.0.0.1:15000:5000
Expand All @@ -375,3 +398,4 @@ services:
volumes:
reth:
shared_config:
shared_tokens:
12 changes: 6 additions & 6 deletions hyperexplorer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
"explorer": "http://localhost:15005/?network=local",
"type": "rollup"
},
"slave1": {
"custombase": {
"chain_id": "0x110",
"l2_url": "http://zksync_slave:3050",
"explorer": "http://localhost:15005/?network=local_slave1",
"l2_url": "http://zksync_custombase:3050",
"explorer": "http://localhost:15005/?network=local_custombase",
"type": "rollup"
},
"slave2": {
"validium": {
"chain_id": "0x111",
"l2_url": "http://zksync_slave2:3050",
"explorer": "http://localhost:15005/?network=local_slave2",
"l2_url": "http://zksync_validium:3050",
"explorer": "http://localhost:15005/?network=local_validium",
"type": "rollup"
}
}
Expand Down
4 changes: 2 additions & 2 deletions init.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE DATABASE "block-explorer";
CREATE DATABASE "block-explorer_slave";
CREATE DATABASE "block-explorer_slave2";
CREATE DATABASE "block-explorer_custombase";
CREATE DATABASE "block-explorer_validium";
Loading