Skip to content

Commit

Permalink
Merge branch 'main' into deniallugo-remove-dev-block-time
Browse files Browse the repository at this point in the history
  • Loading branch information
Deniallugo committed Jul 30, 2024
2 parents 66cc481 + 3fac8ac commit 2d7a194
Show file tree
Hide file tree
Showing 52 changed files with 442 additions and 558 deletions.
1 change: 0 additions & 1 deletion core/lib/basic_types/src/protocol_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ impl Detokenize for VerifierParams {

#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct L1VerifierConfig {
pub params: VerifierParams,
pub recursion_scheduler_level_vk_hash: H256,
}

Expand Down
16 changes: 1 addition & 15 deletions core/lib/config/src/configs/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{

use anyhow::Context as _;
use serde::{de, Deserialize, Deserializer};
use zksync_basic_types::{Address, H256};
use zksync_basic_types::Address;

pub use crate::configs::PrometheusConfig;

Expand Down Expand Up @@ -165,10 +165,6 @@ pub struct Web3JsonRpcConfig {
/// The multiplier to use when suggesting gas price. Should be higher than one,
/// otherwise if the L1 prices soar, the suggested gas price won't be sufficient to be included in block
pub gas_price_scale_factor: f64,
/// Timeout for requests (in s)
pub request_timeout: Option<u64>,
/// Private keys for accounts managed by node
pub account_pks: Option<Vec<H256>>,
/// The factor by which to scale the gasLimit
pub estimate_gas_scale_factor: f64,
/// The max possible number of gas that `eth_estimateGas` is allowed to overestimate.
Expand Down Expand Up @@ -239,8 +235,6 @@ impl Web3JsonRpcConfig {
pubsub_polling_interval: Some(200),
max_nonce_ahead: 50,
gas_price_scale_factor: 1.2,
request_timeout: Default::default(),
account_pks: Default::default(),
estimate_gas_scale_factor: 1.2,
estimate_gas_acceptable_overestimation: 1000,
max_tx_size: 1000000,
Expand Down Expand Up @@ -287,14 +281,6 @@ impl Web3JsonRpcConfig {
Duration::from_millis(self.pubsub_polling_interval.unwrap_or(200))
}

pub fn request_timeout(&self) -> Duration {
Duration::from_secs(self.request_timeout.unwrap_or(10))
}

pub fn account_pks(&self) -> Vec<H256> {
self.account_pks.clone().unwrap_or_default()
}

pub fn vm_concurrency_limit(&self) -> usize {
// The default limit is large so that it does not create a bottleneck on its own.
// VM execution can still be limited by Tokio runtime parallelism and/or the number
Expand Down
6 changes: 0 additions & 6 deletions core/lib/config/src/configs/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ pub struct GenesisConfig {
pub default_aa_hash: Option<H256>,
pub l1_chain_id: L1ChainId,
pub l2_chain_id: L2ChainId,
pub recursion_node_level_vk_hash: H256,
pub recursion_leaf_level_vk_hash: H256,
pub recursion_circuits_set_vks_hash: H256,
pub recursion_scheduler_level_vk_hash: H256,
pub fee_account: Address,
pub dummy_verifier: bool,
Expand All @@ -35,9 +32,6 @@ impl GenesisConfig {
rollup_last_leaf_index: Some(26),
recursion_scheduler_level_vk_hash: H256::repeat_byte(0x02),
fee_account: Default::default(),
recursion_node_level_vk_hash: H256::repeat_byte(0x03),
recursion_leaf_level_vk_hash: H256::repeat_byte(0x04),
recursion_circuits_set_vks_hash: H256::repeat_byte(0x05),
genesis_commitment: Some(H256::repeat_byte(0x17)),
bootloader_hash: Default::default(),
default_aa_hash: Default::default(),
Expand Down
5 changes: 0 additions & 5 deletions core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ impl Distribution<configs::api::Web3JsonRpcConfig> for EncodeDist {
pubsub_polling_interval: self.sample(rng),
max_nonce_ahead: self.sample(rng),
gas_price_scale_factor: self.sample(rng),
request_timeout: self.sample_opt(|| self.sample(rng)),
account_pks: self.sample_opt(|| self.sample_range(rng).map(|_| rng.gen()).collect()),
estimate_gas_scale_factor: self.sample(rng),
estimate_gas_acceptable_overestimation: self.sample(rng),
max_tx_size: self.sample(rng),
Expand Down Expand Up @@ -704,10 +702,7 @@ impl Distribution<configs::GenesisConfig> for EncodeDist {
fee_account: rng.gen(),
l1_chain_id: L1ChainId(self.sample(rng)),
l2_chain_id: L2ChainId::default(),
recursion_node_level_vk_hash: rng.gen(),
recursion_leaf_level_vk_hash: rng.gen(),
recursion_scheduler_level_vk_hash: rng.gen(),
recursion_circuits_set_vks_hash: rng.gen(),
dummy_verifier: rng.gen(),
l1_batch_commit_data_generator_mode: match rng.gen_range(0..2) {
0 => L1BatchCommitmentMode::Rollup,
Expand Down

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

This file was deleted.

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

This file was deleted.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TABLE protocol_versions ALTER COLUMN recursion_node_level_vk_hash SET NOT NULL;
ALTER TABLE protocol_versions ALTER COLUMN recursion_leaf_level_vk_hash SET NOT NULL;
ALTER TABLE protocol_versions ALTER COLUMN recursion_circuits_set_vks_hash SET NOT NULL;

ALTER TABLE protocol_patches ALTER COLUMN recursion_node_level_vk_hash SET NOT NULL;
ALTER TABLE protocol_patches ALTER COLUMN recursion_leaf_level_vk_hash SET NOT NULL;
ALTER TABLE protocol_patches ALTER COLUMN recursion_circuits_set_vks_hash SET NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TABLE protocol_versions ALTER COLUMN recursion_node_level_vk_hash DROP NOT NULL;
ALTER TABLE protocol_versions ALTER COLUMN recursion_leaf_level_vk_hash DROP NOT NULL;
ALTER TABLE protocol_versions ALTER COLUMN recursion_circuits_set_vks_hash DROP NOT NULL;

ALTER TABLE protocol_patches ALTER COLUMN recursion_node_level_vk_hash DROP NOT NULL;
ALTER TABLE protocol_patches ALTER COLUMN recursion_leaf_level_vk_hash DROP NOT NULL;
ALTER TABLE protocol_patches ALTER COLUMN recursion_circuits_set_vks_hash DROP NOT NULL;
16 changes: 1 addition & 15 deletions core/lib/dal/src/models/storage_protocol_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use zksync_contracts::BaseSystemContractsHashes;
use zksync_types::{
api,
protocol_upgrade::{self, ProtocolUpgradeTx},
protocol_version::{L1VerifierConfig, ProtocolSemanticVersion, VerifierParams, VersionPatch},
protocol_version::{L1VerifierConfig, ProtocolSemanticVersion, VersionPatch},
H256,
};

Expand All @@ -14,9 +14,6 @@ pub struct StorageProtocolVersion {
pub patch: i32,
pub timestamp: i64,
pub recursion_scheduler_level_vk_hash: Vec<u8>,
pub recursion_node_level_vk_hash: Vec<u8>,
pub recursion_leaf_level_vk_hash: Vec<u8>,
pub recursion_circuits_set_vks_hash: Vec<u8>,
pub bootloader_code_hash: Vec<u8>,
pub default_account_code_hash: Vec<u8>,
}
Expand All @@ -32,17 +29,6 @@ pub(crate) fn protocol_version_from_storage(
},
timestamp: storage_version.timestamp as u64,
l1_verifier_config: L1VerifierConfig {
params: VerifierParams {
recursion_node_level_vk_hash: H256::from_slice(
&storage_version.recursion_node_level_vk_hash,
),
recursion_leaf_level_vk_hash: H256::from_slice(
&storage_version.recursion_leaf_level_vk_hash,
),
recursion_circuits_set_vks_hash: H256::from_slice(
&storage_version.recursion_circuits_set_vks_hash,
),
},
recursion_scheduler_level_vk_hash: H256::from_slice(
&storage_version.recursion_scheduler_level_vk_hash,
),
Expand Down
43 changes: 5 additions & 38 deletions core/lib/dal/src/protocol_versions_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use zksync_db_connection::{
};
use zksync_types::{
protocol_upgrade::{ProtocolUpgradeTx, ProtocolVersion},
protocol_version::{L1VerifierConfig, ProtocolSemanticVersion, VerifierParams, VersionPatch},
protocol_version::{L1VerifierConfig, ProtocolSemanticVersion, VersionPatch},
ProtocolVersionId, H256,
};

Expand Down Expand Up @@ -71,36 +71,16 @@ impl ProtocolVersionsDal<'_, '_> {
sqlx::query!(
r#"
INSERT INTO
protocol_patches (
minor,
patch,
recursion_scheduler_level_vk_hash,
recursion_node_level_vk_hash,
recursion_leaf_level_vk_hash,
recursion_circuits_set_vks_hash,
created_at
)
protocol_patches (minor, patch, recursion_scheduler_level_vk_hash, created_at)
VALUES
($1, $2, $3, $4, $5, $6, NOW())
($1, $2, $3, NOW())
ON CONFLICT DO NOTHING
"#,
version.minor as i32,
version.patch.0 as i32,
l1_verifier_config
.recursion_scheduler_level_vk_hash
.as_bytes(),
l1_verifier_config
.params
.recursion_node_level_vk_hash
.as_bytes(),
l1_verifier_config
.params
.recursion_leaf_level_vk_hash
.as_bytes(),
l1_verifier_config
.params
.recursion_circuits_set_vks_hash
.as_bytes(),
)
.instrument("save_protocol_version#patch")
.with_arg("version", &version)
Expand Down Expand Up @@ -255,10 +235,7 @@ impl ProtocolVersionsDal<'_, '_> {
protocol_versions.bootloader_code_hash,
protocol_versions.default_account_code_hash,
protocol_patches.patch,
protocol_patches.recursion_scheduler_level_vk_hash,
protocol_patches.recursion_node_level_vk_hash,
protocol_patches.recursion_leaf_level_vk_hash,
protocol_patches.recursion_circuits_set_vks_hash
protocol_patches.recursion_scheduler_level_vk_hash
FROM
protocol_versions
JOIN protocol_patches ON protocol_patches.minor = protocol_versions.id
Expand Down Expand Up @@ -291,10 +268,7 @@ impl ProtocolVersionsDal<'_, '_> {
let row = sqlx::query!(
r#"
SELECT
recursion_scheduler_level_vk_hash,
recursion_node_level_vk_hash,
recursion_leaf_level_vk_hash,
recursion_circuits_set_vks_hash
recursion_scheduler_level_vk_hash
FROM
protocol_patches
WHERE
Expand All @@ -308,13 +282,6 @@ impl ProtocolVersionsDal<'_, '_> {
.await
.unwrap()?;
Some(L1VerifierConfig {
params: VerifierParams {
recursion_node_level_vk_hash: H256::from_slice(&row.recursion_node_level_vk_hash),
recursion_leaf_level_vk_hash: H256::from_slice(&row.recursion_leaf_level_vk_hash),
recursion_circuits_set_vks_hash: H256::from_slice(
&row.recursion_circuits_set_vks_hash,
),
},
recursion_scheduler_level_vk_hash: H256::from_slice(
&row.recursion_scheduler_level_vk_hash,
),
Expand Down
Loading

0 comments on commit 2d7a194

Please sign in to comment.