From 80cc84f686d30e4f7fc349a11b590f33623acebe Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Wed, 20 Nov 2024 16:58:19 +0100 Subject: [PATCH 1/8] restore offline chain creation --- .github/workflows/ci-core-reusable.yml | 70 +++++++++++++------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci-core-reusable.yml b/.github/workflows/ci-core-reusable.yml index a47a78ecee88..a2358552c273 100644 --- a/.github/workflows/ci-core-reusable.yml +++ b/.github/workflows/ci-core-reusable.yml @@ -312,41 +312,41 @@ jobs: --server-db-name=zksync_server_localhost_custom_token \ --chain custom_token - # - name: Create and register chain with transactions signed "offline" - # run: | - # ci_run zkstack chain create \ - # --chain-name offline_chain \ - # --chain-id sequential \ - # --prover-mode no-proofs \ - # --wallet-creation localhost \ - # --l1-batch-commit-data-generator-mode rollup \ - # --base-token-address 0x0000000000000000000000000000000000000001 \ - # --base-token-price-nominator 1 \ - # --base-token-price-denominator 1 \ - # --set-as-default false \ - # --ignore-prerequisites \ - # --evm-emulator false - - # ci_run zkstack chain build-transactions --chain offline_chain --l1-rpc-url http://127.0.0.1:8545 - - # governor_pk=$(awk '/governor:/ {flag=1} flag && /private_key:/ {print $2; exit}' ./configs/wallets.yaml) - - # ci_run zkstack dev send-transactions \ - # --file ./transactions/chain/offline_chain/register-hyperchain-txns.json \ - # --l1-rpc-url http://127.0.0.1:8545 \ - # --private-key $governor_pk - - # bridge_hub=$(awk '/bridgehub_proxy_addr/ {print $2}' ./configs/contracts.yaml) - # chain_id=$(awk '/chain_id:/ {print $2}' ./chains/offline_chain/ZkStack.yaml) - - # hyperchain_output=$(ci_run cast call $bridge_hub "getHyperchain(uint256)" $chain_id) - - # if [[ $hyperchain_output == 0x* && ${#hyperchain_output} -eq 66 ]]; then - # echo "Chain successfully registered: $hyperchain_output" - # else - # echo "Failed to register chain: $hyperchain_output" - # exit 1 - # fi + - name: Create and register chain with transactions signed "offline" + run: | + ci_run zkstack chain create \ + --chain-name offline_chain \ + --chain-id sequential \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode rollup \ + --base-token-address 0x0000000000000000000000000000000000000001 \ + --base-token-price-nominator 1 \ + --base-token-price-denominator 1 \ + --set-as-default false \ + --ignore-prerequisites \ + --evm-emulator false + + ci_run zkstack chain build-transactions --chain offline_chain --l1-rpc-url http://127.0.0.1:8545 + + governor_pk=$(awk '/governor:/ {flag=1} flag && /private_key:/ {print $2; exit}' ./configs/wallets.yaml) + + ci_run zkstack dev send-transactions \ + --file ./transactions/chain/offline_chain/register-hyperchain-txns.json \ + --l1-rpc-url http://127.0.0.1:8545 \ + --private-key $governor_pk + + bridge_hub=$(awk '/bridgehub_proxy_addr/ {print $2}' ./configs/contracts.yaml) + chain_id=$(awk '/chain_id:/ {print $2}' ./chains/offline_chain/ZkStack.yaml) + + hyperchain_output=$(ci_run cast call $bridge_hub "getHyperchain(uint256)" $chain_id) + + if [[ $hyperchain_output == 0x* && ${#hyperchain_output} -eq 66 ]]; then + echo "Chain successfully registered: $hyperchain_output" + else + echo "Failed to register chain: $hyperchain_output" + exit 1 + fi - name: Create and initialize Consensus chain run: | From 19addb6c89d2fe4b7ae4b8f4894ec3e6584d1cbd Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Thu, 21 Nov 2024 20:51:36 +0100 Subject: [PATCH 2/8] fix ci --- .github/workflows/ci-core-reusable.yml | 2 +- .../zkstack/src/commands/chain/build_transactions.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-core-reusable.yml b/.github/workflows/ci-core-reusable.yml index a2358552c273..5d81fd5bf741 100644 --- a/.github/workflows/ci-core-reusable.yml +++ b/.github/workflows/ci-core-reusable.yml @@ -332,7 +332,7 @@ jobs: governor_pk=$(awk '/governor:/ {flag=1} flag && /private_key:/ {print $2; exit}' ./configs/wallets.yaml) ci_run zkstack dev send-transactions \ - --file ./transactions/chain/offline_chain/register-hyperchain-txns.json \ + --file ./transactions/chain/offline_chain/register-zk-chain-txns.json \ --l1-rpc-url http://127.0.0.1:8545 \ --private-key $governor_pk diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs index d3953c656596..388b58ffe6c9 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs @@ -19,12 +19,12 @@ use crate::{ }; const REGISTER_CHAIN_TXNS_FILE_SRC: &str = - "contracts/l1-contracts/broadcast/RegisterHyperchain.s.sol/9/dry-run/run-latest.json"; -const REGISTER_CHAIN_TXNS_FILE_DST: &str = "register-hyperchain-txns.json"; + "contracts/l1-contracts/broadcast/RegisterZKChain.s.sol/9/dry-run/run-latest.json"; +const REGISTER_CHAIN_TXNS_FILE_DST: &str = "register-zk-chain-txns.json"; const SCRIPT_CONFIG_FILE_SRC: &str = - "contracts/l1-contracts/script-config/register-hyperchain.toml"; -const SCRIPT_CONFIG_FILE_DST: &str = "register-hyperchain.toml"; + "contracts/l1-contracts/script-config/register-zk-chain.toml"; +const SCRIPT_CONFIG_FILE_DST: &str = "register-zk-chain.toml"; pub(crate) async fn run(args: BuildTransactionsArgs, shell: &Shell) -> anyhow::Result<()> { let config = EcosystemConfig::from_file(shell)?; From 5f9e9e85ea8752a5ee2e511e6575d237edd6cb73 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Thu, 21 Nov 2024 20:54:53 +0100 Subject: [PATCH 3/8] fix ci --- .../crates/zkstack/src/commands/chain/build_transactions.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs index 388b58ffe6c9..cd3a89ce60c9 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs @@ -22,8 +22,7 @@ const REGISTER_CHAIN_TXNS_FILE_SRC: &str = "contracts/l1-contracts/broadcast/RegisterZKChain.s.sol/9/dry-run/run-latest.json"; const REGISTER_CHAIN_TXNS_FILE_DST: &str = "register-zk-chain-txns.json"; -const SCRIPT_CONFIG_FILE_SRC: &str = - "contracts/l1-contracts/script-config/register-zk-chain.toml"; +const SCRIPT_CONFIG_FILE_SRC: &str = "contracts/l1-contracts/script-config/register-zk-chain.toml"; const SCRIPT_CONFIG_FILE_DST: &str = "register-zk-chain.toml"; pub(crate) async fn run(args: BuildTransactionsArgs, shell: &Shell) -> anyhow::Result<()> { From 360e617e62c8c0f486a68057e081d060999f70a4 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Fri, 22 Nov 2024 14:30:45 +0100 Subject: [PATCH 4/8] more logs --- core/node/consistency_checker/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/node/consistency_checker/src/lib.rs b/core/node/consistency_checker/src/lib.rs index 8d17a425f0e6..a527084bb35e 100644 --- a/core/node/consistency_checker/src/lib.rs +++ b/core/node/consistency_checker/src/lib.rs @@ -662,7 +662,7 @@ impl ConsistencyChecker { continue; }; let chain_id = client_data.chain_id; - tracing::debug!("Performing sanity checks for chain id {chain_id}, diamond proxy contract {address:?}"); + tracing::info!("Performing sanity checks for chain id {chain_id}, diamond proxy contract {address:?}"); let version: U256 = CallFunctionArgs::new("getProtocolVersion", ()) .for_contract(address, &self.contract) From e37f0f9ddfcb7c682dd7b2e9273486a74be7028a Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Sun, 24 Nov 2024 14:22:11 +0100 Subject: [PATCH 5/8] debug logs --- core/bin/external_node/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/bin/external_node/src/main.rs b/core/bin/external_node/src/main.rs index 09d7f193e753..6a02e6da6e71 100644 --- a/core/bin/external_node/src/main.rs +++ b/core/bin/external_node/src/main.rs @@ -130,6 +130,7 @@ fn main() -> anyhow::Result<()> { let mut config = if let Some(config_path) = opt.config_path.clone() { let secrets_path = opt.secrets_path.clone().unwrap(); + println!("Secrets path: {:#?}", secrets_path); let external_node_config_path = opt.external_node_config_path.clone().unwrap(); if opt.enable_consensus { anyhow::ensure!( @@ -144,9 +145,12 @@ fn main() -> anyhow::Result<()> { opt.consensus_path.clone(), )? } else { + println!("Using env!"); ExternalNodeConfig::new().context("Failed to load node configuration")? }; + println!("Final config: {:#?}", config); + if !opt.enable_consensus { config.consensus = None; } From ff7c1963857e90bdeb3da24cdb8d1b3cb2ddc8ba Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Sun, 24 Nov 2024 14:55:50 +0100 Subject: [PATCH 6/8] fix gateway url --- .github/workflows/ci-core-reusable.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-core-reusable.yml b/.github/workflows/ci-core-reusable.yml index be1c17002587..db044e3a74ca 100644 --- a/.github/workflows/ci-core-reusable.yml +++ b/.github/workflows/ci-core-reusable.yml @@ -465,19 +465,19 @@ jobs: - name: Init external nodes run: | ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --db-name=zksync_en_localhost_era_rollup --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3450 --chain era + --db-name=zksync_en_localhost_era_rollup --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain era ci_run zkstack external-node init --ignore-prerequisites --chain era ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --db-name=zksync_en_localhost_era_validium1 --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3450 --chain validium + --db-name=zksync_en_localhost_era_validium1 --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain validium ci_run zkstack external-node init --ignore-prerequisites --chain validium ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --db-name=zksync_en_localhost_era_custom_token --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3450 --chain custom_token + --db-name=zksync_en_localhost_era_custom_token --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain custom_token ci_run zkstack external-node init --ignore-prerequisites --chain custom_token ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --db-name=zksync_en_localhost_era_consensus --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3450 --chain consensus + --db-name=zksync_en_localhost_era_consensus --l1-rpc-url=http://localhost:8545 --gateway-rpc-url=http://localhost:3550 --chain consensus ci_run zkstack external-node init --ignore-prerequisites --chain consensus - name: Run recovery tests (from snapshot) From 0216130d612599d49e772f5dd1a2610f7d22bfcf Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 25 Nov 2024 10:32:18 +0100 Subject: [PATCH 7/8] remove unneeded prints --- core/bin/external_node/src/main.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/bin/external_node/src/main.rs b/core/bin/external_node/src/main.rs index 6a02e6da6e71..09d7f193e753 100644 --- a/core/bin/external_node/src/main.rs +++ b/core/bin/external_node/src/main.rs @@ -130,7 +130,6 @@ fn main() -> anyhow::Result<()> { let mut config = if let Some(config_path) = opt.config_path.clone() { let secrets_path = opt.secrets_path.clone().unwrap(); - println!("Secrets path: {:#?}", secrets_path); let external_node_config_path = opt.external_node_config_path.clone().unwrap(); if opt.enable_consensus { anyhow::ensure!( @@ -145,12 +144,9 @@ fn main() -> anyhow::Result<()> { opt.consensus_path.clone(), )? } else { - println!("Using env!"); ExternalNodeConfig::new().context("Failed to load node configuration")? }; - println!("Final config: {:#?}", config); - if !opt.enable_consensus { config.consensus = None; } From 73aeb6bfceed1ff367099ef9b616e91789901cc5 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 25 Nov 2024 12:20:39 +0100 Subject: [PATCH 8/8] fix deny --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a9e6078d27d3..5b0217c773d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1034,7 +1034,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.12.1", + "itertools 0.10.5", "lazy_static", "lazycell", "log", @@ -4150,7 +4150,7 @@ dependencies = [ "hyper 1.5.0", "hyper-util", "log", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-native-certs 0.8.0", "rustls-pki-types", "tokio", @@ -4552,7 +4552,7 @@ dependencies = [ "http 1.1.0", "jsonrpsee-core 0.23.2", "pin-project", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-pki-types", "rustls-platform-verifier", "soketto 0.8.0", @@ -4651,7 +4651,7 @@ dependencies = [ "hyper-util", "jsonrpsee-core 0.23.2", "jsonrpsee-types 0.23.2", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-platform-verifier", "serde", "serde_json", @@ -4904,7 +4904,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -6532,7 +6532,7 @@ checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.12.1", + "itertools 0.10.5", "log", "multimap", "once_cell", @@ -6552,7 +6552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.10.5", "proc-macro2 1.0.89", "quote 1.0.37", "syn 2.0.85", @@ -6742,7 +6742,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls 0.23.18", "socket2", "thiserror", "tokio", @@ -6759,7 +6759,7 @@ dependencies = [ "rand 0.8.5", "ring", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls 0.23.18", "slab", "thiserror", "tinyvec", @@ -6777,7 +6777,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7063,7 +7063,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-native-certs 0.8.0", "rustls-pemfile 2.2.0", "rustls-pki-types", @@ -7379,9 +7379,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.16" +version = "0.23.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" dependencies = [ "aws-lc-rs", "log", @@ -7466,7 +7466,7 @@ dependencies = [ "jni", "log", "once_cell", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-native-certs 0.7.3", "rustls-platform-verifier-android", "rustls-webpki 0.102.8", @@ -9535,7 +9535,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.16", + "rustls 0.23.18", "rustls-pki-types", "tokio", ] @@ -12874,7 +12874,7 @@ dependencies = [ "pin-project-lite", "rand 0.8.5", "rlp", - "rustls 0.23.16", + "rustls 0.23.18", "serde", "serde_json", "test-casing",