Skip to content

Commit

Permalink
Update from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Oct 21, 2024
2 parents 79cd205 + cfbcc11 commit 02d7594
Show file tree
Hide file tree
Showing 42 changed files with 610 additions and 655 deletions.
4 changes: 0 additions & 4 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions core/bin/system-constants-generator/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{cell::RefCell, rc::Rc};
use once_cell::sync::Lazy;
use zksync_contracts::{
load_sys_contract, read_bootloader_code, read_bytecode_from_path, read_sys_contract_bytecode,
read_zbin_bytecode, BaseSystemContracts, ContractLanguage, SystemContractCode,
read_yul_bytecode, BaseSystemContracts, ContractLanguage, SystemContractCode,
};
use zksync_multivm::{
interface::{
Expand Down Expand Up @@ -176,10 +176,10 @@ fn read_bootloader_test_code(test: &str) -> Vec<u8> {
)){
contract
} else {
read_zbin_bytecode(format!(
"contracts/system-contracts/bootloader/tests/artifacts/{}.yul.zbin",
read_yul_bytecode(
"contracts/system-contracts/bootloader/tests/artifacts",
test
))
)
}
}

Expand Down
10 changes: 6 additions & 4 deletions core/bin/zksync_server/src/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
use anyhow::Context;
use zksync_config::{
configs::{
da_client::DAClientConfig, eth_sender::PubdataSendingMode,
secrets::DataAvailabilitySecrets, wallets::Wallets, GeneralConfig, Secrets,
da_client::DAClientConfig, secrets::DataAvailabilitySecrets, wallets::Wallets,
GeneralConfig, Secrets,
},
ContractsConfig, GenesisConfig,
};
Expand Down Expand Up @@ -69,7 +69,9 @@ use zksync_node_framework::{
},
service::{ZkStackService, ZkStackServiceBuilder},
};
use zksync_types::{settlement::SettlementMode, SHARED_BRIDGE_ETHER_TOKEN_ADDRESS};
use zksync_types::{
pubdata_da::PubdataSendingMode, settlement::SettlementMode, SHARED_BRIDGE_ETHER_TOKEN_ADDRESS,
};
use zksync_vlog::prometheus::PrometheusExporterConfig;

/// Macro that looks into a path to fetch an optional config,
Expand Down Expand Up @@ -189,7 +191,7 @@ impl MainNodeBuilder {
.add_layer(BaseTokenRatioProviderLayer::new(base_token_adjuster_config));
}
let state_keeper_config = try_load_config!(self.configs.state_keeper_config);
let l1_gas_layer = L1GasLayer::new(state_keeper_config);
let l1_gas_layer = L1GasLayer::new(&state_keeper_config);
self.node.add_layer(l1_gas_layer);
Ok(self)
}
Expand Down
1 change: 1 addition & 0 deletions core/lib/basic_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub mod commitment;
pub mod network;
pub mod protocol_version;
pub mod prover_dal;
pub mod pubdata_da;
pub mod seed_phrase;
pub mod settlement;
pub mod tee_types;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
//! Types related to data availability.
use chrono::{DateTime, Utc};
use num_enum::TryFromPrimitive;
use serde::{Deserialize, Serialize};
use zksync_basic_types::L1BatchNumber;
use zksync_config::configs::eth_sender::PubdataSendingMode;

use crate::L1BatchNumber;

/// Enum holding the current values used for DA Layers.
#[repr(u8)]
#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Serialize)]
#[derive(TryFromPrimitive)]
pub enum PubdataDA {
#[derive(Debug, Clone, Copy, Default, PartialEq, Deserialize, Serialize, TryFromPrimitive)]
pub enum PubdataSendingMode {
/// Pubdata is sent to the L1 as a tx calldata.
#[default]
Calldata = 0,
/// Pubdata is sent to L1 as EIP-4844 blobs.
Blobs,
Expand All @@ -19,17 +21,6 @@ pub enum PubdataDA {
RelayedL2Calldata,
}

impl From<PubdataSendingMode> for PubdataDA {
fn from(value: PubdataSendingMode) -> Self {
match value {
PubdataSendingMode::Calldata => PubdataDA::Calldata,
PubdataSendingMode::Blobs => PubdataDA::Blobs,
PubdataSendingMode::Custom => PubdataDA::Custom,
PubdataSendingMode::RelayedL2Calldata => PubdataDA::RelayedL2Calldata,
}
}
}

/// Represents a blob in the data availability layer.
#[derive(Debug, Clone)]
pub struct DataAvailabilityBlob {
Expand Down
11 changes: 1 addition & 10 deletions core/lib/config/src/configs/eth_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::time::Duration;

use anyhow::Context as _;
use serde::Deserialize;
use zksync_basic_types::{settlement::SettlementMode, H256};
use zksync_basic_types::{pubdata_da::PubdataSendingMode, settlement::SettlementMode, H256};
use zksync_crypto_primitives::K256PrivateKey;

use crate::EthWatchConfig;
Expand Down Expand Up @@ -80,15 +80,6 @@ pub enum ProofLoadingMode {
FriProofFromGcs,
}

#[derive(Debug, Deserialize, Clone, Copy, PartialEq, Default)]
pub enum PubdataSendingMode {
#[default]
Calldata,
Blobs,
Custom,
RelayedL2Calldata,
}

#[derive(Debug, Deserialize, Clone, PartialEq)]
pub struct SenderConfig {
pub aggregated_proof_sizes: Vec<usize>,
Expand Down
15 changes: 2 additions & 13 deletions core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use zksync_basic_types::{
commitment::L1BatchCommitmentMode,
network::Network,
protocol_version::{ProtocolSemanticVersion, ProtocolVersionId, VersionPatch},
pubdata_da::PubdataSendingMode,
seed_phrase::SeedPhrase,
vm::FastVmMode,
L1BatchNumber, L1ChainId, L2ChainId,
Expand All @@ -16,8 +17,7 @@ use zksync_crypto_primitives::K256PrivateKey;

use crate::{
configs::{
self, da_client::DAClientConfig::Avail, eth_sender::PubdataSendingMode,
external_price_api_client::ForcedPriceClientConfig,
self, da_client::DAClientConfig::Avail, external_price_api_client::ForcedPriceClientConfig,
},
AvailConfig,
};
Expand Down Expand Up @@ -389,17 +389,6 @@ impl Distribution<configs::eth_sender::ProofLoadingMode> for EncodeDist {
}
}

impl Distribution<configs::eth_sender::PubdataSendingMode> for EncodeDist {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> configs::eth_sender::PubdataSendingMode {
type T = configs::eth_sender::PubdataSendingMode;
match rng.gen_range(0..3) {
0 => T::Calldata,
1 => T::Blobs,
_ => T::Custom,
}
}
}

impl Distribution<configs::eth_sender::SenderConfig> for EncodeDist {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> configs::eth_sender::SenderConfig {
configs::eth_sender::SenderConfig {
Expand Down
19 changes: 10 additions & 9 deletions core/lib/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,11 @@ impl SystemContractsRepo {
))) {
contract
} else {
read_zbin_bytecode_from_path(self.root.join(format!(
"contracts-preprocessed/{0}artifacts/{1}.yul.zbin",
directory, name
)))
read_yul_bytecode_by_path(
self.root
.join(format!("contracts-preprocessed/{directory}artifacts")),
name,
)
}
}
}
Expand All @@ -313,10 +314,10 @@ pub fn read_bootloader_code(bootloader_type: &str) -> Vec<u8> {
{
return contract;
};
read_zbin_bytecode(format!(
"contracts/system-contracts/bootloader/build/artifacts/{}.yul.zbin",
bootloader_type
))
read_yul_bytecode(
"contracts/system-contracts/bootloader/build/artifacts",
bootloader_type,
)
}

fn read_proved_batch_bootloader_bytecode() -> Vec<u8> {
Expand Down Expand Up @@ -438,7 +439,7 @@ impl BaseSystemContracts {

/// Loads the latest EVM emulator for these base system contracts. Logically, it only makes sense to do for the latest protocol version.
pub fn with_latest_evm_emulator(mut self) -> Self {
let bytecode = read_sys_contract_bytecode("", "EvmInterpreter", ContractLanguage::Yul);
let bytecode = read_sys_contract_bytecode("", "EvmEmulator", ContractLanguage::Yul);
let hash = hash_bytecode(&bytecode);
self.evm_emulator = Some(SystemContractCode {
code: bytes_to_be_words(bytecode),
Expand Down

This file was deleted.

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

6 changes: 0 additions & 6 deletions core/lib/dal/src/tee_proof_generation_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ impl TeeProofGenerationDal<'_, '_> {
p.l1_batch_number
FROM
proof_generation_details p
LEFT JOIN
l1_batches l1
ON p.l1_batch_number = l1.number
LEFT JOIN
tee_proof_generation_details tee
ON
Expand All @@ -56,9 +53,6 @@ impl TeeProofGenerationDal<'_, '_> {
p.l1_batch_number >= $5
AND p.vm_run_data_blob_url IS NOT NULL
AND p.proof_gen_data_blob_url IS NOT NULL
AND l1.hash IS NOT NULL
AND l1.aux_data_hash IS NOT NULL
AND l1.meta_parameters_hash IS NOT NULL
)
AND (
tee.l1_batch_number IS NULL
Expand Down
3 changes: 2 additions & 1 deletion core/lib/env_config/src/eth_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ impl FromEnv for GasAdjusterConfig {

#[cfg(test)]
mod tests {
use zksync_config::configs::eth_sender::{ProofSendingMode, PubdataSendingMode};
use zksync_basic_types::pubdata_da::PubdataSendingMode;
use zksync_config::configs::eth_sender::ProofSendingMode;

use super::*;
use crate::test_utils::{hash, EnvMutex};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use zksync_types::{
commitment::{L1BatchCommitmentMode, L1BatchWithMetadata},
ethabi::Token,
pubdata_da::PubdataDA,
pubdata_da::PubdataSendingMode,
};

use crate::{
Expand All @@ -14,7 +14,7 @@ use crate::{
pub struct CommitBatches<'a> {
pub last_committed_l1_batch: &'a L1BatchWithMetadata,
pub l1_batches: &'a [L1BatchWithMetadata],
pub pubdata_da: PubdataDA,
pub pubdata_da: PubdataSendingMode,
pub mode: L1BatchCommitmentMode,
}

Expand Down
Loading

0 comments on commit 02d7594

Please sign in to comment.