Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

[chore] update rust toolchain to 1.76 nightly; replace lazy_static/once_cell with std::sync::LazyLock #1050

Merged
merged 45 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1828e4b
part1
lispc Oct 17, 2023
883f948
part2
lispc Oct 17, 2023
75a0001
wip
zhenfeizhang Oct 27, 2023
5cfcbd7
enforce eth v2.0.7
zhenfeizhang Oct 27, 2023
d485ecc
update links
zhenfeizhang Oct 27, 2023
614f9fc
clean up zktrie
zhenfeizhang Oct 27, 2023
0672a17
fix keccak circuit
zhenfeizhang Oct 27, 2023
11d4fe6
fix gadgets
zhenfeizhang Oct 27, 2023
95774d8
fix bus-mapping
zhenfeizhang Oct 27, 2023
bae6f57
everything compiles now
zhenfeizhang Oct 30, 2023
45cf848
compiles
zhenfeizhang Nov 9, 2023
3b668fe
compiles
zhenfeizhang Nov 9, 2023
c267ed0
clean up
zhenfeizhang Nov 13, 2023
168c981
update zktrie links
zhenfeizhang Nov 20, 2023
16e4095
update dep for zktrie
noel2004 Dec 1, 2023
e660a78
Merge branch 'develop' into chore/rust
lightsing Dec 4, 2023
13e3963
[chore] update rust toolchain to 1.76 nightly
lightsing Dec 5, 2023
21de060
Fix all dep/compliation issues in Sync ff 0.13 (#1056)
noel2004 Dec 5, 2023
3a30167
Merge remote-tracking branch 'scroll/develop' into sync-ff-0.13
lispc Dec 5, 2023
1cb7df2
upgrade halo2;
lispc Dec 5, 2023
94ae9a7
remove lazy_static and once_cell
lightsing Dec 5, 2023
0029f1a
update snark-verifier
lightsing Dec 5, 2023
0a359e6
build
lispc Dec 5, 2023
d7b1631
Upgrade rust-toolchain to `nightly-2023-10-27` in CI.
silathdiir Dec 5, 2023
303265d
Fix some byte values (u8) from `u128` to `u64` in `SAR`.
silathdiir Dec 5, 2023
582ee69
uncomment unit tests for aggregator
zhenfeizhang Dec 5, 2023
8d17893
fix clippy
zhenfeizhang Dec 5, 2023
3239d80
uncomment sig circuit and tx circuit
zhenfeizhang Dec 6, 2023
da8599c
uncomment rlc gates unit tests
zhenfeizhang Dec 6, 2023
63e685d
fix make doc
lispc Dec 6, 2023
f9e113f
Merge branch 'sync-ff-0.13' of github.com:scroll-tech/zkevm-circuits …
lispc Dec 6, 2023
96a03af
uncomment sig/ecc related code
zhenfeizhang Dec 6, 2023
a839cec
Merge branch 'sync-ff-0.13' of github.com:scroll-tech/zkevm-circuits …
zhenfeizhang Dec 6, 2023
16ef6b1
minor fix
zhenfeizhang Dec 6, 2023
a4a54b1
clippy
zhenfeizhang Dec 6, 2023
572584e
undo last clippy..
zhenfeizhang Dec 6, 2023
5eb0830
disable some super circuit tests
lispc Dec 6, 2023
98deda1
update ci script
lightsing Dec 6, 2023
4cf074e
fix missing
lightsing Dec 6, 2023
0b2ad3e
Merge remote-tracking branch 'origin/sync-ff-0.13' into chore/rust
lightsing Dec 6, 2023
1fa5314
post merge
lightsing Dec 6, 2023
c2cad5e
soundness fix
lightsing Dec 6, 2023
8928bca
fix missing
lightsing Dec 6, 2023
10d3caf
fix missing
lightsing Dec 6, 2023
80f1b4b
Merge remote-tracking branch 'scroll/develop' into chore/rust
lispc Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
echo "HOME=/home/CI" >> $GITHUB_ENV
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
- name: Setup golang
uses: actions/setup-go@v3
with:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
echo "HOME=/home/CI" >> $GITHUB_ENV
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
- name: Setup golang
uses: actions/setup-go@v3
with:
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
- name: Add target
run: rustup target add ${{ matrix.target }}
# Go cache for building geth-utils
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
# Go cache for building geth-utils
- name: Go cache
uses: actions/cache@v3
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
# Go cache for building geth-utils
- name: Go cache
uses: actions/cache@v3
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
components: rustfmt
# Go cache for building geth-utils
- name: Go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
- name: Setup golang
uses: actions/setup-go@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03
components: clippy
# Go cache for building geth-utils
- name: Go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-10-27
toolchain: nightly-2023-12-03

# Go cache for building geth-utils
- name: Go cache
Expand Down
12 changes: 0 additions & 12 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ halo2-base = { git = "https://github.com/scroll-tech/halo2-lib", branch = "devel
halo2-ecc = { git = "https://github.com/scroll-tech/halo2-lib", branch = "develop", default-features=false, features=["halo2-pse","display"] }
hex = "0.4"
itertools = "0.11"
lazy_static = "1.4"
libsecp256k1 = "0.7"
log = "0.4"
num = "0.4"
num-bigint = "0.4"
num-traits = "0.2"
once_cell = "1.17"
pretty_assertions = "1.0"
rand = "0.8"
rand_chacha = "0.3"
Expand Down
1 change: 0 additions & 1 deletion aggregator/src/aggregation/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ impl CircuitExt<Fr> for AggregationCircuit {
config.0.flex_gate().basic_gates[0]
.iter()
.map(|gate| gate.q_enable)
.into_iter()
.chain(
[
config.0.rlc_config.selector,
Expand Down
1 change: 0 additions & 1 deletion aggregator/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,6 @@ pub(crate) fn conditional_constraints(
.iter()
.skip(1)
.take((MAX_AGG_SNARKS + 1) * 2)
.into_iter()
.chunks(2)
.into_iter()
{
Expand Down
3 changes: 1 addition & 2 deletions aggregator/src/tests/mock_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ impl Circuit<Fr> for MockChunkCircuit {
let mut index = 0;
let acc_len = if self.has_accumulator { ACC_LEN } else { 0 };

for (_i, byte) in iter::repeat(0)
for byte in iter::repeat(0)
.take(acc_len)
.chain(self.chunk.public_input_hash().as_bytes().iter().copied())
.enumerate()
{
let cell = config
.rlc_config
Expand Down
9 changes: 2 additions & 7 deletions aggregator/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) fn get_indices(preimages: &[Vec<u8>]) -> (Vec<usize>, Vec<usize>) {
for (i, round) in preimage_padded.chunks(INPUT_LEN_PER_ROUND).enumerate() {
let f_round_offset = round_ctr * keccak_f_rows;
// indices for preimages
for (j, _chunk) in round.chunks(8).into_iter().enumerate() {
for (j, _chunk) in round.chunks(8).enumerate() {
let inner_offset = f_round_offset + (j + 1) * inner_round_rows;
for k in 0..8 {
preimage_indices.push(inner_offset + k);
Expand All @@ -83,12 +83,7 @@ pub(crate) fn get_indices(preimages: &[Vec<u8>]) -> (Vec<usize>, Vec<usize>) {
}
// last hash is for data_hash and has various length, so we output all the possible cells
for _i in 0..get_data_hash_keccak_updates(MAX_AGG_SNARKS) {
for (j, _) in (0..INPUT_LEN_PER_ROUND)
.into_iter()
.chunks(8)
.into_iter()
.enumerate()
{
for (j, _) in (0..INPUT_LEN_PER_ROUND).chunks(8).into_iter().enumerate() {
let inner_offset = round_ctr * keccak_f_rows + (j + 1) * inner_round_rows;
for k in 0..8 {
preimage_indices.push(inner_offset + k);
Expand Down
2 changes: 0 additions & 2 deletions bus-mapping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ ethers-providers.workspace = true
halo2_proofs.workspace = true
hash-circuit.workspace = true
itertools.workspace = true
lazy_static.workspace = true
log.workspace = true
num.workspace = true
rand = { workspace = true, optional = true }
Expand All @@ -28,7 +27,6 @@ strum_macros.workspace = true

# precompile related crates
revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "scroll-fix" }
once_cell.workspace = true

[dev-dependencies]
hex.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/circuit_input_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl<'a> CircuitInputBuilder {
RW::READ,
StorageOp::new(
*MESSAGE_QUEUE,
*WITHDRAW_TRIE_ROOT_SLOT,
WITHDRAW_TRIE_ROOT_SLOT,
withdraw_root,
withdraw_root,
dummy_tx_id,
Expand Down
14 changes: 6 additions & 8 deletions bus-mapping/src/circuit_input_builder/l2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,9 @@ impl CircuitInputBuilder {
!existed
}),
)
.fold(
Ok(HashMap::new()),
|m, parsed| -> Result<HashMap<_, _>, Error> {
let mut m = m?;
.try_fold(
HashMap::new(),
|mut m, parsed| -> Result<HashMap<_, _>, Error> {
let (addr, acc) = parsed.map_err(Error::IoError)?;
m.insert(addr, acc);
Ok(m)
Expand All @@ -415,10 +414,9 @@ impl CircuitInputBuilder {
!existed
}),
)
.fold(
Ok(HashMap::new()),
|m, parsed| -> Result<HashMap<(Address, Word), Word>, Error> {
let mut m = m?;
.try_fold(
HashMap::new(),
|mut m, parsed| -> Result<HashMap<(Address, Word), Word>, Error> {
let ((addr, key), val) = parsed.map_err(Error::IoError)?;
m.insert((addr, key), val.into());
Ok(m)
Expand Down
14 changes: 6 additions & 8 deletions bus-mapping/src/circuit_input_builder/tracer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ use eth_types::{
geth_types::GethData,
word, Bytecode, GethExecError, Hash, ToAddress, ToWord, Word,
};
use lazy_static::lazy_static;
use mock::{
test_ctx::{helpers::*, LoggerConfig, TestContext},
MOCK_COINBASE,
};
use pretty_assertions::assert_eq;
use std::collections::HashSet;
use std::{collections::HashSet, sync::LazyLock};

// Helper struct that contains a CircuitInputBuilder, a particular tx and a
// particular execution step so that we can easily get a
Expand Down Expand Up @@ -74,12 +73,11 @@ impl CircuitInputBuilderTx {
}
}

lazy_static! {
static ref ADDR_A: Address = Address::zero();
static ref WORD_ADDR_A: Word = ADDR_A.to_word();
static ref ADDR_B: Address = address!("0x0000000000000000000000000000000000000123");
static ref WORD_ADDR_B: Word = ADDR_B.to_word();
}
static ADDR_A: LazyLock<Address> = LazyLock::new(Address::zero);
static WORD_ADDR_A: LazyLock<Word> = LazyLock::new(|| ADDR_A.to_word());
static ADDR_B: LazyLock<Address> =
LazyLock::new(|| address!("0x0000000000000000000000000000000000000123"));
static WORD_ADDR_B: LazyLock<Word> = LazyLock::new(|| ADDR_B.to_word());

fn mock_internal_create() -> Call {
Call {
Expand Down
3 changes: 1 addition & 2 deletions bus-mapping/src/evm/opcodes/calldataload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ mod calldataload_tests {
memory_a.resize(call_data_length, 0);
}

let mut memory_bytes = vec![];
memory_bytes.resize(32 - pushdata.len(), 0);
let mut memory_bytes = vec![0; 32 - pushdata.len()];
let mut pushdata_mut = pushdata.clone();
memory_bytes.append(&mut pushdata_mut);
// let code_a = bytecode! {
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/evm/opcodes/chainid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod chainid_tests {
},
(
RW::WRITE,
&StackOp::new(1, StackAddress::from(1023), (*MOCK_CHAIN_ID).into())
&StackOp::new(1, StackAddress::from(1023), (MOCK_CHAIN_ID).into())
)
);
}
Expand Down
22 changes: 10 additions & 12 deletions bus-mapping/src/l2_predeployed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,27 @@ use eth_types::Address;
pub mod message_queue {
use super::*;
use eth_types::U256;
use once_cell::sync::Lazy;
use std::str::FromStr;
use std::{str::FromStr, sync::LazyLock};

/// address of L2MessageQueue predeploy
pub static ADDRESS: Lazy<Address> =
Lazy::new(|| Address::from_str("0x5300000000000000000000000000000000000000").unwrap());
pub static ADDRESS: LazyLock<Address> =
LazyLock::new(|| Address::from_str("0x5300000000000000000000000000000000000000").unwrap());
/// the slot of withdraw root in L2MessageQueue
pub static WITHDRAW_TRIE_ROOT_SLOT: Lazy<U256> = Lazy::new(U256::zero);
pub static WITHDRAW_TRIE_ROOT_SLOT: U256 = U256::zero();
}

/// Helper for L1GasPriceOracle contract
pub mod l1_gas_price_oracle {
use eth_types::{Address, U256};
use once_cell::sync::Lazy;
use std::str::FromStr;
use std::{str::FromStr, sync::LazyLock};

/// L1GasPriceOracle predeployed address
pub static ADDRESS: Lazy<Address> =
Lazy::new(|| Address::from_str("0x5300000000000000000000000000000000000002").unwrap());
pub static ADDRESS: LazyLock<Address> =
LazyLock::new(|| Address::from_str("0x5300000000000000000000000000000000000002").unwrap());
/// L1 base fee slot in L1GasPriceOracle
pub static BASE_FEE_SLOT: Lazy<U256> = Lazy::new(|| U256::from(1));
pub static BASE_FEE_SLOT: LazyLock<U256> = LazyLock::new(|| U256::from(1));
/// L1 overhead slot in L1GasPriceOracle
pub static OVERHEAD_SLOT: Lazy<U256> = Lazy::new(|| U256::from(2));
pub static OVERHEAD_SLOT: LazyLock<U256> = LazyLock::new(|| U256::from(2));
/// L1 scalar slot in L1GasPriceOracle
pub static SCALAR_SLOT: Lazy<U256> = Lazy::new(|| U256::from(3));
pub static SCALAR_SLOT: LazyLock<U256> = LazyLock::new(|| U256::from(3));
}
1 change: 1 addition & 0 deletions bus-mapping/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(lazy_cell)]
//! ![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/appliedzkp/zkevm-circuits/CI%20checks/main?style=for-the-badge)
//! Bus-Mapping is a crate designed to parse EVM execution traces and manipulate
//! all of the data they provide in order to obtain structured witness inputs
Expand Down
Loading