Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(consensus): Support for syncing blocks before consensus genesis over p2p network #3040

Merged
merged 16 commits into from
Oct 9, 2024
Merged
52 changes: 32 additions & 20 deletions Cargo.lock

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

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,16 @@ zk_evm_1_5_0 = { package = "zk_evm", version = "=0.150.5" }
zksync_vm2 = { git = "https://github.com/matter-labs/vm2.git", rev = "a233d44bbe61dc6a758a754c3b78fe4f83e56699" }

# Consensus dependencies.
zksync_concurrency = "=0.3.0"
zksync_consensus_bft = "=0.3.0"
zksync_consensus_crypto = "=0.3.0"
zksync_consensus_executor = "=0.3.0"
zksync_consensus_network = "=0.3.0"
zksync_consensus_roles = "=0.3.0"
zksync_consensus_storage = "=0.3.0"
zksync_consensus_utils = "=0.3.0"
zksync_protobuf = "=0.3.0"
zksync_protobuf_build = "=0.3.0"
zksync_concurrency = "=0.5.0"
zksync_consensus_bft = "=0.5.0"
zksync_consensus_crypto = "=0.5.0"
zksync_consensus_executor = "=0.5.0"
zksync_consensus_network = "=0.5.0"
zksync_consensus_roles = "=0.5.0"
zksync_consensus_storage = "=0.5.0"
zksync_consensus_utils = "=0.5.0"
zksync_protobuf = "=0.5.0"
zksync_protobuf_build = "=0.5.0"

# "Local" dependencies
zksync_multivm = { version = "0.1.0", path = "core/lib/multivm" }
Expand Down
16 changes: 16 additions & 0 deletions core/lib/basic_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::{
str::FromStr,
};

use anyhow::Context as _;
pub use ethabi::{
self,
ethereum_types::{
Expand All @@ -35,6 +36,21 @@ pub mod url;
pub mod vm;
pub mod web3;

/// Parses H256 from a slice of bytes.
pub fn parse_h256(bytes: &[u8]) -> anyhow::Result<H256> {
Ok(<[u8; 32]>::try_from(bytes).context("invalid size")?.into())
}

/// Parses H256 from an optional slice of bytes.
pub fn parse_h256_opt(bytes: Option<&[u8]>) -> anyhow::Result<H256> {
parse_h256(bytes.context("missing data")?)
}

/// Parses H160 from a slice of bytes.
pub fn parse_h160(bytes: &[u8]) -> anyhow::Result<H160> {
Ok(<[u8; 20]>::try_from(bytes).context("invalid size")?.into())
}

/// Account place in the global state tree is uniquely identified by its address.
/// Binary this type is represented by 160 bit big-endian representation of account address.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Hash, Ord, PartialOrd)]
Expand Down

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

3 changes: 3 additions & 0 deletions core/lib/dal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ zksync_types.workspace = true
zksync_concurrency.workspace = true
zksync_consensus_roles.workspace = true
zksync_consensus_storage.workspace = true
zksync_consensus_crypto.workspace = true
zksync_consensus_utils.workspace = true
zksync_protobuf.workspace = true
zksync_db_connection.workspace = true
zksync_l1_contract_interface.workspace = true

itertools.workspace = true
thiserror.workspace = true
Expand Down
Loading
Loading