Skip to content

Commit

Permalink
feat!: updated boojum and nightly rust compiler (#2126)
Browse files Browse the repository at this point in the history
## What ❔

* Updated boojum version, which allows us to update nightly rust
compiler.

## Why ❔

* Our rust nightly is quite old (around 1 year)
  • Loading branch information
mm-zk authored Jun 5, 2024
1 parent ac61fed commit 9e39f13
Show file tree
Hide file tree
Showing 68 changed files with 135 additions and 147 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ contracts/.git
!etc/env/dev.toml
!etc/env/consensus_secrets.yaml
!etc/env/consensus_config.yaml
!rust-toolchain
2 changes: 1 addition & 1 deletion .github/workflows/build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
COMPONENT: ${{ matrix.components }}
PLATFORM: ${{ matrix.platforms }}
run: |
ci_run rustup default nightly-2023-08-21
ci_run rustup default nightly-2024-05-07
platform=$(echo $PLATFORM | tr '/' '-')
ci_run zk docker $DOCKER_ACTION --custom-tag=${IMAGE_TAG_SUFFIX} --platform=${PLATFORM} $COMPONENT
- name: Show sccache stats
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
COMPONENT: ${{ matrix.components }}
PLATFORM: ${{ matrix.platforms }}
run: |
ci_run rustup default nightly-2023-08-21
ci_run rustup default nightly-2024-05-07
platform=$(echo $PLATFORM | tr '/' '-')
ci_run zk docker $DOCKER_ACTION --custom-tag=${IMAGE_TAG_SUFFIX} --platform=${PLATFORM} $COMPONENT
- name: Show sccache stats
Expand Down
19 changes: 4 additions & 15 deletions Cargo.lock

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

12 changes: 5 additions & 7 deletions core/bin/external_node/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,11 @@ impl ValidateChainIdsTask {
.fuse();
let main_node_l2_check =
Self::check_l2_chain_using_main_node(self.main_node_client, self.l2_chain_id).fuse();
loop {
tokio::select! {
Err(err) = eth_client_check => return Err(err),
Err(err) = main_node_l1_check => return Err(err),
Err(err) = main_node_l2_check => return Err(err),
_ = stop_receiver.changed() => return Ok(()),
}
tokio::select! {
Err(err) = eth_client_check => Err(err),
Err(err) = main_node_l1_check => Err(err),
Err(err) = main_node_l2_check => Err(err),
_ = stop_receiver.changed() => Ok(()),
}
}
}
Expand Down
44 changes: 22 additions & 22 deletions core/lib/basic_types/src/web3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,28 @@ pub enum SyncState {
NotSyncing,
}

// Sync info from subscription has a different key format
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
struct SubscriptionSyncInfo {
/// The block at which import began.
pub starting_block: U256,
/// The highest currently synced block.
pub current_block: U256,
/// The estimated highest block.
pub highest_block: U256,
}

impl From<SubscriptionSyncInfo> for SyncInfo {
fn from(s: SubscriptionSyncInfo) -> Self {
Self {
starting_block: s.starting_block,
current_block: s.current_block,
highest_block: s.highest_block,
}
}
}

// The `eth_syncing` method returns either `false` or an instance of the sync info object.
// This doesn't play particularly well with the features exposed by `serde_derive`,
// so we use the custom impls below to ensure proper behavior.
Expand All @@ -875,28 +897,6 @@ impl<'de> Deserialize<'de> for SyncState {
where
D: Deserializer<'de>,
{
// Sync info from subscription has a different key format
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
struct SubscriptionSyncInfo {
/// The block at which import began.
pub starting_block: U256,
/// The highest currently synced block.
pub current_block: U256,
/// The estimated highest block.
pub highest_block: U256,
}

impl From<SubscriptionSyncInfo> for SyncInfo {
fn from(s: SubscriptionSyncInfo) -> Self {
Self {
starting_block: s.starting_block,
current_block: s.current_block,
highest_block: s.highest_block,
}
}
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct SubscriptionSyncState {
pub syncing: bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ impl OuterTypeBuilder {
let mut result = BTreeMap::new();

while let Some(front_element) = self.inner_members_queue.pop_front() {
if result.get(&front_element.member_type).is_some() {
if result.contains_key(&front_element.member_type) {
continue;
}

result.insert(front_element.member_type.clone(), front_element.clone());
for inner_member in front_element.inner_members {
if inner_member.is_reference_type && result.get(&inner_member.member_type).is_none()
if inner_member.is_reference_type && !result.contains_key(&inner_member.member_type)
{
self.inner_members_queue.push_back(inner_member);
}
Expand Down
4 changes: 2 additions & 2 deletions core/lib/dal/src/events_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl EventsDal<'_, '_> {
write_str!(
&mut buffer,
r"\\x{topic0:x}|\\x{topic1:x}|\\x{topic2:x}|\\x{topic3:x}|",
topic0 = EventTopic(event.indexed_topics.get(0)),
topic0 = EventTopic(event.indexed_topics.first()),
topic1 = EventTopic(event.indexed_topics.get(1)),
topic2 = EventTopic(event.indexed_topics.get(2)),
topic3 = EventTopic(event.indexed_topics.get(3))
Expand Down Expand Up @@ -454,7 +454,7 @@ mod tests {
tx_index_in_l2_block: 0,
tx_initiator_address: Address::default(),
};
let first_events = vec![create_vm_event(0, 0), create_vm_event(1, 4)];
let first_events = [create_vm_event(0, 0), create_vm_event(1, 4)];
let second_location = IncludedTxLocation {
tx_hash: H256([2; 32]),
tx_index_in_l2_block: 1,
Expand Down
1 change: 0 additions & 1 deletion core/lib/dal/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use zksync_types::{ProtocolVersionId, H160, H256};

pub mod storage_eth_tx;
pub mod storage_event;
pub mod storage_fee_monitor;
pub mod storage_log;
pub mod storage_oracle_info;
pub mod storage_protocol_version;
Expand Down
16 changes: 0 additions & 16 deletions core/lib/dal/src/models/storage_fee_monitor.rs

This file was deleted.

4 changes: 2 additions & 2 deletions core/lib/dal/src/pruning_dal/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn insert_l2_to_l1_logs(conn: &mut Connection<'_, Core>, l2_block_number:
tx_index_in_l2_block: 0,
tx_initiator_address: Address::default(),
};
let first_logs = vec![mock_l2_to_l1_log(), mock_l2_to_l1_log()];
let first_logs = [mock_l2_to_l1_log(), mock_l2_to_l1_log()];
let second_location = IncludedTxLocation {
tx_hash: H256([2; 32]),
tx_index_in_l2_block: 1,
Expand All @@ -71,7 +71,7 @@ async fn insert_events(conn: &mut Connection<'_, Core>, l2_block_number: L2Block
tx_index_in_l2_block: 0,
tx_initiator_address: Address::default(),
};
let first_events = vec![mock_vm_event(0), mock_vm_event(1)];
let first_events = [mock_vm_event(0), mock_vm_event(1)];
let second_location = IncludedTxLocation {
tx_hash: H256([2; 32]),
tx_index_in_l2_block: 1,
Expand Down
6 changes: 3 additions & 3 deletions core/lib/eth_client/src/clients/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ impl From<Vec<u8>> for MockTx {
fn from(tx: Vec<u8>) -> Self {
let len = tx.len();
let recipient = Address::from_slice(&tx[len - 116..len - 96]);
let max_fee_per_gas = U256::try_from(&tx[len - 96..len - 64]).unwrap();
let max_priority_fee_per_gas = U256::try_from(&tx[len - 64..len - 32]).unwrap();
let nonce = U256::try_from(&tx[len - 32..]).unwrap().as_u64();
let max_fee_per_gas = U256::from(&tx[len - 96..len - 64]);
let max_priority_fee_per_gas = U256::from(&tx[len - 64..len - 32]);
let nonce = U256::from(&tx[len - 32..]).as_u64();
let hash = {
let mut buffer = [0_u8; 32];
buffer.copy_from_slice(&tx[..32]);
Expand Down
2 changes: 1 addition & 1 deletion core/lib/mempool/src/mempool_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl MempoolStore {

/// Returns `true` if there is a transaction in the mempool satisfying the filter.
pub fn has_next(&self, filter: &L2TxFilter) -> bool {
self.l1_transactions.get(&self.next_priority_id).is_some()
self.l1_transactions.contains_key(&self.next_priority_id)
|| self
.l2_priority_queue
.iter()
Expand Down
2 changes: 1 addition & 1 deletion core/lib/merkle_tree/src/storage/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl WorkingPatchSet {
if nibble_count == 0 {
// Copy the root node to all parts.
for part in &mut parts {
part.changes_by_nibble_count[0] = level.clone();
part.changes_by_nibble_count[0].clone_from(&level);
}
} else {
for (nibbles, node) in level {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/mini_merkle_tree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
assert!(
tree_depth_by_size(binary_tree_size) <= MAX_TREE_DEPTH,
"Tree contains more than {} items; this is not supported",
1 << MAX_TREE_DEPTH
1u64 << MAX_TREE_DEPTH
);

Self {
Expand Down
3 changes: 2 additions & 1 deletion core/lib/multivm/src/versions/vm_1_3_2/event_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ impl<H: HistoryMode> InMemoryEventSink<H> {
// since if rollbacks of parents were not appended anywhere we just still keep them
for el in history {
// we are time ordered here in terms of rollbacks
if tmp.get(&el.timestamp.0).is_some() {
#[allow(clippy::map_entry)]
if tmp.contains_key(&el.timestamp.0) {
assert!(el.rollback);
tmp.remove(&el.timestamp.0);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub(crate) fn get_debug_log<H: HistoryMode>(
let data = U256::from_big_endian(&data);

// For long data, it is better to use hex-encoding for greater readability
let data_str = if data > U256::from(u64::max_value()) {
let data_str = if data > U256::from(u64::MAX) {
let mut bytes = [0u8; 32];
data.to_big_endian(&mut bytes);
format!("0x{}", hex::encode(bytes))
Expand Down
3 changes: 2 additions & 1 deletion core/lib/multivm/src/versions/vm_1_3_2/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {
});
let compressed_bytecodes: Vec<_> = filtered_deps.collect();

self.last_tx_compressed_bytecodes = compressed_bytecodes.clone();
self.last_tx_compressed_bytecodes
.clone_from(&compressed_bytecodes);
crate::vm_1_3_2::vm_with_bootloader::push_transaction_to_bootloader_memory(
&mut self.vm,
&tx,
Expand Down
3 changes: 2 additions & 1 deletion core/lib/multivm/src/versions/vm_1_4_1/old_vm/event_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ impl<H: HistoryMode> InMemoryEventSink<H> {
// since if rollbacks of parents were not appended anywhere we just still keep them
for el in history {
// we are time ordered here in terms of rollbacks
if tmp.get(&el.timestamp.0).is_some() {
#[allow(clippy::map_entry)]
if tmp.contains_key(&el.timestamp.0) {
assert!(el.rollback);
tmp.remove(&el.timestamp.0);
} else {
Expand Down
3 changes: 3 additions & 0 deletions core/lib/multivm/src/versions/vm_1_4_1/old_vm/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub(crate) enum VmExecutionResult {
Ok(Vec<u8>),
Revert(Vec<u8>),
Panic,
#[allow(dead_code)]
MostLikelyDidNotFinish(Address, u16),
}

Expand All @@ -31,6 +32,7 @@ pub(crate) const fn aux_heap_page_from_base(base: MemoryPage) -> MemoryPage {
MemoryPage(base.0 + 3)
}

#[allow(dead_code)]
pub(crate) trait FixedLengthIterator<'a, I: 'a, const N: usize>: Iterator<Item = I>
where
Self: 'a,
Expand All @@ -42,6 +44,7 @@ where

pub(crate) trait IntoFixedLengthByteIterator<const N: usize> {
type IntoIter: FixedLengthIterator<'static, u8, N>;
#[allow(dead_code)]
fn into_le_iter(self) -> Self::IntoIter;
fn into_be_iter(self) -> Self::IntoIter;
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/versions/vm_1_4_1/tracers/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub(crate) fn get_debug_log<H: HistoryMode>(
let data = U256::from_big_endian(&data);

// For long data, it is better to use hex-encoding for greater readability
let data_str = if data > U256::from(u64::max_value()) {
let data_str = if data > U256::from(u64::MAX) {
let mut bytes = [0u8; 32];
data.to_big_endian(&mut bytes);
format!("0x{}", hex::encode(bytes))
Expand Down
3 changes: 2 additions & 1 deletion core/lib/multivm/src/versions/vm_1_4_2/old_vm/event_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ impl<H: HistoryMode> InMemoryEventSink<H> {
// since if rollbacks of parents were not appended anywhere we just still keep them
for el in history {
// we are time ordered here in terms of rollbacks
if tmp.get(&el.timestamp.0).is_some() {
#[allow(clippy::map_entry)]
if tmp.contains_key(&el.timestamp.0) {
assert!(el.rollback);
tmp.remove(&el.timestamp.0);
} else {
Expand Down
3 changes: 3 additions & 0 deletions core/lib/multivm/src/versions/vm_1_4_2/old_vm/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub(crate) enum VmExecutionResult {
Ok(Vec<u8>),
Revert(Vec<u8>),
Panic,
#[allow(dead_code)]
MostLikelyDidNotFinish(Address, u16),
}

Expand All @@ -31,6 +32,7 @@ pub(crate) const fn aux_heap_page_from_base(base: MemoryPage) -> MemoryPage {
MemoryPage(base.0 + 3)
}

#[allow(dead_code)]
pub(crate) trait FixedLengthIterator<'a, I: 'a, const N: usize>: Iterator<Item = I>
where
Self: 'a,
Expand All @@ -42,6 +44,7 @@ where

pub(crate) trait IntoFixedLengthByteIterator<const N: usize> {
type IntoIter: FixedLengthIterator<'static, u8, N>;
#[allow(dead_code)]
fn into_le_iter(self) -> Self::IntoIter;
fn into_be_iter(self) -> Self::IntoIter;
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/versions/vm_1_4_2/tracers/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub(crate) fn get_debug_log<H: HistoryMode>(
let data = U256::from_big_endian(&data);

// For long data, it is better to use hex-encoding for greater readability
let data_str = if data > U256::from(u64::max_value()) {
let data_str = if data > U256::from(u64::MAX) {
let mut bytes = [0u8; 32];
data.to_big_endian(&mut bytes);
format!("0x{}", hex::encode(bytes))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ impl<H: HistoryMode> InMemoryEventSink<H> {
// since if rollbacks of parents were not appended anywhere we just still keep them
for el in history {
// we are time ordered here in terms of rollbacks
if tmp.get(&el.timestamp.0).is_some() {
#[allow(clippy::map_entry)]
if tmp.contains_key(&el.timestamp.0) {
assert!(el.rollback);
tmp.remove(&el.timestamp.0);
} else {
Expand Down
Loading

0 comments on commit 9e39f13

Please sign in to comment.