Skip to content

Commit

Permalink
feat(consensus): Support for syncing blocks before consensus genesis …
Browse files Browse the repository at this point in the history
…over p2p network (#3040)

To verify the received blocks, a node is requesting the payload hash of
the block from the main node. To verify the block content in a trustless
way, we will need to add more data to the L1 commitment.
  • Loading branch information
pompon0 authored Oct 9, 2024
1 parent 6105514 commit d3edc3d
Show file tree
Hide file tree
Showing 40 changed files with 1,566 additions and 1,728 deletions.
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

0 comments on commit d3edc3d

Please sign in to comment.