Skip to content

Commit

Permalink
Merge branch 'main' into anastasiia-pla-786
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiiaVashchuk committed Jun 5, 2024
2 parents c9a6d89 + 9e39f13 commit e65d56d
Show file tree
Hide file tree
Showing 138 changed files with 1,858 additions and 457 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ contracts/.git
!etc/env/dev.toml
!etc/env/consensus_secrets.yaml
!etc/env/consensus_config.yaml
!rust-toolchain
4 changes: 2 additions & 2 deletions .github/release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"core": "24.6.0",
"prover": "14.4.0"
"core": "24.7.0",
"prover": "14.5.0"
}
3 changes: 2 additions & 1 deletion .github/workflows/build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
mkdir -p ./volumes/postgres
run_retried docker compose pull zk postgres
docker compose up -d zk postgres
ci_run pre_download_compilers.sh
ci_run sccache --start-server
- name: init
Expand Down Expand Up @@ -137,7 +138,7 @@ jobs:
COMPONENT: ${{ matrix.components }}
PLATFORM: ${{ matrix.platforms }}
run: |
ci_run rustup default nightly-2023-08-21
ci_run rustup default nightly-2024-05-07
platform=$(echo $PLATFORM | tr '/' '-')
ci_run zk docker $DOCKER_ACTION --custom-tag=${IMAGE_TAG_SUFFIX} --platform=${PLATFORM} $COMPONENT
- name: Show sccache stats
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
mkdir -p ./volumes/postgres
run_retried docker compose pull zk postgres
docker compose up -d zk postgres
ci_run pre_download_compilers.sh
ci_run sccache --start-server
- name: init
Expand Down Expand Up @@ -146,7 +147,7 @@ jobs:
COMPONENT: ${{ matrix.components }}
PLATFORM: ${{ matrix.platforms }}
run: |
ci_run rustup default nightly-2023-08-21
ci_run rustup default nightly-2024-05-07
platform=$(echo $PLATFORM | tr '/' '-')
ci_run zk docker $DOCKER_ACTION --custom-tag=${IMAGE_TAG_SUFFIX} --platform=${PLATFORM} $COMPONENT
- name: Show sccache stats
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
# `sleep 60` because we need to wait until server added all the tokens
- name: Run server
run: |
ci_run zk server --uring --components api,tree,eth,state_keeper,housekeeper,commitment_generator &>server.log &
ci_run zk server --uring --components api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads &>server.log &
ci_run sleep 60
- name: Deploy legacy era contracts
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
base_token: ["Eth", "Custom"]
deployment_mode: ["Rollup", "Validium"]
env:
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator${{ matrix.consensus && ',consensus' || '' }}"
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads${{ matrix.consensus && ',consensus' || '' }}"

runs-on: [matterlabs-ci-runner]
steps:
Expand Down Expand Up @@ -182,6 +182,7 @@ jobs:
- name: Start services
run: |
ci_localnet_up
ci_run pre_download_compilers.sh
ci_run sccache --start-server
- name: Init
Expand Down Expand Up @@ -301,7 +302,7 @@ jobs:
runs-on: [matterlabs-ci-runner]

env:
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator${{ matrix.consensus && ',consensus' || '' }}"
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads${{ matrix.consensus && ',consensus' || '' }}"
EXT_NODE_FLAGS: "${{ matrix.consensus && '-- --enable-consensus' || '' }}"

steps:
Expand All @@ -322,6 +323,7 @@ jobs:
- name: Start services
run: |
ci_localnet_up
ci_run pre_download_compilers.sh
ci_run sccache --start-server
- name: Init
Expand Down
22 changes: 6 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions bin/pre_download_compilers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

set -e

# This ./cache/hardhat-nodejs is coming from the env-paths module
# that hardhat is using.
COMPILER_DIR=/root/.cache/hardhat-nodejs/compilers-v2
mkdir -p $COMPILER_DIR/{/linux-amd64,/vyper/linux,/zksolc,/zkvyper}

# Fetch latest compiler version
wget -nv -O $COMPILER_DIR/zksolc/compilerVersionInfo.json "https://raw.githubusercontent.com/matter-labs/zksolc-bin/main/version.json"


# These are the versions that we currently have in hardhat.config.ts in zksync-era and era-contracts.
# For now, if there is a new version of compiler, we'd have to modify this file.
# In the future, we should make it more automatic.
(for ver in v1.3.18 v1.3.21 v1.4.0 v1.4.1; do wget -nv -O $COMPILER_DIR/zksolc/zksolc-$ver https://raw.githubusercontent.com/matter-labs/zksolc-bin/main/linux-amd64/zksolc-linux-amd64-musl-$ver; done)

# Special pre-release 1.5.0 compiler.
# It can be removed once system-contracts/hardhatconfig.ts stops using it.
wget -nv -O $COMPILER_DIR/zksolc/zksolc-remote-4cad2deaa6801d7a419f1ed6503c999948b0d6d8.0 https://github.com/matter-labs/era-compiler-solidity/releases/download/prerelease-a167aa3-code4rena/zksolc-linux-amd64-musl-v1.5.0


wget -nv -O $COMPILER_DIR/zkvyper/compilerVersionInfo.json "https://raw.githubusercontent.com/matter-labs/zkvyper-bin/main/version.json"

(for ver in v1.3.13; do wget -nv -O $COMPILER_DIR/zkvyper/zkvyper-$ver https://raw.githubusercontent.com/matter-labs/zkvyper-bin/main/linux-amd64/zkvyper-linux-amd64-musl-$ver; done)


# This matches VYPER_RELEASES_MIRROR_URL from hardhat-vyper
wget -nv -O $COMPILER_DIR/vyper/linux/list.json https://vyper-releases-mirror.hardhat.org/list.json

# Currently we only use 0.3.10 release of vyper compiler (path taken from the list.json above)
wget -nv -O $COMPILER_DIR/vyper/linux/0.3.10 https://github.com/vyperlang/vyper/releases/download/v0.3.10/vyper.0.3.10%2Bcommit.91361694.linux


# This matches COMPILER_REPOSITORY_URL from hardhat-core.
wget -nv -O $COMPILER_DIR/linux-amd64/list.json https://binaries.soliditylang.org/linux-amd64/list.json

(for ver in solc-linux-amd64-v0.8.20+commit.a1b79de6 solc-linux-amd64-v0.8.23+commit.f704f362 solc-linux-amd64-v0.8.24+commit.e11b9ed9; do \
wget -nv -O $COMPILER_DIR/linux-amd64/$ver https://binaries.soliditylang.org/linux-amd64/$ver; \
done)

chmod -R +x /root/.cache/hardhat-nodejs/
14 changes: 14 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [24.7.0](https://github.com/matter-labs/zksync-era/compare/core-v24.6.0...core-v24.7.0) (2024-06-03)


### Features

* **node-framework:** Add reorg detector ([#1551](https://github.com/matter-labs/zksync-era/issues/1551)) ([7c7d352](https://github.com/matter-labs/zksync-era/commit/7c7d352708aa64b55a9b33e273b1a16d3f1d168b))


### Bug Fixes

* **block-reverter:** Fix reverting snapshot files ([#2064](https://github.com/matter-labs/zksync-era/issues/2064)) ([17a7e78](https://github.com/matter-labs/zksync-era/commit/17a7e782d9e35eaf38acf920c2326d4037c7781e))
* **env:** Do not print stacktrace for locate workspace ([#2111](https://github.com/matter-labs/zksync-era/issues/2111)) ([5f2677f](https://github.com/matter-labs/zksync-era/commit/5f2677f2c966f4dd23538a02ecd7fffe306bec7f))
* **eth-watch:** make assert less strict ([#2129](https://github.com/matter-labs/zksync-era/issues/2129)) ([e9bab95](https://github.com/matter-labs/zksync-era/commit/e9bab95539af383c161b357a422d5c45f20f27aa))

## [24.6.0](https://github.com/matter-labs/zksync-era/compare/core-v24.5.1...core-v24.6.0) (2024-06-03)


Expand Down
2 changes: 1 addition & 1 deletion core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zksync_external_node"
version = "24.6.0" # x-release-please-version
version = "24.7.0" # x-release-please-version
edition.workspace = true
authors.workspace = true
homepage.workspace = true
Expand Down
29 changes: 10 additions & 19 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use zksync_node_api_server::{
use zksync_protobuf_config::proto;
use zksync_snapshots_applier::SnapshotsApplierConfig;
use zksync_types::{
api::BridgeAddresses, commitment::L1BatchCommitmentMode, url::SensitiveUrl, Address, L1ChainId,
L2ChainId, ETHEREUM_ADDRESS,
api::BridgeAddresses, commitment::L1BatchCommitmentMode, url::SensitiveUrl, Address,
L1BatchNumber, L1ChainId, L2ChainId, ETHEREUM_ADDRESS,
};
use zksync_web3_decl::{
client::{DynClient, L2},
Expand Down Expand Up @@ -222,8 +222,6 @@ pub(crate) struct OptionalENConfig {
/// Max number of cache misses during one VM execution. If the number of cache misses exceeds this value, the API server panics.
/// This is a temporary solution to mitigate API request resulting in thousands of DB queries.
pub vm_execution_cache_misses_limit: Option<usize>,
/// Note: Deprecated option, no longer in use. Left to display a warning in case someone used them.
pub transactions_per_sec_limit: Option<u32>,
/// Limit for fee history block range.
#[serde(default = "OptionalENConfig::default_fee_history_limit")]
pub fee_history_limit: u64,
Expand Down Expand Up @@ -748,6 +746,8 @@ pub(crate) struct ExperimentalENConfig {
pub state_keeper_db_max_open_files: Option<NonZeroU32>,

// Snapshot recovery
/// L1 batch number of the snapshot to use during recovery. Specifying this parameter is mostly useful for testing.
pub snapshots_recovery_l1_batch: Option<L1BatchNumber>,
/// Approximate chunk size (measured in the number of entries) to recover in a single iteration.
/// Reasonable values are order of 100,000 (meaning an iteration takes several seconds).
///
Expand Down Expand Up @@ -777,6 +777,7 @@ impl ExperimentalENConfig {
state_keeper_db_block_cache_capacity_mb:
Self::default_state_keeper_db_block_cache_capacity_mb(),
state_keeper_db_max_open_files: None,
snapshots_recovery_l1_batch: None,
snapshots_recovery_tree_chunk_size: Self::default_snapshots_recovery_tree_chunk_size(),
commitment_generator_max_parallelism: None,
}
Expand Down Expand Up @@ -809,21 +810,11 @@ pub(crate) fn read_consensus_config() -> anyhow::Result<Option<ConsensusConfig>>
))
}

/// Configuration for snapshot recovery. Loaded optionally, only if snapshot recovery is enabled.
#[derive(Debug)]
pub(crate) struct SnapshotsRecoveryConfig {
pub snapshots_object_store: ObjectStoreConfig,
}

impl SnapshotsRecoveryConfig {
pub fn new() -> anyhow::Result<Self> {
let snapshots_object_store = envy::prefixed("EN_SNAPSHOTS_OBJECT_STORE_")
.from_env::<ObjectStoreConfig>()
.context("failed loading snapshot object store config from env variables")?;
Ok(Self {
snapshots_object_store,
})
}
/// Configuration for snapshot recovery. Should be loaded optionally, only if snapshot recovery is enabled.
pub(crate) fn snapshot_recovery_object_store_config() -> anyhow::Result<ObjectStoreConfig> {
envy::prefixed("EN_SNAPSHOTS_OBJECT_STORE_")
.from_env::<ObjectStoreConfig>()
.context("failed loading snapshot object store config from env variables")
}

#[derive(Debug, Deserialize)]
Expand Down
41 changes: 5 additions & 36 deletions core/bin/external_node/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,6 @@ impl CheckHealth for MainNodeHealthCheck {
}
}

/// Ethereum client health check.
#[derive(Debug)]
pub(crate) struct EthClientHealthCheck(Box<DynClient<L1>>);

impl From<Box<DynClient<L1>>> for EthClientHealthCheck {
fn from(client: Box<DynClient<L1>>) -> Self {
Self(client.for_component("ethereum_health_check"))
}
}

#[async_trait]
impl CheckHealth for EthClientHealthCheck {
fn name(&self) -> &'static str {
"ethereum_http_rpc"
}

async fn check_health(&self) -> Health {
if let Err(err) = self.0.block_number().await {
tracing::warn!("Health-check call to Ethereum HTTP RPC failed: {err}");
let details = serde_json::json!({
"error": err.to_string(),
});
// Unlike main node client, losing connection to L1 is not fatal for the node
return Health::from(HealthStatus::Affected).with_details(details);
}
HealthStatus::Ready.into()
}
}

/// Task that validates chain IDs using main node and Ethereum clients.
#[derive(Debug)]
pub(crate) struct ValidateChainIdsTask {
Expand Down Expand Up @@ -205,13 +176,11 @@ impl ValidateChainIdsTask {
.fuse();
let main_node_l2_check =
Self::check_l2_chain_using_main_node(self.main_node_client, self.l2_chain_id).fuse();
loop {
tokio::select! {
Err(err) = eth_client_check => return Err(err),
Err(err) = main_node_l1_check => return Err(err),
Err(err) = main_node_l2_check => return Err(err),
_ = stop_receiver.changed() => return Ok(()),
}
tokio::select! {
Err(err) = eth_client_check => Err(err),
Err(err) = main_node_l1_check => Err(err),
Err(err) = main_node_l2_check => Err(err),
_ = stop_receiver.changed() => Ok(()),
}
}
}
Expand Down
Loading

0 comments on commit e65d56d

Please sign in to comment.