Skip to content

Commit

Permalink
merge branch 'baset-token-oracle' into gas_oracle_move_gas_to_u256
Browse files Browse the repository at this point in the history
  • Loading branch information
juan518munoz committed May 15, 2024
2 parents 45984aa + fe92700 commit 606e2b2
Show file tree
Hide file tree
Showing 207 changed files with 6,523 additions and 2,944 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ jobs:
done
echo "Contracts tag is: ${filtered_tag}"
mkdir -p ./contracts
curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
tar -C ./contracts -zxf l1-contracts.tar.gz
tar -C ./contracts -zxf l2-contracts.tar.gz
tar -C ./contracts -zxf system-contracts.tar.gz
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk || true
ci_run yarn zk build
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: build contracts
if: env.BUILD_CONTRACTS == 'true'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ jobs:
done
echo "Contracts tag is: ${filtered_tag}"
mkdir -p ./contracts
curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
curl -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l1-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/l2-contracts.tar.gz
curl --retry 5 -s -LO https://github.com/matter-labs/era-contracts/releases/download/${filtered_tag}/system-contracts.tar.gz
tar -C ./contracts -zxf l1-contracts.tar.gz
tar -C ./contracts -zxf l2-contracts.tar.gz
tar -C ./contracts -zxf system-contracts.tar.gz
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk || true
ci_run yarn zk build
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: build contracts
if: env.BUILD_CONTRACTS == 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-prover-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- name: download CRS
if: matrix.component == 'proof-fri-compressor'
run: |
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: login to Docker registries
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-test-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }}

jobs:
changed_files:
Expand Down
42 changes: 40 additions & 2 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ members = [
"core/lib/queued_job_processor",
"core/lib/state",
"core/lib/storage",
"core/lib/tee_verifier",
"core/lib/types",
"core/lib/protobuf_config",
"core/lib/utils",
Expand Down Expand Up @@ -133,6 +134,7 @@ rlp = "0.5"
rocksdb = "0.21.0"
rustc_version = "0.4.0"
secp256k1 = { version = "0.27.0", features = ["recovery", "global-context"] }
secrecy = "0.8.0"
semver = "1"
sentry = "0.31"
serde = "1"
Expand Down Expand Up @@ -220,6 +222,7 @@ zksync_snapshots_applier = { path = "core/lib/snapshots_applier" }
zksync_state = { path = "core/lib/state" }
zksync_storage = { path = "core/lib/storage" }
zksync_system_constants = { path = "core/lib/constants" }
zksync_tee_verifier = { path = "core/lib/tee_verifier" }
zksync_test_account = { path = "core/tests/test_account" }
zksync_types = { path = "core/lib/types" }
zksync_utils = { path = "core/lib/utils" }
Expand Down
22 changes: 22 additions & 0 deletions bin/run_retried
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

BACKOFF=1
MAX_ATTEMPTS=5
attempt=1

while [ $attempt -le $MAX_ATTEMPTS ]; do

"$@"

if [ $? -eq 0 ]; then
exit 0
else
echo "Command \"$*\" failed with code $?. Retrying in $BACKOFF seconds..."
sleep $BACKOFF
let BACKOFF*=2
let attempt++
fi
done

echo "Command failed after $MAX_ATTEMPTS attempts."
exit 1
2 changes: 1 addition & 1 deletion bin/zk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ check_subdirectory
check_yarn_version
if [ -z "$1" ]; then
cd $ZKSYNC_HOME
yarn install --frozen-lockfile && yarn zk build
run_retried yarn install --frozen-lockfile && yarn zk build
else
# can't start this with yarn since it has quirks with `--` as an argument
node -- $ZKSYNC_HOME/infrastructure/zk/build/index.js "$@"
Expand Down
3 changes: 3 additions & 0 deletions checks-config/era.dic
Original file line number Diff line number Diff line change
Expand Up @@ -957,3 +957,6 @@ RECURSION_TIP_ARITY
empty_proof
hyperchain
storages
vec
zksync_merkle_tree
TreeMetadata
1 change: 0 additions & 1 deletion core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ zksync_eth_client.workspace = true
zksync_storage.workspace = true
zksync_utils.workspace = true
zksync_state.workspace = true
zksync_basic_types.workspace = true
zksync_contracts.workspace = true
zksync_l1_contract_interface.workspace = true
zksync_snapshots_applier.workspace = true
Expand Down
19 changes: 8 additions & 11 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ use std::{

use anyhow::Context;
use serde::Deserialize;
use zksync_basic_types::{Address, L1ChainId, L2ChainId};
use zksync_config::{
configs::{
api::{MaxResponseSize, MaxResponseSizeOverrides},
chain::L1BatchCommitDataGeneratorMode,
consensus::{ConsensusConfig, ConsensusSecrets},
},
ObjectStoreConfig,
Expand All @@ -27,7 +25,10 @@ use zksync_core::{
use zksync_dal::{ConnectionPool, Core};
use zksync_protobuf_config::proto;
use zksync_snapshots_applier::SnapshotsApplierConfig;
use zksync_types::{api::BridgeAddresses, url::SensitiveUrl, ETHEREUM_ADDRESS};
use zksync_types::{
api::BridgeAddresses, commitment::L1BatchCommitmentMode, url::SensitiveUrl, Address, L1ChainId,
L2ChainId, ETHEREUM_ADDRESS,
};
use zksync_web3_decl::{
client::{DynClient, L2},
error::ClientRpcContext,
Expand Down Expand Up @@ -85,7 +86,7 @@ pub(crate) struct RemoteENConfig {
pub l2_weth_bridge_addr: Option<Address>,
pub l2_testnet_paymaster_addr: Option<Address>,
pub base_token_addr: Address,
pub l1_batch_commit_data_generator_mode: L1BatchCommitDataGeneratorMode,
pub l1_batch_commit_data_generator_mode: L1BatchCommitmentMode,
pub dummy_verifier: bool,
}

Expand Down Expand Up @@ -186,7 +187,7 @@ impl RemoteENConfig {
l1_shared_bridge_proxy_addr: Some(Address::repeat_byte(5)),
l1_weth_bridge_addr: None,
l2_shared_bridge_addr: Some(Address::repeat_byte(6)),
l1_batch_commit_data_generator_mode: L1BatchCommitDataGeneratorMode::Rollup,
l1_batch_commit_data_generator_mode: L1BatchCommitmentMode::Rollup,
dummy_verifier: true,
}
}
Expand Down Expand Up @@ -362,8 +363,8 @@ pub(crate) struct OptionalENConfig {
#[serde(default = "OptionalENConfig::default_main_node_rate_limit_rps")]
pub main_node_rate_limit_rps: NonZeroUsize,

#[serde(default = "OptionalENConfig::default_l1_batch_commit_data_generator_mode")]
pub l1_batch_commit_data_generator_mode: L1BatchCommitDataGeneratorMode,
#[serde(default)]
pub l1_batch_commit_data_generator_mode: L1BatchCommitmentMode,
/// Enables application-level snapshot recovery. Required to start a node that was recovered from a snapshot,
/// or to initialize a node from a snapshot. Has no effect if a node that was initialized from a Postgres dump
/// or was synced from genesis.
Expand Down Expand Up @@ -513,10 +514,6 @@ impl OptionalENConfig {
NonZeroUsize::new(100).unwrap()
}

const fn default_l1_batch_commit_data_generator_mode() -> L1BatchCommitDataGeneratorMode {
L1BatchCommitDataGeneratorMode::Rollup
}

fn default_snapshots_recovery_postgres_max_concurrency() -> NonZeroUsize {
SnapshotsApplierConfig::default().max_concurrency
}
Expand Down
4 changes: 2 additions & 2 deletions core/bin/external_node/src/config/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn parsing_optional_config_from_empty_env() {
);
assert_eq!(
config.l1_batch_commit_data_generator_mode,
L1BatchCommitDataGeneratorMode::Rollup
L1BatchCommitmentMode::Rollup
);
}

Expand Down Expand Up @@ -168,7 +168,7 @@ fn parsing_optional_config_from_env() {
);
assert_eq!(
config.l1_batch_commit_data_generator_mode,
L1BatchCommitDataGeneratorMode::Validium
L1BatchCommitmentMode::Validium
);
}

Expand Down
2 changes: 1 addition & 1 deletion core/bin/external_node/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::time::Duration;

use futures::FutureExt;
use tokio::sync::watch;
use zksync_basic_types::{L1ChainId, L2ChainId};
use zksync_eth_client::EthInterface;
use zksync_health_check::{async_trait, CheckHealth, Health, HealthStatus};
use zksync_types::{L1ChainId, L2ChainId};
use zksync_web3_decl::{
client::{DynClient, L2},
error::ClientRpcContext,
Expand Down
2 changes: 1 addition & 1 deletion core/bin/external_node/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
use std::time::Instant;

use anyhow::Context as _;
use zksync_basic_types::{L1BatchNumber, L2ChainId};
use zksync_core::sync_layer::genesis::perform_genesis_if_needed;
use zksync_dal::{ConnectionPool, Core, CoreDal};
use zksync_health_check::AppHealthCheck;
use zksync_object_store::ObjectStoreFactory;
use zksync_shared_metrics::{SnapshotRecoveryStage, APP_METRICS};
use zksync_snapshots_applier::{SnapshotsApplierConfig, SnapshotsApplierTask};
use zksync_types::{L1BatchNumber, L2ChainId};
use zksync_web3_decl::client::{DynClient, L2};

use crate::config::SnapshotsRecoveryConfig;
Expand Down
Loading

0 comments on commit 606e2b2

Please sign in to comment.