From 993ca8d914d09c40f76a093ce1fbef60865464ed Mon Sep 17 00:00:00 2001 From: mm Date: Fri, 26 Apr 2024 18:27:20 +0200 Subject: [PATCH 01/11] in progress --- docker-compose.yml | 96 +++++++++++++++++++++ notes.md | 202 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 298 insertions(+) create mode 100644 notes.md diff --git a/docker-compose.yml b/docker-compose.yml index 286eb5d..bbb7298 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,5 +41,101 @@ services: - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_local - ETH_CLIENT_WEB3_URL=http://reth:8545 + + + zksync_slave: + stdin_open: true + tty: true + image: matterlabs/local-node:mmzk_0426-1 + entrypoint: sleep 1000000 + + depends_on: + - reth + - postgres + ports: + - 127.0.0.1:3060:3050 # JSON RPC HTTP port + - 127.0.0.1:3061:3051 # JSON RPC WS port + environment: + - DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_slave + - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_slave + - ETH_CLIENT_WEB3_URL=http://reth:8545 + - IN_DOCKER=true + + zksync_slave2: + stdin_open: true + tty: true + image: matterlabs/local-node:mmzk_0426-1 + entrypoint: sleep 1000000 + + depends_on: + - reth + - postgres + ports: + - 127.0.0.1:3070:3050 # JSON RPC HTTP port + - 127.0.0.1:3071:3051 # JSON RPC WS port + environment: + - DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_slave2 + - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_slave2 + - ETH_CLIENT_WEB3_URL=http://reth:8545 + - IN_DOCKER=true + + + + + data-fetcher: + platform: linux/amd64 + image: "matterlabs/block-explorer-data-fetcher:latest" + environment: + - PORT=3040 + - LOG_LEVEL=verbose + - NODE_ENV=development + - BLOCKCHAIN_RPC_URL=http://zksync:3050 + ports: + - '3040:3040' + restart: unless-stopped + + + worker: + platform: linux/amd64 + image: "matterlabs/block-explorer-worker:latest" + environment: + - PORT=3001 + - LOG_LEVEL=verbose + - NODE_ENV=development + - DATABASE_HOST=postgres + - DATABASE_USER=postgres + - DATABASE_PASSWORD=notsecurepassword + - DATABASE_NAME=block-explorer + - BLOCKCHAIN_RPC_URL=http://zksync:3050 + - DATA_FETCHER_URL=http://data-fetcher:3040 + - BATCHES_PROCESSING_POLLING_INTERVAL=1000 + restart: unless-stopped + + + api: + 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 + ports: + - '3020:3020' + depends_on: + - worker + restart: unless-stopped + + app: + platform: linux/amd64 + image: "matterlabs/block-explorer-app:latest" + ports: + - '3010:3010' + depends_on: + - api + restart: unless-stopped + + volumes: reth: diff --git a/notes.md b/notes.md new file mode 100644 index 0000000..076fc81 --- /dev/null +++ b/notes.md @@ -0,0 +1,202 @@ +CHAIN_ETH_ZKSYNC_NETWORK_ID=271 +-- inside base/chain.toml + +export MNEMONIC="misery lizard beach magic blue one genre damage excess police image become" + +also remember to 're-init' the databse (with 'limited' entrypoint.sh) + + +Change the CONTRACTS_BRIDGEHUB_PROXY_ADDR=0x35A3783781DE026E1e854A6DA45d7a903664a9dA +inside vim /etc/env/target/dev.env (or better in /etc/env/l1-inits/.init.env) + +zk f yarn register-hyperchain +from /contracts/l1-contracts + +Wrong mnemonic derivation?? - 0x3641c494B824FCe82f067Ac2154028C5aa4dA61B +cast send -r http://localhost:8545 0x3641c494B824FCe82f067Ac2154028C5aa4dA61B --value 100ether 0x --private-key 0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be + +Had to use the 'original' mnemonic (fine music test violin matrix prize squirrel panther purchase material script deal) - as the other one was not the owner.. + +All these below should be changed in contracts.toml (or probably those l1-inits/.init.env) + +CONTRACTS_STATE_TRANSITION_PROXY_ADDR=0x358E8b343f5Fd58aC74B262c4492BdFB9CC94116 + +error: chainid already registered +change +CHAIN_ETH_ZKSYNC_NETWORK_ID=271 + +STM: initial cutHash mismatch + +I need: +admin, getter mailbox and executor facets. + +CONTRACTS_ADMIN_FACET_ADDR=0xde1eE9622c8D6F7Da5bb7fB6dAa456f7cbF8a68d +CONTRACTS_MAILBOX_FACET_ADDR=0xfF33105a4BC25D8e2d152850d040286800E906e1 +CONTRACTS_EXECUTOR_FACET_ADDR=0x72093667348cA8381aFA17BBBe97946cc26B9B63 +CONTRACTS_GETTERS_FACET_ADDR=0x359fC3e2c4417C19f48089DB28a6a51c16e92822 + +and diamond init: +CONTRACTS_DIAMOND_INIT_ADDR=0x9fbFBa544B76F67Bf821E3468990B21bFaE45a10 + +CONTRACTS_BLOB_VERSIONED_HASH_RETRIEVER_ADDR=0x585dFAf7332B9a725b8A1957fc6eF544A732bAD9 +CONTRACTS_VERIFIER_ADDR=0x4e49ee147EaD1e39951B9779eA11e16eA30b19C2 + +And this was the output: + + + +Using deployer wallet: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE +Using governor address: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE +Using gas price: 1.500000001 gwei +Using nonce: 170 +Using base token address: 0x0000000000000000000000000000000000000001 +Hyperchain registered, gas used: 3193077 and 3193077 +Hyperchain registration tx hash: 0x49afc2e91b38a9f3cd4b3098ff27f83962aa4ff1bf1222998f329a707c163c94 + +CHAIN_ETH_ZKSYNC_NETWORK_ID=271 +CONTRACTS_BASE_TOKEN_ADDR=0x0000000000000000000000000000000000000001 +CONTRACTS_DIAMOND_PROXY_ADDR=0x7a50c1212c74fac4c8dbffaf96a4ceab32737d50 + +Validator registered, gas used: 21584, tx hash: 0xc37c42d4da1f8e451c20f79dd6aaadebbf969269f81f02254b19e51cc8dc7185 +Validator 2 registered, gas used: 21572 +BaseTokenMultiplier set, gas used: 55290 +Done in 5.58s. + + +Now we also have to deploy the ValidatorTimelock.. + - and it needs CONTRACTS_CREATE2_FACTORY_ADDR + (this required some 'hacking' of the deploy-utils).. + + and now we get: CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0xC8cAD763dC6FF0985FD2434400db58e26C5B936e + ^^this was still via: zk f yarn deploy-no-build + + + + zk f yarn initialize-validator + Error: Hyperchain: not state transition manager... + Or maybe this is really not needed - do we need a separate validator? or can they share?? + + + +Now tryign to deploy l2 through l1. +CONTRACTS_BASE_TOKEN_ADDR=0x0000000000000000000000000000000000000001 + +zk config compile dev + +This also requires governance to be set (as this is what 'approves' this). +CONTRACTS_GOVERNANCE_ADDR + +And now this worked: +zk contract deploy-l2-through-l1 + +We also need MultiCall3.. +CONTRACTS_L1_MULTICALL3_ADDR=0xCF506433F1e04c008c7f230a8d2B8f9dd885837A + + +Now zk f zksync_server (remember - from the '/' dir). + +it fails on ValidatorTimelock: only validator. + +CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0x66D64f3af78E0E4FC6F6f1922f728513BBC303Bd + +And now -- nonce too low - I probably use the same operator as in the other chain.. +(I had to update nonce in eth_txs - and remove entry from eth_txs_history). + +I have 'from': 0x4F9133D1d3F50011A6859807C837bdCB31Aaab13 (which is the same as 'commit' operator in the first chain). + + + + +ok - Ihave to tell 'validator timelock', that I'm a validator for this new chain -id +Ok - the issue was, that we didn't set the correct timelock early enough.. + +So let's fix it for real, 2 new keys: +Address: 0xdbE3094f075AA8bC8D3EFeA39a488c759849Fa63 +Private key: 0xbadbb556964c61aa6e752d2844a7cb942d85954affd2d0318c3a0d7dc97001d9 + +Address: 0xAC044784A139C70A589A8C17B5229D58ed0D786d +Private key: 0x13821fd6d08beb983d1139f7d3087cd2372f1cd7606e87d19aaa4a925e391b90 + + +Update private.toml +// Remember to send some money there. + +And re-registering: +yarn run v1.22.22 +$ ts-node scripts/register-hyperchain.ts +Using deployer wallet: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE +Using governor address: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE +Using gas price: 1.500000001 gwei +Using nonce: 187 +Using base token address: 0x0000000000000000000000000000000000000001 +Validator registered, gas used: 73274, tx hash: 0x8ae33f67c2205dc603d882b89358c6c53477ba7ae2b321239e2743175d204703 +Validator 2 registered, gas used: 73274 +Done in 4.66s. + + +## Stuff to do: +* zkcli - to support chain id +* explorer app - to display different options + + +### Summary + +## Trying again + +CHAIN_ETH_ZKSYNC_NETWORK_ID=272 -- clearly select early. + +* generate the wallets for the operator & blob operator. + +Copy from the main one: + +CONTRACTS_BRIDGEHUB_PROXY_ADDR=0x35A3783781DE026E1e854A6DA45d7a903664a9dA +CONTRACTS_STATE_TRANSITION_PROXY_ADDR=0x358E8b343f5Fd58aC74B262c4492BdFB9CC94116 +CONTRACTS_ADMIN_FACET_ADDR=0xde1eE9622c8D6F7Da5bb7fB6dAa456f7cbF8a68d +CONTRACTS_MAILBOX_FACET_ADDR=0xfF33105a4BC25D8e2d152850d040286800E906e1 +CONTRACTS_EXECUTOR_FACET_ADDR=0x72093667348cA8381aFA17BBBe97946cc26B9B63 +CONTRACTS_GETTERS_FACET_ADDR=0x359fC3e2c4417C19f48089DB28a6a51c16e92822 +CONTRACTS_DIAMOND_INIT_ADDR=0x9fbFBa544B76F67Bf821E3468990B21bFaE45a10 +CONTRACTS_BLOB_VERSIONED_HASH_RETRIEVER_ADDR=0x585dFAf7332B9a725b8A1957fc6eF544A732bAD9 +CONTRACTS_VERIFIER_ADDR=0x4e49ee147EaD1e39951B9779eA11e16eA30b19C2 +CONTRACTS_L1_MULTICALL3_ADDR=0xCF506433F1e04c008c7f230a8d2B8f9dd885837A +CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0x66D64f3af78E0E4FC6F6f1922f728513BBC303Bd +CONTRACTS_GOVERNANCE_ADDR=0x808Dfd96334E52c043e524C16FDD94832884302E + +Successfully created new keypair. +Address: 0xEc39FE3212FedB610842DC15C7a64F6Ef2Cb003B +Private key: 0xca274905a4b9da86b41a0527228468057f1e901970d2e13bf5b0f3cfde1e6210 +➜ local-setup git:(mmzk_0427_with_hyperchain) ✗ cast wallet new +Successfully created new keypair. +Address: 0x7217599A3129c7f3F9e907ae8f25CCDaDdA40756 +Private key: 0x6782bd9efb4cd8a84a52a78b431a20e8811801f9b4d63978d2ec00b33fef7ff6 + +ETH_SENDER_SENDER_OPERATOR_PRIVATE_KEY=0xca274905a4b9da86b41a0527228468057f1e901970d2e13bf5b0f3cfde1e6210 +ETH_SENDER_SENDER_OPERATOR_COMMIT_ETH_ADDR=0xEc39FE3212FedB610842DC15C7a64F6Ef2Cb003B +ETH_SENDER_SENDER_OPERATOR_BLOBS_PRIVATE_KEY=0x6782bd9efb4cd8a84a52a78b431a20e8811801f9b4d63978d2ec00b33fef7ff6 +ETH_SENDER_SENDER_OPERATOR_BLOBS_ETH_ADDR=0x7217599A3129c7f3F9e907ae8f25CCDaDdA40756 + + +zk db reset +zk contract register-hyperchain + +$ ts-node scripts/register-hyperchain.ts +Using deployer wallet: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE +Using governor address: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE +Using gas price: 1.500000001 gwei +Using nonce: 189 +Using base token address: 0x0000000000000000000000000000000000000001 +Hyperchain registered, gas used: 3193077 and 3193077 +Hyperchain registration tx hash: 0x7e613e87ea2391f4944d53698038c20c08d18a5ffa5700839c2be552578d64e8 +CHAIN_ETH_ZKSYNC_NETWORK_ID=272 +CONTRACTS_BASE_TOKEN_ADDR=0x0000000000000000000000000000000000000001 +CONTRACTS_DIAMOND_PROXY_ADDR=0xac4edbf79496b70e82ec4359d8b9eb0b6da457a7 +Validator registered, gas used: 73262, tx hash: 0x4a1790757e2f2a5e72f00bb066cfe3e753324f58eb3d8b88542ef25e052a0700 +Validator 2 registered, gas used: 73274 +BaseTokenMultiplier set, gas used: 55290 +Done in 5.90s. +Writing to etc/env/l2-inits/docker.init.env +Configs compiled for docker + + zk f zksync_server --genesis + zk contract deploy-l2-through-l1 + --failed on 'initializing chain governance' \ No newline at end of file From 95a664ac3fd3f8b6855449ed7e53e834f20544d0 Mon Sep 17 00:00:00 2001 From: mm Date: Mon, 6 May 2024 18:28:18 +0200 Subject: [PATCH 02/11] Working with hyperchains --- docker-compose.yml | 154 ++++++++++++++++++++++++++++++++++++++++----- init.sql | 3 + other.js | 22 +++++++ 3 files changed, 162 insertions(+), 17 deletions(-) create mode 100644 init.sql create mode 100644 other.js diff --git a/docker-compose.yml b/docker-compose.yml index bbb7298..9c0b4d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,22 +14,29 @@ services: - 127.0.0.1:8545:8545 postgres: image: "postgres:14" + # To create necessary databases for block explorer. + volumes: + - ./init.sql:/docker-entrypoint-initdb.d/init.sql command: postgres -c 'max_connections=200' ports: - 127.0.0.1:5432:5432 environment: # We bind only to 127.0.0.1, so setting insecure password is acceptable here - POSTGRES_PASSWORD=notsecurepassword + + # Master node - that will create the hyperchain zksync: stdin_open: true tty: true - image: matterlabs/local-node:${INSTANCE_TYPE:-latest2.0} + image: matterlabs/local-node:mmzk_0506-2 healthcheck: test: curl --fail http://localhost:3071/health || exit 1 interval: 10s timeout: 5s retries: 20 start_period: 30s + volumes: + - shared_config:/etc/env/target depends_on: - reth - postgres @@ -46,12 +53,14 @@ services: zksync_slave: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0426-1 - entrypoint: sleep 1000000 - + image: matterlabs/local-node:mmzk_0506-2 + #entrypoint: sleep 1000000 depends_on: - reth - postgres + - zksync + volumes: + - shared_config:/etc/master_env ports: - 127.0.0.1:3060:3050 # JSON RPC HTTP port - 127.0.0.1:3061:3051 # JSON RPC WS port @@ -59,17 +68,24 @@ services: - DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_slave - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_slave - 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 zksync_slave2: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0426-1 - entrypoint: sleep 1000000 - + image: matterlabs/local-node:mmzk_0506-2 + #entrypoint: sleep 1000000 depends_on: - reth - postgres + - zksync + - zksync_slave # daisy chain + volumes: + - shared_config:/etc/master_env ports: - 127.0.0.1:3070:3050 # JSON RPC HTTP port - 127.0.0.1:3071:3051 # JSON RPC WS port @@ -77,12 +93,18 @@ services: - DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_slave2 - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_slave2 - 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_ENV_FILE=/etc/master_env/dev.env + + - data-fetcher: + data-fetcher_main: platform: linux/amd64 image: "matterlabs/block-explorer-data-fetcher:latest" environment: @@ -90,12 +112,37 @@ services: - LOG_LEVEL=verbose - NODE_ENV=development - BLOCKCHAIN_RPC_URL=http://zksync:3050 - ports: - - '3040:3040' + #ports: + # - '3040:3040' restart: unless-stopped - - worker: + data-fetcher_slave: + 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 + #ports: + # - '3040:3040' + restart: unless-stopped + + data-fetcher_slave2: + 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 + #ports: + # - '3040:3040' + restart: unless-stopped + + + + worker_main: platform: linux/amd64 image: "matterlabs/block-explorer-worker:latest" environment: @@ -107,12 +154,45 @@ services: - DATABASE_PASSWORD=notsecurepassword - DATABASE_NAME=block-explorer - BLOCKCHAIN_RPC_URL=http://zksync:3050 - - DATA_FETCHER_URL=http://data-fetcher:3040 + - DATA_FETCHER_URL=http://data-fetcher_main:3040 + - BATCHES_PROCESSING_POLLING_INTERVAL=1000 + restart: unless-stopped + + worker_slave: + platform: linux/amd64 + image: "matterlabs/block-explorer-worker:latest" + environment: + - PORT=3001 + - LOG_LEVEL=verbose + - NODE_ENV=development + - 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 - BATCHES_PROCESSING_POLLING_INTERVAL=1000 restart: unless-stopped - api: + worker_slave2: + platform: linux/amd64 + image: "matterlabs/block-explorer-worker:latest" + environment: + - PORT=3001 + - LOG_LEVEL=verbose + - NODE_ENV=development + - 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 + - BATCHES_PROCESSING_POLLING_INTERVAL=1000 + restart: unless-stopped + + + api_main: platform: linux/amd64 image: "matterlabs/block-explorer-api:latest" environment: @@ -122,20 +202,60 @@ services: - NODE_ENV=development - DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer ports: - - '3020:3020' + - '127.0.0.1:3052:3020' depends_on: - - worker + - worker_main + restart: unless-stopped + + + api_slave: + 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 + ports: + - '127.0.0.1:3062:3020' + depends_on: + - worker_slave + restart: unless-stopped + + + api_slave2: + 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 + ports: + - '127.0.0.1:3072:3020' + depends_on: + - worker_slave2 restart: unless-stopped app: platform: linux/amd64 image: "matterlabs/block-explorer-app:latest" + volumes: + - ./explorer.app.config.json:/usr/src/app/packages/app/src/configs/dev.config.json + - ./explorer.app.config.json:/usr/src/app/packages/app/src/configs/local.config.json + - ./other.js:/usr/src/app/packages/app/dist/assets/dev.config.4e99e047.js + ports: - '3010:3010' depends_on: - - api + - api_main + - api_slave + - api_slave2 restart: unless-stopped volumes: reth: + shared_config: diff --git a/init.sql b/init.sql new file mode 100644 index 0000000..45fce30 --- /dev/null +++ b/init.sql @@ -0,0 +1,3 @@ +CREATE DATABASE "block-explorer"; +CREATE DATABASE "block-explorer_slave"; +CREATE DATABASE "block-explorer_slave2"; \ No newline at end of file diff --git a/other.js b/other.js new file mode 100644 index 0000000..f11e388 --- /dev/null +++ b/other.js @@ -0,0 +1,22 @@ +const e = [ + { + apiUrl: "http://localhost:3052", bridgeUrl: "http://localhost:3000/bridge", hostnames: [ + "localhost" + ], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 270, l2NetworkName: "Localzz", maintenance: !1, name: "local", published: !0, rpcUrl: "http://localhost:3050" + }, + { + apiUrl: "http://localhost:3062", bridgeUrl: "http://localhost:3000/bridge", hostnames: [ + "localhost" + ], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 272, l2NetworkName: "Slave1", maintenance: !1, name: "local_slave1", published: !0, rpcUrl: "http://localhost:3060" + }, + { + apiUrl: "http://localhost:3072", 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:3070" + } + +]; var s = { + networks: e +}; export { + s as default, e as networks +}; \ No newline at end of file From f56463eb2f9a9bb1f6759a690220ef675a72f517 Mon Sep 17 00:00:00 2001 From: mm Date: Mon, 6 May 2024 20:40:09 +0200 Subject: [PATCH 03/11] adding blockscout - part 1 --- blockscout.yml | 108 +++++++ blockscout/common-blockscout.env | 375 +++++++++++++++++++++++++ blockscout/common-frontend.env | 19 ++ blockscout/common-stats.env | 27 ++ blockscout/proxy/default.conf.template | 56 ++++ 5 files changed, 585 insertions(+) create mode 100644 blockscout.yml create mode 100644 blockscout/common-blockscout.env create mode 100644 blockscout/common-frontend.env create mode 100644 blockscout/common-stats.env create mode 100644 blockscout/proxy/default.conf.template diff --git a/blockscout.yml b/blockscout.yml new file mode 100644 index 0000000..ef5da85 --- /dev/null +++ b/blockscout.yml @@ -0,0 +1,108 @@ +services: + redis-db: + image: 'redis:alpine' + command: redis-server + + + db: + image: postgres:15 + shm_size: 256m + restart: always + command: postgres -c 'max_connections=200' -c 'client_connection_check_interval=60000' + environment: + POSTGRES_DB: 'blockscout' + POSTGRES_USER: 'blockscout' + POSTGRES_PASSWORD: 'ceWb1MeLBEeOIfk65gU8EjF8' + ports: + - target: 5432 + published: 7432 + healthcheck: + test: ["CMD-SHELL", "pg_isready -U blockscout -d blockscout"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + + backend: + depends_on: + - db + - redis-db + image: blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest} + restart: always + stop_grace_period: 5m + command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" + extra_hosts: + - 'host.docker.internal:host-gateway' + env_file: + - blockscout/common-blockscout.env + links: + - db:database + environment: + ETHEREUM_JSONRPC_VARIANT: 'geth' + + frontend: + depends_on: + - backend + image: ghcr.io/blockscout/frontend:${FRONTEND_DOCKER_TAG:-latest} + platform: linux/amd64 + restart: always + env_file: + - blockscout/common-frontend.env + + stats-db: + image: postgres:15 + shm_size: 256m + restart: always + command: postgres -c 'max_connections=200' + environment: + POSTGRES_DB: 'stats' + POSTGRES_USER: 'stats' + POSTGRES_PASSWORD: 'n0uejXPl61ci6ldCuE2gQU5Y' + ports: + - target: 5432 + published: 7433 + healthcheck: + test: ["CMD-SHELL", "pg_isready -U stats -d stats"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + + + stats: + depends_on: + - stats-db + - backend + image: ghcr.io/blockscout/stats:${STATS_DOCKER_TAG:-latest} + platform: linux/amd64 + restart: always + extra_hosts: + - 'host.docker.internal:host-gateway' + env_file: + - blockscout/common-stats.env + environment: + - STATS__DB_URL=postgres://stats:n0uejXPl61ci6ldCuE2gQU5Y@stats-db:5432/stats + - STATS__BLOCKSCOUT_DB_URL=${STATS__BLOCKSCOUT_DB_URL:-postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout} + - STATS__CREATE_DATABASE=true + - STATS__RUN_MIGRATIONS=true + + proxy: + depends_on: + - backend + - frontend + - stats + image: nginx + extra_hosts: + - 'host.docker.internal:host-gateway' + volumes: + - "./blockscout/proxy:/etc/nginx/templates" + environment: + BACK_PROXY_PASS: ${BACK_PROXY_PASS:-http://backend:4000} + FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://frontend:3000} + ports: + - target: 80 + published: 8099 + - target: 8080 + published: 8080 + - target: 8081 + published: 8081 diff --git a/blockscout/common-blockscout.env b/blockscout/common-blockscout.env new file mode 100644 index 0000000..8ea2b23 --- /dev/null +++ b/blockscout/common-blockscout.env @@ -0,0 +1,375 @@ +ETHEREUM_JSONRPC_VARIANT=geth +ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:8545/ +# ETHEREUM_JSONRPC_FALLBACK_HTTP_URL= +DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout +# DATABASE_QUEUE_TARGET +ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:8545/ +# ETHEREUM_JSONRPC_FALLBACK_TRACE_URL= +# ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL= +# ETHEREUM_JSONRPC_ETH_CALL_URL= +# ETHEREUM_JSONRPC_HTTP_TIMEOUT= +# CHAIN_TYPE= +NETWORK= +SUBNETWORK=Awesome chain +LOGO=/images/blockscout_logo.svg +# ETHEREUM_JSONRPC_WS_URL= +ETHEREUM_JSONRPC_TRANSPORT=http +ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=false +# ETHEREUM_JSONRPC_ARCHIVE_BALANCES_WINDOW=200 +# ETHEREUM_JSONRPC_HTTP_HEADERS= +# ETHEREUM_JSONRPC_WAIT_PER_TIMEOUT= +# ETHEREUM_JSONRPC_GETH_TRACE_BY_BLOCK= +IPC_PATH= +NETWORK_PATH=/ +BLOCKSCOUT_HOST= +BLOCKSCOUT_PROTOCOL= +SECRET_KEY_BASE=56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN +# CHECK_ORIGIN= +PORT=4000 +COIN_NAME= +# METADATA_CONTRACT= +# VALIDATORS_CONTRACT= +# KEYS_MANAGER_CONTRACT= +# REWARDS_CONTRACT= +# TOKEN_BRIDGE_CONTRACT= +EMISSION_FORMAT=DEFAULT +# CHAIN_SPEC_PATH= +# SUPPLY_MODULE= +COIN= +EXCHANGE_RATES_COIN= +# EXCHANGE_RATES_MARKET_CAP_SOURCE= +# EXCHANGE_RATES_TVL_SOURCE= +# EXCHANGE_RATES_PRICE_SOURCE= +# EXCHANGE_RATES_COINGECKO_COIN_ID= +# EXCHANGE_RATES_COINGECKO_SECONDARY_COIN_ID= +# EXCHANGE_RATES_COINGECKO_API_KEY= +# EXCHANGE_RATES_COINGECKO_BASE_URL= +# EXCHANGE_RATES_COINGECKO_BASE_PRO_URL= +# EXCHANGE_RATES_COINMARKETCAP_BASE_URL= +# EXCHANGE_RATES_COINMARKETCAP_API_KEY= +# EXCHANGE_RATES_COINMARKETCAP_COIN_ID= +# EXCHANGE_RATES_COINMARKETCAP_SECONDARY_COIN_ID= +# EXCHANGE_RATES_CRYPTOCOMPARE_SECONDARY_COIN_SYMBOL= +POOL_SIZE=80 +# EXCHANGE_RATES_COINGECKO_PLATFORM_ID= +# TOKEN_EXCHANGE_RATE_INTERVAL= +# TOKEN_EXCHANGE_RATE_REFETCH_INTERVAL= +# TOKEN_EXCHANGE_RATE_MAX_BATCH_SIZE= +# DISABLE_TOKEN_EXCHANGE_RATE= +POOL_SIZE_API=10 +ECTO_USE_SSL=false +# DATADOG_HOST= +# DATADOG_PORT= +# SPANDEX_BATCH_SIZE= +# SPANDEX_SYNC_THRESHOLD= +HEART_BEAT_TIMEOUT=30 +# HEART_COMMAND= +# BLOCKSCOUT_VERSION= +RELEASE_LINK= +BLOCK_TRANSFORMER=base +# BLOCK_RANGES= +# FIRST_BLOCK= +# LAST_BLOCK= +# TRACE_BLOCK_RANGES= +# TRACE_FIRST_BLOCK= +# TRACE_LAST_BLOCK= +# FOOTER_CHAT_LINK= +# FOOTER_FORUM_LINK_ENABLED= +# FOOTER_FORUM_LINK= +# FOOTER_TELEGRAM_LINK_ENABLED= +# FOOTER_TELEGRAM_LINK= +# FOOTER_GITHUB_LINK= +FOOTER_LOGO=/images/blockscout_logo.svg +FOOTER_LINK_TO_OTHER_EXPLORERS=false +FOOTER_OTHER_EXPLORERS={} +SUPPORTED_CHAINS={} +CACHE_BLOCK_COUNT_PERIOD=7200 +CACHE_TXS_COUNT_PERIOD=7200 +CACHE_ADDRESS_SUM_PERIOD=3600 +CACHE_TOTAL_GAS_USAGE_PERIOD=3600 +CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD=1800 +CACHE_TOKEN_HOLDERS_COUNTER_PERIOD=3600 +CACHE_TOKEN_TRANSFERS_COUNTER_PERIOD=3600 +CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=1800 +CACHE_AVERAGE_BLOCK_PERIOD=1800 +CACHE_MARKET_HISTORY_PERIOD=21600 +CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD=1800 +CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD=3600 +CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=1800 +# CACHE_TRANSACTIONS_24H_STATS_PERIOD= +# CACHE_FRESH_PENDING_TRANSACTIONS_COUNTER_PERIOD= +# TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD= +# COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD= +# CONTRACT_CODE_ON_DEMAND_FETCHER_THRESHOLD= +TOKEN_METADATA_UPDATE_INTERVAL=172800 +CONTRACT_VERIFICATION_ALLOWED_SOLIDITY_EVM_VERSIONS=homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,paris,shanghai,cancun,default +CONTRACT_VERIFICATION_ALLOWED_VYPER_EVM_VERSIONS=byzantium,constantinople,petersburg,istanbul,berlin,paris,shanghai,cancun,default +# CONTRACT_VERIFICATION_MAX_LIBRARIES=10 +CONTRACT_MAX_STRING_LENGTH_WITHOUT_TRIMMING=2040 +# CONTRACT_DISABLE_INTERACTION= +# CONTRACT_AUDIT_REPORTS_AIRTABLE_URL= +# CONTRACT_AUDIT_REPORTS_AIRTABLE_API_KEY= +# CONTRACT_CERTIFIED_LIST= +UNCLES_IN_AVERAGE_BLOCK_TIME=false +DISABLE_WEBAPP=false +API_V2_ENABLED=true +API_V1_READ_METHODS_DISABLED=false +API_V1_WRITE_METHODS_DISABLED=false +# API_RATE_LIMIT_DISABLED=true +# API_SENSITIVE_ENDPOINTS_KEY= +API_RATE_LIMIT_TIME_INTERVAL=1s +API_RATE_LIMIT_BY_IP_TIME_INTERVAL=5m +API_RATE_LIMIT=50 +API_RATE_LIMIT_BY_KEY=50 +API_RATE_LIMIT_BY_WHITELISTED_IP=50 +API_RATE_LIMIT_WHITELISTED_IPS= +API_RATE_LIMIT_STATIC_API_KEY= +API_RATE_LIMIT_UI_V2_WITH_TOKEN=5 +API_RATE_LIMIT_BY_IP=3000 +# API_GRAPHQL_ENABLED= +# API_GRAPHQL_MAX_COMPLEXITY= +# API_GRAPHQL_TOKEN_LIMIT= +# API_GRAPHQL_DEFAULT_TRANSACTION_HASH= +# API_GRAPHQL_RATE_LIMIT_DISABLED= +# API_GRAPHQL_RATE_LIMIT= +# API_GRAPHQL_RATE_LIMIT_BY_KEY= +# API_GRAPHQL_RATE_LIMIT_TIME_INTERVAL= +# API_GRAPHQL_RATE_LIMIT_BY_IP= +# API_GRAPHQL_RATE_LIMIT_BY_IP_TIME_INTERVAL= +# API_GRAPHQL_RATE_LIMIT_STATIC_API_KEY= +DISABLE_INDEXER=false +DISABLE_REALTIME_INDEXER=false +DISABLE_CATCHUP_INDEXER=false +INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER=false +INDEXER_DISABLE_TOKEN_INSTANCE_REALTIME_FETCHER=false +INDEXER_DISABLE_TOKEN_INSTANCE_RETRY_FETCHER=false +INDEXER_DISABLE_TOKEN_INSTANCE_SANITIZE_FETCHER=false +INDEXER_DISABLE_TOKEN_INSTANCE_LEGACY_SANITIZE_FETCHER=false +# CHANGED - also disabled this. +INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=true +# CHANGED - has to be 'true', as reth doesn't support 'debug_TraceTransaction' +INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=true +# INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER= +# INDEXER_DISABLE_BLOCK_REWARD_FETCHER= +# INDEXER_DISABLE_EMPTY_BLOCKS_SANITIZER= +# INDEXER_DISABLE_WITHDRAWALS_FETCHER= +# INDEXER_CATCHUP_BLOCKS_BATCH_SIZE= +# INDEXER_CATCHUP_BLOCKS_CONCURRENCY= +# INDEXER_CATCHUP_BLOCK_INTERVAL= +# INDEXER_EMPTY_BLOCKS_SANITIZER_INTERVAL= +# INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE= +# INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY= +# ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT= +# INDEXER_BLOCK_REWARD_BATCH_SIZE= +# INDEXER_BLOCK_REWARD_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_USE_BASE_URI_RETRY= +# INDEXER_TOKEN_INSTANCE_RETRY_REFETCH_INTERVAL= +# INDEXER_TOKEN_INSTANCE_RETRY_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_RETRY_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_REALTIME_BATCH_SIZE=1 +# INDEXER_TOKEN_INSTANCE_REALTIME_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_SANITIZE_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_SANITIZE_CONCURRENCY= +# INDEXER_TOKEN_INSTANCE_LEGACY_SANITIZE_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_LEGACY_SANITIZE_CONCURRENCY=10 +# INDEXER_DISABLE_TOKEN_INSTANCE_ERC_1155_SANITIZE_FETCHER=false +# INDEXER_DISABLE_TOKEN_INSTANCE_ERC_721_SANITIZE_FETCHER=false +# INDEXER_TOKEN_INSTANCE_ERC_1155_SANITIZE_CONCURRENCY=2 +# INDEXER_TOKEN_INSTANCE_ERC_1155_SANITIZE_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_ERC_721_SANITIZE_CONCURRENCY=2 +# INDEXER_TOKEN_INSTANCE_ERC_721_SANITIZE_BATCH_SIZE=10 +# INDEXER_TOKEN_INSTANCE_ERC_721_SANITIZE_TOKENS_BATCH_SIZE=100 +# TOKEN_INSTANCE_OWNER_MIGRATION_CONCURRENCY=5 +# TOKEN_INSTANCE_OWNER_MIGRATION_BATCH_SIZE=50 +# INDEXER_COIN_BALANCES_BATCH_SIZE= +# INDEXER_COIN_BALANCES_CONCURRENCY= +# INDEXER_RECEIPTS_BATCH_SIZE= +# INDEXER_RECEIPTS_CONCURRENCY= +# INDEXER_TOKEN_CONCURRENCY= +# INDEXER_TOKEN_BALANCES_BATCH_SIZE= +# INDEXER_TOKEN_BALANCES_CONCURRENCY= +# INDEXER_TX_ACTIONS_ENABLE= +# INDEXER_TX_ACTIONS_MAX_TOKEN_CACHE_SIZE= +# INDEXER_TX_ACTIONS_REINDEX_FIRST_BLOCK= +# INDEXER_TX_ACTIONS_REINDEX_LAST_BLOCK= +# INDEXER_TX_ACTIONS_REINDEX_PROTOCOLS= +# INDEXER_TX_ACTIONS_AAVE_V3_POOL_CONTRACT= +# INDEXER_POLYGON_EDGE_L1_RPC= +# INDEXER_POLYGON_EDGE_L1_EXIT_HELPER_CONTRACT= +# INDEXER_POLYGON_EDGE_L1_WITHDRAWALS_START_BLOCK= +# INDEXER_POLYGON_EDGE_L1_STATE_SENDER_CONTRACT= +# INDEXER_POLYGON_EDGE_L1_DEPOSITS_START_BLOCK= +# INDEXER_POLYGON_EDGE_L2_STATE_SENDER_CONTRACT= +# INDEXER_POLYGON_EDGE_L2_WITHDRAWALS_START_BLOCK= +# INDEXER_POLYGON_EDGE_L2_STATE_RECEIVER_CONTRACT= +# INDEXER_POLYGON_EDGE_L2_DEPOSITS_START_BLOCK= +# INDEXER_POLYGON_EDGE_ETH_GET_LOGS_RANGE_SIZE= +# INDEXER_POLYGON_ZKEVM_BATCHES_ENABLED= +# INDEXER_POLYGON_ZKEVM_BATCHES_CHUNK_SIZE= +# INDEXER_POLYGON_ZKEVM_BATCHES_RECHECK_INTERVAL= +# INDEXER_POLYGON_ZKEVM_L1_RPC= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_START_BLOCK= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_CONTRACT= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NATIVE_SYMBOL= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NATIVE_DECIMALS= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_NETWORK_ID= +# INDEXER_POLYGON_ZKEVM_L1_BRIDGE_ROLLUP_INDEX= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_START_BLOCK= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_CONTRACT= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_NETWORK_ID= +# INDEXER_POLYGON_ZKEVM_L2_BRIDGE_ROLLUP_INDEX= +# INDEXER_ZKSYNC_BATCHES_ENABLED= +# INDEXER_ZKSYNC_BATCHES_CHUNK_SIZE= +# INDEXER_ZKSYNC_NEW_BATCHES_MAX_RANGE= +# INDEXER_ZKSYNC_NEW_BATCHES_RECHECK_INTERVAL= +# INDEXER_ZKSYNC_L1_RPC= +# INDEXER_ZKSYNC_BATCHES_STATUS_RECHECK_INTERVAL= +# INDEXER_REALTIME_FETCHER_MAX_GAP= +# INDEXER_FETCHER_INIT_QUERY_LIMIT= +# INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT= +# INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT= +# INDEXER_GRACEFUL_SHUTDOWN_PERIOD= +# WITHDRAWALS_FIRST_BLOCK= +# INDEXER_OPTIMISM_L1_RPC= +# INDEXER_OPTIMISM_L1_BATCH_START_BLOCK= +# INDEXER_OPTIMISM_L1_BATCH_INBOX= +# INDEXER_OPTIMISM_L1_BATCH_SUBMITTER= +# INDEXER_OPTIMISM_L1_BATCH_BLOCKS_CHUNK_SIZE= +# INDEXER_OPTIMISM_L2_BATCH_GENESIS_BLOCK_NUMBER= +# INDEXER_OPTIMISM_L1_PORTAL_CONTRACT= +# INDEXER_OPTIMISM_L1_OUTPUT_ROOTS_START_BLOCK= +# INDEXER_OPTIMISM_L1_OUTPUT_ORACLE_CONTRACT= +# INDEXER_OPTIMISM_L1_WITHDRAWALS_START_BLOCK= +# INDEXER_OPTIMISM_L2_WITHDRAWALS_START_BLOCK= +# INDEXER_OPTIMISM_L2_MESSAGE_PASSER_CONTRACT= +# INDEXER_OPTIMISM_L1_DEPOSITS_START_BLOCK= +# INDEXER_OPTIMISM_L1_DEPOSITS_BATCH_SIZE= +# ROOTSTOCK_REMASC_ADDRESS= +# ROOTSTOCK_BRIDGE_ADDRESS= +# ROOTSTOCK_LOCKED_BTC_CACHE_PERIOD= +# ROOTSTOCK_LOCKING_CAP= +# INDEXER_DISABLE_ROOTSTOCK_DATA_FETCHER= +# INDEXER_ROOTSTOCK_DATA_FETCHER_INTERVAL= +# INDEXER_ROOTSTOCK_DATA_FETCHER_BATCH_SIZE= +# INDEXER_ROOTSTOCK_DATA_FETCHER_CONCURRENCY= +# INDEXER_ROOTSTOCK_DATA_FETCHER_DB_BATCH_SIZE= +# INDEXER_BEACON_RPC_URL=http://localhost:5052 +# INDEXER_DISABLE_BEACON_BLOB_FETCHER= +# INDEXER_BEACON_BLOB_FETCHER_SLOT_DURATION=12 +# INDEXER_BEACON_BLOB_FETCHER_REFERENCE_SLOT=8000000 +# INDEXER_BEACON_BLOB_FETCHER_REFERENCE_TIMESTAMP=1702824023 +# INDEXER_BEACON_BLOB_FETCHER_START_BLOCK=19200000 +# INDEXER_BEACON_BLOB_FETCHER_END_BLOCK=0 +# TOKEN_ID_MIGRATION_FIRST_BLOCK= +# TOKEN_ID_MIGRATION_CONCURRENCY= +# TOKEN_ID_MIGRATION_BATCH_SIZE= +# INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE= +# WEBAPP_URL= +# API_URL= +SHOW_ADDRESS_MARKETCAP_PERCENTAGE=true +CHECKSUM_ADDRESS_HASHES=true +CHECKSUM_FUNCTION=eth +DISABLE_EXCHANGE_RATES=true +TXS_STATS_ENABLED=true +SHOW_PRICE_CHART=false +SHOW_PRICE_CHART_LEGEND=false +SHOW_TXS_CHART=true +TXS_HISTORIAN_INIT_LAG=0 +TXS_STATS_DAYS_TO_COMPILE_AT_INIT=10 +COIN_BALANCE_HISTORY_DAYS=90 +APPS_MENU=true +EXTERNAL_APPS=[] +# GAS_PRICE= +# GAS_PRICE_ORACLE_CACHE_PERIOD= +# GAS_PRICE_ORACLE_SIMPLE_TRANSACTION_GAS= +# GAS_PRICE_ORACLE_NUM_OF_BLOCKS= +# GAS_PRICE_ORACLE_SAFELOW_PERCENTILE= +# GAS_PRICE_ORACLE_AVERAGE_PERCENTILE= +# GAS_PRICE_ORACLE_FAST_PERCENTILE= +# GAS_PRICE_ORACLE_SAFELOW_TIME_COEFFICIENT= +# GAS_PRICE_ORACLE_AVERAGE_TIME_COEFFICIENT= +# GAS_PRICE_ORACLE_FAST_TIME_COEFFICIENT= +# RESTRICTED_LIST= +# RESTRICTED_LIST_KEY= +SHOW_MAINTENANCE_ALERT=false +MAINTENANCE_ALERT_MESSAGE= +CHAIN_ID= +MAX_SIZE_UNLESS_HIDE_ARRAY=50 +HIDE_BLOCK_MINER=false +DISPLAY_TOKEN_ICONS=false +RE_CAPTCHA_SECRET_KEY= +RE_CAPTCHA_CLIENT_KEY= +RE_CAPTCHA_V3_SECRET_KEY= +RE_CAPTCHA_V3_CLIENT_KEY= +RE_CAPTCHA_DISABLED=false +JSON_RPC= +# API_RATE_LIMIT_HAMMER_REDIS_URL=redis://redis-db:6379/1 +# API_RATE_LIMIT_IS_BLOCKSCOUT_BEHIND_PROXY=false +API_RATE_LIMIT_UI_V2_TOKEN_TTL_IN_SECONDS=18000 +FETCH_REWARDS_WAY=trace_block +MICROSERVICE_SC_VERIFIER_ENABLED=true +# MICROSERVICE_SC_VERIFIER_URL=http://smart-contract-verifier:8050/ +# MICROSERVICE_SC_VERIFIER_TYPE=sc_verifier +MICROSERVICE_SC_VERIFIER_URL=https://eth-bytecode-db.services.blockscout.com/ +MICROSERVICE_SC_VERIFIER_TYPE=eth_bytecode_db +MICROSERVICE_ETH_BYTECODE_DB_INTERVAL_BETWEEN_LOOKUPS=10m +MICROSERVICE_ETH_BYTECODE_DB_MAX_LOOKUPS_CONCURRENCY=10 +MICROSERVICE_VISUALIZE_SOL2UML_ENABLED=true +MICROSERVICE_VISUALIZE_SOL2UML_URL=http://visualizer:8050/ +MICROSERVICE_SIG_PROVIDER_ENABLED=true +MICROSERVICE_SIG_PROVIDER_URL=http://sig-provider:8050/ +# MICROSERVICE_BENS_URL= +# MICROSERVICE_BENS_ENABLED= +# MICROSERVICE_ACCOUNT_ABSTRACTION_ENABLED=true +# MICROSERVICE_ACCOUNT_ABSTRACTION_URL= +# MICROSERVICE_METADATA_URL= +# MICROSERVICE_METADATA_ENABLED= +DECODE_NOT_A_CONTRACT_CALLS=true +# DATABASE_READ_ONLY_API_URL= +# ACCOUNT_DATABASE_URL= +# ACCOUNT_POOL_SIZE= +# ACCOUNT_AUTH0_DOMAIN= +# ACCOUNT_AUTH0_CLIENT_ID= +# ACCOUNT_AUTH0_CLIENT_SECRET= +# ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL= +# ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY= +# ACCOUNT_SENDGRID_API_KEY= +# ACCOUNT_SENDGRID_SENDER= +# ACCOUNT_SENDGRID_TEMPLATE= +# ACCOUNT_VERIFICATION_EMAIL_RESEND_INTERVAL= +# ACCOUNT_PRIVATE_TAGS_LIMIT=2000 +# ACCOUNT_WATCHLIST_ADDRESSES_LIMIT=15 +ACCOUNT_CLOAK_KEY= +ACCOUNT_ENABLED=false +ACCOUNT_REDIS_URL=redis://redis-db:6379 +EIP_1559_ELASTICITY_MULTIPLIER=2 +# MIXPANEL_TOKEN= +# MIXPANEL_URL= +# AMPLITUDE_API_KEY= +# AMPLITUDE_URL= +# IPFS_GATEWAY_URL= +# ADDRESSES_TABS_COUNTERS_TTL=10m +# DENORMALIZATION_MIGRATION_BATCH_SIZE= +# DENORMALIZATION_MIGRATION_CONCURRENCY= +# TOKEN_TRANSFER_TOKEN_TYPE_MIGRATION_BATCH_SIZE= +# TOKEN_TRANSFER_TOKEN_TYPE_MIGRATION_CONCURRENCY= +# SANITIZE_INCORRECT_NFT_BATCH_SIZE= +# SANITIZE_INCORRECT_NFT_CONCURRENCY= +SOURCIFY_INTEGRATION_ENABLED=false +SOURCIFY_SERVER_URL= +SOURCIFY_REPO_URL= +SHOW_TENDERLY_LINK=false +TENDERLY_CHAIN_PATH= +# SOLIDITYSCAN_CHAIN_ID= +# SOLIDITYSCAN_API_TOKEN= +# NOVES_FI_BASE_API_URL= +# NOVES_FI_CHAIN_NAME= +# NOVES_FI_API_TOKEN= +# ZERION_BASE_API_URL= +# ZERION_API_TOKEN= +# BRIDGED_TOKENS_ENABLED= +# BRIDGED_TOKENS_ETH_OMNI_BRIDGE_MEDIATOR= +# BRIDGED_TOKENS_BSC_OMNI_BRIDGE_MEDIATOR= +# BRIDGED_TOKENS_POA_OMNI_BRIDGE_MEDIATOR= +# BRIDGED_TOKENS_AMB_BRIDGE_MEDIATORS +# BRIDGED_TOKENS_FOREIGN_JSON_RPC \ No newline at end of file diff --git a/blockscout/common-frontend.env b/blockscout/common-frontend.env new file mode 100644 index 0000000..6bca03d --- /dev/null +++ b/blockscout/common-frontend.env @@ -0,0 +1,19 @@ +NEXT_PUBLIC_API_HOST=localhost:8099 +NEXT_PUBLIC_API_PROTOCOL=http +NEXT_PUBLIC_STATS_API_HOST=http://localhost:8080 +NEXT_PUBLIC_NETWORK_NAME=L1 Hyperchain +NEXT_PUBLIC_NETWORK_SHORT_NAME=L1 Hyperchain +NEXT_PUBLIC_NETWORK_ID=9 +NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether +NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=ETH +NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18 +NEXT_PUBLIC_API_BASE_PATH=/ +NEXT_PUBLIC_APP_HOST=localhost:8099 +NEXT_PUBLIC_APP_PROTOCOL=http +NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs'] +NEXT_PUBLIC_VISUALIZE_API_HOST=http://localhost:8081 +NEXT_PUBLIC_IS_TESTNET=true +NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=ws +NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml +NEXT_PUBLIC_AD_BANNER_PROVIDER=none +NEXT_PUBLIC_AD_TEXT_PROVIDER=none diff --git a/blockscout/common-stats.env b/blockscout/common-stats.env new file mode 100644 index 0000000..f5eed63 --- /dev/null +++ b/blockscout/common-stats.env @@ -0,0 +1,27 @@ +# Those are examples of existing configuration variables and their default values. +# When uncommented, they would overwrite corresponding values from `base.toml` +# configuration file. + +STATS__SERVER__HTTP__ENABLED=true +STATS__SERVER__HTTP__ADDR=0.0.0.0:8050 +STATS__SERVER__HTTP__MAX_BODY_SIZE=2097152 + +STATS__SERVER__GRPC__ENABLED=false +STATS__SERVER__GRPC__ADDR=0.0.0.0:8051 + +STATS__DB_URL= +STATS__BLOCKSCOUT_DB_URL= +STATS__CREATE_DATABASE=false +STATS__RUN_MIGRATIONS=false +STATS__DEFAULT_SCHEDULE=0 0 1 * * * * +STATS__FORCE_UPDATE_ON_START=false + +STATS__METRICS__ENABLED=false +STATS__METRICS__ADDR=0.0.0.0:6060 +STATS__METRICS__ROUTE=/metrics + +STATS__JAEGER__ENABLED=false +STATS__JAEGER__AGENT_ENDPOINT=localhost:6831 + +STATS__TRACING__ENABLED=true +STATS__TRACING__FORMAT=default diff --git a/blockscout/proxy/default.conf.template b/blockscout/proxy/default.conf.template new file mode 100644 index 0000000..20eaf62 --- /dev/null +++ b/blockscout/proxy/default.conf.template @@ -0,0 +1,56 @@ +map $http_upgrade $connection_upgrade { + + default upgrade; + '' close; +} + +server { + listen 80; + server_name localhost; + proxy_http_version 1.1; + + location ~ ^/(api|socket|sitemap.xml|auth/auth0|auth/auth0/callback|auth/logout) { + proxy_pass ${BACK_PROXY_PASS}; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } + location / { + proxy_pass ${FRONT_PROXY_PASS}; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } +} +server { + listen 8080; + server_name localhost; + proxy_http_version 1.1; + proxy_hide_header Access-Control-Allow-Origin; + proxy_hide_header Access-Control-Allow-Methods; + add_header 'Access-Control-Allow-Origin' 'http://localhost' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always; + + location / { + proxy_pass http://stats:8050/; + proxy_http_version 1.1; + proxy_set_header Host "$host"; + proxy_set_header X-Real-IP "$remote_addr"; + proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for"; + proxy_set_header X-Forwarded-Proto "$scheme"; + proxy_set_header Upgrade "$http_upgrade"; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } +} \ No newline at end of file From 80df5d03bce5bb5f75e7889744b0b2319b2cec02 Mon Sep 17 00:00:00 2001 From: mm Date: Mon, 6 May 2024 20:43:19 +0200 Subject: [PATCH 04/11] single db --- blockscout.yml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/blockscout.yml b/blockscout.yml index ef5da85..34c0a70 100644 --- a/blockscout.yml +++ b/blockscout.yml @@ -49,29 +49,8 @@ services: env_file: - blockscout/common-frontend.env - stats-db: - image: postgres:15 - shm_size: 256m - restart: always - command: postgres -c 'max_connections=200' - environment: - POSTGRES_DB: 'stats' - POSTGRES_USER: 'stats' - POSTGRES_PASSWORD: 'n0uejXPl61ci6ldCuE2gQU5Y' - ports: - - target: 5432 - published: 7433 - healthcheck: - test: ["CMD-SHELL", "pg_isready -U stats -d stats"] - interval: 10s - timeout: 5s - retries: 5 - start_period: 10s - - stats: depends_on: - - stats-db - backend image: ghcr.io/blockscout/stats:${STATS_DOCKER_TAG:-latest} platform: linux/amd64 @@ -81,7 +60,7 @@ services: env_file: - blockscout/common-stats.env environment: - - STATS__DB_URL=postgres://stats:n0uejXPl61ci6ldCuE2gQU5Y@stats-db:5432/stats + - STATS__DB_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/stats - STATS__BLOCKSCOUT_DB_URL=${STATS__BLOCKSCOUT_DB_URL:-postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout} - STATS__CREATE_DATABASE=true - STATS__RUN_MIGRATIONS=true From c6adcea2dc938ef5c874807d7c672b2ed3828e9c Mon Sep 17 00:00:00 2001 From: mm Date: Tue, 7 May 2024 11:23:34 +0200 Subject: [PATCH 05/11] works with hyperexplorer --- blockscout.yml | 7 +- blockscout/common-blockscout.env | 6 +- blockscout/common-frontend.env | 8 +- docker-compose.yml | 150 ++++++++++++++++++++++++++----- explorer.app.config.json | 49 ++++++++++ explorer_mapping.js | 22 +++++ hyperexplorer.json | 34 +++++++ notes.md | 11 ++- other.js | 22 ----- 9 files changed, 254 insertions(+), 55 deletions(-) create mode 100644 explorer.app.config.json create mode 100644 explorer_mapping.js create mode 100644 hyperexplorer.json delete mode 100644 other.js diff --git a/blockscout.yml b/blockscout.yml index 34c0a70..bbc1800 100644 --- a/blockscout.yml +++ b/blockscout.yml @@ -3,9 +3,8 @@ services: image: 'redis:alpine' command: redis-server - db: - image: postgres:15 + image: postgres:14 shm_size: 256m restart: always command: postgres -c 'max_connections=200' -c 'client_connection_check_interval=60000' @@ -38,7 +37,9 @@ services: links: - db:database environment: - ETHEREUM_JSONRPC_VARIANT: 'geth' + - ETHEREUM_JSONRPC_VARIANT=geth + - DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout + frontend: depends_on: diff --git a/blockscout/common-blockscout.env b/blockscout/common-blockscout.env index 8ea2b23..448aa51 100644 --- a/blockscout/common-blockscout.env +++ b/blockscout/common-blockscout.env @@ -1,9 +1,9 @@ ETHEREUM_JSONRPC_VARIANT=geth -ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:8545/ +ETHEREUM_JSONRPC_HTTP_URL= # ETHEREUM_JSONRPC_FALLBACK_HTTP_URL= -DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout +DATABASE_URL= # DATABASE_QUEUE_TARGET -ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:8545/ +ETHEREUM_JSONRPC_TRACE_URL= # ETHEREUM_JSONRPC_FALLBACK_TRACE_URL= # ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL= # ETHEREUM_JSONRPC_ETH_CALL_URL= diff --git a/blockscout/common-frontend.env b/blockscout/common-frontend.env index 6bca03d..af9162d 100644 --- a/blockscout/common-frontend.env +++ b/blockscout/common-frontend.env @@ -1,6 +1,6 @@ -NEXT_PUBLIC_API_HOST=localhost:8099 +NEXT_PUBLIC_API_HOST=localhost:15001 NEXT_PUBLIC_API_PROTOCOL=http -NEXT_PUBLIC_STATS_API_HOST=http://localhost:8080 +NEXT_PUBLIC_STATS_API_HOST=http://localhost:15002 NEXT_PUBLIC_NETWORK_NAME=L1 Hyperchain NEXT_PUBLIC_NETWORK_SHORT_NAME=L1 Hyperchain NEXT_PUBLIC_NETWORK_ID=9 @@ -8,10 +8,10 @@ NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=ETH NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18 NEXT_PUBLIC_API_BASE_PATH=/ -NEXT_PUBLIC_APP_HOST=localhost:8099 +NEXT_PUBLIC_APP_HOST=localhost:15001 NEXT_PUBLIC_APP_PROTOCOL=http NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs'] -NEXT_PUBLIC_VISUALIZE_API_HOST=http://localhost:8081 +NEXT_PUBLIC_VISUALIZE_API_HOST=http://localhost:15003 NEXT_PUBLIC_IS_TESTNET=true NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=ws NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml diff --git a/docker-compose.yml b/docker-compose.yml index 9c0b4d4..af13d8a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,28 @@ +# This docker compose is setting up the full hyperchain network, consisting of: +# +# - L1 (reth) with explorer (blockscout) +# - a single postgres (with all the databases) +# - 3 zksync chains (with ids 270, 272, 273) - 'master', 'slave', 'slave2' +# - together with their explorers +# - hyperexplorer to merge it all together. + +# Ports: +# +# - hyperexplorer: http://localhost:15000 +# - l1 explorer: http://localhost:15001 (also using 15001, 15002, 15003) +# - l2 explorer: http://localhost:15005 (for all the chains) + +# - L1 chain (reth): 15045 + +# - L2 chains (each next chain is +100 for ports) +# - 15100 - http +# - 15101 - ws +# - 15102 - explorer api +# +# So 15100 - 'master', 15200 - 'slave', 15300 - 'slave2' + +# Database is on 15432 + services: reth: restart: always @@ -11,15 +36,18 @@ services: environment: - RUST_LOG=warn ports: - - 127.0.0.1:8545:8545 + - 127.0.0.1:15045:8545 + postgres: image: "postgres:14" + shm_size: 256m + # To create necessary databases for block explorer. volumes: - ./init.sql:/docker-entrypoint-initdb.d/init.sql - command: postgres -c 'max_connections=200' + command: postgres -c 'max_connections=400' ports: - - 127.0.0.1:5432:5432 + - 127.0.0.1:15432:5432 environment: # We bind only to 127.0.0.1, so setting insecure password is acceptable here - POSTGRES_PASSWORD=notsecurepassword @@ -41,8 +69,8 @@ services: - reth - postgres ports: - - 127.0.0.1:3050:3050 # JSON RPC HTTP port - - 127.0.0.1:3051:3051 # JSON RPC WS port + - 127.0.0.1:15100:3050 # JSON RPC HTTP port + - 127.0.0.1:15101:3051 # JSON RPC WS port environment: - DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_local - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_local @@ -62,8 +90,8 @@ services: volumes: - shared_config:/etc/master_env ports: - - 127.0.0.1:3060:3050 # JSON RPC HTTP port - - 127.0.0.1:3061:3051 # JSON RPC WS port + - 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 @@ -87,8 +115,8 @@ services: volumes: - shared_config:/etc/master_env ports: - - 127.0.0.1:3070:3050 # JSON RPC HTTP port - - 127.0.0.1:3071:3051 # JSON RPC WS port + - 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 @@ -112,8 +140,6 @@ services: - LOG_LEVEL=verbose - NODE_ENV=development - BLOCKCHAIN_RPC_URL=http://zksync:3050 - #ports: - # - '3040:3040' restart: unless-stopped data-fetcher_slave: @@ -124,8 +150,6 @@ services: - LOG_LEVEL=verbose - NODE_ENV=development - BLOCKCHAIN_RPC_URL=http://zksync_slave:3050 - #ports: - # - '3040:3040' restart: unless-stopped data-fetcher_slave2: @@ -136,8 +160,6 @@ services: - LOG_LEVEL=verbose - NODE_ENV=development - BLOCKCHAIN_RPC_URL=http://zksync_slave2:3050 - #ports: - # - '3040:3040' restart: unless-stopped @@ -202,7 +224,7 @@ services: - NODE_ENV=development - DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer ports: - - '127.0.0.1:3052:3020' + - '127.0.0.1:15102:3020' depends_on: - worker_main restart: unless-stopped @@ -218,7 +240,7 @@ services: - NODE_ENV=development - DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_slave ports: - - '127.0.0.1:3062:3020' + - '127.0.0.1:15202:3020' depends_on: - worker_slave restart: unless-stopped @@ -234,7 +256,7 @@ services: - NODE_ENV=development - DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_slave2 ports: - - '127.0.0.1:3072:3020' + - '127.0.0.1:15302:3020' depends_on: - worker_slave2 restart: unless-stopped @@ -243,12 +265,11 @@ services: platform: linux/amd64 image: "matterlabs/block-explorer-app:latest" volumes: - - ./explorer.app.config.json:/usr/src/app/packages/app/src/configs/dev.config.json - - ./explorer.app.config.json:/usr/src/app/packages/app/src/configs/local.config.json - - ./other.js:/usr/src/app/packages/app/dist/assets/dev.config.4e99e047.js + # This is super hacky - we should have a better solution. + - ./explorer_mapping.js:/usr/src/app/packages/app/dist/assets/dev.config.4e99e047.js ports: - - '3010:3010' + - '127.0.0.1:15005:3010' depends_on: - api_main - api_slave @@ -256,6 +277,91 @@ services: restart: unless-stopped +## Blockscout + + redis-db: + image: 'redis:alpine' + command: redis-server + + backend: + depends_on: + - postgres + - redis-db + image: blockscout/blockscout:latest + restart: always + stop_grace_period: 5m + command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" + env_file: + - blockscout/common-blockscout.env + links: + - postgres:database + environment: + - ETHEREUM_JSONRPC_VARIANT=geth + - DATABASE_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout + - ETHEREUM_JSONRPC_HTTP_URL=http://reth:8545 + - ETHEREUM_JSONRPC_TRACE_URL=http://reth:8545 + + + frontend: + depends_on: + - backend + image: ghcr.io/blockscout/frontend:latest + platform: linux/amd64 + restart: always + env_file: + - blockscout/common-frontend.env + + stats: + depends_on: + - backend + image: ghcr.io/blockscout/stats:latest + platform: linux/amd64 + restart: always + env_file: + - blockscout/common-stats.env + environment: + - STATS__DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout_stats + - STATS__BLOCKSCOUT_DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout + - STATS__CREATE_DATABASE=true + - STATS__RUN_MIGRATIONS=true + + proxy: + depends_on: + - backend + - frontend + - stats + image: nginx + volumes: + - "./blockscout/proxy:/etc/nginx/templates" + environment: + BACK_PROXY_PASS: http://backend:4000 + FRONT_PROXY_PASS: http://frontend:3000 + ports: + - target: 80 + published: 15001 + - target: 8080 + published: 15002 + - target: 8081 + published: 15003 + + sig-provider: + image: ghcr.io/blockscout/sig-provider:latest + platform: linux/amd64 + restart: always + + + hyperexplorer: + depends_on: + zksync: + condition: service_healthy + + image: ghcr.io/mm-zk/zksync_tools:latest + ports: + - 127.0.0.1:15000:5000 + volumes: + - ./hyperexplorer.json:/app/operator/config.json + + volumes: reth: shared_config: diff --git a/explorer.app.config.json b/explorer.app.config.json new file mode 100644 index 0000000..369bf1c --- /dev/null +++ b/explorer.app.config.json @@ -0,0 +1,49 @@ +{ + "networks": [ + { + "apiUrl": "http://localhost:3020", + "bridgeUrl": "http://localhost:3000/bridge", + "hostnames": [ + "localhost" + ], + "icon": "/images/icons/zksync-arrows.svg", + "l2ChainId": 270, + "l2NetworkName": "Locals", + "maintenance": false, + "name": "local", + "published": true, + "rpcUrl": "http://localhost:3050" + }, + { + "apiUrl": "https://block-explorer-api.sepolia.zksync.dev", + "verificationApiUrl": "https://explorer.sepolia.era.zksync.dev", + "bridgeUrl": "https://portal.zksync.io/bridge/?network=sepolia", + "hostnames": [], + "icon": "/images/icons/zksync-arrows.svg", + "l1ExplorerUrl": "https://sepolia.etherscan.io", + "l2ChainId": 300, + "l2NetworkName": "zkSync Era Sepolia Testnet", + "maintenance": false, + "name": "sepolia", + "published": true, + "rpcUrl": "https://sepolia.era.zksync.dev" + }, + { + "apiUrl": "https://block-explorer-api.mainnet.zksync.io", + "verificationApiUrl": "https://zksync2-mainnet-explorer.zksync.io", + "bridgeUrl": "https://portal.zksync.io/bridge/?network=mainnet", + "hostnames": [ + "https://staging-scan-v2.zksync.dev" + ], + "icon": "/images/icons/zksync-arrows.svg", + "l1ExplorerUrl": "https://etherscan.io", + "l2ChainId": 324, + "l2NetworkName": "zkSync Era Mainnet", + "maintenance": false, + "name": "mainnet", + "published": true, + "rpcUrl": "https://mainnet.era.zksync.io", + "tokensMinLiquidity": 0 + } + ] +} \ No newline at end of file diff --git a/explorer_mapping.js b/explorer_mapping.js new file mode 100644 index 0000000..e68e069 --- /dev/null +++ b/explorer_mapping.js @@ -0,0 +1,22 @@ +const e = [ + { + apiUrl: "http://localhost:15102", bridgeUrl: "http://localhost:3000/bridge", hostnames: [ + "localhost" + ], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 270, l2NetworkName: "Master", maintenance: !1, name: "local", published: !0, rpcUrl: "http://localhost:15100" + }, + { + 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" + }, + { + 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" + } + +]; var s = { + networks: e +}; export { + s as default, e as networks +}; \ No newline at end of file diff --git a/hyperexplorer.json b/hyperexplorer.json new file mode 100644 index 0000000..6ebceb1 --- /dev/null +++ b/hyperexplorer.json @@ -0,0 +1,34 @@ +{ + "networks": { + "local": { + "l1_url": "http://reth:8545", + "explorer_prefix": "http://localhost:15001/", + "explorer_address_prefix": "http://localhost:15001/address/", + "single_bridges": {}, + "shared_bridges": { + "kl_exp": { + "chains": { + "foo1": { + "chain_id": "0x10e", + "l2_url": "http://zksync:3050", + "explorer": "http://localhost:15005/?network=local", + "type": "rollup" + }, + "slave1": { + "chain_id": "0x110", + "l2_url": "http://zksync_slave:3050", + "explorer": "http://localhost:15005/?network=local_slave1", + "type": "rollup" + }, + "slave2": { + "chain_id": "0x111", + "l2_url": "http://zksync_slave2:3050", + "explorer": "http://localhost:15005/?network=local_slave2", + "type": "rollup" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/notes.md b/notes.md index 076fc81..2930053 100644 --- a/notes.md +++ b/notes.md @@ -199,4 +199,13 @@ Configs compiled for docker zk f zksync_server --genesis zk contract deploy-l2-through-l1 - --failed on 'initializing chain governance' \ No newline at end of file + --failed on 'initializing chain governance' + + + ## Manual transfer + + ``` + cast send -r http://localhost:8545 --private-key 0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be 0x35A3783781DE026E1e854A6DA45d7a903664a9dA "requestL2TransactionDirect((uint256, uint256, address, uint256, bytes, uint256, uint256, bytes[], address))" "(270,0xde0b6b3a7640000,0x005C43B2063625e9425943Fec65c42d005a2cD1f,10000000000000,"",10000000,800,[0x1234567890123456789012345678901234567890123456789012345678901234],0x005C43B2063625e9425943Fec65c42d005a2cD1f)" --value=1000000000000000000 + ``` + + \ No newline at end of file diff --git a/other.js b/other.js deleted file mode 100644 index f11e388..0000000 --- a/other.js +++ /dev/null @@ -1,22 +0,0 @@ -const e = [ - { - apiUrl: "http://localhost:3052", bridgeUrl: "http://localhost:3000/bridge", hostnames: [ - "localhost" - ], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 270, l2NetworkName: "Localzz", maintenance: !1, name: "local", published: !0, rpcUrl: "http://localhost:3050" - }, - { - apiUrl: "http://localhost:3062", bridgeUrl: "http://localhost:3000/bridge", hostnames: [ - "localhost" - ], icon: "/images/icons/zksync-arrows.svg", l2ChainId: 272, l2NetworkName: "Slave1", maintenance: !1, name: "local_slave1", published: !0, rpcUrl: "http://localhost:3060" - }, - { - apiUrl: "http://localhost:3072", 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:3070" - } - -]; var s = { - networks: e -}; export { - s as default, e as networks -}; \ No newline at end of file From 79c99098d594d75318ecbbe13d139441d005edc8 Mon Sep 17 00:00:00 2001 From: mm Date: Tue, 7 May 2024 11:28:18 +0200 Subject: [PATCH 06/11] cleanup and move to separate file --- blockscout.yml | 88 -------- docker-compose.yml | 334 +------------------------------ hyperchain-docker-compose.yml | 367 ++++++++++++++++++++++++++++++++++ notes.md | 15 +- 4 files changed, 386 insertions(+), 418 deletions(-) delete mode 100644 blockscout.yml create mode 100644 hyperchain-docker-compose.yml diff --git a/blockscout.yml b/blockscout.yml deleted file mode 100644 index bbc1800..0000000 --- a/blockscout.yml +++ /dev/null @@ -1,88 +0,0 @@ -services: - redis-db: - image: 'redis:alpine' - command: redis-server - - db: - image: postgres:14 - shm_size: 256m - restart: always - command: postgres -c 'max_connections=200' -c 'client_connection_check_interval=60000' - environment: - POSTGRES_DB: 'blockscout' - POSTGRES_USER: 'blockscout' - POSTGRES_PASSWORD: 'ceWb1MeLBEeOIfk65gU8EjF8' - ports: - - target: 5432 - published: 7432 - healthcheck: - test: ["CMD-SHELL", "pg_isready -U blockscout -d blockscout"] - interval: 10s - timeout: 5s - retries: 5 - start_period: 10s - - backend: - depends_on: - - db - - redis-db - image: blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest} - restart: always - stop_grace_period: 5m - command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - blockscout/common-blockscout.env - links: - - db:database - environment: - - ETHEREUM_JSONRPC_VARIANT=geth - - DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout - - - frontend: - depends_on: - - backend - image: ghcr.io/blockscout/frontend:${FRONTEND_DOCKER_TAG:-latest} - platform: linux/amd64 - restart: always - env_file: - - blockscout/common-frontend.env - - stats: - depends_on: - - backend - image: ghcr.io/blockscout/stats:${STATS_DOCKER_TAG:-latest} - platform: linux/amd64 - restart: always - extra_hosts: - - 'host.docker.internal:host-gateway' - env_file: - - blockscout/common-stats.env - environment: - - STATS__DB_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/stats - - STATS__BLOCKSCOUT_DB_URL=${STATS__BLOCKSCOUT_DB_URL:-postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout} - - STATS__CREATE_DATABASE=true - - STATS__RUN_MIGRATIONS=true - - proxy: - depends_on: - - backend - - frontend - - stats - image: nginx - extra_hosts: - - 'host.docker.internal:host-gateway' - volumes: - - "./blockscout/proxy:/etc/nginx/templates" - environment: - BACK_PROXY_PASS: ${BACK_PROXY_PASS:-http://backend:4000} - FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://frontend:3000} - ports: - - target: 80 - published: 8099 - - target: 8080 - published: 8080 - - target: 8081 - published: 8081 diff --git a/docker-compose.yml b/docker-compose.yml index af13d8a..286eb5d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,3 @@ -# This docker compose is setting up the full hyperchain network, consisting of: -# -# - L1 (reth) with explorer (blockscout) -# - a single postgres (with all the databases) -# - 3 zksync chains (with ids 270, 272, 273) - 'master', 'slave', 'slave2' -# - together with their explorers -# - hyperexplorer to merge it all together. - -# Ports: -# -# - hyperexplorer: http://localhost:15000 -# - l1 explorer: http://localhost:15001 (also using 15001, 15002, 15003) -# - l2 explorer: http://localhost:15005 (for all the chains) - -# - L1 chain (reth): 15045 - -# - L2 chains (each next chain is +100 for ports) -# - 15100 - http -# - 15101 - ws -# - 15102 - explorer api -# -# So 15100 - 'master', 15200 - 'slave', 15300 - 'slave2' - -# Database is on 15432 - services: reth: restart: always @@ -36,332 +11,35 @@ services: environment: - RUST_LOG=warn ports: - - 127.0.0.1:15045:8545 - + - 127.0.0.1:8545:8545 postgres: image: "postgres:14" - shm_size: 256m - - # To create necessary databases for block explorer. - volumes: - - ./init.sql:/docker-entrypoint-initdb.d/init.sql - command: postgres -c 'max_connections=400' + command: postgres -c 'max_connections=200' ports: - - 127.0.0.1:15432:5432 + - 127.0.0.1:5432:5432 environment: # We bind only to 127.0.0.1, so setting insecure password is acceptable here - POSTGRES_PASSWORD=notsecurepassword - - # Master node - that will create the hyperchain zksync: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0506-2 + image: matterlabs/local-node:${INSTANCE_TYPE:-latest2.0} healthcheck: test: curl --fail http://localhost:3071/health || exit 1 interval: 10s timeout: 5s retries: 20 start_period: 30s - volumes: - - shared_config:/etc/env/target depends_on: - reth - postgres ports: - - 127.0.0.1:15100:3050 # JSON RPC HTTP port - - 127.0.0.1:15101:3051 # JSON RPC WS port + - 127.0.0.1:3050:3050 # JSON RPC HTTP port + - 127.0.0.1:3051:3051 # JSON RPC WS port environment: - DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_local - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_local - ETH_CLIENT_WEB3_URL=http://reth:8545 - - - zksync_slave: - stdin_open: true - tty: true - image: matterlabs/local-node:mmzk_0506-2 - #entrypoint: sleep 1000000 - depends_on: - - reth - - postgres - - zksync - volumes: - - shared_config:/etc/master_env - 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 - - 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 - - zksync_slave2: - stdin_open: true - tty: true - image: matterlabs/local-node:mmzk_0506-2 - #entrypoint: sleep 1000000 - depends_on: - - reth - - postgres - - zksync - - zksync_slave # daisy chain - volumes: - - shared_config:/etc/master_env - 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 - - 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_ENV_FILE=/etc/master_env/dev.env - - - - - - - data-fetcher_main: - platform: linux/amd64 - image: "matterlabs/block-explorer-data-fetcher:latest" - environment: - - PORT=3040 - - LOG_LEVEL=verbose - - NODE_ENV=development - - BLOCKCHAIN_RPC_URL=http://zksync:3050 - restart: unless-stopped - - data-fetcher_slave: - 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 - restart: unless-stopped - - data-fetcher_slave2: - 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 - restart: unless-stopped - - - - worker_main: - platform: linux/amd64 - image: "matterlabs/block-explorer-worker:latest" - environment: - - PORT=3001 - - LOG_LEVEL=verbose - - NODE_ENV=development - - DATABASE_HOST=postgres - - DATABASE_USER=postgres - - DATABASE_PASSWORD=notsecurepassword - - DATABASE_NAME=block-explorer - - BLOCKCHAIN_RPC_URL=http://zksync:3050 - - DATA_FETCHER_URL=http://data-fetcher_main:3040 - - BATCHES_PROCESSING_POLLING_INTERVAL=1000 - restart: unless-stopped - - worker_slave: - platform: linux/amd64 - image: "matterlabs/block-explorer-worker:latest" - environment: - - PORT=3001 - - LOG_LEVEL=verbose - - NODE_ENV=development - - 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 - - BATCHES_PROCESSING_POLLING_INTERVAL=1000 - restart: unless-stopped - - - worker_slave2: - platform: linux/amd64 - image: "matterlabs/block-explorer-worker:latest" - environment: - - PORT=3001 - - LOG_LEVEL=verbose - - NODE_ENV=development - - 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 - - BATCHES_PROCESSING_POLLING_INTERVAL=1000 - restart: unless-stopped - - - api_main: - 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 - ports: - - '127.0.0.1:15102:3020' - depends_on: - - worker_main - restart: unless-stopped - - - api_slave: - 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 - ports: - - '127.0.0.1:15202:3020' - depends_on: - - worker_slave - restart: unless-stopped - - - api_slave2: - 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 - ports: - - '127.0.0.1:15302:3020' - depends_on: - - worker_slave2 - restart: unless-stopped - - app: - platform: linux/amd64 - image: "matterlabs/block-explorer-app:latest" - volumes: - # This is super hacky - we should have a better solution. - - ./explorer_mapping.js:/usr/src/app/packages/app/dist/assets/dev.config.4e99e047.js - - ports: - - '127.0.0.1:15005:3010' - depends_on: - - api_main - - api_slave - - api_slave2 - restart: unless-stopped - - -## Blockscout - - redis-db: - image: 'redis:alpine' - command: redis-server - - backend: - depends_on: - - postgres - - redis-db - image: blockscout/blockscout:latest - restart: always - stop_grace_period: 5m - command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" - env_file: - - blockscout/common-blockscout.env - links: - - postgres:database - environment: - - ETHEREUM_JSONRPC_VARIANT=geth - - DATABASE_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout - - ETHEREUM_JSONRPC_HTTP_URL=http://reth:8545 - - ETHEREUM_JSONRPC_TRACE_URL=http://reth:8545 - - - frontend: - depends_on: - - backend - image: ghcr.io/blockscout/frontend:latest - platform: linux/amd64 - restart: always - env_file: - - blockscout/common-frontend.env - - stats: - depends_on: - - backend - image: ghcr.io/blockscout/stats:latest - platform: linux/amd64 - restart: always - env_file: - - blockscout/common-stats.env - environment: - - STATS__DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout_stats - - STATS__BLOCKSCOUT_DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout - - STATS__CREATE_DATABASE=true - - STATS__RUN_MIGRATIONS=true - - proxy: - depends_on: - - backend - - frontend - - stats - image: nginx - volumes: - - "./blockscout/proxy:/etc/nginx/templates" - environment: - BACK_PROXY_PASS: http://backend:4000 - FRONT_PROXY_PASS: http://frontend:3000 - ports: - - target: 80 - published: 15001 - - target: 8080 - published: 15002 - - target: 8081 - published: 15003 - - sig-provider: - image: ghcr.io/blockscout/sig-provider:latest - platform: linux/amd64 - restart: always - - - hyperexplorer: - depends_on: - zksync: - condition: service_healthy - - image: ghcr.io/mm-zk/zksync_tools:latest - ports: - - 127.0.0.1:15000:5000 - volumes: - - ./hyperexplorer.json:/app/operator/config.json - - volumes: reth: - shared_config: diff --git a/hyperchain-docker-compose.yml b/hyperchain-docker-compose.yml new file mode 100644 index 0000000..af13d8a --- /dev/null +++ b/hyperchain-docker-compose.yml @@ -0,0 +1,367 @@ +# This docker compose is setting up the full hyperchain network, consisting of: +# +# - L1 (reth) with explorer (blockscout) +# - a single postgres (with all the databases) +# - 3 zksync chains (with ids 270, 272, 273) - 'master', 'slave', 'slave2' +# - together with their explorers +# - hyperexplorer to merge it all together. + +# Ports: +# +# - hyperexplorer: http://localhost:15000 +# - l1 explorer: http://localhost:15001 (also using 15001, 15002, 15003) +# - l2 explorer: http://localhost:15005 (for all the chains) + +# - L1 chain (reth): 15045 + +# - L2 chains (each next chain is +100 for ports) +# - 15100 - http +# - 15101 - ws +# - 15102 - explorer api +# +# So 15100 - 'master', 15200 - 'slave', 15300 - 'slave2' + +# Database is on 15432 + +services: + reth: + restart: always + image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2" + volumes: + - type: bind + source: ./reth_chaindata + target: /chaindata + + command: node --dev --datadir /rethdata --http --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config + environment: + - RUST_LOG=warn + ports: + - 127.0.0.1:15045:8545 + + postgres: + image: "postgres:14" + shm_size: 256m + + # To create necessary databases for block explorer. + volumes: + - ./init.sql:/docker-entrypoint-initdb.d/init.sql + command: postgres -c 'max_connections=400' + ports: + - 127.0.0.1:15432:5432 + environment: + # We bind only to 127.0.0.1, so setting insecure password is acceptable here + - POSTGRES_PASSWORD=notsecurepassword + + # Master node - that will create the hyperchain + zksync: + stdin_open: true + tty: true + image: matterlabs/local-node:mmzk_0506-2 + healthcheck: + test: curl --fail http://localhost:3071/health || exit 1 + interval: 10s + timeout: 5s + retries: 20 + start_period: 30s + volumes: + - shared_config:/etc/env/target + depends_on: + - reth + - postgres + ports: + - 127.0.0.1:15100:3050 # JSON RPC HTTP port + - 127.0.0.1:15101:3051 # JSON RPC WS port + environment: + - DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_local + - DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_local + - ETH_CLIENT_WEB3_URL=http://reth:8545 + + + + zksync_slave: + stdin_open: true + tty: true + image: matterlabs/local-node:mmzk_0506-2 + #entrypoint: sleep 1000000 + depends_on: + - reth + - postgres + - zksync + volumes: + - shared_config:/etc/master_env + 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 + - 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 + + zksync_slave2: + stdin_open: true + tty: true + image: matterlabs/local-node:mmzk_0506-2 + #entrypoint: sleep 1000000 + depends_on: + - reth + - postgres + - zksync + - zksync_slave # daisy chain + volumes: + - shared_config:/etc/master_env + 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 + - 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_ENV_FILE=/etc/master_env/dev.env + + + + + + + data-fetcher_main: + platform: linux/amd64 + image: "matterlabs/block-explorer-data-fetcher:latest" + environment: + - PORT=3040 + - LOG_LEVEL=verbose + - NODE_ENV=development + - BLOCKCHAIN_RPC_URL=http://zksync:3050 + restart: unless-stopped + + data-fetcher_slave: + 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 + restart: unless-stopped + + data-fetcher_slave2: + 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 + restart: unless-stopped + + + + worker_main: + platform: linux/amd64 + image: "matterlabs/block-explorer-worker:latest" + environment: + - PORT=3001 + - LOG_LEVEL=verbose + - NODE_ENV=development + - DATABASE_HOST=postgres + - DATABASE_USER=postgres + - DATABASE_PASSWORD=notsecurepassword + - DATABASE_NAME=block-explorer + - BLOCKCHAIN_RPC_URL=http://zksync:3050 + - DATA_FETCHER_URL=http://data-fetcher_main:3040 + - BATCHES_PROCESSING_POLLING_INTERVAL=1000 + restart: unless-stopped + + worker_slave: + platform: linux/amd64 + image: "matterlabs/block-explorer-worker:latest" + environment: + - PORT=3001 + - LOG_LEVEL=verbose + - NODE_ENV=development + - 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 + - BATCHES_PROCESSING_POLLING_INTERVAL=1000 + restart: unless-stopped + + + worker_slave2: + platform: linux/amd64 + image: "matterlabs/block-explorer-worker:latest" + environment: + - PORT=3001 + - LOG_LEVEL=verbose + - NODE_ENV=development + - 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 + - BATCHES_PROCESSING_POLLING_INTERVAL=1000 + restart: unless-stopped + + + api_main: + 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 + ports: + - '127.0.0.1:15102:3020' + depends_on: + - worker_main + restart: unless-stopped + + + api_slave: + 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 + ports: + - '127.0.0.1:15202:3020' + depends_on: + - worker_slave + restart: unless-stopped + + + api_slave2: + 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 + ports: + - '127.0.0.1:15302:3020' + depends_on: + - worker_slave2 + restart: unless-stopped + + app: + platform: linux/amd64 + image: "matterlabs/block-explorer-app:latest" + volumes: + # This is super hacky - we should have a better solution. + - ./explorer_mapping.js:/usr/src/app/packages/app/dist/assets/dev.config.4e99e047.js + + ports: + - '127.0.0.1:15005:3010' + depends_on: + - api_main + - api_slave + - api_slave2 + restart: unless-stopped + + +## Blockscout + + redis-db: + image: 'redis:alpine' + command: redis-server + + backend: + depends_on: + - postgres + - redis-db + image: blockscout/blockscout:latest + restart: always + stop_grace_period: 5m + command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start" + env_file: + - blockscout/common-blockscout.env + links: + - postgres:database + environment: + - ETHEREUM_JSONRPC_VARIANT=geth + - DATABASE_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout + - ETHEREUM_JSONRPC_HTTP_URL=http://reth:8545 + - ETHEREUM_JSONRPC_TRACE_URL=http://reth:8545 + + + frontend: + depends_on: + - backend + image: ghcr.io/blockscout/frontend:latest + platform: linux/amd64 + restart: always + env_file: + - blockscout/common-frontend.env + + stats: + depends_on: + - backend + image: ghcr.io/blockscout/stats:latest + platform: linux/amd64 + restart: always + env_file: + - blockscout/common-stats.env + environment: + - STATS__DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout_stats + - STATS__BLOCKSCOUT_DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout + - STATS__CREATE_DATABASE=true + - STATS__RUN_MIGRATIONS=true + + proxy: + depends_on: + - backend + - frontend + - stats + image: nginx + volumes: + - "./blockscout/proxy:/etc/nginx/templates" + environment: + BACK_PROXY_PASS: http://backend:4000 + FRONT_PROXY_PASS: http://frontend:3000 + ports: + - target: 80 + published: 15001 + - target: 8080 + published: 15002 + - target: 8081 + published: 15003 + + sig-provider: + image: ghcr.io/blockscout/sig-provider:latest + platform: linux/amd64 + restart: always + + + hyperexplorer: + depends_on: + zksync: + condition: service_healthy + + image: ghcr.io/mm-zk/zksync_tools:latest + ports: + - 127.0.0.1:15000:5000 + volumes: + - ./hyperexplorer.json:/app/operator/config.json + + +volumes: + reth: + shared_config: diff --git a/notes.md b/notes.md index 2930053..6b9523d 100644 --- a/notes.md +++ b/notes.md @@ -204,8 +204,19 @@ Configs compiled for docker ## Manual transfer + +Make sure to get the correct bridgehub address (in this example: 0x35A3783781DE026E1e854A6DA45d7a903664a9dA) from the hyperexplorer. + ``` - cast send -r http://localhost:8545 --private-key 0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be 0x35A3783781DE026E1e854A6DA45d7a903664a9dA "requestL2TransactionDirect((uint256, uint256, address, uint256, bytes, uint256, uint256, bytes[], address))" "(270,0xde0b6b3a7640000,0x005C43B2063625e9425943Fec65c42d005a2cD1f,10000000000000,"",10000000,800,[0x1234567890123456789012345678901234567890123456789012345678901234],0x005C43B2063625e9425943Fec65c42d005a2cD1f)" --value=1000000000000000000 + cast send -r http://localhost:15045 --private-key 0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be 0x35A3783781DE026E1e854A6DA45d7a903664a9dA "requestL2TransactionDirect((uint256, uint256, address, uint256, bytes, uint256, uint256, bytes[], address))" "(270,0xde0b6b3a7640000,0x005C43B2063625e9425943Fec65c42d005a2cD1f,10000000000000,"",10000000,800,[0x1234567890123456789012345678901234567890123456789012345678901234],0x005C43B2063625e9425943Fec65c42d005a2cD1f)" --value=1000000000000000000 ``` - \ No newline at end of file +## Hyperchains + +Will start a hyperchain with 3 L2s, L1 and necessary explorers. + +To run: + +```shell +docker compose -f hyperchain-docker-compose.yml up -d +``` \ No newline at end of file From c5f697c5d0ec1d7418b0a3498bf20616fbfdcb9c Mon Sep 17 00:00:00 2001 From: mm Date: Tue, 7 May 2024 12:02:56 +0200 Subject: [PATCH 07/11] updated readme --- README.md | 23 ++++++ notes.md | 222 ------------------------------------------------------ 2 files changed, 23 insertions(+), 222 deletions(-) delete mode 100644 notes.md diff --git a/README.md b/README.md index dd0cb2c..6b72376 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,26 @@ git clone https://github.com/matter-labs/tutorial-examples.git cd local-setup-testing yarn test ``` + + + +## Hyperchains + +Will start a hyperchain with 3 L2s, L1 and necessary explorers. + +To run: + +```shell +docker compose -f hyperchain-docker-compose.yml up -d +``` + + + +### Manual transfer to hyperchains + + +Make sure to get the correct bridgehub address (in this example: 0x35A3783781DE026E1e854A6DA45d7a903664a9dA) from the hyperexplorer. + + ``` + cast send -r http://localhost:15045 --private-key 0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be 0x35A3783781DE026E1e854A6DA45d7a903664a9dA "requestL2TransactionDirect((uint256, uint256, address, uint256, bytes, uint256, uint256, bytes[], address))" "(270,0xde0b6b3a7640000,0x005C43B2063625e9425943Fec65c42d005a2cD1f,10000000000000,"",10000000,800,[0x1234567890123456789012345678901234567890123456789012345678901234],0x005C43B2063625e9425943Fec65c42d005a2cD1f)" --value=1000000000000000000 + ``` \ No newline at end of file diff --git a/notes.md b/notes.md deleted file mode 100644 index 6b9523d..0000000 --- a/notes.md +++ /dev/null @@ -1,222 +0,0 @@ -CHAIN_ETH_ZKSYNC_NETWORK_ID=271 --- inside base/chain.toml - -export MNEMONIC="misery lizard beach magic blue one genre damage excess police image become" - -also remember to 're-init' the databse (with 'limited' entrypoint.sh) - - -Change the CONTRACTS_BRIDGEHUB_PROXY_ADDR=0x35A3783781DE026E1e854A6DA45d7a903664a9dA -inside vim /etc/env/target/dev.env (or better in /etc/env/l1-inits/.init.env) - -zk f yarn register-hyperchain -from /contracts/l1-contracts - -Wrong mnemonic derivation?? - 0x3641c494B824FCe82f067Ac2154028C5aa4dA61B -cast send -r http://localhost:8545 0x3641c494B824FCe82f067Ac2154028C5aa4dA61B --value 100ether 0x --private-key 0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be - -Had to use the 'original' mnemonic (fine music test violin matrix prize squirrel panther purchase material script deal) - as the other one was not the owner.. - -All these below should be changed in contracts.toml (or probably those l1-inits/.init.env) - -CONTRACTS_STATE_TRANSITION_PROXY_ADDR=0x358E8b343f5Fd58aC74B262c4492BdFB9CC94116 - -error: chainid already registered -change -CHAIN_ETH_ZKSYNC_NETWORK_ID=271 - -STM: initial cutHash mismatch - -I need: -admin, getter mailbox and executor facets. - -CONTRACTS_ADMIN_FACET_ADDR=0xde1eE9622c8D6F7Da5bb7fB6dAa456f7cbF8a68d -CONTRACTS_MAILBOX_FACET_ADDR=0xfF33105a4BC25D8e2d152850d040286800E906e1 -CONTRACTS_EXECUTOR_FACET_ADDR=0x72093667348cA8381aFA17BBBe97946cc26B9B63 -CONTRACTS_GETTERS_FACET_ADDR=0x359fC3e2c4417C19f48089DB28a6a51c16e92822 - -and diamond init: -CONTRACTS_DIAMOND_INIT_ADDR=0x9fbFBa544B76F67Bf821E3468990B21bFaE45a10 - -CONTRACTS_BLOB_VERSIONED_HASH_RETRIEVER_ADDR=0x585dFAf7332B9a725b8A1957fc6eF544A732bAD9 -CONTRACTS_VERIFIER_ADDR=0x4e49ee147EaD1e39951B9779eA11e16eA30b19C2 - -And this was the output: - - - -Using deployer wallet: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE -Using governor address: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE -Using gas price: 1.500000001 gwei -Using nonce: 170 -Using base token address: 0x0000000000000000000000000000000000000001 -Hyperchain registered, gas used: 3193077 and 3193077 -Hyperchain registration tx hash: 0x49afc2e91b38a9f3cd4b3098ff27f83962aa4ff1bf1222998f329a707c163c94 - -CHAIN_ETH_ZKSYNC_NETWORK_ID=271 -CONTRACTS_BASE_TOKEN_ADDR=0x0000000000000000000000000000000000000001 -CONTRACTS_DIAMOND_PROXY_ADDR=0x7a50c1212c74fac4c8dbffaf96a4ceab32737d50 - -Validator registered, gas used: 21584, tx hash: 0xc37c42d4da1f8e451c20f79dd6aaadebbf969269f81f02254b19e51cc8dc7185 -Validator 2 registered, gas used: 21572 -BaseTokenMultiplier set, gas used: 55290 -Done in 5.58s. - - -Now we also have to deploy the ValidatorTimelock.. - - and it needs CONTRACTS_CREATE2_FACTORY_ADDR - (this required some 'hacking' of the deploy-utils).. - - and now we get: CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0xC8cAD763dC6FF0985FD2434400db58e26C5B936e - ^^this was still via: zk f yarn deploy-no-build - - - - zk f yarn initialize-validator - Error: Hyperchain: not state transition manager... - Or maybe this is really not needed - do we need a separate validator? or can they share?? - - - -Now tryign to deploy l2 through l1. -CONTRACTS_BASE_TOKEN_ADDR=0x0000000000000000000000000000000000000001 - -zk config compile dev - -This also requires governance to be set (as this is what 'approves' this). -CONTRACTS_GOVERNANCE_ADDR - -And now this worked: -zk contract deploy-l2-through-l1 - -We also need MultiCall3.. -CONTRACTS_L1_MULTICALL3_ADDR=0xCF506433F1e04c008c7f230a8d2B8f9dd885837A - - -Now zk f zksync_server (remember - from the '/' dir). - -it fails on ValidatorTimelock: only validator. - -CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0x66D64f3af78E0E4FC6F6f1922f728513BBC303Bd - -And now -- nonce too low - I probably use the same operator as in the other chain.. -(I had to update nonce in eth_txs - and remove entry from eth_txs_history). - -I have 'from': 0x4F9133D1d3F50011A6859807C837bdCB31Aaab13 (which is the same as 'commit' operator in the first chain). - - - - -ok - Ihave to tell 'validator timelock', that I'm a validator for this new chain -id -Ok - the issue was, that we didn't set the correct timelock early enough.. - -So let's fix it for real, 2 new keys: -Address: 0xdbE3094f075AA8bC8D3EFeA39a488c759849Fa63 -Private key: 0xbadbb556964c61aa6e752d2844a7cb942d85954affd2d0318c3a0d7dc97001d9 - -Address: 0xAC044784A139C70A589A8C17B5229D58ed0D786d -Private key: 0x13821fd6d08beb983d1139f7d3087cd2372f1cd7606e87d19aaa4a925e391b90 - - -Update private.toml -// Remember to send some money there. - -And re-registering: -yarn run v1.22.22 -$ ts-node scripts/register-hyperchain.ts -Using deployer wallet: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE -Using governor address: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE -Using gas price: 1.500000001 gwei -Using nonce: 187 -Using base token address: 0x0000000000000000000000000000000000000001 -Validator registered, gas used: 73274, tx hash: 0x8ae33f67c2205dc603d882b89358c6c53477ba7ae2b321239e2743175d204703 -Validator 2 registered, gas used: 73274 -Done in 4.66s. - - -## Stuff to do: -* zkcli - to support chain id -* explorer app - to display different options - - -### Summary - -## Trying again - -CHAIN_ETH_ZKSYNC_NETWORK_ID=272 -- clearly select early. - -* generate the wallets for the operator & blob operator. - -Copy from the main one: - -CONTRACTS_BRIDGEHUB_PROXY_ADDR=0x35A3783781DE026E1e854A6DA45d7a903664a9dA -CONTRACTS_STATE_TRANSITION_PROXY_ADDR=0x358E8b343f5Fd58aC74B262c4492BdFB9CC94116 -CONTRACTS_ADMIN_FACET_ADDR=0xde1eE9622c8D6F7Da5bb7fB6dAa456f7cbF8a68d -CONTRACTS_MAILBOX_FACET_ADDR=0xfF33105a4BC25D8e2d152850d040286800E906e1 -CONTRACTS_EXECUTOR_FACET_ADDR=0x72093667348cA8381aFA17BBBe97946cc26B9B63 -CONTRACTS_GETTERS_FACET_ADDR=0x359fC3e2c4417C19f48089DB28a6a51c16e92822 -CONTRACTS_DIAMOND_INIT_ADDR=0x9fbFBa544B76F67Bf821E3468990B21bFaE45a10 -CONTRACTS_BLOB_VERSIONED_HASH_RETRIEVER_ADDR=0x585dFAf7332B9a725b8A1957fc6eF544A732bAD9 -CONTRACTS_VERIFIER_ADDR=0x4e49ee147EaD1e39951B9779eA11e16eA30b19C2 -CONTRACTS_L1_MULTICALL3_ADDR=0xCF506433F1e04c008c7f230a8d2B8f9dd885837A -CONTRACTS_VALIDATOR_TIMELOCK_ADDR=0x66D64f3af78E0E4FC6F6f1922f728513BBC303Bd -CONTRACTS_GOVERNANCE_ADDR=0x808Dfd96334E52c043e524C16FDD94832884302E - -Successfully created new keypair. -Address: 0xEc39FE3212FedB610842DC15C7a64F6Ef2Cb003B -Private key: 0xca274905a4b9da86b41a0527228468057f1e901970d2e13bf5b0f3cfde1e6210 -➜ local-setup git:(mmzk_0427_with_hyperchain) ✗ cast wallet new -Successfully created new keypair. -Address: 0x7217599A3129c7f3F9e907ae8f25CCDaDdA40756 -Private key: 0x6782bd9efb4cd8a84a52a78b431a20e8811801f9b4d63978d2ec00b33fef7ff6 - -ETH_SENDER_SENDER_OPERATOR_PRIVATE_KEY=0xca274905a4b9da86b41a0527228468057f1e901970d2e13bf5b0f3cfde1e6210 -ETH_SENDER_SENDER_OPERATOR_COMMIT_ETH_ADDR=0xEc39FE3212FedB610842DC15C7a64F6Ef2Cb003B -ETH_SENDER_SENDER_OPERATOR_BLOBS_PRIVATE_KEY=0x6782bd9efb4cd8a84a52a78b431a20e8811801f9b4d63978d2ec00b33fef7ff6 -ETH_SENDER_SENDER_OPERATOR_BLOBS_ETH_ADDR=0x7217599A3129c7f3F9e907ae8f25CCDaDdA40756 - - -zk db reset -zk contract register-hyperchain - -$ ts-node scripts/register-hyperchain.ts -Using deployer wallet: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE -Using governor address: 0x52312AD6f01657413b2eaE9287f6B9ADaD93D5FE -Using gas price: 1.500000001 gwei -Using nonce: 189 -Using base token address: 0x0000000000000000000000000000000000000001 -Hyperchain registered, gas used: 3193077 and 3193077 -Hyperchain registration tx hash: 0x7e613e87ea2391f4944d53698038c20c08d18a5ffa5700839c2be552578d64e8 -CHAIN_ETH_ZKSYNC_NETWORK_ID=272 -CONTRACTS_BASE_TOKEN_ADDR=0x0000000000000000000000000000000000000001 -CONTRACTS_DIAMOND_PROXY_ADDR=0xac4edbf79496b70e82ec4359d8b9eb0b6da457a7 -Validator registered, gas used: 73262, tx hash: 0x4a1790757e2f2a5e72f00bb066cfe3e753324f58eb3d8b88542ef25e052a0700 -Validator 2 registered, gas used: 73274 -BaseTokenMultiplier set, gas used: 55290 -Done in 5.90s. -Writing to etc/env/l2-inits/docker.init.env -Configs compiled for docker - - zk f zksync_server --genesis - zk contract deploy-l2-through-l1 - --failed on 'initializing chain governance' - - - ## Manual transfer - - -Make sure to get the correct bridgehub address (in this example: 0x35A3783781DE026E1e854A6DA45d7a903664a9dA) from the hyperexplorer. - - ``` - cast send -r http://localhost:15045 --private-key 0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be 0x35A3783781DE026E1e854A6DA45d7a903664a9dA "requestL2TransactionDirect((uint256, uint256, address, uint256, bytes, uint256, uint256, bytes[], address))" "(270,0xde0b6b3a7640000,0x005C43B2063625e9425943Fec65c42d005a2cD1f,10000000000000,"",10000000,800,[0x1234567890123456789012345678901234567890123456789012345678901234],0x005C43B2063625e9425943Fec65c42d005a2cD1f)" --value=1000000000000000000 - ``` - -## Hyperchains - -Will start a hyperchain with 3 L2s, L1 and necessary explorers. - -To run: - -```shell -docker compose -f hyperchain-docker-compose.yml up -d -``` \ No newline at end of file From 6b747d3217ed886cfe19726d2d0124dca5419564 Mon Sep 17 00:00:00 2001 From: mm Date: Tue, 7 May 2024 12:08:25 +0200 Subject: [PATCH 08/11] updated to proper docker version (hyperlocal) --- hyperchain-docker-compose.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hyperchain-docker-compose.yml b/hyperchain-docker-compose.yml index af13d8a..be4a570 100644 --- a/hyperchain-docker-compose.yml +++ b/hyperchain-docker-compose.yml @@ -56,7 +56,7 @@ services: zksync: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0506-2 + image: matterlabs/local-node:hyperlocal healthcheck: test: curl --fail http://localhost:3071/health || exit 1 interval: 10s @@ -81,8 +81,7 @@ services: zksync_slave: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0506-2 - #entrypoint: sleep 1000000 + image: matterlabs/local-node:hyperlocal depends_on: - reth - postgres @@ -105,8 +104,7 @@ services: zksync_slave2: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0506-2 - #entrypoint: sleep 1000000 + image: matterlabs/local-node:hyperlocal depends_on: - reth - postgres From b6654aa4c2af250ce258f80edb456692ec14bc40 Mon Sep 17 00:00:00 2001 From: mm Date: Wed, 8 May 2024 19:17:26 +0200 Subject: [PATCH 09/11] added validium and custombase support --- explorer_mapping.js | 4 +- hyperchain-docker-compose.yml | 74 +++++++++++++++++++---------------- hyperexplorer.json | 12 +++--- init.sql | 4 +- 4 files changed, 51 insertions(+), 43 deletions(-) diff --git a/explorer_mapping.js b/explorer_mapping.js index e68e069..6045947 100644 --- a/explorer_mapping.js +++ b/explorer_mapping.js @@ -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 = { diff --git a/hyperchain-docker-compose.yml b/hyperchain-docker-compose.yml index be4a570..3dd727c 100644 --- a/hyperchain-docker-compose.yml +++ b/hyperchain-docker-compose.yml @@ -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. @@ -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 @@ -56,7 +56,7 @@ services: zksync: stdin_open: true tty: true - image: matterlabs/local-node:hyperlocal + image: matterlabs/local-node:mmzk_0508-1 healthcheck: test: curl --fail http://localhost:3071/health || exit 1 interval: 10s @@ -65,6 +65,7 @@ services: start_period: 30s volumes: - shared_config:/etc/env/target + - shared_tokens:/etc/tokens depends_on: - reth - postgres @@ -78,52 +79,58 @@ services: - zksync_slave: + zksync_custombase: stdin_open: true tty: true - image: matterlabs/local-node:hyperlocal + image: matterlabs/local-node:mmzk_0508-1 depends_on: - reth - postgres - zksync 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 + image: matterlabs/local-node:mmzk_0508-1 + #entrypoint: sleep 1000000 depends_on: - reth - postgres - zksync - - zksync_slave # daisy chain + - zksync_custombase # daisy chain 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 @@ -140,24 +147,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 @@ -178,7 +185,7 @@ services: - BATCHES_PROCESSING_POLLING_INTERVAL=1000 restart: unless-stopped - worker_slave: + worker_custombase: platform: linux/amd64 image: "matterlabs/block-explorer-worker:latest" environment: @@ -188,14 +195,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: @@ -205,9 +212,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 @@ -228,7 +235,7 @@ services: restart: unless-stopped - api_slave: + api_custombase: platform: linux/amd64 image: "matterlabs/block-explorer-api:latest" environment: @@ -236,15 +243,15 @@ services: - 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: @@ -252,11 +259,11 @@ services: - 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: @@ -270,8 +277,8 @@ services: - '127.0.0.1:15005:3010' depends_on: - api_main - - api_slave - - api_slave2 + - api_custombase + - api_validium restart: unless-stopped @@ -363,3 +370,4 @@ services: volumes: reth: shared_config: + shared_tokens: diff --git a/hyperexplorer.json b/hyperexplorer.json index 6ebceb1..e645965 100644 --- a/hyperexplorer.json +++ b/hyperexplorer.json @@ -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" } } diff --git a/init.sql b/init.sql index 45fce30..47fa24f 100644 --- a/init.sql +++ b/init.sql @@ -1,3 +1,3 @@ CREATE DATABASE "block-explorer"; -CREATE DATABASE "block-explorer_slave"; -CREATE DATABASE "block-explorer_slave2"; \ No newline at end of file +CREATE DATABASE "block-explorer_custombase"; +CREATE DATABASE "block-explorer_validium"; \ No newline at end of file From e1acbf46bad45cad4cd36404ca98088b025311ea Mon Sep 17 00:00:00 2001 From: mm Date: Sat, 11 May 2024 15:28:55 +0200 Subject: [PATCH 10/11] merge fixes --- hyperchain-docker-compose.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hyperchain-docker-compose.yml b/hyperchain-docker-compose.yml index 3dd727c..7be7611 100644 --- a/hyperchain-docker-compose.yml +++ b/hyperchain-docker-compose.yml @@ -22,6 +22,7 @@ # So 15100 - 'master', 15200 - 'custombase', 15300 - 'validium' # Database is on 15432 +# pgAdmin to manage PostgreSQL DB is on 15430 services: reth: @@ -52,6 +53,17 @@ services: # We bind only to 127.0.0.1, so setting insecure password is acceptable here - POSTGRES_PASSWORD=notsecurepassword + pgadmin4: + image: dcagatay/pwless-pgadmin4:latest + ports: + - 127.0.0.1:15430:80 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: notsecurepassword + POSTGRES_HOST: postgres + POSTGRES_PORT: 5432 + restart: unless-stopped + # Master node - that will create the hyperchain zksync: stdin_open: true @@ -108,7 +120,6 @@ services: stdin_open: true tty: true image: matterlabs/local-node:mmzk_0508-1 - #entrypoint: sleep 1000000 depends_on: - reth - postgres @@ -132,11 +143,6 @@ services: - CHAIN_STATE_KEEPER_L1_BATCH_COMMIT_DATA_GENERATOR_MODE=Validium - VALIDIUM_MODE=1 - - - - - data-fetcher_main: platform: linux/amd64 image: "matterlabs/block-explorer-data-fetcher:latest" From 31080adc0da5de401f9e135abfec8055a530b123 Mon Sep 17 00:00:00 2001 From: mm Date: Mon, 13 May 2024 09:49:53 +0200 Subject: [PATCH 11/11] support validium and custom base token --- README.md | 4 +++ hyperchain-docker-compose.yml | 46 ++++++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6b72376..f4b31d6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/hyperchain-docker-compose.yml b/hyperchain-docker-compose.yml index 7be7611..eb96cae 100644 --- a/hyperchain-docker-compose.yml +++ b/hyperchain-docker-compose.yml @@ -68,12 +68,12 @@ services: zksync: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0508-1 + image: matterlabs/local-node:hyperlocal healthcheck: test: curl --fail http://localhost:3071/health || exit 1 interval: 10s timeout: 5s - retries: 20 + retries: 200 start_period: 30s volumes: - shared_config:/etc/env/target @@ -94,11 +94,20 @@ services: zksync_custombase: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0508-1 + 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 @@ -119,12 +128,22 @@ services: zksync_validium: stdin_open: true tty: true - image: matterlabs/local-node:mmzk_0508-1 + image: matterlabs/local-node:hyperlocal depends_on: - - reth - - postgres - - zksync - - zksync_custombase # 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 @@ -365,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