From a149ebd73d5022bf64596973397b0139aee38ef9 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 16 Apr 2024 11:29:27 -0500 Subject: [PATCH 001/140] attempt Cherry-Picked from OffchainLabs/nitro@flatmerkleapril16 --- arbitrator/Cargo.lock | 135 +++++++++++++++- arbitrator/Cargo.toml | 1 + arbitrator/bench/Cargo.toml | 22 +++ arbitrator/bench/src/bin.rs | 76 +++++++++ arbitrator/bench/src/lib.rs | 2 + arbitrator/bench/src/parse_input.rs | 163 +++++++++++++++++++ arbitrator/bench/src/prepare.rs | 69 ++++++++ arbitrator/prover/src/flat_merkle.rs | 226 +++++++++++++++++++++++++++ arbitrator/prover/src/lib.rs | 3 +- arbitrator/prover/src/machine.rs | 14 +- bold | 1 + 11 files changed, 708 insertions(+), 4 deletions(-) create mode 100644 arbitrator/bench/Cargo.toml create mode 100644 arbitrator/bench/src/bin.rs create mode 100644 arbitrator/bench/src/lib.rs create mode 100644 arbitrator/bench/src/parse_input.rs create mode 100644 arbitrator/bench/src/prepare.rs create mode 100644 arbitrator/prover/src/flat_merkle.rs create mode 160000 bold diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index dd6b57e654..dfef9ace1e 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -70,6 +70,54 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +[[package]] +name = "anstream" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "arbutil" version = "0.1.0" @@ -127,6 +175,17 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "bench" +version = "0.1.0" +dependencies = [ + "arbutil", + "clap 4.5.4", + "eyre", + "hex", + "prover", +] + [[package]] name = "bincode" version = "1.3.3" @@ -312,9 +371,59 @@ dependencies = [ "vec_map", ] +[[package]] +name = "clap" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.45", +] + +[[package]] +name = "clap_lex" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "convert_case" version = "0.4.0" + +[[package]] +name = "corosensei" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" @@ -795,6 +904,18 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1805,13 +1926,19 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "structopt" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" dependencies = [ - "clap", + "clap 2.33.3", "lazy_static", "structopt-derive", ] @@ -2069,6 +2196,12 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "vec_map" version = "0.8.2" diff --git a/arbitrator/Cargo.toml b/arbitrator/Cargo.toml index 4676b9cc84..f521f69ad1 100644 --- a/arbitrator/Cargo.toml +++ b/arbitrator/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ "arbutil", + "bench", "brotli", "brotli/fuzz", "caller-env", diff --git a/arbitrator/bench/Cargo.toml b/arbitrator/bench/Cargo.toml new file mode 100644 index 0000000000..e0346d7fab --- /dev/null +++ b/arbitrator/bench/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "bench" +version = "0.1.0" +edition = "2021" + +[lib] +name = "bench" +path = "src/lib.rs" + +[[bin]] +name = "benchbin" +path = "src/bin.rs" + +[dependencies] +hex = "0.4.3" +eyre = "0.6.5" +prover = { path = "../prover" } +arbutil = { path = "../arbutil" } +clap = { version = "4.4.8", features = ["derive"] } + +[profile.release] +debug = true \ No newline at end of file diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs new file mode 100644 index 0000000000..81b592fb48 --- /dev/null +++ b/arbitrator/bench/src/bin.rs @@ -0,0 +1,76 @@ +use std::{path::PathBuf, time::Duration}; + +use bench::prepare::*; +use clap::Parser; +use eyre::bail; +use prover::machine::MachineStatus; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +struct Args { + /// Path to a preimages text file + #[arg(short, long)] + preimages_path: PathBuf, + + /// Path to a machine.wavm.br + #[arg(short, long)] + machine_path: PathBuf, +} + +fn main() -> eyre::Result<()> { + let args = Args::parse(); + let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20]; + let always_merkleize = false; + println!("Running benchmark with always merkleize feature on"); + for step_size in step_sizes { + let mut machine = prepare_machine( + args.preimages_path.clone(), + args.machine_path.clone(), + always_merkleize, + )?; + let _ = machine.hash(); + let mut hash_times = vec![]; + let mut step_times = vec![]; + let mut num_iters = 0; + loop { + let start = std::time::Instant::now(); + machine.step_n(step_size)?; + let step_end_time = start.elapsed(); + step_times.push(step_end_time); + match machine.get_status() { + MachineStatus::Errored => { + println!("Errored"); + break; + // bail!("Machine errored => position {}", machine.get_steps()) + } + MachineStatus::TooFar => { + bail!("Machine too far => position {}", machine.get_steps()) + } + MachineStatus::Running => {} + MachineStatus::Finished => return Ok(()), + } + let start = std::time::Instant::now(); + let _ = machine.hash(); + let hash_end_time = start.elapsed(); + hash_times.push(hash_end_time); + num_iters += 1; + if num_iters == 100 { + break; + } + } + println!( + "avg hash time {:?}, avg step time {:?}, step size {}, num_iters {}", + average(&hash_times), + average(&step_times), + step_size, + num_iters, + ); + } + Ok(()) +} + +fn average(numbers: &[Duration]) -> Duration { + let sum: Duration = numbers.iter().sum(); + let sum: u64 = sum.as_nanos().try_into().unwrap(); + Duration::from_nanos(sum / numbers.len() as u64) +} diff --git a/arbitrator/bench/src/lib.rs b/arbitrator/bench/src/lib.rs new file mode 100644 index 0000000000..5f7c024094 --- /dev/null +++ b/arbitrator/bench/src/lib.rs @@ -0,0 +1,2 @@ +pub mod parse_input; +pub mod prepare; diff --git a/arbitrator/bench/src/parse_input.rs b/arbitrator/bench/src/parse_input.rs new file mode 100644 index 0000000000..9b645850f7 --- /dev/null +++ b/arbitrator/bench/src/parse_input.rs @@ -0,0 +1,163 @@ +use std::io::{self, BufRead}; + +#[derive(Debug, Clone)] +pub struct Preimage { + pub type_: u32, + pub hash: Vec, + pub data: Vec, +} + +#[derive(Debug, Clone)] +pub struct Item { + pub preimages: Vec, +} + +#[derive(Debug)] +pub struct BatchInfo { + pub number: u64, + pub data: Vec, +} + +#[derive(Debug)] +pub struct StartState { + pub block_hash: Vec, + pub send_root: Vec, + pub batch: u64, + pub pos_in_batch: u64, +} + +#[derive(Debug)] +pub struct FileData { + pub id: u64, + pub has_delayed_msg: bool, + pub delayed_msg_nr: u64, + pub items: Vec, + pub batch_info: BatchInfo, + pub delayed_msg: Vec, + pub start_state: StartState, +} + +impl FileData { + pub fn from_reader(mut reader: R) -> io::Result { + let mut items = Vec::new(); + let mut batch_info = BatchInfo { + number: 0, + data: Vec::new(), + }; + let mut id = 0; + let mut has_delayed_msg = false; + let mut delayed_msg_nr = 0; + let mut delayed_msg = Vec::new(); + let mut start_state = StartState { + block_hash: Vec::new(), + send_root: Vec::new(), + batch: 0, + pos_in_batch: 0, + }; + + let mut line = String::new(); + while reader.read_line(&mut line)? > 0 { + if line.starts_with("Id:") { + id = line.split(":").nth(1).unwrap().trim().parse().unwrap(); + } else if line.starts_with("HasDelayedMsg:") { + has_delayed_msg = line.split(":").nth(1).unwrap().trim().parse().unwrap(); + } else if line.starts_with("DelayedMsgNr:") { + delayed_msg_nr = line.split(":").nth(1).unwrap().trim().parse().unwrap(); + } else if line.starts_with("Preimages:") { + items.push(Item::from_reader(&mut reader, &mut line)?); + } else if line.starts_with("BatchInfo:") { + let parts: Vec<_> = line.split(",").collect(); + batch_info.number = parts[0].split(":").nth(2).unwrap().trim().parse().unwrap(); + batch_info.data = hex::decode(parts[1].split(":").nth(1).unwrap().trim()).unwrap(); + } else if line.starts_with("DelayedMsg:") { + delayed_msg = hex::decode(line.split(":").nth(1).unwrap().trim()).unwrap(); + } else if line.starts_with("StartState:") { + let parts: Vec<_> = line.split(",").collect(); + + // Parsing block_hash + let block_hash_str = parts[0].split("BlockHash:").nth(1).unwrap().trim(); + start_state.block_hash = + hex::decode(block_hash_str.strip_prefix("0x").unwrap()).unwrap(); + + // Parsing send_root + let send_root_str = parts[1].split(":").nth(1).unwrap().trim(); + start_state.send_root = + hex::decode(send_root_str.strip_prefix("0x").unwrap()).unwrap(); + + // Parsing batch + start_state.batch = parts[2] + .split(":") + .nth(1) + .unwrap() + .trim() + .parse::() + .unwrap(); + + // Parsing pos_in_batch + start_state.pos_in_batch = parts[3] + .split(":") + .nth(1) + .unwrap() + .trim() + .parse::() + .unwrap(); + } + line.clear(); + } + + Ok(FileData { + id, + has_delayed_msg, + delayed_msg_nr, + items, + batch_info, + delayed_msg, + start_state, + }) + } +} + +impl Item { + pub fn from_reader(reader: &mut R, line: &mut String) -> io::Result { + let mut preimages = Vec::new(); + + loop { + if line.is_empty() + || line.starts_with("BatchInfo:") + || line.starts_with("DelayedMsg:") + || line.starts_with("StartState:") + { + break; + } + if line.starts_with("Preimages:") { + line.clear(); + while reader.read_line(line)? > 0 && line.starts_with("\t") { + let parts: Vec<_> = line.trim().split(",").collect(); + let type_ = parts[0].split(":").nth(1).unwrap().trim().parse().unwrap(); + let hash = hex::decode( + parts[1] + .split(":") + .nth(1) + .unwrap() + .trim() + .strip_prefix("0x") + .unwrap(), + ) + .unwrap(); + let data = hex::decode(parts[2].split(":").nth(1).unwrap().trim()).unwrap(); + preimages.push(Preimage { type_, hash, data }); + line.clear(); + } + continue; // To skip line.clear() at the end of the loop for this case + } + + line.clear(); + if reader.read_line(line)? == 0 { + // If EOF is reached + break; + } + } + + Ok(Item { preimages }) + } +} diff --git a/arbitrator/bench/src/prepare.rs b/arbitrator/bench/src/prepare.rs new file mode 100644 index 0000000000..c6d45dae3b --- /dev/null +++ b/arbitrator/bench/src/prepare.rs @@ -0,0 +1,69 @@ +use arbutil::PreimageType; +use prover::machine::{argument_data_to_inbox, GlobalState, Machine}; +use prover::utils::{Bytes32, CBytes}; +use std::collections::HashMap; +use std::fs::File; +use std::io::BufReader; +use std::path::{Path, PathBuf}; +use std::sync::Arc; + +use crate::parse_input::*; + +pub fn prepare_machine( + preimages: PathBuf, + machines: PathBuf, + always_merkleize: bool, +) -> eyre::Result { + let file = File::open(&preimages)?; + let reader = BufReader::new(file); + + let data = FileData::from_reader(reader)?; + let item = data.items.get(0).unwrap().clone(); + let preimages = item.preimages; + let preimages = preimages + .into_iter() + .map(|preimage| { + let hash: [u8; 32] = preimage.hash.try_into().unwrap(); + let hash: Bytes32 = hash.into(); + (hash, preimage.data) + }) + .collect::>>(); + let preimage_resolver = move |_: u64, _: PreimageType, hash: Bytes32| -> Option { + preimages + .get(&hash) + .map(|data| CBytes::from(data.as_slice())) + }; + let preimage_resolver = Arc::new(Box::new(preimage_resolver)); + + let binary_path = Path::new(&machines); + // println!("Creating machine from binary_path"); + let mut mach = Machine::new_from_wavm(binary_path, always_merkleize)?; + + let block_hash: [u8; 32] = data.start_state.block_hash.try_into().unwrap(); + let block_hash: Bytes32 = block_hash.into(); + let send_root: [u8; 32] = data.start_state.send_root.try_into().unwrap(); + let send_root: Bytes32 = send_root.into(); + let bytes32_vals: [Bytes32; 2] = [block_hash, send_root]; + let u64_vals: [u64; 2] = [data.start_state.batch, data.start_state.pos_in_batch]; + let start_state = GlobalState { + bytes32_vals, + u64_vals, + }; + + //println!("Setting global state"); + mach.set_global_state(start_state); + // println!("After setting global state: {:?}", mach.get_global_state()); + + // println!("Setting preimage resolver"); + mach.set_preimage_resolver(preimage_resolver); + + // println!("Adding sequencer inbox message"); + let identifier = argument_data_to_inbox(0).unwrap(); + mach.add_inbox_msg(identifier, data.batch_info.number, data.batch_info.data); + + // println!("Adding delayed inbox message"); + let identifier = argument_data_to_inbox(1).unwrap(); + mach.add_inbox_msg(identifier, data.delayed_msg_nr, data.delayed_msg); + + Ok(mach) +} diff --git a/arbitrator/prover/src/flat_merkle.rs b/arbitrator/prover/src/flat_merkle.rs new file mode 100644 index 0000000000..022429696e --- /dev/null +++ b/arbitrator/prover/src/flat_merkle.rs @@ -0,0 +1,226 @@ +// Copyright 2021-2022, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE + +use crate::utils::Bytes32; +use digest::Digest; +// use rayon::prelude::*; +use sha3::Keccak256; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum MerkleType { + Empty, + Value, + Function, + Instruction, + Memory, + Table, + TableElement, + Module, +} + +impl Default for MerkleType { + fn default() -> Self { + Self::Empty + } +} + +impl MerkleType { + pub fn get_prefix(self) -> &'static str { + match self { + MerkleType::Empty => panic!("Attempted to get prefix of empty merkle type"), + MerkleType::Value => "Value merkle tree:", + MerkleType::Function => "Function merkle tree:", + MerkleType::Instruction => "Instruction merkle tree:", + MerkleType::Memory => "Memory merkle tree:", + MerkleType::Table => "Table merkle tree:", + MerkleType::TableElement => "Table element merkle tree:", + MerkleType::Module => "Module merkle tree:", + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Default)] +pub struct Merkle { + tree: Vec, + empty_hash: Bytes32, +} + +#[inline] +fn hash_node(a: &[u8], b: &[u8]) -> Bytes32 { + let mut h = Keccak256::new(); + h.update(a); + h.update(b); + h.finalize().into() +} + +impl Merkle { + pub fn new(ty: MerkleType, hashes: Vec) -> Merkle { + Self::new_advanced(ty, hashes, Bytes32::default(), 0) + } + pub fn new_advanced( + ty: MerkleType, + hashes: Vec, + empty_hash: Bytes32, + min_depth: usize, + ) -> Merkle { + if hashes.is_empty() { + return Merkle::default(); + } + + let empty_layer_hash = hash_node(empty_hash.as_slice(), empty_hash.as_slice()); + + let hash_count = hashes.len(); + let mut current_level_size = hash_count; + + // Calculate the total capacity needed for the tree + let mut total_capacity = hash_count * 32; // 32 bytes per hash + let mut depth = min_depth; + while current_level_size > 1 || depth > 0 { + current_level_size = (current_level_size + 1) / 2; + total_capacity += current_level_size * 32; + depth = depth.saturating_sub(1); + } + let mut tree = Vec::with_capacity(total_capacity); + + // Append initial hashes to the tree + for hash in hashes.into_iter() { + tree.extend_from_slice(hash.as_slice()); + } + + let mut next_level_offset = tree.len(); + let mut depth = min_depth; + + while current_level_size > 1 || depth > 0 { + let mut i = next_level_offset - current_level_size * 32; + while i < next_level_offset { + let left = &tree[i..i + 32]; + let right = if i + 32 < next_level_offset { + &tree[i + 32..i + 64] + } else { + empty_layer_hash.as_slice() + }; + + let parent_hash = hash_node(left, right); + tree.extend(parent_hash.as_slice()); + + i += 64; + } + + current_level_size = (current_level_size + 1) / 2; + next_level_offset = tree.len(); + depth = depth.saturating_sub(1); + } + + Merkle { + tree, + empty_hash: empty_layer_hash, + } + } + + pub fn root(&self) -> Bytes32 { + let len = self.tree.len(); + let mut root = [0u8; 32]; + root.copy_from_slice(&self.tree[len - 32..len]); + root.into() + } + + pub fn leaves(&self) -> &[u8] { + let leaf_layer_size = self.calculate_layer_size(0); + &self.tree[..leaf_layer_size * 32] + } + + pub fn prove(&self, idx: usize) -> Option> { + let leaf_count = self.calculate_layer_size(0); + if idx >= leaf_count { + return None; + } + + let mut proof = Vec::new(); + let mut node_index = idx; + let mut layer_start = 0; + + for depth in 0.. { + let layer_size = self.calculate_layer_size(depth); + if layer_size <= 1 { + break; + } + + let sibling_index = if node_index % 2 == 0 { + node_index + 1 + } else { + node_index - 1 + }; + if sibling_index < layer_size { + proof.extend(self.get_node(layer_start, sibling_index)); + } + + node_index /= 2; + layer_start += layer_size * 32; + } + + Some(proof) + } + + // Helper function to get a node from the tree + #[inline(always)] + fn get_node(&self, layer_start: usize, index: usize) -> Bytes32 { + let start = layer_start + index * 32; + let mut node = [0u8; 32]; + node.copy_from_slice(&self.tree[start..start + 32]); + node.into() + } + + pub fn set(&mut self, mut idx: usize, hash: Bytes32) { + // Calculate the offset in the flat tree for the given index + let mut offset = idx * 32; + + // Check if the hash at the calculated position is the same as the input hash + if &self.tree[offset..offset + 32] == hash.as_slice() { + return; + } + + // Copy the new hash into the tree at the calculated position + self.tree[offset..offset + 32].copy_from_slice(hash.as_slice()); + + // Calculate the total number of nodes in the tree + let total_nodes = self.tree.len() / 32; + + // Update parent hashes up the tree + let mut next_hash = hash; + while idx > 0 { + idx = (idx - 1) / 2; // Move to the parent index + offset = idx * 32; + + // Calculate the position of the sibling in the flat tree + let sibling_idx = if idx % 2 == 0 { idx + 1 } else { idx - 1 }; + let sibling_offset = sibling_idx * 32; + + // Handle the case where the sibling index is out of bounds + let sibling_hash = if sibling_offset < total_nodes * 32 { + &self.tree[sibling_offset..sibling_offset + 32] + } else { + self.empty_hash.as_slice() + }; + + // Calculate the parent hash + next_hash = if idx % 2 == 0 { + hash_node(next_hash.as_slice(), sibling_hash) + } else { + hash_node(sibling_hash, next_hash.as_slice()) + }; + + // Update the parent node in the flat tree + self.tree[offset..offset + 32].copy_from_slice(next_hash.as_slice()); + } + } + + // Helper function to calculate the size of a given layer + #[inline(always)] + fn calculate_layer_size(&self, depth: usize) -> usize { + let mut size = self.tree.len() / 32; // Total number of nodes + for _ in 0..depth { + size = (size + 1) / 2; // Size of the current layer + } + size + } +} diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index d2a8a43494..fccd28ff0f 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -4,6 +4,7 @@ #![allow(clippy::missing_safety_doc, clippy::too_many_arguments)] pub mod binary; +pub mod flat_merkle; mod host; #[cfg(feature = "native")] mod kzg; @@ -116,7 +117,7 @@ unsafe fn arbitrator_load_machine_impl( pub unsafe extern "C" fn arbitrator_load_wavm_binary(binary_path: *const c_char) -> *mut Machine { let binary_path = cstr_to_string(binary_path); let binary_path = Path::new(&binary_path); - match Machine::new_from_wavm(binary_path) { + match Machine::new_from_wavm(binary_path, false) { Ok(mach) => Box::into_raw(Box::new(mach)), Err(err) => { eprintln!("Error loading binary: {err}"); diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index a5fe33ea5c..77fcdca883 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -1538,7 +1538,7 @@ impl Machine { Ok(mach) } - pub fn new_from_wavm(wavm_binary: &Path) -> Result { + pub fn new_from_wavm(wavm_binary: &Path, always_merkleize: bool) -> Result { let mut modules: Vec = { let compressed = std::fs::read(wavm_binary)?; let Ok(modules) = brotli::decompress(&compressed, Dictionary::Empty) else { @@ -1564,6 +1564,16 @@ impl Machine { MerkleType::Function, module.funcs.iter().map(Function::hash).collect(), )); + if always_merkleize { + module.memory.cache_merkle_tree(); + } + } + let mut modules_merkle: Option = None; + if always_merkleize { + modules_merkle = Some(Merkle::new( + MerkleType::Module, + modules.iter().map(Module::hash).collect(), + )); } let mut mach = Machine { status: MachineStatus::Running, @@ -1573,7 +1583,7 @@ impl Machine { internal_stack: Vec::new(), frame_stacks: vec![Vec::new()], modules, - modules_merkle: None, + modules_merkle, global_state: Default::default(), pc: ProgramCounter::default(), stdio_output: Vec::new(), diff --git a/bold b/bold new file mode 160000 index 0000000000..f456e2fbfa --- /dev/null +++ b/bold @@ -0,0 +1 @@ +Subproject commit f456e2fbfa8560e52ada5fcc5ce927577d07483d From dec2e824da1bdecc1b880c20cf3b7dfb87f2eea0 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 17 Apr 2024 09:25:53 +0200 Subject: [PATCH 002/140] Make allow_merkleize a command-line switch. --- arbitrator/bench/src/bin.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 81b592fb48..905d202201 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -15,18 +15,25 @@ struct Args { /// Path to a machine.wavm.br #[arg(short, long)] machine_path: PathBuf, + + /// Should the memory tree always Merkleize + #[arg(short, long)] + always_merkleize: bool, } fn main() -> eyre::Result<()> { let args = Args::parse(); let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20]; - let always_merkleize = false; - println!("Running benchmark with always merkleize feature on"); + if args.always_merkleize { + println!("Running benchmark with always merkleize feature on"); + } else { + println!("Running benchmark with always merkleize feature off"); + } for step_size in step_sizes { let mut machine = prepare_machine( args.preimages_path.clone(), args.machine_path.clone(), - always_merkleize, + args.always_merkleize, )?; let _ = machine.hash(); let mut hash_times = vec![]; From 3c3026548a554ecd1c6d07a1896f000e065592cc Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Apr 2024 19:19:20 +0200 Subject: [PATCH 003/140] Add the total time for each step-size. It can be easy to look at small average step and hash times and miss that the total time is what we're really trying to reduce. --- arbitrator/bench/src/bin.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 905d202201..b39e661925 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -30,6 +30,7 @@ fn main() -> eyre::Result<()> { println!("Running benchmark with always merkleize feature off"); } for step_size in step_sizes { + let total = std::time::Instant::now(); let mut machine = prepare_machine( args.preimages_path.clone(), args.machine_path.clone(), @@ -65,12 +66,14 @@ fn main() -> eyre::Result<()> { break; } } + let total_end_time = total.elapsed(); println!( - "avg hash time {:?}, avg step time {:?}, step size {}, num_iters {}", + "avg hash time {:?}, avg step time {:?}, step size {}, num_iters {}, total time {:?}", average(&hash_times), average(&step_times), step_size, num_iters, + total_end_time, ); } Ok(()) From 51069f5ef3e5093067223f02bbd7c0947c55f7bc Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Apr 2024 19:26:26 +0200 Subject: [PATCH 004/140] Add some doc comments and tests to merkle.rs I definitely had some incorrect assumptions about this data structure which made it more difficult to learn. So, I'm documenting how it works and adding some tests. The simple_merkle test is currently failing because the `set` method doesn't allow setting an index larger than the largest currently set leaf's index. There is some debate as to whether or not this is the correct behavior. To run the test, use: ``` $> cargo test -- --include-ignored ``` --- arbitrator/prover/src/merkle.rs | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 16306bd611..bc05d5abe4 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -43,6 +43,15 @@ impl MerkleType { } } +/// A Merkle tree with a fixed number of layers +/// +/// https://en.wikipedia.org/wiki/Merkle_tree +/// +/// Each instance's leaves contain the hashes of a specific [MerkleType]. +/// The tree does not grow. It can be over-provisioned using the +/// [Merkle::new_advanced] method and passing a minimum depth. +/// +/// This structure does not contain the data itself, only the hashes. #[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] pub struct Merkle { ty: MerkleType, @@ -60,6 +69,8 @@ fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { } impl Merkle { + // Creates a new Merkle tree with the given type and leaf hashes. + // The tree is built up to the minimum depth necessary to hold all the leaves. pub fn new(ty: MerkleType, hashes: Vec) -> Merkle { Self::new_advanced(ty, hashes, Bytes32::default(), 0) } @@ -161,6 +172,8 @@ impl Merkle { *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); } + // Sets the leaf at the given index to the given hash. + // Panics if the index is out of bounds (since the structure doesn't grow). pub fn set(&mut self, mut idx: usize, hash: Bytes32) { if self.layers[0][idx] == hash { return; @@ -187,3 +200,45 @@ impl Merkle { } } } + +#[test] +#[ignore] +fn simple_merkle() { + let hashes = vec![ + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + Bytes32::from([5; 32]), + ]; + let mut expected = hash_node(MerkleType::Value, + hash_node( + MerkleType::Value, + hash_node(MerkleType::Value, Bytes32::from([1; 32]), Bytes32::from([2; 32])), + hash_node(MerkleType::Value, Bytes32::from([3; 32]), Bytes32::from([4; 32]))), + hash_node( + MerkleType::Value, + hash_node(MerkleType::Value, Bytes32::from([5; 32]), Bytes32::from([0; 32])), + hash_node(MerkleType::Value, Bytes32::from([0; 32]), Bytes32::from([0; 32])))); + let mut merkle = Merkle::new(MerkleType::Value, hashes.clone()); + assert_eq!(merkle.root(), expected); + + merkle.set(5, Bytes32::from([6; 32])); + expected = hash_node(MerkleType::Value, + hash_node( + MerkleType::Value, + hash_node(MerkleType::Value, Bytes32::from([1; 32]), Bytes32::from([2; 32])), + hash_node(MerkleType::Value, Bytes32::from([3; 32]), Bytes32::from([4; 32]))), + hash_node( + MerkleType::Value, + hash_node(MerkleType::Value, Bytes32::from([5; 32]), Bytes32::from([6; 32])), + hash_node(MerkleType::Value, Bytes32::from([0; 32]), Bytes32::from([0; 32])))); + assert_eq!(merkle.root(), expected); +} + +#[test] +#[should_panic] +fn set_with_bad_index_panics() { + let mut merkle = Merkle::new(MerkleType::Value, vec![Bytes32::default()]); + merkle.set(1, Bytes32::default()); +} From 2ecc4f54a047407b400f5f60404efa941a7cd164 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 19 Apr 2024 16:06:13 +0200 Subject: [PATCH 005/140] Allow callers to extend the Merkle Tree by adding leaves. At this point, the new root hash is eagerly calculated after each call to `extend`. --- arbitrator/prover/src/merkle.rs | 67 ++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index bc05d5abe4..6570c0e7c3 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -5,7 +5,7 @@ use arbutil::Bytes32; use digest::Digest; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::convert::TryFrom; +use std::convert::{TryFrom, TryInto}; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -48,8 +48,14 @@ impl MerkleType { /// https://en.wikipedia.org/wiki/Merkle_tree /// /// Each instance's leaves contain the hashes of a specific [MerkleType]. -/// The tree does not grow. It can be over-provisioned using the -/// [Merkle::new_advanced] method and passing a minimum depth. +/// The tree does not grow in height, but it can be initialized with fewer +/// leaves than the number that could be contained in its layers. +/// +/// When initialized with [Merkle::new], the tree has the minimum depth +/// necessary to hold all the leaves. (e.g. 5 leaves -> 4 layers.) +/// +/// It can be over-provisioned using the [Merkle::new_advanced] method +/// and passing a minimum depth. /// /// This structure does not contain the data itself, only the hashes. #[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] @@ -69,12 +75,15 @@ fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { } impl Merkle { - // Creates a new Merkle tree with the given type and leaf hashes. - // The tree is built up to the minimum depth necessary to hold all the leaves. + /// Creates a new Merkle tree with the given type and leaf hashes. + /// The tree is built up to the minimum depth necessary to hold all the + /// leaves. pub fn new(ty: MerkleType, hashes: Vec) -> Merkle { Self::new_advanced(ty, hashes, Bytes32::default(), 0) } + /// Creates a new Merkle tree with the given type, leaf hashes, a hash to + /// use for representing empty leaves, and a minimum depth. pub fn new_advanced( ty: MerkleType, hashes: Vec, @@ -126,6 +135,13 @@ impl Merkle { } } + // Returns the total number of leaves the tree can hold. + #[inline] + fn capacity(&self) -> usize { + let base: usize = 2; + base.pow((self.layers.len() -1).try_into().unwrap()) + } + #[must_use] pub fn prove(&self, idx: usize) -> Option> { if idx >= self.leaves().len() { @@ -199,11 +215,28 @@ impl Merkle { idx >>= 1; } } + + /// Extends the leaves of the tree with the given hashes. + /// + /// Returns the new number of leaves in the tree. + /// Erorrs if the number of hashes plus the current leaves is greater than + /// the capacity of the tree. + pub fn extend(&mut self, hashes: Vec) -> Result { + if hashes.len() > self.capacity() - self.layers[0].len() { + return Err("Cannot extend with more leaves than the capicity of the tree.".to_owned()); + } + let mut idx = self.layers[0].len(); + self.layers[0].resize(idx + hashes.len(), self.empty_layers[0]); + for hash in hashes { + self.set(idx, hash); + idx += 1; + } + return Ok(self.layers[0].len()); + } } #[test] -#[ignore] -fn simple_merkle() { +fn extend_works() { let hashes = vec![ Bytes32::from([1; 32]), Bytes32::from([2; 32]), @@ -221,9 +254,14 @@ fn simple_merkle() { hash_node(MerkleType::Value, Bytes32::from([5; 32]), Bytes32::from([0; 32])), hash_node(MerkleType::Value, Bytes32::from([0; 32]), Bytes32::from([0; 32])))); let mut merkle = Merkle::new(MerkleType::Value, hashes.clone()); + assert_eq!(merkle.capacity(), 8); assert_eq!(merkle.root(), expected); - merkle.set(5, Bytes32::from([6; 32])); + let new_size = match merkle.extend(vec![Bytes32::from([6; 32])]) { + Ok(size) => size, + Err(e) => panic!("{}", e) + }; + assert_eq!(new_size, 6); expected = hash_node(MerkleType::Value, hash_node( MerkleType::Value, @@ -236,9 +274,18 @@ fn simple_merkle() { assert_eq!(merkle.root(), expected); } +#[test] +fn correct_capacity() { + let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::from([1; 32])]); + assert_eq!(merkle.capacity(), 1); + let merkle = Merkle::new_advanced(MerkleType::Memory, vec![Bytes32::from([1; 32])], Bytes32::default(), 11); + assert_eq!(merkle.capacity(), 1024); +} + #[test] #[should_panic] fn set_with_bad_index_panics() { - let mut merkle = Merkle::new(MerkleType::Value, vec![Bytes32::default()]); - merkle.set(1, Bytes32::default()); + let mut merkle = Merkle::new(MerkleType::Value, vec![Bytes32::default(), Bytes32::default()]); + assert_eq!(merkle.capacity(), 2); + merkle.set(2, Bytes32::default()); } From 05b157f5d932a21c2d4c8be7360f5c4edab77b14 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 19 Apr 2024 16:49:08 +0200 Subject: [PATCH 006/140] Extend the memory merkle instead of clearing it. If this happened frequently, it should really improve the perfomance of the machine. However, it looks like it doesn't happen at all with the benchmark inputs. --- arbitrator/prover/src/memory.rs | 11 ++++++----- arbitrator/prover/src/merkle.rs | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index bd96221091..ceae141360 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -288,7 +288,7 @@ impl Memory { } pub fn get_range(&self, offset: usize, len: usize) -> Option<&[u8]> { - let end = offset.checked_add(len)?; + let end: usize = offset.checked_add(len)?; if end > self.buffer.len() { return None; } @@ -309,11 +309,12 @@ impl Memory { } pub fn resize(&mut self, new_size: usize) { - let had_merkle_tree = self.merkle.is_some(); - self.merkle = None; + println!("Resizing memory."); self.buffer.resize(new_size, 0); - if had_merkle_tree { - self.cache_merkle_tree(); + if let Some(mut merkle) = self.merkle.take() { + let extra = new_size - merkle.len(); + merkle.extend(vec![hash_leaf([0u8; 32]); extra]) + .expect("Couldn't extend merkle tree"); } } } diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 6570c0e7c3..0a4fb42f08 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -142,6 +142,11 @@ impl Merkle { base.pow((self.layers.len() -1).try_into().unwrap()) } + // Returns the number of leaves in the tree. + pub fn len(&self) -> usize { + self.layers[0].len() + } + #[must_use] pub fn prove(&self, idx: usize) -> Option> { if idx >= self.leaves().len() { From 965a20249e4ca6555a331d6f0672bd755f426173 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Sun, 21 Apr 2024 04:42:09 +0200 Subject: [PATCH 007/140] Fix merge problems from nitro cherry-picks --- arbitrator/Cargo.lock | 121 ++++++++++++++++++++------- arbitrator/bench/src/prepare.rs | 4 +- arbitrator/prover/src/flat_merkle.rs | 2 +- 3 files changed, 95 insertions(+), 32 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index dfef9ace1e..44ed6f0c01 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -64,12 +64,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" - [[package]] name = "anstream" version = "0.6.13" @@ -118,6 +112,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + [[package]] name = "arbutil" version = "0.1.0" @@ -402,7 +402,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.52", ] [[package]] @@ -420,10 +420,6 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "convert_case" version = "0.4.0" - -[[package]] -name = "corosensei" -version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" @@ -437,7 +433,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "scopeguard", - "windows-sys", + "windows-sys 0.33.0", ] [[package]] @@ -904,12 +900,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1394,7 +1384,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -1938,7 +1928,7 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" dependencies = [ - "clap 2.33.3", + "clap 2.34.0", "lazy_static", "structopt-derive", ] @@ -1949,7 +1939,7 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro-error", "proc-macro2", "quote", @@ -2190,18 +2180,18 @@ dependencies = [ "ruint2", ] -[[package]] -name = "uuid" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" - [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" + [[package]] name = "vec_map" version = "0.8.2" @@ -2542,27 +2532,58 @@ dependencies = [ "windows_x86_64_msvc 0.33.0", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + [[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.48.5", "windows_aarch64_msvc 0.48.5", "windows_i686_gnu 0.48.5", "windows_i686_msvc 0.48.5", "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.48.5", "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + [[package]] name = "windows_aarch64_msvc" version = "0.33.0" @@ -2575,6 +2596,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + [[package]] name = "windows_i686_gnu" version = "0.33.0" @@ -2587,6 +2614,18 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + [[package]] name = "windows_i686_msvc" version = "0.33.0" @@ -2599,6 +2638,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + [[package]] name = "windows_x86_64_gnu" version = "0.33.0" @@ -2611,12 +2656,24 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + [[package]] name = "windows_x86_64_msvc" version = "0.33.0" @@ -2629,6 +2686,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + [[package]] name = "winnow" version = "0.5.40" diff --git a/arbitrator/bench/src/prepare.rs b/arbitrator/bench/src/prepare.rs index c6d45dae3b..4004e467a9 100644 --- a/arbitrator/bench/src/prepare.rs +++ b/arbitrator/bench/src/prepare.rs @@ -1,6 +1,6 @@ -use arbutil::PreimageType; +use arbutil::{Bytes32, PreimageType}; use prover::machine::{argument_data_to_inbox, GlobalState, Machine}; -use prover::utils::{Bytes32, CBytes}; +use prover::utils::CBytes; use std::collections::HashMap; use std::fs::File; use std::io::BufReader; diff --git a/arbitrator/prover/src/flat_merkle.rs b/arbitrator/prover/src/flat_merkle.rs index 022429696e..4c46c0b2b6 100644 --- a/arbitrator/prover/src/flat_merkle.rs +++ b/arbitrator/prover/src/flat_merkle.rs @@ -1,7 +1,7 @@ // Copyright 2021-2022, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE -use crate::utils::Bytes32; +use arbutil::Bytes32; use digest::Digest; // use rayon::prelude::*; use sha3::Keccak256; From 477e49cb6e71ed50201bff81ce5a8f86807a4a9a Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Sun, 21 Apr 2024 11:20:38 +0200 Subject: [PATCH 008/140] Remove log line about resizing memory. --- arbitrator/prover/src/memory.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index ceae141360..d8cb9cec15 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -309,7 +309,6 @@ impl Memory { } pub fn resize(&mut self, new_size: usize) { - println!("Resizing memory."); self.buffer.resize(new_size, 0); if let Some(mut merkle) = self.merkle.take() { let extra = new_size - merkle.len(); From 15ad8ba9e0496ba56e5bdff5638f3a4f65f8539e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Mon, 22 Apr 2024 23:50:08 +0200 Subject: [PATCH 009/140] Introduce mark-and-sweep dirty branch tracking. This change introduces internal mutability to the merkle tree implementation in the form of a dirty_indices HashSet which keeps track of the indices of the parent nodes for leaves which have changed since the last time the hashes for all of the non-leaf nodes in the tree were calculated. The `set` method was changed to only modify the leaf's value and add the parent node to the set of dirty indices. The hashes of all the non-leaf nodes which are dirty and all their ancestors up to the root node are recalcualted just before returning the value of the root. This should allow us to reuse previously allocated merkle trees rather than having to throw them out and recaculate the hashes of all the nodes every time a leaf's value is changed. --- arbitrator/prover/src/memory.rs | 6 +- arbitrator/prover/src/merkle.rs | 152 +++++++++++++++++++++----------- 2 files changed, 102 insertions(+), 56 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index d8cb9cec15..3b42804648 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -234,7 +234,7 @@ impl Memory { let buf = value.to_le_bytes(); self.buffer[idx..end_idx].copy_from_slice(&buf[..bytes.into()]); - if let Some(mut merkle) = self.merkle.take() { + if let Some(merkle) = self.merkle.take() { let start_leaf = idx / Self::LEAF_SIZE; merkle.set(start_leaf, hash_leaf(self.get_leaf_data(start_leaf))); let end_leaf = (end_idx - 1) / Self::LEAF_SIZE; @@ -262,7 +262,7 @@ impl Memory { let end_idx = end_idx as usize; self.buffer[idx..end_idx].copy_from_slice(value); - if let Some(mut merkle) = self.merkle.take() { + if let Some(merkle) = self.merkle.take() { let start_leaf = idx / Self::LEAF_SIZE; merkle.set(start_leaf, hash_leaf(self.get_leaf_data(start_leaf))); // No need for second merkle @@ -310,7 +310,7 @@ impl Memory { pub fn resize(&mut self, new_size: usize) { self.buffer.resize(new_size, 0); - if let Some(mut merkle) = self.merkle.take() { + if let Some(merkle) = self.merkle.take() { let extra = new_size - merkle.len(); merkle.extend(vec![hash_leaf([0u8; 32]); extra]) .expect("Couldn't extend merkle tree"); diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 0a4fb42f08..0c5ea6a956 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -5,7 +5,7 @@ use arbutil::Bytes32; use digest::Digest; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::convert::{TryFrom, TryInto}; +use std::{collections::HashSet, convert::{TryFrom, TryInto}, sync::{Arc, Mutex, MutexGuard}}; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -58,12 +58,15 @@ impl MerkleType { /// and passing a minimum depth. /// /// This structure does not contain the data itself, only the hashes. -#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct Merkle { ty: MerkleType, - layers: Vec>, + #[serde(with = "arc_mutex_sedre")] + layers: Arc>>>, empty_layers: Vec, min_depth: usize, + #[serde(skip)] + dirty_indices: Arc>>, } fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { @@ -74,6 +77,12 @@ fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { h.finalize().into() } +#[inline] +fn capacity(layers: &Vec>) -> usize { + let base: usize = 2; + base.pow((layers.len() - 1).try_into().unwrap()) +} + impl Merkle { /// Creates a new Merkle tree with the given type and leaf hashes. /// The tree is built up to the minimum depth necessary to hold all the @@ -112,14 +121,42 @@ impl Merkle { } Merkle { ty, - layers, + layers: Arc::new(Mutex::new(layers)), empty_layers, min_depth, + dirty_indices: Arc::new(Mutex::new(HashSet::new())), + } + } + + fn rehash(&self) { + if self.dirty_indices.lock().unwrap().is_empty() { + return; + } + let mut next_dirty: HashSet = HashSet::new(); + let mut dirty = self.dirty_indices.lock().unwrap(); + let layers = &mut self.layers.lock().unwrap(); + for layer_i in 1..layers.len() { + for idx in dirty.iter() { + let left_child_idx = idx << 1; + let right_child_idx = left_child_idx + 1; + let left = layers[layer_i -1][left_child_idx]; + let right = layers[layer_i-1] + .get(right_child_idx) + .cloned() + .unwrap_or_else(|| self.empty_layers[layer_i - 1]); + layers[layer_i][*idx] = hash_node(self.ty, left, right); + if layer_i < layers.len() - 1 { + next_dirty.insert(idx >> 1); + } + } + dirty.clone_from(&next_dirty); + next_dirty.clear(); } } pub fn root(&self) -> Bytes32 { - if let Some(layer) = self.layers.last() { + self.rehash(); + if let Some(layer) = self.layers.lock().unwrap().last() { assert_eq!(layer.len(), 1); layer[0] } else { @@ -127,29 +164,21 @@ impl Merkle { } } - pub fn leaves(&self) -> &[Bytes32] { - if self.layers.is_empty() { - &[] - } else { - &self.layers[0] - } - } - // Returns the total number of leaves the tree can hold. #[inline] + #[cfg(test)] fn capacity(&self) -> usize { - let base: usize = 2; - base.pow((self.layers.len() -1).try_into().unwrap()) + return capacity(self.layers.lock().unwrap().as_ref()); } // Returns the number of leaves in the tree. pub fn len(&self) -> usize { - self.layers[0].len() + self.layers.lock().unwrap()[0].len() } #[must_use] pub fn prove(&self, idx: usize) -> Option> { - if idx >= self.leaves().len() { + if self.layers.lock().unwrap().is_empty() || idx >= self.layers.lock().unwrap()[0].len() { return None; } Some(self.prove_any(idx)) @@ -158,9 +187,10 @@ impl Merkle { /// creates a merkle proof regardless of if the leaf has content #[must_use] pub fn prove_any(&self, mut idx: usize) -> Vec { - let mut proof = vec![u8::try_from(self.layers.len() - 1).unwrap()]; - for (layer_i, layer) in self.layers.iter().enumerate() { - if layer_i == self.layers.len() - 1 { + let layers = self.layers.lock().unwrap(); + let mut proof = vec![u8::try_from(layers.len() - 1).unwrap()]; + for (layer_i, layer) in layers.iter().enumerate() { + if layer_i == layers.len() - 1 { break; } let counterpart = idx ^ 1; @@ -178,7 +208,7 @@ impl Merkle { /// Adds a new leaf to the merkle /// Currently O(n) in the number of leaves (could be log(n)) pub fn push_leaf(&mut self, leaf: Bytes32) { - let mut leaves = self.layers.swap_remove(0); + let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.push(leaf); let empty = self.empty_layers[0]; *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); @@ -187,7 +217,7 @@ impl Merkle { /// Removes the rightmost leaf from the merkle /// Currently O(n) in the number of leaves (could be log(n)) pub fn pop_leaf(&mut self) { - let mut leaves = self.layers.swap_remove(0); + let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.pop(); let empty = self.empty_layers[0]; *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); @@ -195,30 +225,17 @@ impl Merkle { // Sets the leaf at the given index to the given hash. // Panics if the index is out of bounds (since the structure doesn't grow). - pub fn set(&mut self, mut idx: usize, hash: Bytes32) { - if self.layers[0][idx] == hash { + pub fn set(&self, idx: usize, hash: Bytes32) { + let mut layers = self.layers.lock().unwrap(); + self.locked_set(&mut layers, idx, hash); + } + + fn locked_set(&self, locked_layers: &mut MutexGuard>>, idx: usize, hash: Bytes32) { + if locked_layers[0][idx] == hash { return; } - let mut next_hash = hash; - let empty_layers = &self.empty_layers; - let layers_len = self.layers.len(); - for (layer_i, layer) in self.layers.iter_mut().enumerate() { - layer[idx] = next_hash; - if layer_i == layers_len - 1 { - // next_hash isn't needed - break; - } - let counterpart = layer - .get(idx ^ 1) - .cloned() - .unwrap_or_else(|| empty_layers[layer_i]); - if idx % 2 == 0 { - next_hash = hash_node(self.ty, next_hash, counterpart); - } else { - next_hash = hash_node(self.ty, counterpart, next_hash); - } - idx >>= 1; - } + locked_layers[0][idx] = hash; + self.dirty_indices.lock().unwrap().insert(idx >> 1); } /// Extends the leaves of the tree with the given hashes. @@ -226,17 +243,44 @@ impl Merkle { /// Returns the new number of leaves in the tree. /// Erorrs if the number of hashes plus the current leaves is greater than /// the capacity of the tree. - pub fn extend(&mut self, hashes: Vec) -> Result { - if hashes.len() > self.capacity() - self.layers[0].len() { + pub fn extend(&self, hashes: Vec) -> Result { + let mut layers = self.layers.lock().unwrap(); + if hashes.len() > capacity(layers.as_ref()) - layers[0].len() { return Err("Cannot extend with more leaves than the capicity of the tree.".to_owned()); } - let mut idx = self.layers[0].len(); - self.layers[0].resize(idx + hashes.len(), self.empty_layers[0]); + let mut idx = layers[0].len(); + layers[0].resize(idx + hashes.len(), self.empty_layers[0]); for hash in hashes { - self.set(idx, hash); + self.locked_set(&mut layers, idx, hash); idx += 1; } - return Ok(self.layers[0].len()); + return Ok(layers[0].len()); + } +} + +impl PartialEq for Merkle { + fn eq(&self, other: &Self) -> bool { + self.root() == other.root() + } +} + +impl Eq for Merkle {} + +pub mod arc_mutex_sedre { + pub fn serialize(data: &std::sync::Arc>, serializer: S) -> Result + where + S: serde::Serializer, + T: serde::Serialize, + { + data.lock().unwrap().serialize(serializer) + } + + pub fn deserialize<'de, D, T>(deserializer: D) -> Result>, D::Error> + where + D: serde::Deserializer<'de>, + T: serde::Deserialize<'de>, + { + Ok(std::sync::Arc::new(std::sync::Mutex::new(T::deserialize(deserializer)?))) } } @@ -258,7 +302,7 @@ fn extend_works() { MerkleType::Value, hash_node(MerkleType::Value, Bytes32::from([5; 32]), Bytes32::from([0; 32])), hash_node(MerkleType::Value, Bytes32::from([0; 32]), Bytes32::from([0; 32])))); - let mut merkle = Merkle::new(MerkleType::Value, hashes.clone()); + let merkle = Merkle::new(MerkleType::Value, hashes.clone()); assert_eq!(merkle.capacity(), 8); assert_eq!(merkle.root(), expected); @@ -276,7 +320,9 @@ fn extend_works() { MerkleType::Value, hash_node(MerkleType::Value, Bytes32::from([5; 32]), Bytes32::from([6; 32])), hash_node(MerkleType::Value, Bytes32::from([0; 32]), Bytes32::from([0; 32])))); + assert_eq!(merkle.capacity(), 8); assert_eq!(merkle.root(), expected); + merkle.prove(1).unwrap(); } #[test] @@ -288,9 +334,9 @@ fn correct_capacity() { } #[test] -#[should_panic] +#[should_panic(expected = "index out of bounds")] fn set_with_bad_index_panics() { - let mut merkle = Merkle::new(MerkleType::Value, vec![Bytes32::default(), Bytes32::default()]); + let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::default(), Bytes32::default()]); assert_eq!(merkle.capacity(), 2); merkle.set(2, Bytes32::default()); } From cb1d10cde24374adbe2ca291397158c7ed7dc3ed Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 01:31:28 +0200 Subject: [PATCH 010/140] Fix the implementation of extend. Previously, it could hit an index out of bounds if the new leafs caused any parent layer to grow beyond its current size. --- arbitrator/prover/src/merkle.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 0a4fb42f08..36121f49d2 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -5,6 +5,7 @@ use arbutil::Bytes32; use digest::Digest; use serde::{Deserialize, Serialize}; use sha3::Keccak256; +use core::panic; use std::convert::{TryFrom, TryInto}; #[cfg(feature = "rayon")] @@ -203,7 +204,13 @@ impl Merkle { let empty_layers = &self.empty_layers; let layers_len = self.layers.len(); for (layer_i, layer) in self.layers.iter_mut().enumerate() { - layer[idx] = next_hash; + if idx < layer.len() { + layer[idx] = next_hash; + } else if idx == layer.len() { + layer.push(next_hash); + } else { + panic!("Index {} out of bounds {}", idx, layer.len()); + } if layer_i == layers_len - 1 { // next_hash isn't needed break; From e644b891e8b8314345497ccfb58b30caa5d7c8d1 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 01:33:10 +0200 Subject: [PATCH 011/140] Add criterion benchmark for a big merkle tree. Hopefully, this will allow us to compare this branch's implementation of a merkle tree to the one on merkle-perf-a. --- arbitrator/Cargo.lock | 180 ++++++++++++++++++++++ arbitrator/prover/Cargo.toml | 8 + arbitrator/prover/benches/merkle_bench.rs | 47 ++++++ arbitrator/prover/src/lib.rs | 2 +- 4 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 arbitrator/prover/benches/merkle_bench.rs diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 44ed6f0c01..b852174501 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -55,6 +55,12 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "ansi_term" version = "0.12.1" @@ -334,6 +340,12 @@ dependencies = [ "wasmer", ] +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.90" @@ -356,6 +368,33 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "clap" version = "2.34.0" @@ -528,6 +567,42 @@ version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb" +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap 4.5.4", + "criterion-plot", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -872,6 +947,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if 1.0.0", + "crunchy", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -994,6 +1079,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "is-terminal" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -1358,6 +1454,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1399,6 +1501,34 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1455,6 +1585,7 @@ dependencies = [ "bincode", "brotli", "c-kzg", + "criterion", "derivative", "digest 0.9.0", "eyre", @@ -1470,6 +1601,7 @@ dependencies = [ "num-derive", "num-traits", "parking_lot", + "rand", "rayon", "rustc-demangle", "serde", @@ -1721,6 +1853,15 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -2056,6 +2197,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -2204,6 +2355,16 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2485,6 +2646,16 @@ dependencies = [ "wast", ] +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "wee_alloc" version = "0.4.5" @@ -2513,6 +2684,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/arbitrator/prover/Cargo.toml b/arbitrator/prover/Cargo.toml index 1fabc4d56c..f932d9459a 100644 --- a/arbitrator/prover/Cargo.toml +++ b/arbitrator/prover/Cargo.toml @@ -40,6 +40,14 @@ c-kzg = { version = "0.4.0", optional = true } # TODO: look into switching to ru sha2 = "0.9.9" lru = "0.12.3" +[dev-dependencies] +criterion = { version = "0.5.0", features = ["html_reports"] } +rand = "0.8.4" + +[[bench]] +name = "merkle_bench" +harness = false + [lib] name = "prover" crate-type = ["staticlib", "lib"] diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs new file mode 100644 index 0000000000..b0ced75826 --- /dev/null +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -0,0 +1,47 @@ +use criterion::{criterion_group, criterion_main, Criterion}; +use prover::merkle::{Merkle, MerkleType}; +use arbutil::Bytes32; +use rand::Rng; + +fn extend_and_set_leavees(mut merkle: Merkle, rng: &mut rand::rngs::ThreadRng) { + let new_leaves = vec![ + Bytes32::from([6; 32]), + Bytes32::from([7; 32]), + Bytes32::from([8; 32]), + Bytes32::from([9; 32]), + Bytes32::from([10; 32]), + ]; + + for _ in 0..100 { + merkle.extend(new_leaves.clone()).expect("extend failed"); + for _ in 0..(merkle.len()/10) { + let random_index = rng.gen_range(0..merkle.len()); + merkle.set(random_index, Bytes32::from([rng.gen_range(0u8..9); 32])); + } + } + merkle.root(); +} + +fn merkle_benchmark(c: &mut Criterion) { + let mut rng = rand::thread_rng(); + let leaves = vec![ + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + Bytes32::from([5; 32]), + ]; + + let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 20); + assert_eq!(merkle.len(), 5); + + // Perform many calls to set leaves to new values + c.bench_function("extend_set_leaves_and_root", |b| { + b.iter(|| { + extend_and_set_leavees(merkle.clone(), &mut rng); + }) + }); +} + +criterion_group!(benches, merkle_benchmark); +criterion_main!(benches); \ No newline at end of file diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index fccd28ff0f..85c0ca2aa8 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -11,7 +11,7 @@ mod kzg; pub mod machine; /// cbindgen:ignore mod memory; -mod merkle; +pub mod merkle; mod print; pub mod programs; mod reinterpret; From b60438f8076d59519f58d9072c6d70fd0cf77dcb Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 01:50:33 +0200 Subject: [PATCH 012/140] Switch to a binary tree set. This gives us ordered traversal of the dirty indices. The performance benchmarks show that this severely regresses over the implmenetation on merkle-perf. --- arbitrator/prover/src/merkle.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 7f5a82667a..577eeb30a9 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -5,7 +5,7 @@ use arbutil::Bytes32; use digest::Digest; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::{collections::HashSet, convert::{TryFrom, TryInto}, sync::{Arc, Mutex, MutexGuard}}; +use std::{collections::BTreeSet, convert::{TryFrom, TryInto}, sync::{Arc, Mutex, MutexGuard}}; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -66,7 +66,7 @@ pub struct Merkle { empty_layers: Vec, min_depth: usize, #[serde(skip)] - dirty_indices: Arc>>, + dirty_indices: Arc>>, } fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { @@ -124,7 +124,7 @@ impl Merkle { layers: Arc::new(Mutex::new(layers)), empty_layers, min_depth, - dirty_indices: Arc::new(Mutex::new(HashSet::new())), + dirty_indices: Arc::new(Mutex::new(BTreeSet::new())), } } @@ -132,7 +132,7 @@ impl Merkle { if self.dirty_indices.lock().unwrap().is_empty() { return; } - let mut next_dirty: HashSet = HashSet::new(); + let mut next_dirty: BTreeSet = BTreeSet::new(); let mut dirty = self.dirty_indices.lock().unwrap(); let layers = &mut self.layers.lock().unwrap(); for layer_i in 1..layers.len() { From 28c90aee66803e30f22fcdf50d3bf83113a2e423 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 11:50:35 +0200 Subject: [PATCH 013/140] Use memory more efficiently. --- arbitrator/prover/src/merkle.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 577eeb30a9..df41b6cdbc 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -3,9 +3,10 @@ use arbutil::Bytes32; use digest::Digest; +use itertools::sorted; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::{collections::BTreeSet, convert::{TryFrom, TryInto}, sync::{Arc, Mutex, MutexGuard}}; +use std::{collections::HashSet, convert::{TryFrom, TryInto}, sync::{Arc, Mutex, MutexGuard}}; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -66,7 +67,7 @@ pub struct Merkle { empty_layers: Vec, min_depth: usize, #[serde(skip)] - dirty_indices: Arc>>, + dirty_indices: Arc>>, } fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { @@ -119,12 +120,13 @@ impl Merkle { empty_layers.push(hash_node(ty, empty_layer, empty_layer)); layers.push(new_layer); } + let dirty_indices = Arc::new(Mutex::new(HashSet::with_capacity(layers[0].len()))); Merkle { ty, layers: Arc::new(Mutex::new(layers)), empty_layers, min_depth, - dirty_indices: Arc::new(Mutex::new(BTreeSet::new())), + dirty_indices, } } @@ -132,11 +134,12 @@ impl Merkle { if self.dirty_indices.lock().unwrap().is_empty() { return; } - let mut next_dirty: BTreeSet = BTreeSet::new(); - let mut dirty = self.dirty_indices.lock().unwrap(); + println!("Rehashing with dirty indices: {:?} of {:?}", self.dirty_indices.lock().unwrap().len(), self.len()); let layers = &mut self.layers.lock().unwrap(); + let mut next_dirty: HashSet = HashSet::with_capacity(layers[2].len()); + let mut dirty = self.dirty_indices.lock().unwrap(); for layer_i in 1..layers.len() { - for idx in dirty.iter() { + for idx in sorted(dirty.iter()) { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; let left = layers[layer_i -1][left_child_idx]; @@ -156,7 +159,9 @@ impl Merkle { } } dirty.clone_from(&next_dirty); - next_dirty.clear(); + if layer_i < layers.len() - 1 { + next_dirty = HashSet::with_capacity(layers[layer_i + 1].len()); + } } } From e8868a87ce9994e7c0e275426fd96f7a28087765 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 11:52:26 +0200 Subject: [PATCH 014/140] Include the creation of a fresh tree for each iteration. The previous implementation was growing the same layers and dirty_indices arrays because the clone isn't deep (I guess.) --- arbitrator/prover/benches/merkle_bench.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs index b0ced75826..922f6cb177 100644 --- a/arbitrator/prover/benches/merkle_bench.rs +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -32,12 +32,10 @@ fn merkle_benchmark(c: &mut Criterion) { Bytes32::from([5; 32]), ]; - let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 20); - assert_eq!(merkle.len(), 5); - // Perform many calls to set leaves to new values c.bench_function("extend_set_leaves_and_root", |b| { b.iter(|| { + let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 20); extend_and_set_leavees(merkle.clone(), &mut rng); }) }); From 03d242016a1df513735d28cfb8e3c324909c2c86 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 11:58:24 +0200 Subject: [PATCH 015/140] Remove println This was just for troubleshooting. --- arbitrator/prover/src/merkle.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index df41b6cdbc..d74e742915 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -134,7 +134,6 @@ impl Merkle { if self.dirty_indices.lock().unwrap().is_empty() { return; } - println!("Rehashing with dirty indices: {:?} of {:?}", self.dirty_indices.lock().unwrap().len(), self.len()); let layers = &mut self.layers.lock().unwrap(); let mut next_dirty: HashSet = HashSet::with_capacity(layers[2].len()); let mut dirty = self.dirty_indices.lock().unwrap(); From b7e7cd338427fcfa697ea53a1baa9f4f6248958a Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 13:12:07 +0200 Subject: [PATCH 016/140] Further optimization. Specifically, this pre-allocates the dirty HashSets for each layer instead of having to allocate new ones each time rehash is called. --- arbitrator/prover/src/merkle.rs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index d74e742915..ca26a21e28 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -67,7 +67,7 @@ pub struct Merkle { empty_layers: Vec, min_depth: usize, #[serde(skip)] - dirty_indices: Arc>>, + dirty_layers: Arc>>>, } fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { @@ -105,6 +105,7 @@ impl Merkle { } let mut layers = vec![hashes]; let mut empty_layers = vec![empty_hash]; + let mut dirty_indices: Vec> = Vec::new(); while layers.last().unwrap().len() > 1 || layers.len() < min_depth { let empty_layer = *empty_layers.last().unwrap(); @@ -114,31 +115,33 @@ impl Merkle { #[cfg(not(feature = "rayon"))] let new_layer = layers.last().unwrap().chunks(2); - let new_layer = new_layer + let new_layer: Vec = new_layer .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_layer))) .collect(); empty_layers.push(hash_node(ty, empty_layer, empty_layer)); + dirty_indices.push(HashSet::with_capacity(new_layer.len())); layers.push(new_layer); } - let dirty_indices = Arc::new(Mutex::new(HashSet::with_capacity(layers[0].len()))); + let dirty_layers = Arc::new(Mutex::new(dirty_indices)); Merkle { ty, layers: Arc::new(Mutex::new(layers)), empty_layers, min_depth, - dirty_indices, + dirty_layers, } } fn rehash(&self) { - if self.dirty_indices.lock().unwrap().is_empty() { + let dirty_layers = &mut self.dirty_layers.lock().unwrap(); + if dirty_layers[0].is_empty() { return; } let layers = &mut self.layers.lock().unwrap(); - let mut next_dirty: HashSet = HashSet::with_capacity(layers[2].len()); - let mut dirty = self.dirty_indices.lock().unwrap(); for layer_i in 1..layers.len() { - for idx in sorted(dirty.iter()) { + let dirty_i = layer_i - 1; + let dirt = dirty_layers[dirty_i].clone(); + for idx in sorted(dirt.iter()) { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; let left = layers[layer_i -1][left_child_idx]; @@ -152,15 +155,11 @@ impl Merkle { } else { layers[layer_i].push(new_hash); } - layers[layer_i][*idx] = hash_node(self.ty, left, right); if layer_i < layers.len() - 1 { - next_dirty.insert(idx >> 1); + dirty_layers[dirty_i + 1].insert(idx >> 1); } } - dirty.clone_from(&next_dirty); - if layer_i < layers.len() - 1 { - next_dirty = HashSet::with_capacity(layers[layer_i + 1].len()); - } + dirty_layers[dirty_i].clear(); } } @@ -245,7 +244,7 @@ impl Merkle { return; } locked_layers[0][idx] = hash; - self.dirty_indices.lock().unwrap().insert(idx >> 1); + self.dirty_layers.lock().unwrap()[0].insert(idx >> 1); } /// Extends the leaves of the tree with the given hashes. From b354b09fe3a8a0116412099f38c052b1bb3b9bb7 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Apr 2024 16:45:05 +0200 Subject: [PATCH 017/140] Fix the empty dirty indices bug. --- arbitrator/prover/src/merkle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index ca26a21e28..03ec6eb6ef 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -134,7 +134,7 @@ impl Merkle { fn rehash(&self) { let dirty_layers = &mut self.dirty_layers.lock().unwrap(); - if dirty_layers[0].is_empty() { + if dirty_layers.is_empty() || dirty_layers[0].is_empty() { return; } let layers = &mut self.layers.lock().unwrap(); From 1f528752e140a52e6ecaab7b2e51c17d93dc3e58 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 24 Apr 2024 16:44:56 +0200 Subject: [PATCH 018/140] Add some profiling and instrumentation code. There are a few different things going on in this commit. 1. I've added some counters for when methods get called on the Merkle tree. 2. I've added integration with gperftools for profiling specific areas of the code. --- arbitrator/Cargo.lock | 57 +++++++++++++++++-- arbitrator/bench/Cargo.toml | 3 +- arbitrator/bench/src/bin.rs | 15 ++++- arbitrator/prover/Cargo.toml | 3 +- arbitrator/prover/src/merkle.rs | 98 ++++++++++++++++++++++++++++++++- 5 files changed, 168 insertions(+), 8 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index b852174501..25dc258114 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -188,6 +188,7 @@ dependencies = [ "arbutil", "clap 4.5.4", "eyre", + "gperftools", "hex", "prover", ] @@ -816,7 +817,16 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" dependencies = [ - "enum-iterator-derive", + "enum-iterator-derive 0.7.0", +] + +[[package]] +name = "enum-iterator" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0b48d2b80ff6b002339547442496ea29d66a8c66ce8e1a6bd8c58b9cec7cf3" +dependencies = [ + "enum-iterator-derive 1.3.1", ] [[package]] @@ -830,6 +840,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum-iterator-derive" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19cbb53d33b57ac4df1f0af6b92c38c107cded663c4aea9fae1189dcfc17cf5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "enumset" version = "1.1.3" @@ -857,6 +878,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "backtrace", + "version_check", +] + [[package]] name = "eyre" version = "0.6.12" @@ -947,6 +978,17 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gperftools" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20a3fc5818b1223ec628fc6998c8900486208b577f78c07500d4b52f983ebc9d" +dependencies = [ + "error-chain", + "lazy_static", + "pkg-config", +] + [[package]] name = "half" version = "2.4.1" @@ -1501,6 +1543,12 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + [[package]] name = "plotters" version = "0.3.5" @@ -1588,6 +1636,7 @@ dependencies = [ "criterion", "derivative", "digest 0.9.0", + "enum-iterator 2.0.1", "eyre", "fnv", "hex", @@ -2491,7 +2540,7 @@ dependencies = [ "backtrace", "bytes", "cfg-if 1.0.0", - "enum-iterator", + "enum-iterator 0.7.0", "enumset", "lazy_static", "leb128", @@ -2580,7 +2629,7 @@ name = "wasmer-types" version = "4.2.3" dependencies = [ "bytecheck", - "enum-iterator", + "enum-iterator 0.7.0", "enumset", "indexmap 1.9.3", "more-asserts", @@ -2600,7 +2649,7 @@ dependencies = [ "crossbeam-queue", "dashmap", "derivative", - "enum-iterator", + "enum-iterator 0.7.0", "fnv", "indexmap 1.9.3", "lazy_static", diff --git a/arbitrator/bench/Cargo.toml b/arbitrator/bench/Cargo.toml index e0346d7fab..3a245f3d9c 100644 --- a/arbitrator/bench/Cargo.toml +++ b/arbitrator/bench/Cargo.toml @@ -17,6 +17,7 @@ eyre = "0.6.5" prover = { path = "../prover" } arbutil = { path = "../arbutil" } clap = { version = "4.4.8", features = ["derive"] } +gperftools = { version = "0.2.0", features = ["heap"] } [profile.release] -debug = true \ No newline at end of file +debug = true diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index b39e661925..d70b847196 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -3,8 +3,13 @@ use std::{path::PathBuf, time::Duration}; use bench::prepare::*; use clap::Parser; use eyre::bail; +use gperftools::profiler::PROFILER; +use gperftools::heap_profiler::HEAP_PROFILER; use prover::machine::MachineStatus; +#[cfg(feature = "counters")] +use prover::merkle; + #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] struct Args { @@ -30,7 +35,6 @@ fn main() -> eyre::Result<()> { println!("Running benchmark with always merkleize feature off"); } for step_size in step_sizes { - let total = std::time::Instant::now(); let mut machine = prepare_machine( args.preimages_path.clone(), args.machine_path.clone(), @@ -40,6 +44,11 @@ fn main() -> eyre::Result<()> { let mut hash_times = vec![]; let mut step_times = vec![]; let mut num_iters = 0; + PROFILER.lock().unwrap().start(format!("./target/bench-{}.prof", step_size)).unwrap(); + HEAP_PROFILER.lock().unwrap().start(format!("./target/bench-{}.hprof", step_size)).unwrap(); + #[cfg(feature = "counters")] + merkle::resetCounters(); + let total = std::time::Instant::now(); loop { let start = std::time::Instant::now(); machine.step_n(step_size)?; @@ -66,6 +75,8 @@ fn main() -> eyre::Result<()> { break; } } + PROFILER.lock().unwrap().stop().unwrap(); + HEAP_PROFILER.lock().unwrap().stop().unwrap(); let total_end_time = total.elapsed(); println!( "avg hash time {:?}, avg step time {:?}, step size {}, num_iters {}, total time {:?}", @@ -75,6 +86,8 @@ fn main() -> eyre::Result<()> { num_iters, total_end_time, ); + #[cfg(feature = "counters")] + merkle::printCounters(); } Ok(()) } diff --git a/arbitrator/prover/Cargo.toml b/arbitrator/prover/Cargo.toml index f932d9459a..63158c9728 100644 --- a/arbitrator/prover/Cargo.toml +++ b/arbitrator/prover/Cargo.toml @@ -23,7 +23,7 @@ static_assertions = "1.1.0" structopt = "0.3.23" serde_with = "1.12.1" parking_lot = "0.12.1" -lazy_static.workspace = true +lazy_static = "1.4.0" itertools = "0.10.5" wat = "1.0.56" smallvec = { version = "1.10.0", features = ["serde"] } @@ -39,6 +39,7 @@ num-traits = "0.2.17" c-kzg = { version = "0.4.0", optional = true } # TODO: look into switching to rust-kzg (no crates.io release or hosted rustdoc yet) sha2 = "0.9.9" lru = "0.12.3" +enum-iterator = "2.0.1" [dev-dependencies] criterion = { version = "0.5.0", features = ["html_reports"] } diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 36121f49d2..2aec28ce5f 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -3,6 +3,26 @@ use arbutil::Bytes32; use digest::Digest; + +use enum_iterator::Sequence; + +#[cfg(feature = "counters")] +use enum_iterator::all; + + +#[cfg(feature = "counters")] +use std::sync::atomic::AtomicUsize; + +#[cfg(feature = "counters")] +use std::sync::atomic::Ordering; + +#[cfg(feature = "counters")] +use lazy_static::lazy_static; + + +#[cfg(feature = "counters")] +use std::collections::HashMap; + use serde::{Deserialize, Serialize}; use sha3::Keccak256; use core::panic; @@ -11,7 +31,54 @@ use std::convert::{TryFrom, TryInto}; #[cfg(feature = "rayon")] use rayon::prelude::*; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[cfg(feature = "counters")] +lazy_static! { + static ref NEW_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { + let mut map = HashMap::new(); + map.insert(&MerkleType::Empty, AtomicUsize::new(0)); + map.insert(&MerkleType::Value, AtomicUsize::new(0)); + map.insert(&MerkleType::Function, AtomicUsize::new(0)); + map.insert(&MerkleType::Instruction, AtomicUsize::new(0)); + map.insert(&MerkleType::Memory, AtomicUsize::new(0)); + map.insert(&MerkleType::Table, AtomicUsize::new(0)); + map.insert(&MerkleType::TableElement, AtomicUsize::new(0)); + map.insert(&MerkleType::Module, AtomicUsize::new(0)); + map + }; +} +#[cfg(feature = "counters")] +lazy_static! { + static ref ROOT_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { + let mut map = HashMap::new(); + map.insert(&MerkleType::Empty, AtomicUsize::new(0)); + map.insert(&MerkleType::Value, AtomicUsize::new(0)); + map.insert(&MerkleType::Function, AtomicUsize::new(0)); + map.insert(&MerkleType::Instruction, AtomicUsize::new(0)); + map.insert(&MerkleType::Memory, AtomicUsize::new(0)); + map.insert(&MerkleType::Table, AtomicUsize::new(0)); + map.insert(&MerkleType::TableElement, AtomicUsize::new(0)); + map.insert(&MerkleType::Module, AtomicUsize::new(0)); + map + }; +} +#[cfg(feature = "counters")] +lazy_static! { + static ref SET_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { + let mut map = HashMap::new(); + map.insert(&MerkleType::Empty, AtomicUsize::new(0)); + map.insert(&MerkleType::Value, AtomicUsize::new(0)); + map.insert(&MerkleType::Function, AtomicUsize::new(0)); + map.insert(&MerkleType::Instruction, AtomicUsize::new(0)); + map.insert(&MerkleType::Memory, AtomicUsize::new(0)); + map.insert(&MerkleType::Table, AtomicUsize::new(0)); + map.insert(&MerkleType::TableElement, AtomicUsize::new(0)); + map.insert(&MerkleType::Module, AtomicUsize::new(0)); + map + }; +} + + +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Serialize, Deserialize, Sequence)] pub enum MerkleType { Empty, Value, @@ -29,6 +96,29 @@ impl Default for MerkleType { } } +#[cfg(feature = "counters")] +pub fn printCounters() { + for ty in all::() { + if ty == MerkleType::Empty { + continue; + } + println!("{} New: {}, Root: {}, Set: {}", + ty.get_prefix(), NEW_COUNTERS[&ty].load(Ordering::Relaxed), ROOT_COUNTERS[&ty].load(Ordering::Relaxed), SET_COUNTERS[&ty].load(Ordering::Relaxed)); + } +} + +#[cfg(feature = "counters")] +pub fn resetCounters() { + for ty in all::() { + if ty == MerkleType::Empty { + continue; + } + NEW_COUNTERS[&ty].store(0, Ordering::Relaxed); + ROOT_COUNTERS[&ty].store(0, Ordering::Relaxed); + SET_COUNTERS[&ty].store(0, Ordering::Relaxed); + } +} + impl MerkleType { pub fn get_prefix(self) -> &'static str { match self { @@ -91,6 +181,8 @@ impl Merkle { empty_hash: Bytes32, min_depth: usize, ) -> Merkle { + #[cfg(feature = "counters")] + NEW_COUNTERS[&ty].fetch_add(1, Ordering::Relaxed); if hashes.is_empty() { return Merkle::default(); } @@ -120,6 +212,8 @@ impl Merkle { } pub fn root(&self) -> Bytes32 { + #[cfg(feature = "counters")] + ROOT_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); if let Some(layer) = self.layers.last() { assert_eq!(layer.len(), 1); layer[0] @@ -197,6 +291,8 @@ impl Merkle { // Sets the leaf at the given index to the given hash. // Panics if the index is out of bounds (since the structure doesn't grow). pub fn set(&mut self, mut idx: usize, hash: Bytes32) { + #[cfg(feature = "counters")] + SET_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); if self.layers[0][idx] == hash { return; } From 976cb36b14d8adab314c7389092aa21a661ac01d Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 25 Apr 2024 12:12:42 +0200 Subject: [PATCH 019/140] Make features work This allows me to profile CPU and Heap independently, and to enable and disable the call counters independently. --- arbitrator/bench/Cargo.toml | 7 ++++++- arbitrator/bench/src/bin.rs | 19 +++++++++++++++++-- arbitrator/prover/Cargo.toml | 3 ++- arbitrator/prover/src/merkle.rs | 4 ++-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/arbitrator/bench/Cargo.toml b/arbitrator/bench/Cargo.toml index 3a245f3d9c..3441321877 100644 --- a/arbitrator/bench/Cargo.toml +++ b/arbitrator/bench/Cargo.toml @@ -17,7 +17,12 @@ eyre = "0.6.5" prover = { path = "../prover" } arbutil = { path = "../arbutil" } clap = { version = "4.4.8", features = ["derive"] } -gperftools = { version = "0.2.0", features = ["heap"] } +gperftools = { version = "0.2.0", optional = true } + +[features] +counters = [] +cpuprof = ["gperftools"] +heapprof = ["gperftools", "gperftools/heap"] [profile.release] debug = true diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index d70b847196..a2c94a6c7c 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -3,8 +3,13 @@ use std::{path::PathBuf, time::Duration}; use bench::prepare::*; use clap::Parser; use eyre::bail; + +#[cfg(feature = "cpuprof")] use gperftools::profiler::PROFILER; + +#[cfg(feature = "heapprof")] use gperftools::heap_profiler::HEAP_PROFILER; + use prover::machine::MachineStatus; #[cfg(feature = "counters")] @@ -44,10 +49,15 @@ fn main() -> eyre::Result<()> { let mut hash_times = vec![]; let mut step_times = vec![]; let mut num_iters = 0; + + #[cfg(feature = "cpuprof")] PROFILER.lock().unwrap().start(format!("./target/bench-{}.prof", step_size)).unwrap(); + + #[cfg(feature = "heapprof")] HEAP_PROFILER.lock().unwrap().start(format!("./target/bench-{}.hprof", step_size)).unwrap(); + #[cfg(feature = "counters")] - merkle::resetCounters(); + merkle::reset_counters(); let total = std::time::Instant::now(); loop { let start = std::time::Instant::now(); @@ -75,8 +85,13 @@ fn main() -> eyre::Result<()> { break; } } + + #[cfg(feature = "cpuprof")] PROFILER.lock().unwrap().stop().unwrap(); + + #[cfg(feature = "heapprof")] HEAP_PROFILER.lock().unwrap().stop().unwrap(); + let total_end_time = total.elapsed(); println!( "avg hash time {:?}, avg step time {:?}, step size {}, num_iters {}, total time {:?}", @@ -87,7 +102,7 @@ fn main() -> eyre::Result<()> { total_end_time, ); #[cfg(feature = "counters")] - merkle::printCounters(); + merkle::print_counters(); } Ok(()) } diff --git a/arbitrator/prover/Cargo.toml b/arbitrator/prover/Cargo.toml index 63158c9728..fe8b4b0f73 100644 --- a/arbitrator/prover/Cargo.toml +++ b/arbitrator/prover/Cargo.toml @@ -23,7 +23,7 @@ static_assertions = "1.1.0" structopt = "0.3.23" serde_with = "1.12.1" parking_lot = "0.12.1" -lazy_static = "1.4.0" +lazy_static.workspace = true itertools = "0.10.5" wat = "1.0.56" smallvec = { version = "1.10.0", features = ["serde"] } @@ -55,6 +55,7 @@ crate-type = ["staticlib", "lib"] [features] default = ["native", "rayon", "singlepass_rayon"] +counters = [] native = ["dep:wasmer", "dep:wasmer-compiler-singlepass", "brotli/wasmer_traits", "dep:c-kzg"] singlepass_rayon = ["wasmer-compiler-singlepass?/rayon"] rayon = ["dep:rayon"] diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 2aec28ce5f..3af5bd2ae8 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -97,7 +97,7 @@ impl Default for MerkleType { } #[cfg(feature = "counters")] -pub fn printCounters() { +pub fn print_counters() { for ty in all::() { if ty == MerkleType::Empty { continue; @@ -108,7 +108,7 @@ pub fn printCounters() { } #[cfg(feature = "counters")] -pub fn resetCounters() { +pub fn reset_counters() { for ty in all::() { if ty == MerkleType::Empty { continue; From d1a2f66ffe850b498948cac4e79e8d9c7dfa2861 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 26 Apr 2024 11:13:09 +0200 Subject: [PATCH 020/140] Add a benchmark for new_advanced. This part of the code is obviously slow. Let's see if we can improve it. --- arbitrator/prover/benches/merkle_bench.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs index 922f6cb177..b472db0dc9 100644 --- a/arbitrator/prover/benches/merkle_bench.rs +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -3,7 +3,7 @@ use prover::merkle::{Merkle, MerkleType}; use arbutil::Bytes32; use rand::Rng; -fn extend_and_set_leavees(mut merkle: Merkle, rng: &mut rand::rngs::ThreadRng) { +fn extend_and_set_leavees(merkle: Merkle, rng: &mut rand::rngs::ThreadRng) { let new_leaves = vec![ Bytes32::from([6; 32]), Bytes32::from([7; 32]), @@ -41,5 +41,20 @@ fn merkle_benchmark(c: &mut Criterion) { }); } -criterion_group!(benches, merkle_benchmark); +fn merkle_construction(c: &mut Criterion) { + let mut rng = rand::thread_rng(); + let mut leaves: Vec = Vec::with_capacity(1 >> 20); + for _ in 0..(1 >> 20) { + leaves.push(Bytes32::from([rng.gen_range(0u8..9); 32])); + } + + c.bench_function("merkle_construction", |b| { + b.iter(|| { + let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 21); + merkle.root(); + }) + }); +} + +criterion_group!(benches, merkle_benchmark, merkle_construction); criterion_main!(benches); \ No newline at end of file From b31a97b2859b035ee7cd4efc83c3899558ee37df Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 26 Apr 2024 16:38:42 +0200 Subject: [PATCH 021/140] Use capacity hints for all vector initialization. This nets a pretty variable 4%-7% savings in the micro bnechmark. --- arbitrator/prover/src/merkle.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 3d6e94fba9..48d9b65144 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -195,21 +195,27 @@ impl Merkle { if hashes.is_empty() { return Merkle::default(); } - let mut layers = vec![hashes]; - let mut empty_layers = vec![empty_hash]; - let mut dirty_indices: Vec> = Vec::new(); + let mut depth = (hashes.len() as f64).log2().ceil() as usize; + depth = depth.max(min_depth); + let mut layers: Vec> = Vec::with_capacity(depth); + layers.push(hashes); + let mut empty_layers: Vec = Vec::with_capacity(depth); + empty_layers.push(empty_hash); + let mut dirty_indices: Vec> = Vec::with_capacity(depth); while layers.last().unwrap().len() > 1 || layers.len() < min_depth { + let layer = layers.last().unwrap(); let empty_layer = *empty_layers.last().unwrap(); #[cfg(feature = "rayon")] - let new_layer = layers.last().unwrap().par_chunks(2); + let chunks = layer.par_chunks(2); #[cfg(not(feature = "rayon"))] - let new_layer = layers.last().unwrap().chunks(2); + let chunks = layer.chunks(2); - let new_layer: Vec = new_layer + let mut new_layer: Vec = Vec::with_capacity(layer.len() >> 1); + chunks .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_layer))) - .collect(); + .collect_into_vec(&mut new_layer); empty_layers.push(hash_node(ty, empty_layer, empty_layer)); dirty_indices.push(HashSet::with_capacity(new_layer.len())); layers.push(new_layer); From e5ec9c42ac71fc33f98249670462ca7a785ae941 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 26 Apr 2024 21:00:53 +0200 Subject: [PATCH 022/140] Add static vectors of empty hashes for 64 layers of each MerkleType. This saves every instance of a Merkle Tree from having to initialize its own vector of empty hashes. --- arbitrator/prover/src/merkle.rs | 27 +- arbitrator/prover/src/merkle/zerohashes.rs | 475 +++++++++++++++++++++ 2 files changed, 488 insertions(+), 14 deletions(-) create mode 100644 arbitrator/prover/src/merkle/zerohashes.rs diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 48d9b65144..95fa139186 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -10,7 +10,6 @@ use enum_iterator::Sequence; #[cfg(feature = "counters")] use enum_iterator::all; - #[cfg(feature = "counters")] use std::sync::atomic::AtomicUsize; @@ -20,7 +19,6 @@ use std::sync::atomic::Ordering; #[cfg(feature = "counters")] use lazy_static::lazy_static; - #[cfg(feature = "counters")] use std::collections::HashMap; @@ -31,6 +29,10 @@ use std::{collections::HashSet, convert::{TryFrom, TryInto}, sync::{Arc, Mutex, #[cfg(feature = "rayon")] use rayon::prelude::*; +mod zerohashes; + +use zerohashes::ZERO_HASHES; + #[cfg(feature = "counters")] lazy_static! { static ref NEW_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { @@ -154,7 +156,6 @@ pub struct Merkle { ty: MerkleType, #[serde(with = "arc_mutex_sedre")] layers: Arc>>>, - empty_layers: Vec, min_depth: usize, #[serde(skip)] dirty_layers: Arc>>>, @@ -199,12 +200,11 @@ impl Merkle { depth = depth.max(min_depth); let mut layers: Vec> = Vec::with_capacity(depth); layers.push(hashes); - let mut empty_layers: Vec = Vec::with_capacity(depth); - empty_layers.push(empty_hash); let mut dirty_indices: Vec> = Vec::with_capacity(depth); + let mut layer_i = 0usize; while layers.last().unwrap().len() > 1 || layers.len() < min_depth { let layer = layers.last().unwrap(); - let empty_layer = *empty_layers.last().unwrap(); + let empty_hash = ZERO_HASHES[&ty][layer_i]; #[cfg(feature = "rayon")] let chunks = layer.par_chunks(2); @@ -214,17 +214,16 @@ impl Merkle { let mut new_layer: Vec = Vec::with_capacity(layer.len() >> 1); chunks - .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_layer))) + .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_hash))) .collect_into_vec(&mut new_layer); - empty_layers.push(hash_node(ty, empty_layer, empty_layer)); dirty_indices.push(HashSet::with_capacity(new_layer.len())); layers.push(new_layer); + layer_i += 1; } let dirty_layers = Arc::new(Mutex::new(dirty_indices)); Merkle { ty, layers: Arc::new(Mutex::new(layers)), - empty_layers, min_depth, dirty_layers, } @@ -246,7 +245,7 @@ impl Merkle { let right = layers[layer_i-1] .get(right_child_idx) .cloned() - .unwrap_or_else(|| self.empty_layers[layer_i - 1]); + .unwrap_or_else(|| ZERO_HASHES[&self.ty][layer_i - 1]); let new_hash = hash_node(self.ty, left, right); if *idx < layers[layer_i].len() { layers[layer_i][*idx] = new_hash; @@ -307,7 +306,7 @@ impl Merkle { layer .get(counterpart) .cloned() - .unwrap_or_else(|| self.empty_layers[layer_i]), + .unwrap_or_else(|| ZERO_HASHES[&self.ty][layer_i]), ); idx >>= 1; } @@ -319,7 +318,7 @@ impl Merkle { pub fn push_leaf(&mut self, leaf: Bytes32) { let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.push(leaf); - let empty = self.empty_layers[0]; + let empty = ZERO_HASHES[&self.ty][0]; *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); } @@ -328,7 +327,7 @@ impl Merkle { pub fn pop_leaf(&mut self) { let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.pop(); - let empty = self.empty_layers[0]; + let empty = ZERO_HASHES[&self.ty][0]; *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); } @@ -360,7 +359,7 @@ impl Merkle { return Err("Cannot extend with more leaves than the capicity of the tree.".to_owned()); } let mut idx = layers[0].len(); - layers[0].resize(idx + hashes.len(), self.empty_layers[0]); + layers[0].resize(idx + hashes.len(), ZERO_HASHES[&self.ty][0]); for hash in hashes { self.locked_set(&mut layers, idx, hash); idx += 1; diff --git a/arbitrator/prover/src/merkle/zerohashes.rs b/arbitrator/prover/src/merkle/zerohashes.rs new file mode 100644 index 0000000000..97d5c59c10 --- /dev/null +++ b/arbitrator/prover/src/merkle/zerohashes.rs @@ -0,0 +1,475 @@ +use std::collections::HashMap; + +use arbutil::Bytes32; +use lazy_static::lazy_static; + +use crate::merkle::MerkleType; + +lazy_static! { + pub static ref ZERO_HASHES: HashMap> = { + let mut zero_hashes = HashMap::new(); + zero_hashes.insert(MerkleType::Value, vec![ + Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::from([119, 47, 167, 222, 218, 156, 26, 105, 57, 248, 170, 182, 183, 151, 18, 150, 142, 70, 138, 253, 54, 123, 132, 86, 170, 76, 157, 52, 113, 138, 253, 254]), + Bytes32::from([8, 117, 27, 211, 196, 42, 6, 98, 185, 88, 231, 145, 14, 3, 207, 145, 158, 255, 69, 52, 198, 196, 148, 154, 59, 94, 229, 157, 93, 51, 200, 69]), + Bytes32::from([247, 208, 196, 206, 204, 168, 129, 100, 238, 95, 52, 26, 132, 138, 233, 149, 196, 72, 179, 226, 60, 114, 27, 94, 173, 189, 197, 100, 163, 232, 180, 63]), + Bytes32::from([178, 100, 198, 112, 40, 33, 187, 175, 130, 245, 59, 210, 133, 234, 158, 158, 133, 64, 213, 72, 222, 157, 216, 42, 210, 134, 36, 13, 211, 156, 163, 211]), + Bytes32::from([203, 127, 32, 130, 225, 40, 219, 15, 35, 236, 47, 201, 161, 48, 53, 145, 134, 169, 109, 29, 26, 29, 178, 201, 118, 217, 57, 165, 116, 172, 232, 4]), + Bytes32::from([209, 109, 33, 102, 227, 251, 133, 224, 170, 130, 65, 90, 185, 209, 146, 77, 244, 145, 181, 206, 159, 70, 209, 64, 241, 19, 149, 223, 138, 31, 163, 61]), + Bytes32::from([145, 168, 124, 48, 254, 12, 34, 41, 4, 213, 245, 86, 61, 29, 177, 192, 67, 165, 237, 236, 87, 126, 193, 191, 15, 126, 104, 173, 165, 186, 1, 107]), + Bytes32::from([235, 161, 247, 143, 69, 95, 210, 40, 243, 76, 102, 29, 118, 86, 180, 54, 81, 144, 103, 54, 202, 164, 81, 83, 180, 90, 154, 184, 54, 28, 7, 220]), + Bytes32::from([203, 62, 12, 83, 35, 122, 214, 199, 125, 61, 236, 8, 253, 64, 145, 34, 127, 116, 217, 118, 245, 107, 15, 81, 9, 7, 31, 154, 89, 28, 123, 132]), + Bytes32::from([222, 94, 234, 109, 142, 74, 142, 176, 248, 3, 172, 30, 204, 138, 241, 195, 121, 232, 104, 219, 32, 54, 240, 77, 125, 247, 70, 137, 80, 46, 221, 247]), + Bytes32::from([162, 122, 237, 101, 178, 31, 12, 62, 50, 133, 242, 82, 111, 215, 166, 136, 138, 185, 72, 220, 163, 58, 58, 97, 6, 97, 167, 114, 179, 227, 19, 170]), + Bytes32::from([67, 251, 144, 11, 175, 194, 149, 65, 173, 179, 69, 140, 213, 191, 133, 59, 81, 175, 161, 115, 252, 125, 232, 150, 52, 241, 102, 164, 122, 32, 70, 229]), + Bytes32::from([249, 161, 115, 93, 215, 247, 145, 182, 75, 191, 48, 38, 123, 220, 232, 47, 246, 46, 81, 164, 98, 41, 141, 249, 137, 173, 93, 213, 96, 15, 151, 245]), + Bytes32::from([222, 93, 144, 194, 107, 42, 144, 4, 242, 153, 203, 176, 146, 242, 94, 72, 9, 222, 194, 2, 73, 200, 167, 147, 106, 9, 67, 73, 59, 127, 174, 178]), + Bytes32::from([56, 228, 248, 59, 153, 215, 120, 224, 111, 48, 159, 82, 171, 227, 93, 214, 208, 151, 78, 67, 112, 31, 218, 94, 219, 3, 79, 250, 227, 24, 222, 207]), + Bytes32::from([26, 171, 68, 22, 162, 195, 65, 97, 219, 55, 51, 46, 178, 6, 247, 65, 123, 219, 128, 86, 193, 3, 253, 0, 239, 228, 187, 94, 184, 240, 67, 11]), + Bytes32::from([250, 36, 5, 131, 94, 0, 99, 187, 112, 155, 252, 52, 68, 236, 185, 152, 93, 239, 0, 185, 101, 101, 182, 92, 112, 5, 67, 55, 121, 203, 100, 245]), + Bytes32::from([208, 57, 149, 71, 227, 213, 246, 213, 175, 88, 95, 238, 93, 122, 168, 223, 149, 84, 30, 89, 98, 228, 113, 72, 90, 48, 112, 171, 231, 67, 113, 216]), + Bytes32::from([125, 48, 157, 119, 154, 38, 14, 211, 223, 68, 87, 187, 159, 126, 234, 72, 84, 60, 236, 237, 227, 130, 87, 43, 217, 105, 81, 196, 159, 238, 240, 10]), + Bytes32::from([141, 217, 59, 213, 245, 231, 7, 85, 178, 197, 115, 188, 31, 49, 126, 237, 83, 199, 56, 196, 133, 169, 239, 218, 90, 131, 178, 70, 126, 132, 114, 186]), + Bytes32::from([18, 2, 140, 12, 121, 238, 8, 160, 7, 208, 89, 194, 105, 136, 211, 58, 179, 200, 226, 138, 186, 242, 4, 237, 18, 113, 131, 135, 31, 222, 28, 195]), + Bytes32::from([156, 222, 183, 39, 119, 110, 130, 60, 33, 221, 36, 39, 223, 155, 33, 2, 71, 32, 209, 25, 194, 172, 209, 1, 40, 105, 235, 140, 160, 18, 63, 168]), + Bytes32::from([211, 210, 123, 27, 217, 111, 97, 42, 167, 191, 112, 239, 66, 42, 199, 131, 124, 213, 89, 56, 92, 245, 166, 238, 185, 42, 48, 2, 113, 255, 156, 7]), + Bytes32::from([66, 255, 87, 69, 86, 6, 54, 162, 162, 5, 93, 138, 194, 194, 151, 195, 57, 155, 58, 17, 21, 149, 77, 2, 134, 107, 125, 54, 220, 247, 160, 209]), + Bytes32::from([169, 216, 13, 41, 251, 216, 191, 87, 91, 55, 236, 6, 242, 103, 98, 209, 46, 202, 29, 55, 2, 50, 233, 76, 107, 92, 82, 156, 113, 226, 78, 211]), + Bytes32::from([88, 189, 113, 129, 119, 11, 141, 60, 128, 134, 113, 107, 7, 186, 81, 200, 14, 76, 197, 14, 96, 19, 247, 220, 95, 62, 81, 153, 61, 231, 26, 86]), + Bytes32::from([41, 214, 41, 96, 151, 11, 231, 7, 203, 70, 242, 156, 247, 133, 49, 223, 254, 164, 202, 154, 188, 104, 124, 120, 225, 229, 148, 203, 141, 218, 228, 56]), + Bytes32::from([181, 157, 136, 110, 158, 152, 105, 61, 125, 220, 32, 180, 53, 115, 155, 189, 91, 152, 96, 172, 7, 121, 65, 143, 82, 180, 3, 69, 118, 219, 31, 244]), + Bytes32::from([29, 12, 159, 30, 12, 37, 126, 102, 218, 149, 67, 116, 182, 125, 134, 208, 184, 199, 181, 191, 87, 144, 48, 150, 87, 67, 222, 218, 254, 118, 12, 160]), + Bytes32::from([193, 249, 209, 245, 102, 95, 15, 55, 160, 156, 203, 160, 49, 198, 203, 30, 99, 172, 89, 92, 235, 89, 131, 205, 53, 254, 219, 168, 202, 195, 10, 242]), + Bytes32::from([131, 64, 102, 7, 226, 96, 60, 111, 221, 120, 41, 86, 239, 157, 121, 38, 57, 244, 221, 55, 32, 237, 13, 20, 244, 238, 133, 189, 89, 118, 204, 247]), + Bytes32::from([239, 211, 89, 185, 191, 211, 243, 207, 134, 159, 59, 19, 87, 254, 115, 27, 152, 156, 120, 226, 39, 63, 155, 51, 77, 130, 162, 63, 16, 43, 112, 121]), + Bytes32::from([10, 146, 190, 23, 235, 67, 23, 169, 33, 140, 54, 209, 129, 176, 29, 218, 40, 55, 13, 80, 57, 68, 92, 97, 44, 82, 209, 240, 207, 214, 22, 119]), + Bytes32::from([59, 161, 125, 95, 7, 155, 141, 55, 253, 106, 238, 72, 109, 158, 201, 200, 236, 157, 227, 178, 176, 47, 166, 84, 87, 111, 25, 133, 194, 55, 244, 254]), + Bytes32::from([8, 134, 213, 182, 108, 15, 225, 138, 152, 138, 132, 240, 27, 80, 231, 117, 194, 157, 205, 20, 110, 239, 166, 37, 50, 46, 213, 165, 216, 101, 245, 98]), + Bytes32::from([137, 57, 186, 173, 198, 113, 221, 42, 0, 211, 127, 200, 128, 7, 112, 97, 75, 155, 152, 224, 71, 220, 16, 124, 32, 50, 30, 48, 251, 132, 120, 147]), + Bytes32::from([201, 8, 226, 108, 147, 192, 3, 240, 168, 237, 131, 47, 150, 51, 251, 126, 23, 182, 223, 99, 162, 167, 248, 248, 233, 8, 121, 99, 71, 212, 120, 251]), + Bytes32::from([140, 30, 196, 244, 166, 80, 95, 116, 140, 218, 94, 20, 236, 233, 241, 129, 175, 187, 110, 88, 174, 173, 152, 203, 67, 75, 51, 232, 225, 6, 17, 134]), + Bytes32::from([92, 132, 115, 164, 66, 159, 201, 147, 233, 228, 16, 95, 81, 233, 129, 254, 155, 148, 38, 239, 186, 40, 118, 104, 144, 134, 17, 46, 99, 150, 211, 9]), + Bytes32::from([81, 73, 72, 117, 215, 159, 240, 86, 136, 196, 69, 201, 149, 208, 48, 245, 105, 153, 97, 107, 221, 85, 49, 121, 197, 129, 32, 140, 206, 231, 120, 123]), + Bytes32::from([0, 203, 34, 135, 242, 129, 113, 204, 198, 134, 219, 134, 187, 240, 235, 59, 44, 163, 180, 83, 174, 40, 66, 141, 95, 99, 71, 221, 186, 216, 37, 250]), + Bytes32::from([225, 181, 151, 12, 26, 209, 127, 99, 248, 177, 126, 113, 215, 220, 252, 89, 149, 123, 19, 65, 89, 122, 180, 169, 195, 87, 147, 9, 196, 31, 203, 178]), + Bytes32::from([125, 81, 154, 100, 204, 138, 194, 248, 156, 95, 119, 58, 60, 221, 150, 248, 216, 19, 123, 15, 198, 108, 228, 228, 224, 122, 16, 249, 223, 84, 117, 89]), + Bytes32::from([99, 153, 60, 217, 168, 254, 244, 149, 214, 115, 250, 90, 117, 112, 66, 163, 143, 207, 121, 70, 108, 92, 2, 47, 56, 109, 56, 207, 152, 27, 196, 141]), + Bytes32::from([99, 251, 124, 97, 158, 155, 101, 251, 98, 124, 239, 73, 50, 50, 173, 142, 39, 208, 167, 53, 5, 151, 85, 239, 25, 77, 36, 52, 141, 225, 66, 186]), + Bytes32::from([235, 44, 31, 180, 197, 243, 114, 60, 199, 242, 167, 21, 206, 27, 116, 165, 18, 76, 162, 163, 14, 91, 109, 104, 118, 51, 33, 172, 9, 165, 214, 38]), + Bytes32::from([188, 4, 5, 50, 169, 70, 231, 90, 220, 90, 226, 214, 89, 19, 159, 207, 201, 80, 241, 214, 32, 240, 63, 74, 6, 251, 177, 182, 236, 19, 156, 92]), + Bytes32::from([128, 150, 66, 27, 197, 229, 103, 137, 175, 252, 19, 131, 213, 63, 112, 172, 182, 255, 235, 246, 226, 37, 25, 180, 24, 38, 35, 138, 207, 149, 186, 175]), + Bytes32::from([5, 123, 231, 106, 12, 171, 157, 189, 58, 109, 144, 7, 38, 97, 4, 148, 1, 138, 124, 123, 2, 202, 108, 221, 194, 160, 53, 73, 115, 36, 231, 142]), + Bytes32::from([160, 157, 243, 224, 214, 120, 59, 206, 24, 30, 231, 209, 123, 227, 15, 221, 86, 30, 128, 117, 210, 109, 132, 117, 204, 87, 243, 213, 231, 224, 91, 75]), + Bytes32::from([74, 238, 110, 147, 63, 110, 246, 102, 252, 212, 120, 225, 124, 218, 145, 204, 129, 63, 13, 34, 1, 0, 15, 9, 27, 221, 39, 199, 24, 231, 9, 38]), + Bytes32::from([194, 20, 160, 161, 90, 2, 118, 75, 103, 228, 51, 42, 191, 220, 63, 150, 140, 32, 85, 172, 218, 29, 251, 31, 99, 96, 98, 46, 130, 157, 201, 61]), + Bytes32::from([88, 123, 95, 139, 94, 66, 69, 27, 223, 223, 216, 130, 99, 210, 130, 54, 248, 35, 226, 252, 151, 238, 7, 175, 12, 97, 188, 43, 233, 129, 82, 222]), + Bytes32::from([179, 248, 157, 243, 50, 157, 172, 17, 139, 10, 245, 208, 241, 210, 67, 199, 135, 233, 234, 39, 127, 38, 54, 39, 40, 159, 94, 122, 36, 221, 180, 195]), + Bytes32::from([190, 185, 147, 237, 82, 32, 165, 236, 252, 183, 173, 181, 68, 44, 216, 20, 110, 243, 158, 213, 88, 209, 218, 207, 244, 241, 121, 239, 136, 167, 245, 155]), + Bytes32::from([114, 131, 254, 248, 183, 0, 175, 217, 194, 58, 178, 238, 250, 119, 158, 205, 19, 74, 94, 35, 100, 175, 114, 55, 186, 192, 239, 126, 42, 86, 60, 119]), + Bytes32::from([1, 253, 107, 150, 25, 240, 27, 172, 252, 185, 151, 152, 107, 105, 164, 230, 221, 242, 7, 166, 142, 53, 237, 83, 19, 30, 81, 149, 150, 39, 123, 220]), + Bytes32::from([57, 240, 92, 232, 26, 238, 69, 252, 110, 171, 164, 109, 199, 73, 110, 49, 11, 253, 109, 69, 155, 26, 84, 52, 155, 204, 115, 99, 90, 38, 247, 167]), + Bytes32::from([46, 87, 146, 25, 215, 40, 208, 78, 73, 60, 35, 19, 194, 41, 34, 186, 215, 131, 205, 29, 107, 100, 95, 169, 45, 1, 242, 115, 30, 226, 93, 48]), + Bytes32::from([95, 183, 66, 0, 196, 173, 44, 27, 175, 151, 17, 0, 159, 168, 123, 236, 124, 198, 85, 181, 118, 89, 21, 52, 169, 104, 178, 111, 120, 173, 94, 109]), + Bytes32::from([13, 111, 162, 25, 133, 108, 250, 75, 197, 221, 19, 160, 147, 36, 130, 70, 224, 39, 134, 144, 149, 166, 187, 96, 155, 154, 123, 90, 241, 154, 44, 102]), + Bytes32::from([95, 171, 183, 135, 121, 205, 161, 160, 212, 226, 64, 232, 180, 166, 176, 95, 51, 96, 110, 20, 76, 143, 47, 96, 197, 132, 210, 109, 174, 132, 13, 95]), + Bytes32::from([66, 51, 176, 1, 106, 199, 192, 16, 106, 180, 212, 53, 72, 121, 218, 148, 77, 26, 15, 244, 124, 131, 88, 84, 147, 211, 254, 156, 187, 91, 193, 120]) + ]); + zero_hashes.insert(MerkleType::Function, vec![ + Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::from([239, 247, 49, 255, 201, 159, 228, 149, 22, 115, 41, 139, 56, 117, 149, 46, 67, 155, 98, 70, 216, 225, 85, 100, 113, 242, 144, 167, 97, 238, 117, 207]), + Bytes32::from([46, 87, 136, 101, 122, 12, 6, 120, 39, 121, 167, 193, 66, 146, 150, 1, 90, 240, 97, 225, 179, 150, 197, 127, 56, 214, 116, 24, 180, 109, 96, 51]), + Bytes32::from([54, 125, 90, 195, 243, 1, 115, 18, 251, 68, 203, 216, 48, 156, 216, 200, 215, 250, 80, 152, 203, 58, 245, 128, 70, 112, 221, 104, 34, 125, 234, 138]), + Bytes32::from([103, 99, 44, 86, 57, 0, 102, 201, 99, 214, 249, 24, 45, 112, 234, 183, 225, 196, 9, 162, 168, 33, 121, 118, 93, 184, 14, 70, 148, 135, 211, 214]), + Bytes32::from([69, 7, 89, 47, 41, 94, 148, 139, 67, 197, 99, 98, 100, 63, 25, 230, 100, 118, 213, 25, 28, 129, 5, 39, 69, 89, 71, 21, 102, 84, 101, 175]), + Bytes32::from([232, 195, 82, 123, 189, 200, 139, 61, 179, 141, 208, 69, 102, 58, 127, 66, 69, 127, 7, 179, 108, 128, 253, 154, 207, 254, 201, 18, 192, 241, 99, 208]), + Bytes32::from([138, 25, 185, 215, 159, 159, 214, 251, 161, 103, 180, 78, 209, 215, 131, 132, 134, 180, 177, 37, 79, 219, 19, 93, 45, 30, 53, 125, 142, 194, 114, 34]), + Bytes32::from([185, 24, 200, 28, 68, 7, 118, 226, 65, 240, 85, 120, 123, 174, 239, 85, 247, 210, 104, 247, 20, 229, 41, 91, 242, 5, 2, 121, 132, 69, 43, 33]), + Bytes32::from([78, 191, 92, 97, 205, 120, 114, 216, 112, 101, 44, 98, 148, 2, 112, 221, 168, 199, 254, 55, 160, 116, 116, 105, 109, 227, 130, 219, 194, 32, 209, 196]), + Bytes32::from([177, 203, 26, 1, 216, 115, 242, 158, 202, 107, 60, 221, 81, 167, 8, 233, 247, 235, 49, 54, 45, 133, 202, 193, 34, 158, 205, 29, 232, 245, 195, 194]), + Bytes32::from([193, 118, 182, 153, 10, 237, 67, 229, 136, 193, 253, 250, 46, 125, 141, 22, 107, 168, 74, 130, 60, 193, 194, 196, 249, 129, 153, 82, 162, 143, 188, 42]), + Bytes32::from([239, 57, 105, 90, 116, 61, 160, 214, 55, 191, 17, 228, 44, 149, 103, 180, 229, 4, 175, 240, 209, 231, 141, 95, 109, 195, 78, 142, 122, 177, 227, 20]), + Bytes32::from([153, 247, 105, 126, 178, 44, 190, 57, 12, 63, 169, 27, 206, 19, 151, 38, 33, 83, 35, 3, 177, 97, 36, 182, 37, 78, 150, 243, 222, 32, 180, 148]), + Bytes32::from([29, 109, 110, 167, 27, 136, 235, 226, 147, 175, 241, 236, 138, 135, 163, 200, 21, 94, 220, 238, 23, 84, 46, 14, 44, 100, 47, 131, 134, 43, 98, 173]), + Bytes32::from([73, 241, 108, 102, 184, 200, 64, 80, 58, 162, 29, 211, 173, 150, 6, 195, 2, 137, 246, 51, 155, 132, 41, 255, 21, 71, 74, 143, 197, 180, 217, 159]), + Bytes32::from([109, 189, 226, 33, 70, 157, 161, 166, 223, 31, 224, 221, 37, 112, 27, 215, 163, 250, 217, 155, 168, 121, 119, 232, 100, 177, 104, 210, 10, 118, 215, 0]), + Bytes32::from([175, 156, 32, 156, 238, 82, 62, 25, 96, 251, 146, 24, 13, 2, 115, 174, 163, 50, 14, 251, 196, 173, 5, 87, 171, 228, 191, 9, 90, 84, 156, 63]), + Bytes32::from([244, 161, 238, 217, 14, 60, 162, 139, 34, 84, 68, 121, 213, 11, 230, 95, 57, 221, 174, 107, 103, 105, 76, 137, 58, 247, 65, 209, 167, 63, 96, 212]), + Bytes32::from([31, 177, 221, 130, 152, 92, 190, 4, 59, 90, 122, 63, 128, 180, 140, 201, 75, 239, 200, 151, 94, 65, 36, 227, 21, 250, 10, 253, 26, 114, 238, 188]), + Bytes32::from([48, 216, 87, 30, 113, 214, 69, 1, 9, 112, 244, 232, 127, 55, 43, 162, 156, 83, 235, 199, 126, 132, 241, 106, 65, 209, 240, 32, 11, 179, 219, 135]), + Bytes32::from([20, 55, 225, 132, 0, 219, 175, 17, 235, 73, 236, 16, 24, 227, 250, 155, 32, 83, 234, 123, 191, 209, 157, 133, 215, 202, 3, 221, 135, 223, 221, 90]), + Bytes32::from([113, 185, 118, 164, 139, 219, 203, 140, 245, 123, 21, 186, 102, 22, 54, 14, 19, 230, 223, 120, 211, 114, 203, 77, 173, 214, 61, 80, 151, 10, 2, 205]), + Bytes32::from([50, 20, 214, 105, 232, 5, 9, 101, 16, 72, 46, 139, 177, 188, 25, 93, 14, 57, 60, 168, 49, 147, 134, 5, 62, 181, 120, 75, 193, 229, 107, 67]), + Bytes32::from([92, 167, 117, 18, 186, 193, 28, 56, 86, 25, 75, 64, 1, 8, 126, 212, 56, 163, 157, 242, 34, 73, 65, 58, 187, 2, 112, 58, 225, 229, 113, 58]), + Bytes32::from([173, 139, 156, 215, 250, 231, 15, 123, 8, 5, 98, 192, 164, 48, 106, 203, 152, 189, 118, 120, 245, 221, 214, 26, 79, 39, 148, 232, 217, 88, 34, 246]), + Bytes32::from([8, 207, 11, 196, 253, 51, 182, 90, 62, 110, 125, 142, 209, 154, 5, 203, 252, 62, 117, 215, 226, 136, 140, 201, 227, 210, 71, 34, 113, 160, 42, 68]), + Bytes32::from([108, 135, 226, 117, 179, 142, 93, 181, 20, 186, 189, 217, 49, 154, 66, 244, 180, 170, 122, 233, 153, 214, 104, 71, 44, 57, 103, 240, 97, 80, 170, 198]), + Bytes32::from([123, 168, 184, 254, 241, 78, 23, 91, 32, 77, 218, 176, 179, 189, 61, 162, 114, 158, 212, 7, 201, 15, 58, 4, 161, 211, 188, 156, 190, 2, 20, 183]), + Bytes32::from([60, 170, 86, 130, 38, 170, 202, 88, 97, 206, 67, 69, 140, 122, 201, 38, 70, 229, 144, 202, 146, 10, 146, 148, 21, 247, 119, 196, 150, 223, 110, 67]), + Bytes32::from([102, 154, 215, 132, 143, 248, 151, 101, 101, 253, 80, 211, 254, 64, 179, 73, 96, 132, 144, 216, 225, 130, 48, 56, 14, 39, 97, 223, 134, 10, 124, 138]), + Bytes32::from([197, 131, 194, 166, 168, 160, 24, 116, 47, 120, 89, 3, 44, 154, 83, 250, 142, 64, 77, 63, 15, 60, 97, 100, 150, 39, 227, 139, 42, 146, 146, 104]), + Bytes32::from([7, 160, 246, 93, 64, 79, 76, 208, 66, 80, 60, 123, 13, 51, 115, 251, 196, 209, 145, 106, 61, 105, 136, 58, 7, 129, 142, 203, 205, 69, 45, 203]), + Bytes32::from([64, 162, 48, 187, 213, 182, 41, 85, 62, 148, 26, 161, 227, 108, 173, 249, 195, 106, 203, 18, 28, 59, 184, 85, 249, 16, 224, 222, 114, 200, 99, 22]), + Bytes32::from([246, 194, 74, 122, 165, 216, 211, 144, 101, 143, 134, 9, 53, 229, 197, 227, 121, 248, 89, 169, 48, 220, 104, 216, 117, 118, 36, 234, 108, 135, 81, 162]), + Bytes32::from([232, 59, 196, 2, 103, 242, 44, 129, 41, 231, 226, 115, 238, 151, 166, 210, 158, 110, 43, 45, 86, 163, 127, 8, 162, 81, 131, 145, 165, 252, 170, 12]), + Bytes32::from([204, 88, 102, 180, 241, 148, 27, 183, 223, 71, 157, 119, 155, 31, 102, 239, 4, 83, 204, 246, 38, 228, 234, 20, 97, 233, 203, 149, 186, 67, 143, 51]), + Bytes32::from([246, 170, 233, 8, 202, 38, 67, 219, 175, 13, 250, 174, 98, 36, 84, 166, 6, 75, 27, 43, 62, 128, 106, 23, 163, 191, 86, 115, 164, 50, 127, 151]), + Bytes32::from([204, 72, 199, 57, 106, 136, 244, 66, 217, 155, 183, 211, 166, 71, 140, 211, 210, 181, 178, 218, 204, 91, 200, 204, 153, 60, 22, 32, 24, 153, 131, 31]), + Bytes32::from([204, 193, 13, 167, 214, 136, 121, 99, 198, 137, 11, 223, 85, 40, 167, 126, 153, 80, 187, 35, 226, 31, 226, 42, 9, 175, 31, 206, 119, 67, 153, 39]), + Bytes32::from([63, 82, 16, 182, 255, 45, 123, 220, 252, 52, 199, 222, 76, 172, 123, 232, 133, 182, 143, 202, 223, 161, 203, 91, 239, 225, 123, 184, 231, 53, 19, 253]), + Bytes32::from([5, 13, 255, 217, 70, 105, 205, 70, 41, 25, 44, 3, 245, 136, 16, 255, 101, 61, 189, 225, 142, 201, 210, 226, 9, 237, 171, 109, 63, 204, 204, 139]), + Bytes32::from([161, 218, 126, 252, 32, 196, 32, 105, 98, 13, 201, 117, 64, 37, 232, 32, 159, 106, 48, 121, 250, 139, 219, 137, 129, 3, 83, 194, 102, 251, 148, 71]), + Bytes32::from([72, 17, 9, 21, 142, 89, 135, 91, 81, 155, 72, 247, 56, 232, 136, 57, 251, 182, 211, 35, 207, 169, 87, 123, 31, 222, 72, 85, 212, 92, 159, 171]), + Bytes32::from([193, 253, 238, 224, 198, 216, 154, 52, 59, 87, 183, 80, 242, 162, 238, 7, 218, 195, 253, 210, 92, 116, 43, 181, 109, 40, 74, 38, 154, 211, 102, 173]), + Bytes32::from([193, 88, 249, 81, 11, 128, 242, 239, 220, 1, 237, 199, 235, 12, 153, 73, 145, 158, 15, 111, 108, 244, 19, 51, 159, 206, 66, 25, 147, 215, 157, 165]), + Bytes32::from([195, 90, 0, 163, 8, 199, 55, 59, 47, 117, 186, 204, 5, 42, 205, 164, 239, 233, 203, 210, 69, 205, 244, 152, 113, 184, 206, 110, 101, 197, 120, 101]), + Bytes32::from([114, 169, 222, 11, 169, 15, 123, 245, 42, 25, 120, 198, 66, 140, 125, 123, 201, 107, 3, 50, 245, 226, 52, 46, 162, 44, 134, 157, 226, 11, 115, 186]), + Bytes32::from([6, 47, 131, 89, 216, 138, 92, 250, 126, 232, 238, 50, 181, 78, 69, 115, 227, 25, 49, 50, 116, 138, 47, 61, 179, 75, 121, 124, 127, 106, 228, 178]), + Bytes32::from([152, 253, 228, 228, 120, 255, 82, 66, 24, 145, 159, 223, 39, 185, 81, 201, 81, 110, 47, 57, 105, 128, 8, 42, 130, 119, 92, 7, 14, 247, 137, 135]), + Bytes32::from([162, 28, 11, 245, 48, 21, 8, 137, 161, 131, 84, 18, 129, 70, 197, 122, 165, 39, 71, 213, 142, 115, 159, 52, 46, 213, 81, 10, 217, 212, 74, 20]), + Bytes32::from([129, 250, 71, 119, 46, 25, 220, 212, 143, 120, 0, 101, 85, 101, 109, 107, 142, 20, 107, 174, 39, 134, 128, 244, 237, 155, 190, 19, 110, 10, 240, 94]), + Bytes32::from([90, 70, 190, 48, 191, 45, 227, 17, 185, 162, 159, 12, 18, 94, 186, 251, 252, 238, 95, 174, 253, 99, 194, 204, 5, 178, 117, 139, 50, 154, 93, 170]), + Bytes32::from([201, 8, 48, 126, 70, 22, 83, 82, 229, 84, 168, 86, 100, 169, 227, 175, 196, 154, 217, 150, 2, 36, 1, 100, 48, 216, 141, 205, 113, 148, 109, 126]), + Bytes32::from([16, 182, 10, 119, 255, 70, 127, 242, 64, 68, 67, 44, 52, 195, 63, 185, 227, 97, 138, 244, 53, 246, 110, 99, 41, 176, 146, 206, 81, 168, 66, 140]), + Bytes32::from([95, 9, 211, 227, 219, 119, 221, 132, 248, 92, 236, 190, 110, 227, 153, 109, 103, 63, 121, 221, 165, 212, 20, 141, 33, 95, 52, 157, 69, 76, 2, 70]), + Bytes32::from([216, 138, 115, 198, 102, 135, 226, 247, 235, 185, 206, 147, 130, 9, 48, 166, 92, 22, 41, 158, 169, 52, 233, 1, 60, 229, 165, 208, 60, 161, 194, 166]), + Bytes32::from([129, 241, 87, 138, 103, 241, 79, 26, 52, 35, 125, 237, 54, 147, 253, 137, 101, 146, 235, 127, 124, 113, 60, 203, 181, 4, 250, 12, 72, 27, 24, 7]), + Bytes32::from([52, 120, 68, 97, 147, 229, 251, 178, 161, 233, 142, 136, 38, 40, 85, 46, 121, 156, 115, 186, 72, 95, 128, 43, 252, 176, 176, 51, 113, 83, 154, 232]), + Bytes32::from([227, 11, 188, 57, 98, 160, 248, 247, 112, 49, 247, 92, 94, 224, 135, 182, 211, 230, 69, 185, 138, 154, 141, 157, 18, 34, 138, 236, 67, 243, 26, 132]), + Bytes32::from([61, 246, 31, 52, 44, 146, 190, 215, 214, 105, 253, 86, 172, 174, 140, 112, 30, 154, 82, 173, 62, 199, 157, 180, 255, 104, 73, 136, 163, 79, 210, 252]), + Bytes32::from([200, 155, 200, 87, 142, 123, 62, 176, 250, 44, 18, 238, 229, 121, 125, 109, 102, 173, 60, 203, 88, 65, 33, 122, 22, 111, 157, 143, 164, 7, 214, 26]), + Bytes32::from([179, 76, 168, 179, 139, 86, 151, 173, 26, 70, 236, 116, 202, 123, 63, 80, 106, 208, 63, 138, 179, 225, 114, 64, 48, 34, 78, 124, 132, 210, 224, 190]), + Bytes32::from([138, 116, 89, 240, 28, 79, 42, 149, 199, 118, 149, 49, 146, 212, 104, 62, 17, 137, 138, 223, 225, 187, 152, 43, 134, 60, 95, 55, 175, 128, 95, 144]) + ]); + zero_hashes.insert(MerkleType::Instruction, vec![ + Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::from([248, 140, 83, 29, 241, 220, 66, 40, 126, 248, 5, 153, 77, 179, 26, 64, 221, 108, 205, 162, 173, 52, 179, 140, 202, 105, 0, 170, 166, 130, 120, 176]), + Bytes32::from([35, 74, 103, 235, 245, 71, 66, 212, 99, 147, 15, 200, 1, 237, 95, 163, 10, 146, 122, 251, 243, 239, 93, 186, 46, 74, 206, 130, 63, 17, 199, 80]), + Bytes32::from([113, 169, 40, 37, 169, 205, 28, 78, 37, 104, 52, 28, 29, 222, 39, 32, 208, 183, 215, 38, 255, 69, 87, 70, 174, 113, 221, 183, 206, 62, 192, 118]), + Bytes32::from([1, 148, 183, 39, 234, 23, 138, 182, 169, 58, 52, 158, 248, 212, 186, 127, 60, 42, 25, 210, 20, 170, 182, 139, 20, 185, 196, 85, 241, 214, 181, 64]), + Bytes32::from([241, 14, 59, 8, 168, 222, 232, 125, 149, 227, 125, 41, 223, 198, 88, 135, 54, 146, 140, 212, 164, 76, 239, 106, 10, 20, 67, 180, 24, 159, 174, 99]), + Bytes32::from([117, 111, 220, 19, 204, 227, 211, 18, 61, 239, 179, 46, 142, 75, 67, 98, 159, 221, 205, 158, 125, 42, 221, 227, 148, 162, 193, 229, 147, 70, 214, 127]), + Bytes32::from([20, 72, 211, 188, 38, 126, 166, 75, 54, 22, 225, 21, 113, 155, 167, 89, 161, 6, 37, 78, 227, 211, 219, 141, 161, 199, 151, 122, 81, 45, 159, 187]), + Bytes32::from([69, 198, 100, 170, 106, 174, 208, 152, 152, 121, 118, 66, 111, 89, 131, 14, 159, 115, 142, 200, 205, 173, 89, 77, 68, 234, 5, 171, 105, 248, 199, 83]), + Bytes32::from([17, 1, 220, 13, 154, 194, 88, 60, 253, 223, 149, 35, 44, 184, 107, 141, 205, 177, 185, 32, 22, 99, 212, 96, 194, 91, 255, 179, 121, 153, 254, 40]), + Bytes32::from([222, 247, 186, 138, 222, 183, 135, 183, 170, 79, 182, 23, 69, 89, 70, 68, 88, 87, 235, 22, 178, 134, 114, 220, 249, 153, 70, 71, 229, 139, 10, 190]), + Bytes32::from([183, 77, 65, 51, 207, 78, 55, 149, 222, 3, 100, 82, 232, 230, 21, 115, 249, 177, 36, 89, 12, 41, 70, 31, 199, 254, 213, 3, 184, 2, 85, 137]), + Bytes32::from([82, 15, 215, 135, 95, 18, 143, 49, 239, 237, 6, 15, 213, 113, 153, 49, 149, 54, 50, 139, 100, 192, 128, 226, 168, 9, 120, 167, 157, 42, 45, 19]), + Bytes32::from([70, 32, 130, 243, 186, 144, 224, 217, 130, 222, 175, 221, 218, 190, 179, 222, 217, 115, 70, 160, 141, 231, 221, 96, 2, 173, 27, 17, 158, 66, 180, 58]), + Bytes32::from([76, 243, 65, 235, 12, 31, 48, 195, 62, 176, 202, 57, 99, 80, 237, 222, 138, 199, 124, 251, 143, 243, 205, 226, 18, 164, 67, 64, 68, 238, 53, 71]), + Bytes32::from([70, 52, 254, 193, 211, 92, 63, 238, 92, 2, 160, 29, 154, 25, 221, 136, 2, 49, 96, 27, 15, 152, 238, 57, 241, 253, 32, 131, 73, 38, 229, 243]), + Bytes32::from([214, 162, 82, 44, 146, 145, 61, 77, 36, 3, 131, 81, 217, 39, 127, 81, 66, 82, 172, 230, 246, 3, 243, 217, 210, 38, 201, 109, 240, 143, 253, 79]), + Bytes32::from([127, 18, 198, 116, 112, 141, 16, 39, 115, 118, 37, 208, 118, 119, 147, 46, 196, 124, 19, 196, 34, 183, 172, 157, 18, 91, 4, 210, 77, 195, 220, 59]), + Bytes32::from([87, 54, 42, 60, 39, 223, 84, 148, 158, 230, 70, 53, 191, 1, 108, 103, 139, 111, 58, 220, 114, 46, 46, 110, 20, 211, 84, 1, 173, 104, 175, 191]), + Bytes32::from([182, 147, 66, 127, 229, 144, 125, 93, 84, 220, 116, 107, 51, 13, 24, 161, 68, 172, 165, 50, 12, 198, 229, 173, 49, 26, 114, 159, 84, 190, 6, 42]), + Bytes32::from([183, 20, 36, 145, 76, 36, 61, 136, 224, 139, 89, 23, 124, 29, 210, 137, 1, 160, 22, 128, 48, 242, 234, 85, 84, 24, 206, 49, 143, 185, 237, 110]), + Bytes32::from([38, 19, 77, 150, 92, 129, 177, 155, 139, 162, 90, 91, 231, 146, 216, 21, 54, 152, 18, 5, 98, 21, 67, 160, 154, 113, 175, 65, 214, 78, 19, 97]), + Bytes32::from([163, 236, 47, 120, 121, 17, 217, 4, 200, 247, 206, 178, 211, 212, 163, 48, 38, 172, 111, 123, 75, 221, 63, 117, 42, 3, 252, 233, 104, 13, 210, 203]), + Bytes32::from([127, 106, 132, 246, 28, 129, 245, 83, 159, 109, 196, 219, 68, 81, 230, 77, 254, 166, 55, 73, 169, 179, 93, 97, 117, 176, 53, 74, 121, 238, 184, 240]), + Bytes32::from([255, 23, 108, 186, 145, 182, 196, 67, 163, 95, 173, 17, 67, 239, 199, 189, 145, 153, 120, 152, 159, 126, 255, 39, 55, 178, 230, 173, 91, 165, 229, 106]), + Bytes32::from([184, 156, 20, 114, 222, 219, 89, 218, 102, 62, 130, 200, 179, 237, 32, 237, 127, 75, 251, 163, 160, 2, 221, 34, 166, 30, 172, 97, 115, 137, 179, 175]), + Bytes32::from([244, 165, 127, 27, 66, 22, 38, 243, 235, 107, 30, 181, 31, 193, 210, 174, 254, 129, 39, 71, 59, 117, 186, 37, 217, 129, 138, 23, 146, 114, 96, 78]), + Bytes32::from([27, 57, 244, 93, 208, 90, 64, 181, 161, 110, 161, 188, 62, 180, 46, 103, 136, 233, 63, 1, 243, 202, 236, 206, 173, 45, 45, 218, 238, 184, 83, 121]), + Bytes32::from([138, 185, 33, 206, 120, 214, 246, 27, 100, 91, 106, 213, 60, 177, 39, 182, 149, 204, 11, 225, 254, 5, 87, 9, 19, 186, 166, 210, 33, 67, 146, 37]), + Bytes32::from([243, 161, 7, 52, 35, 240, 227, 144, 29, 50, 232, 3, 101, 174, 192, 139, 89, 75, 204, 245, 173, 55, 139, 76, 126, 19, 142, 18, 230, 57, 219, 227]), + Bytes32::from([97, 73, 36, 70, 120, 55, 49, 114, 107, 193, 66, 219, 47, 122, 201, 194, 52, 142, 12, 163, 108, 2, 107, 58, 185, 251, 168, 146, 57, 189, 150, 134]), + Bytes32::from([11, 215, 29, 229, 151, 208, 62, 1, 172, 253, 253, 156, 177, 31, 117, 214, 161, 192, 68, 255, 140, 131, 66, 23, 247, 161, 107, 98, 199, 57, 123, 110]), + Bytes32::from([41, 166, 54, 134, 242, 64, 153, 167, 5, 230, 226, 128, 71, 10, 251, 160, 19, 187, 70, 4, 95, 98, 77, 233, 181, 24, 11, 239, 142, 152, 229, 215]), + Bytes32::from([221, 220, 68, 168, 143, 124, 235, 77, 241, 190, 214, 6, 102, 40, 32, 245, 131, 114, 170, 151, 134, 49, 79, 57, 242, 124, 85, 172, 83, 81, 68, 99]), + Bytes32::from([142, 200, 102, 97, 170, 43, 14, 11, 139, 207, 150, 163, 99, 103, 2, 46, 44, 63, 109, 61, 62, 64, 199, 104, 36, 194, 155, 232, 139, 250, 97, 224]), + Bytes32::from([162, 15, 26, 217, 96, 195, 70, 196, 253, 70, 127, 156, 39, 120, 120, 232, 197, 154, 192, 147, 104, 33, 104, 189, 120, 160, 36, 129, 208, 237, 128, 23]), + Bytes32::from([42, 228, 74, 47, 20, 55, 197, 252, 173, 70, 178, 8, 2, 43, 97, 238, 155, 124, 87, 225, 217, 6, 103, 134, 136, 235, 193, 175, 33, 228, 219, 217]), + Bytes32::from([219, 143, 25, 70, 78, 155, 119, 63, 126, 20, 158, 54, 27, 181, 104, 184, 74, 192, 75, 157, 42, 204, 45, 122, 25, 248, 247, 24, 225, 207, 51, 251]), + Bytes32::from([151, 253, 36, 33, 104, 222, 126, 234, 112, 74, 59, 94, 239, 58, 36, 114, 90, 195, 208, 46, 250, 138, 165, 200, 178, 54, 238, 154, 219, 238, 6, 183]), + Bytes32::from([205, 57, 187, 174, 221, 9, 164, 77, 76, 143, 54, 212, 115, 196, 67, 182, 200, 147, 78, 194, 245, 92, 173, 114, 180, 160, 168, 5, 200, 82, 217, 64]), + Bytes32::from([211, 104, 62, 114, 157, 56, 254, 26, 32, 168, 208, 248, 62, 195, 142, 68, 53, 13, 7, 36, 216, 5, 127, 153, 97, 88, 222, 206, 91, 42, 14, 114]), + Bytes32::from([203, 158, 225, 200, 62, 223, 202, 52, 207, 179, 250, 236, 29, 144, 181, 31, 87, 192, 203, 66, 56, 39, 123, 25, 123, 157, 196, 161, 34, 245, 22, 130]), + Bytes32::from([147, 247, 233, 96, 190, 104, 227, 251, 99, 2, 16, 8, 77, 119, 1, 97, 243, 78, 103, 46, 24, 228, 217, 65, 219, 238, 135, 18, 164, 219, 132, 39]), + Bytes32::from([239, 153, 72, 139, 52, 60, 171, 44, 72, 218, 138, 124, 45, 30, 143, 122, 147, 158, 12, 62, 213, 151, 217, 217, 212, 51, 110, 75, 122, 67, 134, 80]), + Bytes32::from([46, 47, 130, 237, 178, 232, 239, 217, 165, 114, 255, 202, 132, 214, 18, 8, 72, 8, 255, 0, 162, 82, 5, 228, 141, 201, 70, 135, 255, 21, 220, 3]), + Bytes32::from([21, 11, 196, 5, 215, 241, 194, 200, 198, 129, 133, 244, 204, 47, 131, 70, 138, 38, 107, 39, 211, 243, 72, 72, 34, 145, 35, 42, 14, 69, 218, 227]), + Bytes32::from([73, 103, 117, 195, 67, 126, 242, 57, 232, 74, 142, 64, 169, 248, 113, 69, 110, 103, 127, 185, 177, 51, 212, 178, 48, 183, 247, 44, 246, 69, 35, 208]), + Bytes32::from([125, 8, 83, 22, 215, 82, 179, 234, 169, 227, 213, 39, 170, 164, 195, 187, 63, 38, 59, 146, 144, 101, 38, 0, 110, 212, 202, 20, 245, 105, 187, 201]), + Bytes32::from([186, 231, 186, 148, 68, 208, 226, 170, 120, 80, 68, 79, 23, 41, 51, 205, 240, 201, 10, 16, 24, 38, 137, 151, 7, 102, 92, 244, 3, 194, 228, 229]), + Bytes32::from([46, 8, 51, 150, 63, 114, 126, 210, 30, 130, 76, 142, 13, 149, 14, 0, 205, 199, 48, 90, 86, 75, 151, 135, 164, 224, 129, 77, 174, 194, 212, 112]), + Bytes32::from([150, 239, 42, 111, 3, 112, 25, 168, 179, 36, 106, 73, 212, 188, 215, 79, 180, 142, 191, 29, 219, 12, 244, 74, 254, 205, 160, 54, 68, 144, 81, 207]), + Bytes32::from([23, 164, 189, 201, 250, 65, 212, 148, 132, 125, 94, 209, 115, 123, 29, 66, 3, 172, 57, 58, 46, 191, 96, 7, 212, 25, 226, 79, 120, 68, 202, 210]), + Bytes32::from([252, 13, 137, 225, 208, 6, 84, 75, 97, 32, 177, 156, 248, 191, 113, 97, 254, 122, 86, 194, 3, 103, 219, 74, 227, 160, 231, 202, 13, 126, 46, 255]), + Bytes32::from([70, 35, 27, 128, 17, 79, 226, 131, 144, 118, 248, 125, 188, 110, 20, 15, 255, 73, 205, 69, 0, 227, 26, 66, 39, 61, 191, 224, 239, 234, 83, 170]), + Bytes32::from([129, 52, 148, 121, 230, 84, 28, 112, 75, 68, 181, 197, 80, 227, 107, 22, 60, 118, 81, 209, 198, 125, 233, 190, 84, 189, 18, 25, 72, 143, 2, 190]), + Bytes32::from([244, 237, 81, 131, 251, 35, 56, 158, 229, 102, 150, 122, 213, 206, 119, 38, 54, 238, 158, 159, 1, 214, 31, 147, 245, 9, 172, 247, 156, 115, 209, 140]), + Bytes32::from([47, 5, 174, 62, 80, 172, 77, 111, 136, 114, 188, 85, 249, 157, 182, 175, 187, 207, 29, 43, 152, 88, 130, 156, 138, 30, 188, 51, 82, 105, 145, 161]), + Bytes32::from([102, 2, 197, 195, 206, 149, 53, 224, 61, 219, 163, 246, 208, 218, 140, 47, 16, 42, 196, 20, 145, 158, 101, 31, 225, 135, 49, 68, 95, 5, 228, 92]), + Bytes32::from([78, 136, 176, 216, 253, 15, 136, 48, 162, 5, 57, 120, 93, 222, 179, 174, 129, 40, 8, 63, 18, 102, 97, 41, 58, 214, 1, 52, 58, 126, 186, 146]), + Bytes32::from([145, 56, 231, 59, 247, 191, 104, 137, 240, 113, 32, 245, 235, 129, 255, 54, 99, 176, 109, 175, 107, 232, 201, 235, 95, 104, 54, 67, 252, 184, 200, 54]), + Bytes32::from([181, 3, 229, 152, 113, 182, 55, 93, 138, 137, 21, 67, 27, 204, 96, 69, 72, 247, 237, 216, 28, 36, 115, 185, 111, 149, 224, 69, 66, 121, 188, 228]), + Bytes32::from([212, 25, 201, 68, 187, 25, 10, 96, 40, 88, 100, 216, 145, 200, 26, 203, 220, 14, 14, 11, 190, 62, 143, 137, 53, 208, 233, 158, 37, 34, 8, 15]), + Bytes32::from([80, 101, 192, 136, 203, 90, 189, 204, 181, 36, 28, 107, 220, 69, 119, 99, 145, 227, 198, 55, 37, 237, 212, 114, 31, 27, 19, 90, 231, 143, 87, 149]), + Bytes32::from([248, 97, 168, 33, 15, 230, 128, 82, 157, 26, 186, 89, 200, 7, 101, 210, 117, 111, 75, 233, 244, 187, 1, 180, 30, 220, 15, 21, 203, 5, 243, 223]) + ]); + zero_hashes.insert(MerkleType::Memory, vec![ + Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::from([66, 208, 130, 169, 194, 116, 5, 27, 68, 75, 235, 175, 164, 169, 41, 91, 88, 134, 51, 194, 219, 201, 182, 199, 1, 52, 173, 215, 20, 37, 51, 0]), + Bytes32::from([90, 210, 50, 227, 58, 173, 147, 92, 139, 15, 127, 190, 196, 111, 142, 207, 31, 223, 70, 96, 17, 251, 164, 200, 133, 0, 76, 35, 200, 9, 51, 218]), + Bytes32::from([97, 5, 162, 226, 92, 108, 172, 8, 7, 65, 104, 176, 216, 3, 144, 47, 14, 88, 50, 101, 194, 94, 10, 132, 192, 76, 37, 152, 42, 73, 30, 2]), + Bytes32::from([68, 59, 208, 14, 89, 37, 33, 1, 177, 225, 235, 66, 129, 28, 103, 156, 46, 206, 94, 141, 33, 152, 141, 26, 209, 161, 53, 237, 198, 163, 115, 57]), + Bytes32::from([28, 94, 12, 53, 70, 163, 95, 44, 168, 42, 196, 126, 181, 231, 174, 247, 89, 100, 77, 238, 211, 74, 116, 144, 183, 111, 254, 75, 30, 187, 228, 222]), + Bytes32::from([238, 133, 50, 189, 14, 89, 244, 88, 239, 50, 172, 85, 172, 1, 131, 2, 24, 161, 70, 94, 0, 204, 50, 199, 48, 107, 30, 70, 6, 8, 18, 90]), + Bytes32::from([165, 239, 71, 173, 192, 165, 25, 35, 4, 130, 148, 158, 177, 193, 129, 45, 115, 209, 7, 233, 136, 108, 245, 126, 74, 200, 22, 204, 190, 137, 191, 105]), + Bytes32::from([173, 102, 127, 73, 167, 249, 117, 26, 190, 231, 26, 60, 201, 138, 160, 182, 180, 44, 34, 132, 171, 254, 91, 8, 167, 114, 188, 157, 181, 148, 169, 165]), + Bytes32::from([71, 62, 70, 89, 203, 1, 105, 187, 178, 167, 217, 118, 42, 217, 154, 234, 238, 109, 145, 231, 247, 199, 40, 110, 162, 11, 173, 144, 103, 110, 99, 101]), + Bytes32::from([121, 36, 94, 4, 25, 134, 16, 98, 198, 109, 123, 42, 56, 151, 224, 7, 232, 155, 231, 154, 229, 162, 250, 149, 231, 198, 0, 65, 17, 27, 181, 28]), + Bytes32::from([247, 158, 162, 102, 242, 117, 166, 252, 175, 158, 107, 157, 244, 44, 17, 99, 93, 52, 43, 136, 5, 211, 32, 152, 91, 148, 41, 32, 231, 18, 237, 208]), + Bytes32::from([147, 52, 155, 255, 81, 242, 75, 54, 54, 66, 166, 41, 131, 177, 183, 151, 229, 177, 232, 86, 146, 137, 106, 68, 226, 117, 20, 210, 224, 170, 249, 68]), + Bytes32::from([160, 89, 180, 156, 119, 172, 38, 10, 97, 101, 64, 56, 98, 133, 199, 228, 58, 66, 139, 128, 88, 140, 143, 85, 148, 167, 79, 75, 34, 45, 204, 68]), + Bytes32::from([165, 233, 117, 3, 27, 56, 166, 16, 56, 132, 198, 32, 11, 149, 212, 98, 64, 236, 180, 106, 174, 80, 122, 220, 102, 67, 67, 110, 67, 8, 48, 217]), + Bytes32::from([113, 74, 209, 139, 250, 181, 182, 127, 178, 77, 17, 63, 79, 109, 145, 74, 52, 102, 125, 154, 22, 241, 177, 177, 34, 189, 124, 22, 4, 200, 201, 76]), + Bytes32::from([67, 7, 240, 151, 128, 149, 238, 113, 130, 127, 174, 223, 142, 124, 230, 10, 91, 89, 113, 157, 230, 21, 213, 3, 146, 249, 26, 80, 239, 90, 4, 216]), + Bytes32::from([152, 20, 80, 244, 232, 182, 1, 145, 31, 191, 46, 207, 83, 199, 209, 104, 0, 75, 106, 230, 16, 98, 121, 127, 175, 78, 119, 154, 69, 55, 66, 169]), + Bytes32::from([123, 50, 162, 158, 51, 112, 129, 232, 242, 158, 150, 72, 244, 40, 191, 63, 205, 61, 144, 39, 65, 122, 28, 88, 253, 146, 29, 29, 15, 40, 122, 95]), + Bytes32::from([231, 253, 202, 45, 165, 158, 212, 29, 104, 165, 209, 179, 188, 154, 89, 18, 216, 23, 140, 66, 150, 49, 99, 200, 163, 155, 50, 9, 250, 22, 19, 203]), + Bytes32::from([127, 172, 110, 243, 156, 134, 199, 15, 248, 216, 12, 196, 221, 66, 202, 186, 105, 197, 43, 245, 46, 116, 251, 133, 111, 118, 56, 214, 157, 244, 187, 58]), + Bytes32::from([181, 181, 163, 95, 7, 188, 245, 128, 161, 210, 137, 217, 103, 101, 120, 255, 47, 83, 102, 68, 238, 195, 206, 105, 24, 150, 216, 50, 74, 6, 94, 95]), + Bytes32::from([171, 250, 198, 40, 153, 26, 240, 152, 96, 169, 15, 123, 33, 155, 57, 172, 89, 205, 9, 65, 45, 126, 155, 143, 224, 145, 25, 214, 19, 227, 213, 195]), + Bytes32::from([44, 177, 244, 220, 119, 33, 203, 59, 209, 72, 28, 4, 210, 54, 86, 20, 119, 41, 45, 231, 143, 104, 57, 206, 212, 222, 81, 62, 92, 221, 200, 32]), + Bytes32::from([37, 200, 165, 195, 67, 224, 131, 227, 97, 54, 21, 233, 76, 186, 6, 122, 178, 131, 252, 59, 97, 218, 239, 62, 124, 255, 201, 178, 241, 236, 4, 214]), + Bytes32::from([77, 171, 229, 183, 46, 112, 203, 177, 89, 90, 64, 114, 109, 220, 32, 120, 41, 223, 72, 86, 59, 211, 110, 17, 129, 112, 194, 186, 200, 92, 144, 49]), + Bytes32::from([2, 198, 61, 112, 181, 185, 194, 114, 149, 63, 65, 76, 55, 179, 170, 62, 91, 112, 189, 100, 13, 34, 98, 187, 85, 132, 202, 86, 47, 27, 236, 200]), + Bytes32::from([164, 238, 109, 209, 155, 118, 236, 237, 84, 43, 56, 99, 51, 60, 116, 235, 100, 39, 163, 105, 34, 93, 8, 187, 228, 213, 35, 200, 43, 8, 32, 68]), + Bytes32::from([32, 220, 39, 200, 214, 245, 102, 200, 167, 204, 3, 54, 140, 126, 129, 35, 139, 60, 112, 133, 52, 166, 162, 63, 119, 20, 2, 116, 132, 244, 246, 225]), + Bytes32::from([5, 54, 145, 188, 188, 251, 36, 4, 103, 140, 229, 143, 83, 11, 77, 207, 57, 125, 51, 127, 89, 130, 138, 193, 190, 17, 17, 23, 68, 168, 231, 106]), + Bytes32::from([239, 112, 72, 74, 116, 134, 210, 24, 226, 242, 91, 113, 99, 59, 19, 7, 226, 215, 254, 220, 14, 225, 75, 245, 11, 234, 138, 52, 195, 86, 79, 124]), + Bytes32::from([187, 35, 132, 188, 162, 128, 96, 71, 124, 213, 251, 229, 73, 52, 187, 22, 166, 35, 214, 14, 121, 189, 37, 5, 77, 54, 201, 51, 95, 179, 75, 229]), + Bytes32::from([5, 54, 88, 42, 68, 200, 45, 209, 121, 70, 128, 8, 178, 212, 197, 39, 101, 90, 101, 111, 77, 133, 13, 77, 19, 111, 113, 122, 222, 85, 180, 82]), + Bytes32::from([34, 182, 144, 13, 35, 35, 79, 14, 239, 80, 21, 255, 67, 48, 210, 174, 159, 182, 239, 236, 68, 46, 125, 105, 243, 202, 218, 64, 53, 94, 159, 253]), + Bytes32::from([224, 189, 145, 186, 43, 169, 131, 161, 223, 161, 72, 72, 229, 97, 113, 233, 2, 250, 109, 31, 19, 125, 57, 135, 144, 3, 187, 18, 102, 108, 232, 9]), + Bytes32::from([68, 94, 11, 104, 95, 110, 179, 226, 157, 245, 113, 68, 44, 122, 17, 22, 244, 35, 248, 126, 131, 192, 20, 169, 129, 236, 60, 54, 157, 30, 231, 36]), + Bytes32::from([101, 198, 107, 156, 226, 8, 67, 168, 197, 91, 189, 166, 187, 16, 121, 93, 114, 243, 137, 162, 125, 142, 50, 206, 160, 168, 165, 27, 207, 10, 22, 19]), + Bytes32::from([222, 29, 134, 137, 98, 73, 58, 143, 166, 134, 210, 47, 68, 23, 214, 237, 241, 207, 226, 83, 113, 222, 184, 139, 16, 1, 200, 56, 34, 208, 197, 152]), + Bytes32::from([107, 200, 189, 222, 185, 32, 192, 130, 237, 238, 168, 137, 14, 94, 3, 26, 41, 238, 19, 119, 207, 158, 25, 177, 116, 70, 170, 161, 141, 129, 16, 88]), + Bytes32::from([131, 243, 131, 161, 236, 101, 108, 81, 59, 123, 150, 6, 250, 124, 103, 101, 75, 234, 98, 223, 129, 87, 202, 59, 184, 173, 44, 191, 200, 30, 223, 66]), + Bytes32::from([17, 226, 72, 31, 180, 33, 229, 83, 154, 39, 104, 45, 93, 117, 153, 249, 216, 127, 120, 182, 4, 19, 169, 87, 127, 70, 7, 237, 80, 251, 220, 126]), + Bytes32::from([88, 122, 134, 181, 173, 175, 100, 74, 28, 141, 45, 215, 245, 170, 222, 54, 106, 118, 146, 59, 207, 251, 133, 155, 164, 75, 240, 208, 10, 185, 187, 163]), + Bytes32::from([214, 1, 209, 99, 53, 101, 233, 225, 55, 171, 69, 200, 44, 144, 169, 11, 65, 85, 84, 158, 233, 227, 37, 59, 42, 52, 153, 13, 0, 158, 122, 208]), + Bytes32::from([124, 146, 1, 221, 33, 138, 233, 130, 184, 163, 121, 110, 95, 242, 123, 251, 110, 46, 41, 197, 75, 145, 121, 95, 29, 1, 19, 19, 167, 220, 177, 153]), + Bytes32::from([77, 38, 54, 170, 19, 128, 180, 248, 208, 75, 27, 53, 228, 104, 7, 216, 188, 186, 40, 84, 87, 11, 121, 3, 175, 89, 49, 46, 191, 94, 80, 97]), + Bytes32::from([134, 127, 37, 206, 212, 70, 146, 143, 81, 104, 140, 28, 135, 233, 171, 88, 18, 2, 148, 143, 111, 208, 149, 138, 167, 84, 183, 100, 67, 181, 243, 135]), + Bytes32::from([218, 16, 220, 189, 192, 237, 252, 168, 45, 33, 177, 81, 53, 115, 141, 190, 99, 138, 113, 85, 60, 230, 244, 222, 205, 16, 152, 26, 185, 207, 114, 143]), + Bytes32::from([9, 85, 193, 163, 186, 152, 83, 149, 29, 71, 50, 13, 175, 149, 184, 51, 246, 97, 20, 22, 57, 201, 27, 72, 146, 19, 213, 102, 164, 148, 176, 45]), + Bytes32::from([140, 94, 218, 31, 232, 0, 167, 218, 122, 119, 62, 179, 181, 51, 100, 6, 150, 159, 212, 207, 160, 94, 212, 108, 225, 196, 190, 210, 145, 110, 120, 114]), + Bytes32::from([152, 169, 229, 240, 162, 212, 61, 59, 167, 135, 124, 147, 212, 248, 177, 85, 243, 72, 150, 127, 122, 60, 143, 125, 226, 186, 67, 219, 50, 112, 242, 212]), + Bytes32::from([47, 244, 81, 140, 243, 189, 116, 0, 2, 158, 242, 188, 215, 90, 177, 37, 175, 221, 80, 226, 209, 79, 2, 62, 112, 245, 1, 132, 7, 78, 0, 117]), + Bytes32::from([247, 236, 252, 118, 6, 245, 132, 187, 48, 36, 77, 0, 167, 150, 109, 72, 234, 9, 224, 162, 223, 191, 21, 19, 180, 201, 138, 56, 109, 97, 152, 170]), + Bytes32::from([77, 23, 112, 52, 78, 204, 135, 173, 2, 206, 148, 200, 60, 155, 60, 179, 201, 111, 73, 138, 76, 104, 79, 174, 190, 173, 42, 51, 38, 48, 237, 241]), + Bytes32::from([117, 234, 73, 183, 4, 144, 12, 196, 78, 228, 178, 218, 206, 147, 147, 94, 190, 22, 22, 233, 88, 118, 135, 55, 63, 29, 212, 38, 223, 160, 121, 230]), + Bytes32::from([74, 138, 173, 10, 77, 129, 10, 115, 18, 90, 57, 215, 221, 171, 109, 152, 31, 219, 235, 122, 189, 201, 210, 186, 52, 200, 81, 218, 112, 79, 80, 54]), + Bytes32::from([189, 150, 224, 30, 110, 73, 249, 62, 100, 244, 206, 110, 206, 239, 233, 213, 61, 213, 65, 139, 103, 19, 20, 123, 167, 65, 161, 165, 216, 217, 255, 248]), + Bytes32::from([119, 71, 56, 219, 155, 139, 253, 40, 100, 132, 185, 98, 24, 34, 156, 225, 120, 176, 76, 147, 31, 105, 245, 216, 165, 161, 89, 157, 246, 17, 251, 234]), + Bytes32::from([192, 39, 162, 126, 222, 211, 173, 195, 198, 124, 1, 124, 140, 2, 252, 191, 185, 85, 10, 125, 226, 7, 88, 221, 164, 13, 221, 74, 200, 7, 249, 177]), + Bytes32::from([251, 226, 24, 5, 54, 89, 9, 93, 217, 202, 148, 172, 208, 197, 65, 172, 98, 96, 58, 194, 61, 253, 157, 193, 135, 32, 206, 97, 133, 234, 199, 197]), + Bytes32::from([130, 3, 195, 156, 210, 123, 23, 44, 223, 25, 153, 169, 250, 88, 127, 239, 206, 196, 156, 143, 182, 185, 35, 77, 162, 48, 143, 64, 231, 129, 216, 185]), + Bytes32::from([123, 201, 97, 230, 121, 13, 207, 138, 137, 3, 122, 92, 105, 155, 214, 204, 142, 18, 119, 138, 135, 165, 249, 58, 184, 53, 27, 31, 109, 214, 176, 147]), + Bytes32::from([46, 71, 246, 155, 247, 109, 236, 225, 147, 51, 250, 72, 97, 116, 162, 36, 115, 164, 80, 28, 252, 238, 98, 92, 16, 66, 190, 208, 180, 39, 179, 211]), + Bytes32::from([38, 76, 13, 227, 149, 18, 84, 170, 83, 231, 122, 59, 237, 66, 32, 171, 158, 251, 78, 156, 186, 160, 29, 30, 207, 178, 16, 193, 221, 158, 49, 48]), + Bytes32::from([166, 13, 210, 208, 250, 131, 27, 163, 99, 204, 199, 134, 152, 131, 28, 164, 8, 222, 176, 200, 34, 40, 74, 188, 120, 46, 167, 44, 95, 199, 86, 225]) + ]); + zero_hashes.insert(MerkleType::Table, vec![ + Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::from([164, 47, 121, 69, 150, 44, 30, 204, 210, 181, 242, 154, 59, 111, 5, 10, 47, 121, 213, 80, 163, 196, 205, 188, 241, 64, 202, 26, 242, 47, 50, 205]), + Bytes32::from([166, 9, 224, 145, 14, 138, 194, 78, 202, 114, 110, 38, 244, 33, 189, 185, 170, 85, 144, 229, 123, 63, 229, 194, 59, 130, 156, 6, 184, 154, 187, 17]), + Bytes32::from([32, 51, 186, 232, 39, 244, 218, 98, 243, 254, 82, 247, 63, 120, 34, 123, 128, 240, 220, 145, 41, 114, 251, 208, 209, 244, 10, 9, 179, 5, 105, 181]), + Bytes32::from([73, 148, 74, 132, 241, 45, 129, 169, 83, 223, 101, 12, 184, 60, 10, 201, 169, 197, 75, 17, 198, 168, 79, 171, 207, 195, 123, 47, 249, 30, 176, 216]), + Bytes32::from([145, 224, 51, 196, 211, 137, 189, 133, 232, 210, 170, 157, 227, 160, 218, 143, 15, 82, 170, 226, 241, 83, 7, 112, 138, 227, 58, 59, 149, 168, 81, 94]), + Bytes32::from([241, 90, 42, 7, 231, 63, 36, 86, 238, 131, 19, 20, 38, 118, 65, 180, 109, 121, 147, 147, 213, 142, 203, 244, 239, 75, 5, 160, 16, 85, 221, 95]), + Bytes32::from([213, 113, 178, 221, 213, 107, 77, 153, 222, 48, 148, 140, 250, 1, 17, 59, 73, 19, 110, 106, 94, 195, 126, 49, 126, 109, 65, 55, 104, 111, 18, 171]), + Bytes32::from([43, 198, 12, 197, 95, 201, 76, 108, 96, 235, 76, 8, 117, 99, 42, 20, 177, 45, 112, 40, 2, 180, 68, 19, 25, 11, 210, 168, 170, 178, 99, 27]), + Bytes32::from([142, 205, 24, 125, 81, 234, 138, 161, 206, 121, 163, 225, 50, 9, 180, 102, 0, 25, 93, 180, 137, 164, 206, 249, 222, 20, 175, 177, 199, 14, 115, 207]), + Bytes32::from([213, 41, 249, 19, 173, 165, 236, 103, 42, 146, 223, 6, 190, 229, 161, 13, 96, 163, 110, 23, 203, 238, 24, 95, 130, 203, 35, 211, 63, 234, 32, 137]), + Bytes32::from([176, 82, 229, 48, 113, 46, 179, 38, 231, 83, 50, 136, 179, 190, 242, 126, 152, 210, 141, 102, 191, 21, 20, 96, 235, 245, 81, 254, 231, 117, 159, 146]), + Bytes32::from([216, 15, 120, 147, 70, 215, 12, 160, 223, 73, 246, 73, 195, 189, 200, 3, 19, 131, 102, 61, 173, 79, 50, 76, 39, 150, 151, 147, 35, 251, 200, 0]), + Bytes32::from([88, 215, 168, 30, 218, 72, 206, 159, 91, 121, 14, 133, 241, 220, 195, 46, 93, 244, 179, 53, 158, 75, 211, 161, 8, 120, 167, 141, 235, 16, 232, 42]), + Bytes32::from([114, 99, 218, 52, 203, 162, 199, 16, 225, 154, 182, 20, 59, 121, 250, 249, 166, 35, 118, 18, 142, 57, 122, 131, 32, 219, 83, 126, 147, 91, 116, 16]), + Bytes32::from([193, 157, 15, 251, 179, 155, 215, 190, 98, 93, 30, 167, 23, 175, 178, 172, 142, 143, 222, 20, 18, 157, 215, 42, 105, 107, 64, 16, 216, 143, 109, 45]), + Bytes32::from([178, 2, 203, 32, 83, 90, 114, 97, 124, 210, 81, 81, 179, 213, 71, 19, 181, 173, 227, 88, 226, 83, 48, 169, 134, 163, 62, 103, 222, 82, 128, 30]), + Bytes32::from([252, 17, 142, 50, 185, 19, 111, 148, 204, 30, 199, 138, 143, 207, 30, 212, 254, 7, 129, 43, 100, 167, 52, 115, 247, 143, 64, 106, 220, 5, 7, 89]), + Bytes32::from([117, 136, 111, 98, 95, 97, 253, 43, 82, 22, 43, 187, 65, 154, 132, 105, 55, 194, 240, 148, 170, 199, 185, 91, 157, 138, 43, 117, 218, 176, 110, 101]), + Bytes32::from([228, 56, 186, 202, 73, 47, 253, 151, 48, 173, 2, 101, 153, 197, 108, 145, 227, 170, 247, 86, 80, 70, 30, 93, 232, 148, 63, 211, 197, 135, 23, 97]), + Bytes32::from([162, 35, 93, 45, 208, 241, 87, 57, 138, 79, 231, 83, 75, 81, 102, 91, 115, 58, 1, 205, 193, 197, 62, 210, 144, 88, 59, 52, 149, 234, 121, 224]), + Bytes32::from([165, 67, 16, 239, 234, 92, 207, 81, 64, 93, 227, 154, 132, 33, 54, 53, 102, 198, 90, 134, 24, 29, 190, 158, 121, 23, 127, 30, 27, 239, 140, 88]), + Bytes32::from([61, 125, 183, 139, 186, 82, 193, 166, 2, 147, 231, 215, 179, 107, 163, 67, 122, 0, 90, 188, 142, 216, 72, 20, 63, 146, 85, 89, 231, 41, 153, 117]), + Bytes32::from([206, 31, 38, 182, 78, 170, 183, 207, 211, 114, 212, 4, 108, 84, 62, 99, 245, 196, 10, 1, 188, 63, 240, 199, 27, 85, 68, 101, 212, 222, 85, 12]), + Bytes32::from([106, 0, 225, 130, 195, 87, 113, 106, 101, 80, 56, 119, 93, 45, 74, 168, 240, 209, 155, 123, 8, 129, 73, 225, 204, 125, 42, 73, 102, 122, 228, 158]), + Bytes32::from([251, 63, 88, 92, 59, 176, 71, 194, 46, 19, 18, 27, 83, 57, 197, 231, 202, 242, 155, 63, 252, 240, 205, 216, 96, 130, 161, 197, 123, 110, 175, 220]), + Bytes32::from([239, 6, 249, 150, 189, 234, 197, 18, 79, 222, 80, 72, 205, 147, 251, 135, 226, 33, 46, 111, 186, 185, 4, 33, 219, 129, 30, 182, 57, 229, 34, 16]), + Bytes32::from([192, 35, 149, 149, 16, 111, 3, 119, 173, 215, 223, 247, 70, 25, 31, 107, 104, 5, 249, 243, 193, 66, 99, 48, 107, 158, 25, 147, 163, 151, 96, 149]), + Bytes32::from([197, 133, 241, 197, 67, 52, 255, 227, 180, 235, 137, 164, 174, 160, 183, 9, 159, 254, 210, 180, 231, 140, 176, 165, 113, 215, 182, 1, 177, 204, 219, 246]), + Bytes32::from([51, 32, 109, 173, 131, 6, 99, 63, 75, 191, 207, 187, 73, 26, 5, 139, 167, 216, 123, 26, 199, 176, 84, 215, 158, 243, 105, 0, 91, 254, 59, 146]), + Bytes32::from([229, 120, 15, 22, 225, 50, 131, 240, 190, 232, 83, 119, 169, 246, 172, 35, 99, 163, 58, 146, 234, 253, 252, 83, 5, 48, 54, 142, 172, 91, 145, 13]), + Bytes32::from([159, 9, 100, 20, 215, 92, 217, 43, 208, 254, 65, 234, 124, 167, 250, 53, 159, 151, 124, 70, 26, 0, 113, 28, 78, 44, 238, 8, 34, 255, 19, 36]), + Bytes32::from([193, 135, 44, 144, 13, 46, 76, 43, 127, 208, 79, 196, 229, 58, 125, 33, 71, 118, 215, 240, 80, 123, 44, 181, 174, 47, 102, 42, 137, 98, 190, 41]), + Bytes32::from([78, 19, 3, 217, 174, 154, 142, 109, 189, 14, 241, 12, 23, 185, 224, 152, 209, 108, 223, 202, 191, 11, 190, 149, 31, 236, 104, 234, 22, 38, 196, 3]), + Bytes32::from([60, 93, 237, 228, 186, 222, 179, 231, 151, 95, 147, 20, 188, 10, 191, 34, 126, 57, 253, 161, 154, 117, 182, 108, 143, 72, 48, 102, 191, 240, 81, 208]), + Bytes32::from([179, 114, 163, 89, 172, 211, 154, 204, 11, 125, 140, 186, 107, 90, 17, 116, 214, 31, 165, 94, 36, 187, 184, 151, 210, 208, 76, 215, 75, 166, 107, 91]), + Bytes32::from([125, 131, 52, 139, 120, 156, 163, 243, 206, 143, 204, 221, 123, 140, 1, 103, 235, 186, 64, 82, 194, 191, 205, 2, 32, 242, 38, 77, 184, 23, 236, 228]), + Bytes32::from([137, 224, 90, 1, 116, 95, 215, 47, 8, 3, 227, 132, 154, 232, 216, 63, 3, 80, 52, 18, 42, 29, 85, 38, 117, 255, 9, 99, 88, 233, 129, 92]), + Bytes32::from([54, 182, 145, 174, 54, 24, 168, 13, 71, 43, 178, 49, 153, 246, 94, 79, 228, 254, 134, 0, 21, 210, 176, 242, 82, 117, 76, 40, 221, 181, 30, 62]), + Bytes32::from([145, 171, 156, 87, 15, 174, 31, 111, 175, 161, 31, 116, 123, 123, 37, 216, 43, 147, 197, 79, 218, 49, 236, 111, 35, 49, 44, 188, 197, 79, 136, 45]), + Bytes32::from([169, 48, 186, 93, 10, 48, 80, 103, 68, 226, 103, 31, 176, 154, 146, 199, 166, 89, 48, 149, 116, 101, 157, 149, 149, 72, 123, 54, 153, 26, 210, 122]), + Bytes32::from([225, 45, 163, 167, 213, 84, 40, 87, 106, 253, 206, 80, 189, 71, 153, 5, 15, 107, 151, 150, 14, 22, 143, 207, 4, 192, 63, 250, 207, 207, 179, 26]), + Bytes32::from([110, 249, 172, 218, 206, 202, 107, 64, 48, 153, 226, 127, 165, 227, 50, 146, 140, 239, 220, 252, 188, 157, 77, 210, 92, 73, 38, 6, 16, 87, 244, 66]), + Bytes32::from([39, 217, 230, 91, 60, 231, 96, 137, 37, 58, 93, 51, 79, 222, 132, 171, 196, 109, 155, 4, 252, 213, 17, 33, 160, 24, 250, 118, 187, 62, 107, 113]), + Bytes32::from([120, 167, 145, 121, 184, 31, 185, 178, 241, 54, 20, 48, 132, 89, 132, 127, 235, 189, 197, 127, 249, 58, 255, 197, 40, 229, 130, 254, 213, 186, 114, 74]), + Bytes32::from([7, 40, 187, 172, 225, 196, 3, 77, 113, 16, 118, 148, 95, 65, 42, 234, 233, 29, 120, 223, 105, 77, 250, 119, 245, 20, 21, 155, 177, 13, 56, 151]), + Bytes32::from([22, 248, 25, 75, 36, 179, 251, 57, 101, 170, 213, 19, 216, 64, 164, 253, 151, 199, 88, 5, 92, 129, 138, 185, 9, 236, 231, 68, 112, 24, 218, 216]), + Bytes32::from([95, 141, 49, 39, 213, 214, 130, 49, 143, 124, 178, 114, 200, 136, 160, 90, 233, 73, 233, 185, 60, 250, 174, 74, 2, 123, 2, 62, 192, 174, 115, 158]), + Bytes32::from([142, 29, 212, 35, 71, 107, 91, 164, 226, 225, 180, 218, 99, 34, 200, 171, 33, 235, 113, 105, 191, 78, 105, 70, 221, 135, 167, 148, 24, 225, 6, 146]), + Bytes32::from([176, 194, 115, 243, 138, 104, 3, 247, 184, 74, 81, 60, 173, 45, 29, 189, 252, 202, 206, 66, 129, 65, 150, 25, 246, 145, 133, 4, 93, 201, 201, 240]), + Bytes32::from([18, 233, 186, 158, 43, 12, 206, 228, 80, 102, 187, 25, 78, 77, 180, 28, 82, 62, 168, 252, 14, 113, 126, 91, 243, 120, 213, 91, 189, 244, 247, 177]), + Bytes32::from([79, 126, 97, 23, 112, 98, 93, 86, 24, 103, 82, 33, 155, 188, 202, 61, 29, 146, 132, 169, 116, 207, 216, 35, 29, 229, 213, 120, 135, 240, 129, 205]), + Bytes32::from([146, 121, 255, 202, 145, 53, 46, 8, 102, 205, 56, 234, 49, 42, 85, 231, 217, 114, 235, 141, 233, 187, 29, 9, 122, 232, 61, 253, 42, 104, 4, 113]), + Bytes32::from([103, 174, 255, 6, 115, 155, 156, 65, 84, 251, 208, 55, 89, 124, 171, 167, 133, 227, 22, 134, 32, 71, 243, 181, 16, 100, 81, 63, 22, 207, 58, 190]), + Bytes32::from([69, 10, 247, 243, 56, 0, 64, 72, 218, 21, 211, 192, 62, 243, 66, 244, 230, 58, 107, 54, 180, 29, 216, 23, 86, 211, 173, 181, 118, 188, 238, 72]), + Bytes32::from([25, 179, 4, 93, 169, 76, 76, 69, 158, 3, 24, 146, 130, 9, 225, 198, 102, 238, 29, 73, 74, 179, 159, 74, 40, 111, 181, 110, 76, 173, 251, 255]), + Bytes32::from([236, 113, 37, 202, 149, 150, 90, 50, 233, 141, 125, 12, 212, 163, 137, 176, 15, 214, 194, 73, 138, 104, 4, 33, 235, 76, 185, 58, 125, 182, 56, 0]), + Bytes32::from([238, 54, 183, 94, 50, 33, 98, 31, 133, 181, 230, 98, 43, 154, 95, 111, 250, 71, 15, 197, 156, 60, 8, 90, 208, 50, 62, 127, 30, 18, 181, 176]), + Bytes32::from([246, 143, 72, 228, 143, 15, 15, 131, 178, 105, 113, 46, 85, 36, 165, 116, 63, 131, 61, 228, 98, 144, 232, 209, 228, 110, 168, 171, 252, 47, 79, 165]), + Bytes32::from([146, 70, 74, 79, 139, 107, 73, 28, 231, 88, 235, 214, 163, 185, 87, 195, 147, 186, 153, 222, 191, 214, 30, 231, 173, 166, 151, 169, 244, 15, 15, 227]), + Bytes32::from([137, 182, 175, 97, 212, 23, 62, 70, 50, 150, 67, 153, 253, 52, 179, 105, 147, 177, 217, 170, 125, 251, 1, 96, 4, 127, 196, 37, 254, 7, 217, 100]), + Bytes32::from([32, 253, 229, 209, 120, 43, 120, 189, 245, 227, 178, 79, 134, 175, 240, 107, 25, 124, 5, 67, 120, 213, 187, 200, 159, 9, 26, 119, 13, 1, 8, 120]), + Bytes32::from([115, 241, 26, 44, 83, 229, 130, 21, 249, 87, 72, 212, 75, 220, 95, 22, 151, 77, 182, 8, 196, 207, 95, 18, 9, 92, 89, 206, 114, 80, 36, 159]), + Bytes32::from([174, 151, 88, 171, 52, 40, 161, 16, 106, 45, 44, 9, 142, 95, 5, 205, 82, 24, 172, 103, 152, 202, 187, 34, 217, 173, 236, 129, 32, 203, 205, 38]) + ]); + zero_hashes.insert(MerkleType::TableElement, vec![ + Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::from([145, 218, 63, 74, 131, 182, 204, 163, 74, 206, 234, 50, 47, 3, 51, 74, 121, 225, 146, 237, 5, 128, 20, 230, 243, 89, 33, 248, 136, 154, 189, 5]), + Bytes32::from([36, 240, 95, 13, 214, 136, 92, 102, 96, 137, 39, 96, 108, 223, 147, 130, 220, 61, 147, 226, 52, 133, 67, 223, 211, 164, 6, 53, 45, 117, 120, 241]), + Bytes32::from([9, 2, 218, 34, 228, 8, 178, 127, 160, 30, 104, 198, 49, 37, 71, 115, 14, 35, 20, 15, 253, 160, 147, 143, 24, 186, 12, 90, 41, 169, 30, 8]), + Bytes32::from([137, 242, 105, 78, 161, 99, 76, 224, 226, 100, 216, 235, 156, 132, 214, 154, 107, 120, 197, 113, 45, 221, 170, 119, 92, 228, 76, 139, 170, 159, 111, 58]), + Bytes32::from([231, 165, 221, 185, 139, 22, 70, 40, 67, 162, 123, 94, 161, 156, 57, 53, 102, 217, 128, 227, 18, 132, 17, 170, 90, 31, 214, 181, 249, 220, 70, 37]), + Bytes32::from([171, 253, 174, 187, 9, 186, 87, 37, 22, 83, 13, 88, 75, 11, 177, 226, 237, 136, 132, 137, 101, 109, 135, 192, 224, 80, 87, 105, 95, 81, 255, 21]), + Bytes32::from([179, 50, 36, 230, 159, 162, 184, 132, 140, 121, 133, 155, 189, 44, 132, 93, 80, 79, 32, 244, 131, 57, 79, 222, 104, 63, 224, 182, 91, 162, 73, 122]), + Bytes32::from([17, 55, 206, 87, 127, 185, 135, 231, 41, 56, 166, 104, 229, 102, 222, 181, 236, 233, 230, 39, 43, 163, 16, 1, 225, 86, 211, 51, 145, 7, 169, 84]), + Bytes32::from([201, 174, 3, 154, 104, 190, 240, 99, 123, 201, 7, 118, 196, 85, 28, 247, 35, 232, 39, 25, 151, 52, 167, 136, 179, 13, 213, 60, 138, 158, 39, 131]), + Bytes32::from([35, 33, 109, 155, 171, 252, 195, 80, 10, 115, 40, 199, 250, 1, 241, 82, 146, 225, 118, 237, 11, 125, 198, 97, 57, 21, 171, 237, 94, 60, 49, 32]), + Bytes32::from([126, 95, 42, 157, 183, 168, 137, 120, 114, 64, 148, 170, 32, 156, 137, 96, 194, 91, 119, 11, 20, 3, 30, 62, 118, 12, 31, 48, 245, 144, 252, 29]), + Bytes32::from([48, 135, 201, 114, 103, 35, 8, 96, 5, 101, 125, 26, 87, 0, 98, 122, 239, 140, 230, 10, 102, 112, 155, 87, 249, 181, 152, 235, 28, 79, 176, 56]), + Bytes32::from([76, 70, 222, 210, 242, 159, 52, 123, 112, 106, 253, 140, 55, 160, 189, 255, 220, 64, 8, 168, 39, 196, 160, 8, 105, 154, 91, 184, 62, 63, 227, 156]), + Bytes32::from([138, 201, 8, 240, 218, 190, 210, 227, 236, 168, 45, 161, 209, 115, 126, 165, 235, 162, 6, 117, 76, 239, 3, 225, 163, 251, 111, 233, 233, 228, 14, 92]), + Bytes32::from([190, 166, 27, 117, 242, 0, 25, 148, 230, 125, 237, 22, 153, 158, 151, 56, 121, 194, 221, 198, 184, 147, 249, 149, 27, 29, 166, 243, 254, 181, 209, 102]), + Bytes32::from([235, 63, 149, 47, 164, 152, 80, 11, 178, 203, 99, 178, 176, 226, 164, 151, 39, 65, 83, 200, 102, 90, 12, 102, 178, 15, 232, 16, 222, 141, 78, 3]), + Bytes32::from([37, 179, 99, 114, 214, 120, 87, 53, 198, 229, 207, 47, 16, 112, 208, 33, 216, 152, 209, 228, 196, 14, 237, 250, 212, 90, 176, 185, 21, 248, 92, 109]), + Bytes32::from([237, 200, 122, 93, 145, 116, 138, 59, 86, 220, 58, 171, 160, 31, 142, 193, 231, 131, 106, 164, 166, 44, 120, 170, 62, 81, 73, 85, 0, 52, 219, 220]), + Bytes32::from([244, 173, 85, 141, 81, 198, 214, 0, 54, 21, 20, 169, 177, 235, 104, 206, 43, 218, 96, 68, 73, 37, 252, 77, 253, 18, 30, 97, 223, 122, 1, 12]), + Bytes32::from([104, 169, 247, 140, 131, 245, 193, 3, 36, 119, 249, 119, 108, 102, 115, 250, 173, 225, 33, 156, 116, 87, 180, 27, 84, 215, 126, 15, 187, 189, 32, 139]), + Bytes32::from([47, 156, 244, 88, 145, 227, 224, 87, 233, 138, 138, 9, 169, 96, 29, 204, 100, 170, 23, 105, 63, 4, 119, 90, 167, 161, 72, 109, 82, 254, 123, 48]), + Bytes32::from([196, 68, 107, 111, 141, 253, 138, 140, 162, 104, 247, 104, 87, 144, 123, 240, 105, 251, 246, 210, 172, 172, 241, 162, 155, 90, 83, 175, 131, 251, 107, 215]), + Bytes32::from([28, 100, 243, 226, 32, 234, 211, 106, 197, 179, 14, 192, 70, 11, 203, 125, 151, 53, 20, 77, 175, 99, 154, 100, 159, 249, 54, 39, 73, 168, 162, 66]), + Bytes32::from([83, 176, 7, 180, 201, 178, 172, 98, 47, 34, 80, 6, 62, 10, 4, 112, 43, 93, 10, 227, 74, 91, 11, 217, 83, 230, 104, 0, 167, 2, 114, 89]), + Bytes32::from([185, 162, 212, 82, 149, 182, 104, 215, 62, 244, 114, 124, 181, 74, 226, 119, 4, 42, 181, 238, 25, 212, 215, 219, 174, 231, 32, 170, 9, 234, 12, 212]), + Bytes32::from([173, 38, 241, 20, 137, 119, 33, 252, 174, 245, 252, 234, 165, 181, 128, 225, 14, 147, 182, 97, 145, 19, 40, 193, 90, 238, 140, 87, 0, 222, 70, 254]), + Bytes32::from([51, 218, 162, 213, 211, 23, 9, 158, 185, 156, 39, 145, 5, 146, 70, 144, 172, 10, 26, 212, 253, 37, 24, 32, 21, 65, 179, 140, 64, 237, 96, 157]), + Bytes32::from([221, 87, 57, 81, 246, 126, 53, 163, 190, 220, 109, 205, 114, 234, 85, 151, 75, 245, 254, 16, 140, 131, 239, 120, 9, 209, 54, 61, 177, 6, 188, 252]), + Bytes32::from([54, 161, 25, 198, 75, 151, 214, 76, 83, 74, 117, 229, 155, 237, 88, 95, 143, 119, 56, 12, 201, 164, 235, 20, 117, 49, 177, 88, 14, 248, 95, 198]), + Bytes32::from([60, 16, 183, 115, 241, 45, 253, 24, 105, 43, 79, 72, 212, 238, 24, 156, 132, 93, 78, 246, 1, 228, 222, 200, 254, 130, 170, 46, 91, 254, 205, 143]), + Bytes32::from([184, 30, 34, 235, 214, 40, 120, 64, 182, 15, 162, 189, 164, 202, 89, 146, 202, 177, 16, 105, 172, 158, 1, 95, 101, 146, 253, 115, 226, 233, 38, 171]), + Bytes32::from([70, 152, 3, 73, 249, 222, 93, 214, 74, 179, 140, 47, 34, 42, 149, 214, 152, 75, 34, 145, 68, 226, 151, 101, 121, 54, 252, 240, 206, 140, 81, 165]), + Bytes32::from([9, 88, 51, 124, 67, 108, 84, 244, 61, 241, 110, 246, 184, 105, 6, 116, 242, 58, 15, 144, 43, 76, 176, 107, 0, 138, 155, 235, 210, 138, 226, 215]), + Bytes32::from([98, 170, 168, 147, 158, 223, 186, 7, 58, 130, 89, 200, 153, 24, 158, 251, 69, 100, 7, 57, 96, 115, 136, 170, 57, 145, 143, 240, 102, 6, 248, 111]), + Bytes32::from([76, 75, 216, 216, 194, 146, 2, 59, 247, 64, 98, 160, 62, 105, 193, 186, 161, 191, 64, 154, 254, 196, 55, 214, 201, 103, 223, 131, 181, 192, 152, 176]), + Bytes32::from([188, 141, 114, 199, 33, 45, 183, 18, 123, 231, 92, 215, 51, 191, 11, 199, 253, 46, 28, 10, 156, 23, 92, 255, 219, 236, 176, 247, 52, 105, 210, 223]), + Bytes32::from([200, 67, 112, 29, 180, 70, 50, 18, 220, 122, 39, 122, 83, 186, 81, 77, 241, 44, 190, 3, 162, 217, 76, 61, 230, 237, 157, 230, 205, 172, 186, 247]), + Bytes32::from([131, 131, 129, 83, 251, 217, 83, 88, 93, 39, 66, 174, 51, 19, 190, 91, 16, 187, 95, 63, 35, 178, 94, 237, 194, 42, 231, 227, 138, 202, 216, 93]), + Bytes32::from([18, 177, 28, 41, 199, 59, 160, 244, 26, 162, 73, 48, 16, 74, 190, 195, 249, 216, 64, 229, 145, 65, 18, 131, 75, 57, 71, 74, 127, 239, 112, 13]), + Bytes32::from([41, 120, 53, 253, 151, 12, 143, 213, 212, 31, 245, 61, 168, 113, 30, 38, 112, 126, 156, 133, 241, 102, 110, 237, 4, 138, 50, 160, 79, 235, 52, 35]), + Bytes32::from([38, 74, 146, 27, 110, 86, 122, 250, 58, 243, 64, 185, 207, 174, 28, 124, 35, 183, 53, 88, 34, 234, 89, 58, 98, 223, 69, 13, 48, 15, 239, 230]), + Bytes32::from([221, 132, 1, 28, 157, 232, 235, 132, 32, 58, 26, 36, 60, 217, 197, 165, 141, 19, 64, 120, 197, 139, 190, 86, 153, 152, 235, 11, 99, 129, 222, 91]), + Bytes32::from([237, 76, 61, 239, 169, 108, 131, 62, 163, 67, 158, 210, 14, 45, 91, 105, 36, 182, 206, 182, 71, 11, 159, 169, 159, 248, 247, 176, 6, 176, 237, 123]), + Bytes32::from([232, 190, 198, 78, 12, 148, 86, 176, 221, 115, 1, 22, 122, 163, 223, 234, 74, 129, 125, 53, 211, 137, 115, 18, 241, 170, 69, 42, 34, 74, 180, 172]), + Bytes32::from([215, 199, 144, 158, 222, 153, 123, 125, 150, 97, 127, 151, 96, 43, 69, 155, 150, 119, 75, 82, 218, 48, 101, 70, 121, 18, 42, 146, 215, 183, 100, 158]), + Bytes32::from([121, 182, 45, 62, 255, 78, 32, 48, 107, 186, 208, 155, 158, 80, 231, 241, 90, 227, 219, 113, 52, 20, 66, 45, 124, 67, 209, 61, 167, 74, 60, 34]), + Bytes32::from([34, 136, 15, 103, 128, 220, 202, 103, 150, 123, 249, 145, 218, 227, 17, 64, 142, 129, 4, 42, 93, 7, 6, 147, 111, 117, 25, 185, 88, 104, 85, 115]), + Bytes32::from([144, 191, 235, 38, 205, 102, 127, 160, 139, 105, 75, 63, 86, 192, 194, 49, 240, 35, 65, 154, 4, 113, 51, 87, 40, 70, 32, 58, 243, 16, 136, 67]), + Bytes32::from([217, 150, 254, 250, 111, 69, 45, 227, 111, 59, 199, 149, 59, 216, 17, 117, 8, 226, 85, 250, 183, 187, 21, 129, 208, 0, 63, 158, 232, 106, 131, 16]), + Bytes32::from([148, 212, 84, 16, 204, 49, 69, 96, 137, 125, 102, 221, 111, 8, 41, 51, 221, 241, 87, 231, 88, 215, 211, 24, 254, 131, 111, 56, 160, 143, 230, 109]), + Bytes32::from([144, 48, 37, 157, 153, 7, 123, 206, 46, 224, 211, 249, 208, 217, 91, 243, 128, 62, 100, 126, 3, 253, 223, 161, 50, 108, 26, 151, 129, 242, 94, 132]), + Bytes32::from([97, 167, 177, 53, 183, 154, 164, 1, 129, 184, 234, 182, 190, 197, 244, 226, 150, 217, 57, 152, 243, 206, 60, 76, 114, 194, 51, 240, 58, 93, 219, 76]), + Bytes32::from([139, 70, 147, 227, 94, 147, 130, 53, 38, 112, 138, 176, 7, 148, 6, 21, 50, 199, 70, 33, 87, 180, 33, 167, 56, 89, 66, 95, 245, 247, 135, 24]), + Bytes32::from([175, 169, 204, 13, 145, 18, 40, 29, 84, 88, 206, 99, 208, 137, 249, 146, 0, 237, 188, 130, 135, 223, 121, 54, 126, 251, 247, 109, 141, 217, 62, 127]), + Bytes32::from([139, 188, 3, 234, 198, 124, 194, 238, 217, 237, 214, 250, 66, 220, 0, 51, 1, 203, 122, 125, 46, 213, 22, 253, 8, 218, 145, 253, 170, 156, 159, 96]), + Bytes32::from([107, 130, 208, 55, 16, 249, 46, 4, 98, 236, 130, 52, 190, 126, 232, 229, 108, 126, 239, 175, 25, 229, 84, 33, 249, 66, 128, 162, 47, 221, 110, 163]), + Bytes32::from([239, 176, 14, 134, 210, 125, 177, 40, 200, 42, 229, 32, 200, 58, 9, 73, 210, 161, 8, 105, 4, 70, 19, 134, 117, 132, 167, 18, 16, 108, 207, 113]), + Bytes32::from([237, 116, 250, 79, 151, 228, 171, 189, 89, 213, 122, 121, 55, 25, 52, 238, 79, 19, 31, 194, 73, 158, 43, 78, 86, 194, 36, 141, 105, 10, 87, 58]), + Bytes32::from([216, 125, 158, 123, 121, 158, 74, 152, 46, 18, 196, 115, 233, 149, 205, 189, 10, 232, 174, 21, 2, 52, 202, 111, 74, 160, 191, 196, 84, 93, 98, 46]), + Bytes32::from([201, 148, 124, 172, 62, 154, 127, 129, 205, 197, 134, 133, 144, 78, 47, 190, 197, 190, 103, 44, 129, 57, 155, 227, 152, 212, 130, 12, 192, 223, 244, 68]), + Bytes32::from([102, 147, 19, 104, 237, 188, 140, 66, 166, 77, 105, 55, 5, 165, 143, 107, 91, 247, 53, 203, 187, 163, 109, 66, 19, 164, 153, 170, 82, 251, 148, 10]), + Bytes32::from([33, 89, 246, 96, 201, 15, 77, 99, 252, 111, 250, 152, 124, 80, 50, 57, 197, 124, 254, 202, 246, 131, 11, 219, 249, 102, 35, 79, 100, 173, 146, 167]), + Bytes32::from([6, 27, 205, 165, 249, 112, 70, 105, 232, 156, 155, 204, 71, 5, 21, 239, 91, 69, 248, 111, 218, 154, 187, 85, 118, 72, 210, 99, 138, 40, 233, 75]) + ]); + zero_hashes.insert(MerkleType::Module, vec![ + Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::from([252, 178, 61, 5, 174, 66, 106, 30, 131, 163, 114, 90, 231, 83, 228, 153, 108, 255, 60, 37, 254, 139, 153, 129, 208, 156, 109, 74, 233, 129, 174, 182]), + Bytes32::from([128, 23, 154, 62, 181, 220, 154, 183, 222, 214, 79, 76, 162, 169, 179, 162, 185, 93, 179, 115, 161, 55, 19, 63, 227, 168, 140, 66, 182, 6, 60, 120]), + Bytes32::from([243, 119, 126, 55, 151, 128, 119, 12, 124, 84, 146, 243, 156, 68, 82, 174, 201, 162, 29, 73, 29, 77, 103, 205, 194, 250, 45, 133, 39, 71, 224, 177]), + Bytes32::from([209, 179, 222, 187, 184, 84, 131, 182, 172, 78, 20, 104, 236, 246, 114, 74, 55, 98, 29, 34, 117, 249, 89, 76, 85, 38, 248, 193, 75, 10, 243, 100]), + Bytes32::from([195, 14, 58, 139, 148, 140, 218, 174, 131, 204, 69, 84, 127, 8, 142, 88, 136, 83, 253, 241, 74, 247, 143, 204, 38, 15, 138, 98, 47, 188, 255, 245]), + Bytes32::from([167, 4, 177, 126, 159, 76, 19, 220, 160, 159, 81, 227, 110, 147, 179, 175, 253, 187, 46, 24, 15, 168, 153, 84, 4, 167, 247, 225, 121, 175, 134, 85]), + Bytes32::from([237, 144, 152, 155, 211, 100, 202, 187, 41, 181, 45, 224, 143, 139, 18, 77, 110, 34, 212, 207, 239, 180, 73, 84, 166, 194, 22, 149, 89, 215, 86, 21]), + Bytes32::from([226, 192, 91, 176, 242, 185, 212, 189, 178, 80, 238, 252, 183, 82, 220, 242, 22, 237, 84, 142, 132, 91, 95, 219, 252, 171, 51, 76, 28, 146, 86, 155]), + Bytes32::from([199, 200, 237, 66, 220, 14, 221, 121, 117, 150, 118, 36, 138, 142, 50, 173, 12, 195, 131, 90, 27, 189, 247, 221, 89, 151, 41, 27, 135, 207, 137, 172]), + Bytes32::from([160, 60, 124, 200, 56, 240, 67, 161, 121, 95, 247, 51, 153, 249, 125, 88, 231, 2, 85, 167, 251, 187, 21, 103, 49, 132, 213, 52, 219, 30, 146, 59]), + Bytes32::from([123, 52, 142, 254, 117, 160, 215, 99, 155, 130, 134, 183, 76, 99, 166, 246, 49, 51, 142, 67, 116, 234, 69, 199, 201, 19, 70, 3, 208, 247, 40, 82]), + Bytes32::from([165, 32, 183, 79, 246, 224, 220, 103, 11, 160, 233, 66, 129, 238, 194, 73, 17, 37, 128, 185, 175, 88, 144, 228, 231, 185, 22, 17, 149, 174, 72, 1]), + Bytes32::from([12, 24, 45, 128, 57, 246, 187, 176, 154, 247, 169, 18, 116, 176, 70, 246, 203, 141, 211, 104, 5, 147, 78, 214, 161, 71, 33, 97, 7, 21, 158, 61]), + Bytes32::from([215, 18, 110, 29, 36, 34, 133, 219, 15, 204, 206, 158, 186, 213, 181, 41, 184, 160, 71, 165, 163, 121, 88, 106, 228, 58, 34, 105, 112, 168, 84, 123]), + Bytes32::from([6, 169, 156, 220, 55, 53, 26, 229, 104, 60, 113, 111, 153, 18, 251, 234, 179, 159, 56, 14, 112, 7, 144, 199, 45, 180, 116, 239, 21, 207, 173, 205]), + Bytes32::from([24, 172, 76, 192, 21, 91, 250, 75, 196, 119, 231, 221, 13, 239, 113, 39, 62, 40, 165, 26, 245, 16, 61, 106, 39, 28, 78, 212, 249, 230, 84, 108]), + Bytes32::from([248, 34, 1, 62, 213, 235, 20, 21, 220, 78, 178, 126, 184, 102, 242, 50, 49, 174, 163, 122, 166, 96, 40, 110, 78, 199, 89, 158, 155, 251, 233, 49]), + Bytes32::from([103, 54, 133, 19, 189, 117, 46, 209, 17, 2, 64, 251, 77, 195, 197, 91, 38, 48, 214, 36, 96, 255, 133, 87, 244, 101, 166, 218, 167, 129, 225, 167]), + Bytes32::from([196, 159, 226, 85, 100, 246, 179, 251, 133, 33, 114, 51, 104, 245, 81, 54, 137, 126, 245, 76, 112, 146, 139, 185, 190, 19, 106, 132, 48, 203, 34, 237]), + Bytes32::from([41, 190, 7, 23, 227, 80, 13, 134, 244, 18, 215, 148, 1, 72, 1, 22, 91, 165, 182, 69, 160, 179, 241, 106, 254, 116, 245, 131, 136, 35, 190, 226]), + Bytes32::from([205, 132, 211, 121, 67, 210, 191, 102, 218, 92, 56, 204, 68, 160, 188, 100, 229, 80, 77, 27, 26, 86, 248, 86, 216, 39, 242, 211, 183, 139, 219, 83]), + Bytes32::from([13, 215, 68, 100, 180, 74, 23, 58, 157, 140, 76, 31, 114, 254, 85, 78, 234, 40, 251, 199, 35, 204, 111, 243, 163, 64, 221, 21, 96, 55, 127, 118]), + Bytes32::from([225, 14, 246, 105, 64, 96, 225, 200, 186, 66, 40, 253, 131, 80, 102, 178, 83, 22, 150, 32, 15, 139, 76, 172, 144, 3, 30, 43, 217, 213, 89, 43]), + Bytes32::from([200, 83, 93, 27, 98, 246, 87, 100, 53, 166, 89, 138, 157, 88, 148, 245, 61, 115, 246, 20, 142, 156, 54, 237, 179, 64, 148, 218, 67, 5, 142, 248]), + Bytes32::from([159, 25, 150, 25, 114, 252, 162, 57, 21, 125, 147, 111, 220, 117, 17, 107, 40, 21, 157, 183, 6, 63, 226, 37, 64, 179, 133, 58, 107, 245, 78, 14]), + Bytes32::from([58, 243, 16, 193, 174, 42, 255, 46, 40, 128, 26, 167, 173, 164, 71, 226, 155, 205, 26, 127, 154, 24, 74, 244, 106, 251, 25, 221, 197, 176, 194, 17]), + Bytes32::from([51, 47, 251, 206, 27, 9, 142, 27, 253, 132, 189, 62, 109, 150, 246, 2, 137, 90, 157, 185, 59, 96, 0, 154, 29, 17, 231, 3, 84, 95, 49, 51]), + Bytes32::from([250, 158, 158, 248, 206, 150, 95, 254, 53, 140, 80, 102, 67, 26, 76, 127, 236, 86, 182, 120, 72, 239, 190, 118, 60, 77, 28, 82, 152, 234, 73, 201]), + Bytes32::from([255, 137, 155, 144, 74, 231, 231, 43, 187, 202, 137, 66, 205, 37, 40, 225, 0, 33, 87, 137, 113, 163, 58, 64, 147, 74, 123, 128, 19, 156, 46, 83]), + Bytes32::from([207, 61, 79, 4, 202, 96, 238, 144, 154, 230, 145, 65, 230, 130, 246, 10, 140, 71, 66, 246, 53, 230, 148, 1, 248, 103, 145, 149, 157, 38, 169, 8]), + Bytes32::from([33, 168, 110, 82, 84, 151, 70, 98, 115, 2, 221, 116, 210, 10, 247, 189, 203, 245, 186, 86, 121, 142, 218, 95, 68, 241, 21, 219, 131, 241, 185, 203]), + Bytes32::from([125, 247, 7, 149, 181, 71, 68, 141, 123, 207, 144, 83, 170, 27, 244, 37, 210, 148, 0, 140, 144, 159, 237, 216, 227, 247, 85, 229, 80, 174, 40, 48]), + Bytes32::from([0, 205, 68, 89, 77, 97, 204, 140, 113, 244, 168, 76, 49, 137, 236, 21, 132, 99, 10, 206, 195, 206, 208, 120, 227, 77, 21, 223, 145, 227, 48, 139]), + Bytes32::from([10, 153, 106, 155, 149, 65, 211, 247, 246, 5, 129, 126, 74, 14, 113, 168, 152, 154, 205, 139, 49, 2, 182, 65, 163, 15, 62, 126, 62, 16, 26, 36]), + Bytes32::from([24, 251, 204, 187, 179, 146, 114, 66, 110, 182, 131, 248, 36, 170, 169, 128, 22, 221, 134, 193, 121, 189, 128, 94, 83, 255, 226, 37, 133, 83, 220, 181]), + Bytes32::from([25, 52, 245, 155, 53, 39, 73, 130, 12, 73, 106, 255, 44, 204, 208, 41, 32, 126, 159, 98, 197, 67, 58, 90, 6, 146, 25, 166, 195, 194, 215, 70]), + Bytes32::from([194, 167, 206, 222, 96, 6, 86, 241, 95, 105, 225, 147, 99, 93, 201, 220, 166, 145, 4, 25, 168, 188, 21, 168, 80, 163, 132, 216, 239, 19, 115, 36]), + Bytes32::from([243, 16, 4, 9, 140, 42, 62, 105, 97, 7, 4, 234, 200, 227, 42, 10, 51, 167, 38, 148, 69, 154, 143, 179, 94, 177, 248, 28, 33, 61, 166, 187]), + Bytes32::from([156, 201, 97, 197, 223, 83, 229, 186, 187, 33, 49, 210, 181, 222, 180, 234, 150, 33, 99, 168, 157, 26, 241, 1, 213, 220, 165, 8, 31, 76, 134, 243]), + Bytes32::from([34, 218, 29, 74, 212, 218, 95, 6, 53, 10, 63, 174, 119, 90, 90, 35, 92, 124, 169, 222, 75, 61, 199, 118, 132, 40, 193, 9, 250, 80, 12, 197]), + Bytes32::from([102, 137, 75, 155, 181, 222, 86, 192, 140, 167, 3, 178, 212, 165, 49, 163, 86, 8, 76, 240, 32, 202, 34, 159, 217, 173, 101, 125, 237, 34, 48, 179]), + Bytes32::from([136, 53, 156, 19, 107, 234, 210, 218, 180, 236, 9, 7, 80, 63, 146, 57, 77, 106, 135, 64, 23, 184, 9, 139, 61, 237, 225, 157, 183, 182, 137, 31]), + Bytes32::from([237, 226, 115, 218, 228, 122, 45, 46, 67, 21, 130, 204, 80, 2, 28, 47, 148, 191, 28, 33, 177, 47, 207, 14, 33, 117, 28, 46, 88, 254, 97, 227]), + Bytes32::from([38, 87, 252, 28, 105, 20, 117, 29, 234, 237, 60, 91, 48, 101, 219, 219, 24, 52, 169, 243, 71, 214, 117, 41, 207, 17, 148, 77, 218, 44, 122, 167]), + Bytes32::from([235, 31, 185, 222, 3, 22, 222, 174, 126, 128, 55, 67, 201, 229, 55, 28, 241, 144, 184, 85, 141, 153, 183, 211, 66, 80, 152, 248, 214, 130, 64, 205]), + Bytes32::from([52, 169, 226, 179, 195, 44, 245, 101, 35, 92, 145, 174, 152, 212, 192, 148, 241, 72, 248, 61, 239, 124, 98, 213, 181, 75, 84, 121, 57, 90, 172, 164]), + Bytes32::from([27, 19, 12, 74, 128, 193, 65, 63, 15, 6, 174, 167, 79, 56, 88, 13, 117, 6, 189, 14, 11, 13, 133, 136, 141, 64, 74, 17, 159, 192, 251, 242]), + Bytes32::from([101, 69, 132, 221, 127, 162, 162, 92, 248, 131, 39, 52, 169, 170, 231, 137, 123, 106, 161, 16, 202, 242, 216, 245, 211, 170, 74, 128, 108, 243, 166, 38]), + Bytes32::from([157, 82, 193, 234, 117, 199, 118, 245, 63, 31, 186, 32, 135, 233, 29, 213, 217, 119, 208, 64, 149, 116, 117, 129, 211, 225, 207, 22, 225, 99, 194, 222]), + Bytes32::from([112, 194, 64, 229, 154, 223, 109, 8, 191, 120, 32, 176, 154, 7, 174, 103, 2, 156, 230, 164, 245, 252, 0, 116, 213, 40, 20, 239, 135, 62, 198, 42]), + Bytes32::from([32, 91, 5, 170, 221, 134, 167, 144, 16, 130, 237, 114, 71, 184, 131, 223, 92, 149, 161, 68, 196, 56, 73, 148, 203, 187, 174, 178, 178, 53, 156, 177]), + Bytes32::from([234, 97, 64, 211, 81, 59, 14, 249, 38, 8, 247, 37, 243, 37, 88, 234, 19, 54, 146, 63, 88, 79, 127, 190, 144, 51, 240, 19, 15, 143, 18, 9]), + Bytes32::from([247, 102, 43, 28, 24, 201, 189, 198, 66, 58, 210, 51, 174, 234, 52, 239, 37, 83, 212, 184, 127, 170, 168, 127, 47, 11, 248, 213, 84, 3, 201, 181]), + Bytes32::from([126, 18, 116, 33, 129, 25, 247, 2, 162, 202, 103, 201, 237, 67, 28, 80, 46, 182, 163, 239, 90, 204, 47, 196, 137, 79, 19, 165, 209, 84, 140, 132]), + Bytes32::from([189, 160, 148, 101, 82, 248, 215, 206, 90, 91, 205, 148, 37, 38, 172, 82, 223, 228, 66, 173, 220, 246, 194, 73, 231, 17, 220, 47, 222, 175, 7, 24]), + Bytes32::from([237, 149, 54, 210, 99, 72, 182, 55, 69, 140, 161, 215, 104, 90, 104, 26, 216, 241, 232, 210, 37, 77, 56, 216, 6, 160, 199, 247, 164, 227, 142, 255]), + Bytes32::from([11, 57, 131, 77, 203, 89, 156, 126, 200, 215, 103, 209, 70, 235, 78, 247, 0, 126, 209, 248, 220, 135, 158, 244, 141, 74, 6, 158, 19, 37, 42, 39]), + Bytes32::from([107, 131, 231, 102, 64, 182, 78, 253, 77, 143, 94, 34, 199, 93, 44, 131, 169, 211, 71, 223, 53, 230, 59, 107, 146, 22, 188, 207, 210, 220, 168, 129]), + Bytes32::from([78, 71, 246, 216, 154, 188, 152, 6, 234, 254, 21, 1, 128, 148, 56, 91, 250, 95, 76, 103, 15, 250, 137, 186, 114, 254, 122, 69, 208, 242, 69, 111]), + Bytes32::from([82, 241, 242, 155, 248, 109, 84, 118, 225, 255, 122, 40, 3, 87, 20, 223, 212, 205, 141, 178, 32, 229, 234, 146, 101, 73, 79, 55, 28, 82, 81, 178]), + Bytes32::from([35, 169, 243, 198, 215, 220, 113, 91, 6, 79, 48, 201, 97, 143, 212, 34, 247, 46, 38, 93, 166, 213, 158, 218, 61, 86, 240, 149, 224, 174, 225, 73]), + Bytes32::from([25, 108, 21, 212, 193, 192, 96, 39, 57, 72, 193, 99, 239, 0, 231, 83, 183, 195, 105, 33, 220, 187, 18, 148, 43, 30, 42, 127, 192, 240, 13, 224]), + Bytes32::from([119, 117, 186, 31, 43, 128, 143, 25, 182, 135, 156, 58, 152, 81, 70, 116, 171, 137, 125, 157, 152, 163, 34, 65, 240, 178, 12, 24, 168, 111, 39, 35]) + ]); + zero_hashes + }; +} \ No newline at end of file From 5e14a2bfdb4aa37c5844d323bb978e410503c5d0 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 26 Apr 2024 11:13:09 +0200 Subject: [PATCH 023/140] Add a benchmark for new_advanced. This part of the code is obviously slow. Let's see if we can improve it. --- arbitrator/prover/benches/merkle_bench.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs index 922f6cb177..20b566e077 100644 --- a/arbitrator/prover/benches/merkle_bench.rs +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -41,5 +41,20 @@ fn merkle_benchmark(c: &mut Criterion) { }); } -criterion_group!(benches, merkle_benchmark); +fn merkle_construction(c: &mut Criterion) { + let mut rng = rand::thread_rng(); + let mut leaves: Vec = Vec::with_capacity(1 >> 20); + for _ in 0..(1 >> 20) { + leaves.push(Bytes32::from([rng.gen_range(0u8..9); 32])); + } + + c.bench_function("merkle_construction", |b| { + b.iter(|| { + let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 21); + merkle.root(); + }) + }); +} + +criterion_group!(benches, merkle_benchmark, merkle_construction); criterion_main!(benches); \ No newline at end of file From c949b545cc02b9696cc27e0d0b5f55b2903581a7 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 26 Apr 2024 23:21:15 +0200 Subject: [PATCH 024/140] Add constant arrays of empty hashes for each Merkle type. This allows the most efficient lookup possible for empty layer hashes. --- arbitrator/arbutil/src/types.rs | 6 + arbitrator/prover/src/merkle.rs | 27 +- arbitrator/prover/src/merkle/zerohashes.rs | 949 +++++++++++---------- 3 files changed, 503 insertions(+), 479 deletions(-) diff --git a/arbitrator/arbutil/src/types.rs b/arbitrator/arbutil/src/types.rs index 6cf1d6cdf7..532484cb5d 100644 --- a/arbitrator/arbutil/src/types.rs +++ b/arbitrator/arbutil/src/types.rs @@ -27,6 +27,12 @@ pub enum PreimageType { #[repr(C)] pub struct Bytes32(pub [u8; 32]); +impl Bytes32 { + pub const fn new(x: [u8; 32]) -> Self { + Self(x) + } +} + impl Deref for Bytes32 { type Target = [u8; 32]; diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 95fa139186..b1a3a6c03b 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -175,6 +175,19 @@ fn capacity(layers: &Vec>) -> usize { base.pow((layers.len() - 1).try_into().unwrap()) } +const fn empty_hash_at(ty: MerkleType, layer_i: usize) -> Bytes32 { + match ty { + MerkleType::Empty => Bytes32::new([0u8; 32]), + MerkleType::Value => ZERO_HASHES[0][layer_i], + MerkleType::Function => ZERO_HASHES[1][layer_i], + MerkleType::Instruction => ZERO_HASHES[2][layer_i], + MerkleType::Memory => ZERO_HASHES[3][layer_i], + MerkleType::Table => ZERO_HASHES[4][layer_i], + MerkleType::TableElement => ZERO_HASHES[5][layer_i], + MerkleType::Module => ZERO_HASHES[6][layer_i], + } +} + impl Merkle { /// Creates a new Merkle tree with the given type and leaf hashes. /// The tree is built up to the minimum depth necessary to hold all the @@ -188,7 +201,7 @@ impl Merkle { pub fn new_advanced( ty: MerkleType, hashes: Vec, - empty_hash: Bytes32, + _empty_hash: Bytes32, min_depth: usize, ) -> Merkle { #[cfg(feature = "counters")] @@ -204,7 +217,7 @@ impl Merkle { let mut layer_i = 0usize; while layers.last().unwrap().len() > 1 || layers.len() < min_depth { let layer = layers.last().unwrap(); - let empty_hash = ZERO_HASHES[&ty][layer_i]; + let empty_hash = empty_hash_at(ty, layer_i); #[cfg(feature = "rayon")] let chunks = layer.par_chunks(2); @@ -245,7 +258,7 @@ impl Merkle { let right = layers[layer_i-1] .get(right_child_idx) .cloned() - .unwrap_or_else(|| ZERO_HASHES[&self.ty][layer_i - 1]); + .unwrap_or_else(|| empty_hash_at(self.ty, layer_i - 1)); let new_hash = hash_node(self.ty, left, right); if *idx < layers[layer_i].len() { layers[layer_i][*idx] = new_hash; @@ -306,7 +319,7 @@ impl Merkle { layer .get(counterpart) .cloned() - .unwrap_or_else(|| ZERO_HASHES[&self.ty][layer_i]), + .unwrap_or_else(|| empty_hash_at(self.ty, layer_i)), ); idx >>= 1; } @@ -318,7 +331,7 @@ impl Merkle { pub fn push_leaf(&mut self, leaf: Bytes32) { let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.push(leaf); - let empty = ZERO_HASHES[&self.ty][0]; + let empty = empty_hash_at(self.ty, 0); *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); } @@ -327,7 +340,7 @@ impl Merkle { pub fn pop_leaf(&mut self) { let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.pop(); - let empty = ZERO_HASHES[&self.ty][0]; + let empty = empty_hash_at(self.ty,0); *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); } @@ -359,7 +372,7 @@ impl Merkle { return Err("Cannot extend with more leaves than the capicity of the tree.".to_owned()); } let mut idx = layers[0].len(); - layers[0].resize(idx + hashes.len(), ZERO_HASHES[&self.ty][0]); + layers[0].resize(idx + hashes.len(), empty_hash_at(self.ty, 0)); for hash in hashes { self.locked_set(&mut layers, idx, hash); idx += 1; diff --git a/arbitrator/prover/src/merkle/zerohashes.rs b/arbitrator/prover/src/merkle/zerohashes.rs index 97d5c59c10..5b72e010fe 100644 --- a/arbitrator/prover/src/merkle/zerohashes.rs +++ b/arbitrator/prover/src/merkle/zerohashes.rs @@ -1,475 +1,480 @@ -use std::collections::HashMap; - use arbutil::Bytes32; -use lazy_static::lazy_static; -use crate::merkle::MerkleType; +const VALUE_HASHES: &[Bytes32; 64] = &[ + Bytes32::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::new([119, 47, 167, 222, 218, 156, 26, 105, 57, 248, 170, 182, 183, 151, 18, 150, 142, 70, 138, 253, 54, 123, 132, 86, 170, 76, 157, 52, 113, 138, 253, 254]), + Bytes32::new([8, 117, 27, 211, 196, 42, 6, 98, 185, 88, 231, 145, 14, 3, 207, 145, 158, 255, 69, 52, 198, 196, 148, 154, 59, 94, 229, 157, 93, 51, 200, 69]), + Bytes32::new([247, 208, 196, 206, 204, 168, 129, 100, 238, 95, 52, 26, 132, 138, 233, 149, 196, 72, 179, 226, 60, 114, 27, 94, 173, 189, 197, 100, 163, 232, 180, 63]), + Bytes32::new([178, 100, 198, 112, 40, 33, 187, 175, 130, 245, 59, 210, 133, 234, 158, 158, 133, 64, 213, 72, 222, 157, 216, 42, 210, 134, 36, 13, 211, 156, 163, 211]), + Bytes32::new([203, 127, 32, 130, 225, 40, 219, 15, 35, 236, 47, 201, 161, 48, 53, 145, 134, 169, 109, 29, 26, 29, 178, 201, 118, 217, 57, 165, 116, 172, 232, 4]), + Bytes32::new([209, 109, 33, 102, 227, 251, 133, 224, 170, 130, 65, 90, 185, 209, 146, 77, 244, 145, 181, 206, 159, 70, 209, 64, 241, 19, 149, 223, 138, 31, 163, 61]), + Bytes32::new([145, 168, 124, 48, 254, 12, 34, 41, 4, 213, 245, 86, 61, 29, 177, 192, 67, 165, 237, 236, 87, 126, 193, 191, 15, 126, 104, 173, 165, 186, 1, 107]), + Bytes32::new([235, 161, 247, 143, 69, 95, 210, 40, 243, 76, 102, 29, 118, 86, 180, 54, 81, 144, 103, 54, 202, 164, 81, 83, 180, 90, 154, 184, 54, 28, 7, 220]), + Bytes32::new([203, 62, 12, 83, 35, 122, 214, 199, 125, 61, 236, 8, 253, 64, 145, 34, 127, 116, 217, 118, 245, 107, 15, 81, 9, 7, 31, 154, 89, 28, 123, 132]), + Bytes32::new([222, 94, 234, 109, 142, 74, 142, 176, 248, 3, 172, 30, 204, 138, 241, 195, 121, 232, 104, 219, 32, 54, 240, 77, 125, 247, 70, 137, 80, 46, 221, 247]), + Bytes32::new([162, 122, 237, 101, 178, 31, 12, 62, 50, 133, 242, 82, 111, 215, 166, 136, 138, 185, 72, 220, 163, 58, 58, 97, 6, 97, 167, 114, 179, 227, 19, 170]), + Bytes32::new([67, 251, 144, 11, 175, 194, 149, 65, 173, 179, 69, 140, 213, 191, 133, 59, 81, 175, 161, 115, 252, 125, 232, 150, 52, 241, 102, 164, 122, 32, 70, 229]), + Bytes32::new([249, 161, 115, 93, 215, 247, 145, 182, 75, 191, 48, 38, 123, 220, 232, 47, 246, 46, 81, 164, 98, 41, 141, 249, 137, 173, 93, 213, 96, 15, 151, 245]), + Bytes32::new([222, 93, 144, 194, 107, 42, 144, 4, 242, 153, 203, 176, 146, 242, 94, 72, 9, 222, 194, 2, 73, 200, 167, 147, 106, 9, 67, 73, 59, 127, 174, 178]), + Bytes32::new([56, 228, 248, 59, 153, 215, 120, 224, 111, 48, 159, 82, 171, 227, 93, 214, 208, 151, 78, 67, 112, 31, 218, 94, 219, 3, 79, 250, 227, 24, 222, 207]), + Bytes32::new([26, 171, 68, 22, 162, 195, 65, 97, 219, 55, 51, 46, 178, 6, 247, 65, 123, 219, 128, 86, 193, 3, 253, 0, 239, 228, 187, 94, 184, 240, 67, 11]), + Bytes32::new([250, 36, 5, 131, 94, 0, 99, 187, 112, 155, 252, 52, 68, 236, 185, 152, 93, 239, 0, 185, 101, 101, 182, 92, 112, 5, 67, 55, 121, 203, 100, 245]), + Bytes32::new([208, 57, 149, 71, 227, 213, 246, 213, 175, 88, 95, 238, 93, 122, 168, 223, 149, 84, 30, 89, 98, 228, 113, 72, 90, 48, 112, 171, 231, 67, 113, 216]), + Bytes32::new([125, 48, 157, 119, 154, 38, 14, 211, 223, 68, 87, 187, 159, 126, 234, 72, 84, 60, 236, 237, 227, 130, 87, 43, 217, 105, 81, 196, 159, 238, 240, 10]), + Bytes32::new([141, 217, 59, 213, 245, 231, 7, 85, 178, 197, 115, 188, 31, 49, 126, 237, 83, 199, 56, 196, 133, 169, 239, 218, 90, 131, 178, 70, 126, 132, 114, 186]), + Bytes32::new([18, 2, 140, 12, 121, 238, 8, 160, 7, 208, 89, 194, 105, 136, 211, 58, 179, 200, 226, 138, 186, 242, 4, 237, 18, 113, 131, 135, 31, 222, 28, 195]), + Bytes32::new([156, 222, 183, 39, 119, 110, 130, 60, 33, 221, 36, 39, 223, 155, 33, 2, 71, 32, 209, 25, 194, 172, 209, 1, 40, 105, 235, 140, 160, 18, 63, 168]), + Bytes32::new([211, 210, 123, 27, 217, 111, 97, 42, 167, 191, 112, 239, 66, 42, 199, 131, 124, 213, 89, 56, 92, 245, 166, 238, 185, 42, 48, 2, 113, 255, 156, 7]), + Bytes32::new([66, 255, 87, 69, 86, 6, 54, 162, 162, 5, 93, 138, 194, 194, 151, 195, 57, 155, 58, 17, 21, 149, 77, 2, 134, 107, 125, 54, 220, 247, 160, 209]), + Bytes32::new([169, 216, 13, 41, 251, 216, 191, 87, 91, 55, 236, 6, 242, 103, 98, 209, 46, 202, 29, 55, 2, 50, 233, 76, 107, 92, 82, 156, 113, 226, 78, 211]), + Bytes32::new([88, 189, 113, 129, 119, 11, 141, 60, 128, 134, 113, 107, 7, 186, 81, 200, 14, 76, 197, 14, 96, 19, 247, 220, 95, 62, 81, 153, 61, 231, 26, 86]), + Bytes32::new([41, 214, 41, 96, 151, 11, 231, 7, 203, 70, 242, 156, 247, 133, 49, 223, 254, 164, 202, 154, 188, 104, 124, 120, 225, 229, 148, 203, 141, 218, 228, 56]), + Bytes32::new([181, 157, 136, 110, 158, 152, 105, 61, 125, 220, 32, 180, 53, 115, 155, 189, 91, 152, 96, 172, 7, 121, 65, 143, 82, 180, 3, 69, 118, 219, 31, 244]), + Bytes32::new([29, 12, 159, 30, 12, 37, 126, 102, 218, 149, 67, 116, 182, 125, 134, 208, 184, 199, 181, 191, 87, 144, 48, 150, 87, 67, 222, 218, 254, 118, 12, 160]), + Bytes32::new([193, 249, 209, 245, 102, 95, 15, 55, 160, 156, 203, 160, 49, 198, 203, 30, 99, 172, 89, 92, 235, 89, 131, 205, 53, 254, 219, 168, 202, 195, 10, 242]), + Bytes32::new([131, 64, 102, 7, 226, 96, 60, 111, 221, 120, 41, 86, 239, 157, 121, 38, 57, 244, 221, 55, 32, 237, 13, 20, 244, 238, 133, 189, 89, 118, 204, 247]), + Bytes32::new([239, 211, 89, 185, 191, 211, 243, 207, 134, 159, 59, 19, 87, 254, 115, 27, 152, 156, 120, 226, 39, 63, 155, 51, 77, 130, 162, 63, 16, 43, 112, 121]), + Bytes32::new([10, 146, 190, 23, 235, 67, 23, 169, 33, 140, 54, 209, 129, 176, 29, 218, 40, 55, 13, 80, 57, 68, 92, 97, 44, 82, 209, 240, 207, 214, 22, 119]), + Bytes32::new([59, 161, 125, 95, 7, 155, 141, 55, 253, 106, 238, 72, 109, 158, 201, 200, 236, 157, 227, 178, 176, 47, 166, 84, 87, 111, 25, 133, 194, 55, 244, 254]), + Bytes32::new([8, 134, 213, 182, 108, 15, 225, 138, 152, 138, 132, 240, 27, 80, 231, 117, 194, 157, 205, 20, 110, 239, 166, 37, 50, 46, 213, 165, 216, 101, 245, 98]), + Bytes32::new([137, 57, 186, 173, 198, 113, 221, 42, 0, 211, 127, 200, 128, 7, 112, 97, 75, 155, 152, 224, 71, 220, 16, 124, 32, 50, 30, 48, 251, 132, 120, 147]), + Bytes32::new([201, 8, 226, 108, 147, 192, 3, 240, 168, 237, 131, 47, 150, 51, 251, 126, 23, 182, 223, 99, 162, 167, 248, 248, 233, 8, 121, 99, 71, 212, 120, 251]), + Bytes32::new([140, 30, 196, 244, 166, 80, 95, 116, 140, 218, 94, 20, 236, 233, 241, 129, 175, 187, 110, 88, 174, 173, 152, 203, 67, 75, 51, 232, 225, 6, 17, 134]), + Bytes32::new([92, 132, 115, 164, 66, 159, 201, 147, 233, 228, 16, 95, 81, 233, 129, 254, 155, 148, 38, 239, 186, 40, 118, 104, 144, 134, 17, 46, 99, 150, 211, 9]), + Bytes32::new([81, 73, 72, 117, 215, 159, 240, 86, 136, 196, 69, 201, 149, 208, 48, 245, 105, 153, 97, 107, 221, 85, 49, 121, 197, 129, 32, 140, 206, 231, 120, 123]), + Bytes32::new([0, 203, 34, 135, 242, 129, 113, 204, 198, 134, 219, 134, 187, 240, 235, 59, 44, 163, 180, 83, 174, 40, 66, 141, 95, 99, 71, 221, 186, 216, 37, 250]), + Bytes32::new([225, 181, 151, 12, 26, 209, 127, 99, 248, 177, 126, 113, 215, 220, 252, 89, 149, 123, 19, 65, 89, 122, 180, 169, 195, 87, 147, 9, 196, 31, 203, 178]), + Bytes32::new([125, 81, 154, 100, 204, 138, 194, 248, 156, 95, 119, 58, 60, 221, 150, 248, 216, 19, 123, 15, 198, 108, 228, 228, 224, 122, 16, 249, 223, 84, 117, 89]), + Bytes32::new([99, 153, 60, 217, 168, 254, 244, 149, 214, 115, 250, 90, 117, 112, 66, 163, 143, 207, 121, 70, 108, 92, 2, 47, 56, 109, 56, 207, 152, 27, 196, 141]), + Bytes32::new([99, 251, 124, 97, 158, 155, 101, 251, 98, 124, 239, 73, 50, 50, 173, 142, 39, 208, 167, 53, 5, 151, 85, 239, 25, 77, 36, 52, 141, 225, 66, 186]), + Bytes32::new([235, 44, 31, 180, 197, 243, 114, 60, 199, 242, 167, 21, 206, 27, 116, 165, 18, 76, 162, 163, 14, 91, 109, 104, 118, 51, 33, 172, 9, 165, 214, 38]), + Bytes32::new([188, 4, 5, 50, 169, 70, 231, 90, 220, 90, 226, 214, 89, 19, 159, 207, 201, 80, 241, 214, 32, 240, 63, 74, 6, 251, 177, 182, 236, 19, 156, 92]), + Bytes32::new([128, 150, 66, 27, 197, 229, 103, 137, 175, 252, 19, 131, 213, 63, 112, 172, 182, 255, 235, 246, 226, 37, 25, 180, 24, 38, 35, 138, 207, 149, 186, 175]), + Bytes32::new([5, 123, 231, 106, 12, 171, 157, 189, 58, 109, 144, 7, 38, 97, 4, 148, 1, 138, 124, 123, 2, 202, 108, 221, 194, 160, 53, 73, 115, 36, 231, 142]), + Bytes32::new([160, 157, 243, 224, 214, 120, 59, 206, 24, 30, 231, 209, 123, 227, 15, 221, 86, 30, 128, 117, 210, 109, 132, 117, 204, 87, 243, 213, 231, 224, 91, 75]), + Bytes32::new([74, 238, 110, 147, 63, 110, 246, 102, 252, 212, 120, 225, 124, 218, 145, 204, 129, 63, 13, 34, 1, 0, 15, 9, 27, 221, 39, 199, 24, 231, 9, 38]), + Bytes32::new([194, 20, 160, 161, 90, 2, 118, 75, 103, 228, 51, 42, 191, 220, 63, 150, 140, 32, 85, 172, 218, 29, 251, 31, 99, 96, 98, 46, 130, 157, 201, 61]), + Bytes32::new([88, 123, 95, 139, 94, 66, 69, 27, 223, 223, 216, 130, 99, 210, 130, 54, 248, 35, 226, 252, 151, 238, 7, 175, 12, 97, 188, 43, 233, 129, 82, 222]), + Bytes32::new([179, 248, 157, 243, 50, 157, 172, 17, 139, 10, 245, 208, 241, 210, 67, 199, 135, 233, 234, 39, 127, 38, 54, 39, 40, 159, 94, 122, 36, 221, 180, 195]), + Bytes32::new([190, 185, 147, 237, 82, 32, 165, 236, 252, 183, 173, 181, 68, 44, 216, 20, 110, 243, 158, 213, 88, 209, 218, 207, 244, 241, 121, 239, 136, 167, 245, 155]), + Bytes32::new([114, 131, 254, 248, 183, 0, 175, 217, 194, 58, 178, 238, 250, 119, 158, 205, 19, 74, 94, 35, 100, 175, 114, 55, 186, 192, 239, 126, 42, 86, 60, 119]), + Bytes32::new([1, 253, 107, 150, 25, 240, 27, 172, 252, 185, 151, 152, 107, 105, 164, 230, 221, 242, 7, 166, 142, 53, 237, 83, 19, 30, 81, 149, 150, 39, 123, 220]), + Bytes32::new([57, 240, 92, 232, 26, 238, 69, 252, 110, 171, 164, 109, 199, 73, 110, 49, 11, 253, 109, 69, 155, 26, 84, 52, 155, 204, 115, 99, 90, 38, 247, 167]), + Bytes32::new([46, 87, 146, 25, 215, 40, 208, 78, 73, 60, 35, 19, 194, 41, 34, 186, 215, 131, 205, 29, 107, 100, 95, 169, 45, 1, 242, 115, 30, 226, 93, 48]), + Bytes32::new([95, 183, 66, 0, 196, 173, 44, 27, 175, 151, 17, 0, 159, 168, 123, 236, 124, 198, 85, 181, 118, 89, 21, 52, 169, 104, 178, 111, 120, 173, 94, 109]), + Bytes32::new([13, 111, 162, 25, 133, 108, 250, 75, 197, 221, 19, 160, 147, 36, 130, 70, 224, 39, 134, 144, 149, 166, 187, 96, 155, 154, 123, 90, 241, 154, 44, 102]), + Bytes32::new([95, 171, 183, 135, 121, 205, 161, 160, 212, 226, 64, 232, 180, 166, 176, 95, 51, 96, 110, 20, 76, 143, 47, 96, 197, 132, 210, 109, 174, 132, 13, 95]), + Bytes32::new([66, 51, 176, 1, 106, 199, 192, 16, 106, 180, 212, 53, 72, 121, 218, 148, 77, 26, 15, 244, 124, 131, 88, 84, 147, 211, 254, 156, 187, 91, 193, 120]), +]; + +const FUNCTION_HASHES: &[Bytes32; 64] = &[ + Bytes32::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::new([239, 247, 49, 255, 201, 159, 228, 149, 22, 115, 41, 139, 56, 117, 149, 46, 67, 155, 98, 70, 216, 225, 85, 100, 113, 242, 144, 167, 97, 238, 117, 207]), + Bytes32::new([46, 87, 136, 101, 122, 12, 6, 120, 39, 121, 167, 193, 66, 146, 150, 1, 90, 240, 97, 225, 179, 150, 197, 127, 56, 214, 116, 24, 180, 109, 96, 51]), + Bytes32::new([54, 125, 90, 195, 243, 1, 115, 18, 251, 68, 203, 216, 48, 156, 216, 200, 215, 250, 80, 152, 203, 58, 245, 128, 70, 112, 221, 104, 34, 125, 234, 138]), + Bytes32::new([103, 99, 44, 86, 57, 0, 102, 201, 99, 214, 249, 24, 45, 112, 234, 183, 225, 196, 9, 162, 168, 33, 121, 118, 93, 184, 14, 70, 148, 135, 211, 214]), + Bytes32::new([69, 7, 89, 47, 41, 94, 148, 139, 67, 197, 99, 98, 100, 63, 25, 230, 100, 118, 213, 25, 28, 129, 5, 39, 69, 89, 71, 21, 102, 84, 101, 175]), + Bytes32::new([232, 195, 82, 123, 189, 200, 139, 61, 179, 141, 208, 69, 102, 58, 127, 66, 69, 127, 7, 179, 108, 128, 253, 154, 207, 254, 201, 18, 192, 241, 99, 208]), + Bytes32::new([138, 25, 185, 215, 159, 159, 214, 251, 161, 103, 180, 78, 209, 215, 131, 132, 134, 180, 177, 37, 79, 219, 19, 93, 45, 30, 53, 125, 142, 194, 114, 34]), + Bytes32::new([185, 24, 200, 28, 68, 7, 118, 226, 65, 240, 85, 120, 123, 174, 239, 85, 247, 210, 104, 247, 20, 229, 41, 91, 242, 5, 2, 121, 132, 69, 43, 33]), + Bytes32::new([78, 191, 92, 97, 205, 120, 114, 216, 112, 101, 44, 98, 148, 2, 112, 221, 168, 199, 254, 55, 160, 116, 116, 105, 109, 227, 130, 219, 194, 32, 209, 196]), + Bytes32::new([177, 203, 26, 1, 216, 115, 242, 158, 202, 107, 60, 221, 81, 167, 8, 233, 247, 235, 49, 54, 45, 133, 202, 193, 34, 158, 205, 29, 232, 245, 195, 194]), + Bytes32::new([193, 118, 182, 153, 10, 237, 67, 229, 136, 193, 253, 250, 46, 125, 141, 22, 107, 168, 74, 130, 60, 193, 194, 196, 249, 129, 153, 82, 162, 143, 188, 42]), + Bytes32::new([239, 57, 105, 90, 116, 61, 160, 214, 55, 191, 17, 228, 44, 149, 103, 180, 229, 4, 175, 240, 209, 231, 141, 95, 109, 195, 78, 142, 122, 177, 227, 20]), + Bytes32::new([153, 247, 105, 126, 178, 44, 190, 57, 12, 63, 169, 27, 206, 19, 151, 38, 33, 83, 35, 3, 177, 97, 36, 182, 37, 78, 150, 243, 222, 32, 180, 148]), + Bytes32::new([29, 109, 110, 167, 27, 136, 235, 226, 147, 175, 241, 236, 138, 135, 163, 200, 21, 94, 220, 238, 23, 84, 46, 14, 44, 100, 47, 131, 134, 43, 98, 173]), + Bytes32::new([73, 241, 108, 102, 184, 200, 64, 80, 58, 162, 29, 211, 173, 150, 6, 195, 2, 137, 246, 51, 155, 132, 41, 255, 21, 71, 74, 143, 197, 180, 217, 159]), + Bytes32::new([109, 189, 226, 33, 70, 157, 161, 166, 223, 31, 224, 221, 37, 112, 27, 215, 163, 250, 217, 155, 168, 121, 119, 232, 100, 177, 104, 210, 10, 118, 215, 0]), + Bytes32::new([175, 156, 32, 156, 238, 82, 62, 25, 96, 251, 146, 24, 13, 2, 115, 174, 163, 50, 14, 251, 196, 173, 5, 87, 171, 228, 191, 9, 90, 84, 156, 63]), + Bytes32::new([244, 161, 238, 217, 14, 60, 162, 139, 34, 84, 68, 121, 213, 11, 230, 95, 57, 221, 174, 107, 103, 105, 76, 137, 58, 247, 65, 209, 167, 63, 96, 212]), + Bytes32::new([31, 177, 221, 130, 152, 92, 190, 4, 59, 90, 122, 63, 128, 180, 140, 201, 75, 239, 200, 151, 94, 65, 36, 227, 21, 250, 10, 253, 26, 114, 238, 188]), + Bytes32::new([48, 216, 87, 30, 113, 214, 69, 1, 9, 112, 244, 232, 127, 55, 43, 162, 156, 83, 235, 199, 126, 132, 241, 106, 65, 209, 240, 32, 11, 179, 219, 135]), + Bytes32::new([20, 55, 225, 132, 0, 219, 175, 17, 235, 73, 236, 16, 24, 227, 250, 155, 32, 83, 234, 123, 191, 209, 157, 133, 215, 202, 3, 221, 135, 223, 221, 90]), + Bytes32::new([113, 185, 118, 164, 139, 219, 203, 140, 245, 123, 21, 186, 102, 22, 54, 14, 19, 230, 223, 120, 211, 114, 203, 77, 173, 214, 61, 80, 151, 10, 2, 205]), + Bytes32::new([50, 20, 214, 105, 232, 5, 9, 101, 16, 72, 46, 139, 177, 188, 25, 93, 14, 57, 60, 168, 49, 147, 134, 5, 62, 181, 120, 75, 193, 229, 107, 67]), + Bytes32::new([92, 167, 117, 18, 186, 193, 28, 56, 86, 25, 75, 64, 1, 8, 126, 212, 56, 163, 157, 242, 34, 73, 65, 58, 187, 2, 112, 58, 225, 229, 113, 58]), + Bytes32::new([173, 139, 156, 215, 250, 231, 15, 123, 8, 5, 98, 192, 164, 48, 106, 203, 152, 189, 118, 120, 245, 221, 214, 26, 79, 39, 148, 232, 217, 88, 34, 246]), + Bytes32::new([8, 207, 11, 196, 253, 51, 182, 90, 62, 110, 125, 142, 209, 154, 5, 203, 252, 62, 117, 215, 226, 136, 140, 201, 227, 210, 71, 34, 113, 160, 42, 68]), + Bytes32::new([108, 135, 226, 117, 179, 142, 93, 181, 20, 186, 189, 217, 49, 154, 66, 244, 180, 170, 122, 233, 153, 214, 104, 71, 44, 57, 103, 240, 97, 80, 170, 198]), + Bytes32::new([123, 168, 184, 254, 241, 78, 23, 91, 32, 77, 218, 176, 179, 189, 61, 162, 114, 158, 212, 7, 201, 15, 58, 4, 161, 211, 188, 156, 190, 2, 20, 183]), + Bytes32::new([60, 170, 86, 130, 38, 170, 202, 88, 97, 206, 67, 69, 140, 122, 201, 38, 70, 229, 144, 202, 146, 10, 146, 148, 21, 247, 119, 196, 150, 223, 110, 67]), + Bytes32::new([102, 154, 215, 132, 143, 248, 151, 101, 101, 253, 80, 211, 254, 64, 179, 73, 96, 132, 144, 216, 225, 130, 48, 56, 14, 39, 97, 223, 134, 10, 124, 138]), + Bytes32::new([197, 131, 194, 166, 168, 160, 24, 116, 47, 120, 89, 3, 44, 154, 83, 250, 142, 64, 77, 63, 15, 60, 97, 100, 150, 39, 227, 139, 42, 146, 146, 104]), + Bytes32::new([7, 160, 246, 93, 64, 79, 76, 208, 66, 80, 60, 123, 13, 51, 115, 251, 196, 209, 145, 106, 61, 105, 136, 58, 7, 129, 142, 203, 205, 69, 45, 203]), + Bytes32::new([64, 162, 48, 187, 213, 182, 41, 85, 62, 148, 26, 161, 227, 108, 173, 249, 195, 106, 203, 18, 28, 59, 184, 85, 249, 16, 224, 222, 114, 200, 99, 22]), + Bytes32::new([246, 194, 74, 122, 165, 216, 211, 144, 101, 143, 134, 9, 53, 229, 197, 227, 121, 248, 89, 169, 48, 220, 104, 216, 117, 118, 36, 234, 108, 135, 81, 162]), + Bytes32::new([232, 59, 196, 2, 103, 242, 44, 129, 41, 231, 226, 115, 238, 151, 166, 210, 158, 110, 43, 45, 86, 163, 127, 8, 162, 81, 131, 145, 165, 252, 170, 12]), + Bytes32::new([204, 88, 102, 180, 241, 148, 27, 183, 223, 71, 157, 119, 155, 31, 102, 239, 4, 83, 204, 246, 38, 228, 234, 20, 97, 233, 203, 149, 186, 67, 143, 51]), + Bytes32::new([246, 170, 233, 8, 202, 38, 67, 219, 175, 13, 250, 174, 98, 36, 84, 166, 6, 75, 27, 43, 62, 128, 106, 23, 163, 191, 86, 115, 164, 50, 127, 151]), + Bytes32::new([204, 72, 199, 57, 106, 136, 244, 66, 217, 155, 183, 211, 166, 71, 140, 211, 210, 181, 178, 218, 204, 91, 200, 204, 153, 60, 22, 32, 24, 153, 131, 31]), + Bytes32::new([204, 193, 13, 167, 214, 136, 121, 99, 198, 137, 11, 223, 85, 40, 167, 126, 153, 80, 187, 35, 226, 31, 226, 42, 9, 175, 31, 206, 119, 67, 153, 39]), + Bytes32::new([63, 82, 16, 182, 255, 45, 123, 220, 252, 52, 199, 222, 76, 172, 123, 232, 133, 182, 143, 202, 223, 161, 203, 91, 239, 225, 123, 184, 231, 53, 19, 253]), + Bytes32::new([5, 13, 255, 217, 70, 105, 205, 70, 41, 25, 44, 3, 245, 136, 16, 255, 101, 61, 189, 225, 142, 201, 210, 226, 9, 237, 171, 109, 63, 204, 204, 139]), + Bytes32::new([161, 218, 126, 252, 32, 196, 32, 105, 98, 13, 201, 117, 64, 37, 232, 32, 159, 106, 48, 121, 250, 139, 219, 137, 129, 3, 83, 194, 102, 251, 148, 71]), + Bytes32::new([72, 17, 9, 21, 142, 89, 135, 91, 81, 155, 72, 247, 56, 232, 136, 57, 251, 182, 211, 35, 207, 169, 87, 123, 31, 222, 72, 85, 212, 92, 159, 171]), + Bytes32::new([193, 253, 238, 224, 198, 216, 154, 52, 59, 87, 183, 80, 242, 162, 238, 7, 218, 195, 253, 210, 92, 116, 43, 181, 109, 40, 74, 38, 154, 211, 102, 173]), + Bytes32::new([193, 88, 249, 81, 11, 128, 242, 239, 220, 1, 237, 199, 235, 12, 153, 73, 145, 158, 15, 111, 108, 244, 19, 51, 159, 206, 66, 25, 147, 215, 157, 165]), + Bytes32::new([195, 90, 0, 163, 8, 199, 55, 59, 47, 117, 186, 204, 5, 42, 205, 164, 239, 233, 203, 210, 69, 205, 244, 152, 113, 184, 206, 110, 101, 197, 120, 101]), + Bytes32::new([114, 169, 222, 11, 169, 15, 123, 245, 42, 25, 120, 198, 66, 140, 125, 123, 201, 107, 3, 50, 245, 226, 52, 46, 162, 44, 134, 157, 226, 11, 115, 186]), + Bytes32::new([6, 47, 131, 89, 216, 138, 92, 250, 126, 232, 238, 50, 181, 78, 69, 115, 227, 25, 49, 50, 116, 138, 47, 61, 179, 75, 121, 124, 127, 106, 228, 178]), + Bytes32::new([152, 253, 228, 228, 120, 255, 82, 66, 24, 145, 159, 223, 39, 185, 81, 201, 81, 110, 47, 57, 105, 128, 8, 42, 130, 119, 92, 7, 14, 247, 137, 135]), + Bytes32::new([162, 28, 11, 245, 48, 21, 8, 137, 161, 131, 84, 18, 129, 70, 197, 122, 165, 39, 71, 213, 142, 115, 159, 52, 46, 213, 81, 10, 217, 212, 74, 20]), + Bytes32::new([129, 250, 71, 119, 46, 25, 220, 212, 143, 120, 0, 101, 85, 101, 109, 107, 142, 20, 107, 174, 39, 134, 128, 244, 237, 155, 190, 19, 110, 10, 240, 94]), + Bytes32::new([90, 70, 190, 48, 191, 45, 227, 17, 185, 162, 159, 12, 18, 94, 186, 251, 252, 238, 95, 174, 253, 99, 194, 204, 5, 178, 117, 139, 50, 154, 93, 170]), + Bytes32::new([201, 8, 48, 126, 70, 22, 83, 82, 229, 84, 168, 86, 100, 169, 227, 175, 196, 154, 217, 150, 2, 36, 1, 100, 48, 216, 141, 205, 113, 148, 109, 126]), + Bytes32::new([16, 182, 10, 119, 255, 70, 127, 242, 64, 68, 67, 44, 52, 195, 63, 185, 227, 97, 138, 244, 53, 246, 110, 99, 41, 176, 146, 206, 81, 168, 66, 140]), + Bytes32::new([95, 9, 211, 227, 219, 119, 221, 132, 248, 92, 236, 190, 110, 227, 153, 109, 103, 63, 121, 221, 165, 212, 20, 141, 33, 95, 52, 157, 69, 76, 2, 70]), + Bytes32::new([216, 138, 115, 198, 102, 135, 226, 247, 235, 185, 206, 147, 130, 9, 48, 166, 92, 22, 41, 158, 169, 52, 233, 1, 60, 229, 165, 208, 60, 161, 194, 166]), + Bytes32::new([129, 241, 87, 138, 103, 241, 79, 26, 52, 35, 125, 237, 54, 147, 253, 137, 101, 146, 235, 127, 124, 113, 60, 203, 181, 4, 250, 12, 72, 27, 24, 7]), + Bytes32::new([52, 120, 68, 97, 147, 229, 251, 178, 161, 233, 142, 136, 38, 40, 85, 46, 121, 156, 115, 186, 72, 95, 128, 43, 252, 176, 176, 51, 113, 83, 154, 232]), + Bytes32::new([227, 11, 188, 57, 98, 160, 248, 247, 112, 49, 247, 92, 94, 224, 135, 182, 211, 230, 69, 185, 138, 154, 141, 157, 18, 34, 138, 236, 67, 243, 26, 132]), + Bytes32::new([61, 246, 31, 52, 44, 146, 190, 215, 214, 105, 253, 86, 172, 174, 140, 112, 30, 154, 82, 173, 62, 199, 157, 180, 255, 104, 73, 136, 163, 79, 210, 252]), + Bytes32::new([200, 155, 200, 87, 142, 123, 62, 176, 250, 44, 18, 238, 229, 121, 125, 109, 102, 173, 60, 203, 88, 65, 33, 122, 22, 111, 157, 143, 164, 7, 214, 26]), + Bytes32::new([179, 76, 168, 179, 139, 86, 151, 173, 26, 70, 236, 116, 202, 123, 63, 80, 106, 208, 63, 138, 179, 225, 114, 64, 48, 34, 78, 124, 132, 210, 224, 190]), + Bytes32::new([138, 116, 89, 240, 28, 79, 42, 149, 199, 118, 149, 49, 146, 212, 104, 62, 17, 137, 138, 223, 225, 187, 152, 43, 134, 60, 95, 55, 175, 128, 95, 144]), +]; + +const INSTRUCTION_HASHES: &[Bytes32; 64] = &[ + Bytes32::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::new([248, 140, 83, 29, 241, 220, 66, 40, 126, 248, 5, 153, 77, 179, 26, 64, 221, 108, 205, 162, 173, 52, 179, 140, 202, 105, 0, 170, 166, 130, 120, 176]), + Bytes32::new([35, 74, 103, 235, 245, 71, 66, 212, 99, 147, 15, 200, 1, 237, 95, 163, 10, 146, 122, 251, 243, 239, 93, 186, 46, 74, 206, 130, 63, 17, 199, 80]), + Bytes32::new([113, 169, 40, 37, 169, 205, 28, 78, 37, 104, 52, 28, 29, 222, 39, 32, 208, 183, 215, 38, 255, 69, 87, 70, 174, 113, 221, 183, 206, 62, 192, 118]), + Bytes32::new([1, 148, 183, 39, 234, 23, 138, 182, 169, 58, 52, 158, 248, 212, 186, 127, 60, 42, 25, 210, 20, 170, 182, 139, 20, 185, 196, 85, 241, 214, 181, 64]), + Bytes32::new([241, 14, 59, 8, 168, 222, 232, 125, 149, 227, 125, 41, 223, 198, 88, 135, 54, 146, 140, 212, 164, 76, 239, 106, 10, 20, 67, 180, 24, 159, 174, 99]), + Bytes32::new([117, 111, 220, 19, 204, 227, 211, 18, 61, 239, 179, 46, 142, 75, 67, 98, 159, 221, 205, 158, 125, 42, 221, 227, 148, 162, 193, 229, 147, 70, 214, 127]), + Bytes32::new([20, 72, 211, 188, 38, 126, 166, 75, 54, 22, 225, 21, 113, 155, 167, 89, 161, 6, 37, 78, 227, 211, 219, 141, 161, 199, 151, 122, 81, 45, 159, 187]), + Bytes32::new([69, 198, 100, 170, 106, 174, 208, 152, 152, 121, 118, 66, 111, 89, 131, 14, 159, 115, 142, 200, 205, 173, 89, 77, 68, 234, 5, 171, 105, 248, 199, 83]), + Bytes32::new([17, 1, 220, 13, 154, 194, 88, 60, 253, 223, 149, 35, 44, 184, 107, 141, 205, 177, 185, 32, 22, 99, 212, 96, 194, 91, 255, 179, 121, 153, 254, 40]), + Bytes32::new([222, 247, 186, 138, 222, 183, 135, 183, 170, 79, 182, 23, 69, 89, 70, 68, 88, 87, 235, 22, 178, 134, 114, 220, 249, 153, 70, 71, 229, 139, 10, 190]), + Bytes32::new([183, 77, 65, 51, 207, 78, 55, 149, 222, 3, 100, 82, 232, 230, 21, 115, 249, 177, 36, 89, 12, 41, 70, 31, 199, 254, 213, 3, 184, 2, 85, 137]), + Bytes32::new([82, 15, 215, 135, 95, 18, 143, 49, 239, 237, 6, 15, 213, 113, 153, 49, 149, 54, 50, 139, 100, 192, 128, 226, 168, 9, 120, 167, 157, 42, 45, 19]), + Bytes32::new([70, 32, 130, 243, 186, 144, 224, 217, 130, 222, 175, 221, 218, 190, 179, 222, 217, 115, 70, 160, 141, 231, 221, 96, 2, 173, 27, 17, 158, 66, 180, 58]), + Bytes32::new([76, 243, 65, 235, 12, 31, 48, 195, 62, 176, 202, 57, 99, 80, 237, 222, 138, 199, 124, 251, 143, 243, 205, 226, 18, 164, 67, 64, 68, 238, 53, 71]), + Bytes32::new([70, 52, 254, 193, 211, 92, 63, 238, 92, 2, 160, 29, 154, 25, 221, 136, 2, 49, 96, 27, 15, 152, 238, 57, 241, 253, 32, 131, 73, 38, 229, 243]), + Bytes32::new([214, 162, 82, 44, 146, 145, 61, 77, 36, 3, 131, 81, 217, 39, 127, 81, 66, 82, 172, 230, 246, 3, 243, 217, 210, 38, 201, 109, 240, 143, 253, 79]), + Bytes32::new([127, 18, 198, 116, 112, 141, 16, 39, 115, 118, 37, 208, 118, 119, 147, 46, 196, 124, 19, 196, 34, 183, 172, 157, 18, 91, 4, 210, 77, 195, 220, 59]), + Bytes32::new([87, 54, 42, 60, 39, 223, 84, 148, 158, 230, 70, 53, 191, 1, 108, 103, 139, 111, 58, 220, 114, 46, 46, 110, 20, 211, 84, 1, 173, 104, 175, 191]), + Bytes32::new([182, 147, 66, 127, 229, 144, 125, 93, 84, 220, 116, 107, 51, 13, 24, 161, 68, 172, 165, 50, 12, 198, 229, 173, 49, 26, 114, 159, 84, 190, 6, 42]), + Bytes32::new([183, 20, 36, 145, 76, 36, 61, 136, 224, 139, 89, 23, 124, 29, 210, 137, 1, 160, 22, 128, 48, 242, 234, 85, 84, 24, 206, 49, 143, 185, 237, 110]), + Bytes32::new([38, 19, 77, 150, 92, 129, 177, 155, 139, 162, 90, 91, 231, 146, 216, 21, 54, 152, 18, 5, 98, 21, 67, 160, 154, 113, 175, 65, 214, 78, 19, 97]), + Bytes32::new([163, 236, 47, 120, 121, 17, 217, 4, 200, 247, 206, 178, 211, 212, 163, 48, 38, 172, 111, 123, 75, 221, 63, 117, 42, 3, 252, 233, 104, 13, 210, 203]), + Bytes32::new([127, 106, 132, 246, 28, 129, 245, 83, 159, 109, 196, 219, 68, 81, 230, 77, 254, 166, 55, 73, 169, 179, 93, 97, 117, 176, 53, 74, 121, 238, 184, 240]), + Bytes32::new([255, 23, 108, 186, 145, 182, 196, 67, 163, 95, 173, 17, 67, 239, 199, 189, 145, 153, 120, 152, 159, 126, 255, 39, 55, 178, 230, 173, 91, 165, 229, 106]), + Bytes32::new([184, 156, 20, 114, 222, 219, 89, 218, 102, 62, 130, 200, 179, 237, 32, 237, 127, 75, 251, 163, 160, 2, 221, 34, 166, 30, 172, 97, 115, 137, 179, 175]), + Bytes32::new([244, 165, 127, 27, 66, 22, 38, 243, 235, 107, 30, 181, 31, 193, 210, 174, 254, 129, 39, 71, 59, 117, 186, 37, 217, 129, 138, 23, 146, 114, 96, 78]), + Bytes32::new([27, 57, 244, 93, 208, 90, 64, 181, 161, 110, 161, 188, 62, 180, 46, 103, 136, 233, 63, 1, 243, 202, 236, 206, 173, 45, 45, 218, 238, 184, 83, 121]), + Bytes32::new([138, 185, 33, 206, 120, 214, 246, 27, 100, 91, 106, 213, 60, 177, 39, 182, 149, 204, 11, 225, 254, 5, 87, 9, 19, 186, 166, 210, 33, 67, 146, 37]), + Bytes32::new([243, 161, 7, 52, 35, 240, 227, 144, 29, 50, 232, 3, 101, 174, 192, 139, 89, 75, 204, 245, 173, 55, 139, 76, 126, 19, 142, 18, 230, 57, 219, 227]), + Bytes32::new([97, 73, 36, 70, 120, 55, 49, 114, 107, 193, 66, 219, 47, 122, 201, 194, 52, 142, 12, 163, 108, 2, 107, 58, 185, 251, 168, 146, 57, 189, 150, 134]), + Bytes32::new([11, 215, 29, 229, 151, 208, 62, 1, 172, 253, 253, 156, 177, 31, 117, 214, 161, 192, 68, 255, 140, 131, 66, 23, 247, 161, 107, 98, 199, 57, 123, 110]), + Bytes32::new([41, 166, 54, 134, 242, 64, 153, 167, 5, 230, 226, 128, 71, 10, 251, 160, 19, 187, 70, 4, 95, 98, 77, 233, 181, 24, 11, 239, 142, 152, 229, 215]), + Bytes32::new([221, 220, 68, 168, 143, 124, 235, 77, 241, 190, 214, 6, 102, 40, 32, 245, 131, 114, 170, 151, 134, 49, 79, 57, 242, 124, 85, 172, 83, 81, 68, 99]), + Bytes32::new([142, 200, 102, 97, 170, 43, 14, 11, 139, 207, 150, 163, 99, 103, 2, 46, 44, 63, 109, 61, 62, 64, 199, 104, 36, 194, 155, 232, 139, 250, 97, 224]), + Bytes32::new([162, 15, 26, 217, 96, 195, 70, 196, 253, 70, 127, 156, 39, 120, 120, 232, 197, 154, 192, 147, 104, 33, 104, 189, 120, 160, 36, 129, 208, 237, 128, 23]), + Bytes32::new([42, 228, 74, 47, 20, 55, 197, 252, 173, 70, 178, 8, 2, 43, 97, 238, 155, 124, 87, 225, 217, 6, 103, 134, 136, 235, 193, 175, 33, 228, 219, 217]), + Bytes32::new([219, 143, 25, 70, 78, 155, 119, 63, 126, 20, 158, 54, 27, 181, 104, 184, 74, 192, 75, 157, 42, 204, 45, 122, 25, 248, 247, 24, 225, 207, 51, 251]), + Bytes32::new([151, 253, 36, 33, 104, 222, 126, 234, 112, 74, 59, 94, 239, 58, 36, 114, 90, 195, 208, 46, 250, 138, 165, 200, 178, 54, 238, 154, 219, 238, 6, 183]), + Bytes32::new([205, 57, 187, 174, 221, 9, 164, 77, 76, 143, 54, 212, 115, 196, 67, 182, 200, 147, 78, 194, 245, 92, 173, 114, 180, 160, 168, 5, 200, 82, 217, 64]), + Bytes32::new([211, 104, 62, 114, 157, 56, 254, 26, 32, 168, 208, 248, 62, 195, 142, 68, 53, 13, 7, 36, 216, 5, 127, 153, 97, 88, 222, 206, 91, 42, 14, 114]), + Bytes32::new([203, 158, 225, 200, 62, 223, 202, 52, 207, 179, 250, 236, 29, 144, 181, 31, 87, 192, 203, 66, 56, 39, 123, 25, 123, 157, 196, 161, 34, 245, 22, 130]), + Bytes32::new([147, 247, 233, 96, 190, 104, 227, 251, 99, 2, 16, 8, 77, 119, 1, 97, 243, 78, 103, 46, 24, 228, 217, 65, 219, 238, 135, 18, 164, 219, 132, 39]), + Bytes32::new([239, 153, 72, 139, 52, 60, 171, 44, 72, 218, 138, 124, 45, 30, 143, 122, 147, 158, 12, 62, 213, 151, 217, 217, 212, 51, 110, 75, 122, 67, 134, 80]), + Bytes32::new([46, 47, 130, 237, 178, 232, 239, 217, 165, 114, 255, 202, 132, 214, 18, 8, 72, 8, 255, 0, 162, 82, 5, 228, 141, 201, 70, 135, 255, 21, 220, 3]), + Bytes32::new([21, 11, 196, 5, 215, 241, 194, 200, 198, 129, 133, 244, 204, 47, 131, 70, 138, 38, 107, 39, 211, 243, 72, 72, 34, 145, 35, 42, 14, 69, 218, 227]), + Bytes32::new([73, 103, 117, 195, 67, 126, 242, 57, 232, 74, 142, 64, 169, 248, 113, 69, 110, 103, 127, 185, 177, 51, 212, 178, 48, 183, 247, 44, 246, 69, 35, 208]), + Bytes32::new([125, 8, 83, 22, 215, 82, 179, 234, 169, 227, 213, 39, 170, 164, 195, 187, 63, 38, 59, 146, 144, 101, 38, 0, 110, 212, 202, 20, 245, 105, 187, 201]), + Bytes32::new([186, 231, 186, 148, 68, 208, 226, 170, 120, 80, 68, 79, 23, 41, 51, 205, 240, 201, 10, 16, 24, 38, 137, 151, 7, 102, 92, 244, 3, 194, 228, 229]), + Bytes32::new([46, 8, 51, 150, 63, 114, 126, 210, 30, 130, 76, 142, 13, 149, 14, 0, 205, 199, 48, 90, 86, 75, 151, 135, 164, 224, 129, 77, 174, 194, 212, 112]), + Bytes32::new([150, 239, 42, 111, 3, 112, 25, 168, 179, 36, 106, 73, 212, 188, 215, 79, 180, 142, 191, 29, 219, 12, 244, 74, 254, 205, 160, 54, 68, 144, 81, 207]), + Bytes32::new([23, 164, 189, 201, 250, 65, 212, 148, 132, 125, 94, 209, 115, 123, 29, 66, 3, 172, 57, 58, 46, 191, 96, 7, 212, 25, 226, 79, 120, 68, 202, 210]), + Bytes32::new([252, 13, 137, 225, 208, 6, 84, 75, 97, 32, 177, 156, 248, 191, 113, 97, 254, 122, 86, 194, 3, 103, 219, 74, 227, 160, 231, 202, 13, 126, 46, 255]), + Bytes32::new([70, 35, 27, 128, 17, 79, 226, 131, 144, 118, 248, 125, 188, 110, 20, 15, 255, 73, 205, 69, 0, 227, 26, 66, 39, 61, 191, 224, 239, 234, 83, 170]), + Bytes32::new([129, 52, 148, 121, 230, 84, 28, 112, 75, 68, 181, 197, 80, 227, 107, 22, 60, 118, 81, 209, 198, 125, 233, 190, 84, 189, 18, 25, 72, 143, 2, 190]), + Bytes32::new([244, 237, 81, 131, 251, 35, 56, 158, 229, 102, 150, 122, 213, 206, 119, 38, 54, 238, 158, 159, 1, 214, 31, 147, 245, 9, 172, 247, 156, 115, 209, 140]), + Bytes32::new([47, 5, 174, 62, 80, 172, 77, 111, 136, 114, 188, 85, 249, 157, 182, 175, 187, 207, 29, 43, 152, 88, 130, 156, 138, 30, 188, 51, 82, 105, 145, 161]), + Bytes32::new([102, 2, 197, 195, 206, 149, 53, 224, 61, 219, 163, 246, 208, 218, 140, 47, 16, 42, 196, 20, 145, 158, 101, 31, 225, 135, 49, 68, 95, 5, 228, 92]), + Bytes32::new([78, 136, 176, 216, 253, 15, 136, 48, 162, 5, 57, 120, 93, 222, 179, 174, 129, 40, 8, 63, 18, 102, 97, 41, 58, 214, 1, 52, 58, 126, 186, 146]), + Bytes32::new([145, 56, 231, 59, 247, 191, 104, 137, 240, 113, 32, 245, 235, 129, 255, 54, 99, 176, 109, 175, 107, 232, 201, 235, 95, 104, 54, 67, 252, 184, 200, 54]), + Bytes32::new([181, 3, 229, 152, 113, 182, 55, 93, 138, 137, 21, 67, 27, 204, 96, 69, 72, 247, 237, 216, 28, 36, 115, 185, 111, 149, 224, 69, 66, 121, 188, 228]), + Bytes32::new([212, 25, 201, 68, 187, 25, 10, 96, 40, 88, 100, 216, 145, 200, 26, 203, 220, 14, 14, 11, 190, 62, 143, 137, 53, 208, 233, 158, 37, 34, 8, 15]), + Bytes32::new([80, 101, 192, 136, 203, 90, 189, 204, 181, 36, 28, 107, 220, 69, 119, 99, 145, 227, 198, 55, 37, 237, 212, 114, 31, 27, 19, 90, 231, 143, 87, 149]), + Bytes32::new([248, 97, 168, 33, 15, 230, 128, 82, 157, 26, 186, 89, 200, 7, 101, 210, 117, 111, 75, 233, 244, 187, 1, 180, 30, 220, 15, 21, 203, 5, 243, 223]), +]; + +const MEMORY_HASHES: &[Bytes32; 64] = &[ + Bytes32::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::new([66, 208, 130, 169, 194, 116, 5, 27, 68, 75, 235, 175, 164, 169, 41, 91, 88, 134, 51, 194, 219, 201, 182, 199, 1, 52, 173, 215, 20, 37, 51, 0]), + Bytes32::new([90, 210, 50, 227, 58, 173, 147, 92, 139, 15, 127, 190, 196, 111, 142, 207, 31, 223, 70, 96, 17, 251, 164, 200, 133, 0, 76, 35, 200, 9, 51, 218]), + Bytes32::new([97, 5, 162, 226, 92, 108, 172, 8, 7, 65, 104, 176, 216, 3, 144, 47, 14, 88, 50, 101, 194, 94, 10, 132, 192, 76, 37, 152, 42, 73, 30, 2]), + Bytes32::new([68, 59, 208, 14, 89, 37, 33, 1, 177, 225, 235, 66, 129, 28, 103, 156, 46, 206, 94, 141, 33, 152, 141, 26, 209, 161, 53, 237, 198, 163, 115, 57]), + Bytes32::new([28, 94, 12, 53, 70, 163, 95, 44, 168, 42, 196, 126, 181, 231, 174, 247, 89, 100, 77, 238, 211, 74, 116, 144, 183, 111, 254, 75, 30, 187, 228, 222]), + Bytes32::new([238, 133, 50, 189, 14, 89, 244, 88, 239, 50, 172, 85, 172, 1, 131, 2, 24, 161, 70, 94, 0, 204, 50, 199, 48, 107, 30, 70, 6, 8, 18, 90]), + Bytes32::new([165, 239, 71, 173, 192, 165, 25, 35, 4, 130, 148, 158, 177, 193, 129, 45, 115, 209, 7, 233, 136, 108, 245, 126, 74, 200, 22, 204, 190, 137, 191, 105]), + Bytes32::new([173, 102, 127, 73, 167, 249, 117, 26, 190, 231, 26, 60, 201, 138, 160, 182, 180, 44, 34, 132, 171, 254, 91, 8, 167, 114, 188, 157, 181, 148, 169, 165]), + Bytes32::new([71, 62, 70, 89, 203, 1, 105, 187, 178, 167, 217, 118, 42, 217, 154, 234, 238, 109, 145, 231, 247, 199, 40, 110, 162, 11, 173, 144, 103, 110, 99, 101]), + Bytes32::new([121, 36, 94, 4, 25, 134, 16, 98, 198, 109, 123, 42, 56, 151, 224, 7, 232, 155, 231, 154, 229, 162, 250, 149, 231, 198, 0, 65, 17, 27, 181, 28]), + Bytes32::new([247, 158, 162, 102, 242, 117, 166, 252, 175, 158, 107, 157, 244, 44, 17, 99, 93, 52, 43, 136, 5, 211, 32, 152, 91, 148, 41, 32, 231, 18, 237, 208]), + Bytes32::new([147, 52, 155, 255, 81, 242, 75, 54, 54, 66, 166, 41, 131, 177, 183, 151, 229, 177, 232, 86, 146, 137, 106, 68, 226, 117, 20, 210, 224, 170, 249, 68]), + Bytes32::new([160, 89, 180, 156, 119, 172, 38, 10, 97, 101, 64, 56, 98, 133, 199, 228, 58, 66, 139, 128, 88, 140, 143, 85, 148, 167, 79, 75, 34, 45, 204, 68]), + Bytes32::new([165, 233, 117, 3, 27, 56, 166, 16, 56, 132, 198, 32, 11, 149, 212, 98, 64, 236, 180, 106, 174, 80, 122, 220, 102, 67, 67, 110, 67, 8, 48, 217]), + Bytes32::new([113, 74, 209, 139, 250, 181, 182, 127, 178, 77, 17, 63, 79, 109, 145, 74, 52, 102, 125, 154, 22, 241, 177, 177, 34, 189, 124, 22, 4, 200, 201, 76]), + Bytes32::new([67, 7, 240, 151, 128, 149, 238, 113, 130, 127, 174, 223, 142, 124, 230, 10, 91, 89, 113, 157, 230, 21, 213, 3, 146, 249, 26, 80, 239, 90, 4, 216]), + Bytes32::new([152, 20, 80, 244, 232, 182, 1, 145, 31, 191, 46, 207, 83, 199, 209, 104, 0, 75, 106, 230, 16, 98, 121, 127, 175, 78, 119, 154, 69, 55, 66, 169]), + Bytes32::new([123, 50, 162, 158, 51, 112, 129, 232, 242, 158, 150, 72, 244, 40, 191, 63, 205, 61, 144, 39, 65, 122, 28, 88, 253, 146, 29, 29, 15, 40, 122, 95]), + Bytes32::new([231, 253, 202, 45, 165, 158, 212, 29, 104, 165, 209, 179, 188, 154, 89, 18, 216, 23, 140, 66, 150, 49, 99, 200, 163, 155, 50, 9, 250, 22, 19, 203]), + Bytes32::new([127, 172, 110, 243, 156, 134, 199, 15, 248, 216, 12, 196, 221, 66, 202, 186, 105, 197, 43, 245, 46, 116, 251, 133, 111, 118, 56, 214, 157, 244, 187, 58]), + Bytes32::new([181, 181, 163, 95, 7, 188, 245, 128, 161, 210, 137, 217, 103, 101, 120, 255, 47, 83, 102, 68, 238, 195, 206, 105, 24, 150, 216, 50, 74, 6, 94, 95]), + Bytes32::new([171, 250, 198, 40, 153, 26, 240, 152, 96, 169, 15, 123, 33, 155, 57, 172, 89, 205, 9, 65, 45, 126, 155, 143, 224, 145, 25, 214, 19, 227, 213, 195]), + Bytes32::new([44, 177, 244, 220, 119, 33, 203, 59, 209, 72, 28, 4, 210, 54, 86, 20, 119, 41, 45, 231, 143, 104, 57, 206, 212, 222, 81, 62, 92, 221, 200, 32]), + Bytes32::new([37, 200, 165, 195, 67, 224, 131, 227, 97, 54, 21, 233, 76, 186, 6, 122, 178, 131, 252, 59, 97, 218, 239, 62, 124, 255, 201, 178, 241, 236, 4, 214]), + Bytes32::new([77, 171, 229, 183, 46, 112, 203, 177, 89, 90, 64, 114, 109, 220, 32, 120, 41, 223, 72, 86, 59, 211, 110, 17, 129, 112, 194, 186, 200, 92, 144, 49]), + Bytes32::new([2, 198, 61, 112, 181, 185, 194, 114, 149, 63, 65, 76, 55, 179, 170, 62, 91, 112, 189, 100, 13, 34, 98, 187, 85, 132, 202, 86, 47, 27, 236, 200]), + Bytes32::new([164, 238, 109, 209, 155, 118, 236, 237, 84, 43, 56, 99, 51, 60, 116, 235, 100, 39, 163, 105, 34, 93, 8, 187, 228, 213, 35, 200, 43, 8, 32, 68]), + Bytes32::new([32, 220, 39, 200, 214, 245, 102, 200, 167, 204, 3, 54, 140, 126, 129, 35, 139, 60, 112, 133, 52, 166, 162, 63, 119, 20, 2, 116, 132, 244, 246, 225]), + Bytes32::new([5, 54, 145, 188, 188, 251, 36, 4, 103, 140, 229, 143, 83, 11, 77, 207, 57, 125, 51, 127, 89, 130, 138, 193, 190, 17, 17, 23, 68, 168, 231, 106]), + Bytes32::new([239, 112, 72, 74, 116, 134, 210, 24, 226, 242, 91, 113, 99, 59, 19, 7, 226, 215, 254, 220, 14, 225, 75, 245, 11, 234, 138, 52, 195, 86, 79, 124]), + Bytes32::new([187, 35, 132, 188, 162, 128, 96, 71, 124, 213, 251, 229, 73, 52, 187, 22, 166, 35, 214, 14, 121, 189, 37, 5, 77, 54, 201, 51, 95, 179, 75, 229]), + Bytes32::new([5, 54, 88, 42, 68, 200, 45, 209, 121, 70, 128, 8, 178, 212, 197, 39, 101, 90, 101, 111, 77, 133, 13, 77, 19, 111, 113, 122, 222, 85, 180, 82]), + Bytes32::new([34, 182, 144, 13, 35, 35, 79, 14, 239, 80, 21, 255, 67, 48, 210, 174, 159, 182, 239, 236, 68, 46, 125, 105, 243, 202, 218, 64, 53, 94, 159, 253]), + Bytes32::new([224, 189, 145, 186, 43, 169, 131, 161, 223, 161, 72, 72, 229, 97, 113, 233, 2, 250, 109, 31, 19, 125, 57, 135, 144, 3, 187, 18, 102, 108, 232, 9]), + Bytes32::new([68, 94, 11, 104, 95, 110, 179, 226, 157, 245, 113, 68, 44, 122, 17, 22, 244, 35, 248, 126, 131, 192, 20, 169, 129, 236, 60, 54, 157, 30, 231, 36]), + Bytes32::new([101, 198, 107, 156, 226, 8, 67, 168, 197, 91, 189, 166, 187, 16, 121, 93, 114, 243, 137, 162, 125, 142, 50, 206, 160, 168, 165, 27, 207, 10, 22, 19]), + Bytes32::new([222, 29, 134, 137, 98, 73, 58, 143, 166, 134, 210, 47, 68, 23, 214, 237, 241, 207, 226, 83, 113, 222, 184, 139, 16, 1, 200, 56, 34, 208, 197, 152]), + Bytes32::new([107, 200, 189, 222, 185, 32, 192, 130, 237, 238, 168, 137, 14, 94, 3, 26, 41, 238, 19, 119, 207, 158, 25, 177, 116, 70, 170, 161, 141, 129, 16, 88]), + Bytes32::new([131, 243, 131, 161, 236, 101, 108, 81, 59, 123, 150, 6, 250, 124, 103, 101, 75, 234, 98, 223, 129, 87, 202, 59, 184, 173, 44, 191, 200, 30, 223, 66]), + Bytes32::new([17, 226, 72, 31, 180, 33, 229, 83, 154, 39, 104, 45, 93, 117, 153, 249, 216, 127, 120, 182, 4, 19, 169, 87, 127, 70, 7, 237, 80, 251, 220, 126]), + Bytes32::new([88, 122, 134, 181, 173, 175, 100, 74, 28, 141, 45, 215, 245, 170, 222, 54, 106, 118, 146, 59, 207, 251, 133, 155, 164, 75, 240, 208, 10, 185, 187, 163]), + Bytes32::new([214, 1, 209, 99, 53, 101, 233, 225, 55, 171, 69, 200, 44, 144, 169, 11, 65, 85, 84, 158, 233, 227, 37, 59, 42, 52, 153, 13, 0, 158, 122, 208]), + Bytes32::new([124, 146, 1, 221, 33, 138, 233, 130, 184, 163, 121, 110, 95, 242, 123, 251, 110, 46, 41, 197, 75, 145, 121, 95, 29, 1, 19, 19, 167, 220, 177, 153]), + Bytes32::new([77, 38, 54, 170, 19, 128, 180, 248, 208, 75, 27, 53, 228, 104, 7, 216, 188, 186, 40, 84, 87, 11, 121, 3, 175, 89, 49, 46, 191, 94, 80, 97]), + Bytes32::new([134, 127, 37, 206, 212, 70, 146, 143, 81, 104, 140, 28, 135, 233, 171, 88, 18, 2, 148, 143, 111, 208, 149, 138, 167, 84, 183, 100, 67, 181, 243, 135]), + Bytes32::new([218, 16, 220, 189, 192, 237, 252, 168, 45, 33, 177, 81, 53, 115, 141, 190, 99, 138, 113, 85, 60, 230, 244, 222, 205, 16, 152, 26, 185, 207, 114, 143]), + Bytes32::new([9, 85, 193, 163, 186, 152, 83, 149, 29, 71, 50, 13, 175, 149, 184, 51, 246, 97, 20, 22, 57, 201, 27, 72, 146, 19, 213, 102, 164, 148, 176, 45]), + Bytes32::new([140, 94, 218, 31, 232, 0, 167, 218, 122, 119, 62, 179, 181, 51, 100, 6, 150, 159, 212, 207, 160, 94, 212, 108, 225, 196, 190, 210, 145, 110, 120, 114]), + Bytes32::new([152, 169, 229, 240, 162, 212, 61, 59, 167, 135, 124, 147, 212, 248, 177, 85, 243, 72, 150, 127, 122, 60, 143, 125, 226, 186, 67, 219, 50, 112, 242, 212]), + Bytes32::new([47, 244, 81, 140, 243, 189, 116, 0, 2, 158, 242, 188, 215, 90, 177, 37, 175, 221, 80, 226, 209, 79, 2, 62, 112, 245, 1, 132, 7, 78, 0, 117]), + Bytes32::new([247, 236, 252, 118, 6, 245, 132, 187, 48, 36, 77, 0, 167, 150, 109, 72, 234, 9, 224, 162, 223, 191, 21, 19, 180, 201, 138, 56, 109, 97, 152, 170]), + Bytes32::new([77, 23, 112, 52, 78, 204, 135, 173, 2, 206, 148, 200, 60, 155, 60, 179, 201, 111, 73, 138, 76, 104, 79, 174, 190, 173, 42, 51, 38, 48, 237, 241]), + Bytes32::new([117, 234, 73, 183, 4, 144, 12, 196, 78, 228, 178, 218, 206, 147, 147, 94, 190, 22, 22, 233, 88, 118, 135, 55, 63, 29, 212, 38, 223, 160, 121, 230]), + Bytes32::new([74, 138, 173, 10, 77, 129, 10, 115, 18, 90, 57, 215, 221, 171, 109, 152, 31, 219, 235, 122, 189, 201, 210, 186, 52, 200, 81, 218, 112, 79, 80, 54]), + Bytes32::new([189, 150, 224, 30, 110, 73, 249, 62, 100, 244, 206, 110, 206, 239, 233, 213, 61, 213, 65, 139, 103, 19, 20, 123, 167, 65, 161, 165, 216, 217, 255, 248]), + Bytes32::new([119, 71, 56, 219, 155, 139, 253, 40, 100, 132, 185, 98, 24, 34, 156, 225, 120, 176, 76, 147, 31, 105, 245, 216, 165, 161, 89, 157, 246, 17, 251, 234]), + Bytes32::new([192, 39, 162, 126, 222, 211, 173, 195, 198, 124, 1, 124, 140, 2, 252, 191, 185, 85, 10, 125, 226, 7, 88, 221, 164, 13, 221, 74, 200, 7, 249, 177]), + Bytes32::new([251, 226, 24, 5, 54, 89, 9, 93, 217, 202, 148, 172, 208, 197, 65, 172, 98, 96, 58, 194, 61, 253, 157, 193, 135, 32, 206, 97, 133, 234, 199, 197]), + Bytes32::new([130, 3, 195, 156, 210, 123, 23, 44, 223, 25, 153, 169, 250, 88, 127, 239, 206, 196, 156, 143, 182, 185, 35, 77, 162, 48, 143, 64, 231, 129, 216, 185]), + Bytes32::new([123, 201, 97, 230, 121, 13, 207, 138, 137, 3, 122, 92, 105, 155, 214, 204, 142, 18, 119, 138, 135, 165, 249, 58, 184, 53, 27, 31, 109, 214, 176, 147]), + Bytes32::new([46, 71, 246, 155, 247, 109, 236, 225, 147, 51, 250, 72, 97, 116, 162, 36, 115, 164, 80, 28, 252, 238, 98, 92, 16, 66, 190, 208, 180, 39, 179, 211]), + Bytes32::new([38, 76, 13, 227, 149, 18, 84, 170, 83, 231, 122, 59, 237, 66, 32, 171, 158, 251, 78, 156, 186, 160, 29, 30, 207, 178, 16, 193, 221, 158, 49, 48]), + Bytes32::new([166, 13, 210, 208, 250, 131, 27, 163, 99, 204, 199, 134, 152, 131, 28, 164, 8, 222, 176, 200, 34, 40, 74, 188, 120, 46, 167, 44, 95, 199, 86, 225]), +]; + +const TABLE_HASHES: &[Bytes32; 64] = &[ + Bytes32::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::new([164, 47, 121, 69, 150, 44, 30, 204, 210, 181, 242, 154, 59, 111, 5, 10, 47, 121, 213, 80, 163, 196, 205, 188, 241, 64, 202, 26, 242, 47, 50, 205]), + Bytes32::new([166, 9, 224, 145, 14, 138, 194, 78, 202, 114, 110, 38, 244, 33, 189, 185, 170, 85, 144, 229, 123, 63, 229, 194, 59, 130, 156, 6, 184, 154, 187, 17]), + Bytes32::new([32, 51, 186, 232, 39, 244, 218, 98, 243, 254, 82, 247, 63, 120, 34, 123, 128, 240, 220, 145, 41, 114, 251, 208, 209, 244, 10, 9, 179, 5, 105, 181]), + Bytes32::new([73, 148, 74, 132, 241, 45, 129, 169, 83, 223, 101, 12, 184, 60, 10, 201, 169, 197, 75, 17, 198, 168, 79, 171, 207, 195, 123, 47, 249, 30, 176, 216]), + Bytes32::new([145, 224, 51, 196, 211, 137, 189, 133, 232, 210, 170, 157, 227, 160, 218, 143, 15, 82, 170, 226, 241, 83, 7, 112, 138, 227, 58, 59, 149, 168, 81, 94]), + Bytes32::new([241, 90, 42, 7, 231, 63, 36, 86, 238, 131, 19, 20, 38, 118, 65, 180, 109, 121, 147, 147, 213, 142, 203, 244, 239, 75, 5, 160, 16, 85, 221, 95]), + Bytes32::new([213, 113, 178, 221, 213, 107, 77, 153, 222, 48, 148, 140, 250, 1, 17, 59, 73, 19, 110, 106, 94, 195, 126, 49, 126, 109, 65, 55, 104, 111, 18, 171]), + Bytes32::new([43, 198, 12, 197, 95, 201, 76, 108, 96, 235, 76, 8, 117, 99, 42, 20, 177, 45, 112, 40, 2, 180, 68, 19, 25, 11, 210, 168, 170, 178, 99, 27]), + Bytes32::new([142, 205, 24, 125, 81, 234, 138, 161, 206, 121, 163, 225, 50, 9, 180, 102, 0, 25, 93, 180, 137, 164, 206, 249, 222, 20, 175, 177, 199, 14, 115, 207]), + Bytes32::new([213, 41, 249, 19, 173, 165, 236, 103, 42, 146, 223, 6, 190, 229, 161, 13, 96, 163, 110, 23, 203, 238, 24, 95, 130, 203, 35, 211, 63, 234, 32, 137]), + Bytes32::new([176, 82, 229, 48, 113, 46, 179, 38, 231, 83, 50, 136, 179, 190, 242, 126, 152, 210, 141, 102, 191, 21, 20, 96, 235, 245, 81, 254, 231, 117, 159, 146]), + Bytes32::new([216, 15, 120, 147, 70, 215, 12, 160, 223, 73, 246, 73, 195, 189, 200, 3, 19, 131, 102, 61, 173, 79, 50, 76, 39, 150, 151, 147, 35, 251, 200, 0]), + Bytes32::new([88, 215, 168, 30, 218, 72, 206, 159, 91, 121, 14, 133, 241, 220, 195, 46, 93, 244, 179, 53, 158, 75, 211, 161, 8, 120, 167, 141, 235, 16, 232, 42]), + Bytes32::new([114, 99, 218, 52, 203, 162, 199, 16, 225, 154, 182, 20, 59, 121, 250, 249, 166, 35, 118, 18, 142, 57, 122, 131, 32, 219, 83, 126, 147, 91, 116, 16]), + Bytes32::new([193, 157, 15, 251, 179, 155, 215, 190, 98, 93, 30, 167, 23, 175, 178, 172, 142, 143, 222, 20, 18, 157, 215, 42, 105, 107, 64, 16, 216, 143, 109, 45]), + Bytes32::new([178, 2, 203, 32, 83, 90, 114, 97, 124, 210, 81, 81, 179, 213, 71, 19, 181, 173, 227, 88, 226, 83, 48, 169, 134, 163, 62, 103, 222, 82, 128, 30]), + Bytes32::new([252, 17, 142, 50, 185, 19, 111, 148, 204, 30, 199, 138, 143, 207, 30, 212, 254, 7, 129, 43, 100, 167, 52, 115, 247, 143, 64, 106, 220, 5, 7, 89]), + Bytes32::new([117, 136, 111, 98, 95, 97, 253, 43, 82, 22, 43, 187, 65, 154, 132, 105, 55, 194, 240, 148, 170, 199, 185, 91, 157, 138, 43, 117, 218, 176, 110, 101]), + Bytes32::new([228, 56, 186, 202, 73, 47, 253, 151, 48, 173, 2, 101, 153, 197, 108, 145, 227, 170, 247, 86, 80, 70, 30, 93, 232, 148, 63, 211, 197, 135, 23, 97]), + Bytes32::new([162, 35, 93, 45, 208, 241, 87, 57, 138, 79, 231, 83, 75, 81, 102, 91, 115, 58, 1, 205, 193, 197, 62, 210, 144, 88, 59, 52, 149, 234, 121, 224]), + Bytes32::new([165, 67, 16, 239, 234, 92, 207, 81, 64, 93, 227, 154, 132, 33, 54, 53, 102, 198, 90, 134, 24, 29, 190, 158, 121, 23, 127, 30, 27, 239, 140, 88]), + Bytes32::new([61, 125, 183, 139, 186, 82, 193, 166, 2, 147, 231, 215, 179, 107, 163, 67, 122, 0, 90, 188, 142, 216, 72, 20, 63, 146, 85, 89, 231, 41, 153, 117]), + Bytes32::new([206, 31, 38, 182, 78, 170, 183, 207, 211, 114, 212, 4, 108, 84, 62, 99, 245, 196, 10, 1, 188, 63, 240, 199, 27, 85, 68, 101, 212, 222, 85, 12]), + Bytes32::new([106, 0, 225, 130, 195, 87, 113, 106, 101, 80, 56, 119, 93, 45, 74, 168, 240, 209, 155, 123, 8, 129, 73, 225, 204, 125, 42, 73, 102, 122, 228, 158]), + Bytes32::new([251, 63, 88, 92, 59, 176, 71, 194, 46, 19, 18, 27, 83, 57, 197, 231, 202, 242, 155, 63, 252, 240, 205, 216, 96, 130, 161, 197, 123, 110, 175, 220]), + Bytes32::new([239, 6, 249, 150, 189, 234, 197, 18, 79, 222, 80, 72, 205, 147, 251, 135, 226, 33, 46, 111, 186, 185, 4, 33, 219, 129, 30, 182, 57, 229, 34, 16]), + Bytes32::new([192, 35, 149, 149, 16, 111, 3, 119, 173, 215, 223, 247, 70, 25, 31, 107, 104, 5, 249, 243, 193, 66, 99, 48, 107, 158, 25, 147, 163, 151, 96, 149]), + Bytes32::new([197, 133, 241, 197, 67, 52, 255, 227, 180, 235, 137, 164, 174, 160, 183, 9, 159, 254, 210, 180, 231, 140, 176, 165, 113, 215, 182, 1, 177, 204, 219, 246]), + Bytes32::new([51, 32, 109, 173, 131, 6, 99, 63, 75, 191, 207, 187, 73, 26, 5, 139, 167, 216, 123, 26, 199, 176, 84, 215, 158, 243, 105, 0, 91, 254, 59, 146]), + Bytes32::new([229, 120, 15, 22, 225, 50, 131, 240, 190, 232, 83, 119, 169, 246, 172, 35, 99, 163, 58, 146, 234, 253, 252, 83, 5, 48, 54, 142, 172, 91, 145, 13]), + Bytes32::new([159, 9, 100, 20, 215, 92, 217, 43, 208, 254, 65, 234, 124, 167, 250, 53, 159, 151, 124, 70, 26, 0, 113, 28, 78, 44, 238, 8, 34, 255, 19, 36]), + Bytes32::new([193, 135, 44, 144, 13, 46, 76, 43, 127, 208, 79, 196, 229, 58, 125, 33, 71, 118, 215, 240, 80, 123, 44, 181, 174, 47, 102, 42, 137, 98, 190, 41]), + Bytes32::new([78, 19, 3, 217, 174, 154, 142, 109, 189, 14, 241, 12, 23, 185, 224, 152, 209, 108, 223, 202, 191, 11, 190, 149, 31, 236, 104, 234, 22, 38, 196, 3]), + Bytes32::new([60, 93, 237, 228, 186, 222, 179, 231, 151, 95, 147, 20, 188, 10, 191, 34, 126, 57, 253, 161, 154, 117, 182, 108, 143, 72, 48, 102, 191, 240, 81, 208]), + Bytes32::new([179, 114, 163, 89, 172, 211, 154, 204, 11, 125, 140, 186, 107, 90, 17, 116, 214, 31, 165, 94, 36, 187, 184, 151, 210, 208, 76, 215, 75, 166, 107, 91]), + Bytes32::new([125, 131, 52, 139, 120, 156, 163, 243, 206, 143, 204, 221, 123, 140, 1, 103, 235, 186, 64, 82, 194, 191, 205, 2, 32, 242, 38, 77, 184, 23, 236, 228]), + Bytes32::new([137, 224, 90, 1, 116, 95, 215, 47, 8, 3, 227, 132, 154, 232, 216, 63, 3, 80, 52, 18, 42, 29, 85, 38, 117, 255, 9, 99, 88, 233, 129, 92]), + Bytes32::new([54, 182, 145, 174, 54, 24, 168, 13, 71, 43, 178, 49, 153, 246, 94, 79, 228, 254, 134, 0, 21, 210, 176, 242, 82, 117, 76, 40, 221, 181, 30, 62]), + Bytes32::new([145, 171, 156, 87, 15, 174, 31, 111, 175, 161, 31, 116, 123, 123, 37, 216, 43, 147, 197, 79, 218, 49, 236, 111, 35, 49, 44, 188, 197, 79, 136, 45]), + Bytes32::new([169, 48, 186, 93, 10, 48, 80, 103, 68, 226, 103, 31, 176, 154, 146, 199, 166, 89, 48, 149, 116, 101, 157, 149, 149, 72, 123, 54, 153, 26, 210, 122]), + Bytes32::new([225, 45, 163, 167, 213, 84, 40, 87, 106, 253, 206, 80, 189, 71, 153, 5, 15, 107, 151, 150, 14, 22, 143, 207, 4, 192, 63, 250, 207, 207, 179, 26]), + Bytes32::new([110, 249, 172, 218, 206, 202, 107, 64, 48, 153, 226, 127, 165, 227, 50, 146, 140, 239, 220, 252, 188, 157, 77, 210, 92, 73, 38, 6, 16, 87, 244, 66]), + Bytes32::new([39, 217, 230, 91, 60, 231, 96, 137, 37, 58, 93, 51, 79, 222, 132, 171, 196, 109, 155, 4, 252, 213, 17, 33, 160, 24, 250, 118, 187, 62, 107, 113]), + Bytes32::new([120, 167, 145, 121, 184, 31, 185, 178, 241, 54, 20, 48, 132, 89, 132, 127, 235, 189, 197, 127, 249, 58, 255, 197, 40, 229, 130, 254, 213, 186, 114, 74]), + Bytes32::new([7, 40, 187, 172, 225, 196, 3, 77, 113, 16, 118, 148, 95, 65, 42, 234, 233, 29, 120, 223, 105, 77, 250, 119, 245, 20, 21, 155, 177, 13, 56, 151]), + Bytes32::new([22, 248, 25, 75, 36, 179, 251, 57, 101, 170, 213, 19, 216, 64, 164, 253, 151, 199, 88, 5, 92, 129, 138, 185, 9, 236, 231, 68, 112, 24, 218, 216]), + Bytes32::new([95, 141, 49, 39, 213, 214, 130, 49, 143, 124, 178, 114, 200, 136, 160, 90, 233, 73, 233, 185, 60, 250, 174, 74, 2, 123, 2, 62, 192, 174, 115, 158]), + Bytes32::new([142, 29, 212, 35, 71, 107, 91, 164, 226, 225, 180, 218, 99, 34, 200, 171, 33, 235, 113, 105, 191, 78, 105, 70, 221, 135, 167, 148, 24, 225, 6, 146]), + Bytes32::new([176, 194, 115, 243, 138, 104, 3, 247, 184, 74, 81, 60, 173, 45, 29, 189, 252, 202, 206, 66, 129, 65, 150, 25, 246, 145, 133, 4, 93, 201, 201, 240]), + Bytes32::new([18, 233, 186, 158, 43, 12, 206, 228, 80, 102, 187, 25, 78, 77, 180, 28, 82, 62, 168, 252, 14, 113, 126, 91, 243, 120, 213, 91, 189, 244, 247, 177]), + Bytes32::new([79, 126, 97, 23, 112, 98, 93, 86, 24, 103, 82, 33, 155, 188, 202, 61, 29, 146, 132, 169, 116, 207, 216, 35, 29, 229, 213, 120, 135, 240, 129, 205]), + Bytes32::new([146, 121, 255, 202, 145, 53, 46, 8, 102, 205, 56, 234, 49, 42, 85, 231, 217, 114, 235, 141, 233, 187, 29, 9, 122, 232, 61, 253, 42, 104, 4, 113]), + Bytes32::new([103, 174, 255, 6, 115, 155, 156, 65, 84, 251, 208, 55, 89, 124, 171, 167, 133, 227, 22, 134, 32, 71, 243, 181, 16, 100, 81, 63, 22, 207, 58, 190]), + Bytes32::new([69, 10, 247, 243, 56, 0, 64, 72, 218, 21, 211, 192, 62, 243, 66, 244, 230, 58, 107, 54, 180, 29, 216, 23, 86, 211, 173, 181, 118, 188, 238, 72]), + Bytes32::new([25, 179, 4, 93, 169, 76, 76, 69, 158, 3, 24, 146, 130, 9, 225, 198, 102, 238, 29, 73, 74, 179, 159, 74, 40, 111, 181, 110, 76, 173, 251, 255]), + Bytes32::new([236, 113, 37, 202, 149, 150, 90, 50, 233, 141, 125, 12, 212, 163, 137, 176, 15, 214, 194, 73, 138, 104, 4, 33, 235, 76, 185, 58, 125, 182, 56, 0]), + Bytes32::new([238, 54, 183, 94, 50, 33, 98, 31, 133, 181, 230, 98, 43, 154, 95, 111, 250, 71, 15, 197, 156, 60, 8, 90, 208, 50, 62, 127, 30, 18, 181, 176]), + Bytes32::new([246, 143, 72, 228, 143, 15, 15, 131, 178, 105, 113, 46, 85, 36, 165, 116, 63, 131, 61, 228, 98, 144, 232, 209, 228, 110, 168, 171, 252, 47, 79, 165]), + Bytes32::new([146, 70, 74, 79, 139, 107, 73, 28, 231, 88, 235, 214, 163, 185, 87, 195, 147, 186, 153, 222, 191, 214, 30, 231, 173, 166, 151, 169, 244, 15, 15, 227]), + Bytes32::new([137, 182, 175, 97, 212, 23, 62, 70, 50, 150, 67, 153, 253, 52, 179, 105, 147, 177, 217, 170, 125, 251, 1, 96, 4, 127, 196, 37, 254, 7, 217, 100]), + Bytes32::new([32, 253, 229, 209, 120, 43, 120, 189, 245, 227, 178, 79, 134, 175, 240, 107, 25, 124, 5, 67, 120, 213, 187, 200, 159, 9, 26, 119, 13, 1, 8, 120]), + Bytes32::new([115, 241, 26, 44, 83, 229, 130, 21, 249, 87, 72, 212, 75, 220, 95, 22, 151, 77, 182, 8, 196, 207, 95, 18, 9, 92, 89, 206, 114, 80, 36, 159]), + Bytes32::new([174, 151, 88, 171, 52, 40, 161, 16, 106, 45, 44, 9, 142, 95, 5, 205, 82, 24, 172, 103, 152, 202, 187, 34, 217, 173, 236, 129, 32, 203, 205, 38]), +]; + +const TABLE_ELEMENT_HASHES: &[Bytes32; 64] = &[ + Bytes32::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::new([145, 218, 63, 74, 131, 182, 204, 163, 74, 206, 234, 50, 47, 3, 51, 74, 121, 225, 146, 237, 5, 128, 20, 230, 243, 89, 33, 248, 136, 154, 189, 5]), + Bytes32::new([36, 240, 95, 13, 214, 136, 92, 102, 96, 137, 39, 96, 108, 223, 147, 130, 220, 61, 147, 226, 52, 133, 67, 223, 211, 164, 6, 53, 45, 117, 120, 241]), + Bytes32::new([9, 2, 218, 34, 228, 8, 178, 127, 160, 30, 104, 198, 49, 37, 71, 115, 14, 35, 20, 15, 253, 160, 147, 143, 24, 186, 12, 90, 41, 169, 30, 8]), + Bytes32::new([137, 242, 105, 78, 161, 99, 76, 224, 226, 100, 216, 235, 156, 132, 214, 154, 107, 120, 197, 113, 45, 221, 170, 119, 92, 228, 76, 139, 170, 159, 111, 58]), + Bytes32::new([231, 165, 221, 185, 139, 22, 70, 40, 67, 162, 123, 94, 161, 156, 57, 53, 102, 217, 128, 227, 18, 132, 17, 170, 90, 31, 214, 181, 249, 220, 70, 37]), + Bytes32::new([171, 253, 174, 187, 9, 186, 87, 37, 22, 83, 13, 88, 75, 11, 177, 226, 237, 136, 132, 137, 101, 109, 135, 192, 224, 80, 87, 105, 95, 81, 255, 21]), + Bytes32::new([179, 50, 36, 230, 159, 162, 184, 132, 140, 121, 133, 155, 189, 44, 132, 93, 80, 79, 32, 244, 131, 57, 79, 222, 104, 63, 224, 182, 91, 162, 73, 122]), + Bytes32::new([17, 55, 206, 87, 127, 185, 135, 231, 41, 56, 166, 104, 229, 102, 222, 181, 236, 233, 230, 39, 43, 163, 16, 1, 225, 86, 211, 51, 145, 7, 169, 84]), + Bytes32::new([201, 174, 3, 154, 104, 190, 240, 99, 123, 201, 7, 118, 196, 85, 28, 247, 35, 232, 39, 25, 151, 52, 167, 136, 179, 13, 213, 60, 138, 158, 39, 131]), + Bytes32::new([35, 33, 109, 155, 171, 252, 195, 80, 10, 115, 40, 199, 250, 1, 241, 82, 146, 225, 118, 237, 11, 125, 198, 97, 57, 21, 171, 237, 94, 60, 49, 32]), + Bytes32::new([126, 95, 42, 157, 183, 168, 137, 120, 114, 64, 148, 170, 32, 156, 137, 96, 194, 91, 119, 11, 20, 3, 30, 62, 118, 12, 31, 48, 245, 144, 252, 29]), + Bytes32::new([48, 135, 201, 114, 103, 35, 8, 96, 5, 101, 125, 26, 87, 0, 98, 122, 239, 140, 230, 10, 102, 112, 155, 87, 249, 181, 152, 235, 28, 79, 176, 56]), + Bytes32::new([76, 70, 222, 210, 242, 159, 52, 123, 112, 106, 253, 140, 55, 160, 189, 255, 220, 64, 8, 168, 39, 196, 160, 8, 105, 154, 91, 184, 62, 63, 227, 156]), + Bytes32::new([138, 201, 8, 240, 218, 190, 210, 227, 236, 168, 45, 161, 209, 115, 126, 165, 235, 162, 6, 117, 76, 239, 3, 225, 163, 251, 111, 233, 233, 228, 14, 92]), + Bytes32::new([190, 166, 27, 117, 242, 0, 25, 148, 230, 125, 237, 22, 153, 158, 151, 56, 121, 194, 221, 198, 184, 147, 249, 149, 27, 29, 166, 243, 254, 181, 209, 102]), + Bytes32::new([235, 63, 149, 47, 164, 152, 80, 11, 178, 203, 99, 178, 176, 226, 164, 151, 39, 65, 83, 200, 102, 90, 12, 102, 178, 15, 232, 16, 222, 141, 78, 3]), + Bytes32::new([37, 179, 99, 114, 214, 120, 87, 53, 198, 229, 207, 47, 16, 112, 208, 33, 216, 152, 209, 228, 196, 14, 237, 250, 212, 90, 176, 185, 21, 248, 92, 109]), + Bytes32::new([237, 200, 122, 93, 145, 116, 138, 59, 86, 220, 58, 171, 160, 31, 142, 193, 231, 131, 106, 164, 166, 44, 120, 170, 62, 81, 73, 85, 0, 52, 219, 220]), + Bytes32::new([244, 173, 85, 141, 81, 198, 214, 0, 54, 21, 20, 169, 177, 235, 104, 206, 43, 218, 96, 68, 73, 37, 252, 77, 253, 18, 30, 97, 223, 122, 1, 12]), + Bytes32::new([104, 169, 247, 140, 131, 245, 193, 3, 36, 119, 249, 119, 108, 102, 115, 250, 173, 225, 33, 156, 116, 87, 180, 27, 84, 215, 126, 15, 187, 189, 32, 139]), + Bytes32::new([47, 156, 244, 88, 145, 227, 224, 87, 233, 138, 138, 9, 169, 96, 29, 204, 100, 170, 23, 105, 63, 4, 119, 90, 167, 161, 72, 109, 82, 254, 123, 48]), + Bytes32::new([196, 68, 107, 111, 141, 253, 138, 140, 162, 104, 247, 104, 87, 144, 123, 240, 105, 251, 246, 210, 172, 172, 241, 162, 155, 90, 83, 175, 131, 251, 107, 215]), + Bytes32::new([28, 100, 243, 226, 32, 234, 211, 106, 197, 179, 14, 192, 70, 11, 203, 125, 151, 53, 20, 77, 175, 99, 154, 100, 159, 249, 54, 39, 73, 168, 162, 66]), + Bytes32::new([83, 176, 7, 180, 201, 178, 172, 98, 47, 34, 80, 6, 62, 10, 4, 112, 43, 93, 10, 227, 74, 91, 11, 217, 83, 230, 104, 0, 167, 2, 114, 89]), + Bytes32::new([185, 162, 212, 82, 149, 182, 104, 215, 62, 244, 114, 124, 181, 74, 226, 119, 4, 42, 181, 238, 25, 212, 215, 219, 174, 231, 32, 170, 9, 234, 12, 212]), + Bytes32::new([173, 38, 241, 20, 137, 119, 33, 252, 174, 245, 252, 234, 165, 181, 128, 225, 14, 147, 182, 97, 145, 19, 40, 193, 90, 238, 140, 87, 0, 222, 70, 254]), + Bytes32::new([51, 218, 162, 213, 211, 23, 9, 158, 185, 156, 39, 145, 5, 146, 70, 144, 172, 10, 26, 212, 253, 37, 24, 32, 21, 65, 179, 140, 64, 237, 96, 157]), + Bytes32::new([221, 87, 57, 81, 246, 126, 53, 163, 190, 220, 109, 205, 114, 234, 85, 151, 75, 245, 254, 16, 140, 131, 239, 120, 9, 209, 54, 61, 177, 6, 188, 252]), + Bytes32::new([54, 161, 25, 198, 75, 151, 214, 76, 83, 74, 117, 229, 155, 237, 88, 95, 143, 119, 56, 12, 201, 164, 235, 20, 117, 49, 177, 88, 14, 248, 95, 198]), + Bytes32::new([60, 16, 183, 115, 241, 45, 253, 24, 105, 43, 79, 72, 212, 238, 24, 156, 132, 93, 78, 246, 1, 228, 222, 200, 254, 130, 170, 46, 91, 254, 205, 143]), + Bytes32::new([184, 30, 34, 235, 214, 40, 120, 64, 182, 15, 162, 189, 164, 202, 89, 146, 202, 177, 16, 105, 172, 158, 1, 95, 101, 146, 253, 115, 226, 233, 38, 171]), + Bytes32::new([70, 152, 3, 73, 249, 222, 93, 214, 74, 179, 140, 47, 34, 42, 149, 214, 152, 75, 34, 145, 68, 226, 151, 101, 121, 54, 252, 240, 206, 140, 81, 165]), + Bytes32::new([9, 88, 51, 124, 67, 108, 84, 244, 61, 241, 110, 246, 184, 105, 6, 116, 242, 58, 15, 144, 43, 76, 176, 107, 0, 138, 155, 235, 210, 138, 226, 215]), + Bytes32::new([98, 170, 168, 147, 158, 223, 186, 7, 58, 130, 89, 200, 153, 24, 158, 251, 69, 100, 7, 57, 96, 115, 136, 170, 57, 145, 143, 240, 102, 6, 248, 111]), + Bytes32::new([76, 75, 216, 216, 194, 146, 2, 59, 247, 64, 98, 160, 62, 105, 193, 186, 161, 191, 64, 154, 254, 196, 55, 214, 201, 103, 223, 131, 181, 192, 152, 176]), + Bytes32::new([188, 141, 114, 199, 33, 45, 183, 18, 123, 231, 92, 215, 51, 191, 11, 199, 253, 46, 28, 10, 156, 23, 92, 255, 219, 236, 176, 247, 52, 105, 210, 223]), + Bytes32::new([200, 67, 112, 29, 180, 70, 50, 18, 220, 122, 39, 122, 83, 186, 81, 77, 241, 44, 190, 3, 162, 217, 76, 61, 230, 237, 157, 230, 205, 172, 186, 247]), + Bytes32::new([131, 131, 129, 83, 251, 217, 83, 88, 93, 39, 66, 174, 51, 19, 190, 91, 16, 187, 95, 63, 35, 178, 94, 237, 194, 42, 231, 227, 138, 202, 216, 93]), + Bytes32::new([18, 177, 28, 41, 199, 59, 160, 244, 26, 162, 73, 48, 16, 74, 190, 195, 249, 216, 64, 229, 145, 65, 18, 131, 75, 57, 71, 74, 127, 239, 112, 13]), + Bytes32::new([41, 120, 53, 253, 151, 12, 143, 213, 212, 31, 245, 61, 168, 113, 30, 38, 112, 126, 156, 133, 241, 102, 110, 237, 4, 138, 50, 160, 79, 235, 52, 35]), + Bytes32::new([38, 74, 146, 27, 110, 86, 122, 250, 58, 243, 64, 185, 207, 174, 28, 124, 35, 183, 53, 88, 34, 234, 89, 58, 98, 223, 69, 13, 48, 15, 239, 230]), + Bytes32::new([221, 132, 1, 28, 157, 232, 235, 132, 32, 58, 26, 36, 60, 217, 197, 165, 141, 19, 64, 120, 197, 139, 190, 86, 153, 152, 235, 11, 99, 129, 222, 91]), + Bytes32::new([237, 76, 61, 239, 169, 108, 131, 62, 163, 67, 158, 210, 14, 45, 91, 105, 36, 182, 206, 182, 71, 11, 159, 169, 159, 248, 247, 176, 6, 176, 237, 123]), + Bytes32::new([232, 190, 198, 78, 12, 148, 86, 176, 221, 115, 1, 22, 122, 163, 223, 234, 74, 129, 125, 53, 211, 137, 115, 18, 241, 170, 69, 42, 34, 74, 180, 172]), + Bytes32::new([215, 199, 144, 158, 222, 153, 123, 125, 150, 97, 127, 151, 96, 43, 69, 155, 150, 119, 75, 82, 218, 48, 101, 70, 121, 18, 42, 146, 215, 183, 100, 158]), + Bytes32::new([121, 182, 45, 62, 255, 78, 32, 48, 107, 186, 208, 155, 158, 80, 231, 241, 90, 227, 219, 113, 52, 20, 66, 45, 124, 67, 209, 61, 167, 74, 60, 34]), + Bytes32::new([34, 136, 15, 103, 128, 220, 202, 103, 150, 123, 249, 145, 218, 227, 17, 64, 142, 129, 4, 42, 93, 7, 6, 147, 111, 117, 25, 185, 88, 104, 85, 115]), + Bytes32::new([144, 191, 235, 38, 205, 102, 127, 160, 139, 105, 75, 63, 86, 192, 194, 49, 240, 35, 65, 154, 4, 113, 51, 87, 40, 70, 32, 58, 243, 16, 136, 67]), + Bytes32::new([217, 150, 254, 250, 111, 69, 45, 227, 111, 59, 199, 149, 59, 216, 17, 117, 8, 226, 85, 250, 183, 187, 21, 129, 208, 0, 63, 158, 232, 106, 131, 16]), + Bytes32::new([148, 212, 84, 16, 204, 49, 69, 96, 137, 125, 102, 221, 111, 8, 41, 51, 221, 241, 87, 231, 88, 215, 211, 24, 254, 131, 111, 56, 160, 143, 230, 109]), + Bytes32::new([144, 48, 37, 157, 153, 7, 123, 206, 46, 224, 211, 249, 208, 217, 91, 243, 128, 62, 100, 126, 3, 253, 223, 161, 50, 108, 26, 151, 129, 242, 94, 132]), + Bytes32::new([97, 167, 177, 53, 183, 154, 164, 1, 129, 184, 234, 182, 190, 197, 244, 226, 150, 217, 57, 152, 243, 206, 60, 76, 114, 194, 51, 240, 58, 93, 219, 76]), + Bytes32::new([139, 70, 147, 227, 94, 147, 130, 53, 38, 112, 138, 176, 7, 148, 6, 21, 50, 199, 70, 33, 87, 180, 33, 167, 56, 89, 66, 95, 245, 247, 135, 24]), + Bytes32::new([175, 169, 204, 13, 145, 18, 40, 29, 84, 88, 206, 99, 208, 137, 249, 146, 0, 237, 188, 130, 135, 223, 121, 54, 126, 251, 247, 109, 141, 217, 62, 127]), + Bytes32::new([139, 188, 3, 234, 198, 124, 194, 238, 217, 237, 214, 250, 66, 220, 0, 51, 1, 203, 122, 125, 46, 213, 22, 253, 8, 218, 145, 253, 170, 156, 159, 96]), + Bytes32::new([107, 130, 208, 55, 16, 249, 46, 4, 98, 236, 130, 52, 190, 126, 232, 229, 108, 126, 239, 175, 25, 229, 84, 33, 249, 66, 128, 162, 47, 221, 110, 163]), + Bytes32::new([239, 176, 14, 134, 210, 125, 177, 40, 200, 42, 229, 32, 200, 58, 9, 73, 210, 161, 8, 105, 4, 70, 19, 134, 117, 132, 167, 18, 16, 108, 207, 113]), + Bytes32::new([237, 116, 250, 79, 151, 228, 171, 189, 89, 213, 122, 121, 55, 25, 52, 238, 79, 19, 31, 194, 73, 158, 43, 78, 86, 194, 36, 141, 105, 10, 87, 58]), + Bytes32::new([216, 125, 158, 123, 121, 158, 74, 152, 46, 18, 196, 115, 233, 149, 205, 189, 10, 232, 174, 21, 2, 52, 202, 111, 74, 160, 191, 196, 84, 93, 98, 46]), + Bytes32::new([201, 148, 124, 172, 62, 154, 127, 129, 205, 197, 134, 133, 144, 78, 47, 190, 197, 190, 103, 44, 129, 57, 155, 227, 152, 212, 130, 12, 192, 223, 244, 68]), + Bytes32::new([102, 147, 19, 104, 237, 188, 140, 66, 166, 77, 105, 55, 5, 165, 143, 107, 91, 247, 53, 203, 187, 163, 109, 66, 19, 164, 153, 170, 82, 251, 148, 10]), + Bytes32::new([33, 89, 246, 96, 201, 15, 77, 99, 252, 111, 250, 152, 124, 80, 50, 57, 197, 124, 254, 202, 246, 131, 11, 219, 249, 102, 35, 79, 100, 173, 146, 167]), + Bytes32::new([6, 27, 205, 165, 249, 112, 70, 105, 232, 156, 155, 204, 71, 5, 21, 239, 91, 69, 248, 111, 218, 154, 187, 85, 118, 72, 210, 99, 138, 40, 233, 75]), +]; + +const MODULE_HASHES: &[Bytes32; 64] = &[ + Bytes32::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), + Bytes32::new([252, 178, 61, 5, 174, 66, 106, 30, 131, 163, 114, 90, 231, 83, 228, 153, 108, 255, 60, 37, 254, 139, 153, 129, 208, 156, 109, 74, 233, 129, 174, 182]), + Bytes32::new([128, 23, 154, 62, 181, 220, 154, 183, 222, 214, 79, 76, 162, 169, 179, 162, 185, 93, 179, 115, 161, 55, 19, 63, 227, 168, 140, 66, 182, 6, 60, 120]), + Bytes32::new([243, 119, 126, 55, 151, 128, 119, 12, 124, 84, 146, 243, 156, 68, 82, 174, 201, 162, 29, 73, 29, 77, 103, 205, 194, 250, 45, 133, 39, 71, 224, 177]), + Bytes32::new([209, 179, 222, 187, 184, 84, 131, 182, 172, 78, 20, 104, 236, 246, 114, 74, 55, 98, 29, 34, 117, 249, 89, 76, 85, 38, 248, 193, 75, 10, 243, 100]), + Bytes32::new([195, 14, 58, 139, 148, 140, 218, 174, 131, 204, 69, 84, 127, 8, 142, 88, 136, 83, 253, 241, 74, 247, 143, 204, 38, 15, 138, 98, 47, 188, 255, 245]), + Bytes32::new([167, 4, 177, 126, 159, 76, 19, 220, 160, 159, 81, 227, 110, 147, 179, 175, 253, 187, 46, 24, 15, 168, 153, 84, 4, 167, 247, 225, 121, 175, 134, 85]), + Bytes32::new([237, 144, 152, 155, 211, 100, 202, 187, 41, 181, 45, 224, 143, 139, 18, 77, 110, 34, 212, 207, 239, 180, 73, 84, 166, 194, 22, 149, 89, 215, 86, 21]), + Bytes32::new([226, 192, 91, 176, 242, 185, 212, 189, 178, 80, 238, 252, 183, 82, 220, 242, 22, 237, 84, 142, 132, 91, 95, 219, 252, 171, 51, 76, 28, 146, 86, 155]), + Bytes32::new([199, 200, 237, 66, 220, 14, 221, 121, 117, 150, 118, 36, 138, 142, 50, 173, 12, 195, 131, 90, 27, 189, 247, 221, 89, 151, 41, 27, 135, 207, 137, 172]), + Bytes32::new([160, 60, 124, 200, 56, 240, 67, 161, 121, 95, 247, 51, 153, 249, 125, 88, 231, 2, 85, 167, 251, 187, 21, 103, 49, 132, 213, 52, 219, 30, 146, 59]), + Bytes32::new([123, 52, 142, 254, 117, 160, 215, 99, 155, 130, 134, 183, 76, 99, 166, 246, 49, 51, 142, 67, 116, 234, 69, 199, 201, 19, 70, 3, 208, 247, 40, 82]), + Bytes32::new([165, 32, 183, 79, 246, 224, 220, 103, 11, 160, 233, 66, 129, 238, 194, 73, 17, 37, 128, 185, 175, 88, 144, 228, 231, 185, 22, 17, 149, 174, 72, 1]), + Bytes32::new([12, 24, 45, 128, 57, 246, 187, 176, 154, 247, 169, 18, 116, 176, 70, 246, 203, 141, 211, 104, 5, 147, 78, 214, 161, 71, 33, 97, 7, 21, 158, 61]), + Bytes32::new([215, 18, 110, 29, 36, 34, 133, 219, 15, 204, 206, 158, 186, 213, 181, 41, 184, 160, 71, 165, 163, 121, 88, 106, 228, 58, 34, 105, 112, 168, 84, 123]), + Bytes32::new([6, 169, 156, 220, 55, 53, 26, 229, 104, 60, 113, 111, 153, 18, 251, 234, 179, 159, 56, 14, 112, 7, 144, 199, 45, 180, 116, 239, 21, 207, 173, 205]), + Bytes32::new([24, 172, 76, 192, 21, 91, 250, 75, 196, 119, 231, 221, 13, 239, 113, 39, 62, 40, 165, 26, 245, 16, 61, 106, 39, 28, 78, 212, 249, 230, 84, 108]), + Bytes32::new([248, 34, 1, 62, 213, 235, 20, 21, 220, 78, 178, 126, 184, 102, 242, 50, 49, 174, 163, 122, 166, 96, 40, 110, 78, 199, 89, 158, 155, 251, 233, 49]), + Bytes32::new([103, 54, 133, 19, 189, 117, 46, 209, 17, 2, 64, 251, 77, 195, 197, 91, 38, 48, 214, 36, 96, 255, 133, 87, 244, 101, 166, 218, 167, 129, 225, 167]), + Bytes32::new([196, 159, 226, 85, 100, 246, 179, 251, 133, 33, 114, 51, 104, 245, 81, 54, 137, 126, 245, 76, 112, 146, 139, 185, 190, 19, 106, 132, 48, 203, 34, 237]), + Bytes32::new([41, 190, 7, 23, 227, 80, 13, 134, 244, 18, 215, 148, 1, 72, 1, 22, 91, 165, 182, 69, 160, 179, 241, 106, 254, 116, 245, 131, 136, 35, 190, 226]), + Bytes32::new([205, 132, 211, 121, 67, 210, 191, 102, 218, 92, 56, 204, 68, 160, 188, 100, 229, 80, 77, 27, 26, 86, 248, 86, 216, 39, 242, 211, 183, 139, 219, 83]), + Bytes32::new([13, 215, 68, 100, 180, 74, 23, 58, 157, 140, 76, 31, 114, 254, 85, 78, 234, 40, 251, 199, 35, 204, 111, 243, 163, 64, 221, 21, 96, 55, 127, 118]), + Bytes32::new([225, 14, 246, 105, 64, 96, 225, 200, 186, 66, 40, 253, 131, 80, 102, 178, 83, 22, 150, 32, 15, 139, 76, 172, 144, 3, 30, 43, 217, 213, 89, 43]), + Bytes32::new([200, 83, 93, 27, 98, 246, 87, 100, 53, 166, 89, 138, 157, 88, 148, 245, 61, 115, 246, 20, 142, 156, 54, 237, 179, 64, 148, 218, 67, 5, 142, 248]), + Bytes32::new([159, 25, 150, 25, 114, 252, 162, 57, 21, 125, 147, 111, 220, 117, 17, 107, 40, 21, 157, 183, 6, 63, 226, 37, 64, 179, 133, 58, 107, 245, 78, 14]), + Bytes32::new([58, 243, 16, 193, 174, 42, 255, 46, 40, 128, 26, 167, 173, 164, 71, 226, 155, 205, 26, 127, 154, 24, 74, 244, 106, 251, 25, 221, 197, 176, 194, 17]), + Bytes32::new([51, 47, 251, 206, 27, 9, 142, 27, 253, 132, 189, 62, 109, 150, 246, 2, 137, 90, 157, 185, 59, 96, 0, 154, 29, 17, 231, 3, 84, 95, 49, 51]), + Bytes32::new([250, 158, 158, 248, 206, 150, 95, 254, 53, 140, 80, 102, 67, 26, 76, 127, 236, 86, 182, 120, 72, 239, 190, 118, 60, 77, 28, 82, 152, 234, 73, 201]), + Bytes32::new([255, 137, 155, 144, 74, 231, 231, 43, 187, 202, 137, 66, 205, 37, 40, 225, 0, 33, 87, 137, 113, 163, 58, 64, 147, 74, 123, 128, 19, 156, 46, 83]), + Bytes32::new([207, 61, 79, 4, 202, 96, 238, 144, 154, 230, 145, 65, 230, 130, 246, 10, 140, 71, 66, 246, 53, 230, 148, 1, 248, 103, 145, 149, 157, 38, 169, 8]), + Bytes32::new([33, 168, 110, 82, 84, 151, 70, 98, 115, 2, 221, 116, 210, 10, 247, 189, 203, 245, 186, 86, 121, 142, 218, 95, 68, 241, 21, 219, 131, 241, 185, 203]), + Bytes32::new([125, 247, 7, 149, 181, 71, 68, 141, 123, 207, 144, 83, 170, 27, 244, 37, 210, 148, 0, 140, 144, 159, 237, 216, 227, 247, 85, 229, 80, 174, 40, 48]), + Bytes32::new([0, 205, 68, 89, 77, 97, 204, 140, 113, 244, 168, 76, 49, 137, 236, 21, 132, 99, 10, 206, 195, 206, 208, 120, 227, 77, 21, 223, 145, 227, 48, 139]), + Bytes32::new([10, 153, 106, 155, 149, 65, 211, 247, 246, 5, 129, 126, 74, 14, 113, 168, 152, 154, 205, 139, 49, 2, 182, 65, 163, 15, 62, 126, 62, 16, 26, 36]), + Bytes32::new([24, 251, 204, 187, 179, 146, 114, 66, 110, 182, 131, 248, 36, 170, 169, 128, 22, 221, 134, 193, 121, 189, 128, 94, 83, 255, 226, 37, 133, 83, 220, 181]), + Bytes32::new([25, 52, 245, 155, 53, 39, 73, 130, 12, 73, 106, 255, 44, 204, 208, 41, 32, 126, 159, 98, 197, 67, 58, 90, 6, 146, 25, 166, 195, 194, 215, 70]), + Bytes32::new([194, 167, 206, 222, 96, 6, 86, 241, 95, 105, 225, 147, 99, 93, 201, 220, 166, 145, 4, 25, 168, 188, 21, 168, 80, 163, 132, 216, 239, 19, 115, 36]), + Bytes32::new([243, 16, 4, 9, 140, 42, 62, 105, 97, 7, 4, 234, 200, 227, 42, 10, 51, 167, 38, 148, 69, 154, 143, 179, 94, 177, 248, 28, 33, 61, 166, 187]), + Bytes32::new([156, 201, 97, 197, 223, 83, 229, 186, 187, 33, 49, 210, 181, 222, 180, 234, 150, 33, 99, 168, 157, 26, 241, 1, 213, 220, 165, 8, 31, 76, 134, 243]), + Bytes32::new([34, 218, 29, 74, 212, 218, 95, 6, 53, 10, 63, 174, 119, 90, 90, 35, 92, 124, 169, 222, 75, 61, 199, 118, 132, 40, 193, 9, 250, 80, 12, 197]), + Bytes32::new([102, 137, 75, 155, 181, 222, 86, 192, 140, 167, 3, 178, 212, 165, 49, 163, 86, 8, 76, 240, 32, 202, 34, 159, 217, 173, 101, 125, 237, 34, 48, 179]), + Bytes32::new([136, 53, 156, 19, 107, 234, 210, 218, 180, 236, 9, 7, 80, 63, 146, 57, 77, 106, 135, 64, 23, 184, 9, 139, 61, 237, 225, 157, 183, 182, 137, 31]), + Bytes32::new([237, 226, 115, 218, 228, 122, 45, 46, 67, 21, 130, 204, 80, 2, 28, 47, 148, 191, 28, 33, 177, 47, 207, 14, 33, 117, 28, 46, 88, 254, 97, 227]), + Bytes32::new([38, 87, 252, 28, 105, 20, 117, 29, 234, 237, 60, 91, 48, 101, 219, 219, 24, 52, 169, 243, 71, 214, 117, 41, 207, 17, 148, 77, 218, 44, 122, 167]), + Bytes32::new([235, 31, 185, 222, 3, 22, 222, 174, 126, 128, 55, 67, 201, 229, 55, 28, 241, 144, 184, 85, 141, 153, 183, 211, 66, 80, 152, 248, 214, 130, 64, 205]), + Bytes32::new([52, 169, 226, 179, 195, 44, 245, 101, 35, 92, 145, 174, 152, 212, 192, 148, 241, 72, 248, 61, 239, 124, 98, 213, 181, 75, 84, 121, 57, 90, 172, 164]), + Bytes32::new([27, 19, 12, 74, 128, 193, 65, 63, 15, 6, 174, 167, 79, 56, 88, 13, 117, 6, 189, 14, 11, 13, 133, 136, 141, 64, 74, 17, 159, 192, 251, 242]), + Bytes32::new([101, 69, 132, 221, 127, 162, 162, 92, 248, 131, 39, 52, 169, 170, 231, 137, 123, 106, 161, 16, 202, 242, 216, 245, 211, 170, 74, 128, 108, 243, 166, 38]), + Bytes32::new([157, 82, 193, 234, 117, 199, 118, 245, 63, 31, 186, 32, 135, 233, 29, 213, 217, 119, 208, 64, 149, 116, 117, 129, 211, 225, 207, 22, 225, 99, 194, 222]), + Bytes32::new([112, 194, 64, 229, 154, 223, 109, 8, 191, 120, 32, 176, 154, 7, 174, 103, 2, 156, 230, 164, 245, 252, 0, 116, 213, 40, 20, 239, 135, 62, 198, 42]), + Bytes32::new([32, 91, 5, 170, 221, 134, 167, 144, 16, 130, 237, 114, 71, 184, 131, 223, 92, 149, 161, 68, 196, 56, 73, 148, 203, 187, 174, 178, 178, 53, 156, 177]), + Bytes32::new([234, 97, 64, 211, 81, 59, 14, 249, 38, 8, 247, 37, 243, 37, 88, 234, 19, 54, 146, 63, 88, 79, 127, 190, 144, 51, 240, 19, 15, 143, 18, 9]), + Bytes32::new([247, 102, 43, 28, 24, 201, 189, 198, 66, 58, 210, 51, 174, 234, 52, 239, 37, 83, 212, 184, 127, 170, 168, 127, 47, 11, 248, 213, 84, 3, 201, 181]), + Bytes32::new([126, 18, 116, 33, 129, 25, 247, 2, 162, 202, 103, 201, 237, 67, 28, 80, 46, 182, 163, 239, 90, 204, 47, 196, 137, 79, 19, 165, 209, 84, 140, 132]), + Bytes32::new([189, 160, 148, 101, 82, 248, 215, 206, 90, 91, 205, 148, 37, 38, 172, 82, 223, 228, 66, 173, 220, 246, 194, 73, 231, 17, 220, 47, 222, 175, 7, 24]), + Bytes32::new([237, 149, 54, 210, 99, 72, 182, 55, 69, 140, 161, 215, 104, 90, 104, 26, 216, 241, 232, 210, 37, 77, 56, 216, 6, 160, 199, 247, 164, 227, 142, 255]), + Bytes32::new([11, 57, 131, 77, 203, 89, 156, 126, 200, 215, 103, 209, 70, 235, 78, 247, 0, 126, 209, 248, 220, 135, 158, 244, 141, 74, 6, 158, 19, 37, 42, 39]), + Bytes32::new([107, 131, 231, 102, 64, 182, 78, 253, 77, 143, 94, 34, 199, 93, 44, 131, 169, 211, 71, 223, 53, 230, 59, 107, 146, 22, 188, 207, 210, 220, 168, 129]), + Bytes32::new([78, 71, 246, 216, 154, 188, 152, 6, 234, 254, 21, 1, 128, 148, 56, 91, 250, 95, 76, 103, 15, 250, 137, 186, 114, 254, 122, 69, 208, 242, 69, 111]), + Bytes32::new([82, 241, 242, 155, 248, 109, 84, 118, 225, 255, 122, 40, 3, 87, 20, 223, 212, 205, 141, 178, 32, 229, 234, 146, 101, 73, 79, 55, 28, 82, 81, 178]), + Bytes32::new([35, 169, 243, 198, 215, 220, 113, 91, 6, 79, 48, 201, 97, 143, 212, 34, 247, 46, 38, 93, 166, 213, 158, 218, 61, 86, 240, 149, 224, 174, 225, 73]), + Bytes32::new([25, 108, 21, 212, 193, 192, 96, 39, 57, 72, 193, 99, 239, 0, 231, 83, 183, 195, 105, 33, 220, 187, 18, 148, 43, 30, 42, 127, 192, 240, 13, 224]), + Bytes32::new([119, 117, 186, 31, 43, 128, 143, 25, 182, 135, 156, 58, 152, 81, 70, 116, 171, 137, 125, 157, 152, 163, 34, 65, 240, 178, 12, 24, 168, 111, 39, 35]), +]; -lazy_static! { - pub static ref ZERO_HASHES: HashMap> = { - let mut zero_hashes = HashMap::new(); - zero_hashes.insert(MerkleType::Value, vec![ - Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::from([119, 47, 167, 222, 218, 156, 26, 105, 57, 248, 170, 182, 183, 151, 18, 150, 142, 70, 138, 253, 54, 123, 132, 86, 170, 76, 157, 52, 113, 138, 253, 254]), - Bytes32::from([8, 117, 27, 211, 196, 42, 6, 98, 185, 88, 231, 145, 14, 3, 207, 145, 158, 255, 69, 52, 198, 196, 148, 154, 59, 94, 229, 157, 93, 51, 200, 69]), - Bytes32::from([247, 208, 196, 206, 204, 168, 129, 100, 238, 95, 52, 26, 132, 138, 233, 149, 196, 72, 179, 226, 60, 114, 27, 94, 173, 189, 197, 100, 163, 232, 180, 63]), - Bytes32::from([178, 100, 198, 112, 40, 33, 187, 175, 130, 245, 59, 210, 133, 234, 158, 158, 133, 64, 213, 72, 222, 157, 216, 42, 210, 134, 36, 13, 211, 156, 163, 211]), - Bytes32::from([203, 127, 32, 130, 225, 40, 219, 15, 35, 236, 47, 201, 161, 48, 53, 145, 134, 169, 109, 29, 26, 29, 178, 201, 118, 217, 57, 165, 116, 172, 232, 4]), - Bytes32::from([209, 109, 33, 102, 227, 251, 133, 224, 170, 130, 65, 90, 185, 209, 146, 77, 244, 145, 181, 206, 159, 70, 209, 64, 241, 19, 149, 223, 138, 31, 163, 61]), - Bytes32::from([145, 168, 124, 48, 254, 12, 34, 41, 4, 213, 245, 86, 61, 29, 177, 192, 67, 165, 237, 236, 87, 126, 193, 191, 15, 126, 104, 173, 165, 186, 1, 107]), - Bytes32::from([235, 161, 247, 143, 69, 95, 210, 40, 243, 76, 102, 29, 118, 86, 180, 54, 81, 144, 103, 54, 202, 164, 81, 83, 180, 90, 154, 184, 54, 28, 7, 220]), - Bytes32::from([203, 62, 12, 83, 35, 122, 214, 199, 125, 61, 236, 8, 253, 64, 145, 34, 127, 116, 217, 118, 245, 107, 15, 81, 9, 7, 31, 154, 89, 28, 123, 132]), - Bytes32::from([222, 94, 234, 109, 142, 74, 142, 176, 248, 3, 172, 30, 204, 138, 241, 195, 121, 232, 104, 219, 32, 54, 240, 77, 125, 247, 70, 137, 80, 46, 221, 247]), - Bytes32::from([162, 122, 237, 101, 178, 31, 12, 62, 50, 133, 242, 82, 111, 215, 166, 136, 138, 185, 72, 220, 163, 58, 58, 97, 6, 97, 167, 114, 179, 227, 19, 170]), - Bytes32::from([67, 251, 144, 11, 175, 194, 149, 65, 173, 179, 69, 140, 213, 191, 133, 59, 81, 175, 161, 115, 252, 125, 232, 150, 52, 241, 102, 164, 122, 32, 70, 229]), - Bytes32::from([249, 161, 115, 93, 215, 247, 145, 182, 75, 191, 48, 38, 123, 220, 232, 47, 246, 46, 81, 164, 98, 41, 141, 249, 137, 173, 93, 213, 96, 15, 151, 245]), - Bytes32::from([222, 93, 144, 194, 107, 42, 144, 4, 242, 153, 203, 176, 146, 242, 94, 72, 9, 222, 194, 2, 73, 200, 167, 147, 106, 9, 67, 73, 59, 127, 174, 178]), - Bytes32::from([56, 228, 248, 59, 153, 215, 120, 224, 111, 48, 159, 82, 171, 227, 93, 214, 208, 151, 78, 67, 112, 31, 218, 94, 219, 3, 79, 250, 227, 24, 222, 207]), - Bytes32::from([26, 171, 68, 22, 162, 195, 65, 97, 219, 55, 51, 46, 178, 6, 247, 65, 123, 219, 128, 86, 193, 3, 253, 0, 239, 228, 187, 94, 184, 240, 67, 11]), - Bytes32::from([250, 36, 5, 131, 94, 0, 99, 187, 112, 155, 252, 52, 68, 236, 185, 152, 93, 239, 0, 185, 101, 101, 182, 92, 112, 5, 67, 55, 121, 203, 100, 245]), - Bytes32::from([208, 57, 149, 71, 227, 213, 246, 213, 175, 88, 95, 238, 93, 122, 168, 223, 149, 84, 30, 89, 98, 228, 113, 72, 90, 48, 112, 171, 231, 67, 113, 216]), - Bytes32::from([125, 48, 157, 119, 154, 38, 14, 211, 223, 68, 87, 187, 159, 126, 234, 72, 84, 60, 236, 237, 227, 130, 87, 43, 217, 105, 81, 196, 159, 238, 240, 10]), - Bytes32::from([141, 217, 59, 213, 245, 231, 7, 85, 178, 197, 115, 188, 31, 49, 126, 237, 83, 199, 56, 196, 133, 169, 239, 218, 90, 131, 178, 70, 126, 132, 114, 186]), - Bytes32::from([18, 2, 140, 12, 121, 238, 8, 160, 7, 208, 89, 194, 105, 136, 211, 58, 179, 200, 226, 138, 186, 242, 4, 237, 18, 113, 131, 135, 31, 222, 28, 195]), - Bytes32::from([156, 222, 183, 39, 119, 110, 130, 60, 33, 221, 36, 39, 223, 155, 33, 2, 71, 32, 209, 25, 194, 172, 209, 1, 40, 105, 235, 140, 160, 18, 63, 168]), - Bytes32::from([211, 210, 123, 27, 217, 111, 97, 42, 167, 191, 112, 239, 66, 42, 199, 131, 124, 213, 89, 56, 92, 245, 166, 238, 185, 42, 48, 2, 113, 255, 156, 7]), - Bytes32::from([66, 255, 87, 69, 86, 6, 54, 162, 162, 5, 93, 138, 194, 194, 151, 195, 57, 155, 58, 17, 21, 149, 77, 2, 134, 107, 125, 54, 220, 247, 160, 209]), - Bytes32::from([169, 216, 13, 41, 251, 216, 191, 87, 91, 55, 236, 6, 242, 103, 98, 209, 46, 202, 29, 55, 2, 50, 233, 76, 107, 92, 82, 156, 113, 226, 78, 211]), - Bytes32::from([88, 189, 113, 129, 119, 11, 141, 60, 128, 134, 113, 107, 7, 186, 81, 200, 14, 76, 197, 14, 96, 19, 247, 220, 95, 62, 81, 153, 61, 231, 26, 86]), - Bytes32::from([41, 214, 41, 96, 151, 11, 231, 7, 203, 70, 242, 156, 247, 133, 49, 223, 254, 164, 202, 154, 188, 104, 124, 120, 225, 229, 148, 203, 141, 218, 228, 56]), - Bytes32::from([181, 157, 136, 110, 158, 152, 105, 61, 125, 220, 32, 180, 53, 115, 155, 189, 91, 152, 96, 172, 7, 121, 65, 143, 82, 180, 3, 69, 118, 219, 31, 244]), - Bytes32::from([29, 12, 159, 30, 12, 37, 126, 102, 218, 149, 67, 116, 182, 125, 134, 208, 184, 199, 181, 191, 87, 144, 48, 150, 87, 67, 222, 218, 254, 118, 12, 160]), - Bytes32::from([193, 249, 209, 245, 102, 95, 15, 55, 160, 156, 203, 160, 49, 198, 203, 30, 99, 172, 89, 92, 235, 89, 131, 205, 53, 254, 219, 168, 202, 195, 10, 242]), - Bytes32::from([131, 64, 102, 7, 226, 96, 60, 111, 221, 120, 41, 86, 239, 157, 121, 38, 57, 244, 221, 55, 32, 237, 13, 20, 244, 238, 133, 189, 89, 118, 204, 247]), - Bytes32::from([239, 211, 89, 185, 191, 211, 243, 207, 134, 159, 59, 19, 87, 254, 115, 27, 152, 156, 120, 226, 39, 63, 155, 51, 77, 130, 162, 63, 16, 43, 112, 121]), - Bytes32::from([10, 146, 190, 23, 235, 67, 23, 169, 33, 140, 54, 209, 129, 176, 29, 218, 40, 55, 13, 80, 57, 68, 92, 97, 44, 82, 209, 240, 207, 214, 22, 119]), - Bytes32::from([59, 161, 125, 95, 7, 155, 141, 55, 253, 106, 238, 72, 109, 158, 201, 200, 236, 157, 227, 178, 176, 47, 166, 84, 87, 111, 25, 133, 194, 55, 244, 254]), - Bytes32::from([8, 134, 213, 182, 108, 15, 225, 138, 152, 138, 132, 240, 27, 80, 231, 117, 194, 157, 205, 20, 110, 239, 166, 37, 50, 46, 213, 165, 216, 101, 245, 98]), - Bytes32::from([137, 57, 186, 173, 198, 113, 221, 42, 0, 211, 127, 200, 128, 7, 112, 97, 75, 155, 152, 224, 71, 220, 16, 124, 32, 50, 30, 48, 251, 132, 120, 147]), - Bytes32::from([201, 8, 226, 108, 147, 192, 3, 240, 168, 237, 131, 47, 150, 51, 251, 126, 23, 182, 223, 99, 162, 167, 248, 248, 233, 8, 121, 99, 71, 212, 120, 251]), - Bytes32::from([140, 30, 196, 244, 166, 80, 95, 116, 140, 218, 94, 20, 236, 233, 241, 129, 175, 187, 110, 88, 174, 173, 152, 203, 67, 75, 51, 232, 225, 6, 17, 134]), - Bytes32::from([92, 132, 115, 164, 66, 159, 201, 147, 233, 228, 16, 95, 81, 233, 129, 254, 155, 148, 38, 239, 186, 40, 118, 104, 144, 134, 17, 46, 99, 150, 211, 9]), - Bytes32::from([81, 73, 72, 117, 215, 159, 240, 86, 136, 196, 69, 201, 149, 208, 48, 245, 105, 153, 97, 107, 221, 85, 49, 121, 197, 129, 32, 140, 206, 231, 120, 123]), - Bytes32::from([0, 203, 34, 135, 242, 129, 113, 204, 198, 134, 219, 134, 187, 240, 235, 59, 44, 163, 180, 83, 174, 40, 66, 141, 95, 99, 71, 221, 186, 216, 37, 250]), - Bytes32::from([225, 181, 151, 12, 26, 209, 127, 99, 248, 177, 126, 113, 215, 220, 252, 89, 149, 123, 19, 65, 89, 122, 180, 169, 195, 87, 147, 9, 196, 31, 203, 178]), - Bytes32::from([125, 81, 154, 100, 204, 138, 194, 248, 156, 95, 119, 58, 60, 221, 150, 248, 216, 19, 123, 15, 198, 108, 228, 228, 224, 122, 16, 249, 223, 84, 117, 89]), - Bytes32::from([99, 153, 60, 217, 168, 254, 244, 149, 214, 115, 250, 90, 117, 112, 66, 163, 143, 207, 121, 70, 108, 92, 2, 47, 56, 109, 56, 207, 152, 27, 196, 141]), - Bytes32::from([99, 251, 124, 97, 158, 155, 101, 251, 98, 124, 239, 73, 50, 50, 173, 142, 39, 208, 167, 53, 5, 151, 85, 239, 25, 77, 36, 52, 141, 225, 66, 186]), - Bytes32::from([235, 44, 31, 180, 197, 243, 114, 60, 199, 242, 167, 21, 206, 27, 116, 165, 18, 76, 162, 163, 14, 91, 109, 104, 118, 51, 33, 172, 9, 165, 214, 38]), - Bytes32::from([188, 4, 5, 50, 169, 70, 231, 90, 220, 90, 226, 214, 89, 19, 159, 207, 201, 80, 241, 214, 32, 240, 63, 74, 6, 251, 177, 182, 236, 19, 156, 92]), - Bytes32::from([128, 150, 66, 27, 197, 229, 103, 137, 175, 252, 19, 131, 213, 63, 112, 172, 182, 255, 235, 246, 226, 37, 25, 180, 24, 38, 35, 138, 207, 149, 186, 175]), - Bytes32::from([5, 123, 231, 106, 12, 171, 157, 189, 58, 109, 144, 7, 38, 97, 4, 148, 1, 138, 124, 123, 2, 202, 108, 221, 194, 160, 53, 73, 115, 36, 231, 142]), - Bytes32::from([160, 157, 243, 224, 214, 120, 59, 206, 24, 30, 231, 209, 123, 227, 15, 221, 86, 30, 128, 117, 210, 109, 132, 117, 204, 87, 243, 213, 231, 224, 91, 75]), - Bytes32::from([74, 238, 110, 147, 63, 110, 246, 102, 252, 212, 120, 225, 124, 218, 145, 204, 129, 63, 13, 34, 1, 0, 15, 9, 27, 221, 39, 199, 24, 231, 9, 38]), - Bytes32::from([194, 20, 160, 161, 90, 2, 118, 75, 103, 228, 51, 42, 191, 220, 63, 150, 140, 32, 85, 172, 218, 29, 251, 31, 99, 96, 98, 46, 130, 157, 201, 61]), - Bytes32::from([88, 123, 95, 139, 94, 66, 69, 27, 223, 223, 216, 130, 99, 210, 130, 54, 248, 35, 226, 252, 151, 238, 7, 175, 12, 97, 188, 43, 233, 129, 82, 222]), - Bytes32::from([179, 248, 157, 243, 50, 157, 172, 17, 139, 10, 245, 208, 241, 210, 67, 199, 135, 233, 234, 39, 127, 38, 54, 39, 40, 159, 94, 122, 36, 221, 180, 195]), - Bytes32::from([190, 185, 147, 237, 82, 32, 165, 236, 252, 183, 173, 181, 68, 44, 216, 20, 110, 243, 158, 213, 88, 209, 218, 207, 244, 241, 121, 239, 136, 167, 245, 155]), - Bytes32::from([114, 131, 254, 248, 183, 0, 175, 217, 194, 58, 178, 238, 250, 119, 158, 205, 19, 74, 94, 35, 100, 175, 114, 55, 186, 192, 239, 126, 42, 86, 60, 119]), - Bytes32::from([1, 253, 107, 150, 25, 240, 27, 172, 252, 185, 151, 152, 107, 105, 164, 230, 221, 242, 7, 166, 142, 53, 237, 83, 19, 30, 81, 149, 150, 39, 123, 220]), - Bytes32::from([57, 240, 92, 232, 26, 238, 69, 252, 110, 171, 164, 109, 199, 73, 110, 49, 11, 253, 109, 69, 155, 26, 84, 52, 155, 204, 115, 99, 90, 38, 247, 167]), - Bytes32::from([46, 87, 146, 25, 215, 40, 208, 78, 73, 60, 35, 19, 194, 41, 34, 186, 215, 131, 205, 29, 107, 100, 95, 169, 45, 1, 242, 115, 30, 226, 93, 48]), - Bytes32::from([95, 183, 66, 0, 196, 173, 44, 27, 175, 151, 17, 0, 159, 168, 123, 236, 124, 198, 85, 181, 118, 89, 21, 52, 169, 104, 178, 111, 120, 173, 94, 109]), - Bytes32::from([13, 111, 162, 25, 133, 108, 250, 75, 197, 221, 19, 160, 147, 36, 130, 70, 224, 39, 134, 144, 149, 166, 187, 96, 155, 154, 123, 90, 241, 154, 44, 102]), - Bytes32::from([95, 171, 183, 135, 121, 205, 161, 160, 212, 226, 64, 232, 180, 166, 176, 95, 51, 96, 110, 20, 76, 143, 47, 96, 197, 132, 210, 109, 174, 132, 13, 95]), - Bytes32::from([66, 51, 176, 1, 106, 199, 192, 16, 106, 180, 212, 53, 72, 121, 218, 148, 77, 26, 15, 244, 124, 131, 88, 84, 147, 211, 254, 156, 187, 91, 193, 120]) - ]); - zero_hashes.insert(MerkleType::Function, vec![ - Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::from([239, 247, 49, 255, 201, 159, 228, 149, 22, 115, 41, 139, 56, 117, 149, 46, 67, 155, 98, 70, 216, 225, 85, 100, 113, 242, 144, 167, 97, 238, 117, 207]), - Bytes32::from([46, 87, 136, 101, 122, 12, 6, 120, 39, 121, 167, 193, 66, 146, 150, 1, 90, 240, 97, 225, 179, 150, 197, 127, 56, 214, 116, 24, 180, 109, 96, 51]), - Bytes32::from([54, 125, 90, 195, 243, 1, 115, 18, 251, 68, 203, 216, 48, 156, 216, 200, 215, 250, 80, 152, 203, 58, 245, 128, 70, 112, 221, 104, 34, 125, 234, 138]), - Bytes32::from([103, 99, 44, 86, 57, 0, 102, 201, 99, 214, 249, 24, 45, 112, 234, 183, 225, 196, 9, 162, 168, 33, 121, 118, 93, 184, 14, 70, 148, 135, 211, 214]), - Bytes32::from([69, 7, 89, 47, 41, 94, 148, 139, 67, 197, 99, 98, 100, 63, 25, 230, 100, 118, 213, 25, 28, 129, 5, 39, 69, 89, 71, 21, 102, 84, 101, 175]), - Bytes32::from([232, 195, 82, 123, 189, 200, 139, 61, 179, 141, 208, 69, 102, 58, 127, 66, 69, 127, 7, 179, 108, 128, 253, 154, 207, 254, 201, 18, 192, 241, 99, 208]), - Bytes32::from([138, 25, 185, 215, 159, 159, 214, 251, 161, 103, 180, 78, 209, 215, 131, 132, 134, 180, 177, 37, 79, 219, 19, 93, 45, 30, 53, 125, 142, 194, 114, 34]), - Bytes32::from([185, 24, 200, 28, 68, 7, 118, 226, 65, 240, 85, 120, 123, 174, 239, 85, 247, 210, 104, 247, 20, 229, 41, 91, 242, 5, 2, 121, 132, 69, 43, 33]), - Bytes32::from([78, 191, 92, 97, 205, 120, 114, 216, 112, 101, 44, 98, 148, 2, 112, 221, 168, 199, 254, 55, 160, 116, 116, 105, 109, 227, 130, 219, 194, 32, 209, 196]), - Bytes32::from([177, 203, 26, 1, 216, 115, 242, 158, 202, 107, 60, 221, 81, 167, 8, 233, 247, 235, 49, 54, 45, 133, 202, 193, 34, 158, 205, 29, 232, 245, 195, 194]), - Bytes32::from([193, 118, 182, 153, 10, 237, 67, 229, 136, 193, 253, 250, 46, 125, 141, 22, 107, 168, 74, 130, 60, 193, 194, 196, 249, 129, 153, 82, 162, 143, 188, 42]), - Bytes32::from([239, 57, 105, 90, 116, 61, 160, 214, 55, 191, 17, 228, 44, 149, 103, 180, 229, 4, 175, 240, 209, 231, 141, 95, 109, 195, 78, 142, 122, 177, 227, 20]), - Bytes32::from([153, 247, 105, 126, 178, 44, 190, 57, 12, 63, 169, 27, 206, 19, 151, 38, 33, 83, 35, 3, 177, 97, 36, 182, 37, 78, 150, 243, 222, 32, 180, 148]), - Bytes32::from([29, 109, 110, 167, 27, 136, 235, 226, 147, 175, 241, 236, 138, 135, 163, 200, 21, 94, 220, 238, 23, 84, 46, 14, 44, 100, 47, 131, 134, 43, 98, 173]), - Bytes32::from([73, 241, 108, 102, 184, 200, 64, 80, 58, 162, 29, 211, 173, 150, 6, 195, 2, 137, 246, 51, 155, 132, 41, 255, 21, 71, 74, 143, 197, 180, 217, 159]), - Bytes32::from([109, 189, 226, 33, 70, 157, 161, 166, 223, 31, 224, 221, 37, 112, 27, 215, 163, 250, 217, 155, 168, 121, 119, 232, 100, 177, 104, 210, 10, 118, 215, 0]), - Bytes32::from([175, 156, 32, 156, 238, 82, 62, 25, 96, 251, 146, 24, 13, 2, 115, 174, 163, 50, 14, 251, 196, 173, 5, 87, 171, 228, 191, 9, 90, 84, 156, 63]), - Bytes32::from([244, 161, 238, 217, 14, 60, 162, 139, 34, 84, 68, 121, 213, 11, 230, 95, 57, 221, 174, 107, 103, 105, 76, 137, 58, 247, 65, 209, 167, 63, 96, 212]), - Bytes32::from([31, 177, 221, 130, 152, 92, 190, 4, 59, 90, 122, 63, 128, 180, 140, 201, 75, 239, 200, 151, 94, 65, 36, 227, 21, 250, 10, 253, 26, 114, 238, 188]), - Bytes32::from([48, 216, 87, 30, 113, 214, 69, 1, 9, 112, 244, 232, 127, 55, 43, 162, 156, 83, 235, 199, 126, 132, 241, 106, 65, 209, 240, 32, 11, 179, 219, 135]), - Bytes32::from([20, 55, 225, 132, 0, 219, 175, 17, 235, 73, 236, 16, 24, 227, 250, 155, 32, 83, 234, 123, 191, 209, 157, 133, 215, 202, 3, 221, 135, 223, 221, 90]), - Bytes32::from([113, 185, 118, 164, 139, 219, 203, 140, 245, 123, 21, 186, 102, 22, 54, 14, 19, 230, 223, 120, 211, 114, 203, 77, 173, 214, 61, 80, 151, 10, 2, 205]), - Bytes32::from([50, 20, 214, 105, 232, 5, 9, 101, 16, 72, 46, 139, 177, 188, 25, 93, 14, 57, 60, 168, 49, 147, 134, 5, 62, 181, 120, 75, 193, 229, 107, 67]), - Bytes32::from([92, 167, 117, 18, 186, 193, 28, 56, 86, 25, 75, 64, 1, 8, 126, 212, 56, 163, 157, 242, 34, 73, 65, 58, 187, 2, 112, 58, 225, 229, 113, 58]), - Bytes32::from([173, 139, 156, 215, 250, 231, 15, 123, 8, 5, 98, 192, 164, 48, 106, 203, 152, 189, 118, 120, 245, 221, 214, 26, 79, 39, 148, 232, 217, 88, 34, 246]), - Bytes32::from([8, 207, 11, 196, 253, 51, 182, 90, 62, 110, 125, 142, 209, 154, 5, 203, 252, 62, 117, 215, 226, 136, 140, 201, 227, 210, 71, 34, 113, 160, 42, 68]), - Bytes32::from([108, 135, 226, 117, 179, 142, 93, 181, 20, 186, 189, 217, 49, 154, 66, 244, 180, 170, 122, 233, 153, 214, 104, 71, 44, 57, 103, 240, 97, 80, 170, 198]), - Bytes32::from([123, 168, 184, 254, 241, 78, 23, 91, 32, 77, 218, 176, 179, 189, 61, 162, 114, 158, 212, 7, 201, 15, 58, 4, 161, 211, 188, 156, 190, 2, 20, 183]), - Bytes32::from([60, 170, 86, 130, 38, 170, 202, 88, 97, 206, 67, 69, 140, 122, 201, 38, 70, 229, 144, 202, 146, 10, 146, 148, 21, 247, 119, 196, 150, 223, 110, 67]), - Bytes32::from([102, 154, 215, 132, 143, 248, 151, 101, 101, 253, 80, 211, 254, 64, 179, 73, 96, 132, 144, 216, 225, 130, 48, 56, 14, 39, 97, 223, 134, 10, 124, 138]), - Bytes32::from([197, 131, 194, 166, 168, 160, 24, 116, 47, 120, 89, 3, 44, 154, 83, 250, 142, 64, 77, 63, 15, 60, 97, 100, 150, 39, 227, 139, 42, 146, 146, 104]), - Bytes32::from([7, 160, 246, 93, 64, 79, 76, 208, 66, 80, 60, 123, 13, 51, 115, 251, 196, 209, 145, 106, 61, 105, 136, 58, 7, 129, 142, 203, 205, 69, 45, 203]), - Bytes32::from([64, 162, 48, 187, 213, 182, 41, 85, 62, 148, 26, 161, 227, 108, 173, 249, 195, 106, 203, 18, 28, 59, 184, 85, 249, 16, 224, 222, 114, 200, 99, 22]), - Bytes32::from([246, 194, 74, 122, 165, 216, 211, 144, 101, 143, 134, 9, 53, 229, 197, 227, 121, 248, 89, 169, 48, 220, 104, 216, 117, 118, 36, 234, 108, 135, 81, 162]), - Bytes32::from([232, 59, 196, 2, 103, 242, 44, 129, 41, 231, 226, 115, 238, 151, 166, 210, 158, 110, 43, 45, 86, 163, 127, 8, 162, 81, 131, 145, 165, 252, 170, 12]), - Bytes32::from([204, 88, 102, 180, 241, 148, 27, 183, 223, 71, 157, 119, 155, 31, 102, 239, 4, 83, 204, 246, 38, 228, 234, 20, 97, 233, 203, 149, 186, 67, 143, 51]), - Bytes32::from([246, 170, 233, 8, 202, 38, 67, 219, 175, 13, 250, 174, 98, 36, 84, 166, 6, 75, 27, 43, 62, 128, 106, 23, 163, 191, 86, 115, 164, 50, 127, 151]), - Bytes32::from([204, 72, 199, 57, 106, 136, 244, 66, 217, 155, 183, 211, 166, 71, 140, 211, 210, 181, 178, 218, 204, 91, 200, 204, 153, 60, 22, 32, 24, 153, 131, 31]), - Bytes32::from([204, 193, 13, 167, 214, 136, 121, 99, 198, 137, 11, 223, 85, 40, 167, 126, 153, 80, 187, 35, 226, 31, 226, 42, 9, 175, 31, 206, 119, 67, 153, 39]), - Bytes32::from([63, 82, 16, 182, 255, 45, 123, 220, 252, 52, 199, 222, 76, 172, 123, 232, 133, 182, 143, 202, 223, 161, 203, 91, 239, 225, 123, 184, 231, 53, 19, 253]), - Bytes32::from([5, 13, 255, 217, 70, 105, 205, 70, 41, 25, 44, 3, 245, 136, 16, 255, 101, 61, 189, 225, 142, 201, 210, 226, 9, 237, 171, 109, 63, 204, 204, 139]), - Bytes32::from([161, 218, 126, 252, 32, 196, 32, 105, 98, 13, 201, 117, 64, 37, 232, 32, 159, 106, 48, 121, 250, 139, 219, 137, 129, 3, 83, 194, 102, 251, 148, 71]), - Bytes32::from([72, 17, 9, 21, 142, 89, 135, 91, 81, 155, 72, 247, 56, 232, 136, 57, 251, 182, 211, 35, 207, 169, 87, 123, 31, 222, 72, 85, 212, 92, 159, 171]), - Bytes32::from([193, 253, 238, 224, 198, 216, 154, 52, 59, 87, 183, 80, 242, 162, 238, 7, 218, 195, 253, 210, 92, 116, 43, 181, 109, 40, 74, 38, 154, 211, 102, 173]), - Bytes32::from([193, 88, 249, 81, 11, 128, 242, 239, 220, 1, 237, 199, 235, 12, 153, 73, 145, 158, 15, 111, 108, 244, 19, 51, 159, 206, 66, 25, 147, 215, 157, 165]), - Bytes32::from([195, 90, 0, 163, 8, 199, 55, 59, 47, 117, 186, 204, 5, 42, 205, 164, 239, 233, 203, 210, 69, 205, 244, 152, 113, 184, 206, 110, 101, 197, 120, 101]), - Bytes32::from([114, 169, 222, 11, 169, 15, 123, 245, 42, 25, 120, 198, 66, 140, 125, 123, 201, 107, 3, 50, 245, 226, 52, 46, 162, 44, 134, 157, 226, 11, 115, 186]), - Bytes32::from([6, 47, 131, 89, 216, 138, 92, 250, 126, 232, 238, 50, 181, 78, 69, 115, 227, 25, 49, 50, 116, 138, 47, 61, 179, 75, 121, 124, 127, 106, 228, 178]), - Bytes32::from([152, 253, 228, 228, 120, 255, 82, 66, 24, 145, 159, 223, 39, 185, 81, 201, 81, 110, 47, 57, 105, 128, 8, 42, 130, 119, 92, 7, 14, 247, 137, 135]), - Bytes32::from([162, 28, 11, 245, 48, 21, 8, 137, 161, 131, 84, 18, 129, 70, 197, 122, 165, 39, 71, 213, 142, 115, 159, 52, 46, 213, 81, 10, 217, 212, 74, 20]), - Bytes32::from([129, 250, 71, 119, 46, 25, 220, 212, 143, 120, 0, 101, 85, 101, 109, 107, 142, 20, 107, 174, 39, 134, 128, 244, 237, 155, 190, 19, 110, 10, 240, 94]), - Bytes32::from([90, 70, 190, 48, 191, 45, 227, 17, 185, 162, 159, 12, 18, 94, 186, 251, 252, 238, 95, 174, 253, 99, 194, 204, 5, 178, 117, 139, 50, 154, 93, 170]), - Bytes32::from([201, 8, 48, 126, 70, 22, 83, 82, 229, 84, 168, 86, 100, 169, 227, 175, 196, 154, 217, 150, 2, 36, 1, 100, 48, 216, 141, 205, 113, 148, 109, 126]), - Bytes32::from([16, 182, 10, 119, 255, 70, 127, 242, 64, 68, 67, 44, 52, 195, 63, 185, 227, 97, 138, 244, 53, 246, 110, 99, 41, 176, 146, 206, 81, 168, 66, 140]), - Bytes32::from([95, 9, 211, 227, 219, 119, 221, 132, 248, 92, 236, 190, 110, 227, 153, 109, 103, 63, 121, 221, 165, 212, 20, 141, 33, 95, 52, 157, 69, 76, 2, 70]), - Bytes32::from([216, 138, 115, 198, 102, 135, 226, 247, 235, 185, 206, 147, 130, 9, 48, 166, 92, 22, 41, 158, 169, 52, 233, 1, 60, 229, 165, 208, 60, 161, 194, 166]), - Bytes32::from([129, 241, 87, 138, 103, 241, 79, 26, 52, 35, 125, 237, 54, 147, 253, 137, 101, 146, 235, 127, 124, 113, 60, 203, 181, 4, 250, 12, 72, 27, 24, 7]), - Bytes32::from([52, 120, 68, 97, 147, 229, 251, 178, 161, 233, 142, 136, 38, 40, 85, 46, 121, 156, 115, 186, 72, 95, 128, 43, 252, 176, 176, 51, 113, 83, 154, 232]), - Bytes32::from([227, 11, 188, 57, 98, 160, 248, 247, 112, 49, 247, 92, 94, 224, 135, 182, 211, 230, 69, 185, 138, 154, 141, 157, 18, 34, 138, 236, 67, 243, 26, 132]), - Bytes32::from([61, 246, 31, 52, 44, 146, 190, 215, 214, 105, 253, 86, 172, 174, 140, 112, 30, 154, 82, 173, 62, 199, 157, 180, 255, 104, 73, 136, 163, 79, 210, 252]), - Bytes32::from([200, 155, 200, 87, 142, 123, 62, 176, 250, 44, 18, 238, 229, 121, 125, 109, 102, 173, 60, 203, 88, 65, 33, 122, 22, 111, 157, 143, 164, 7, 214, 26]), - Bytes32::from([179, 76, 168, 179, 139, 86, 151, 173, 26, 70, 236, 116, 202, 123, 63, 80, 106, 208, 63, 138, 179, 225, 114, 64, 48, 34, 78, 124, 132, 210, 224, 190]), - Bytes32::from([138, 116, 89, 240, 28, 79, 42, 149, 199, 118, 149, 49, 146, 212, 104, 62, 17, 137, 138, 223, 225, 187, 152, 43, 134, 60, 95, 55, 175, 128, 95, 144]) - ]); - zero_hashes.insert(MerkleType::Instruction, vec![ - Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::from([248, 140, 83, 29, 241, 220, 66, 40, 126, 248, 5, 153, 77, 179, 26, 64, 221, 108, 205, 162, 173, 52, 179, 140, 202, 105, 0, 170, 166, 130, 120, 176]), - Bytes32::from([35, 74, 103, 235, 245, 71, 66, 212, 99, 147, 15, 200, 1, 237, 95, 163, 10, 146, 122, 251, 243, 239, 93, 186, 46, 74, 206, 130, 63, 17, 199, 80]), - Bytes32::from([113, 169, 40, 37, 169, 205, 28, 78, 37, 104, 52, 28, 29, 222, 39, 32, 208, 183, 215, 38, 255, 69, 87, 70, 174, 113, 221, 183, 206, 62, 192, 118]), - Bytes32::from([1, 148, 183, 39, 234, 23, 138, 182, 169, 58, 52, 158, 248, 212, 186, 127, 60, 42, 25, 210, 20, 170, 182, 139, 20, 185, 196, 85, 241, 214, 181, 64]), - Bytes32::from([241, 14, 59, 8, 168, 222, 232, 125, 149, 227, 125, 41, 223, 198, 88, 135, 54, 146, 140, 212, 164, 76, 239, 106, 10, 20, 67, 180, 24, 159, 174, 99]), - Bytes32::from([117, 111, 220, 19, 204, 227, 211, 18, 61, 239, 179, 46, 142, 75, 67, 98, 159, 221, 205, 158, 125, 42, 221, 227, 148, 162, 193, 229, 147, 70, 214, 127]), - Bytes32::from([20, 72, 211, 188, 38, 126, 166, 75, 54, 22, 225, 21, 113, 155, 167, 89, 161, 6, 37, 78, 227, 211, 219, 141, 161, 199, 151, 122, 81, 45, 159, 187]), - Bytes32::from([69, 198, 100, 170, 106, 174, 208, 152, 152, 121, 118, 66, 111, 89, 131, 14, 159, 115, 142, 200, 205, 173, 89, 77, 68, 234, 5, 171, 105, 248, 199, 83]), - Bytes32::from([17, 1, 220, 13, 154, 194, 88, 60, 253, 223, 149, 35, 44, 184, 107, 141, 205, 177, 185, 32, 22, 99, 212, 96, 194, 91, 255, 179, 121, 153, 254, 40]), - Bytes32::from([222, 247, 186, 138, 222, 183, 135, 183, 170, 79, 182, 23, 69, 89, 70, 68, 88, 87, 235, 22, 178, 134, 114, 220, 249, 153, 70, 71, 229, 139, 10, 190]), - Bytes32::from([183, 77, 65, 51, 207, 78, 55, 149, 222, 3, 100, 82, 232, 230, 21, 115, 249, 177, 36, 89, 12, 41, 70, 31, 199, 254, 213, 3, 184, 2, 85, 137]), - Bytes32::from([82, 15, 215, 135, 95, 18, 143, 49, 239, 237, 6, 15, 213, 113, 153, 49, 149, 54, 50, 139, 100, 192, 128, 226, 168, 9, 120, 167, 157, 42, 45, 19]), - Bytes32::from([70, 32, 130, 243, 186, 144, 224, 217, 130, 222, 175, 221, 218, 190, 179, 222, 217, 115, 70, 160, 141, 231, 221, 96, 2, 173, 27, 17, 158, 66, 180, 58]), - Bytes32::from([76, 243, 65, 235, 12, 31, 48, 195, 62, 176, 202, 57, 99, 80, 237, 222, 138, 199, 124, 251, 143, 243, 205, 226, 18, 164, 67, 64, 68, 238, 53, 71]), - Bytes32::from([70, 52, 254, 193, 211, 92, 63, 238, 92, 2, 160, 29, 154, 25, 221, 136, 2, 49, 96, 27, 15, 152, 238, 57, 241, 253, 32, 131, 73, 38, 229, 243]), - Bytes32::from([214, 162, 82, 44, 146, 145, 61, 77, 36, 3, 131, 81, 217, 39, 127, 81, 66, 82, 172, 230, 246, 3, 243, 217, 210, 38, 201, 109, 240, 143, 253, 79]), - Bytes32::from([127, 18, 198, 116, 112, 141, 16, 39, 115, 118, 37, 208, 118, 119, 147, 46, 196, 124, 19, 196, 34, 183, 172, 157, 18, 91, 4, 210, 77, 195, 220, 59]), - Bytes32::from([87, 54, 42, 60, 39, 223, 84, 148, 158, 230, 70, 53, 191, 1, 108, 103, 139, 111, 58, 220, 114, 46, 46, 110, 20, 211, 84, 1, 173, 104, 175, 191]), - Bytes32::from([182, 147, 66, 127, 229, 144, 125, 93, 84, 220, 116, 107, 51, 13, 24, 161, 68, 172, 165, 50, 12, 198, 229, 173, 49, 26, 114, 159, 84, 190, 6, 42]), - Bytes32::from([183, 20, 36, 145, 76, 36, 61, 136, 224, 139, 89, 23, 124, 29, 210, 137, 1, 160, 22, 128, 48, 242, 234, 85, 84, 24, 206, 49, 143, 185, 237, 110]), - Bytes32::from([38, 19, 77, 150, 92, 129, 177, 155, 139, 162, 90, 91, 231, 146, 216, 21, 54, 152, 18, 5, 98, 21, 67, 160, 154, 113, 175, 65, 214, 78, 19, 97]), - Bytes32::from([163, 236, 47, 120, 121, 17, 217, 4, 200, 247, 206, 178, 211, 212, 163, 48, 38, 172, 111, 123, 75, 221, 63, 117, 42, 3, 252, 233, 104, 13, 210, 203]), - Bytes32::from([127, 106, 132, 246, 28, 129, 245, 83, 159, 109, 196, 219, 68, 81, 230, 77, 254, 166, 55, 73, 169, 179, 93, 97, 117, 176, 53, 74, 121, 238, 184, 240]), - Bytes32::from([255, 23, 108, 186, 145, 182, 196, 67, 163, 95, 173, 17, 67, 239, 199, 189, 145, 153, 120, 152, 159, 126, 255, 39, 55, 178, 230, 173, 91, 165, 229, 106]), - Bytes32::from([184, 156, 20, 114, 222, 219, 89, 218, 102, 62, 130, 200, 179, 237, 32, 237, 127, 75, 251, 163, 160, 2, 221, 34, 166, 30, 172, 97, 115, 137, 179, 175]), - Bytes32::from([244, 165, 127, 27, 66, 22, 38, 243, 235, 107, 30, 181, 31, 193, 210, 174, 254, 129, 39, 71, 59, 117, 186, 37, 217, 129, 138, 23, 146, 114, 96, 78]), - Bytes32::from([27, 57, 244, 93, 208, 90, 64, 181, 161, 110, 161, 188, 62, 180, 46, 103, 136, 233, 63, 1, 243, 202, 236, 206, 173, 45, 45, 218, 238, 184, 83, 121]), - Bytes32::from([138, 185, 33, 206, 120, 214, 246, 27, 100, 91, 106, 213, 60, 177, 39, 182, 149, 204, 11, 225, 254, 5, 87, 9, 19, 186, 166, 210, 33, 67, 146, 37]), - Bytes32::from([243, 161, 7, 52, 35, 240, 227, 144, 29, 50, 232, 3, 101, 174, 192, 139, 89, 75, 204, 245, 173, 55, 139, 76, 126, 19, 142, 18, 230, 57, 219, 227]), - Bytes32::from([97, 73, 36, 70, 120, 55, 49, 114, 107, 193, 66, 219, 47, 122, 201, 194, 52, 142, 12, 163, 108, 2, 107, 58, 185, 251, 168, 146, 57, 189, 150, 134]), - Bytes32::from([11, 215, 29, 229, 151, 208, 62, 1, 172, 253, 253, 156, 177, 31, 117, 214, 161, 192, 68, 255, 140, 131, 66, 23, 247, 161, 107, 98, 199, 57, 123, 110]), - Bytes32::from([41, 166, 54, 134, 242, 64, 153, 167, 5, 230, 226, 128, 71, 10, 251, 160, 19, 187, 70, 4, 95, 98, 77, 233, 181, 24, 11, 239, 142, 152, 229, 215]), - Bytes32::from([221, 220, 68, 168, 143, 124, 235, 77, 241, 190, 214, 6, 102, 40, 32, 245, 131, 114, 170, 151, 134, 49, 79, 57, 242, 124, 85, 172, 83, 81, 68, 99]), - Bytes32::from([142, 200, 102, 97, 170, 43, 14, 11, 139, 207, 150, 163, 99, 103, 2, 46, 44, 63, 109, 61, 62, 64, 199, 104, 36, 194, 155, 232, 139, 250, 97, 224]), - Bytes32::from([162, 15, 26, 217, 96, 195, 70, 196, 253, 70, 127, 156, 39, 120, 120, 232, 197, 154, 192, 147, 104, 33, 104, 189, 120, 160, 36, 129, 208, 237, 128, 23]), - Bytes32::from([42, 228, 74, 47, 20, 55, 197, 252, 173, 70, 178, 8, 2, 43, 97, 238, 155, 124, 87, 225, 217, 6, 103, 134, 136, 235, 193, 175, 33, 228, 219, 217]), - Bytes32::from([219, 143, 25, 70, 78, 155, 119, 63, 126, 20, 158, 54, 27, 181, 104, 184, 74, 192, 75, 157, 42, 204, 45, 122, 25, 248, 247, 24, 225, 207, 51, 251]), - Bytes32::from([151, 253, 36, 33, 104, 222, 126, 234, 112, 74, 59, 94, 239, 58, 36, 114, 90, 195, 208, 46, 250, 138, 165, 200, 178, 54, 238, 154, 219, 238, 6, 183]), - Bytes32::from([205, 57, 187, 174, 221, 9, 164, 77, 76, 143, 54, 212, 115, 196, 67, 182, 200, 147, 78, 194, 245, 92, 173, 114, 180, 160, 168, 5, 200, 82, 217, 64]), - Bytes32::from([211, 104, 62, 114, 157, 56, 254, 26, 32, 168, 208, 248, 62, 195, 142, 68, 53, 13, 7, 36, 216, 5, 127, 153, 97, 88, 222, 206, 91, 42, 14, 114]), - Bytes32::from([203, 158, 225, 200, 62, 223, 202, 52, 207, 179, 250, 236, 29, 144, 181, 31, 87, 192, 203, 66, 56, 39, 123, 25, 123, 157, 196, 161, 34, 245, 22, 130]), - Bytes32::from([147, 247, 233, 96, 190, 104, 227, 251, 99, 2, 16, 8, 77, 119, 1, 97, 243, 78, 103, 46, 24, 228, 217, 65, 219, 238, 135, 18, 164, 219, 132, 39]), - Bytes32::from([239, 153, 72, 139, 52, 60, 171, 44, 72, 218, 138, 124, 45, 30, 143, 122, 147, 158, 12, 62, 213, 151, 217, 217, 212, 51, 110, 75, 122, 67, 134, 80]), - Bytes32::from([46, 47, 130, 237, 178, 232, 239, 217, 165, 114, 255, 202, 132, 214, 18, 8, 72, 8, 255, 0, 162, 82, 5, 228, 141, 201, 70, 135, 255, 21, 220, 3]), - Bytes32::from([21, 11, 196, 5, 215, 241, 194, 200, 198, 129, 133, 244, 204, 47, 131, 70, 138, 38, 107, 39, 211, 243, 72, 72, 34, 145, 35, 42, 14, 69, 218, 227]), - Bytes32::from([73, 103, 117, 195, 67, 126, 242, 57, 232, 74, 142, 64, 169, 248, 113, 69, 110, 103, 127, 185, 177, 51, 212, 178, 48, 183, 247, 44, 246, 69, 35, 208]), - Bytes32::from([125, 8, 83, 22, 215, 82, 179, 234, 169, 227, 213, 39, 170, 164, 195, 187, 63, 38, 59, 146, 144, 101, 38, 0, 110, 212, 202, 20, 245, 105, 187, 201]), - Bytes32::from([186, 231, 186, 148, 68, 208, 226, 170, 120, 80, 68, 79, 23, 41, 51, 205, 240, 201, 10, 16, 24, 38, 137, 151, 7, 102, 92, 244, 3, 194, 228, 229]), - Bytes32::from([46, 8, 51, 150, 63, 114, 126, 210, 30, 130, 76, 142, 13, 149, 14, 0, 205, 199, 48, 90, 86, 75, 151, 135, 164, 224, 129, 77, 174, 194, 212, 112]), - Bytes32::from([150, 239, 42, 111, 3, 112, 25, 168, 179, 36, 106, 73, 212, 188, 215, 79, 180, 142, 191, 29, 219, 12, 244, 74, 254, 205, 160, 54, 68, 144, 81, 207]), - Bytes32::from([23, 164, 189, 201, 250, 65, 212, 148, 132, 125, 94, 209, 115, 123, 29, 66, 3, 172, 57, 58, 46, 191, 96, 7, 212, 25, 226, 79, 120, 68, 202, 210]), - Bytes32::from([252, 13, 137, 225, 208, 6, 84, 75, 97, 32, 177, 156, 248, 191, 113, 97, 254, 122, 86, 194, 3, 103, 219, 74, 227, 160, 231, 202, 13, 126, 46, 255]), - Bytes32::from([70, 35, 27, 128, 17, 79, 226, 131, 144, 118, 248, 125, 188, 110, 20, 15, 255, 73, 205, 69, 0, 227, 26, 66, 39, 61, 191, 224, 239, 234, 83, 170]), - Bytes32::from([129, 52, 148, 121, 230, 84, 28, 112, 75, 68, 181, 197, 80, 227, 107, 22, 60, 118, 81, 209, 198, 125, 233, 190, 84, 189, 18, 25, 72, 143, 2, 190]), - Bytes32::from([244, 237, 81, 131, 251, 35, 56, 158, 229, 102, 150, 122, 213, 206, 119, 38, 54, 238, 158, 159, 1, 214, 31, 147, 245, 9, 172, 247, 156, 115, 209, 140]), - Bytes32::from([47, 5, 174, 62, 80, 172, 77, 111, 136, 114, 188, 85, 249, 157, 182, 175, 187, 207, 29, 43, 152, 88, 130, 156, 138, 30, 188, 51, 82, 105, 145, 161]), - Bytes32::from([102, 2, 197, 195, 206, 149, 53, 224, 61, 219, 163, 246, 208, 218, 140, 47, 16, 42, 196, 20, 145, 158, 101, 31, 225, 135, 49, 68, 95, 5, 228, 92]), - Bytes32::from([78, 136, 176, 216, 253, 15, 136, 48, 162, 5, 57, 120, 93, 222, 179, 174, 129, 40, 8, 63, 18, 102, 97, 41, 58, 214, 1, 52, 58, 126, 186, 146]), - Bytes32::from([145, 56, 231, 59, 247, 191, 104, 137, 240, 113, 32, 245, 235, 129, 255, 54, 99, 176, 109, 175, 107, 232, 201, 235, 95, 104, 54, 67, 252, 184, 200, 54]), - Bytes32::from([181, 3, 229, 152, 113, 182, 55, 93, 138, 137, 21, 67, 27, 204, 96, 69, 72, 247, 237, 216, 28, 36, 115, 185, 111, 149, 224, 69, 66, 121, 188, 228]), - Bytes32::from([212, 25, 201, 68, 187, 25, 10, 96, 40, 88, 100, 216, 145, 200, 26, 203, 220, 14, 14, 11, 190, 62, 143, 137, 53, 208, 233, 158, 37, 34, 8, 15]), - Bytes32::from([80, 101, 192, 136, 203, 90, 189, 204, 181, 36, 28, 107, 220, 69, 119, 99, 145, 227, 198, 55, 37, 237, 212, 114, 31, 27, 19, 90, 231, 143, 87, 149]), - Bytes32::from([248, 97, 168, 33, 15, 230, 128, 82, 157, 26, 186, 89, 200, 7, 101, 210, 117, 111, 75, 233, 244, 187, 1, 180, 30, 220, 15, 21, 203, 5, 243, 223]) - ]); - zero_hashes.insert(MerkleType::Memory, vec![ - Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::from([66, 208, 130, 169, 194, 116, 5, 27, 68, 75, 235, 175, 164, 169, 41, 91, 88, 134, 51, 194, 219, 201, 182, 199, 1, 52, 173, 215, 20, 37, 51, 0]), - Bytes32::from([90, 210, 50, 227, 58, 173, 147, 92, 139, 15, 127, 190, 196, 111, 142, 207, 31, 223, 70, 96, 17, 251, 164, 200, 133, 0, 76, 35, 200, 9, 51, 218]), - Bytes32::from([97, 5, 162, 226, 92, 108, 172, 8, 7, 65, 104, 176, 216, 3, 144, 47, 14, 88, 50, 101, 194, 94, 10, 132, 192, 76, 37, 152, 42, 73, 30, 2]), - Bytes32::from([68, 59, 208, 14, 89, 37, 33, 1, 177, 225, 235, 66, 129, 28, 103, 156, 46, 206, 94, 141, 33, 152, 141, 26, 209, 161, 53, 237, 198, 163, 115, 57]), - Bytes32::from([28, 94, 12, 53, 70, 163, 95, 44, 168, 42, 196, 126, 181, 231, 174, 247, 89, 100, 77, 238, 211, 74, 116, 144, 183, 111, 254, 75, 30, 187, 228, 222]), - Bytes32::from([238, 133, 50, 189, 14, 89, 244, 88, 239, 50, 172, 85, 172, 1, 131, 2, 24, 161, 70, 94, 0, 204, 50, 199, 48, 107, 30, 70, 6, 8, 18, 90]), - Bytes32::from([165, 239, 71, 173, 192, 165, 25, 35, 4, 130, 148, 158, 177, 193, 129, 45, 115, 209, 7, 233, 136, 108, 245, 126, 74, 200, 22, 204, 190, 137, 191, 105]), - Bytes32::from([173, 102, 127, 73, 167, 249, 117, 26, 190, 231, 26, 60, 201, 138, 160, 182, 180, 44, 34, 132, 171, 254, 91, 8, 167, 114, 188, 157, 181, 148, 169, 165]), - Bytes32::from([71, 62, 70, 89, 203, 1, 105, 187, 178, 167, 217, 118, 42, 217, 154, 234, 238, 109, 145, 231, 247, 199, 40, 110, 162, 11, 173, 144, 103, 110, 99, 101]), - Bytes32::from([121, 36, 94, 4, 25, 134, 16, 98, 198, 109, 123, 42, 56, 151, 224, 7, 232, 155, 231, 154, 229, 162, 250, 149, 231, 198, 0, 65, 17, 27, 181, 28]), - Bytes32::from([247, 158, 162, 102, 242, 117, 166, 252, 175, 158, 107, 157, 244, 44, 17, 99, 93, 52, 43, 136, 5, 211, 32, 152, 91, 148, 41, 32, 231, 18, 237, 208]), - Bytes32::from([147, 52, 155, 255, 81, 242, 75, 54, 54, 66, 166, 41, 131, 177, 183, 151, 229, 177, 232, 86, 146, 137, 106, 68, 226, 117, 20, 210, 224, 170, 249, 68]), - Bytes32::from([160, 89, 180, 156, 119, 172, 38, 10, 97, 101, 64, 56, 98, 133, 199, 228, 58, 66, 139, 128, 88, 140, 143, 85, 148, 167, 79, 75, 34, 45, 204, 68]), - Bytes32::from([165, 233, 117, 3, 27, 56, 166, 16, 56, 132, 198, 32, 11, 149, 212, 98, 64, 236, 180, 106, 174, 80, 122, 220, 102, 67, 67, 110, 67, 8, 48, 217]), - Bytes32::from([113, 74, 209, 139, 250, 181, 182, 127, 178, 77, 17, 63, 79, 109, 145, 74, 52, 102, 125, 154, 22, 241, 177, 177, 34, 189, 124, 22, 4, 200, 201, 76]), - Bytes32::from([67, 7, 240, 151, 128, 149, 238, 113, 130, 127, 174, 223, 142, 124, 230, 10, 91, 89, 113, 157, 230, 21, 213, 3, 146, 249, 26, 80, 239, 90, 4, 216]), - Bytes32::from([152, 20, 80, 244, 232, 182, 1, 145, 31, 191, 46, 207, 83, 199, 209, 104, 0, 75, 106, 230, 16, 98, 121, 127, 175, 78, 119, 154, 69, 55, 66, 169]), - Bytes32::from([123, 50, 162, 158, 51, 112, 129, 232, 242, 158, 150, 72, 244, 40, 191, 63, 205, 61, 144, 39, 65, 122, 28, 88, 253, 146, 29, 29, 15, 40, 122, 95]), - Bytes32::from([231, 253, 202, 45, 165, 158, 212, 29, 104, 165, 209, 179, 188, 154, 89, 18, 216, 23, 140, 66, 150, 49, 99, 200, 163, 155, 50, 9, 250, 22, 19, 203]), - Bytes32::from([127, 172, 110, 243, 156, 134, 199, 15, 248, 216, 12, 196, 221, 66, 202, 186, 105, 197, 43, 245, 46, 116, 251, 133, 111, 118, 56, 214, 157, 244, 187, 58]), - Bytes32::from([181, 181, 163, 95, 7, 188, 245, 128, 161, 210, 137, 217, 103, 101, 120, 255, 47, 83, 102, 68, 238, 195, 206, 105, 24, 150, 216, 50, 74, 6, 94, 95]), - Bytes32::from([171, 250, 198, 40, 153, 26, 240, 152, 96, 169, 15, 123, 33, 155, 57, 172, 89, 205, 9, 65, 45, 126, 155, 143, 224, 145, 25, 214, 19, 227, 213, 195]), - Bytes32::from([44, 177, 244, 220, 119, 33, 203, 59, 209, 72, 28, 4, 210, 54, 86, 20, 119, 41, 45, 231, 143, 104, 57, 206, 212, 222, 81, 62, 92, 221, 200, 32]), - Bytes32::from([37, 200, 165, 195, 67, 224, 131, 227, 97, 54, 21, 233, 76, 186, 6, 122, 178, 131, 252, 59, 97, 218, 239, 62, 124, 255, 201, 178, 241, 236, 4, 214]), - Bytes32::from([77, 171, 229, 183, 46, 112, 203, 177, 89, 90, 64, 114, 109, 220, 32, 120, 41, 223, 72, 86, 59, 211, 110, 17, 129, 112, 194, 186, 200, 92, 144, 49]), - Bytes32::from([2, 198, 61, 112, 181, 185, 194, 114, 149, 63, 65, 76, 55, 179, 170, 62, 91, 112, 189, 100, 13, 34, 98, 187, 85, 132, 202, 86, 47, 27, 236, 200]), - Bytes32::from([164, 238, 109, 209, 155, 118, 236, 237, 84, 43, 56, 99, 51, 60, 116, 235, 100, 39, 163, 105, 34, 93, 8, 187, 228, 213, 35, 200, 43, 8, 32, 68]), - Bytes32::from([32, 220, 39, 200, 214, 245, 102, 200, 167, 204, 3, 54, 140, 126, 129, 35, 139, 60, 112, 133, 52, 166, 162, 63, 119, 20, 2, 116, 132, 244, 246, 225]), - Bytes32::from([5, 54, 145, 188, 188, 251, 36, 4, 103, 140, 229, 143, 83, 11, 77, 207, 57, 125, 51, 127, 89, 130, 138, 193, 190, 17, 17, 23, 68, 168, 231, 106]), - Bytes32::from([239, 112, 72, 74, 116, 134, 210, 24, 226, 242, 91, 113, 99, 59, 19, 7, 226, 215, 254, 220, 14, 225, 75, 245, 11, 234, 138, 52, 195, 86, 79, 124]), - Bytes32::from([187, 35, 132, 188, 162, 128, 96, 71, 124, 213, 251, 229, 73, 52, 187, 22, 166, 35, 214, 14, 121, 189, 37, 5, 77, 54, 201, 51, 95, 179, 75, 229]), - Bytes32::from([5, 54, 88, 42, 68, 200, 45, 209, 121, 70, 128, 8, 178, 212, 197, 39, 101, 90, 101, 111, 77, 133, 13, 77, 19, 111, 113, 122, 222, 85, 180, 82]), - Bytes32::from([34, 182, 144, 13, 35, 35, 79, 14, 239, 80, 21, 255, 67, 48, 210, 174, 159, 182, 239, 236, 68, 46, 125, 105, 243, 202, 218, 64, 53, 94, 159, 253]), - Bytes32::from([224, 189, 145, 186, 43, 169, 131, 161, 223, 161, 72, 72, 229, 97, 113, 233, 2, 250, 109, 31, 19, 125, 57, 135, 144, 3, 187, 18, 102, 108, 232, 9]), - Bytes32::from([68, 94, 11, 104, 95, 110, 179, 226, 157, 245, 113, 68, 44, 122, 17, 22, 244, 35, 248, 126, 131, 192, 20, 169, 129, 236, 60, 54, 157, 30, 231, 36]), - Bytes32::from([101, 198, 107, 156, 226, 8, 67, 168, 197, 91, 189, 166, 187, 16, 121, 93, 114, 243, 137, 162, 125, 142, 50, 206, 160, 168, 165, 27, 207, 10, 22, 19]), - Bytes32::from([222, 29, 134, 137, 98, 73, 58, 143, 166, 134, 210, 47, 68, 23, 214, 237, 241, 207, 226, 83, 113, 222, 184, 139, 16, 1, 200, 56, 34, 208, 197, 152]), - Bytes32::from([107, 200, 189, 222, 185, 32, 192, 130, 237, 238, 168, 137, 14, 94, 3, 26, 41, 238, 19, 119, 207, 158, 25, 177, 116, 70, 170, 161, 141, 129, 16, 88]), - Bytes32::from([131, 243, 131, 161, 236, 101, 108, 81, 59, 123, 150, 6, 250, 124, 103, 101, 75, 234, 98, 223, 129, 87, 202, 59, 184, 173, 44, 191, 200, 30, 223, 66]), - Bytes32::from([17, 226, 72, 31, 180, 33, 229, 83, 154, 39, 104, 45, 93, 117, 153, 249, 216, 127, 120, 182, 4, 19, 169, 87, 127, 70, 7, 237, 80, 251, 220, 126]), - Bytes32::from([88, 122, 134, 181, 173, 175, 100, 74, 28, 141, 45, 215, 245, 170, 222, 54, 106, 118, 146, 59, 207, 251, 133, 155, 164, 75, 240, 208, 10, 185, 187, 163]), - Bytes32::from([214, 1, 209, 99, 53, 101, 233, 225, 55, 171, 69, 200, 44, 144, 169, 11, 65, 85, 84, 158, 233, 227, 37, 59, 42, 52, 153, 13, 0, 158, 122, 208]), - Bytes32::from([124, 146, 1, 221, 33, 138, 233, 130, 184, 163, 121, 110, 95, 242, 123, 251, 110, 46, 41, 197, 75, 145, 121, 95, 29, 1, 19, 19, 167, 220, 177, 153]), - Bytes32::from([77, 38, 54, 170, 19, 128, 180, 248, 208, 75, 27, 53, 228, 104, 7, 216, 188, 186, 40, 84, 87, 11, 121, 3, 175, 89, 49, 46, 191, 94, 80, 97]), - Bytes32::from([134, 127, 37, 206, 212, 70, 146, 143, 81, 104, 140, 28, 135, 233, 171, 88, 18, 2, 148, 143, 111, 208, 149, 138, 167, 84, 183, 100, 67, 181, 243, 135]), - Bytes32::from([218, 16, 220, 189, 192, 237, 252, 168, 45, 33, 177, 81, 53, 115, 141, 190, 99, 138, 113, 85, 60, 230, 244, 222, 205, 16, 152, 26, 185, 207, 114, 143]), - Bytes32::from([9, 85, 193, 163, 186, 152, 83, 149, 29, 71, 50, 13, 175, 149, 184, 51, 246, 97, 20, 22, 57, 201, 27, 72, 146, 19, 213, 102, 164, 148, 176, 45]), - Bytes32::from([140, 94, 218, 31, 232, 0, 167, 218, 122, 119, 62, 179, 181, 51, 100, 6, 150, 159, 212, 207, 160, 94, 212, 108, 225, 196, 190, 210, 145, 110, 120, 114]), - Bytes32::from([152, 169, 229, 240, 162, 212, 61, 59, 167, 135, 124, 147, 212, 248, 177, 85, 243, 72, 150, 127, 122, 60, 143, 125, 226, 186, 67, 219, 50, 112, 242, 212]), - Bytes32::from([47, 244, 81, 140, 243, 189, 116, 0, 2, 158, 242, 188, 215, 90, 177, 37, 175, 221, 80, 226, 209, 79, 2, 62, 112, 245, 1, 132, 7, 78, 0, 117]), - Bytes32::from([247, 236, 252, 118, 6, 245, 132, 187, 48, 36, 77, 0, 167, 150, 109, 72, 234, 9, 224, 162, 223, 191, 21, 19, 180, 201, 138, 56, 109, 97, 152, 170]), - Bytes32::from([77, 23, 112, 52, 78, 204, 135, 173, 2, 206, 148, 200, 60, 155, 60, 179, 201, 111, 73, 138, 76, 104, 79, 174, 190, 173, 42, 51, 38, 48, 237, 241]), - Bytes32::from([117, 234, 73, 183, 4, 144, 12, 196, 78, 228, 178, 218, 206, 147, 147, 94, 190, 22, 22, 233, 88, 118, 135, 55, 63, 29, 212, 38, 223, 160, 121, 230]), - Bytes32::from([74, 138, 173, 10, 77, 129, 10, 115, 18, 90, 57, 215, 221, 171, 109, 152, 31, 219, 235, 122, 189, 201, 210, 186, 52, 200, 81, 218, 112, 79, 80, 54]), - Bytes32::from([189, 150, 224, 30, 110, 73, 249, 62, 100, 244, 206, 110, 206, 239, 233, 213, 61, 213, 65, 139, 103, 19, 20, 123, 167, 65, 161, 165, 216, 217, 255, 248]), - Bytes32::from([119, 71, 56, 219, 155, 139, 253, 40, 100, 132, 185, 98, 24, 34, 156, 225, 120, 176, 76, 147, 31, 105, 245, 216, 165, 161, 89, 157, 246, 17, 251, 234]), - Bytes32::from([192, 39, 162, 126, 222, 211, 173, 195, 198, 124, 1, 124, 140, 2, 252, 191, 185, 85, 10, 125, 226, 7, 88, 221, 164, 13, 221, 74, 200, 7, 249, 177]), - Bytes32::from([251, 226, 24, 5, 54, 89, 9, 93, 217, 202, 148, 172, 208, 197, 65, 172, 98, 96, 58, 194, 61, 253, 157, 193, 135, 32, 206, 97, 133, 234, 199, 197]), - Bytes32::from([130, 3, 195, 156, 210, 123, 23, 44, 223, 25, 153, 169, 250, 88, 127, 239, 206, 196, 156, 143, 182, 185, 35, 77, 162, 48, 143, 64, 231, 129, 216, 185]), - Bytes32::from([123, 201, 97, 230, 121, 13, 207, 138, 137, 3, 122, 92, 105, 155, 214, 204, 142, 18, 119, 138, 135, 165, 249, 58, 184, 53, 27, 31, 109, 214, 176, 147]), - Bytes32::from([46, 71, 246, 155, 247, 109, 236, 225, 147, 51, 250, 72, 97, 116, 162, 36, 115, 164, 80, 28, 252, 238, 98, 92, 16, 66, 190, 208, 180, 39, 179, 211]), - Bytes32::from([38, 76, 13, 227, 149, 18, 84, 170, 83, 231, 122, 59, 237, 66, 32, 171, 158, 251, 78, 156, 186, 160, 29, 30, 207, 178, 16, 193, 221, 158, 49, 48]), - Bytes32::from([166, 13, 210, 208, 250, 131, 27, 163, 99, 204, 199, 134, 152, 131, 28, 164, 8, 222, 176, 200, 34, 40, 74, 188, 120, 46, 167, 44, 95, 199, 86, 225]) - ]); - zero_hashes.insert(MerkleType::Table, vec![ - Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::from([164, 47, 121, 69, 150, 44, 30, 204, 210, 181, 242, 154, 59, 111, 5, 10, 47, 121, 213, 80, 163, 196, 205, 188, 241, 64, 202, 26, 242, 47, 50, 205]), - Bytes32::from([166, 9, 224, 145, 14, 138, 194, 78, 202, 114, 110, 38, 244, 33, 189, 185, 170, 85, 144, 229, 123, 63, 229, 194, 59, 130, 156, 6, 184, 154, 187, 17]), - Bytes32::from([32, 51, 186, 232, 39, 244, 218, 98, 243, 254, 82, 247, 63, 120, 34, 123, 128, 240, 220, 145, 41, 114, 251, 208, 209, 244, 10, 9, 179, 5, 105, 181]), - Bytes32::from([73, 148, 74, 132, 241, 45, 129, 169, 83, 223, 101, 12, 184, 60, 10, 201, 169, 197, 75, 17, 198, 168, 79, 171, 207, 195, 123, 47, 249, 30, 176, 216]), - Bytes32::from([145, 224, 51, 196, 211, 137, 189, 133, 232, 210, 170, 157, 227, 160, 218, 143, 15, 82, 170, 226, 241, 83, 7, 112, 138, 227, 58, 59, 149, 168, 81, 94]), - Bytes32::from([241, 90, 42, 7, 231, 63, 36, 86, 238, 131, 19, 20, 38, 118, 65, 180, 109, 121, 147, 147, 213, 142, 203, 244, 239, 75, 5, 160, 16, 85, 221, 95]), - Bytes32::from([213, 113, 178, 221, 213, 107, 77, 153, 222, 48, 148, 140, 250, 1, 17, 59, 73, 19, 110, 106, 94, 195, 126, 49, 126, 109, 65, 55, 104, 111, 18, 171]), - Bytes32::from([43, 198, 12, 197, 95, 201, 76, 108, 96, 235, 76, 8, 117, 99, 42, 20, 177, 45, 112, 40, 2, 180, 68, 19, 25, 11, 210, 168, 170, 178, 99, 27]), - Bytes32::from([142, 205, 24, 125, 81, 234, 138, 161, 206, 121, 163, 225, 50, 9, 180, 102, 0, 25, 93, 180, 137, 164, 206, 249, 222, 20, 175, 177, 199, 14, 115, 207]), - Bytes32::from([213, 41, 249, 19, 173, 165, 236, 103, 42, 146, 223, 6, 190, 229, 161, 13, 96, 163, 110, 23, 203, 238, 24, 95, 130, 203, 35, 211, 63, 234, 32, 137]), - Bytes32::from([176, 82, 229, 48, 113, 46, 179, 38, 231, 83, 50, 136, 179, 190, 242, 126, 152, 210, 141, 102, 191, 21, 20, 96, 235, 245, 81, 254, 231, 117, 159, 146]), - Bytes32::from([216, 15, 120, 147, 70, 215, 12, 160, 223, 73, 246, 73, 195, 189, 200, 3, 19, 131, 102, 61, 173, 79, 50, 76, 39, 150, 151, 147, 35, 251, 200, 0]), - Bytes32::from([88, 215, 168, 30, 218, 72, 206, 159, 91, 121, 14, 133, 241, 220, 195, 46, 93, 244, 179, 53, 158, 75, 211, 161, 8, 120, 167, 141, 235, 16, 232, 42]), - Bytes32::from([114, 99, 218, 52, 203, 162, 199, 16, 225, 154, 182, 20, 59, 121, 250, 249, 166, 35, 118, 18, 142, 57, 122, 131, 32, 219, 83, 126, 147, 91, 116, 16]), - Bytes32::from([193, 157, 15, 251, 179, 155, 215, 190, 98, 93, 30, 167, 23, 175, 178, 172, 142, 143, 222, 20, 18, 157, 215, 42, 105, 107, 64, 16, 216, 143, 109, 45]), - Bytes32::from([178, 2, 203, 32, 83, 90, 114, 97, 124, 210, 81, 81, 179, 213, 71, 19, 181, 173, 227, 88, 226, 83, 48, 169, 134, 163, 62, 103, 222, 82, 128, 30]), - Bytes32::from([252, 17, 142, 50, 185, 19, 111, 148, 204, 30, 199, 138, 143, 207, 30, 212, 254, 7, 129, 43, 100, 167, 52, 115, 247, 143, 64, 106, 220, 5, 7, 89]), - Bytes32::from([117, 136, 111, 98, 95, 97, 253, 43, 82, 22, 43, 187, 65, 154, 132, 105, 55, 194, 240, 148, 170, 199, 185, 91, 157, 138, 43, 117, 218, 176, 110, 101]), - Bytes32::from([228, 56, 186, 202, 73, 47, 253, 151, 48, 173, 2, 101, 153, 197, 108, 145, 227, 170, 247, 86, 80, 70, 30, 93, 232, 148, 63, 211, 197, 135, 23, 97]), - Bytes32::from([162, 35, 93, 45, 208, 241, 87, 57, 138, 79, 231, 83, 75, 81, 102, 91, 115, 58, 1, 205, 193, 197, 62, 210, 144, 88, 59, 52, 149, 234, 121, 224]), - Bytes32::from([165, 67, 16, 239, 234, 92, 207, 81, 64, 93, 227, 154, 132, 33, 54, 53, 102, 198, 90, 134, 24, 29, 190, 158, 121, 23, 127, 30, 27, 239, 140, 88]), - Bytes32::from([61, 125, 183, 139, 186, 82, 193, 166, 2, 147, 231, 215, 179, 107, 163, 67, 122, 0, 90, 188, 142, 216, 72, 20, 63, 146, 85, 89, 231, 41, 153, 117]), - Bytes32::from([206, 31, 38, 182, 78, 170, 183, 207, 211, 114, 212, 4, 108, 84, 62, 99, 245, 196, 10, 1, 188, 63, 240, 199, 27, 85, 68, 101, 212, 222, 85, 12]), - Bytes32::from([106, 0, 225, 130, 195, 87, 113, 106, 101, 80, 56, 119, 93, 45, 74, 168, 240, 209, 155, 123, 8, 129, 73, 225, 204, 125, 42, 73, 102, 122, 228, 158]), - Bytes32::from([251, 63, 88, 92, 59, 176, 71, 194, 46, 19, 18, 27, 83, 57, 197, 231, 202, 242, 155, 63, 252, 240, 205, 216, 96, 130, 161, 197, 123, 110, 175, 220]), - Bytes32::from([239, 6, 249, 150, 189, 234, 197, 18, 79, 222, 80, 72, 205, 147, 251, 135, 226, 33, 46, 111, 186, 185, 4, 33, 219, 129, 30, 182, 57, 229, 34, 16]), - Bytes32::from([192, 35, 149, 149, 16, 111, 3, 119, 173, 215, 223, 247, 70, 25, 31, 107, 104, 5, 249, 243, 193, 66, 99, 48, 107, 158, 25, 147, 163, 151, 96, 149]), - Bytes32::from([197, 133, 241, 197, 67, 52, 255, 227, 180, 235, 137, 164, 174, 160, 183, 9, 159, 254, 210, 180, 231, 140, 176, 165, 113, 215, 182, 1, 177, 204, 219, 246]), - Bytes32::from([51, 32, 109, 173, 131, 6, 99, 63, 75, 191, 207, 187, 73, 26, 5, 139, 167, 216, 123, 26, 199, 176, 84, 215, 158, 243, 105, 0, 91, 254, 59, 146]), - Bytes32::from([229, 120, 15, 22, 225, 50, 131, 240, 190, 232, 83, 119, 169, 246, 172, 35, 99, 163, 58, 146, 234, 253, 252, 83, 5, 48, 54, 142, 172, 91, 145, 13]), - Bytes32::from([159, 9, 100, 20, 215, 92, 217, 43, 208, 254, 65, 234, 124, 167, 250, 53, 159, 151, 124, 70, 26, 0, 113, 28, 78, 44, 238, 8, 34, 255, 19, 36]), - Bytes32::from([193, 135, 44, 144, 13, 46, 76, 43, 127, 208, 79, 196, 229, 58, 125, 33, 71, 118, 215, 240, 80, 123, 44, 181, 174, 47, 102, 42, 137, 98, 190, 41]), - Bytes32::from([78, 19, 3, 217, 174, 154, 142, 109, 189, 14, 241, 12, 23, 185, 224, 152, 209, 108, 223, 202, 191, 11, 190, 149, 31, 236, 104, 234, 22, 38, 196, 3]), - Bytes32::from([60, 93, 237, 228, 186, 222, 179, 231, 151, 95, 147, 20, 188, 10, 191, 34, 126, 57, 253, 161, 154, 117, 182, 108, 143, 72, 48, 102, 191, 240, 81, 208]), - Bytes32::from([179, 114, 163, 89, 172, 211, 154, 204, 11, 125, 140, 186, 107, 90, 17, 116, 214, 31, 165, 94, 36, 187, 184, 151, 210, 208, 76, 215, 75, 166, 107, 91]), - Bytes32::from([125, 131, 52, 139, 120, 156, 163, 243, 206, 143, 204, 221, 123, 140, 1, 103, 235, 186, 64, 82, 194, 191, 205, 2, 32, 242, 38, 77, 184, 23, 236, 228]), - Bytes32::from([137, 224, 90, 1, 116, 95, 215, 47, 8, 3, 227, 132, 154, 232, 216, 63, 3, 80, 52, 18, 42, 29, 85, 38, 117, 255, 9, 99, 88, 233, 129, 92]), - Bytes32::from([54, 182, 145, 174, 54, 24, 168, 13, 71, 43, 178, 49, 153, 246, 94, 79, 228, 254, 134, 0, 21, 210, 176, 242, 82, 117, 76, 40, 221, 181, 30, 62]), - Bytes32::from([145, 171, 156, 87, 15, 174, 31, 111, 175, 161, 31, 116, 123, 123, 37, 216, 43, 147, 197, 79, 218, 49, 236, 111, 35, 49, 44, 188, 197, 79, 136, 45]), - Bytes32::from([169, 48, 186, 93, 10, 48, 80, 103, 68, 226, 103, 31, 176, 154, 146, 199, 166, 89, 48, 149, 116, 101, 157, 149, 149, 72, 123, 54, 153, 26, 210, 122]), - Bytes32::from([225, 45, 163, 167, 213, 84, 40, 87, 106, 253, 206, 80, 189, 71, 153, 5, 15, 107, 151, 150, 14, 22, 143, 207, 4, 192, 63, 250, 207, 207, 179, 26]), - Bytes32::from([110, 249, 172, 218, 206, 202, 107, 64, 48, 153, 226, 127, 165, 227, 50, 146, 140, 239, 220, 252, 188, 157, 77, 210, 92, 73, 38, 6, 16, 87, 244, 66]), - Bytes32::from([39, 217, 230, 91, 60, 231, 96, 137, 37, 58, 93, 51, 79, 222, 132, 171, 196, 109, 155, 4, 252, 213, 17, 33, 160, 24, 250, 118, 187, 62, 107, 113]), - Bytes32::from([120, 167, 145, 121, 184, 31, 185, 178, 241, 54, 20, 48, 132, 89, 132, 127, 235, 189, 197, 127, 249, 58, 255, 197, 40, 229, 130, 254, 213, 186, 114, 74]), - Bytes32::from([7, 40, 187, 172, 225, 196, 3, 77, 113, 16, 118, 148, 95, 65, 42, 234, 233, 29, 120, 223, 105, 77, 250, 119, 245, 20, 21, 155, 177, 13, 56, 151]), - Bytes32::from([22, 248, 25, 75, 36, 179, 251, 57, 101, 170, 213, 19, 216, 64, 164, 253, 151, 199, 88, 5, 92, 129, 138, 185, 9, 236, 231, 68, 112, 24, 218, 216]), - Bytes32::from([95, 141, 49, 39, 213, 214, 130, 49, 143, 124, 178, 114, 200, 136, 160, 90, 233, 73, 233, 185, 60, 250, 174, 74, 2, 123, 2, 62, 192, 174, 115, 158]), - Bytes32::from([142, 29, 212, 35, 71, 107, 91, 164, 226, 225, 180, 218, 99, 34, 200, 171, 33, 235, 113, 105, 191, 78, 105, 70, 221, 135, 167, 148, 24, 225, 6, 146]), - Bytes32::from([176, 194, 115, 243, 138, 104, 3, 247, 184, 74, 81, 60, 173, 45, 29, 189, 252, 202, 206, 66, 129, 65, 150, 25, 246, 145, 133, 4, 93, 201, 201, 240]), - Bytes32::from([18, 233, 186, 158, 43, 12, 206, 228, 80, 102, 187, 25, 78, 77, 180, 28, 82, 62, 168, 252, 14, 113, 126, 91, 243, 120, 213, 91, 189, 244, 247, 177]), - Bytes32::from([79, 126, 97, 23, 112, 98, 93, 86, 24, 103, 82, 33, 155, 188, 202, 61, 29, 146, 132, 169, 116, 207, 216, 35, 29, 229, 213, 120, 135, 240, 129, 205]), - Bytes32::from([146, 121, 255, 202, 145, 53, 46, 8, 102, 205, 56, 234, 49, 42, 85, 231, 217, 114, 235, 141, 233, 187, 29, 9, 122, 232, 61, 253, 42, 104, 4, 113]), - Bytes32::from([103, 174, 255, 6, 115, 155, 156, 65, 84, 251, 208, 55, 89, 124, 171, 167, 133, 227, 22, 134, 32, 71, 243, 181, 16, 100, 81, 63, 22, 207, 58, 190]), - Bytes32::from([69, 10, 247, 243, 56, 0, 64, 72, 218, 21, 211, 192, 62, 243, 66, 244, 230, 58, 107, 54, 180, 29, 216, 23, 86, 211, 173, 181, 118, 188, 238, 72]), - Bytes32::from([25, 179, 4, 93, 169, 76, 76, 69, 158, 3, 24, 146, 130, 9, 225, 198, 102, 238, 29, 73, 74, 179, 159, 74, 40, 111, 181, 110, 76, 173, 251, 255]), - Bytes32::from([236, 113, 37, 202, 149, 150, 90, 50, 233, 141, 125, 12, 212, 163, 137, 176, 15, 214, 194, 73, 138, 104, 4, 33, 235, 76, 185, 58, 125, 182, 56, 0]), - Bytes32::from([238, 54, 183, 94, 50, 33, 98, 31, 133, 181, 230, 98, 43, 154, 95, 111, 250, 71, 15, 197, 156, 60, 8, 90, 208, 50, 62, 127, 30, 18, 181, 176]), - Bytes32::from([246, 143, 72, 228, 143, 15, 15, 131, 178, 105, 113, 46, 85, 36, 165, 116, 63, 131, 61, 228, 98, 144, 232, 209, 228, 110, 168, 171, 252, 47, 79, 165]), - Bytes32::from([146, 70, 74, 79, 139, 107, 73, 28, 231, 88, 235, 214, 163, 185, 87, 195, 147, 186, 153, 222, 191, 214, 30, 231, 173, 166, 151, 169, 244, 15, 15, 227]), - Bytes32::from([137, 182, 175, 97, 212, 23, 62, 70, 50, 150, 67, 153, 253, 52, 179, 105, 147, 177, 217, 170, 125, 251, 1, 96, 4, 127, 196, 37, 254, 7, 217, 100]), - Bytes32::from([32, 253, 229, 209, 120, 43, 120, 189, 245, 227, 178, 79, 134, 175, 240, 107, 25, 124, 5, 67, 120, 213, 187, 200, 159, 9, 26, 119, 13, 1, 8, 120]), - Bytes32::from([115, 241, 26, 44, 83, 229, 130, 21, 249, 87, 72, 212, 75, 220, 95, 22, 151, 77, 182, 8, 196, 207, 95, 18, 9, 92, 89, 206, 114, 80, 36, 159]), - Bytes32::from([174, 151, 88, 171, 52, 40, 161, 16, 106, 45, 44, 9, 142, 95, 5, 205, 82, 24, 172, 103, 152, 202, 187, 34, 217, 173, 236, 129, 32, 203, 205, 38]) - ]); - zero_hashes.insert(MerkleType::TableElement, vec![ - Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::from([145, 218, 63, 74, 131, 182, 204, 163, 74, 206, 234, 50, 47, 3, 51, 74, 121, 225, 146, 237, 5, 128, 20, 230, 243, 89, 33, 248, 136, 154, 189, 5]), - Bytes32::from([36, 240, 95, 13, 214, 136, 92, 102, 96, 137, 39, 96, 108, 223, 147, 130, 220, 61, 147, 226, 52, 133, 67, 223, 211, 164, 6, 53, 45, 117, 120, 241]), - Bytes32::from([9, 2, 218, 34, 228, 8, 178, 127, 160, 30, 104, 198, 49, 37, 71, 115, 14, 35, 20, 15, 253, 160, 147, 143, 24, 186, 12, 90, 41, 169, 30, 8]), - Bytes32::from([137, 242, 105, 78, 161, 99, 76, 224, 226, 100, 216, 235, 156, 132, 214, 154, 107, 120, 197, 113, 45, 221, 170, 119, 92, 228, 76, 139, 170, 159, 111, 58]), - Bytes32::from([231, 165, 221, 185, 139, 22, 70, 40, 67, 162, 123, 94, 161, 156, 57, 53, 102, 217, 128, 227, 18, 132, 17, 170, 90, 31, 214, 181, 249, 220, 70, 37]), - Bytes32::from([171, 253, 174, 187, 9, 186, 87, 37, 22, 83, 13, 88, 75, 11, 177, 226, 237, 136, 132, 137, 101, 109, 135, 192, 224, 80, 87, 105, 95, 81, 255, 21]), - Bytes32::from([179, 50, 36, 230, 159, 162, 184, 132, 140, 121, 133, 155, 189, 44, 132, 93, 80, 79, 32, 244, 131, 57, 79, 222, 104, 63, 224, 182, 91, 162, 73, 122]), - Bytes32::from([17, 55, 206, 87, 127, 185, 135, 231, 41, 56, 166, 104, 229, 102, 222, 181, 236, 233, 230, 39, 43, 163, 16, 1, 225, 86, 211, 51, 145, 7, 169, 84]), - Bytes32::from([201, 174, 3, 154, 104, 190, 240, 99, 123, 201, 7, 118, 196, 85, 28, 247, 35, 232, 39, 25, 151, 52, 167, 136, 179, 13, 213, 60, 138, 158, 39, 131]), - Bytes32::from([35, 33, 109, 155, 171, 252, 195, 80, 10, 115, 40, 199, 250, 1, 241, 82, 146, 225, 118, 237, 11, 125, 198, 97, 57, 21, 171, 237, 94, 60, 49, 32]), - Bytes32::from([126, 95, 42, 157, 183, 168, 137, 120, 114, 64, 148, 170, 32, 156, 137, 96, 194, 91, 119, 11, 20, 3, 30, 62, 118, 12, 31, 48, 245, 144, 252, 29]), - Bytes32::from([48, 135, 201, 114, 103, 35, 8, 96, 5, 101, 125, 26, 87, 0, 98, 122, 239, 140, 230, 10, 102, 112, 155, 87, 249, 181, 152, 235, 28, 79, 176, 56]), - Bytes32::from([76, 70, 222, 210, 242, 159, 52, 123, 112, 106, 253, 140, 55, 160, 189, 255, 220, 64, 8, 168, 39, 196, 160, 8, 105, 154, 91, 184, 62, 63, 227, 156]), - Bytes32::from([138, 201, 8, 240, 218, 190, 210, 227, 236, 168, 45, 161, 209, 115, 126, 165, 235, 162, 6, 117, 76, 239, 3, 225, 163, 251, 111, 233, 233, 228, 14, 92]), - Bytes32::from([190, 166, 27, 117, 242, 0, 25, 148, 230, 125, 237, 22, 153, 158, 151, 56, 121, 194, 221, 198, 184, 147, 249, 149, 27, 29, 166, 243, 254, 181, 209, 102]), - Bytes32::from([235, 63, 149, 47, 164, 152, 80, 11, 178, 203, 99, 178, 176, 226, 164, 151, 39, 65, 83, 200, 102, 90, 12, 102, 178, 15, 232, 16, 222, 141, 78, 3]), - Bytes32::from([37, 179, 99, 114, 214, 120, 87, 53, 198, 229, 207, 47, 16, 112, 208, 33, 216, 152, 209, 228, 196, 14, 237, 250, 212, 90, 176, 185, 21, 248, 92, 109]), - Bytes32::from([237, 200, 122, 93, 145, 116, 138, 59, 86, 220, 58, 171, 160, 31, 142, 193, 231, 131, 106, 164, 166, 44, 120, 170, 62, 81, 73, 85, 0, 52, 219, 220]), - Bytes32::from([244, 173, 85, 141, 81, 198, 214, 0, 54, 21, 20, 169, 177, 235, 104, 206, 43, 218, 96, 68, 73, 37, 252, 77, 253, 18, 30, 97, 223, 122, 1, 12]), - Bytes32::from([104, 169, 247, 140, 131, 245, 193, 3, 36, 119, 249, 119, 108, 102, 115, 250, 173, 225, 33, 156, 116, 87, 180, 27, 84, 215, 126, 15, 187, 189, 32, 139]), - Bytes32::from([47, 156, 244, 88, 145, 227, 224, 87, 233, 138, 138, 9, 169, 96, 29, 204, 100, 170, 23, 105, 63, 4, 119, 90, 167, 161, 72, 109, 82, 254, 123, 48]), - Bytes32::from([196, 68, 107, 111, 141, 253, 138, 140, 162, 104, 247, 104, 87, 144, 123, 240, 105, 251, 246, 210, 172, 172, 241, 162, 155, 90, 83, 175, 131, 251, 107, 215]), - Bytes32::from([28, 100, 243, 226, 32, 234, 211, 106, 197, 179, 14, 192, 70, 11, 203, 125, 151, 53, 20, 77, 175, 99, 154, 100, 159, 249, 54, 39, 73, 168, 162, 66]), - Bytes32::from([83, 176, 7, 180, 201, 178, 172, 98, 47, 34, 80, 6, 62, 10, 4, 112, 43, 93, 10, 227, 74, 91, 11, 217, 83, 230, 104, 0, 167, 2, 114, 89]), - Bytes32::from([185, 162, 212, 82, 149, 182, 104, 215, 62, 244, 114, 124, 181, 74, 226, 119, 4, 42, 181, 238, 25, 212, 215, 219, 174, 231, 32, 170, 9, 234, 12, 212]), - Bytes32::from([173, 38, 241, 20, 137, 119, 33, 252, 174, 245, 252, 234, 165, 181, 128, 225, 14, 147, 182, 97, 145, 19, 40, 193, 90, 238, 140, 87, 0, 222, 70, 254]), - Bytes32::from([51, 218, 162, 213, 211, 23, 9, 158, 185, 156, 39, 145, 5, 146, 70, 144, 172, 10, 26, 212, 253, 37, 24, 32, 21, 65, 179, 140, 64, 237, 96, 157]), - Bytes32::from([221, 87, 57, 81, 246, 126, 53, 163, 190, 220, 109, 205, 114, 234, 85, 151, 75, 245, 254, 16, 140, 131, 239, 120, 9, 209, 54, 61, 177, 6, 188, 252]), - Bytes32::from([54, 161, 25, 198, 75, 151, 214, 76, 83, 74, 117, 229, 155, 237, 88, 95, 143, 119, 56, 12, 201, 164, 235, 20, 117, 49, 177, 88, 14, 248, 95, 198]), - Bytes32::from([60, 16, 183, 115, 241, 45, 253, 24, 105, 43, 79, 72, 212, 238, 24, 156, 132, 93, 78, 246, 1, 228, 222, 200, 254, 130, 170, 46, 91, 254, 205, 143]), - Bytes32::from([184, 30, 34, 235, 214, 40, 120, 64, 182, 15, 162, 189, 164, 202, 89, 146, 202, 177, 16, 105, 172, 158, 1, 95, 101, 146, 253, 115, 226, 233, 38, 171]), - Bytes32::from([70, 152, 3, 73, 249, 222, 93, 214, 74, 179, 140, 47, 34, 42, 149, 214, 152, 75, 34, 145, 68, 226, 151, 101, 121, 54, 252, 240, 206, 140, 81, 165]), - Bytes32::from([9, 88, 51, 124, 67, 108, 84, 244, 61, 241, 110, 246, 184, 105, 6, 116, 242, 58, 15, 144, 43, 76, 176, 107, 0, 138, 155, 235, 210, 138, 226, 215]), - Bytes32::from([98, 170, 168, 147, 158, 223, 186, 7, 58, 130, 89, 200, 153, 24, 158, 251, 69, 100, 7, 57, 96, 115, 136, 170, 57, 145, 143, 240, 102, 6, 248, 111]), - Bytes32::from([76, 75, 216, 216, 194, 146, 2, 59, 247, 64, 98, 160, 62, 105, 193, 186, 161, 191, 64, 154, 254, 196, 55, 214, 201, 103, 223, 131, 181, 192, 152, 176]), - Bytes32::from([188, 141, 114, 199, 33, 45, 183, 18, 123, 231, 92, 215, 51, 191, 11, 199, 253, 46, 28, 10, 156, 23, 92, 255, 219, 236, 176, 247, 52, 105, 210, 223]), - Bytes32::from([200, 67, 112, 29, 180, 70, 50, 18, 220, 122, 39, 122, 83, 186, 81, 77, 241, 44, 190, 3, 162, 217, 76, 61, 230, 237, 157, 230, 205, 172, 186, 247]), - Bytes32::from([131, 131, 129, 83, 251, 217, 83, 88, 93, 39, 66, 174, 51, 19, 190, 91, 16, 187, 95, 63, 35, 178, 94, 237, 194, 42, 231, 227, 138, 202, 216, 93]), - Bytes32::from([18, 177, 28, 41, 199, 59, 160, 244, 26, 162, 73, 48, 16, 74, 190, 195, 249, 216, 64, 229, 145, 65, 18, 131, 75, 57, 71, 74, 127, 239, 112, 13]), - Bytes32::from([41, 120, 53, 253, 151, 12, 143, 213, 212, 31, 245, 61, 168, 113, 30, 38, 112, 126, 156, 133, 241, 102, 110, 237, 4, 138, 50, 160, 79, 235, 52, 35]), - Bytes32::from([38, 74, 146, 27, 110, 86, 122, 250, 58, 243, 64, 185, 207, 174, 28, 124, 35, 183, 53, 88, 34, 234, 89, 58, 98, 223, 69, 13, 48, 15, 239, 230]), - Bytes32::from([221, 132, 1, 28, 157, 232, 235, 132, 32, 58, 26, 36, 60, 217, 197, 165, 141, 19, 64, 120, 197, 139, 190, 86, 153, 152, 235, 11, 99, 129, 222, 91]), - Bytes32::from([237, 76, 61, 239, 169, 108, 131, 62, 163, 67, 158, 210, 14, 45, 91, 105, 36, 182, 206, 182, 71, 11, 159, 169, 159, 248, 247, 176, 6, 176, 237, 123]), - Bytes32::from([232, 190, 198, 78, 12, 148, 86, 176, 221, 115, 1, 22, 122, 163, 223, 234, 74, 129, 125, 53, 211, 137, 115, 18, 241, 170, 69, 42, 34, 74, 180, 172]), - Bytes32::from([215, 199, 144, 158, 222, 153, 123, 125, 150, 97, 127, 151, 96, 43, 69, 155, 150, 119, 75, 82, 218, 48, 101, 70, 121, 18, 42, 146, 215, 183, 100, 158]), - Bytes32::from([121, 182, 45, 62, 255, 78, 32, 48, 107, 186, 208, 155, 158, 80, 231, 241, 90, 227, 219, 113, 52, 20, 66, 45, 124, 67, 209, 61, 167, 74, 60, 34]), - Bytes32::from([34, 136, 15, 103, 128, 220, 202, 103, 150, 123, 249, 145, 218, 227, 17, 64, 142, 129, 4, 42, 93, 7, 6, 147, 111, 117, 25, 185, 88, 104, 85, 115]), - Bytes32::from([144, 191, 235, 38, 205, 102, 127, 160, 139, 105, 75, 63, 86, 192, 194, 49, 240, 35, 65, 154, 4, 113, 51, 87, 40, 70, 32, 58, 243, 16, 136, 67]), - Bytes32::from([217, 150, 254, 250, 111, 69, 45, 227, 111, 59, 199, 149, 59, 216, 17, 117, 8, 226, 85, 250, 183, 187, 21, 129, 208, 0, 63, 158, 232, 106, 131, 16]), - Bytes32::from([148, 212, 84, 16, 204, 49, 69, 96, 137, 125, 102, 221, 111, 8, 41, 51, 221, 241, 87, 231, 88, 215, 211, 24, 254, 131, 111, 56, 160, 143, 230, 109]), - Bytes32::from([144, 48, 37, 157, 153, 7, 123, 206, 46, 224, 211, 249, 208, 217, 91, 243, 128, 62, 100, 126, 3, 253, 223, 161, 50, 108, 26, 151, 129, 242, 94, 132]), - Bytes32::from([97, 167, 177, 53, 183, 154, 164, 1, 129, 184, 234, 182, 190, 197, 244, 226, 150, 217, 57, 152, 243, 206, 60, 76, 114, 194, 51, 240, 58, 93, 219, 76]), - Bytes32::from([139, 70, 147, 227, 94, 147, 130, 53, 38, 112, 138, 176, 7, 148, 6, 21, 50, 199, 70, 33, 87, 180, 33, 167, 56, 89, 66, 95, 245, 247, 135, 24]), - Bytes32::from([175, 169, 204, 13, 145, 18, 40, 29, 84, 88, 206, 99, 208, 137, 249, 146, 0, 237, 188, 130, 135, 223, 121, 54, 126, 251, 247, 109, 141, 217, 62, 127]), - Bytes32::from([139, 188, 3, 234, 198, 124, 194, 238, 217, 237, 214, 250, 66, 220, 0, 51, 1, 203, 122, 125, 46, 213, 22, 253, 8, 218, 145, 253, 170, 156, 159, 96]), - Bytes32::from([107, 130, 208, 55, 16, 249, 46, 4, 98, 236, 130, 52, 190, 126, 232, 229, 108, 126, 239, 175, 25, 229, 84, 33, 249, 66, 128, 162, 47, 221, 110, 163]), - Bytes32::from([239, 176, 14, 134, 210, 125, 177, 40, 200, 42, 229, 32, 200, 58, 9, 73, 210, 161, 8, 105, 4, 70, 19, 134, 117, 132, 167, 18, 16, 108, 207, 113]), - Bytes32::from([237, 116, 250, 79, 151, 228, 171, 189, 89, 213, 122, 121, 55, 25, 52, 238, 79, 19, 31, 194, 73, 158, 43, 78, 86, 194, 36, 141, 105, 10, 87, 58]), - Bytes32::from([216, 125, 158, 123, 121, 158, 74, 152, 46, 18, 196, 115, 233, 149, 205, 189, 10, 232, 174, 21, 2, 52, 202, 111, 74, 160, 191, 196, 84, 93, 98, 46]), - Bytes32::from([201, 148, 124, 172, 62, 154, 127, 129, 205, 197, 134, 133, 144, 78, 47, 190, 197, 190, 103, 44, 129, 57, 155, 227, 152, 212, 130, 12, 192, 223, 244, 68]), - Bytes32::from([102, 147, 19, 104, 237, 188, 140, 66, 166, 77, 105, 55, 5, 165, 143, 107, 91, 247, 53, 203, 187, 163, 109, 66, 19, 164, 153, 170, 82, 251, 148, 10]), - Bytes32::from([33, 89, 246, 96, 201, 15, 77, 99, 252, 111, 250, 152, 124, 80, 50, 57, 197, 124, 254, 202, 246, 131, 11, 219, 249, 102, 35, 79, 100, 173, 146, 167]), - Bytes32::from([6, 27, 205, 165, 249, 112, 70, 105, 232, 156, 155, 204, 71, 5, 21, 239, 91, 69, 248, 111, 218, 154, 187, 85, 118, 72, 210, 99, 138, 40, 233, 75]) - ]); - zero_hashes.insert(MerkleType::Module, vec![ - Bytes32::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::from([252, 178, 61, 5, 174, 66, 106, 30, 131, 163, 114, 90, 231, 83, 228, 153, 108, 255, 60, 37, 254, 139, 153, 129, 208, 156, 109, 74, 233, 129, 174, 182]), - Bytes32::from([128, 23, 154, 62, 181, 220, 154, 183, 222, 214, 79, 76, 162, 169, 179, 162, 185, 93, 179, 115, 161, 55, 19, 63, 227, 168, 140, 66, 182, 6, 60, 120]), - Bytes32::from([243, 119, 126, 55, 151, 128, 119, 12, 124, 84, 146, 243, 156, 68, 82, 174, 201, 162, 29, 73, 29, 77, 103, 205, 194, 250, 45, 133, 39, 71, 224, 177]), - Bytes32::from([209, 179, 222, 187, 184, 84, 131, 182, 172, 78, 20, 104, 236, 246, 114, 74, 55, 98, 29, 34, 117, 249, 89, 76, 85, 38, 248, 193, 75, 10, 243, 100]), - Bytes32::from([195, 14, 58, 139, 148, 140, 218, 174, 131, 204, 69, 84, 127, 8, 142, 88, 136, 83, 253, 241, 74, 247, 143, 204, 38, 15, 138, 98, 47, 188, 255, 245]), - Bytes32::from([167, 4, 177, 126, 159, 76, 19, 220, 160, 159, 81, 227, 110, 147, 179, 175, 253, 187, 46, 24, 15, 168, 153, 84, 4, 167, 247, 225, 121, 175, 134, 85]), - Bytes32::from([237, 144, 152, 155, 211, 100, 202, 187, 41, 181, 45, 224, 143, 139, 18, 77, 110, 34, 212, 207, 239, 180, 73, 84, 166, 194, 22, 149, 89, 215, 86, 21]), - Bytes32::from([226, 192, 91, 176, 242, 185, 212, 189, 178, 80, 238, 252, 183, 82, 220, 242, 22, 237, 84, 142, 132, 91, 95, 219, 252, 171, 51, 76, 28, 146, 86, 155]), - Bytes32::from([199, 200, 237, 66, 220, 14, 221, 121, 117, 150, 118, 36, 138, 142, 50, 173, 12, 195, 131, 90, 27, 189, 247, 221, 89, 151, 41, 27, 135, 207, 137, 172]), - Bytes32::from([160, 60, 124, 200, 56, 240, 67, 161, 121, 95, 247, 51, 153, 249, 125, 88, 231, 2, 85, 167, 251, 187, 21, 103, 49, 132, 213, 52, 219, 30, 146, 59]), - Bytes32::from([123, 52, 142, 254, 117, 160, 215, 99, 155, 130, 134, 183, 76, 99, 166, 246, 49, 51, 142, 67, 116, 234, 69, 199, 201, 19, 70, 3, 208, 247, 40, 82]), - Bytes32::from([165, 32, 183, 79, 246, 224, 220, 103, 11, 160, 233, 66, 129, 238, 194, 73, 17, 37, 128, 185, 175, 88, 144, 228, 231, 185, 22, 17, 149, 174, 72, 1]), - Bytes32::from([12, 24, 45, 128, 57, 246, 187, 176, 154, 247, 169, 18, 116, 176, 70, 246, 203, 141, 211, 104, 5, 147, 78, 214, 161, 71, 33, 97, 7, 21, 158, 61]), - Bytes32::from([215, 18, 110, 29, 36, 34, 133, 219, 15, 204, 206, 158, 186, 213, 181, 41, 184, 160, 71, 165, 163, 121, 88, 106, 228, 58, 34, 105, 112, 168, 84, 123]), - Bytes32::from([6, 169, 156, 220, 55, 53, 26, 229, 104, 60, 113, 111, 153, 18, 251, 234, 179, 159, 56, 14, 112, 7, 144, 199, 45, 180, 116, 239, 21, 207, 173, 205]), - Bytes32::from([24, 172, 76, 192, 21, 91, 250, 75, 196, 119, 231, 221, 13, 239, 113, 39, 62, 40, 165, 26, 245, 16, 61, 106, 39, 28, 78, 212, 249, 230, 84, 108]), - Bytes32::from([248, 34, 1, 62, 213, 235, 20, 21, 220, 78, 178, 126, 184, 102, 242, 50, 49, 174, 163, 122, 166, 96, 40, 110, 78, 199, 89, 158, 155, 251, 233, 49]), - Bytes32::from([103, 54, 133, 19, 189, 117, 46, 209, 17, 2, 64, 251, 77, 195, 197, 91, 38, 48, 214, 36, 96, 255, 133, 87, 244, 101, 166, 218, 167, 129, 225, 167]), - Bytes32::from([196, 159, 226, 85, 100, 246, 179, 251, 133, 33, 114, 51, 104, 245, 81, 54, 137, 126, 245, 76, 112, 146, 139, 185, 190, 19, 106, 132, 48, 203, 34, 237]), - Bytes32::from([41, 190, 7, 23, 227, 80, 13, 134, 244, 18, 215, 148, 1, 72, 1, 22, 91, 165, 182, 69, 160, 179, 241, 106, 254, 116, 245, 131, 136, 35, 190, 226]), - Bytes32::from([205, 132, 211, 121, 67, 210, 191, 102, 218, 92, 56, 204, 68, 160, 188, 100, 229, 80, 77, 27, 26, 86, 248, 86, 216, 39, 242, 211, 183, 139, 219, 83]), - Bytes32::from([13, 215, 68, 100, 180, 74, 23, 58, 157, 140, 76, 31, 114, 254, 85, 78, 234, 40, 251, 199, 35, 204, 111, 243, 163, 64, 221, 21, 96, 55, 127, 118]), - Bytes32::from([225, 14, 246, 105, 64, 96, 225, 200, 186, 66, 40, 253, 131, 80, 102, 178, 83, 22, 150, 32, 15, 139, 76, 172, 144, 3, 30, 43, 217, 213, 89, 43]), - Bytes32::from([200, 83, 93, 27, 98, 246, 87, 100, 53, 166, 89, 138, 157, 88, 148, 245, 61, 115, 246, 20, 142, 156, 54, 237, 179, 64, 148, 218, 67, 5, 142, 248]), - Bytes32::from([159, 25, 150, 25, 114, 252, 162, 57, 21, 125, 147, 111, 220, 117, 17, 107, 40, 21, 157, 183, 6, 63, 226, 37, 64, 179, 133, 58, 107, 245, 78, 14]), - Bytes32::from([58, 243, 16, 193, 174, 42, 255, 46, 40, 128, 26, 167, 173, 164, 71, 226, 155, 205, 26, 127, 154, 24, 74, 244, 106, 251, 25, 221, 197, 176, 194, 17]), - Bytes32::from([51, 47, 251, 206, 27, 9, 142, 27, 253, 132, 189, 62, 109, 150, 246, 2, 137, 90, 157, 185, 59, 96, 0, 154, 29, 17, 231, 3, 84, 95, 49, 51]), - Bytes32::from([250, 158, 158, 248, 206, 150, 95, 254, 53, 140, 80, 102, 67, 26, 76, 127, 236, 86, 182, 120, 72, 239, 190, 118, 60, 77, 28, 82, 152, 234, 73, 201]), - Bytes32::from([255, 137, 155, 144, 74, 231, 231, 43, 187, 202, 137, 66, 205, 37, 40, 225, 0, 33, 87, 137, 113, 163, 58, 64, 147, 74, 123, 128, 19, 156, 46, 83]), - Bytes32::from([207, 61, 79, 4, 202, 96, 238, 144, 154, 230, 145, 65, 230, 130, 246, 10, 140, 71, 66, 246, 53, 230, 148, 1, 248, 103, 145, 149, 157, 38, 169, 8]), - Bytes32::from([33, 168, 110, 82, 84, 151, 70, 98, 115, 2, 221, 116, 210, 10, 247, 189, 203, 245, 186, 86, 121, 142, 218, 95, 68, 241, 21, 219, 131, 241, 185, 203]), - Bytes32::from([125, 247, 7, 149, 181, 71, 68, 141, 123, 207, 144, 83, 170, 27, 244, 37, 210, 148, 0, 140, 144, 159, 237, 216, 227, 247, 85, 229, 80, 174, 40, 48]), - Bytes32::from([0, 205, 68, 89, 77, 97, 204, 140, 113, 244, 168, 76, 49, 137, 236, 21, 132, 99, 10, 206, 195, 206, 208, 120, 227, 77, 21, 223, 145, 227, 48, 139]), - Bytes32::from([10, 153, 106, 155, 149, 65, 211, 247, 246, 5, 129, 126, 74, 14, 113, 168, 152, 154, 205, 139, 49, 2, 182, 65, 163, 15, 62, 126, 62, 16, 26, 36]), - Bytes32::from([24, 251, 204, 187, 179, 146, 114, 66, 110, 182, 131, 248, 36, 170, 169, 128, 22, 221, 134, 193, 121, 189, 128, 94, 83, 255, 226, 37, 133, 83, 220, 181]), - Bytes32::from([25, 52, 245, 155, 53, 39, 73, 130, 12, 73, 106, 255, 44, 204, 208, 41, 32, 126, 159, 98, 197, 67, 58, 90, 6, 146, 25, 166, 195, 194, 215, 70]), - Bytes32::from([194, 167, 206, 222, 96, 6, 86, 241, 95, 105, 225, 147, 99, 93, 201, 220, 166, 145, 4, 25, 168, 188, 21, 168, 80, 163, 132, 216, 239, 19, 115, 36]), - Bytes32::from([243, 16, 4, 9, 140, 42, 62, 105, 97, 7, 4, 234, 200, 227, 42, 10, 51, 167, 38, 148, 69, 154, 143, 179, 94, 177, 248, 28, 33, 61, 166, 187]), - Bytes32::from([156, 201, 97, 197, 223, 83, 229, 186, 187, 33, 49, 210, 181, 222, 180, 234, 150, 33, 99, 168, 157, 26, 241, 1, 213, 220, 165, 8, 31, 76, 134, 243]), - Bytes32::from([34, 218, 29, 74, 212, 218, 95, 6, 53, 10, 63, 174, 119, 90, 90, 35, 92, 124, 169, 222, 75, 61, 199, 118, 132, 40, 193, 9, 250, 80, 12, 197]), - Bytes32::from([102, 137, 75, 155, 181, 222, 86, 192, 140, 167, 3, 178, 212, 165, 49, 163, 86, 8, 76, 240, 32, 202, 34, 159, 217, 173, 101, 125, 237, 34, 48, 179]), - Bytes32::from([136, 53, 156, 19, 107, 234, 210, 218, 180, 236, 9, 7, 80, 63, 146, 57, 77, 106, 135, 64, 23, 184, 9, 139, 61, 237, 225, 157, 183, 182, 137, 31]), - Bytes32::from([237, 226, 115, 218, 228, 122, 45, 46, 67, 21, 130, 204, 80, 2, 28, 47, 148, 191, 28, 33, 177, 47, 207, 14, 33, 117, 28, 46, 88, 254, 97, 227]), - Bytes32::from([38, 87, 252, 28, 105, 20, 117, 29, 234, 237, 60, 91, 48, 101, 219, 219, 24, 52, 169, 243, 71, 214, 117, 41, 207, 17, 148, 77, 218, 44, 122, 167]), - Bytes32::from([235, 31, 185, 222, 3, 22, 222, 174, 126, 128, 55, 67, 201, 229, 55, 28, 241, 144, 184, 85, 141, 153, 183, 211, 66, 80, 152, 248, 214, 130, 64, 205]), - Bytes32::from([52, 169, 226, 179, 195, 44, 245, 101, 35, 92, 145, 174, 152, 212, 192, 148, 241, 72, 248, 61, 239, 124, 98, 213, 181, 75, 84, 121, 57, 90, 172, 164]), - Bytes32::from([27, 19, 12, 74, 128, 193, 65, 63, 15, 6, 174, 167, 79, 56, 88, 13, 117, 6, 189, 14, 11, 13, 133, 136, 141, 64, 74, 17, 159, 192, 251, 242]), - Bytes32::from([101, 69, 132, 221, 127, 162, 162, 92, 248, 131, 39, 52, 169, 170, 231, 137, 123, 106, 161, 16, 202, 242, 216, 245, 211, 170, 74, 128, 108, 243, 166, 38]), - Bytes32::from([157, 82, 193, 234, 117, 199, 118, 245, 63, 31, 186, 32, 135, 233, 29, 213, 217, 119, 208, 64, 149, 116, 117, 129, 211, 225, 207, 22, 225, 99, 194, 222]), - Bytes32::from([112, 194, 64, 229, 154, 223, 109, 8, 191, 120, 32, 176, 154, 7, 174, 103, 2, 156, 230, 164, 245, 252, 0, 116, 213, 40, 20, 239, 135, 62, 198, 42]), - Bytes32::from([32, 91, 5, 170, 221, 134, 167, 144, 16, 130, 237, 114, 71, 184, 131, 223, 92, 149, 161, 68, 196, 56, 73, 148, 203, 187, 174, 178, 178, 53, 156, 177]), - Bytes32::from([234, 97, 64, 211, 81, 59, 14, 249, 38, 8, 247, 37, 243, 37, 88, 234, 19, 54, 146, 63, 88, 79, 127, 190, 144, 51, 240, 19, 15, 143, 18, 9]), - Bytes32::from([247, 102, 43, 28, 24, 201, 189, 198, 66, 58, 210, 51, 174, 234, 52, 239, 37, 83, 212, 184, 127, 170, 168, 127, 47, 11, 248, 213, 84, 3, 201, 181]), - Bytes32::from([126, 18, 116, 33, 129, 25, 247, 2, 162, 202, 103, 201, 237, 67, 28, 80, 46, 182, 163, 239, 90, 204, 47, 196, 137, 79, 19, 165, 209, 84, 140, 132]), - Bytes32::from([189, 160, 148, 101, 82, 248, 215, 206, 90, 91, 205, 148, 37, 38, 172, 82, 223, 228, 66, 173, 220, 246, 194, 73, 231, 17, 220, 47, 222, 175, 7, 24]), - Bytes32::from([237, 149, 54, 210, 99, 72, 182, 55, 69, 140, 161, 215, 104, 90, 104, 26, 216, 241, 232, 210, 37, 77, 56, 216, 6, 160, 199, 247, 164, 227, 142, 255]), - Bytes32::from([11, 57, 131, 77, 203, 89, 156, 126, 200, 215, 103, 209, 70, 235, 78, 247, 0, 126, 209, 248, 220, 135, 158, 244, 141, 74, 6, 158, 19, 37, 42, 39]), - Bytes32::from([107, 131, 231, 102, 64, 182, 78, 253, 77, 143, 94, 34, 199, 93, 44, 131, 169, 211, 71, 223, 53, 230, 59, 107, 146, 22, 188, 207, 210, 220, 168, 129]), - Bytes32::from([78, 71, 246, 216, 154, 188, 152, 6, 234, 254, 21, 1, 128, 148, 56, 91, 250, 95, 76, 103, 15, 250, 137, 186, 114, 254, 122, 69, 208, 242, 69, 111]), - Bytes32::from([82, 241, 242, 155, 248, 109, 84, 118, 225, 255, 122, 40, 3, 87, 20, 223, 212, 205, 141, 178, 32, 229, 234, 146, 101, 73, 79, 55, 28, 82, 81, 178]), - Bytes32::from([35, 169, 243, 198, 215, 220, 113, 91, 6, 79, 48, 201, 97, 143, 212, 34, 247, 46, 38, 93, 166, 213, 158, 218, 61, 86, 240, 149, 224, 174, 225, 73]), - Bytes32::from([25, 108, 21, 212, 193, 192, 96, 39, 57, 72, 193, 99, 239, 0, 231, 83, 183, 195, 105, 33, 220, 187, 18, 148, 43, 30, 42, 127, 192, 240, 13, 224]), - Bytes32::from([119, 117, 186, 31, 43, 128, 143, 25, 182, 135, 156, 58, 152, 81, 70, 116, 171, 137, 125, 157, 152, 163, 34, 65, 240, 178, 12, 24, 168, 111, 39, 35]) - ]); - zero_hashes - }; -} \ No newline at end of file +pub const ZERO_HASHES: &[&[Bytes32; 64]; 7] = &[ + FUNCTION_HASHES, + VALUE_HASHES, + INSTRUCTION_HASHES, + MEMORY_HASHES, + TABLE_HASHES, + TABLE_ELEMENT_HASHES, + MODULE_HASHES, +]; \ No newline at end of file From c5d29939fdd6c271da1c3addeb9376b9755e5cf0 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 26 Apr 2024 23:30:50 +0200 Subject: [PATCH 025/140] Fix order of VALUES and FUNCTIONS. Yay! Tests caught typos. --- arbitrator/prover/src/merkle/zerohashes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle/zerohashes.rs b/arbitrator/prover/src/merkle/zerohashes.rs index 5b72e010fe..e0db5fbee2 100644 --- a/arbitrator/prover/src/merkle/zerohashes.rs +++ b/arbitrator/prover/src/merkle/zerohashes.rs @@ -470,8 +470,8 @@ const MODULE_HASHES: &[Bytes32; 64] = &[ ]; pub const ZERO_HASHES: &[&[Bytes32; 64]; 7] = &[ - FUNCTION_HASHES, VALUE_HASHES, + FUNCTION_HASHES, INSTRUCTION_HASHES, MEMORY_HASHES, TABLE_HASHES, From 0cce10c41f76f68233f28c12544bca4b3d29cbc7 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Sat, 27 Apr 2024 00:05:05 +0200 Subject: [PATCH 026/140] Make merkle.rs compile with non-rayon. Previously, this wouldn't work because the collect_into_iter() method is not supported on the non-rayon map. --- arbitrator/prover/src/merkle.rs | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index b1a3a6c03b..628b6c64eb 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -188,6 +188,26 @@ const fn empty_hash_at(ty: MerkleType, layer_i: usize) -> Bytes32 { } } +#[inline] +#[cfg(feature = "rayon")] +fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: Bytes32) -> Vec { + let mut new_layer: Vec = Vec::with_capacity(layer.len() >> 1); + let chunks = layer.par_chunks(2); + chunks + .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_hash))) + .collect_into_vec(&mut new_layer); + new_layer +} + +#[inline] +#[cfg(not(feature = "rayon"))] +fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: Bytes32) -> Vec { + let new_layer = layer.chunks(2) + .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_hash))) + .collect(); + new_layer +} + impl Merkle { /// Creates a new Merkle tree with the given type and leaf hashes. /// The tree is built up to the minimum depth necessary to hold all the @@ -219,16 +239,7 @@ impl Merkle { let layer = layers.last().unwrap(); let empty_hash = empty_hash_at(ty, layer_i); - #[cfg(feature = "rayon")] - let chunks = layer.par_chunks(2); - - #[cfg(not(feature = "rayon"))] - let chunks = layer.chunks(2); - - let mut new_layer: Vec = Vec::with_capacity(layer.len() >> 1); - chunks - .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_hash))) - .collect_into_vec(&mut new_layer); + let new_layer = new_layer(ty, layer, empty_hash); dirty_indices.push(HashSet::with_capacity(new_layer.len())); layers.push(new_layer); layer_i += 1; From 2f2e1731ec828bd153bdc532a2075da010565f3e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Sat, 27 Apr 2024 00:06:20 +0200 Subject: [PATCH 027/140] Actually set the cached merkle back on the instance. This is why there were all those unexpected "new_advanced" calls on the memory merkle. The resizes were actually setting self.merkle back to None. --- arbitrator/prover/src/memory.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index d8cb9cec15..98e4cc4195 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -312,8 +312,10 @@ impl Memory { self.buffer.resize(new_size, 0); if let Some(mut merkle) = self.merkle.take() { let extra = new_size - merkle.len(); - merkle.extend(vec![hash_leaf([0u8; 32]); extra]) - .expect("Couldn't extend merkle tree"); + merkle + .extend(vec![hash_leaf([0u8; 32]); extra]) + .expect("Couldn't extend merkle tree"); + self.merkle = Some(merkle); } } } From fc16ec383d87a756c810324b32add30699afc94b Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Sat, 27 Apr 2024 01:02:21 +0200 Subject: [PATCH 028/140] Update the version of the enum-iterator-derive crate. --- arbitrator/wasm-libraries/Cargo.lock | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/arbitrator/wasm-libraries/Cargo.lock b/arbitrator/wasm-libraries/Cargo.lock index c5e3855259..650484a631 100644 --- a/arbitrator/wasm-libraries/Cargo.lock +++ b/arbitrator/wasm-libraries/Cargo.lock @@ -378,7 +378,16 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" dependencies = [ - "enum-iterator-derive", + "enum-iterator-derive 0.7.0", +] + +[[package]] +name = "enum-iterator" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0b48d2b80ff6b002339547442496ea29d66a8c66ce8e1a6bd8c58b9cec7cf3" +dependencies = [ + "enum-iterator-derive 1.3.1", ] [[package]] @@ -392,6 +401,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum-iterator-derive" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19cbb53d33b57ac4df1f0af6b92c38c107cded663c4aea9fae1189dcfc17cf5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "enumset" version = "1.1.3" @@ -887,6 +907,7 @@ dependencies = [ "brotli", "derivative", "digest 0.9.0", + "enum-iterator 2.0.1", "eyre", "fnv", "hex", @@ -1481,7 +1502,7 @@ name = "wasmer-types" version = "4.2.3" dependencies = [ "bytecheck", - "enum-iterator", + "enum-iterator 0.7.0", "enumset", "indexmap 1.9.3", "more-asserts", From 1a52847b58d6773b6bf011ccd37736c8521279fa Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Mon, 29 Apr 2024 13:56:39 +0200 Subject: [PATCH 029/140] Update the logic for expand to include upper layers. There was a bug where expanding the lowest layer and calling set on all of the new elements was not sufficient to grow the upper layers. This commit also fixes a warning about the package-level profile override being ineffective. --- arbitrator/bench/Cargo.toml | 3 --- arbitrator/bench/src/bin.rs | 4 ++-- arbitrator/prover/src/merkle.rs | 8 ++++++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arbitrator/bench/Cargo.toml b/arbitrator/bench/Cargo.toml index 3441321877..396988ed83 100644 --- a/arbitrator/bench/Cargo.toml +++ b/arbitrator/bench/Cargo.toml @@ -23,6 +23,3 @@ gperftools = { version = "0.2.0", optional = true } counters = [] cpuprof = ["gperftools"] heapprof = ["gperftools", "gperftools/heap"] - -[profile.release] -debug = true diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index a2c94a6c7c..723a1a92d1 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -33,7 +33,7 @@ struct Args { fn main() -> eyre::Result<()> { let args = Args::parse(); - let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20]; + let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; if args.always_merkleize { println!("Running benchmark with always merkleize feature on"); } else { @@ -94,7 +94,7 @@ fn main() -> eyre::Result<()> { let total_end_time = total.elapsed(); println!( - "avg hash time {:?}, avg step time {:?}, step size {}, num_iters {}, total time {:?}", + "avg hash time {:>12?}, avg step time {:>12?}, step size {:>8}, num_iters {}, total time {:>12?}", average(&hash_times), average(&step_times), step_size, diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 3af5bd2ae8..29606d42de 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -305,7 +305,7 @@ impl Merkle { } else if idx == layer.len() { layer.push(next_hash); } else { - panic!("Index {} out of bounds {}", idx, layer.len()); + panic!("Index {} out of bounds {} in layer {}", idx, layer.len(), layer_i); } if layer_i == layers_len - 1 { // next_hash isn't needed @@ -334,7 +334,11 @@ impl Merkle { return Err("Cannot extend with more leaves than the capicity of the tree.".to_owned()); } let mut idx = self.layers[0].len(); - self.layers[0].resize(idx + hashes.len(), self.empty_layers[0]); + let mut new_size = idx + hashes.len(); + for (layer_i, layer) in self.layers.iter_mut().enumerate() { + layer.resize(new_size, self.empty_layers[layer_i]); + new_size >>= 1; + } for hash in hashes { self.set(idx, hash); idx += 1; From bcf845504b87a973169c6a087d769e6d65216471 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Mon, 29 Apr 2024 15:40:31 +0200 Subject: [PATCH 030/140] Fix the merge issue for index out of bounds. --- arbitrator/prover/src/merkle.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 34d489ef0c..ed23db0fc5 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -33,6 +33,8 @@ mod zerohashes; use zerohashes::ZERO_HASHES; +use crate::print; + #[cfg(feature = "counters")] lazy_static! { static ref NEW_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { @@ -382,7 +384,7 @@ impl Merkle { if hashes.len() > capacity(layers.as_ref()) - layers[0].len() { return Err("Cannot extend with more leaves than the capicity of the tree.".to_owned()); } - let mut idx = layers.len(); + let mut idx = layers[0].len(); let mut new_size = idx + hashes.len(); for (layer_i, layer) in layers.iter_mut().enumerate() { layer.resize(new_size, empty_hash_at(self.ty, layer_i)); From 72bc92fb64ffd8816e8c3847ae7e7f852941403f Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 30 Apr 2024 10:25:50 +0200 Subject: [PATCH 031/140] Remove the bold submodule. I don't think it's being used. --- bold | 1 - 1 file changed, 1 deletion(-) delete mode 160000 bold diff --git a/bold b/bold deleted file mode 160000 index f456e2fbfa..0000000000 --- a/bold +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f456e2fbfa8560e52ada5fcc5ce927577d07483d From 6f7cafa341a032c81ce0230d0c2647d6f20135e5 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 30 Apr 2024 14:44:59 +0200 Subject: [PATCH 032/140] Enable always_merkelize for all uses of the merkle tree. --- arbitrator/prover/src/lib.rs | 4 ++-- arbitrator/prover/src/machine.rs | 4 ++-- arbitrator/stylus/src/test/mod.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index 85c0ca2aa8..f3169e8ef8 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -101,7 +101,7 @@ unsafe fn arbitrator_load_machine_impl( &libraries, binary_path, true, - false, + true, false, debug_chain, debug_chain, @@ -117,7 +117,7 @@ unsafe fn arbitrator_load_machine_impl( pub unsafe extern "C" fn arbitrator_load_wavm_binary(binary_path: *const c_char) -> *mut Machine { let binary_path = cstr_to_string(binary_path); let binary_path = Path::new(&binary_path); - match Machine::new_from_wavm(binary_path, false) { + match Machine::new_from_wavm(binary_path, true) { Ok(mach) => Box::into_raw(Box::new(mach)), Err(err) => { eprintln!("Error loading binary: {err}"); diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index 77fcdca883..e836bed5f1 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -1245,11 +1245,11 @@ impl Machine { let soft_float = std::fs::read("../../target/machines/latest/soft-float.wasm")?; let soft_float = parse(&soft_float, Path::new("soft-float"))?; - let mut machine = Self::from_binaries( + let mut machine: Machine = Self::from_binaries( &[soft_float, wasi_stub, user_test], bin, false, - false, + true, false, compile.debug.debug_funcs, true, diff --git a/arbitrator/stylus/src/test/mod.rs b/arbitrator/stylus/src/test/mod.rs index 0f1cfd7618..a6259d82bf 100644 --- a/arbitrator/stylus/src/test/mod.rs +++ b/arbitrator/stylus/src/test/mod.rs @@ -150,7 +150,7 @@ fn new_test_machine(path: &str, compile: &CompileConfig) -> Result { &[lib], bin, false, - false, + true, true, compile.debug.debug_funcs, true, From 36578d7d415df6a99fc4346cf643cf36227526f4 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 30 Apr 2024 15:04:18 +0200 Subject: [PATCH 033/140] Make clippy happy. --- arbitrator/prover/src/flat_merkle.rs | 2 +- arbitrator/prover/src/merkle.rs | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arbitrator/prover/src/flat_merkle.rs b/arbitrator/prover/src/flat_merkle.rs index 4c46c0b2b6..87ce55d14b 100644 --- a/arbitrator/prover/src/flat_merkle.rs +++ b/arbitrator/prover/src/flat_merkle.rs @@ -58,7 +58,7 @@ impl Merkle { Self::new_advanced(ty, hashes, Bytes32::default(), 0) } pub fn new_advanced( - ty: MerkleType, + _ty: MerkleType, hashes: Vec, empty_hash: Bytes32, min_depth: usize, diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 29606d42de..75f27d38e6 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -10,6 +10,7 @@ use enum_iterator::Sequence; use enum_iterator::all; +use std::cmp::Ordering; #[cfg(feature = "counters")] use std::sync::atomic::AtomicUsize; @@ -242,6 +243,10 @@ impl Merkle { self.layers[0].len() } + pub fn is_empty(&self) -> bool { + self.layers.is_empty() || self.layers[0].is_empty() + } + #[must_use] pub fn prove(&self, idx: usize) -> Option> { if idx >= self.leaves().len() { @@ -300,12 +305,10 @@ impl Merkle { let empty_layers = &self.empty_layers; let layers_len = self.layers.len(); for (layer_i, layer) in self.layers.iter_mut().enumerate() { - if idx < layer.len() { - layer[idx] = next_hash; - } else if idx == layer.len() { - layer.push(next_hash); - } else { - panic!("Index {} out of bounds {} in layer {}", idx, layer.len(), layer_i); + match idx.cmp(&layer.len()) { + Ordering::Less => layer[idx] = next_hash, + Ordering::Equal => layer.push(next_hash), + Ordering::Greater => panic!("Index {} out of bounds {} in layer {}", idx, layer.len(), layer_i), } if layer_i == layers_len - 1 { // next_hash isn't needed @@ -343,7 +346,7 @@ impl Merkle { self.set(idx, hash); idx += 1; } - return Ok(self.layers[0].len()); + Ok(self.layers[0].len()) } } From 97d93d5b08e2e9a28ea72803c007ecf2393f79a7 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 30 Apr 2024 15:57:58 +0200 Subject: [PATCH 034/140] Add the fake stuff for the benchmarks to the Dockerfile. I have no idea why this is needed. But, it makes `make docker` successful again. --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6e26a16226..2eba3ca25c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -99,6 +99,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ COPY arbitrator/Cargo.* arbitrator/ COPY ./Makefile ./ COPY arbitrator/arbutil arbitrator/arbutil +COPY arbitrator/bench arbitrator/bench COPY arbitrator/brotli arbitrator/brotli COPY arbitrator/caller-env arbitrator/caller-env COPY arbitrator/prover arbitrator/prover @@ -127,9 +128,12 @@ RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ COPY --from=brotli-library-export / target/ COPY arbitrator/Cargo.* arbitrator/ COPY arbitrator/arbutil arbitrator/arbutil +COPY arbitrator/bench arbitrator/bench COPY arbitrator/brotli arbitrator/brotli COPY arbitrator/caller-env arbitrator/caller-env COPY arbitrator/prover/Cargo.toml arbitrator/prover/ +COPY arbitrator/prover/benches arbitrator/prover/benches +COPY arbitrator/bench/Cargo.toml arbitrator/bench/ COPY arbitrator/jit/Cargo.toml arbitrator/jit/ COPY arbitrator/stylus/Cargo.toml arbitrator/stylus/ COPY arbitrator/tools/wasmer arbitrator/tools/wasmer @@ -137,11 +141,15 @@ COPY arbitrator/wasm-libraries/user-host-trait/Cargo.toml arbitrator/wasm-librar RUN bash -c 'mkdir arbitrator/{prover,jit,stylus}/src arbitrator/wasm-libraries/user-host-trait/src' RUN echo "fn test() {}" > arbitrator/jit/src/lib.rs && \ echo "fn test() {}" > arbitrator/prover/src/lib.rs && \ + echo "fn test() {}" > arbitrator/bench/src/lib.rs && \ + echo "fn test() {}" > arbitrator/prover/benches/merkle_bench.rs && \ echo "fn test() {}" > arbitrator/stylus/src/lib.rs && \ echo "fn test() {}" > arbitrator/wasm-libraries/user-host-trait/src/lib.rs && \ cargo build --manifest-path arbitrator/Cargo.toml --release --lib && \ rm arbitrator/prover/src/lib.rs arbitrator/jit/src/lib.rs arbitrator/stylus/src/lib.rs && \ - rm arbitrator/wasm-libraries/user-host-trait/src/lib.rs + rm arbitrator/wasm-libraries/user-host-trait/src/lib.rs && \ + rm arbitrator/prover/benches/merkle_bench.rs && \ + rm arbitrator/bench/src/lib.rs COPY ./Makefile ./ COPY arbitrator/prover arbitrator/prover COPY arbitrator/wasm-libraries arbitrator/wasm-libraries From e3d7cf4626b4cfc8e8f2821fd377dc4777045c23 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 30 Apr 2024 16:29:57 +0200 Subject: [PATCH 035/140] Make clippy even happier. --- arbitrator/bench/src/parse_input.rs | 32 ++++++++++++++--------------- arbitrator/bench/src/prepare.rs | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arbitrator/bench/src/parse_input.rs b/arbitrator/bench/src/parse_input.rs index 9b645850f7..32f1c15ed3 100644 --- a/arbitrator/bench/src/parse_input.rs +++ b/arbitrator/bench/src/parse_input.rs @@ -58,21 +58,21 @@ impl FileData { let mut line = String::new(); while reader.read_line(&mut line)? > 0 { if line.starts_with("Id:") { - id = line.split(":").nth(1).unwrap().trim().parse().unwrap(); + id = line.split(':').nth(1).unwrap().trim().parse().unwrap(); } else if line.starts_with("HasDelayedMsg:") { - has_delayed_msg = line.split(":").nth(1).unwrap().trim().parse().unwrap(); + has_delayed_msg = line.split(':').nth(1).unwrap().trim().parse().unwrap(); } else if line.starts_with("DelayedMsgNr:") { - delayed_msg_nr = line.split(":").nth(1).unwrap().trim().parse().unwrap(); + delayed_msg_nr = line.split(':').nth(1).unwrap().trim().parse().unwrap(); } else if line.starts_with("Preimages:") { items.push(Item::from_reader(&mut reader, &mut line)?); } else if line.starts_with("BatchInfo:") { - let parts: Vec<_> = line.split(",").collect(); - batch_info.number = parts[0].split(":").nth(2).unwrap().trim().parse().unwrap(); - batch_info.data = hex::decode(parts[1].split(":").nth(1).unwrap().trim()).unwrap(); + let parts: Vec<_> = line.split(',').collect(); + batch_info.number = parts[0].split(':').nth(2).unwrap().trim().parse().unwrap(); + batch_info.data = hex::decode(parts[1].split(':').nth(1).unwrap().trim()).unwrap(); } else if line.starts_with("DelayedMsg:") { - delayed_msg = hex::decode(line.split(":").nth(1).unwrap().trim()).unwrap(); + delayed_msg = hex::decode(line.split(':').nth(1).unwrap().trim()).unwrap(); } else if line.starts_with("StartState:") { - let parts: Vec<_> = line.split(",").collect(); + let parts: Vec<_> = line.split(',').collect(); // Parsing block_hash let block_hash_str = parts[0].split("BlockHash:").nth(1).unwrap().trim(); @@ -80,13 +80,13 @@ impl FileData { hex::decode(block_hash_str.strip_prefix("0x").unwrap()).unwrap(); // Parsing send_root - let send_root_str = parts[1].split(":").nth(1).unwrap().trim(); + let send_root_str = parts[1].split(':').nth(1).unwrap().trim(); start_state.send_root = hex::decode(send_root_str.strip_prefix("0x").unwrap()).unwrap(); // Parsing batch start_state.batch = parts[2] - .split(":") + .split(':') .nth(1) .unwrap() .trim() @@ -95,7 +95,7 @@ impl FileData { // Parsing pos_in_batch start_state.pos_in_batch = parts[3] - .split(":") + .split(':') .nth(1) .unwrap() .trim() @@ -131,12 +131,12 @@ impl Item { } if line.starts_with("Preimages:") { line.clear(); - while reader.read_line(line)? > 0 && line.starts_with("\t") { - let parts: Vec<_> = line.trim().split(",").collect(); - let type_ = parts[0].split(":").nth(1).unwrap().trim().parse().unwrap(); + while reader.read_line(line)? > 0 && line.starts_with('\t') { + let parts: Vec<_> = line.trim().split(',').collect(); + let type_ = parts[0].split(':').nth(1).unwrap().trim().parse().unwrap(); let hash = hex::decode( parts[1] - .split(":") + .split(':') .nth(1) .unwrap() .trim() @@ -144,7 +144,7 @@ impl Item { .unwrap(), ) .unwrap(); - let data = hex::decode(parts[2].split(":").nth(1).unwrap().trim()).unwrap(); + let data = hex::decode(parts[2].split(':').nth(1).unwrap().trim()).unwrap(); preimages.push(Preimage { type_, hash, data }); line.clear(); } diff --git a/arbitrator/bench/src/prepare.rs b/arbitrator/bench/src/prepare.rs index 4004e467a9..daf0f48f8f 100644 --- a/arbitrator/bench/src/prepare.rs +++ b/arbitrator/bench/src/prepare.rs @@ -14,11 +14,11 @@ pub fn prepare_machine( machines: PathBuf, always_merkleize: bool, ) -> eyre::Result { - let file = File::open(&preimages)?; + let file = File::open(preimages)?; let reader = BufReader::new(file); let data = FileData::from_reader(reader)?; - let item = data.items.get(0).unwrap().clone(); + let item = data.items.first().unwrap().clone(); let preimages = item.preimages; let preimages = preimages .into_iter() From 521a7d830f49718bb73842b3b03a27483dd9a3e7 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 30 Apr 2024 18:24:59 +0200 Subject: [PATCH 036/140] Cargo fmt changes only. --- arbitrator/bench/src/bin.rs | 12 ++- arbitrator/prover/benches/merkle_bench.rs | 12 ++- arbitrator/prover/src/merkle.rs | 109 ++++++++++++++++------ 3 files changed, 99 insertions(+), 34 deletions(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 723a1a92d1..23930652c2 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -51,10 +51,18 @@ fn main() -> eyre::Result<()> { let mut num_iters = 0; #[cfg(feature = "cpuprof")] - PROFILER.lock().unwrap().start(format!("./target/bench-{}.prof", step_size)).unwrap(); + PROFILER + .lock() + .unwrap() + .start(format!("./target/bench-{}.prof", step_size)) + .unwrap(); #[cfg(feature = "heapprof")] - HEAP_PROFILER.lock().unwrap().start(format!("./target/bench-{}.hprof", step_size)).unwrap(); + HEAP_PROFILER + .lock() + .unwrap() + .start(format!("./target/bench-{}.hprof", step_size)) + .unwrap(); #[cfg(feature = "counters")] merkle::reset_counters(); diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs index 20b566e077..ee8905964f 100644 --- a/arbitrator/prover/benches/merkle_bench.rs +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -1,6 +1,6 @@ +use arbutil::Bytes32; use criterion::{criterion_group, criterion_main, Criterion}; use prover::merkle::{Merkle, MerkleType}; -use arbutil::Bytes32; use rand::Rng; fn extend_and_set_leavees(mut merkle: Merkle, rng: &mut rand::rngs::ThreadRng) { @@ -14,7 +14,7 @@ fn extend_and_set_leavees(mut merkle: Merkle, rng: &mut rand::rngs::ThreadRng) { for _ in 0..100 { merkle.extend(new_leaves.clone()).expect("extend failed"); - for _ in 0..(merkle.len()/10) { + for _ in 0..(merkle.len() / 10) { let random_index = rng.gen_range(0..merkle.len()); merkle.set(random_index, Bytes32::from([rng.gen_range(0u8..9); 32])); } @@ -35,7 +35,8 @@ fn merkle_benchmark(c: &mut Criterion) { // Perform many calls to set leaves to new values c.bench_function("extend_set_leaves_and_root", |b| { b.iter(|| { - let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 20); + let merkle = + Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 20); extend_and_set_leavees(merkle.clone(), &mut rng); }) }); @@ -50,11 +51,12 @@ fn merkle_construction(c: &mut Criterion) { c.bench_function("merkle_construction", |b| { b.iter(|| { - let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 21); + let merkle = + Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 21); merkle.root(); }) }); } criterion_group!(benches, merkle_benchmark, merkle_construction); -criterion_main!(benches); \ No newline at end of file +criterion_main!(benches); diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 75f27d38e6..52afd587dd 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -9,7 +9,6 @@ use enum_iterator::Sequence; #[cfg(feature = "counters")] use enum_iterator::all; - use std::cmp::Ordering; #[cfg(feature = "counters")] use std::sync::atomic::AtomicUsize; @@ -20,13 +19,12 @@ use std::sync::atomic::Ordering; #[cfg(feature = "counters")] use lazy_static::lazy_static; - #[cfg(feature = "counters")] use std::collections::HashMap; +use core::panic; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use core::panic; use std::convert::{TryFrom, TryInto}; #[cfg(feature = "rayon")] @@ -78,7 +76,6 @@ lazy_static! { }; } - #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Serialize, Deserialize, Sequence)] pub enum MerkleType { Empty, @@ -103,8 +100,13 @@ pub fn print_counters() { if ty == MerkleType::Empty { continue; } - println!("{} New: {}, Root: {}, Set: {}", - ty.get_prefix(), NEW_COUNTERS[&ty].load(Ordering::Relaxed), ROOT_COUNTERS[&ty].load(Ordering::Relaxed), SET_COUNTERS[&ty].load(Ordering::Relaxed)); + println!( + "{} New: {}, Root: {}, Set: {}", + ty.get_prefix(), + NEW_COUNTERS[&ty].load(Ordering::Relaxed), + ROOT_COUNTERS[&ty].load(Ordering::Relaxed), + SET_COUNTERS[&ty].load(Ordering::Relaxed) + ); } } @@ -136,19 +138,19 @@ impl MerkleType { } /// A Merkle tree with a fixed number of layers -/// +/// /// https://en.wikipedia.org/wiki/Merkle_tree -/// +/// /// Each instance's leaves contain the hashes of a specific [MerkleType]. /// The tree does not grow in height, but it can be initialized with fewer /// leaves than the number that could be contained in its layers. -/// +/// /// When initialized with [Merkle::new], the tree has the minimum depth /// necessary to hold all the leaves. (e.g. 5 leaves -> 4 layers.) -/// +/// /// It can be over-provisioned using the [Merkle::new_advanced] method /// and passing a minimum depth. -/// +/// /// This structure does not contain the data itself, only the hashes. #[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] pub struct Merkle { @@ -235,7 +237,7 @@ impl Merkle { #[inline] fn capacity(&self) -> usize { let base: usize = 2; - base.pow((self.layers.len() -1).try_into().unwrap()) + base.pow((self.layers.len() - 1).try_into().unwrap()) } // Returns the number of leaves in the tree. @@ -308,7 +310,12 @@ impl Merkle { match idx.cmp(&layer.len()) { Ordering::Less => layer[idx] = next_hash, Ordering::Equal => layer.push(next_hash), - Ordering::Greater => panic!("Index {} out of bounds {} in layer {}", idx, layer.len(), layer_i), + Ordering::Greater => panic!( + "Index {} out of bounds {} in layer {}", + idx, + layer.len(), + layer_i + ), } if layer_i == layers_len - 1 { // next_hash isn't needed @@ -328,7 +335,7 @@ impl Merkle { } /// Extends the leaves of the tree with the given hashes. - /// + /// /// Returns the new number of leaves in the tree. /// Erorrs if the number of hashes plus the current leaves is greater than /// the capacity of the tree. @@ -359,33 +366,73 @@ fn extend_works() { Bytes32::from([4; 32]), Bytes32::from([5; 32]), ]; - let mut expected = hash_node(MerkleType::Value, + let mut expected = hash_node( + MerkleType::Value, hash_node( MerkleType::Value, - hash_node(MerkleType::Value, Bytes32::from([1; 32]), Bytes32::from([2; 32])), - hash_node(MerkleType::Value, Bytes32::from([3; 32]), Bytes32::from([4; 32]))), + hash_node( + MerkleType::Value, + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + ), + ), hash_node( MerkleType::Value, - hash_node(MerkleType::Value, Bytes32::from([5; 32]), Bytes32::from([0; 32])), - hash_node(MerkleType::Value, Bytes32::from([0; 32]), Bytes32::from([0; 32])))); + hash_node( + MerkleType::Value, + Bytes32::from([5; 32]), + Bytes32::from([0; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([0; 32]), + Bytes32::from([0; 32]), + ), + ), + ); let mut merkle = Merkle::new(MerkleType::Value, hashes.clone()); assert_eq!(merkle.capacity(), 8); assert_eq!(merkle.root(), expected); let new_size = match merkle.extend(vec![Bytes32::from([6; 32])]) { Ok(size) => size, - Err(e) => panic!("{}", e) + Err(e) => panic!("{}", e), }; assert_eq!(new_size, 6); - expected = hash_node(MerkleType::Value, + expected = hash_node( + MerkleType::Value, hash_node( MerkleType::Value, - hash_node(MerkleType::Value, Bytes32::from([1; 32]), Bytes32::from([2; 32])), - hash_node(MerkleType::Value, Bytes32::from([3; 32]), Bytes32::from([4; 32]))), + hash_node( + MerkleType::Value, + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + ), + ), hash_node( MerkleType::Value, - hash_node(MerkleType::Value, Bytes32::from([5; 32]), Bytes32::from([6; 32])), - hash_node(MerkleType::Value, Bytes32::from([0; 32]), Bytes32::from([0; 32])))); + hash_node( + MerkleType::Value, + Bytes32::from([5; 32]), + Bytes32::from([6; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([0; 32]), + Bytes32::from([0; 32]), + ), + ), + ); assert_eq!(merkle.root(), expected); } @@ -393,14 +440,22 @@ fn extend_works() { fn correct_capacity() { let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::from([1; 32])]); assert_eq!(merkle.capacity(), 1); - let merkle = Merkle::new_advanced(MerkleType::Memory, vec![Bytes32::from([1; 32])], Bytes32::default(), 11); + let merkle = Merkle::new_advanced( + MerkleType::Memory, + vec![Bytes32::from([1; 32])], + Bytes32::default(), + 11, + ); assert_eq!(merkle.capacity(), 1024); } #[test] #[should_panic] fn set_with_bad_index_panics() { - let mut merkle = Merkle::new(MerkleType::Value, vec![Bytes32::default(), Bytes32::default()]); + let mut merkle = Merkle::new( + MerkleType::Value, + vec![Bytes32::default(), Bytes32::default()], + ); assert_eq!(merkle.capacity(), 2); merkle.set(2, Bytes32::default()); } From cf50743843659560bd079c6f651b345003df6642 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 1 May 2024 23:32:58 +0200 Subject: [PATCH 037/140] Fix right-shifting to zero. --- arbitrator/prover/src/merkle.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 52afd587dd..adf4c1ea80 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -9,6 +9,7 @@ use enum_iterator::Sequence; #[cfg(feature = "counters")] use enum_iterator::all; +use std::cmp::max; use std::cmp::Ordering; #[cfg(feature = "counters")] use std::sync::atomic::AtomicUsize; @@ -347,7 +348,7 @@ impl Merkle { let mut new_size = idx + hashes.len(); for (layer_i, layer) in self.layers.iter_mut().enumerate() { layer.resize(new_size, self.empty_layers[layer_i]); - new_size >>= 1; + new_size = max(new_size >> 1, 1); } for hash in hashes { self.set(idx, hash); From cc71b3275112bf81af511900439aea864a0f5c67 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 2 May 2024 00:55:06 +0200 Subject: [PATCH 038/140] Turn off always_merkelize for now. The system tests are timing out because the implementation is still too slow for large steps with lots of store and resize memory calls. --- arbitrator/prover/src/lib.rs | 4 ++-- arbitrator/prover/src/machine.rs | 4 ++-- arbitrator/stylus/src/test/mod.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index f3169e8ef8..85c0ca2aa8 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -101,7 +101,7 @@ unsafe fn arbitrator_load_machine_impl( &libraries, binary_path, true, - true, + false, false, debug_chain, debug_chain, @@ -117,7 +117,7 @@ unsafe fn arbitrator_load_machine_impl( pub unsafe extern "C" fn arbitrator_load_wavm_binary(binary_path: *const c_char) -> *mut Machine { let binary_path = cstr_to_string(binary_path); let binary_path = Path::new(&binary_path); - match Machine::new_from_wavm(binary_path, true) { + match Machine::new_from_wavm(binary_path, false) { Ok(mach) => Box::into_raw(Box::new(mach)), Err(err) => { eprintln!("Error loading binary: {err}"); diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index 22da90bb80..6f99cd905e 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -1243,11 +1243,11 @@ impl Machine { let soft_float = std::fs::read("../../target/machines/latest/soft-float.wasm")?; let soft_float = parse(&soft_float, Path::new("soft-float"))?; - let mut machine: Machine = Self::from_binaries( + let mut machine = Self::from_binaries( &[soft_float, wasi_stub, user_test], bin, false, - true, + false, false, compile.debug.debug_funcs, true, diff --git a/arbitrator/stylus/src/test/mod.rs b/arbitrator/stylus/src/test/mod.rs index a6259d82bf..0f1cfd7618 100644 --- a/arbitrator/stylus/src/test/mod.rs +++ b/arbitrator/stylus/src/test/mod.rs @@ -150,7 +150,7 @@ fn new_test_machine(path: &str, compile: &CompileConfig) -> Result { &[lib], bin, false, - true, + false, true, compile.debug.debug_funcs, true, From d8069c837f03927a573b34b6224f5aca11cf84cd Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 2 May 2024 14:22:33 +0200 Subject: [PATCH 039/140] Fix up the branch after merges. --- arbitrator/prover/benches/merkle_bench.rs | 6 +- arbitrator/prover/src/memory.rs | 1 - arbitrator/prover/src/merkle.rs | 99 +- arbitrator/prover/src/merkle/zerohashes.rs | 2244 ++++++++++++++++---- 4 files changed, 1827 insertions(+), 523 deletions(-) diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs index d1b37b93f7..f64bfa780a 100644 --- a/arbitrator/prover/benches/merkle_bench.rs +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -35,8 +35,7 @@ fn merkle_benchmark(c: &mut Criterion) { // Perform many calls to set leaves to new values c.bench_function("extend_set_leaves_and_root", |b| { b.iter(|| { - let merkle = - Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 20); + let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), 20); extend_and_set_leavees(merkle.clone(), &mut rng); }) }); @@ -51,8 +50,7 @@ fn merkle_construction(c: &mut Criterion) { c.bench_function("merkle_construction", |b| { b.iter(|| { - let merkle = - Merkle::new_advanced(MerkleType::Memory, leaves.clone(), Bytes32::default(), 21); + let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), 21); merkle.root(); }) }); diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 91deaba28d..72407b15c7 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -125,7 +125,6 @@ impl Memory { Cow::Owned(Merkle::new_advanced( MerkleType::Memory, leaf_hashes, - hash_leaf([0u8; 32]), Self::MEMORY_LAYERS, )) } diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 008a5c4528..90671bde17 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -11,7 +11,7 @@ use enum_iterator::Sequence; use enum_iterator::all; use std::cmp::max; -use std::cmp::Ordering; + #[cfg(feature = "counters")] use std::sync::atomic::AtomicUsize; @@ -40,7 +40,7 @@ mod zerohashes; use zerohashes::ZERO_HASHES; -use crate::print; +use self::zerohashes::EMPTY_HASH; #[cfg(feature = "counters")] lazy_static! { @@ -174,7 +174,7 @@ pub struct Merkle { dirty_layers: Arc>>>, } -fn hash_node(ty: MerkleType, a: Bytes32, b: Bytes32) -> Bytes32 { +fn hash_node(ty: MerkleType, a: impl AsRef<[u8]>, b: impl AsRef<[u8]>) -> Bytes32 { let mut h = Keccak256::new(); h.update(ty.get_prefix()); h.update(a); @@ -188,36 +188,36 @@ fn capacity(layers: &Vec>) -> usize { base.pow((layers.len() - 1).try_into().unwrap()) } -const fn empty_hash_at(ty: MerkleType, layer_i: usize) -> Bytes32 { +const fn empty_hash_at(ty: MerkleType, layer_i: usize) -> &'static Bytes32 { match ty { - MerkleType::Empty => Bytes32::new_direct([0u8; 32]), - MerkleType::Value => ZERO_HASHES[0][layer_i], - MerkleType::Function => ZERO_HASHES[1][layer_i], - MerkleType::Instruction => ZERO_HASHES[2][layer_i], - MerkleType::Memory => ZERO_HASHES[3][layer_i], - MerkleType::Table => ZERO_HASHES[4][layer_i], - MerkleType::TableElement => ZERO_HASHES[5][layer_i], - MerkleType::Module => ZERO_HASHES[6][layer_i], + MerkleType::Empty => EMPTY_HASH, + MerkleType::Value => &ZERO_HASHES[0][layer_i], + MerkleType::Function => &ZERO_HASHES[1][layer_i], + MerkleType::Instruction => &ZERO_HASHES[2][layer_i], + MerkleType::Memory => &ZERO_HASHES[3][layer_i], + MerkleType::Table => &ZERO_HASHES[4][layer_i], + MerkleType::TableElement => &ZERO_HASHES[5][layer_i], + MerkleType::Module => &ZERO_HASHES[6][layer_i], } } #[inline] #[cfg(feature = "rayon")] -fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: Bytes32) -> Vec { +fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) -> Vec { let mut new_layer: Vec = Vec::with_capacity(layer.len() >> 1); let chunks = layer.par_chunks(2); chunks - .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_hash))) + .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).unwrap_or(empty_hash))) .collect_into_vec(&mut new_layer); new_layer } #[inline] #[cfg(not(feature = "rayon"))] -fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: Bytes32) -> Vec { +fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) -> Vec { let new_layer = layer .chunks(2) - .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).cloned().unwrap_or(empty_hash))) + .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).unwrap_or(empty_hash))) .collect(); new_layer } @@ -227,17 +227,12 @@ impl Merkle { /// The tree is built up to the minimum depth necessary to hold all the /// leaves. pub fn new(ty: MerkleType, hashes: Vec) -> Merkle { - Self::new_advanced(ty, hashes, Bytes32::default(), 0) + Self::new_advanced(ty, hashes, 0) } /// Creates a new Merkle tree with the given type, leaf hashes, a hash to /// use for representing empty leaves, and a minimum depth. - pub fn new_advanced( - ty: MerkleType, - hashes: Vec, - _empty_hash: Bytes32, - min_depth: usize, - ) -> Merkle { + pub fn new_advanced(ty: MerkleType, hashes: Vec, min_depth: usize) -> Merkle { #[cfg(feature = "counters")] NEW_COUNTERS[&ty].fetch_add(1, Ordering::Relaxed); if hashes.is_empty() { @@ -282,8 +277,7 @@ impl Merkle { let left = layers[layer_i - 1][left_child_idx]; let right = layers[layer_i - 1] .get(right_child_idx) - .cloned() - .unwrap_or_else(|| empty_hash_at(self.ty, layer_i - 1)); + .unwrap_or(empty_hash_at(self.ty, layer_i - 1)); let new_hash = hash_node(self.ty, left, right); if *idx < layers[layer_i].len() { layers[layer_i][*idx] = new_hash; @@ -323,7 +317,8 @@ impl Merkle { } pub fn is_empty(&self) -> bool { - self.layers.is_empty() || self.layers[0].is_empty() + let layers = self.layers.lock().unwrap(); + layers.is_empty() || layers[0].is_empty() } #[must_use] @@ -348,7 +343,7 @@ impl Merkle { layer .get(counterpart) .cloned() - .unwrap_or_else(|| empty_hash_at(self.ty, layer_i)), + .unwrap_or_else(|| *empty_hash_at(self.ty, layer_i)), ); idx >>= 1; } @@ -360,8 +355,7 @@ impl Merkle { pub fn push_leaf(&mut self, leaf: Bytes32) { let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.push(leaf); - let empty = empty_hash_at(self.ty, 0); - *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); + *self = Self::new_advanced(self.ty, leaves, self.min_depth); } /// Removes the rightmost leaf from the merkle @@ -369,8 +363,7 @@ impl Merkle { pub fn pop_leaf(&mut self) { let mut leaves = self.layers.lock().unwrap().swap_remove(0); leaves.pop(); - let empty = empty_hash_at(self.ty, 0); - *self = Self::new_advanced(self.ty, leaves, empty, self.min_depth); + *self = Self::new_advanced(self.ty, leaves, self.min_depth); } // Sets the leaf at the given index to the given hash. @@ -391,35 +384,8 @@ impl Merkle { if locked_layers[0][idx] == hash { return; } - let mut next_hash = hash; - let empty_layers = &self.empty_layers; - let layers_len = self.layers.len(); - for (layer_i, layer) in self.layers.iter_mut().enumerate() { - match idx.cmp(&layer.len()) { - Ordering::Less => layer[idx] = next_hash, - Ordering::Equal => layer.push(next_hash), - Ordering::Greater => panic!( - "Index {} out of bounds {} in layer {}", - idx, - layer.len(), - layer_i - ), - } - if layer_i == layers_len - 1 { - // next_hash isn't needed - break; - } - let counterpart = layer - .get(idx ^ 1) - .cloned() - .unwrap_or_else(|| empty_layers[layer_i]); - if idx % 2 == 0 { - next_hash = hash_node(self.ty, next_hash, counterpart); - } else { - next_hash = hash_node(self.ty, counterpart, next_hash); - } - idx >>= 1; - } + locked_layers[0][idx] = hash; + self.dirty_layers.lock().unwrap()[0].insert(idx >> 1); } /// Extends the leaves of the tree with the given hashes. @@ -435,14 +401,14 @@ impl Merkle { let mut idx = layers[0].len(); let mut new_size = idx + hashes.len(); for (layer_i, layer) in layers.iter_mut().enumerate() { - layer.resize(new_size, empty_hash_at(self.ty, layer_i)); + layer.resize(new_size, *empty_hash_at(self.ty, layer_i)); new_size = max(new_size >> 1, 1); } for hash in hashes { self.locked_set(&mut layers, idx, hash); idx += 1; } - Ok(self.layers[0].len()) + Ok(layers[0].len()) } } @@ -517,7 +483,7 @@ fn extend_works() { ), ), ); - let mut merkle = Merkle::new(MerkleType::Value, hashes.clone()); + let merkle = Merkle::new(MerkleType::Value, hashes.clone()); assert_eq!(merkle.capacity(), 8); assert_eq!(merkle.root(), expected); @@ -563,12 +529,7 @@ fn extend_works() { fn correct_capacity() { let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::from([1; 32])]); assert_eq!(merkle.capacity(), 1); - let merkle = Merkle::new_advanced( - MerkleType::Memory, - vec![Bytes32::from([1; 32])], - Bytes32::default(), - 11, - ); + let merkle = Merkle::new_advanced(MerkleType::Memory, vec![Bytes32::from([1; 32])], 11); assert_eq!(merkle.capacity(), 1024); } diff --git a/arbitrator/prover/src/merkle/zerohashes.rs b/arbitrator/prover/src/merkle/zerohashes.rs index c0971f17e6..acb5757d61 100644 --- a/arbitrator/prover/src/merkle/zerohashes.rs +++ b/arbitrator/prover/src/merkle/zerohashes.rs @@ -1,474 +1,1820 @@ use arbutil::Bytes32; const VALUE_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::new_direct([119, 47, 167, 222, 218, 156, 26, 105, 57, 248, 170, 182, 183, 151, 18, 150, 142, 70, 138, 253, 54, 123, 132, 86, 170, 76, 157, 52, 113, 138, 253, 254]), - Bytes32::new_direct([8, 117, 27, 211, 196, 42, 6, 98, 185, 88, 231, 145, 14, 3, 207, 145, 158, 255, 69, 52, 198, 196, 148, 154, 59, 94, 229, 157, 93, 51, 200, 69]), - Bytes32::new_direct([247, 208, 196, 206, 204, 168, 129, 100, 238, 95, 52, 26, 132, 138, 233, 149, 196, 72, 179, 226, 60, 114, 27, 94, 173, 189, 197, 100, 163, 232, 180, 63]), - Bytes32::new_direct([178, 100, 198, 112, 40, 33, 187, 175, 130, 245, 59, 210, 133, 234, 158, 158, 133, 64, 213, 72, 222, 157, 216, 42, 210, 134, 36, 13, 211, 156, 163, 211]), - Bytes32::new_direct([203, 127, 32, 130, 225, 40, 219, 15, 35, 236, 47, 201, 161, 48, 53, 145, 134, 169, 109, 29, 26, 29, 178, 201, 118, 217, 57, 165, 116, 172, 232, 4]), - Bytes32::new_direct([209, 109, 33, 102, 227, 251, 133, 224, 170, 130, 65, 90, 185, 209, 146, 77, 244, 145, 181, 206, 159, 70, 209, 64, 241, 19, 149, 223, 138, 31, 163, 61]), - Bytes32::new_direct([145, 168, 124, 48, 254, 12, 34, 41, 4, 213, 245, 86, 61, 29, 177, 192, 67, 165, 237, 236, 87, 126, 193, 191, 15, 126, 104, 173, 165, 186, 1, 107]), - Bytes32::new_direct([235, 161, 247, 143, 69, 95, 210, 40, 243, 76, 102, 29, 118, 86, 180, 54, 81, 144, 103, 54, 202, 164, 81, 83, 180, 90, 154, 184, 54, 28, 7, 220]), - Bytes32::new_direct([203, 62, 12, 83, 35, 122, 214, 199, 125, 61, 236, 8, 253, 64, 145, 34, 127, 116, 217, 118, 245, 107, 15, 81, 9, 7, 31, 154, 89, 28, 123, 132]), - Bytes32::new_direct([222, 94, 234, 109, 142, 74, 142, 176, 248, 3, 172, 30, 204, 138, 241, 195, 121, 232, 104, 219, 32, 54, 240, 77, 125, 247, 70, 137, 80, 46, 221, 247]), - Bytes32::new_direct([162, 122, 237, 101, 178, 31, 12, 62, 50, 133, 242, 82, 111, 215, 166, 136, 138, 185, 72, 220, 163, 58, 58, 97, 6, 97, 167, 114, 179, 227, 19, 170]), - Bytes32::new_direct([67, 251, 144, 11, 175, 194, 149, 65, 173, 179, 69, 140, 213, 191, 133, 59, 81, 175, 161, 115, 252, 125, 232, 150, 52, 241, 102, 164, 122, 32, 70, 229]), - Bytes32::new_direct([249, 161, 115, 93, 215, 247, 145, 182, 75, 191, 48, 38, 123, 220, 232, 47, 246, 46, 81, 164, 98, 41, 141, 249, 137, 173, 93, 213, 96, 15, 151, 245]), - Bytes32::new_direct([222, 93, 144, 194, 107, 42, 144, 4, 242, 153, 203, 176, 146, 242, 94, 72, 9, 222, 194, 2, 73, 200, 167, 147, 106, 9, 67, 73, 59, 127, 174, 178]), - Bytes32::new_direct([56, 228, 248, 59, 153, 215, 120, 224, 111, 48, 159, 82, 171, 227, 93, 214, 208, 151, 78, 67, 112, 31, 218, 94, 219, 3, 79, 250, 227, 24, 222, 207]), - Bytes32::new_direct([26, 171, 68, 22, 162, 195, 65, 97, 219, 55, 51, 46, 178, 6, 247, 65, 123, 219, 128, 86, 193, 3, 253, 0, 239, 228, 187, 94, 184, 240, 67, 11]), - Bytes32::new_direct([250, 36, 5, 131, 94, 0, 99, 187, 112, 155, 252, 52, 68, 236, 185, 152, 93, 239, 0, 185, 101, 101, 182, 92, 112, 5, 67, 55, 121, 203, 100, 245]), - Bytes32::new_direct([208, 57, 149, 71, 227, 213, 246, 213, 175, 88, 95, 238, 93, 122, 168, 223, 149, 84, 30, 89, 98, 228, 113, 72, 90, 48, 112, 171, 231, 67, 113, 216]), - Bytes32::new_direct([125, 48, 157, 119, 154, 38, 14, 211, 223, 68, 87, 187, 159, 126, 234, 72, 84, 60, 236, 237, 227, 130, 87, 43, 217, 105, 81, 196, 159, 238, 240, 10]), - Bytes32::new_direct([141, 217, 59, 213, 245, 231, 7, 85, 178, 197, 115, 188, 31, 49, 126, 237, 83, 199, 56, 196, 133, 169, 239, 218, 90, 131, 178, 70, 126, 132, 114, 186]), - Bytes32::new_direct([18, 2, 140, 12, 121, 238, 8, 160, 7, 208, 89, 194, 105, 136, 211, 58, 179, 200, 226, 138, 186, 242, 4, 237, 18, 113, 131, 135, 31, 222, 28, 195]), - Bytes32::new_direct([156, 222, 183, 39, 119, 110, 130, 60, 33, 221, 36, 39, 223, 155, 33, 2, 71, 32, 209, 25, 194, 172, 209, 1, 40, 105, 235, 140, 160, 18, 63, 168]), - Bytes32::new_direct([211, 210, 123, 27, 217, 111, 97, 42, 167, 191, 112, 239, 66, 42, 199, 131, 124, 213, 89, 56, 92, 245, 166, 238, 185, 42, 48, 2, 113, 255, 156, 7]), - Bytes32::new_direct([66, 255, 87, 69, 86, 6, 54, 162, 162, 5, 93, 138, 194, 194, 151, 195, 57, 155, 58, 17, 21, 149, 77, 2, 134, 107, 125, 54, 220, 247, 160, 209]), - Bytes32::new_direct([169, 216, 13, 41, 251, 216, 191, 87, 91, 55, 236, 6, 242, 103, 98, 209, 46, 202, 29, 55, 2, 50, 233, 76, 107, 92, 82, 156, 113, 226, 78, 211]), - Bytes32::new_direct([88, 189, 113, 129, 119, 11, 141, 60, 128, 134, 113, 107, 7, 186, 81, 200, 14, 76, 197, 14, 96, 19, 247, 220, 95, 62, 81, 153, 61, 231, 26, 86]), - Bytes32::new_direct([41, 214, 41, 96, 151, 11, 231, 7, 203, 70, 242, 156, 247, 133, 49, 223, 254, 164, 202, 154, 188, 104, 124, 120, 225, 229, 148, 203, 141, 218, 228, 56]), - Bytes32::new_direct([181, 157, 136, 110, 158, 152, 105, 61, 125, 220, 32, 180, 53, 115, 155, 189, 91, 152, 96, 172, 7, 121, 65, 143, 82, 180, 3, 69, 118, 219, 31, 244]), - Bytes32::new_direct([29, 12, 159, 30, 12, 37, 126, 102, 218, 149, 67, 116, 182, 125, 134, 208, 184, 199, 181, 191, 87, 144, 48, 150, 87, 67, 222, 218, 254, 118, 12, 160]), - Bytes32::new_direct([193, 249, 209, 245, 102, 95, 15, 55, 160, 156, 203, 160, 49, 198, 203, 30, 99, 172, 89, 92, 235, 89, 131, 205, 53, 254, 219, 168, 202, 195, 10, 242]), - Bytes32::new_direct([131, 64, 102, 7, 226, 96, 60, 111, 221, 120, 41, 86, 239, 157, 121, 38, 57, 244, 221, 55, 32, 237, 13, 20, 244, 238, 133, 189, 89, 118, 204, 247]), - Bytes32::new_direct([239, 211, 89, 185, 191, 211, 243, 207, 134, 159, 59, 19, 87, 254, 115, 27, 152, 156, 120, 226, 39, 63, 155, 51, 77, 130, 162, 63, 16, 43, 112, 121]), - Bytes32::new_direct([10, 146, 190, 23, 235, 67, 23, 169, 33, 140, 54, 209, 129, 176, 29, 218, 40, 55, 13, 80, 57, 68, 92, 97, 44, 82, 209, 240, 207, 214, 22, 119]), - Bytes32::new_direct([59, 161, 125, 95, 7, 155, 141, 55, 253, 106, 238, 72, 109, 158, 201, 200, 236, 157, 227, 178, 176, 47, 166, 84, 87, 111, 25, 133, 194, 55, 244, 254]), - Bytes32::new_direct([8, 134, 213, 182, 108, 15, 225, 138, 152, 138, 132, 240, 27, 80, 231, 117, 194, 157, 205, 20, 110, 239, 166, 37, 50, 46, 213, 165, 216, 101, 245, 98]), - Bytes32::new_direct([137, 57, 186, 173, 198, 113, 221, 42, 0, 211, 127, 200, 128, 7, 112, 97, 75, 155, 152, 224, 71, 220, 16, 124, 32, 50, 30, 48, 251, 132, 120, 147]), - Bytes32::new_direct([201, 8, 226, 108, 147, 192, 3, 240, 168, 237, 131, 47, 150, 51, 251, 126, 23, 182, 223, 99, 162, 167, 248, 248, 233, 8, 121, 99, 71, 212, 120, 251]), - Bytes32::new_direct([140, 30, 196, 244, 166, 80, 95, 116, 140, 218, 94, 20, 236, 233, 241, 129, 175, 187, 110, 88, 174, 173, 152, 203, 67, 75, 51, 232, 225, 6, 17, 134]), - Bytes32::new_direct([92, 132, 115, 164, 66, 159, 201, 147, 233, 228, 16, 95, 81, 233, 129, 254, 155, 148, 38, 239, 186, 40, 118, 104, 144, 134, 17, 46, 99, 150, 211, 9]), - Bytes32::new_direct([81, 73, 72, 117, 215, 159, 240, 86, 136, 196, 69, 201, 149, 208, 48, 245, 105, 153, 97, 107, 221, 85, 49, 121, 197, 129, 32, 140, 206, 231, 120, 123]), - Bytes32::new_direct([0, 203, 34, 135, 242, 129, 113, 204, 198, 134, 219, 134, 187, 240, 235, 59, 44, 163, 180, 83, 174, 40, 66, 141, 95, 99, 71, 221, 186, 216, 37, 250]), - Bytes32::new_direct([225, 181, 151, 12, 26, 209, 127, 99, 248, 177, 126, 113, 215, 220, 252, 89, 149, 123, 19, 65, 89, 122, 180, 169, 195, 87, 147, 9, 196, 31, 203, 178]), - Bytes32::new_direct([125, 81, 154, 100, 204, 138, 194, 248, 156, 95, 119, 58, 60, 221, 150, 248, 216, 19, 123, 15, 198, 108, 228, 228, 224, 122, 16, 249, 223, 84, 117, 89]), - Bytes32::new_direct([99, 153, 60, 217, 168, 254, 244, 149, 214, 115, 250, 90, 117, 112, 66, 163, 143, 207, 121, 70, 108, 92, 2, 47, 56, 109, 56, 207, 152, 27, 196, 141]), - Bytes32::new_direct([99, 251, 124, 97, 158, 155, 101, 251, 98, 124, 239, 73, 50, 50, 173, 142, 39, 208, 167, 53, 5, 151, 85, 239, 25, 77, 36, 52, 141, 225, 66, 186]), - Bytes32::new_direct([235, 44, 31, 180, 197, 243, 114, 60, 199, 242, 167, 21, 206, 27, 116, 165, 18, 76, 162, 163, 14, 91, 109, 104, 118, 51, 33, 172, 9, 165, 214, 38]), - Bytes32::new_direct([188, 4, 5, 50, 169, 70, 231, 90, 220, 90, 226, 214, 89, 19, 159, 207, 201, 80, 241, 214, 32, 240, 63, 74, 6, 251, 177, 182, 236, 19, 156, 92]), - Bytes32::new_direct([128, 150, 66, 27, 197, 229, 103, 137, 175, 252, 19, 131, 213, 63, 112, 172, 182, 255, 235, 246, 226, 37, 25, 180, 24, 38, 35, 138, 207, 149, 186, 175]), - Bytes32::new_direct([5, 123, 231, 106, 12, 171, 157, 189, 58, 109, 144, 7, 38, 97, 4, 148, 1, 138, 124, 123, 2, 202, 108, 221, 194, 160, 53, 73, 115, 36, 231, 142]), - Bytes32::new_direct([160, 157, 243, 224, 214, 120, 59, 206, 24, 30, 231, 209, 123, 227, 15, 221, 86, 30, 128, 117, 210, 109, 132, 117, 204, 87, 243, 213, 231, 224, 91, 75]), - Bytes32::new_direct([74, 238, 110, 147, 63, 110, 246, 102, 252, 212, 120, 225, 124, 218, 145, 204, 129, 63, 13, 34, 1, 0, 15, 9, 27, 221, 39, 199, 24, 231, 9, 38]), - Bytes32::new_direct([194, 20, 160, 161, 90, 2, 118, 75, 103, 228, 51, 42, 191, 220, 63, 150, 140, 32, 85, 172, 218, 29, 251, 31, 99, 96, 98, 46, 130, 157, 201, 61]), - Bytes32::new_direct([88, 123, 95, 139, 94, 66, 69, 27, 223, 223, 216, 130, 99, 210, 130, 54, 248, 35, 226, 252, 151, 238, 7, 175, 12, 97, 188, 43, 233, 129, 82, 222]), - Bytes32::new_direct([179, 248, 157, 243, 50, 157, 172, 17, 139, 10, 245, 208, 241, 210, 67, 199, 135, 233, 234, 39, 127, 38, 54, 39, 40, 159, 94, 122, 36, 221, 180, 195]), - Bytes32::new_direct([190, 185, 147, 237, 82, 32, 165, 236, 252, 183, 173, 181, 68, 44, 216, 20, 110, 243, 158, 213, 88, 209, 218, 207, 244, 241, 121, 239, 136, 167, 245, 155]), - Bytes32::new_direct([114, 131, 254, 248, 183, 0, 175, 217, 194, 58, 178, 238, 250, 119, 158, 205, 19, 74, 94, 35, 100, 175, 114, 55, 186, 192, 239, 126, 42, 86, 60, 119]), - Bytes32::new_direct([1, 253, 107, 150, 25, 240, 27, 172, 252, 185, 151, 152, 107, 105, 164, 230, 221, 242, 7, 166, 142, 53, 237, 83, 19, 30, 81, 149, 150, 39, 123, 220]), - Bytes32::new_direct([57, 240, 92, 232, 26, 238, 69, 252, 110, 171, 164, 109, 199, 73, 110, 49, 11, 253, 109, 69, 155, 26, 84, 52, 155, 204, 115, 99, 90, 38, 247, 167]), - Bytes32::new_direct([46, 87, 146, 25, 215, 40, 208, 78, 73, 60, 35, 19, 194, 41, 34, 186, 215, 131, 205, 29, 107, 100, 95, 169, 45, 1, 242, 115, 30, 226, 93, 48]), - Bytes32::new_direct([95, 183, 66, 0, 196, 173, 44, 27, 175, 151, 17, 0, 159, 168, 123, 236, 124, 198, 85, 181, 118, 89, 21, 52, 169, 104, 178, 111, 120, 173, 94, 109]), - Bytes32::new_direct([13, 111, 162, 25, 133, 108, 250, 75, 197, 221, 19, 160, 147, 36, 130, 70, 224, 39, 134, 144, 149, 166, 187, 96, 155, 154, 123, 90, 241, 154, 44, 102]), - Bytes32::new_direct([95, 171, 183, 135, 121, 205, 161, 160, 212, 226, 64, 232, 180, 166, 176, 95, 51, 96, 110, 20, 76, 143, 47, 96, 197, 132, 210, 109, 174, 132, 13, 95]), - Bytes32::new_direct([66, 51, 176, 1, 106, 199, 192, 16, 106, 180, 212, 53, 72, 121, 218, 148, 77, 26, 15, 244, 124, 131, 88, 84, 147, 211, 254, 156, 187, 91, 193, 120]), + Bytes32::new_direct([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ]), + Bytes32::new_direct([ + 119, 47, 167, 222, 218, 156, 26, 105, 57, 248, 170, 182, 183, 151, 18, 150, 142, 70, 138, + 253, 54, 123, 132, 86, 170, 76, 157, 52, 113, 138, 253, 254, + ]), + Bytes32::new_direct([ + 8, 117, 27, 211, 196, 42, 6, 98, 185, 88, 231, 145, 14, 3, 207, 145, 158, 255, 69, 52, 198, + 196, 148, 154, 59, 94, 229, 157, 93, 51, 200, 69, + ]), + Bytes32::new_direct([ + 247, 208, 196, 206, 204, 168, 129, 100, 238, 95, 52, 26, 132, 138, 233, 149, 196, 72, 179, + 226, 60, 114, 27, 94, 173, 189, 197, 100, 163, 232, 180, 63, + ]), + Bytes32::new_direct([ + 178, 100, 198, 112, 40, 33, 187, 175, 130, 245, 59, 210, 133, 234, 158, 158, 133, 64, 213, + 72, 222, 157, 216, 42, 210, 134, 36, 13, 211, 156, 163, 211, + ]), + Bytes32::new_direct([ + 203, 127, 32, 130, 225, 40, 219, 15, 35, 236, 47, 201, 161, 48, 53, 145, 134, 169, 109, 29, + 26, 29, 178, 201, 118, 217, 57, 165, 116, 172, 232, 4, + ]), + Bytes32::new_direct([ + 209, 109, 33, 102, 227, 251, 133, 224, 170, 130, 65, 90, 185, 209, 146, 77, 244, 145, 181, + 206, 159, 70, 209, 64, 241, 19, 149, 223, 138, 31, 163, 61, + ]), + Bytes32::new_direct([ + 145, 168, 124, 48, 254, 12, 34, 41, 4, 213, 245, 86, 61, 29, 177, 192, 67, 165, 237, 236, + 87, 126, 193, 191, 15, 126, 104, 173, 165, 186, 1, 107, + ]), + Bytes32::new_direct([ + 235, 161, 247, 143, 69, 95, 210, 40, 243, 76, 102, 29, 118, 86, 180, 54, 81, 144, 103, 54, + 202, 164, 81, 83, 180, 90, 154, 184, 54, 28, 7, 220, + ]), + Bytes32::new_direct([ + 203, 62, 12, 83, 35, 122, 214, 199, 125, 61, 236, 8, 253, 64, 145, 34, 127, 116, 217, 118, + 245, 107, 15, 81, 9, 7, 31, 154, 89, 28, 123, 132, + ]), + Bytes32::new_direct([ + 222, 94, 234, 109, 142, 74, 142, 176, 248, 3, 172, 30, 204, 138, 241, 195, 121, 232, 104, + 219, 32, 54, 240, 77, 125, 247, 70, 137, 80, 46, 221, 247, + ]), + Bytes32::new_direct([ + 162, 122, 237, 101, 178, 31, 12, 62, 50, 133, 242, 82, 111, 215, 166, 136, 138, 185, 72, + 220, 163, 58, 58, 97, 6, 97, 167, 114, 179, 227, 19, 170, + ]), + Bytes32::new_direct([ + 67, 251, 144, 11, 175, 194, 149, 65, 173, 179, 69, 140, 213, 191, 133, 59, 81, 175, 161, + 115, 252, 125, 232, 150, 52, 241, 102, 164, 122, 32, 70, 229, + ]), + Bytes32::new_direct([ + 249, 161, 115, 93, 215, 247, 145, 182, 75, 191, 48, 38, 123, 220, 232, 47, 246, 46, 81, + 164, 98, 41, 141, 249, 137, 173, 93, 213, 96, 15, 151, 245, + ]), + Bytes32::new_direct([ + 222, 93, 144, 194, 107, 42, 144, 4, 242, 153, 203, 176, 146, 242, 94, 72, 9, 222, 194, 2, + 73, 200, 167, 147, 106, 9, 67, 73, 59, 127, 174, 178, + ]), + Bytes32::new_direct([ + 56, 228, 248, 59, 153, 215, 120, 224, 111, 48, 159, 82, 171, 227, 93, 214, 208, 151, 78, + 67, 112, 31, 218, 94, 219, 3, 79, 250, 227, 24, 222, 207, + ]), + Bytes32::new_direct([ + 26, 171, 68, 22, 162, 195, 65, 97, 219, 55, 51, 46, 178, 6, 247, 65, 123, 219, 128, 86, + 193, 3, 253, 0, 239, 228, 187, 94, 184, 240, 67, 11, + ]), + Bytes32::new_direct([ + 250, 36, 5, 131, 94, 0, 99, 187, 112, 155, 252, 52, 68, 236, 185, 152, 93, 239, 0, 185, + 101, 101, 182, 92, 112, 5, 67, 55, 121, 203, 100, 245, + ]), + Bytes32::new_direct([ + 208, 57, 149, 71, 227, 213, 246, 213, 175, 88, 95, 238, 93, 122, 168, 223, 149, 84, 30, 89, + 98, 228, 113, 72, 90, 48, 112, 171, 231, 67, 113, 216, + ]), + Bytes32::new_direct([ + 125, 48, 157, 119, 154, 38, 14, 211, 223, 68, 87, 187, 159, 126, 234, 72, 84, 60, 236, 237, + 227, 130, 87, 43, 217, 105, 81, 196, 159, 238, 240, 10, + ]), + Bytes32::new_direct([ + 141, 217, 59, 213, 245, 231, 7, 85, 178, 197, 115, 188, 31, 49, 126, 237, 83, 199, 56, 196, + 133, 169, 239, 218, 90, 131, 178, 70, 126, 132, 114, 186, + ]), + Bytes32::new_direct([ + 18, 2, 140, 12, 121, 238, 8, 160, 7, 208, 89, 194, 105, 136, 211, 58, 179, 200, 226, 138, + 186, 242, 4, 237, 18, 113, 131, 135, 31, 222, 28, 195, + ]), + Bytes32::new_direct([ + 156, 222, 183, 39, 119, 110, 130, 60, 33, 221, 36, 39, 223, 155, 33, 2, 71, 32, 209, 25, + 194, 172, 209, 1, 40, 105, 235, 140, 160, 18, 63, 168, + ]), + Bytes32::new_direct([ + 211, 210, 123, 27, 217, 111, 97, 42, 167, 191, 112, 239, 66, 42, 199, 131, 124, 213, 89, + 56, 92, 245, 166, 238, 185, 42, 48, 2, 113, 255, 156, 7, + ]), + Bytes32::new_direct([ + 66, 255, 87, 69, 86, 6, 54, 162, 162, 5, 93, 138, 194, 194, 151, 195, 57, 155, 58, 17, 21, + 149, 77, 2, 134, 107, 125, 54, 220, 247, 160, 209, + ]), + Bytes32::new_direct([ + 169, 216, 13, 41, 251, 216, 191, 87, 91, 55, 236, 6, 242, 103, 98, 209, 46, 202, 29, 55, 2, + 50, 233, 76, 107, 92, 82, 156, 113, 226, 78, 211, + ]), + Bytes32::new_direct([ + 88, 189, 113, 129, 119, 11, 141, 60, 128, 134, 113, 107, 7, 186, 81, 200, 14, 76, 197, 14, + 96, 19, 247, 220, 95, 62, 81, 153, 61, 231, 26, 86, + ]), + Bytes32::new_direct([ + 41, 214, 41, 96, 151, 11, 231, 7, 203, 70, 242, 156, 247, 133, 49, 223, 254, 164, 202, 154, + 188, 104, 124, 120, 225, 229, 148, 203, 141, 218, 228, 56, + ]), + Bytes32::new_direct([ + 181, 157, 136, 110, 158, 152, 105, 61, 125, 220, 32, 180, 53, 115, 155, 189, 91, 152, 96, + 172, 7, 121, 65, 143, 82, 180, 3, 69, 118, 219, 31, 244, + ]), + Bytes32::new_direct([ + 29, 12, 159, 30, 12, 37, 126, 102, 218, 149, 67, 116, 182, 125, 134, 208, 184, 199, 181, + 191, 87, 144, 48, 150, 87, 67, 222, 218, 254, 118, 12, 160, + ]), + Bytes32::new_direct([ + 193, 249, 209, 245, 102, 95, 15, 55, 160, 156, 203, 160, 49, 198, 203, 30, 99, 172, 89, 92, + 235, 89, 131, 205, 53, 254, 219, 168, 202, 195, 10, 242, + ]), + Bytes32::new_direct([ + 131, 64, 102, 7, 226, 96, 60, 111, 221, 120, 41, 86, 239, 157, 121, 38, 57, 244, 221, 55, + 32, 237, 13, 20, 244, 238, 133, 189, 89, 118, 204, 247, + ]), + Bytes32::new_direct([ + 239, 211, 89, 185, 191, 211, 243, 207, 134, 159, 59, 19, 87, 254, 115, 27, 152, 156, 120, + 226, 39, 63, 155, 51, 77, 130, 162, 63, 16, 43, 112, 121, + ]), + Bytes32::new_direct([ + 10, 146, 190, 23, 235, 67, 23, 169, 33, 140, 54, 209, 129, 176, 29, 218, 40, 55, 13, 80, + 57, 68, 92, 97, 44, 82, 209, 240, 207, 214, 22, 119, + ]), + Bytes32::new_direct([ + 59, 161, 125, 95, 7, 155, 141, 55, 253, 106, 238, 72, 109, 158, 201, 200, 236, 157, 227, + 178, 176, 47, 166, 84, 87, 111, 25, 133, 194, 55, 244, 254, + ]), + Bytes32::new_direct([ + 8, 134, 213, 182, 108, 15, 225, 138, 152, 138, 132, 240, 27, 80, 231, 117, 194, 157, 205, + 20, 110, 239, 166, 37, 50, 46, 213, 165, 216, 101, 245, 98, + ]), + Bytes32::new_direct([ + 137, 57, 186, 173, 198, 113, 221, 42, 0, 211, 127, 200, 128, 7, 112, 97, 75, 155, 152, 224, + 71, 220, 16, 124, 32, 50, 30, 48, 251, 132, 120, 147, + ]), + Bytes32::new_direct([ + 201, 8, 226, 108, 147, 192, 3, 240, 168, 237, 131, 47, 150, 51, 251, 126, 23, 182, 223, 99, + 162, 167, 248, 248, 233, 8, 121, 99, 71, 212, 120, 251, + ]), + Bytes32::new_direct([ + 140, 30, 196, 244, 166, 80, 95, 116, 140, 218, 94, 20, 236, 233, 241, 129, 175, 187, 110, + 88, 174, 173, 152, 203, 67, 75, 51, 232, 225, 6, 17, 134, + ]), + Bytes32::new_direct([ + 92, 132, 115, 164, 66, 159, 201, 147, 233, 228, 16, 95, 81, 233, 129, 254, 155, 148, 38, + 239, 186, 40, 118, 104, 144, 134, 17, 46, 99, 150, 211, 9, + ]), + Bytes32::new_direct([ + 81, 73, 72, 117, 215, 159, 240, 86, 136, 196, 69, 201, 149, 208, 48, 245, 105, 153, 97, + 107, 221, 85, 49, 121, 197, 129, 32, 140, 206, 231, 120, 123, + ]), + Bytes32::new_direct([ + 0, 203, 34, 135, 242, 129, 113, 204, 198, 134, 219, 134, 187, 240, 235, 59, 44, 163, 180, + 83, 174, 40, 66, 141, 95, 99, 71, 221, 186, 216, 37, 250, + ]), + Bytes32::new_direct([ + 225, 181, 151, 12, 26, 209, 127, 99, 248, 177, 126, 113, 215, 220, 252, 89, 149, 123, 19, + 65, 89, 122, 180, 169, 195, 87, 147, 9, 196, 31, 203, 178, + ]), + Bytes32::new_direct([ + 125, 81, 154, 100, 204, 138, 194, 248, 156, 95, 119, 58, 60, 221, 150, 248, 216, 19, 123, + 15, 198, 108, 228, 228, 224, 122, 16, 249, 223, 84, 117, 89, + ]), + Bytes32::new_direct([ + 99, 153, 60, 217, 168, 254, 244, 149, 214, 115, 250, 90, 117, 112, 66, 163, 143, 207, 121, + 70, 108, 92, 2, 47, 56, 109, 56, 207, 152, 27, 196, 141, + ]), + Bytes32::new_direct([ + 99, 251, 124, 97, 158, 155, 101, 251, 98, 124, 239, 73, 50, 50, 173, 142, 39, 208, 167, 53, + 5, 151, 85, 239, 25, 77, 36, 52, 141, 225, 66, 186, + ]), + Bytes32::new_direct([ + 235, 44, 31, 180, 197, 243, 114, 60, 199, 242, 167, 21, 206, 27, 116, 165, 18, 76, 162, + 163, 14, 91, 109, 104, 118, 51, 33, 172, 9, 165, 214, 38, + ]), + Bytes32::new_direct([ + 188, 4, 5, 50, 169, 70, 231, 90, 220, 90, 226, 214, 89, 19, 159, 207, 201, 80, 241, 214, + 32, 240, 63, 74, 6, 251, 177, 182, 236, 19, 156, 92, + ]), + Bytes32::new_direct([ + 128, 150, 66, 27, 197, 229, 103, 137, 175, 252, 19, 131, 213, 63, 112, 172, 182, 255, 235, + 246, 226, 37, 25, 180, 24, 38, 35, 138, 207, 149, 186, 175, + ]), + Bytes32::new_direct([ + 5, 123, 231, 106, 12, 171, 157, 189, 58, 109, 144, 7, 38, 97, 4, 148, 1, 138, 124, 123, 2, + 202, 108, 221, 194, 160, 53, 73, 115, 36, 231, 142, + ]), + Bytes32::new_direct([ + 160, 157, 243, 224, 214, 120, 59, 206, 24, 30, 231, 209, 123, 227, 15, 221, 86, 30, 128, + 117, 210, 109, 132, 117, 204, 87, 243, 213, 231, 224, 91, 75, + ]), + Bytes32::new_direct([ + 74, 238, 110, 147, 63, 110, 246, 102, 252, 212, 120, 225, 124, 218, 145, 204, 129, 63, 13, + 34, 1, 0, 15, 9, 27, 221, 39, 199, 24, 231, 9, 38, + ]), + Bytes32::new_direct([ + 194, 20, 160, 161, 90, 2, 118, 75, 103, 228, 51, 42, 191, 220, 63, 150, 140, 32, 85, 172, + 218, 29, 251, 31, 99, 96, 98, 46, 130, 157, 201, 61, + ]), + Bytes32::new_direct([ + 88, 123, 95, 139, 94, 66, 69, 27, 223, 223, 216, 130, 99, 210, 130, 54, 248, 35, 226, 252, + 151, 238, 7, 175, 12, 97, 188, 43, 233, 129, 82, 222, + ]), + Bytes32::new_direct([ + 179, 248, 157, 243, 50, 157, 172, 17, 139, 10, 245, 208, 241, 210, 67, 199, 135, 233, 234, + 39, 127, 38, 54, 39, 40, 159, 94, 122, 36, 221, 180, 195, + ]), + Bytes32::new_direct([ + 190, 185, 147, 237, 82, 32, 165, 236, 252, 183, 173, 181, 68, 44, 216, 20, 110, 243, 158, + 213, 88, 209, 218, 207, 244, 241, 121, 239, 136, 167, 245, 155, + ]), + Bytes32::new_direct([ + 114, 131, 254, 248, 183, 0, 175, 217, 194, 58, 178, 238, 250, 119, 158, 205, 19, 74, 94, + 35, 100, 175, 114, 55, 186, 192, 239, 126, 42, 86, 60, 119, + ]), + Bytes32::new_direct([ + 1, 253, 107, 150, 25, 240, 27, 172, 252, 185, 151, 152, 107, 105, 164, 230, 221, 242, 7, + 166, 142, 53, 237, 83, 19, 30, 81, 149, 150, 39, 123, 220, + ]), + Bytes32::new_direct([ + 57, 240, 92, 232, 26, 238, 69, 252, 110, 171, 164, 109, 199, 73, 110, 49, 11, 253, 109, 69, + 155, 26, 84, 52, 155, 204, 115, 99, 90, 38, 247, 167, + ]), + Bytes32::new_direct([ + 46, 87, 146, 25, 215, 40, 208, 78, 73, 60, 35, 19, 194, 41, 34, 186, 215, 131, 205, 29, + 107, 100, 95, 169, 45, 1, 242, 115, 30, 226, 93, 48, + ]), + Bytes32::new_direct([ + 95, 183, 66, 0, 196, 173, 44, 27, 175, 151, 17, 0, 159, 168, 123, 236, 124, 198, 85, 181, + 118, 89, 21, 52, 169, 104, 178, 111, 120, 173, 94, 109, + ]), + Bytes32::new_direct([ + 13, 111, 162, 25, 133, 108, 250, 75, 197, 221, 19, 160, 147, 36, 130, 70, 224, 39, 134, + 144, 149, 166, 187, 96, 155, 154, 123, 90, 241, 154, 44, 102, + ]), + Bytes32::new_direct([ + 95, 171, 183, 135, 121, 205, 161, 160, 212, 226, 64, 232, 180, 166, 176, 95, 51, 96, 110, + 20, 76, 143, 47, 96, 197, 132, 210, 109, 174, 132, 13, 95, + ]), + Bytes32::new_direct([ + 66, 51, 176, 1, 106, 199, 192, 16, 106, 180, 212, 53, 72, 121, 218, 148, 77, 26, 15, 244, + 124, 131, 88, 84, 147, 211, 254, 156, 187, 91, 193, 120, + ]), ]; const FUNCTION_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::new_direct([239, 247, 49, 255, 201, 159, 228, 149, 22, 115, 41, 139, 56, 117, 149, 46, 67, 155, 98, 70, 216, 225, 85, 100, 113, 242, 144, 167, 97, 238, 117, 207]), - Bytes32::new_direct([46, 87, 136, 101, 122, 12, 6, 120, 39, 121, 167, 193, 66, 146, 150, 1, 90, 240, 97, 225, 179, 150, 197, 127, 56, 214, 116, 24, 180, 109, 96, 51]), - Bytes32::new_direct([54, 125, 90, 195, 243, 1, 115, 18, 251, 68, 203, 216, 48, 156, 216, 200, 215, 250, 80, 152, 203, 58, 245, 128, 70, 112, 221, 104, 34, 125, 234, 138]), - Bytes32::new_direct([103, 99, 44, 86, 57, 0, 102, 201, 99, 214, 249, 24, 45, 112, 234, 183, 225, 196, 9, 162, 168, 33, 121, 118, 93, 184, 14, 70, 148, 135, 211, 214]), - Bytes32::new_direct([69, 7, 89, 47, 41, 94, 148, 139, 67, 197, 99, 98, 100, 63, 25, 230, 100, 118, 213, 25, 28, 129, 5, 39, 69, 89, 71, 21, 102, 84, 101, 175]), - Bytes32::new_direct([232, 195, 82, 123, 189, 200, 139, 61, 179, 141, 208, 69, 102, 58, 127, 66, 69, 127, 7, 179, 108, 128, 253, 154, 207, 254, 201, 18, 192, 241, 99, 208]), - Bytes32::new_direct([138, 25, 185, 215, 159, 159, 214, 251, 161, 103, 180, 78, 209, 215, 131, 132, 134, 180, 177, 37, 79, 219, 19, 93, 45, 30, 53, 125, 142, 194, 114, 34]), - Bytes32::new_direct([185, 24, 200, 28, 68, 7, 118, 226, 65, 240, 85, 120, 123, 174, 239, 85, 247, 210, 104, 247, 20, 229, 41, 91, 242, 5, 2, 121, 132, 69, 43, 33]), - Bytes32::new_direct([78, 191, 92, 97, 205, 120, 114, 216, 112, 101, 44, 98, 148, 2, 112, 221, 168, 199, 254, 55, 160, 116, 116, 105, 109, 227, 130, 219, 194, 32, 209, 196]), - Bytes32::new_direct([177, 203, 26, 1, 216, 115, 242, 158, 202, 107, 60, 221, 81, 167, 8, 233, 247, 235, 49, 54, 45, 133, 202, 193, 34, 158, 205, 29, 232, 245, 195, 194]), - Bytes32::new_direct([193, 118, 182, 153, 10, 237, 67, 229, 136, 193, 253, 250, 46, 125, 141, 22, 107, 168, 74, 130, 60, 193, 194, 196, 249, 129, 153, 82, 162, 143, 188, 42]), - Bytes32::new_direct([239, 57, 105, 90, 116, 61, 160, 214, 55, 191, 17, 228, 44, 149, 103, 180, 229, 4, 175, 240, 209, 231, 141, 95, 109, 195, 78, 142, 122, 177, 227, 20]), - Bytes32::new_direct([153, 247, 105, 126, 178, 44, 190, 57, 12, 63, 169, 27, 206, 19, 151, 38, 33, 83, 35, 3, 177, 97, 36, 182, 37, 78, 150, 243, 222, 32, 180, 148]), - Bytes32::new_direct([29, 109, 110, 167, 27, 136, 235, 226, 147, 175, 241, 236, 138, 135, 163, 200, 21, 94, 220, 238, 23, 84, 46, 14, 44, 100, 47, 131, 134, 43, 98, 173]), - Bytes32::new_direct([73, 241, 108, 102, 184, 200, 64, 80, 58, 162, 29, 211, 173, 150, 6, 195, 2, 137, 246, 51, 155, 132, 41, 255, 21, 71, 74, 143, 197, 180, 217, 159]), - Bytes32::new_direct([109, 189, 226, 33, 70, 157, 161, 166, 223, 31, 224, 221, 37, 112, 27, 215, 163, 250, 217, 155, 168, 121, 119, 232, 100, 177, 104, 210, 10, 118, 215, 0]), - Bytes32::new_direct([175, 156, 32, 156, 238, 82, 62, 25, 96, 251, 146, 24, 13, 2, 115, 174, 163, 50, 14, 251, 196, 173, 5, 87, 171, 228, 191, 9, 90, 84, 156, 63]), - Bytes32::new_direct([244, 161, 238, 217, 14, 60, 162, 139, 34, 84, 68, 121, 213, 11, 230, 95, 57, 221, 174, 107, 103, 105, 76, 137, 58, 247, 65, 209, 167, 63, 96, 212]), - Bytes32::new_direct([31, 177, 221, 130, 152, 92, 190, 4, 59, 90, 122, 63, 128, 180, 140, 201, 75, 239, 200, 151, 94, 65, 36, 227, 21, 250, 10, 253, 26, 114, 238, 188]), - Bytes32::new_direct([48, 216, 87, 30, 113, 214, 69, 1, 9, 112, 244, 232, 127, 55, 43, 162, 156, 83, 235, 199, 126, 132, 241, 106, 65, 209, 240, 32, 11, 179, 219, 135]), - Bytes32::new_direct([20, 55, 225, 132, 0, 219, 175, 17, 235, 73, 236, 16, 24, 227, 250, 155, 32, 83, 234, 123, 191, 209, 157, 133, 215, 202, 3, 221, 135, 223, 221, 90]), - Bytes32::new_direct([113, 185, 118, 164, 139, 219, 203, 140, 245, 123, 21, 186, 102, 22, 54, 14, 19, 230, 223, 120, 211, 114, 203, 77, 173, 214, 61, 80, 151, 10, 2, 205]), - Bytes32::new_direct([50, 20, 214, 105, 232, 5, 9, 101, 16, 72, 46, 139, 177, 188, 25, 93, 14, 57, 60, 168, 49, 147, 134, 5, 62, 181, 120, 75, 193, 229, 107, 67]), - Bytes32::new_direct([92, 167, 117, 18, 186, 193, 28, 56, 86, 25, 75, 64, 1, 8, 126, 212, 56, 163, 157, 242, 34, 73, 65, 58, 187, 2, 112, 58, 225, 229, 113, 58]), - Bytes32::new_direct([173, 139, 156, 215, 250, 231, 15, 123, 8, 5, 98, 192, 164, 48, 106, 203, 152, 189, 118, 120, 245, 221, 214, 26, 79, 39, 148, 232, 217, 88, 34, 246]), - Bytes32::new_direct([8, 207, 11, 196, 253, 51, 182, 90, 62, 110, 125, 142, 209, 154, 5, 203, 252, 62, 117, 215, 226, 136, 140, 201, 227, 210, 71, 34, 113, 160, 42, 68]), - Bytes32::new_direct([108, 135, 226, 117, 179, 142, 93, 181, 20, 186, 189, 217, 49, 154, 66, 244, 180, 170, 122, 233, 153, 214, 104, 71, 44, 57, 103, 240, 97, 80, 170, 198]), - Bytes32::new_direct([123, 168, 184, 254, 241, 78, 23, 91, 32, 77, 218, 176, 179, 189, 61, 162, 114, 158, 212, 7, 201, 15, 58, 4, 161, 211, 188, 156, 190, 2, 20, 183]), - Bytes32::new_direct([60, 170, 86, 130, 38, 170, 202, 88, 97, 206, 67, 69, 140, 122, 201, 38, 70, 229, 144, 202, 146, 10, 146, 148, 21, 247, 119, 196, 150, 223, 110, 67]), - Bytes32::new_direct([102, 154, 215, 132, 143, 248, 151, 101, 101, 253, 80, 211, 254, 64, 179, 73, 96, 132, 144, 216, 225, 130, 48, 56, 14, 39, 97, 223, 134, 10, 124, 138]), - Bytes32::new_direct([197, 131, 194, 166, 168, 160, 24, 116, 47, 120, 89, 3, 44, 154, 83, 250, 142, 64, 77, 63, 15, 60, 97, 100, 150, 39, 227, 139, 42, 146, 146, 104]), - Bytes32::new_direct([7, 160, 246, 93, 64, 79, 76, 208, 66, 80, 60, 123, 13, 51, 115, 251, 196, 209, 145, 106, 61, 105, 136, 58, 7, 129, 142, 203, 205, 69, 45, 203]), - Bytes32::new_direct([64, 162, 48, 187, 213, 182, 41, 85, 62, 148, 26, 161, 227, 108, 173, 249, 195, 106, 203, 18, 28, 59, 184, 85, 249, 16, 224, 222, 114, 200, 99, 22]), - Bytes32::new_direct([246, 194, 74, 122, 165, 216, 211, 144, 101, 143, 134, 9, 53, 229, 197, 227, 121, 248, 89, 169, 48, 220, 104, 216, 117, 118, 36, 234, 108, 135, 81, 162]), - Bytes32::new_direct([232, 59, 196, 2, 103, 242, 44, 129, 41, 231, 226, 115, 238, 151, 166, 210, 158, 110, 43, 45, 86, 163, 127, 8, 162, 81, 131, 145, 165, 252, 170, 12]), - Bytes32::new_direct([204, 88, 102, 180, 241, 148, 27, 183, 223, 71, 157, 119, 155, 31, 102, 239, 4, 83, 204, 246, 38, 228, 234, 20, 97, 233, 203, 149, 186, 67, 143, 51]), - Bytes32::new_direct([246, 170, 233, 8, 202, 38, 67, 219, 175, 13, 250, 174, 98, 36, 84, 166, 6, 75, 27, 43, 62, 128, 106, 23, 163, 191, 86, 115, 164, 50, 127, 151]), - Bytes32::new_direct([204, 72, 199, 57, 106, 136, 244, 66, 217, 155, 183, 211, 166, 71, 140, 211, 210, 181, 178, 218, 204, 91, 200, 204, 153, 60, 22, 32, 24, 153, 131, 31]), - Bytes32::new_direct([204, 193, 13, 167, 214, 136, 121, 99, 198, 137, 11, 223, 85, 40, 167, 126, 153, 80, 187, 35, 226, 31, 226, 42, 9, 175, 31, 206, 119, 67, 153, 39]), - Bytes32::new_direct([63, 82, 16, 182, 255, 45, 123, 220, 252, 52, 199, 222, 76, 172, 123, 232, 133, 182, 143, 202, 223, 161, 203, 91, 239, 225, 123, 184, 231, 53, 19, 253]), - Bytes32::new_direct([5, 13, 255, 217, 70, 105, 205, 70, 41, 25, 44, 3, 245, 136, 16, 255, 101, 61, 189, 225, 142, 201, 210, 226, 9, 237, 171, 109, 63, 204, 204, 139]), - Bytes32::new_direct([161, 218, 126, 252, 32, 196, 32, 105, 98, 13, 201, 117, 64, 37, 232, 32, 159, 106, 48, 121, 250, 139, 219, 137, 129, 3, 83, 194, 102, 251, 148, 71]), - Bytes32::new_direct([72, 17, 9, 21, 142, 89, 135, 91, 81, 155, 72, 247, 56, 232, 136, 57, 251, 182, 211, 35, 207, 169, 87, 123, 31, 222, 72, 85, 212, 92, 159, 171]), - Bytes32::new_direct([193, 253, 238, 224, 198, 216, 154, 52, 59, 87, 183, 80, 242, 162, 238, 7, 218, 195, 253, 210, 92, 116, 43, 181, 109, 40, 74, 38, 154, 211, 102, 173]), - Bytes32::new_direct([193, 88, 249, 81, 11, 128, 242, 239, 220, 1, 237, 199, 235, 12, 153, 73, 145, 158, 15, 111, 108, 244, 19, 51, 159, 206, 66, 25, 147, 215, 157, 165]), - Bytes32::new_direct([195, 90, 0, 163, 8, 199, 55, 59, 47, 117, 186, 204, 5, 42, 205, 164, 239, 233, 203, 210, 69, 205, 244, 152, 113, 184, 206, 110, 101, 197, 120, 101]), - Bytes32::new_direct([114, 169, 222, 11, 169, 15, 123, 245, 42, 25, 120, 198, 66, 140, 125, 123, 201, 107, 3, 50, 245, 226, 52, 46, 162, 44, 134, 157, 226, 11, 115, 186]), - Bytes32::new_direct([6, 47, 131, 89, 216, 138, 92, 250, 126, 232, 238, 50, 181, 78, 69, 115, 227, 25, 49, 50, 116, 138, 47, 61, 179, 75, 121, 124, 127, 106, 228, 178]), - Bytes32::new_direct([152, 253, 228, 228, 120, 255, 82, 66, 24, 145, 159, 223, 39, 185, 81, 201, 81, 110, 47, 57, 105, 128, 8, 42, 130, 119, 92, 7, 14, 247, 137, 135]), - Bytes32::new_direct([162, 28, 11, 245, 48, 21, 8, 137, 161, 131, 84, 18, 129, 70, 197, 122, 165, 39, 71, 213, 142, 115, 159, 52, 46, 213, 81, 10, 217, 212, 74, 20]), - Bytes32::new_direct([129, 250, 71, 119, 46, 25, 220, 212, 143, 120, 0, 101, 85, 101, 109, 107, 142, 20, 107, 174, 39, 134, 128, 244, 237, 155, 190, 19, 110, 10, 240, 94]), - Bytes32::new_direct([90, 70, 190, 48, 191, 45, 227, 17, 185, 162, 159, 12, 18, 94, 186, 251, 252, 238, 95, 174, 253, 99, 194, 204, 5, 178, 117, 139, 50, 154, 93, 170]), - Bytes32::new_direct([201, 8, 48, 126, 70, 22, 83, 82, 229, 84, 168, 86, 100, 169, 227, 175, 196, 154, 217, 150, 2, 36, 1, 100, 48, 216, 141, 205, 113, 148, 109, 126]), - Bytes32::new_direct([16, 182, 10, 119, 255, 70, 127, 242, 64, 68, 67, 44, 52, 195, 63, 185, 227, 97, 138, 244, 53, 246, 110, 99, 41, 176, 146, 206, 81, 168, 66, 140]), - Bytes32::new_direct([95, 9, 211, 227, 219, 119, 221, 132, 248, 92, 236, 190, 110, 227, 153, 109, 103, 63, 121, 221, 165, 212, 20, 141, 33, 95, 52, 157, 69, 76, 2, 70]), - Bytes32::new_direct([216, 138, 115, 198, 102, 135, 226, 247, 235, 185, 206, 147, 130, 9, 48, 166, 92, 22, 41, 158, 169, 52, 233, 1, 60, 229, 165, 208, 60, 161, 194, 166]), - Bytes32::new_direct([129, 241, 87, 138, 103, 241, 79, 26, 52, 35, 125, 237, 54, 147, 253, 137, 101, 146, 235, 127, 124, 113, 60, 203, 181, 4, 250, 12, 72, 27, 24, 7]), - Bytes32::new_direct([52, 120, 68, 97, 147, 229, 251, 178, 161, 233, 142, 136, 38, 40, 85, 46, 121, 156, 115, 186, 72, 95, 128, 43, 252, 176, 176, 51, 113, 83, 154, 232]), - Bytes32::new_direct([227, 11, 188, 57, 98, 160, 248, 247, 112, 49, 247, 92, 94, 224, 135, 182, 211, 230, 69, 185, 138, 154, 141, 157, 18, 34, 138, 236, 67, 243, 26, 132]), - Bytes32::new_direct([61, 246, 31, 52, 44, 146, 190, 215, 214, 105, 253, 86, 172, 174, 140, 112, 30, 154, 82, 173, 62, 199, 157, 180, 255, 104, 73, 136, 163, 79, 210, 252]), - Bytes32::new_direct([200, 155, 200, 87, 142, 123, 62, 176, 250, 44, 18, 238, 229, 121, 125, 109, 102, 173, 60, 203, 88, 65, 33, 122, 22, 111, 157, 143, 164, 7, 214, 26]), - Bytes32::new_direct([179, 76, 168, 179, 139, 86, 151, 173, 26, 70, 236, 116, 202, 123, 63, 80, 106, 208, 63, 138, 179, 225, 114, 64, 48, 34, 78, 124, 132, 210, 224, 190]), - Bytes32::new_direct([138, 116, 89, 240, 28, 79, 42, 149, 199, 118, 149, 49, 146, 212, 104, 62, 17, 137, 138, 223, 225, 187, 152, 43, 134, 60, 95, 55, 175, 128, 95, 144]), + Bytes32::new_direct([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ]), + Bytes32::new_direct([ + 239, 247, 49, 255, 201, 159, 228, 149, 22, 115, 41, 139, 56, 117, 149, 46, 67, 155, 98, 70, + 216, 225, 85, 100, 113, 242, 144, 167, 97, 238, 117, 207, + ]), + Bytes32::new_direct([ + 46, 87, 136, 101, 122, 12, 6, 120, 39, 121, 167, 193, 66, 146, 150, 1, 90, 240, 97, 225, + 179, 150, 197, 127, 56, 214, 116, 24, 180, 109, 96, 51, + ]), + Bytes32::new_direct([ + 54, 125, 90, 195, 243, 1, 115, 18, 251, 68, 203, 216, 48, 156, 216, 200, 215, 250, 80, 152, + 203, 58, 245, 128, 70, 112, 221, 104, 34, 125, 234, 138, + ]), + Bytes32::new_direct([ + 103, 99, 44, 86, 57, 0, 102, 201, 99, 214, 249, 24, 45, 112, 234, 183, 225, 196, 9, 162, + 168, 33, 121, 118, 93, 184, 14, 70, 148, 135, 211, 214, + ]), + Bytes32::new_direct([ + 69, 7, 89, 47, 41, 94, 148, 139, 67, 197, 99, 98, 100, 63, 25, 230, 100, 118, 213, 25, 28, + 129, 5, 39, 69, 89, 71, 21, 102, 84, 101, 175, + ]), + Bytes32::new_direct([ + 232, 195, 82, 123, 189, 200, 139, 61, 179, 141, 208, 69, 102, 58, 127, 66, 69, 127, 7, 179, + 108, 128, 253, 154, 207, 254, 201, 18, 192, 241, 99, 208, + ]), + Bytes32::new_direct([ + 138, 25, 185, 215, 159, 159, 214, 251, 161, 103, 180, 78, 209, 215, 131, 132, 134, 180, + 177, 37, 79, 219, 19, 93, 45, 30, 53, 125, 142, 194, 114, 34, + ]), + Bytes32::new_direct([ + 185, 24, 200, 28, 68, 7, 118, 226, 65, 240, 85, 120, 123, 174, 239, 85, 247, 210, 104, 247, + 20, 229, 41, 91, 242, 5, 2, 121, 132, 69, 43, 33, + ]), + Bytes32::new_direct([ + 78, 191, 92, 97, 205, 120, 114, 216, 112, 101, 44, 98, 148, 2, 112, 221, 168, 199, 254, 55, + 160, 116, 116, 105, 109, 227, 130, 219, 194, 32, 209, 196, + ]), + Bytes32::new_direct([ + 177, 203, 26, 1, 216, 115, 242, 158, 202, 107, 60, 221, 81, 167, 8, 233, 247, 235, 49, 54, + 45, 133, 202, 193, 34, 158, 205, 29, 232, 245, 195, 194, + ]), + Bytes32::new_direct([ + 193, 118, 182, 153, 10, 237, 67, 229, 136, 193, 253, 250, 46, 125, 141, 22, 107, 168, 74, + 130, 60, 193, 194, 196, 249, 129, 153, 82, 162, 143, 188, 42, + ]), + Bytes32::new_direct([ + 239, 57, 105, 90, 116, 61, 160, 214, 55, 191, 17, 228, 44, 149, 103, 180, 229, 4, 175, 240, + 209, 231, 141, 95, 109, 195, 78, 142, 122, 177, 227, 20, + ]), + Bytes32::new_direct([ + 153, 247, 105, 126, 178, 44, 190, 57, 12, 63, 169, 27, 206, 19, 151, 38, 33, 83, 35, 3, + 177, 97, 36, 182, 37, 78, 150, 243, 222, 32, 180, 148, + ]), + Bytes32::new_direct([ + 29, 109, 110, 167, 27, 136, 235, 226, 147, 175, 241, 236, 138, 135, 163, 200, 21, 94, 220, + 238, 23, 84, 46, 14, 44, 100, 47, 131, 134, 43, 98, 173, + ]), + Bytes32::new_direct([ + 73, 241, 108, 102, 184, 200, 64, 80, 58, 162, 29, 211, 173, 150, 6, 195, 2, 137, 246, 51, + 155, 132, 41, 255, 21, 71, 74, 143, 197, 180, 217, 159, + ]), + Bytes32::new_direct([ + 109, 189, 226, 33, 70, 157, 161, 166, 223, 31, 224, 221, 37, 112, 27, 215, 163, 250, 217, + 155, 168, 121, 119, 232, 100, 177, 104, 210, 10, 118, 215, 0, + ]), + Bytes32::new_direct([ + 175, 156, 32, 156, 238, 82, 62, 25, 96, 251, 146, 24, 13, 2, 115, 174, 163, 50, 14, 251, + 196, 173, 5, 87, 171, 228, 191, 9, 90, 84, 156, 63, + ]), + Bytes32::new_direct([ + 244, 161, 238, 217, 14, 60, 162, 139, 34, 84, 68, 121, 213, 11, 230, 95, 57, 221, 174, 107, + 103, 105, 76, 137, 58, 247, 65, 209, 167, 63, 96, 212, + ]), + Bytes32::new_direct([ + 31, 177, 221, 130, 152, 92, 190, 4, 59, 90, 122, 63, 128, 180, 140, 201, 75, 239, 200, 151, + 94, 65, 36, 227, 21, 250, 10, 253, 26, 114, 238, 188, + ]), + Bytes32::new_direct([ + 48, 216, 87, 30, 113, 214, 69, 1, 9, 112, 244, 232, 127, 55, 43, 162, 156, 83, 235, 199, + 126, 132, 241, 106, 65, 209, 240, 32, 11, 179, 219, 135, + ]), + Bytes32::new_direct([ + 20, 55, 225, 132, 0, 219, 175, 17, 235, 73, 236, 16, 24, 227, 250, 155, 32, 83, 234, 123, + 191, 209, 157, 133, 215, 202, 3, 221, 135, 223, 221, 90, + ]), + Bytes32::new_direct([ + 113, 185, 118, 164, 139, 219, 203, 140, 245, 123, 21, 186, 102, 22, 54, 14, 19, 230, 223, + 120, 211, 114, 203, 77, 173, 214, 61, 80, 151, 10, 2, 205, + ]), + Bytes32::new_direct([ + 50, 20, 214, 105, 232, 5, 9, 101, 16, 72, 46, 139, 177, 188, 25, 93, 14, 57, 60, 168, 49, + 147, 134, 5, 62, 181, 120, 75, 193, 229, 107, 67, + ]), + Bytes32::new_direct([ + 92, 167, 117, 18, 186, 193, 28, 56, 86, 25, 75, 64, 1, 8, 126, 212, 56, 163, 157, 242, 34, + 73, 65, 58, 187, 2, 112, 58, 225, 229, 113, 58, + ]), + Bytes32::new_direct([ + 173, 139, 156, 215, 250, 231, 15, 123, 8, 5, 98, 192, 164, 48, 106, 203, 152, 189, 118, + 120, 245, 221, 214, 26, 79, 39, 148, 232, 217, 88, 34, 246, + ]), + Bytes32::new_direct([ + 8, 207, 11, 196, 253, 51, 182, 90, 62, 110, 125, 142, 209, 154, 5, 203, 252, 62, 117, 215, + 226, 136, 140, 201, 227, 210, 71, 34, 113, 160, 42, 68, + ]), + Bytes32::new_direct([ + 108, 135, 226, 117, 179, 142, 93, 181, 20, 186, 189, 217, 49, 154, 66, 244, 180, 170, 122, + 233, 153, 214, 104, 71, 44, 57, 103, 240, 97, 80, 170, 198, + ]), + Bytes32::new_direct([ + 123, 168, 184, 254, 241, 78, 23, 91, 32, 77, 218, 176, 179, 189, 61, 162, 114, 158, 212, 7, + 201, 15, 58, 4, 161, 211, 188, 156, 190, 2, 20, 183, + ]), + Bytes32::new_direct([ + 60, 170, 86, 130, 38, 170, 202, 88, 97, 206, 67, 69, 140, 122, 201, 38, 70, 229, 144, 202, + 146, 10, 146, 148, 21, 247, 119, 196, 150, 223, 110, 67, + ]), + Bytes32::new_direct([ + 102, 154, 215, 132, 143, 248, 151, 101, 101, 253, 80, 211, 254, 64, 179, 73, 96, 132, 144, + 216, 225, 130, 48, 56, 14, 39, 97, 223, 134, 10, 124, 138, + ]), + Bytes32::new_direct([ + 197, 131, 194, 166, 168, 160, 24, 116, 47, 120, 89, 3, 44, 154, 83, 250, 142, 64, 77, 63, + 15, 60, 97, 100, 150, 39, 227, 139, 42, 146, 146, 104, + ]), + Bytes32::new_direct([ + 7, 160, 246, 93, 64, 79, 76, 208, 66, 80, 60, 123, 13, 51, 115, 251, 196, 209, 145, 106, + 61, 105, 136, 58, 7, 129, 142, 203, 205, 69, 45, 203, + ]), + Bytes32::new_direct([ + 64, 162, 48, 187, 213, 182, 41, 85, 62, 148, 26, 161, 227, 108, 173, 249, 195, 106, 203, + 18, 28, 59, 184, 85, 249, 16, 224, 222, 114, 200, 99, 22, + ]), + Bytes32::new_direct([ + 246, 194, 74, 122, 165, 216, 211, 144, 101, 143, 134, 9, 53, 229, 197, 227, 121, 248, 89, + 169, 48, 220, 104, 216, 117, 118, 36, 234, 108, 135, 81, 162, + ]), + Bytes32::new_direct([ + 232, 59, 196, 2, 103, 242, 44, 129, 41, 231, 226, 115, 238, 151, 166, 210, 158, 110, 43, + 45, 86, 163, 127, 8, 162, 81, 131, 145, 165, 252, 170, 12, + ]), + Bytes32::new_direct([ + 204, 88, 102, 180, 241, 148, 27, 183, 223, 71, 157, 119, 155, 31, 102, 239, 4, 83, 204, + 246, 38, 228, 234, 20, 97, 233, 203, 149, 186, 67, 143, 51, + ]), + Bytes32::new_direct([ + 246, 170, 233, 8, 202, 38, 67, 219, 175, 13, 250, 174, 98, 36, 84, 166, 6, 75, 27, 43, 62, + 128, 106, 23, 163, 191, 86, 115, 164, 50, 127, 151, + ]), + Bytes32::new_direct([ + 204, 72, 199, 57, 106, 136, 244, 66, 217, 155, 183, 211, 166, 71, 140, 211, 210, 181, 178, + 218, 204, 91, 200, 204, 153, 60, 22, 32, 24, 153, 131, 31, + ]), + Bytes32::new_direct([ + 204, 193, 13, 167, 214, 136, 121, 99, 198, 137, 11, 223, 85, 40, 167, 126, 153, 80, 187, + 35, 226, 31, 226, 42, 9, 175, 31, 206, 119, 67, 153, 39, + ]), + Bytes32::new_direct([ + 63, 82, 16, 182, 255, 45, 123, 220, 252, 52, 199, 222, 76, 172, 123, 232, 133, 182, 143, + 202, 223, 161, 203, 91, 239, 225, 123, 184, 231, 53, 19, 253, + ]), + Bytes32::new_direct([ + 5, 13, 255, 217, 70, 105, 205, 70, 41, 25, 44, 3, 245, 136, 16, 255, 101, 61, 189, 225, + 142, 201, 210, 226, 9, 237, 171, 109, 63, 204, 204, 139, + ]), + Bytes32::new_direct([ + 161, 218, 126, 252, 32, 196, 32, 105, 98, 13, 201, 117, 64, 37, 232, 32, 159, 106, 48, 121, + 250, 139, 219, 137, 129, 3, 83, 194, 102, 251, 148, 71, + ]), + Bytes32::new_direct([ + 72, 17, 9, 21, 142, 89, 135, 91, 81, 155, 72, 247, 56, 232, 136, 57, 251, 182, 211, 35, + 207, 169, 87, 123, 31, 222, 72, 85, 212, 92, 159, 171, + ]), + Bytes32::new_direct([ + 193, 253, 238, 224, 198, 216, 154, 52, 59, 87, 183, 80, 242, 162, 238, 7, 218, 195, 253, + 210, 92, 116, 43, 181, 109, 40, 74, 38, 154, 211, 102, 173, + ]), + Bytes32::new_direct([ + 193, 88, 249, 81, 11, 128, 242, 239, 220, 1, 237, 199, 235, 12, 153, 73, 145, 158, 15, 111, + 108, 244, 19, 51, 159, 206, 66, 25, 147, 215, 157, 165, + ]), + Bytes32::new_direct([ + 195, 90, 0, 163, 8, 199, 55, 59, 47, 117, 186, 204, 5, 42, 205, 164, 239, 233, 203, 210, + 69, 205, 244, 152, 113, 184, 206, 110, 101, 197, 120, 101, + ]), + Bytes32::new_direct([ + 114, 169, 222, 11, 169, 15, 123, 245, 42, 25, 120, 198, 66, 140, 125, 123, 201, 107, 3, 50, + 245, 226, 52, 46, 162, 44, 134, 157, 226, 11, 115, 186, + ]), + Bytes32::new_direct([ + 6, 47, 131, 89, 216, 138, 92, 250, 126, 232, 238, 50, 181, 78, 69, 115, 227, 25, 49, 50, + 116, 138, 47, 61, 179, 75, 121, 124, 127, 106, 228, 178, + ]), + Bytes32::new_direct([ + 152, 253, 228, 228, 120, 255, 82, 66, 24, 145, 159, 223, 39, 185, 81, 201, 81, 110, 47, 57, + 105, 128, 8, 42, 130, 119, 92, 7, 14, 247, 137, 135, + ]), + Bytes32::new_direct([ + 162, 28, 11, 245, 48, 21, 8, 137, 161, 131, 84, 18, 129, 70, 197, 122, 165, 39, 71, 213, + 142, 115, 159, 52, 46, 213, 81, 10, 217, 212, 74, 20, + ]), + Bytes32::new_direct([ + 129, 250, 71, 119, 46, 25, 220, 212, 143, 120, 0, 101, 85, 101, 109, 107, 142, 20, 107, + 174, 39, 134, 128, 244, 237, 155, 190, 19, 110, 10, 240, 94, + ]), + Bytes32::new_direct([ + 90, 70, 190, 48, 191, 45, 227, 17, 185, 162, 159, 12, 18, 94, 186, 251, 252, 238, 95, 174, + 253, 99, 194, 204, 5, 178, 117, 139, 50, 154, 93, 170, + ]), + Bytes32::new_direct([ + 201, 8, 48, 126, 70, 22, 83, 82, 229, 84, 168, 86, 100, 169, 227, 175, 196, 154, 217, 150, + 2, 36, 1, 100, 48, 216, 141, 205, 113, 148, 109, 126, + ]), + Bytes32::new_direct([ + 16, 182, 10, 119, 255, 70, 127, 242, 64, 68, 67, 44, 52, 195, 63, 185, 227, 97, 138, 244, + 53, 246, 110, 99, 41, 176, 146, 206, 81, 168, 66, 140, + ]), + Bytes32::new_direct([ + 95, 9, 211, 227, 219, 119, 221, 132, 248, 92, 236, 190, 110, 227, 153, 109, 103, 63, 121, + 221, 165, 212, 20, 141, 33, 95, 52, 157, 69, 76, 2, 70, + ]), + Bytes32::new_direct([ + 216, 138, 115, 198, 102, 135, 226, 247, 235, 185, 206, 147, 130, 9, 48, 166, 92, 22, 41, + 158, 169, 52, 233, 1, 60, 229, 165, 208, 60, 161, 194, 166, + ]), + Bytes32::new_direct([ + 129, 241, 87, 138, 103, 241, 79, 26, 52, 35, 125, 237, 54, 147, 253, 137, 101, 146, 235, + 127, 124, 113, 60, 203, 181, 4, 250, 12, 72, 27, 24, 7, + ]), + Bytes32::new_direct([ + 52, 120, 68, 97, 147, 229, 251, 178, 161, 233, 142, 136, 38, 40, 85, 46, 121, 156, 115, + 186, 72, 95, 128, 43, 252, 176, 176, 51, 113, 83, 154, 232, + ]), + Bytes32::new_direct([ + 227, 11, 188, 57, 98, 160, 248, 247, 112, 49, 247, 92, 94, 224, 135, 182, 211, 230, 69, + 185, 138, 154, 141, 157, 18, 34, 138, 236, 67, 243, 26, 132, + ]), + Bytes32::new_direct([ + 61, 246, 31, 52, 44, 146, 190, 215, 214, 105, 253, 86, 172, 174, 140, 112, 30, 154, 82, + 173, 62, 199, 157, 180, 255, 104, 73, 136, 163, 79, 210, 252, + ]), + Bytes32::new_direct([ + 200, 155, 200, 87, 142, 123, 62, 176, 250, 44, 18, 238, 229, 121, 125, 109, 102, 173, 60, + 203, 88, 65, 33, 122, 22, 111, 157, 143, 164, 7, 214, 26, + ]), + Bytes32::new_direct([ + 179, 76, 168, 179, 139, 86, 151, 173, 26, 70, 236, 116, 202, 123, 63, 80, 106, 208, 63, + 138, 179, 225, 114, 64, 48, 34, 78, 124, 132, 210, 224, 190, + ]), + Bytes32::new_direct([ + 138, 116, 89, 240, 28, 79, 42, 149, 199, 118, 149, 49, 146, 212, 104, 62, 17, 137, 138, + 223, 225, 187, 152, 43, 134, 60, 95, 55, 175, 128, 95, 144, + ]), ]; const INSTRUCTION_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::new_direct([248, 140, 83, 29, 241, 220, 66, 40, 126, 248, 5, 153, 77, 179, 26, 64, 221, 108, 205, 162, 173, 52, 179, 140, 202, 105, 0, 170, 166, 130, 120, 176]), - Bytes32::new_direct([35, 74, 103, 235, 245, 71, 66, 212, 99, 147, 15, 200, 1, 237, 95, 163, 10, 146, 122, 251, 243, 239, 93, 186, 46, 74, 206, 130, 63, 17, 199, 80]), - Bytes32::new_direct([113, 169, 40, 37, 169, 205, 28, 78, 37, 104, 52, 28, 29, 222, 39, 32, 208, 183, 215, 38, 255, 69, 87, 70, 174, 113, 221, 183, 206, 62, 192, 118]), - Bytes32::new_direct([1, 148, 183, 39, 234, 23, 138, 182, 169, 58, 52, 158, 248, 212, 186, 127, 60, 42, 25, 210, 20, 170, 182, 139, 20, 185, 196, 85, 241, 214, 181, 64]), - Bytes32::new_direct([241, 14, 59, 8, 168, 222, 232, 125, 149, 227, 125, 41, 223, 198, 88, 135, 54, 146, 140, 212, 164, 76, 239, 106, 10, 20, 67, 180, 24, 159, 174, 99]), - Bytes32::new_direct([117, 111, 220, 19, 204, 227, 211, 18, 61, 239, 179, 46, 142, 75, 67, 98, 159, 221, 205, 158, 125, 42, 221, 227, 148, 162, 193, 229, 147, 70, 214, 127]), - Bytes32::new_direct([20, 72, 211, 188, 38, 126, 166, 75, 54, 22, 225, 21, 113, 155, 167, 89, 161, 6, 37, 78, 227, 211, 219, 141, 161, 199, 151, 122, 81, 45, 159, 187]), - Bytes32::new_direct([69, 198, 100, 170, 106, 174, 208, 152, 152, 121, 118, 66, 111, 89, 131, 14, 159, 115, 142, 200, 205, 173, 89, 77, 68, 234, 5, 171, 105, 248, 199, 83]), - Bytes32::new_direct([17, 1, 220, 13, 154, 194, 88, 60, 253, 223, 149, 35, 44, 184, 107, 141, 205, 177, 185, 32, 22, 99, 212, 96, 194, 91, 255, 179, 121, 153, 254, 40]), - Bytes32::new_direct([222, 247, 186, 138, 222, 183, 135, 183, 170, 79, 182, 23, 69, 89, 70, 68, 88, 87, 235, 22, 178, 134, 114, 220, 249, 153, 70, 71, 229, 139, 10, 190]), - Bytes32::new_direct([183, 77, 65, 51, 207, 78, 55, 149, 222, 3, 100, 82, 232, 230, 21, 115, 249, 177, 36, 89, 12, 41, 70, 31, 199, 254, 213, 3, 184, 2, 85, 137]), - Bytes32::new_direct([82, 15, 215, 135, 95, 18, 143, 49, 239, 237, 6, 15, 213, 113, 153, 49, 149, 54, 50, 139, 100, 192, 128, 226, 168, 9, 120, 167, 157, 42, 45, 19]), - Bytes32::new_direct([70, 32, 130, 243, 186, 144, 224, 217, 130, 222, 175, 221, 218, 190, 179, 222, 217, 115, 70, 160, 141, 231, 221, 96, 2, 173, 27, 17, 158, 66, 180, 58]), - Bytes32::new_direct([76, 243, 65, 235, 12, 31, 48, 195, 62, 176, 202, 57, 99, 80, 237, 222, 138, 199, 124, 251, 143, 243, 205, 226, 18, 164, 67, 64, 68, 238, 53, 71]), - Bytes32::new_direct([70, 52, 254, 193, 211, 92, 63, 238, 92, 2, 160, 29, 154, 25, 221, 136, 2, 49, 96, 27, 15, 152, 238, 57, 241, 253, 32, 131, 73, 38, 229, 243]), - Bytes32::new_direct([214, 162, 82, 44, 146, 145, 61, 77, 36, 3, 131, 81, 217, 39, 127, 81, 66, 82, 172, 230, 246, 3, 243, 217, 210, 38, 201, 109, 240, 143, 253, 79]), - Bytes32::new_direct([127, 18, 198, 116, 112, 141, 16, 39, 115, 118, 37, 208, 118, 119, 147, 46, 196, 124, 19, 196, 34, 183, 172, 157, 18, 91, 4, 210, 77, 195, 220, 59]), - Bytes32::new_direct([87, 54, 42, 60, 39, 223, 84, 148, 158, 230, 70, 53, 191, 1, 108, 103, 139, 111, 58, 220, 114, 46, 46, 110, 20, 211, 84, 1, 173, 104, 175, 191]), - Bytes32::new_direct([182, 147, 66, 127, 229, 144, 125, 93, 84, 220, 116, 107, 51, 13, 24, 161, 68, 172, 165, 50, 12, 198, 229, 173, 49, 26, 114, 159, 84, 190, 6, 42]), - Bytes32::new_direct([183, 20, 36, 145, 76, 36, 61, 136, 224, 139, 89, 23, 124, 29, 210, 137, 1, 160, 22, 128, 48, 242, 234, 85, 84, 24, 206, 49, 143, 185, 237, 110]), - Bytes32::new_direct([38, 19, 77, 150, 92, 129, 177, 155, 139, 162, 90, 91, 231, 146, 216, 21, 54, 152, 18, 5, 98, 21, 67, 160, 154, 113, 175, 65, 214, 78, 19, 97]), - Bytes32::new_direct([163, 236, 47, 120, 121, 17, 217, 4, 200, 247, 206, 178, 211, 212, 163, 48, 38, 172, 111, 123, 75, 221, 63, 117, 42, 3, 252, 233, 104, 13, 210, 203]), - Bytes32::new_direct([127, 106, 132, 246, 28, 129, 245, 83, 159, 109, 196, 219, 68, 81, 230, 77, 254, 166, 55, 73, 169, 179, 93, 97, 117, 176, 53, 74, 121, 238, 184, 240]), - Bytes32::new_direct([255, 23, 108, 186, 145, 182, 196, 67, 163, 95, 173, 17, 67, 239, 199, 189, 145, 153, 120, 152, 159, 126, 255, 39, 55, 178, 230, 173, 91, 165, 229, 106]), - Bytes32::new_direct([184, 156, 20, 114, 222, 219, 89, 218, 102, 62, 130, 200, 179, 237, 32, 237, 127, 75, 251, 163, 160, 2, 221, 34, 166, 30, 172, 97, 115, 137, 179, 175]), - Bytes32::new_direct([244, 165, 127, 27, 66, 22, 38, 243, 235, 107, 30, 181, 31, 193, 210, 174, 254, 129, 39, 71, 59, 117, 186, 37, 217, 129, 138, 23, 146, 114, 96, 78]), - Bytes32::new_direct([27, 57, 244, 93, 208, 90, 64, 181, 161, 110, 161, 188, 62, 180, 46, 103, 136, 233, 63, 1, 243, 202, 236, 206, 173, 45, 45, 218, 238, 184, 83, 121]), - Bytes32::new_direct([138, 185, 33, 206, 120, 214, 246, 27, 100, 91, 106, 213, 60, 177, 39, 182, 149, 204, 11, 225, 254, 5, 87, 9, 19, 186, 166, 210, 33, 67, 146, 37]), - Bytes32::new_direct([243, 161, 7, 52, 35, 240, 227, 144, 29, 50, 232, 3, 101, 174, 192, 139, 89, 75, 204, 245, 173, 55, 139, 76, 126, 19, 142, 18, 230, 57, 219, 227]), - Bytes32::new_direct([97, 73, 36, 70, 120, 55, 49, 114, 107, 193, 66, 219, 47, 122, 201, 194, 52, 142, 12, 163, 108, 2, 107, 58, 185, 251, 168, 146, 57, 189, 150, 134]), - Bytes32::new_direct([11, 215, 29, 229, 151, 208, 62, 1, 172, 253, 253, 156, 177, 31, 117, 214, 161, 192, 68, 255, 140, 131, 66, 23, 247, 161, 107, 98, 199, 57, 123, 110]), - Bytes32::new_direct([41, 166, 54, 134, 242, 64, 153, 167, 5, 230, 226, 128, 71, 10, 251, 160, 19, 187, 70, 4, 95, 98, 77, 233, 181, 24, 11, 239, 142, 152, 229, 215]), - Bytes32::new_direct([221, 220, 68, 168, 143, 124, 235, 77, 241, 190, 214, 6, 102, 40, 32, 245, 131, 114, 170, 151, 134, 49, 79, 57, 242, 124, 85, 172, 83, 81, 68, 99]), - Bytes32::new_direct([142, 200, 102, 97, 170, 43, 14, 11, 139, 207, 150, 163, 99, 103, 2, 46, 44, 63, 109, 61, 62, 64, 199, 104, 36, 194, 155, 232, 139, 250, 97, 224]), - Bytes32::new_direct([162, 15, 26, 217, 96, 195, 70, 196, 253, 70, 127, 156, 39, 120, 120, 232, 197, 154, 192, 147, 104, 33, 104, 189, 120, 160, 36, 129, 208, 237, 128, 23]), - Bytes32::new_direct([42, 228, 74, 47, 20, 55, 197, 252, 173, 70, 178, 8, 2, 43, 97, 238, 155, 124, 87, 225, 217, 6, 103, 134, 136, 235, 193, 175, 33, 228, 219, 217]), - Bytes32::new_direct([219, 143, 25, 70, 78, 155, 119, 63, 126, 20, 158, 54, 27, 181, 104, 184, 74, 192, 75, 157, 42, 204, 45, 122, 25, 248, 247, 24, 225, 207, 51, 251]), - Bytes32::new_direct([151, 253, 36, 33, 104, 222, 126, 234, 112, 74, 59, 94, 239, 58, 36, 114, 90, 195, 208, 46, 250, 138, 165, 200, 178, 54, 238, 154, 219, 238, 6, 183]), - Bytes32::new_direct([205, 57, 187, 174, 221, 9, 164, 77, 76, 143, 54, 212, 115, 196, 67, 182, 200, 147, 78, 194, 245, 92, 173, 114, 180, 160, 168, 5, 200, 82, 217, 64]), - Bytes32::new_direct([211, 104, 62, 114, 157, 56, 254, 26, 32, 168, 208, 248, 62, 195, 142, 68, 53, 13, 7, 36, 216, 5, 127, 153, 97, 88, 222, 206, 91, 42, 14, 114]), - Bytes32::new_direct([203, 158, 225, 200, 62, 223, 202, 52, 207, 179, 250, 236, 29, 144, 181, 31, 87, 192, 203, 66, 56, 39, 123, 25, 123, 157, 196, 161, 34, 245, 22, 130]), - Bytes32::new_direct([147, 247, 233, 96, 190, 104, 227, 251, 99, 2, 16, 8, 77, 119, 1, 97, 243, 78, 103, 46, 24, 228, 217, 65, 219, 238, 135, 18, 164, 219, 132, 39]), - Bytes32::new_direct([239, 153, 72, 139, 52, 60, 171, 44, 72, 218, 138, 124, 45, 30, 143, 122, 147, 158, 12, 62, 213, 151, 217, 217, 212, 51, 110, 75, 122, 67, 134, 80]), - Bytes32::new_direct([46, 47, 130, 237, 178, 232, 239, 217, 165, 114, 255, 202, 132, 214, 18, 8, 72, 8, 255, 0, 162, 82, 5, 228, 141, 201, 70, 135, 255, 21, 220, 3]), - Bytes32::new_direct([21, 11, 196, 5, 215, 241, 194, 200, 198, 129, 133, 244, 204, 47, 131, 70, 138, 38, 107, 39, 211, 243, 72, 72, 34, 145, 35, 42, 14, 69, 218, 227]), - Bytes32::new_direct([73, 103, 117, 195, 67, 126, 242, 57, 232, 74, 142, 64, 169, 248, 113, 69, 110, 103, 127, 185, 177, 51, 212, 178, 48, 183, 247, 44, 246, 69, 35, 208]), - Bytes32::new_direct([125, 8, 83, 22, 215, 82, 179, 234, 169, 227, 213, 39, 170, 164, 195, 187, 63, 38, 59, 146, 144, 101, 38, 0, 110, 212, 202, 20, 245, 105, 187, 201]), - Bytes32::new_direct([186, 231, 186, 148, 68, 208, 226, 170, 120, 80, 68, 79, 23, 41, 51, 205, 240, 201, 10, 16, 24, 38, 137, 151, 7, 102, 92, 244, 3, 194, 228, 229]), - Bytes32::new_direct([46, 8, 51, 150, 63, 114, 126, 210, 30, 130, 76, 142, 13, 149, 14, 0, 205, 199, 48, 90, 86, 75, 151, 135, 164, 224, 129, 77, 174, 194, 212, 112]), - Bytes32::new_direct([150, 239, 42, 111, 3, 112, 25, 168, 179, 36, 106, 73, 212, 188, 215, 79, 180, 142, 191, 29, 219, 12, 244, 74, 254, 205, 160, 54, 68, 144, 81, 207]), - Bytes32::new_direct([23, 164, 189, 201, 250, 65, 212, 148, 132, 125, 94, 209, 115, 123, 29, 66, 3, 172, 57, 58, 46, 191, 96, 7, 212, 25, 226, 79, 120, 68, 202, 210]), - Bytes32::new_direct([252, 13, 137, 225, 208, 6, 84, 75, 97, 32, 177, 156, 248, 191, 113, 97, 254, 122, 86, 194, 3, 103, 219, 74, 227, 160, 231, 202, 13, 126, 46, 255]), - Bytes32::new_direct([70, 35, 27, 128, 17, 79, 226, 131, 144, 118, 248, 125, 188, 110, 20, 15, 255, 73, 205, 69, 0, 227, 26, 66, 39, 61, 191, 224, 239, 234, 83, 170]), - Bytes32::new_direct([129, 52, 148, 121, 230, 84, 28, 112, 75, 68, 181, 197, 80, 227, 107, 22, 60, 118, 81, 209, 198, 125, 233, 190, 84, 189, 18, 25, 72, 143, 2, 190]), - Bytes32::new_direct([244, 237, 81, 131, 251, 35, 56, 158, 229, 102, 150, 122, 213, 206, 119, 38, 54, 238, 158, 159, 1, 214, 31, 147, 245, 9, 172, 247, 156, 115, 209, 140]), - Bytes32::new_direct([47, 5, 174, 62, 80, 172, 77, 111, 136, 114, 188, 85, 249, 157, 182, 175, 187, 207, 29, 43, 152, 88, 130, 156, 138, 30, 188, 51, 82, 105, 145, 161]), - Bytes32::new_direct([102, 2, 197, 195, 206, 149, 53, 224, 61, 219, 163, 246, 208, 218, 140, 47, 16, 42, 196, 20, 145, 158, 101, 31, 225, 135, 49, 68, 95, 5, 228, 92]), - Bytes32::new_direct([78, 136, 176, 216, 253, 15, 136, 48, 162, 5, 57, 120, 93, 222, 179, 174, 129, 40, 8, 63, 18, 102, 97, 41, 58, 214, 1, 52, 58, 126, 186, 146]), - Bytes32::new_direct([145, 56, 231, 59, 247, 191, 104, 137, 240, 113, 32, 245, 235, 129, 255, 54, 99, 176, 109, 175, 107, 232, 201, 235, 95, 104, 54, 67, 252, 184, 200, 54]), - Bytes32::new_direct([181, 3, 229, 152, 113, 182, 55, 93, 138, 137, 21, 67, 27, 204, 96, 69, 72, 247, 237, 216, 28, 36, 115, 185, 111, 149, 224, 69, 66, 121, 188, 228]), - Bytes32::new_direct([212, 25, 201, 68, 187, 25, 10, 96, 40, 88, 100, 216, 145, 200, 26, 203, 220, 14, 14, 11, 190, 62, 143, 137, 53, 208, 233, 158, 37, 34, 8, 15]), - Bytes32::new_direct([80, 101, 192, 136, 203, 90, 189, 204, 181, 36, 28, 107, 220, 69, 119, 99, 145, 227, 198, 55, 37, 237, 212, 114, 31, 27, 19, 90, 231, 143, 87, 149]), - Bytes32::new_direct([248, 97, 168, 33, 15, 230, 128, 82, 157, 26, 186, 89, 200, 7, 101, 210, 117, 111, 75, 233, 244, 187, 1, 180, 30, 220, 15, 21, 203, 5, 243, 223]), + Bytes32::new_direct([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ]), + Bytes32::new_direct([ + 248, 140, 83, 29, 241, 220, 66, 40, 126, 248, 5, 153, 77, 179, 26, 64, 221, 108, 205, 162, + 173, 52, 179, 140, 202, 105, 0, 170, 166, 130, 120, 176, + ]), + Bytes32::new_direct([ + 35, 74, 103, 235, 245, 71, 66, 212, 99, 147, 15, 200, 1, 237, 95, 163, 10, 146, 122, 251, + 243, 239, 93, 186, 46, 74, 206, 130, 63, 17, 199, 80, + ]), + Bytes32::new_direct([ + 113, 169, 40, 37, 169, 205, 28, 78, 37, 104, 52, 28, 29, 222, 39, 32, 208, 183, 215, 38, + 255, 69, 87, 70, 174, 113, 221, 183, 206, 62, 192, 118, + ]), + Bytes32::new_direct([ + 1, 148, 183, 39, 234, 23, 138, 182, 169, 58, 52, 158, 248, 212, 186, 127, 60, 42, 25, 210, + 20, 170, 182, 139, 20, 185, 196, 85, 241, 214, 181, 64, + ]), + Bytes32::new_direct([ + 241, 14, 59, 8, 168, 222, 232, 125, 149, 227, 125, 41, 223, 198, 88, 135, 54, 146, 140, + 212, 164, 76, 239, 106, 10, 20, 67, 180, 24, 159, 174, 99, + ]), + Bytes32::new_direct([ + 117, 111, 220, 19, 204, 227, 211, 18, 61, 239, 179, 46, 142, 75, 67, 98, 159, 221, 205, + 158, 125, 42, 221, 227, 148, 162, 193, 229, 147, 70, 214, 127, + ]), + Bytes32::new_direct([ + 20, 72, 211, 188, 38, 126, 166, 75, 54, 22, 225, 21, 113, 155, 167, 89, 161, 6, 37, 78, + 227, 211, 219, 141, 161, 199, 151, 122, 81, 45, 159, 187, + ]), + Bytes32::new_direct([ + 69, 198, 100, 170, 106, 174, 208, 152, 152, 121, 118, 66, 111, 89, 131, 14, 159, 115, 142, + 200, 205, 173, 89, 77, 68, 234, 5, 171, 105, 248, 199, 83, + ]), + Bytes32::new_direct([ + 17, 1, 220, 13, 154, 194, 88, 60, 253, 223, 149, 35, 44, 184, 107, 141, 205, 177, 185, 32, + 22, 99, 212, 96, 194, 91, 255, 179, 121, 153, 254, 40, + ]), + Bytes32::new_direct([ + 222, 247, 186, 138, 222, 183, 135, 183, 170, 79, 182, 23, 69, 89, 70, 68, 88, 87, 235, 22, + 178, 134, 114, 220, 249, 153, 70, 71, 229, 139, 10, 190, + ]), + Bytes32::new_direct([ + 183, 77, 65, 51, 207, 78, 55, 149, 222, 3, 100, 82, 232, 230, 21, 115, 249, 177, 36, 89, + 12, 41, 70, 31, 199, 254, 213, 3, 184, 2, 85, 137, + ]), + Bytes32::new_direct([ + 82, 15, 215, 135, 95, 18, 143, 49, 239, 237, 6, 15, 213, 113, 153, 49, 149, 54, 50, 139, + 100, 192, 128, 226, 168, 9, 120, 167, 157, 42, 45, 19, + ]), + Bytes32::new_direct([ + 70, 32, 130, 243, 186, 144, 224, 217, 130, 222, 175, 221, 218, 190, 179, 222, 217, 115, 70, + 160, 141, 231, 221, 96, 2, 173, 27, 17, 158, 66, 180, 58, + ]), + Bytes32::new_direct([ + 76, 243, 65, 235, 12, 31, 48, 195, 62, 176, 202, 57, 99, 80, 237, 222, 138, 199, 124, 251, + 143, 243, 205, 226, 18, 164, 67, 64, 68, 238, 53, 71, + ]), + Bytes32::new_direct([ + 70, 52, 254, 193, 211, 92, 63, 238, 92, 2, 160, 29, 154, 25, 221, 136, 2, 49, 96, 27, 15, + 152, 238, 57, 241, 253, 32, 131, 73, 38, 229, 243, + ]), + Bytes32::new_direct([ + 214, 162, 82, 44, 146, 145, 61, 77, 36, 3, 131, 81, 217, 39, 127, 81, 66, 82, 172, 230, + 246, 3, 243, 217, 210, 38, 201, 109, 240, 143, 253, 79, + ]), + Bytes32::new_direct([ + 127, 18, 198, 116, 112, 141, 16, 39, 115, 118, 37, 208, 118, 119, 147, 46, 196, 124, 19, + 196, 34, 183, 172, 157, 18, 91, 4, 210, 77, 195, 220, 59, + ]), + Bytes32::new_direct([ + 87, 54, 42, 60, 39, 223, 84, 148, 158, 230, 70, 53, 191, 1, 108, 103, 139, 111, 58, 220, + 114, 46, 46, 110, 20, 211, 84, 1, 173, 104, 175, 191, + ]), + Bytes32::new_direct([ + 182, 147, 66, 127, 229, 144, 125, 93, 84, 220, 116, 107, 51, 13, 24, 161, 68, 172, 165, 50, + 12, 198, 229, 173, 49, 26, 114, 159, 84, 190, 6, 42, + ]), + Bytes32::new_direct([ + 183, 20, 36, 145, 76, 36, 61, 136, 224, 139, 89, 23, 124, 29, 210, 137, 1, 160, 22, 128, + 48, 242, 234, 85, 84, 24, 206, 49, 143, 185, 237, 110, + ]), + Bytes32::new_direct([ + 38, 19, 77, 150, 92, 129, 177, 155, 139, 162, 90, 91, 231, 146, 216, 21, 54, 152, 18, 5, + 98, 21, 67, 160, 154, 113, 175, 65, 214, 78, 19, 97, + ]), + Bytes32::new_direct([ + 163, 236, 47, 120, 121, 17, 217, 4, 200, 247, 206, 178, 211, 212, 163, 48, 38, 172, 111, + 123, 75, 221, 63, 117, 42, 3, 252, 233, 104, 13, 210, 203, + ]), + Bytes32::new_direct([ + 127, 106, 132, 246, 28, 129, 245, 83, 159, 109, 196, 219, 68, 81, 230, 77, 254, 166, 55, + 73, 169, 179, 93, 97, 117, 176, 53, 74, 121, 238, 184, 240, + ]), + Bytes32::new_direct([ + 255, 23, 108, 186, 145, 182, 196, 67, 163, 95, 173, 17, 67, 239, 199, 189, 145, 153, 120, + 152, 159, 126, 255, 39, 55, 178, 230, 173, 91, 165, 229, 106, + ]), + Bytes32::new_direct([ + 184, 156, 20, 114, 222, 219, 89, 218, 102, 62, 130, 200, 179, 237, 32, 237, 127, 75, 251, + 163, 160, 2, 221, 34, 166, 30, 172, 97, 115, 137, 179, 175, + ]), + Bytes32::new_direct([ + 244, 165, 127, 27, 66, 22, 38, 243, 235, 107, 30, 181, 31, 193, 210, 174, 254, 129, 39, 71, + 59, 117, 186, 37, 217, 129, 138, 23, 146, 114, 96, 78, + ]), + Bytes32::new_direct([ + 27, 57, 244, 93, 208, 90, 64, 181, 161, 110, 161, 188, 62, 180, 46, 103, 136, 233, 63, 1, + 243, 202, 236, 206, 173, 45, 45, 218, 238, 184, 83, 121, + ]), + Bytes32::new_direct([ + 138, 185, 33, 206, 120, 214, 246, 27, 100, 91, 106, 213, 60, 177, 39, 182, 149, 204, 11, + 225, 254, 5, 87, 9, 19, 186, 166, 210, 33, 67, 146, 37, + ]), + Bytes32::new_direct([ + 243, 161, 7, 52, 35, 240, 227, 144, 29, 50, 232, 3, 101, 174, 192, 139, 89, 75, 204, 245, + 173, 55, 139, 76, 126, 19, 142, 18, 230, 57, 219, 227, + ]), + Bytes32::new_direct([ + 97, 73, 36, 70, 120, 55, 49, 114, 107, 193, 66, 219, 47, 122, 201, 194, 52, 142, 12, 163, + 108, 2, 107, 58, 185, 251, 168, 146, 57, 189, 150, 134, + ]), + Bytes32::new_direct([ + 11, 215, 29, 229, 151, 208, 62, 1, 172, 253, 253, 156, 177, 31, 117, 214, 161, 192, 68, + 255, 140, 131, 66, 23, 247, 161, 107, 98, 199, 57, 123, 110, + ]), + Bytes32::new_direct([ + 41, 166, 54, 134, 242, 64, 153, 167, 5, 230, 226, 128, 71, 10, 251, 160, 19, 187, 70, 4, + 95, 98, 77, 233, 181, 24, 11, 239, 142, 152, 229, 215, + ]), + Bytes32::new_direct([ + 221, 220, 68, 168, 143, 124, 235, 77, 241, 190, 214, 6, 102, 40, 32, 245, 131, 114, 170, + 151, 134, 49, 79, 57, 242, 124, 85, 172, 83, 81, 68, 99, + ]), + Bytes32::new_direct([ + 142, 200, 102, 97, 170, 43, 14, 11, 139, 207, 150, 163, 99, 103, 2, 46, 44, 63, 109, 61, + 62, 64, 199, 104, 36, 194, 155, 232, 139, 250, 97, 224, + ]), + Bytes32::new_direct([ + 162, 15, 26, 217, 96, 195, 70, 196, 253, 70, 127, 156, 39, 120, 120, 232, 197, 154, 192, + 147, 104, 33, 104, 189, 120, 160, 36, 129, 208, 237, 128, 23, + ]), + Bytes32::new_direct([ + 42, 228, 74, 47, 20, 55, 197, 252, 173, 70, 178, 8, 2, 43, 97, 238, 155, 124, 87, 225, 217, + 6, 103, 134, 136, 235, 193, 175, 33, 228, 219, 217, + ]), + Bytes32::new_direct([ + 219, 143, 25, 70, 78, 155, 119, 63, 126, 20, 158, 54, 27, 181, 104, 184, 74, 192, 75, 157, + 42, 204, 45, 122, 25, 248, 247, 24, 225, 207, 51, 251, + ]), + Bytes32::new_direct([ + 151, 253, 36, 33, 104, 222, 126, 234, 112, 74, 59, 94, 239, 58, 36, 114, 90, 195, 208, 46, + 250, 138, 165, 200, 178, 54, 238, 154, 219, 238, 6, 183, + ]), + Bytes32::new_direct([ + 205, 57, 187, 174, 221, 9, 164, 77, 76, 143, 54, 212, 115, 196, 67, 182, 200, 147, 78, 194, + 245, 92, 173, 114, 180, 160, 168, 5, 200, 82, 217, 64, + ]), + Bytes32::new_direct([ + 211, 104, 62, 114, 157, 56, 254, 26, 32, 168, 208, 248, 62, 195, 142, 68, 53, 13, 7, 36, + 216, 5, 127, 153, 97, 88, 222, 206, 91, 42, 14, 114, + ]), + Bytes32::new_direct([ + 203, 158, 225, 200, 62, 223, 202, 52, 207, 179, 250, 236, 29, 144, 181, 31, 87, 192, 203, + 66, 56, 39, 123, 25, 123, 157, 196, 161, 34, 245, 22, 130, + ]), + Bytes32::new_direct([ + 147, 247, 233, 96, 190, 104, 227, 251, 99, 2, 16, 8, 77, 119, 1, 97, 243, 78, 103, 46, 24, + 228, 217, 65, 219, 238, 135, 18, 164, 219, 132, 39, + ]), + Bytes32::new_direct([ + 239, 153, 72, 139, 52, 60, 171, 44, 72, 218, 138, 124, 45, 30, 143, 122, 147, 158, 12, 62, + 213, 151, 217, 217, 212, 51, 110, 75, 122, 67, 134, 80, + ]), + Bytes32::new_direct([ + 46, 47, 130, 237, 178, 232, 239, 217, 165, 114, 255, 202, 132, 214, 18, 8, 72, 8, 255, 0, + 162, 82, 5, 228, 141, 201, 70, 135, 255, 21, 220, 3, + ]), + Bytes32::new_direct([ + 21, 11, 196, 5, 215, 241, 194, 200, 198, 129, 133, 244, 204, 47, 131, 70, 138, 38, 107, 39, + 211, 243, 72, 72, 34, 145, 35, 42, 14, 69, 218, 227, + ]), + Bytes32::new_direct([ + 73, 103, 117, 195, 67, 126, 242, 57, 232, 74, 142, 64, 169, 248, 113, 69, 110, 103, 127, + 185, 177, 51, 212, 178, 48, 183, 247, 44, 246, 69, 35, 208, + ]), + Bytes32::new_direct([ + 125, 8, 83, 22, 215, 82, 179, 234, 169, 227, 213, 39, 170, 164, 195, 187, 63, 38, 59, 146, + 144, 101, 38, 0, 110, 212, 202, 20, 245, 105, 187, 201, + ]), + Bytes32::new_direct([ + 186, 231, 186, 148, 68, 208, 226, 170, 120, 80, 68, 79, 23, 41, 51, 205, 240, 201, 10, 16, + 24, 38, 137, 151, 7, 102, 92, 244, 3, 194, 228, 229, + ]), + Bytes32::new_direct([ + 46, 8, 51, 150, 63, 114, 126, 210, 30, 130, 76, 142, 13, 149, 14, 0, 205, 199, 48, 90, 86, + 75, 151, 135, 164, 224, 129, 77, 174, 194, 212, 112, + ]), + Bytes32::new_direct([ + 150, 239, 42, 111, 3, 112, 25, 168, 179, 36, 106, 73, 212, 188, 215, 79, 180, 142, 191, 29, + 219, 12, 244, 74, 254, 205, 160, 54, 68, 144, 81, 207, + ]), + Bytes32::new_direct([ + 23, 164, 189, 201, 250, 65, 212, 148, 132, 125, 94, 209, 115, 123, 29, 66, 3, 172, 57, 58, + 46, 191, 96, 7, 212, 25, 226, 79, 120, 68, 202, 210, + ]), + Bytes32::new_direct([ + 252, 13, 137, 225, 208, 6, 84, 75, 97, 32, 177, 156, 248, 191, 113, 97, 254, 122, 86, 194, + 3, 103, 219, 74, 227, 160, 231, 202, 13, 126, 46, 255, + ]), + Bytes32::new_direct([ + 70, 35, 27, 128, 17, 79, 226, 131, 144, 118, 248, 125, 188, 110, 20, 15, 255, 73, 205, 69, + 0, 227, 26, 66, 39, 61, 191, 224, 239, 234, 83, 170, + ]), + Bytes32::new_direct([ + 129, 52, 148, 121, 230, 84, 28, 112, 75, 68, 181, 197, 80, 227, 107, 22, 60, 118, 81, 209, + 198, 125, 233, 190, 84, 189, 18, 25, 72, 143, 2, 190, + ]), + Bytes32::new_direct([ + 244, 237, 81, 131, 251, 35, 56, 158, 229, 102, 150, 122, 213, 206, 119, 38, 54, 238, 158, + 159, 1, 214, 31, 147, 245, 9, 172, 247, 156, 115, 209, 140, + ]), + Bytes32::new_direct([ + 47, 5, 174, 62, 80, 172, 77, 111, 136, 114, 188, 85, 249, 157, 182, 175, 187, 207, 29, 43, + 152, 88, 130, 156, 138, 30, 188, 51, 82, 105, 145, 161, + ]), + Bytes32::new_direct([ + 102, 2, 197, 195, 206, 149, 53, 224, 61, 219, 163, 246, 208, 218, 140, 47, 16, 42, 196, 20, + 145, 158, 101, 31, 225, 135, 49, 68, 95, 5, 228, 92, + ]), + Bytes32::new_direct([ + 78, 136, 176, 216, 253, 15, 136, 48, 162, 5, 57, 120, 93, 222, 179, 174, 129, 40, 8, 63, + 18, 102, 97, 41, 58, 214, 1, 52, 58, 126, 186, 146, + ]), + Bytes32::new_direct([ + 145, 56, 231, 59, 247, 191, 104, 137, 240, 113, 32, 245, 235, 129, 255, 54, 99, 176, 109, + 175, 107, 232, 201, 235, 95, 104, 54, 67, 252, 184, 200, 54, + ]), + Bytes32::new_direct([ + 181, 3, 229, 152, 113, 182, 55, 93, 138, 137, 21, 67, 27, 204, 96, 69, 72, 247, 237, 216, + 28, 36, 115, 185, 111, 149, 224, 69, 66, 121, 188, 228, + ]), + Bytes32::new_direct([ + 212, 25, 201, 68, 187, 25, 10, 96, 40, 88, 100, 216, 145, 200, 26, 203, 220, 14, 14, 11, + 190, 62, 143, 137, 53, 208, 233, 158, 37, 34, 8, 15, + ]), + Bytes32::new_direct([ + 80, 101, 192, 136, 203, 90, 189, 204, 181, 36, 28, 107, 220, 69, 119, 99, 145, 227, 198, + 55, 37, 237, 212, 114, 31, 27, 19, 90, 231, 143, 87, 149, + ]), + Bytes32::new_direct([ + 248, 97, 168, 33, 15, 230, 128, 82, 157, 26, 186, 89, 200, 7, 101, 210, 117, 111, 75, 233, + 244, 187, 1, 180, 30, 220, 15, 21, 203, 5, 243, 223, + ]), ]; const MEMORY_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::new_direct([66, 208, 130, 169, 194, 116, 5, 27, 68, 75, 235, 175, 164, 169, 41, 91, 88, 134, 51, 194, 219, 201, 182, 199, 1, 52, 173, 215, 20, 37, 51, 0]), - Bytes32::new_direct([90, 210, 50, 227, 58, 173, 147, 92, 139, 15, 127, 190, 196, 111, 142, 207, 31, 223, 70, 96, 17, 251, 164, 200, 133, 0, 76, 35, 200, 9, 51, 218]), - Bytes32::new_direct([97, 5, 162, 226, 92, 108, 172, 8, 7, 65, 104, 176, 216, 3, 144, 47, 14, 88, 50, 101, 194, 94, 10, 132, 192, 76, 37, 152, 42, 73, 30, 2]), - Bytes32::new_direct([68, 59, 208, 14, 89, 37, 33, 1, 177, 225, 235, 66, 129, 28, 103, 156, 46, 206, 94, 141, 33, 152, 141, 26, 209, 161, 53, 237, 198, 163, 115, 57]), - Bytes32::new_direct([28, 94, 12, 53, 70, 163, 95, 44, 168, 42, 196, 126, 181, 231, 174, 247, 89, 100, 77, 238, 211, 74, 116, 144, 183, 111, 254, 75, 30, 187, 228, 222]), - Bytes32::new_direct([238, 133, 50, 189, 14, 89, 244, 88, 239, 50, 172, 85, 172, 1, 131, 2, 24, 161, 70, 94, 0, 204, 50, 199, 48, 107, 30, 70, 6, 8, 18, 90]), - Bytes32::new_direct([165, 239, 71, 173, 192, 165, 25, 35, 4, 130, 148, 158, 177, 193, 129, 45, 115, 209, 7, 233, 136, 108, 245, 126, 74, 200, 22, 204, 190, 137, 191, 105]), - Bytes32::new_direct([173, 102, 127, 73, 167, 249, 117, 26, 190, 231, 26, 60, 201, 138, 160, 182, 180, 44, 34, 132, 171, 254, 91, 8, 167, 114, 188, 157, 181, 148, 169, 165]), - Bytes32::new_direct([71, 62, 70, 89, 203, 1, 105, 187, 178, 167, 217, 118, 42, 217, 154, 234, 238, 109, 145, 231, 247, 199, 40, 110, 162, 11, 173, 144, 103, 110, 99, 101]), - Bytes32::new_direct([121, 36, 94, 4, 25, 134, 16, 98, 198, 109, 123, 42, 56, 151, 224, 7, 232, 155, 231, 154, 229, 162, 250, 149, 231, 198, 0, 65, 17, 27, 181, 28]), - Bytes32::new_direct([247, 158, 162, 102, 242, 117, 166, 252, 175, 158, 107, 157, 244, 44, 17, 99, 93, 52, 43, 136, 5, 211, 32, 152, 91, 148, 41, 32, 231, 18, 237, 208]), - Bytes32::new_direct([147, 52, 155, 255, 81, 242, 75, 54, 54, 66, 166, 41, 131, 177, 183, 151, 229, 177, 232, 86, 146, 137, 106, 68, 226, 117, 20, 210, 224, 170, 249, 68]), - Bytes32::new_direct([160, 89, 180, 156, 119, 172, 38, 10, 97, 101, 64, 56, 98, 133, 199, 228, 58, 66, 139, 128, 88, 140, 143, 85, 148, 167, 79, 75, 34, 45, 204, 68]), - Bytes32::new_direct([165, 233, 117, 3, 27, 56, 166, 16, 56, 132, 198, 32, 11, 149, 212, 98, 64, 236, 180, 106, 174, 80, 122, 220, 102, 67, 67, 110, 67, 8, 48, 217]), - Bytes32::new_direct([113, 74, 209, 139, 250, 181, 182, 127, 178, 77, 17, 63, 79, 109, 145, 74, 52, 102, 125, 154, 22, 241, 177, 177, 34, 189, 124, 22, 4, 200, 201, 76]), - Bytes32::new_direct([67, 7, 240, 151, 128, 149, 238, 113, 130, 127, 174, 223, 142, 124, 230, 10, 91, 89, 113, 157, 230, 21, 213, 3, 146, 249, 26, 80, 239, 90, 4, 216]), - Bytes32::new_direct([152, 20, 80, 244, 232, 182, 1, 145, 31, 191, 46, 207, 83, 199, 209, 104, 0, 75, 106, 230, 16, 98, 121, 127, 175, 78, 119, 154, 69, 55, 66, 169]), - Bytes32::new_direct([123, 50, 162, 158, 51, 112, 129, 232, 242, 158, 150, 72, 244, 40, 191, 63, 205, 61, 144, 39, 65, 122, 28, 88, 253, 146, 29, 29, 15, 40, 122, 95]), - Bytes32::new_direct([231, 253, 202, 45, 165, 158, 212, 29, 104, 165, 209, 179, 188, 154, 89, 18, 216, 23, 140, 66, 150, 49, 99, 200, 163, 155, 50, 9, 250, 22, 19, 203]), - Bytes32::new_direct([127, 172, 110, 243, 156, 134, 199, 15, 248, 216, 12, 196, 221, 66, 202, 186, 105, 197, 43, 245, 46, 116, 251, 133, 111, 118, 56, 214, 157, 244, 187, 58]), - Bytes32::new_direct([181, 181, 163, 95, 7, 188, 245, 128, 161, 210, 137, 217, 103, 101, 120, 255, 47, 83, 102, 68, 238, 195, 206, 105, 24, 150, 216, 50, 74, 6, 94, 95]), - Bytes32::new_direct([171, 250, 198, 40, 153, 26, 240, 152, 96, 169, 15, 123, 33, 155, 57, 172, 89, 205, 9, 65, 45, 126, 155, 143, 224, 145, 25, 214, 19, 227, 213, 195]), - Bytes32::new_direct([44, 177, 244, 220, 119, 33, 203, 59, 209, 72, 28, 4, 210, 54, 86, 20, 119, 41, 45, 231, 143, 104, 57, 206, 212, 222, 81, 62, 92, 221, 200, 32]), - Bytes32::new_direct([37, 200, 165, 195, 67, 224, 131, 227, 97, 54, 21, 233, 76, 186, 6, 122, 178, 131, 252, 59, 97, 218, 239, 62, 124, 255, 201, 178, 241, 236, 4, 214]), - Bytes32::new_direct([77, 171, 229, 183, 46, 112, 203, 177, 89, 90, 64, 114, 109, 220, 32, 120, 41, 223, 72, 86, 59, 211, 110, 17, 129, 112, 194, 186, 200, 92, 144, 49]), - Bytes32::new_direct([2, 198, 61, 112, 181, 185, 194, 114, 149, 63, 65, 76, 55, 179, 170, 62, 91, 112, 189, 100, 13, 34, 98, 187, 85, 132, 202, 86, 47, 27, 236, 200]), - Bytes32::new_direct([164, 238, 109, 209, 155, 118, 236, 237, 84, 43, 56, 99, 51, 60, 116, 235, 100, 39, 163, 105, 34, 93, 8, 187, 228, 213, 35, 200, 43, 8, 32, 68]), - Bytes32::new_direct([32, 220, 39, 200, 214, 245, 102, 200, 167, 204, 3, 54, 140, 126, 129, 35, 139, 60, 112, 133, 52, 166, 162, 63, 119, 20, 2, 116, 132, 244, 246, 225]), - Bytes32::new_direct([5, 54, 145, 188, 188, 251, 36, 4, 103, 140, 229, 143, 83, 11, 77, 207, 57, 125, 51, 127, 89, 130, 138, 193, 190, 17, 17, 23, 68, 168, 231, 106]), - Bytes32::new_direct([239, 112, 72, 74, 116, 134, 210, 24, 226, 242, 91, 113, 99, 59, 19, 7, 226, 215, 254, 220, 14, 225, 75, 245, 11, 234, 138, 52, 195, 86, 79, 124]), - Bytes32::new_direct([187, 35, 132, 188, 162, 128, 96, 71, 124, 213, 251, 229, 73, 52, 187, 22, 166, 35, 214, 14, 121, 189, 37, 5, 77, 54, 201, 51, 95, 179, 75, 229]), - Bytes32::new_direct([5, 54, 88, 42, 68, 200, 45, 209, 121, 70, 128, 8, 178, 212, 197, 39, 101, 90, 101, 111, 77, 133, 13, 77, 19, 111, 113, 122, 222, 85, 180, 82]), - Bytes32::new_direct([34, 182, 144, 13, 35, 35, 79, 14, 239, 80, 21, 255, 67, 48, 210, 174, 159, 182, 239, 236, 68, 46, 125, 105, 243, 202, 218, 64, 53, 94, 159, 253]), - Bytes32::new_direct([224, 189, 145, 186, 43, 169, 131, 161, 223, 161, 72, 72, 229, 97, 113, 233, 2, 250, 109, 31, 19, 125, 57, 135, 144, 3, 187, 18, 102, 108, 232, 9]), - Bytes32::new_direct([68, 94, 11, 104, 95, 110, 179, 226, 157, 245, 113, 68, 44, 122, 17, 22, 244, 35, 248, 126, 131, 192, 20, 169, 129, 236, 60, 54, 157, 30, 231, 36]), - Bytes32::new_direct([101, 198, 107, 156, 226, 8, 67, 168, 197, 91, 189, 166, 187, 16, 121, 93, 114, 243, 137, 162, 125, 142, 50, 206, 160, 168, 165, 27, 207, 10, 22, 19]), - Bytes32::new_direct([222, 29, 134, 137, 98, 73, 58, 143, 166, 134, 210, 47, 68, 23, 214, 237, 241, 207, 226, 83, 113, 222, 184, 139, 16, 1, 200, 56, 34, 208, 197, 152]), - Bytes32::new_direct([107, 200, 189, 222, 185, 32, 192, 130, 237, 238, 168, 137, 14, 94, 3, 26, 41, 238, 19, 119, 207, 158, 25, 177, 116, 70, 170, 161, 141, 129, 16, 88]), - Bytes32::new_direct([131, 243, 131, 161, 236, 101, 108, 81, 59, 123, 150, 6, 250, 124, 103, 101, 75, 234, 98, 223, 129, 87, 202, 59, 184, 173, 44, 191, 200, 30, 223, 66]), - Bytes32::new_direct([17, 226, 72, 31, 180, 33, 229, 83, 154, 39, 104, 45, 93, 117, 153, 249, 216, 127, 120, 182, 4, 19, 169, 87, 127, 70, 7, 237, 80, 251, 220, 126]), - Bytes32::new_direct([88, 122, 134, 181, 173, 175, 100, 74, 28, 141, 45, 215, 245, 170, 222, 54, 106, 118, 146, 59, 207, 251, 133, 155, 164, 75, 240, 208, 10, 185, 187, 163]), - Bytes32::new_direct([214, 1, 209, 99, 53, 101, 233, 225, 55, 171, 69, 200, 44, 144, 169, 11, 65, 85, 84, 158, 233, 227, 37, 59, 42, 52, 153, 13, 0, 158, 122, 208]), - Bytes32::new_direct([124, 146, 1, 221, 33, 138, 233, 130, 184, 163, 121, 110, 95, 242, 123, 251, 110, 46, 41, 197, 75, 145, 121, 95, 29, 1, 19, 19, 167, 220, 177, 153]), - Bytes32::new_direct([77, 38, 54, 170, 19, 128, 180, 248, 208, 75, 27, 53, 228, 104, 7, 216, 188, 186, 40, 84, 87, 11, 121, 3, 175, 89, 49, 46, 191, 94, 80, 97]), - Bytes32::new_direct([134, 127, 37, 206, 212, 70, 146, 143, 81, 104, 140, 28, 135, 233, 171, 88, 18, 2, 148, 143, 111, 208, 149, 138, 167, 84, 183, 100, 67, 181, 243, 135]), - Bytes32::new_direct([218, 16, 220, 189, 192, 237, 252, 168, 45, 33, 177, 81, 53, 115, 141, 190, 99, 138, 113, 85, 60, 230, 244, 222, 205, 16, 152, 26, 185, 207, 114, 143]), - Bytes32::new_direct([9, 85, 193, 163, 186, 152, 83, 149, 29, 71, 50, 13, 175, 149, 184, 51, 246, 97, 20, 22, 57, 201, 27, 72, 146, 19, 213, 102, 164, 148, 176, 45]), - Bytes32::new_direct([140, 94, 218, 31, 232, 0, 167, 218, 122, 119, 62, 179, 181, 51, 100, 6, 150, 159, 212, 207, 160, 94, 212, 108, 225, 196, 190, 210, 145, 110, 120, 114]), - Bytes32::new_direct([152, 169, 229, 240, 162, 212, 61, 59, 167, 135, 124, 147, 212, 248, 177, 85, 243, 72, 150, 127, 122, 60, 143, 125, 226, 186, 67, 219, 50, 112, 242, 212]), - Bytes32::new_direct([47, 244, 81, 140, 243, 189, 116, 0, 2, 158, 242, 188, 215, 90, 177, 37, 175, 221, 80, 226, 209, 79, 2, 62, 112, 245, 1, 132, 7, 78, 0, 117]), - Bytes32::new_direct([247, 236, 252, 118, 6, 245, 132, 187, 48, 36, 77, 0, 167, 150, 109, 72, 234, 9, 224, 162, 223, 191, 21, 19, 180, 201, 138, 56, 109, 97, 152, 170]), - Bytes32::new_direct([77, 23, 112, 52, 78, 204, 135, 173, 2, 206, 148, 200, 60, 155, 60, 179, 201, 111, 73, 138, 76, 104, 79, 174, 190, 173, 42, 51, 38, 48, 237, 241]), - Bytes32::new_direct([117, 234, 73, 183, 4, 144, 12, 196, 78, 228, 178, 218, 206, 147, 147, 94, 190, 22, 22, 233, 88, 118, 135, 55, 63, 29, 212, 38, 223, 160, 121, 230]), - Bytes32::new_direct([74, 138, 173, 10, 77, 129, 10, 115, 18, 90, 57, 215, 221, 171, 109, 152, 31, 219, 235, 122, 189, 201, 210, 186, 52, 200, 81, 218, 112, 79, 80, 54]), - Bytes32::new_direct([189, 150, 224, 30, 110, 73, 249, 62, 100, 244, 206, 110, 206, 239, 233, 213, 61, 213, 65, 139, 103, 19, 20, 123, 167, 65, 161, 165, 216, 217, 255, 248]), - Bytes32::new_direct([119, 71, 56, 219, 155, 139, 253, 40, 100, 132, 185, 98, 24, 34, 156, 225, 120, 176, 76, 147, 31, 105, 245, 216, 165, 161, 89, 157, 246, 17, 251, 234]), - Bytes32::new_direct([192, 39, 162, 126, 222, 211, 173, 195, 198, 124, 1, 124, 140, 2, 252, 191, 185, 85, 10, 125, 226, 7, 88, 221, 164, 13, 221, 74, 200, 7, 249, 177]), - Bytes32::new_direct([251, 226, 24, 5, 54, 89, 9, 93, 217, 202, 148, 172, 208, 197, 65, 172, 98, 96, 58, 194, 61, 253, 157, 193, 135, 32, 206, 97, 133, 234, 199, 197]), - Bytes32::new_direct([130, 3, 195, 156, 210, 123, 23, 44, 223, 25, 153, 169, 250, 88, 127, 239, 206, 196, 156, 143, 182, 185, 35, 77, 162, 48, 143, 64, 231, 129, 216, 185]), - Bytes32::new_direct([123, 201, 97, 230, 121, 13, 207, 138, 137, 3, 122, 92, 105, 155, 214, 204, 142, 18, 119, 138, 135, 165, 249, 58, 184, 53, 27, 31, 109, 214, 176, 147]), - Bytes32::new_direct([46, 71, 246, 155, 247, 109, 236, 225, 147, 51, 250, 72, 97, 116, 162, 36, 115, 164, 80, 28, 252, 238, 98, 92, 16, 66, 190, 208, 180, 39, 179, 211]), - Bytes32::new_direct([38, 76, 13, 227, 149, 18, 84, 170, 83, 231, 122, 59, 237, 66, 32, 171, 158, 251, 78, 156, 186, 160, 29, 30, 207, 178, 16, 193, 221, 158, 49, 48]), - Bytes32::new_direct([166, 13, 210, 208, 250, 131, 27, 163, 99, 204, 199, 134, 152, 131, 28, 164, 8, 222, 176, 200, 34, 40, 74, 188, 120, 46, 167, 44, 95, 199, 86, 225]), + Bytes32::new_direct([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ]), + Bytes32::new_direct([ + 66, 208, 130, 169, 194, 116, 5, 27, 68, 75, 235, 175, 164, 169, 41, 91, 88, 134, 51, 194, + 219, 201, 182, 199, 1, 52, 173, 215, 20, 37, 51, 0, + ]), + Bytes32::new_direct([ + 90, 210, 50, 227, 58, 173, 147, 92, 139, 15, 127, 190, 196, 111, 142, 207, 31, 223, 70, 96, + 17, 251, 164, 200, 133, 0, 76, 35, 200, 9, 51, 218, + ]), + Bytes32::new_direct([ + 97, 5, 162, 226, 92, 108, 172, 8, 7, 65, 104, 176, 216, 3, 144, 47, 14, 88, 50, 101, 194, + 94, 10, 132, 192, 76, 37, 152, 42, 73, 30, 2, + ]), + Bytes32::new_direct([ + 68, 59, 208, 14, 89, 37, 33, 1, 177, 225, 235, 66, 129, 28, 103, 156, 46, 206, 94, 141, 33, + 152, 141, 26, 209, 161, 53, 237, 198, 163, 115, 57, + ]), + Bytes32::new_direct([ + 28, 94, 12, 53, 70, 163, 95, 44, 168, 42, 196, 126, 181, 231, 174, 247, 89, 100, 77, 238, + 211, 74, 116, 144, 183, 111, 254, 75, 30, 187, 228, 222, + ]), + Bytes32::new_direct([ + 238, 133, 50, 189, 14, 89, 244, 88, 239, 50, 172, 85, 172, 1, 131, 2, 24, 161, 70, 94, 0, + 204, 50, 199, 48, 107, 30, 70, 6, 8, 18, 90, + ]), + Bytes32::new_direct([ + 165, 239, 71, 173, 192, 165, 25, 35, 4, 130, 148, 158, 177, 193, 129, 45, 115, 209, 7, 233, + 136, 108, 245, 126, 74, 200, 22, 204, 190, 137, 191, 105, + ]), + Bytes32::new_direct([ + 173, 102, 127, 73, 167, 249, 117, 26, 190, 231, 26, 60, 201, 138, 160, 182, 180, 44, 34, + 132, 171, 254, 91, 8, 167, 114, 188, 157, 181, 148, 169, 165, + ]), + Bytes32::new_direct([ + 71, 62, 70, 89, 203, 1, 105, 187, 178, 167, 217, 118, 42, 217, 154, 234, 238, 109, 145, + 231, 247, 199, 40, 110, 162, 11, 173, 144, 103, 110, 99, 101, + ]), + Bytes32::new_direct([ + 121, 36, 94, 4, 25, 134, 16, 98, 198, 109, 123, 42, 56, 151, 224, 7, 232, 155, 231, 154, + 229, 162, 250, 149, 231, 198, 0, 65, 17, 27, 181, 28, + ]), + Bytes32::new_direct([ + 247, 158, 162, 102, 242, 117, 166, 252, 175, 158, 107, 157, 244, 44, 17, 99, 93, 52, 43, + 136, 5, 211, 32, 152, 91, 148, 41, 32, 231, 18, 237, 208, + ]), + Bytes32::new_direct([ + 147, 52, 155, 255, 81, 242, 75, 54, 54, 66, 166, 41, 131, 177, 183, 151, 229, 177, 232, 86, + 146, 137, 106, 68, 226, 117, 20, 210, 224, 170, 249, 68, + ]), + Bytes32::new_direct([ + 160, 89, 180, 156, 119, 172, 38, 10, 97, 101, 64, 56, 98, 133, 199, 228, 58, 66, 139, 128, + 88, 140, 143, 85, 148, 167, 79, 75, 34, 45, 204, 68, + ]), + Bytes32::new_direct([ + 165, 233, 117, 3, 27, 56, 166, 16, 56, 132, 198, 32, 11, 149, 212, 98, 64, 236, 180, 106, + 174, 80, 122, 220, 102, 67, 67, 110, 67, 8, 48, 217, + ]), + Bytes32::new_direct([ + 113, 74, 209, 139, 250, 181, 182, 127, 178, 77, 17, 63, 79, 109, 145, 74, 52, 102, 125, + 154, 22, 241, 177, 177, 34, 189, 124, 22, 4, 200, 201, 76, + ]), + Bytes32::new_direct([ + 67, 7, 240, 151, 128, 149, 238, 113, 130, 127, 174, 223, 142, 124, 230, 10, 91, 89, 113, + 157, 230, 21, 213, 3, 146, 249, 26, 80, 239, 90, 4, 216, + ]), + Bytes32::new_direct([ + 152, 20, 80, 244, 232, 182, 1, 145, 31, 191, 46, 207, 83, 199, 209, 104, 0, 75, 106, 230, + 16, 98, 121, 127, 175, 78, 119, 154, 69, 55, 66, 169, + ]), + Bytes32::new_direct([ + 123, 50, 162, 158, 51, 112, 129, 232, 242, 158, 150, 72, 244, 40, 191, 63, 205, 61, 144, + 39, 65, 122, 28, 88, 253, 146, 29, 29, 15, 40, 122, 95, + ]), + Bytes32::new_direct([ + 231, 253, 202, 45, 165, 158, 212, 29, 104, 165, 209, 179, 188, 154, 89, 18, 216, 23, 140, + 66, 150, 49, 99, 200, 163, 155, 50, 9, 250, 22, 19, 203, + ]), + Bytes32::new_direct([ + 127, 172, 110, 243, 156, 134, 199, 15, 248, 216, 12, 196, 221, 66, 202, 186, 105, 197, 43, + 245, 46, 116, 251, 133, 111, 118, 56, 214, 157, 244, 187, 58, + ]), + Bytes32::new_direct([ + 181, 181, 163, 95, 7, 188, 245, 128, 161, 210, 137, 217, 103, 101, 120, 255, 47, 83, 102, + 68, 238, 195, 206, 105, 24, 150, 216, 50, 74, 6, 94, 95, + ]), + Bytes32::new_direct([ + 171, 250, 198, 40, 153, 26, 240, 152, 96, 169, 15, 123, 33, 155, 57, 172, 89, 205, 9, 65, + 45, 126, 155, 143, 224, 145, 25, 214, 19, 227, 213, 195, + ]), + Bytes32::new_direct([ + 44, 177, 244, 220, 119, 33, 203, 59, 209, 72, 28, 4, 210, 54, 86, 20, 119, 41, 45, 231, + 143, 104, 57, 206, 212, 222, 81, 62, 92, 221, 200, 32, + ]), + Bytes32::new_direct([ + 37, 200, 165, 195, 67, 224, 131, 227, 97, 54, 21, 233, 76, 186, 6, 122, 178, 131, 252, 59, + 97, 218, 239, 62, 124, 255, 201, 178, 241, 236, 4, 214, + ]), + Bytes32::new_direct([ + 77, 171, 229, 183, 46, 112, 203, 177, 89, 90, 64, 114, 109, 220, 32, 120, 41, 223, 72, 86, + 59, 211, 110, 17, 129, 112, 194, 186, 200, 92, 144, 49, + ]), + Bytes32::new_direct([ + 2, 198, 61, 112, 181, 185, 194, 114, 149, 63, 65, 76, 55, 179, 170, 62, 91, 112, 189, 100, + 13, 34, 98, 187, 85, 132, 202, 86, 47, 27, 236, 200, + ]), + Bytes32::new_direct([ + 164, 238, 109, 209, 155, 118, 236, 237, 84, 43, 56, 99, 51, 60, 116, 235, 100, 39, 163, + 105, 34, 93, 8, 187, 228, 213, 35, 200, 43, 8, 32, 68, + ]), + Bytes32::new_direct([ + 32, 220, 39, 200, 214, 245, 102, 200, 167, 204, 3, 54, 140, 126, 129, 35, 139, 60, 112, + 133, 52, 166, 162, 63, 119, 20, 2, 116, 132, 244, 246, 225, + ]), + Bytes32::new_direct([ + 5, 54, 145, 188, 188, 251, 36, 4, 103, 140, 229, 143, 83, 11, 77, 207, 57, 125, 51, 127, + 89, 130, 138, 193, 190, 17, 17, 23, 68, 168, 231, 106, + ]), + Bytes32::new_direct([ + 239, 112, 72, 74, 116, 134, 210, 24, 226, 242, 91, 113, 99, 59, 19, 7, 226, 215, 254, 220, + 14, 225, 75, 245, 11, 234, 138, 52, 195, 86, 79, 124, + ]), + Bytes32::new_direct([ + 187, 35, 132, 188, 162, 128, 96, 71, 124, 213, 251, 229, 73, 52, 187, 22, 166, 35, 214, 14, + 121, 189, 37, 5, 77, 54, 201, 51, 95, 179, 75, 229, + ]), + Bytes32::new_direct([ + 5, 54, 88, 42, 68, 200, 45, 209, 121, 70, 128, 8, 178, 212, 197, 39, 101, 90, 101, 111, 77, + 133, 13, 77, 19, 111, 113, 122, 222, 85, 180, 82, + ]), + Bytes32::new_direct([ + 34, 182, 144, 13, 35, 35, 79, 14, 239, 80, 21, 255, 67, 48, 210, 174, 159, 182, 239, 236, + 68, 46, 125, 105, 243, 202, 218, 64, 53, 94, 159, 253, + ]), + Bytes32::new_direct([ + 224, 189, 145, 186, 43, 169, 131, 161, 223, 161, 72, 72, 229, 97, 113, 233, 2, 250, 109, + 31, 19, 125, 57, 135, 144, 3, 187, 18, 102, 108, 232, 9, + ]), + Bytes32::new_direct([ + 68, 94, 11, 104, 95, 110, 179, 226, 157, 245, 113, 68, 44, 122, 17, 22, 244, 35, 248, 126, + 131, 192, 20, 169, 129, 236, 60, 54, 157, 30, 231, 36, + ]), + Bytes32::new_direct([ + 101, 198, 107, 156, 226, 8, 67, 168, 197, 91, 189, 166, 187, 16, 121, 93, 114, 243, 137, + 162, 125, 142, 50, 206, 160, 168, 165, 27, 207, 10, 22, 19, + ]), + Bytes32::new_direct([ + 222, 29, 134, 137, 98, 73, 58, 143, 166, 134, 210, 47, 68, 23, 214, 237, 241, 207, 226, 83, + 113, 222, 184, 139, 16, 1, 200, 56, 34, 208, 197, 152, + ]), + Bytes32::new_direct([ + 107, 200, 189, 222, 185, 32, 192, 130, 237, 238, 168, 137, 14, 94, 3, 26, 41, 238, 19, 119, + 207, 158, 25, 177, 116, 70, 170, 161, 141, 129, 16, 88, + ]), + Bytes32::new_direct([ + 131, 243, 131, 161, 236, 101, 108, 81, 59, 123, 150, 6, 250, 124, 103, 101, 75, 234, 98, + 223, 129, 87, 202, 59, 184, 173, 44, 191, 200, 30, 223, 66, + ]), + Bytes32::new_direct([ + 17, 226, 72, 31, 180, 33, 229, 83, 154, 39, 104, 45, 93, 117, 153, 249, 216, 127, 120, 182, + 4, 19, 169, 87, 127, 70, 7, 237, 80, 251, 220, 126, + ]), + Bytes32::new_direct([ + 88, 122, 134, 181, 173, 175, 100, 74, 28, 141, 45, 215, 245, 170, 222, 54, 106, 118, 146, + 59, 207, 251, 133, 155, 164, 75, 240, 208, 10, 185, 187, 163, + ]), + Bytes32::new_direct([ + 214, 1, 209, 99, 53, 101, 233, 225, 55, 171, 69, 200, 44, 144, 169, 11, 65, 85, 84, 158, + 233, 227, 37, 59, 42, 52, 153, 13, 0, 158, 122, 208, + ]), + Bytes32::new_direct([ + 124, 146, 1, 221, 33, 138, 233, 130, 184, 163, 121, 110, 95, 242, 123, 251, 110, 46, 41, + 197, 75, 145, 121, 95, 29, 1, 19, 19, 167, 220, 177, 153, + ]), + Bytes32::new_direct([ + 77, 38, 54, 170, 19, 128, 180, 248, 208, 75, 27, 53, 228, 104, 7, 216, 188, 186, 40, 84, + 87, 11, 121, 3, 175, 89, 49, 46, 191, 94, 80, 97, + ]), + Bytes32::new_direct([ + 134, 127, 37, 206, 212, 70, 146, 143, 81, 104, 140, 28, 135, 233, 171, 88, 18, 2, 148, 143, + 111, 208, 149, 138, 167, 84, 183, 100, 67, 181, 243, 135, + ]), + Bytes32::new_direct([ + 218, 16, 220, 189, 192, 237, 252, 168, 45, 33, 177, 81, 53, 115, 141, 190, 99, 138, 113, + 85, 60, 230, 244, 222, 205, 16, 152, 26, 185, 207, 114, 143, + ]), + Bytes32::new_direct([ + 9, 85, 193, 163, 186, 152, 83, 149, 29, 71, 50, 13, 175, 149, 184, 51, 246, 97, 20, 22, 57, + 201, 27, 72, 146, 19, 213, 102, 164, 148, 176, 45, + ]), + Bytes32::new_direct([ + 140, 94, 218, 31, 232, 0, 167, 218, 122, 119, 62, 179, 181, 51, 100, 6, 150, 159, 212, 207, + 160, 94, 212, 108, 225, 196, 190, 210, 145, 110, 120, 114, + ]), + Bytes32::new_direct([ + 152, 169, 229, 240, 162, 212, 61, 59, 167, 135, 124, 147, 212, 248, 177, 85, 243, 72, 150, + 127, 122, 60, 143, 125, 226, 186, 67, 219, 50, 112, 242, 212, + ]), + Bytes32::new_direct([ + 47, 244, 81, 140, 243, 189, 116, 0, 2, 158, 242, 188, 215, 90, 177, 37, 175, 221, 80, 226, + 209, 79, 2, 62, 112, 245, 1, 132, 7, 78, 0, 117, + ]), + Bytes32::new_direct([ + 247, 236, 252, 118, 6, 245, 132, 187, 48, 36, 77, 0, 167, 150, 109, 72, 234, 9, 224, 162, + 223, 191, 21, 19, 180, 201, 138, 56, 109, 97, 152, 170, + ]), + Bytes32::new_direct([ + 77, 23, 112, 52, 78, 204, 135, 173, 2, 206, 148, 200, 60, 155, 60, 179, 201, 111, 73, 138, + 76, 104, 79, 174, 190, 173, 42, 51, 38, 48, 237, 241, + ]), + Bytes32::new_direct([ + 117, 234, 73, 183, 4, 144, 12, 196, 78, 228, 178, 218, 206, 147, 147, 94, 190, 22, 22, 233, + 88, 118, 135, 55, 63, 29, 212, 38, 223, 160, 121, 230, + ]), + Bytes32::new_direct([ + 74, 138, 173, 10, 77, 129, 10, 115, 18, 90, 57, 215, 221, 171, 109, 152, 31, 219, 235, 122, + 189, 201, 210, 186, 52, 200, 81, 218, 112, 79, 80, 54, + ]), + Bytes32::new_direct([ + 189, 150, 224, 30, 110, 73, 249, 62, 100, 244, 206, 110, 206, 239, 233, 213, 61, 213, 65, + 139, 103, 19, 20, 123, 167, 65, 161, 165, 216, 217, 255, 248, + ]), + Bytes32::new_direct([ + 119, 71, 56, 219, 155, 139, 253, 40, 100, 132, 185, 98, 24, 34, 156, 225, 120, 176, 76, + 147, 31, 105, 245, 216, 165, 161, 89, 157, 246, 17, 251, 234, + ]), + Bytes32::new_direct([ + 192, 39, 162, 126, 222, 211, 173, 195, 198, 124, 1, 124, 140, 2, 252, 191, 185, 85, 10, + 125, 226, 7, 88, 221, 164, 13, 221, 74, 200, 7, 249, 177, + ]), + Bytes32::new_direct([ + 251, 226, 24, 5, 54, 89, 9, 93, 217, 202, 148, 172, 208, 197, 65, 172, 98, 96, 58, 194, 61, + 253, 157, 193, 135, 32, 206, 97, 133, 234, 199, 197, + ]), + Bytes32::new_direct([ + 130, 3, 195, 156, 210, 123, 23, 44, 223, 25, 153, 169, 250, 88, 127, 239, 206, 196, 156, + 143, 182, 185, 35, 77, 162, 48, 143, 64, 231, 129, 216, 185, + ]), + Bytes32::new_direct([ + 123, 201, 97, 230, 121, 13, 207, 138, 137, 3, 122, 92, 105, 155, 214, 204, 142, 18, 119, + 138, 135, 165, 249, 58, 184, 53, 27, 31, 109, 214, 176, 147, + ]), + Bytes32::new_direct([ + 46, 71, 246, 155, 247, 109, 236, 225, 147, 51, 250, 72, 97, 116, 162, 36, 115, 164, 80, 28, + 252, 238, 98, 92, 16, 66, 190, 208, 180, 39, 179, 211, + ]), + Bytes32::new_direct([ + 38, 76, 13, 227, 149, 18, 84, 170, 83, 231, 122, 59, 237, 66, 32, 171, 158, 251, 78, 156, + 186, 160, 29, 30, 207, 178, 16, 193, 221, 158, 49, 48, + ]), + Bytes32::new_direct([ + 166, 13, 210, 208, 250, 131, 27, 163, 99, 204, 199, 134, 152, 131, 28, 164, 8, 222, 176, + 200, 34, 40, 74, 188, 120, 46, 167, 44, 95, 199, 86, 225, + ]), ]; const TABLE_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::new_direct([164, 47, 121, 69, 150, 44, 30, 204, 210, 181, 242, 154, 59, 111, 5, 10, 47, 121, 213, 80, 163, 196, 205, 188, 241, 64, 202, 26, 242, 47, 50, 205]), - Bytes32::new_direct([166, 9, 224, 145, 14, 138, 194, 78, 202, 114, 110, 38, 244, 33, 189, 185, 170, 85, 144, 229, 123, 63, 229, 194, 59, 130, 156, 6, 184, 154, 187, 17]), - Bytes32::new_direct([32, 51, 186, 232, 39, 244, 218, 98, 243, 254, 82, 247, 63, 120, 34, 123, 128, 240, 220, 145, 41, 114, 251, 208, 209, 244, 10, 9, 179, 5, 105, 181]), - Bytes32::new_direct([73, 148, 74, 132, 241, 45, 129, 169, 83, 223, 101, 12, 184, 60, 10, 201, 169, 197, 75, 17, 198, 168, 79, 171, 207, 195, 123, 47, 249, 30, 176, 216]), - Bytes32::new_direct([145, 224, 51, 196, 211, 137, 189, 133, 232, 210, 170, 157, 227, 160, 218, 143, 15, 82, 170, 226, 241, 83, 7, 112, 138, 227, 58, 59, 149, 168, 81, 94]), - Bytes32::new_direct([241, 90, 42, 7, 231, 63, 36, 86, 238, 131, 19, 20, 38, 118, 65, 180, 109, 121, 147, 147, 213, 142, 203, 244, 239, 75, 5, 160, 16, 85, 221, 95]), - Bytes32::new_direct([213, 113, 178, 221, 213, 107, 77, 153, 222, 48, 148, 140, 250, 1, 17, 59, 73, 19, 110, 106, 94, 195, 126, 49, 126, 109, 65, 55, 104, 111, 18, 171]), - Bytes32::new_direct([43, 198, 12, 197, 95, 201, 76, 108, 96, 235, 76, 8, 117, 99, 42, 20, 177, 45, 112, 40, 2, 180, 68, 19, 25, 11, 210, 168, 170, 178, 99, 27]), - Bytes32::new_direct([142, 205, 24, 125, 81, 234, 138, 161, 206, 121, 163, 225, 50, 9, 180, 102, 0, 25, 93, 180, 137, 164, 206, 249, 222, 20, 175, 177, 199, 14, 115, 207]), - Bytes32::new_direct([213, 41, 249, 19, 173, 165, 236, 103, 42, 146, 223, 6, 190, 229, 161, 13, 96, 163, 110, 23, 203, 238, 24, 95, 130, 203, 35, 211, 63, 234, 32, 137]), - Bytes32::new_direct([176, 82, 229, 48, 113, 46, 179, 38, 231, 83, 50, 136, 179, 190, 242, 126, 152, 210, 141, 102, 191, 21, 20, 96, 235, 245, 81, 254, 231, 117, 159, 146]), - Bytes32::new_direct([216, 15, 120, 147, 70, 215, 12, 160, 223, 73, 246, 73, 195, 189, 200, 3, 19, 131, 102, 61, 173, 79, 50, 76, 39, 150, 151, 147, 35, 251, 200, 0]), - Bytes32::new_direct([88, 215, 168, 30, 218, 72, 206, 159, 91, 121, 14, 133, 241, 220, 195, 46, 93, 244, 179, 53, 158, 75, 211, 161, 8, 120, 167, 141, 235, 16, 232, 42]), - Bytes32::new_direct([114, 99, 218, 52, 203, 162, 199, 16, 225, 154, 182, 20, 59, 121, 250, 249, 166, 35, 118, 18, 142, 57, 122, 131, 32, 219, 83, 126, 147, 91, 116, 16]), - Bytes32::new_direct([193, 157, 15, 251, 179, 155, 215, 190, 98, 93, 30, 167, 23, 175, 178, 172, 142, 143, 222, 20, 18, 157, 215, 42, 105, 107, 64, 16, 216, 143, 109, 45]), - Bytes32::new_direct([178, 2, 203, 32, 83, 90, 114, 97, 124, 210, 81, 81, 179, 213, 71, 19, 181, 173, 227, 88, 226, 83, 48, 169, 134, 163, 62, 103, 222, 82, 128, 30]), - Bytes32::new_direct([252, 17, 142, 50, 185, 19, 111, 148, 204, 30, 199, 138, 143, 207, 30, 212, 254, 7, 129, 43, 100, 167, 52, 115, 247, 143, 64, 106, 220, 5, 7, 89]), - Bytes32::new_direct([117, 136, 111, 98, 95, 97, 253, 43, 82, 22, 43, 187, 65, 154, 132, 105, 55, 194, 240, 148, 170, 199, 185, 91, 157, 138, 43, 117, 218, 176, 110, 101]), - Bytes32::new_direct([228, 56, 186, 202, 73, 47, 253, 151, 48, 173, 2, 101, 153, 197, 108, 145, 227, 170, 247, 86, 80, 70, 30, 93, 232, 148, 63, 211, 197, 135, 23, 97]), - Bytes32::new_direct([162, 35, 93, 45, 208, 241, 87, 57, 138, 79, 231, 83, 75, 81, 102, 91, 115, 58, 1, 205, 193, 197, 62, 210, 144, 88, 59, 52, 149, 234, 121, 224]), - Bytes32::new_direct([165, 67, 16, 239, 234, 92, 207, 81, 64, 93, 227, 154, 132, 33, 54, 53, 102, 198, 90, 134, 24, 29, 190, 158, 121, 23, 127, 30, 27, 239, 140, 88]), - Bytes32::new_direct([61, 125, 183, 139, 186, 82, 193, 166, 2, 147, 231, 215, 179, 107, 163, 67, 122, 0, 90, 188, 142, 216, 72, 20, 63, 146, 85, 89, 231, 41, 153, 117]), - Bytes32::new_direct([206, 31, 38, 182, 78, 170, 183, 207, 211, 114, 212, 4, 108, 84, 62, 99, 245, 196, 10, 1, 188, 63, 240, 199, 27, 85, 68, 101, 212, 222, 85, 12]), - Bytes32::new_direct([106, 0, 225, 130, 195, 87, 113, 106, 101, 80, 56, 119, 93, 45, 74, 168, 240, 209, 155, 123, 8, 129, 73, 225, 204, 125, 42, 73, 102, 122, 228, 158]), - Bytes32::new_direct([251, 63, 88, 92, 59, 176, 71, 194, 46, 19, 18, 27, 83, 57, 197, 231, 202, 242, 155, 63, 252, 240, 205, 216, 96, 130, 161, 197, 123, 110, 175, 220]), - Bytes32::new_direct([239, 6, 249, 150, 189, 234, 197, 18, 79, 222, 80, 72, 205, 147, 251, 135, 226, 33, 46, 111, 186, 185, 4, 33, 219, 129, 30, 182, 57, 229, 34, 16]), - Bytes32::new_direct([192, 35, 149, 149, 16, 111, 3, 119, 173, 215, 223, 247, 70, 25, 31, 107, 104, 5, 249, 243, 193, 66, 99, 48, 107, 158, 25, 147, 163, 151, 96, 149]), - Bytes32::new_direct([197, 133, 241, 197, 67, 52, 255, 227, 180, 235, 137, 164, 174, 160, 183, 9, 159, 254, 210, 180, 231, 140, 176, 165, 113, 215, 182, 1, 177, 204, 219, 246]), - Bytes32::new_direct([51, 32, 109, 173, 131, 6, 99, 63, 75, 191, 207, 187, 73, 26, 5, 139, 167, 216, 123, 26, 199, 176, 84, 215, 158, 243, 105, 0, 91, 254, 59, 146]), - Bytes32::new_direct([229, 120, 15, 22, 225, 50, 131, 240, 190, 232, 83, 119, 169, 246, 172, 35, 99, 163, 58, 146, 234, 253, 252, 83, 5, 48, 54, 142, 172, 91, 145, 13]), - Bytes32::new_direct([159, 9, 100, 20, 215, 92, 217, 43, 208, 254, 65, 234, 124, 167, 250, 53, 159, 151, 124, 70, 26, 0, 113, 28, 78, 44, 238, 8, 34, 255, 19, 36]), - Bytes32::new_direct([193, 135, 44, 144, 13, 46, 76, 43, 127, 208, 79, 196, 229, 58, 125, 33, 71, 118, 215, 240, 80, 123, 44, 181, 174, 47, 102, 42, 137, 98, 190, 41]), - Bytes32::new_direct([78, 19, 3, 217, 174, 154, 142, 109, 189, 14, 241, 12, 23, 185, 224, 152, 209, 108, 223, 202, 191, 11, 190, 149, 31, 236, 104, 234, 22, 38, 196, 3]), - Bytes32::new_direct([60, 93, 237, 228, 186, 222, 179, 231, 151, 95, 147, 20, 188, 10, 191, 34, 126, 57, 253, 161, 154, 117, 182, 108, 143, 72, 48, 102, 191, 240, 81, 208]), - Bytes32::new_direct([179, 114, 163, 89, 172, 211, 154, 204, 11, 125, 140, 186, 107, 90, 17, 116, 214, 31, 165, 94, 36, 187, 184, 151, 210, 208, 76, 215, 75, 166, 107, 91]), - Bytes32::new_direct([125, 131, 52, 139, 120, 156, 163, 243, 206, 143, 204, 221, 123, 140, 1, 103, 235, 186, 64, 82, 194, 191, 205, 2, 32, 242, 38, 77, 184, 23, 236, 228]), - Bytes32::new_direct([137, 224, 90, 1, 116, 95, 215, 47, 8, 3, 227, 132, 154, 232, 216, 63, 3, 80, 52, 18, 42, 29, 85, 38, 117, 255, 9, 99, 88, 233, 129, 92]), - Bytes32::new_direct([54, 182, 145, 174, 54, 24, 168, 13, 71, 43, 178, 49, 153, 246, 94, 79, 228, 254, 134, 0, 21, 210, 176, 242, 82, 117, 76, 40, 221, 181, 30, 62]), - Bytes32::new_direct([145, 171, 156, 87, 15, 174, 31, 111, 175, 161, 31, 116, 123, 123, 37, 216, 43, 147, 197, 79, 218, 49, 236, 111, 35, 49, 44, 188, 197, 79, 136, 45]), - Bytes32::new_direct([169, 48, 186, 93, 10, 48, 80, 103, 68, 226, 103, 31, 176, 154, 146, 199, 166, 89, 48, 149, 116, 101, 157, 149, 149, 72, 123, 54, 153, 26, 210, 122]), - Bytes32::new_direct([225, 45, 163, 167, 213, 84, 40, 87, 106, 253, 206, 80, 189, 71, 153, 5, 15, 107, 151, 150, 14, 22, 143, 207, 4, 192, 63, 250, 207, 207, 179, 26]), - Bytes32::new_direct([110, 249, 172, 218, 206, 202, 107, 64, 48, 153, 226, 127, 165, 227, 50, 146, 140, 239, 220, 252, 188, 157, 77, 210, 92, 73, 38, 6, 16, 87, 244, 66]), - Bytes32::new_direct([39, 217, 230, 91, 60, 231, 96, 137, 37, 58, 93, 51, 79, 222, 132, 171, 196, 109, 155, 4, 252, 213, 17, 33, 160, 24, 250, 118, 187, 62, 107, 113]), - Bytes32::new_direct([120, 167, 145, 121, 184, 31, 185, 178, 241, 54, 20, 48, 132, 89, 132, 127, 235, 189, 197, 127, 249, 58, 255, 197, 40, 229, 130, 254, 213, 186, 114, 74]), - Bytes32::new_direct([7, 40, 187, 172, 225, 196, 3, 77, 113, 16, 118, 148, 95, 65, 42, 234, 233, 29, 120, 223, 105, 77, 250, 119, 245, 20, 21, 155, 177, 13, 56, 151]), - Bytes32::new_direct([22, 248, 25, 75, 36, 179, 251, 57, 101, 170, 213, 19, 216, 64, 164, 253, 151, 199, 88, 5, 92, 129, 138, 185, 9, 236, 231, 68, 112, 24, 218, 216]), - Bytes32::new_direct([95, 141, 49, 39, 213, 214, 130, 49, 143, 124, 178, 114, 200, 136, 160, 90, 233, 73, 233, 185, 60, 250, 174, 74, 2, 123, 2, 62, 192, 174, 115, 158]), - Bytes32::new_direct([142, 29, 212, 35, 71, 107, 91, 164, 226, 225, 180, 218, 99, 34, 200, 171, 33, 235, 113, 105, 191, 78, 105, 70, 221, 135, 167, 148, 24, 225, 6, 146]), - Bytes32::new_direct([176, 194, 115, 243, 138, 104, 3, 247, 184, 74, 81, 60, 173, 45, 29, 189, 252, 202, 206, 66, 129, 65, 150, 25, 246, 145, 133, 4, 93, 201, 201, 240]), - Bytes32::new_direct([18, 233, 186, 158, 43, 12, 206, 228, 80, 102, 187, 25, 78, 77, 180, 28, 82, 62, 168, 252, 14, 113, 126, 91, 243, 120, 213, 91, 189, 244, 247, 177]), - Bytes32::new_direct([79, 126, 97, 23, 112, 98, 93, 86, 24, 103, 82, 33, 155, 188, 202, 61, 29, 146, 132, 169, 116, 207, 216, 35, 29, 229, 213, 120, 135, 240, 129, 205]), - Bytes32::new_direct([146, 121, 255, 202, 145, 53, 46, 8, 102, 205, 56, 234, 49, 42, 85, 231, 217, 114, 235, 141, 233, 187, 29, 9, 122, 232, 61, 253, 42, 104, 4, 113]), - Bytes32::new_direct([103, 174, 255, 6, 115, 155, 156, 65, 84, 251, 208, 55, 89, 124, 171, 167, 133, 227, 22, 134, 32, 71, 243, 181, 16, 100, 81, 63, 22, 207, 58, 190]), - Bytes32::new_direct([69, 10, 247, 243, 56, 0, 64, 72, 218, 21, 211, 192, 62, 243, 66, 244, 230, 58, 107, 54, 180, 29, 216, 23, 86, 211, 173, 181, 118, 188, 238, 72]), - Bytes32::new_direct([25, 179, 4, 93, 169, 76, 76, 69, 158, 3, 24, 146, 130, 9, 225, 198, 102, 238, 29, 73, 74, 179, 159, 74, 40, 111, 181, 110, 76, 173, 251, 255]), - Bytes32::new_direct([236, 113, 37, 202, 149, 150, 90, 50, 233, 141, 125, 12, 212, 163, 137, 176, 15, 214, 194, 73, 138, 104, 4, 33, 235, 76, 185, 58, 125, 182, 56, 0]), - Bytes32::new_direct([238, 54, 183, 94, 50, 33, 98, 31, 133, 181, 230, 98, 43, 154, 95, 111, 250, 71, 15, 197, 156, 60, 8, 90, 208, 50, 62, 127, 30, 18, 181, 176]), - Bytes32::new_direct([246, 143, 72, 228, 143, 15, 15, 131, 178, 105, 113, 46, 85, 36, 165, 116, 63, 131, 61, 228, 98, 144, 232, 209, 228, 110, 168, 171, 252, 47, 79, 165]), - Bytes32::new_direct([146, 70, 74, 79, 139, 107, 73, 28, 231, 88, 235, 214, 163, 185, 87, 195, 147, 186, 153, 222, 191, 214, 30, 231, 173, 166, 151, 169, 244, 15, 15, 227]), - Bytes32::new_direct([137, 182, 175, 97, 212, 23, 62, 70, 50, 150, 67, 153, 253, 52, 179, 105, 147, 177, 217, 170, 125, 251, 1, 96, 4, 127, 196, 37, 254, 7, 217, 100]), - Bytes32::new_direct([32, 253, 229, 209, 120, 43, 120, 189, 245, 227, 178, 79, 134, 175, 240, 107, 25, 124, 5, 67, 120, 213, 187, 200, 159, 9, 26, 119, 13, 1, 8, 120]), - Bytes32::new_direct([115, 241, 26, 44, 83, 229, 130, 21, 249, 87, 72, 212, 75, 220, 95, 22, 151, 77, 182, 8, 196, 207, 95, 18, 9, 92, 89, 206, 114, 80, 36, 159]), - Bytes32::new_direct([174, 151, 88, 171, 52, 40, 161, 16, 106, 45, 44, 9, 142, 95, 5, 205, 82, 24, 172, 103, 152, 202, 187, 34, 217, 173, 236, 129, 32, 203, 205, 38]), + Bytes32::new_direct([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ]), + Bytes32::new_direct([ + 164, 47, 121, 69, 150, 44, 30, 204, 210, 181, 242, 154, 59, 111, 5, 10, 47, 121, 213, 80, + 163, 196, 205, 188, 241, 64, 202, 26, 242, 47, 50, 205, + ]), + Bytes32::new_direct([ + 166, 9, 224, 145, 14, 138, 194, 78, 202, 114, 110, 38, 244, 33, 189, 185, 170, 85, 144, + 229, 123, 63, 229, 194, 59, 130, 156, 6, 184, 154, 187, 17, + ]), + Bytes32::new_direct([ + 32, 51, 186, 232, 39, 244, 218, 98, 243, 254, 82, 247, 63, 120, 34, 123, 128, 240, 220, + 145, 41, 114, 251, 208, 209, 244, 10, 9, 179, 5, 105, 181, + ]), + Bytes32::new_direct([ + 73, 148, 74, 132, 241, 45, 129, 169, 83, 223, 101, 12, 184, 60, 10, 201, 169, 197, 75, 17, + 198, 168, 79, 171, 207, 195, 123, 47, 249, 30, 176, 216, + ]), + Bytes32::new_direct([ + 145, 224, 51, 196, 211, 137, 189, 133, 232, 210, 170, 157, 227, 160, 218, 143, 15, 82, 170, + 226, 241, 83, 7, 112, 138, 227, 58, 59, 149, 168, 81, 94, + ]), + Bytes32::new_direct([ + 241, 90, 42, 7, 231, 63, 36, 86, 238, 131, 19, 20, 38, 118, 65, 180, 109, 121, 147, 147, + 213, 142, 203, 244, 239, 75, 5, 160, 16, 85, 221, 95, + ]), + Bytes32::new_direct([ + 213, 113, 178, 221, 213, 107, 77, 153, 222, 48, 148, 140, 250, 1, 17, 59, 73, 19, 110, 106, + 94, 195, 126, 49, 126, 109, 65, 55, 104, 111, 18, 171, + ]), + Bytes32::new_direct([ + 43, 198, 12, 197, 95, 201, 76, 108, 96, 235, 76, 8, 117, 99, 42, 20, 177, 45, 112, 40, 2, + 180, 68, 19, 25, 11, 210, 168, 170, 178, 99, 27, + ]), + Bytes32::new_direct([ + 142, 205, 24, 125, 81, 234, 138, 161, 206, 121, 163, 225, 50, 9, 180, 102, 0, 25, 93, 180, + 137, 164, 206, 249, 222, 20, 175, 177, 199, 14, 115, 207, + ]), + Bytes32::new_direct([ + 213, 41, 249, 19, 173, 165, 236, 103, 42, 146, 223, 6, 190, 229, 161, 13, 96, 163, 110, 23, + 203, 238, 24, 95, 130, 203, 35, 211, 63, 234, 32, 137, + ]), + Bytes32::new_direct([ + 176, 82, 229, 48, 113, 46, 179, 38, 231, 83, 50, 136, 179, 190, 242, 126, 152, 210, 141, + 102, 191, 21, 20, 96, 235, 245, 81, 254, 231, 117, 159, 146, + ]), + Bytes32::new_direct([ + 216, 15, 120, 147, 70, 215, 12, 160, 223, 73, 246, 73, 195, 189, 200, 3, 19, 131, 102, 61, + 173, 79, 50, 76, 39, 150, 151, 147, 35, 251, 200, 0, + ]), + Bytes32::new_direct([ + 88, 215, 168, 30, 218, 72, 206, 159, 91, 121, 14, 133, 241, 220, 195, 46, 93, 244, 179, 53, + 158, 75, 211, 161, 8, 120, 167, 141, 235, 16, 232, 42, + ]), + Bytes32::new_direct([ + 114, 99, 218, 52, 203, 162, 199, 16, 225, 154, 182, 20, 59, 121, 250, 249, 166, 35, 118, + 18, 142, 57, 122, 131, 32, 219, 83, 126, 147, 91, 116, 16, + ]), + Bytes32::new_direct([ + 193, 157, 15, 251, 179, 155, 215, 190, 98, 93, 30, 167, 23, 175, 178, 172, 142, 143, 222, + 20, 18, 157, 215, 42, 105, 107, 64, 16, 216, 143, 109, 45, + ]), + Bytes32::new_direct([ + 178, 2, 203, 32, 83, 90, 114, 97, 124, 210, 81, 81, 179, 213, 71, 19, 181, 173, 227, 88, + 226, 83, 48, 169, 134, 163, 62, 103, 222, 82, 128, 30, + ]), + Bytes32::new_direct([ + 252, 17, 142, 50, 185, 19, 111, 148, 204, 30, 199, 138, 143, 207, 30, 212, 254, 7, 129, 43, + 100, 167, 52, 115, 247, 143, 64, 106, 220, 5, 7, 89, + ]), + Bytes32::new_direct([ + 117, 136, 111, 98, 95, 97, 253, 43, 82, 22, 43, 187, 65, 154, 132, 105, 55, 194, 240, 148, + 170, 199, 185, 91, 157, 138, 43, 117, 218, 176, 110, 101, + ]), + Bytes32::new_direct([ + 228, 56, 186, 202, 73, 47, 253, 151, 48, 173, 2, 101, 153, 197, 108, 145, 227, 170, 247, + 86, 80, 70, 30, 93, 232, 148, 63, 211, 197, 135, 23, 97, + ]), + Bytes32::new_direct([ + 162, 35, 93, 45, 208, 241, 87, 57, 138, 79, 231, 83, 75, 81, 102, 91, 115, 58, 1, 205, 193, + 197, 62, 210, 144, 88, 59, 52, 149, 234, 121, 224, + ]), + Bytes32::new_direct([ + 165, 67, 16, 239, 234, 92, 207, 81, 64, 93, 227, 154, 132, 33, 54, 53, 102, 198, 90, 134, + 24, 29, 190, 158, 121, 23, 127, 30, 27, 239, 140, 88, + ]), + Bytes32::new_direct([ + 61, 125, 183, 139, 186, 82, 193, 166, 2, 147, 231, 215, 179, 107, 163, 67, 122, 0, 90, 188, + 142, 216, 72, 20, 63, 146, 85, 89, 231, 41, 153, 117, + ]), + Bytes32::new_direct([ + 206, 31, 38, 182, 78, 170, 183, 207, 211, 114, 212, 4, 108, 84, 62, 99, 245, 196, 10, 1, + 188, 63, 240, 199, 27, 85, 68, 101, 212, 222, 85, 12, + ]), + Bytes32::new_direct([ + 106, 0, 225, 130, 195, 87, 113, 106, 101, 80, 56, 119, 93, 45, 74, 168, 240, 209, 155, 123, + 8, 129, 73, 225, 204, 125, 42, 73, 102, 122, 228, 158, + ]), + Bytes32::new_direct([ + 251, 63, 88, 92, 59, 176, 71, 194, 46, 19, 18, 27, 83, 57, 197, 231, 202, 242, 155, 63, + 252, 240, 205, 216, 96, 130, 161, 197, 123, 110, 175, 220, + ]), + Bytes32::new_direct([ + 239, 6, 249, 150, 189, 234, 197, 18, 79, 222, 80, 72, 205, 147, 251, 135, 226, 33, 46, 111, + 186, 185, 4, 33, 219, 129, 30, 182, 57, 229, 34, 16, + ]), + Bytes32::new_direct([ + 192, 35, 149, 149, 16, 111, 3, 119, 173, 215, 223, 247, 70, 25, 31, 107, 104, 5, 249, 243, + 193, 66, 99, 48, 107, 158, 25, 147, 163, 151, 96, 149, + ]), + Bytes32::new_direct([ + 197, 133, 241, 197, 67, 52, 255, 227, 180, 235, 137, 164, 174, 160, 183, 9, 159, 254, 210, + 180, 231, 140, 176, 165, 113, 215, 182, 1, 177, 204, 219, 246, + ]), + Bytes32::new_direct([ + 51, 32, 109, 173, 131, 6, 99, 63, 75, 191, 207, 187, 73, 26, 5, 139, 167, 216, 123, 26, + 199, 176, 84, 215, 158, 243, 105, 0, 91, 254, 59, 146, + ]), + Bytes32::new_direct([ + 229, 120, 15, 22, 225, 50, 131, 240, 190, 232, 83, 119, 169, 246, 172, 35, 99, 163, 58, + 146, 234, 253, 252, 83, 5, 48, 54, 142, 172, 91, 145, 13, + ]), + Bytes32::new_direct([ + 159, 9, 100, 20, 215, 92, 217, 43, 208, 254, 65, 234, 124, 167, 250, 53, 159, 151, 124, 70, + 26, 0, 113, 28, 78, 44, 238, 8, 34, 255, 19, 36, + ]), + Bytes32::new_direct([ + 193, 135, 44, 144, 13, 46, 76, 43, 127, 208, 79, 196, 229, 58, 125, 33, 71, 118, 215, 240, + 80, 123, 44, 181, 174, 47, 102, 42, 137, 98, 190, 41, + ]), + Bytes32::new_direct([ + 78, 19, 3, 217, 174, 154, 142, 109, 189, 14, 241, 12, 23, 185, 224, 152, 209, 108, 223, + 202, 191, 11, 190, 149, 31, 236, 104, 234, 22, 38, 196, 3, + ]), + Bytes32::new_direct([ + 60, 93, 237, 228, 186, 222, 179, 231, 151, 95, 147, 20, 188, 10, 191, 34, 126, 57, 253, + 161, 154, 117, 182, 108, 143, 72, 48, 102, 191, 240, 81, 208, + ]), + Bytes32::new_direct([ + 179, 114, 163, 89, 172, 211, 154, 204, 11, 125, 140, 186, 107, 90, 17, 116, 214, 31, 165, + 94, 36, 187, 184, 151, 210, 208, 76, 215, 75, 166, 107, 91, + ]), + Bytes32::new_direct([ + 125, 131, 52, 139, 120, 156, 163, 243, 206, 143, 204, 221, 123, 140, 1, 103, 235, 186, 64, + 82, 194, 191, 205, 2, 32, 242, 38, 77, 184, 23, 236, 228, + ]), + Bytes32::new_direct([ + 137, 224, 90, 1, 116, 95, 215, 47, 8, 3, 227, 132, 154, 232, 216, 63, 3, 80, 52, 18, 42, + 29, 85, 38, 117, 255, 9, 99, 88, 233, 129, 92, + ]), + Bytes32::new_direct([ + 54, 182, 145, 174, 54, 24, 168, 13, 71, 43, 178, 49, 153, 246, 94, 79, 228, 254, 134, 0, + 21, 210, 176, 242, 82, 117, 76, 40, 221, 181, 30, 62, + ]), + Bytes32::new_direct([ + 145, 171, 156, 87, 15, 174, 31, 111, 175, 161, 31, 116, 123, 123, 37, 216, 43, 147, 197, + 79, 218, 49, 236, 111, 35, 49, 44, 188, 197, 79, 136, 45, + ]), + Bytes32::new_direct([ + 169, 48, 186, 93, 10, 48, 80, 103, 68, 226, 103, 31, 176, 154, 146, 199, 166, 89, 48, 149, + 116, 101, 157, 149, 149, 72, 123, 54, 153, 26, 210, 122, + ]), + Bytes32::new_direct([ + 225, 45, 163, 167, 213, 84, 40, 87, 106, 253, 206, 80, 189, 71, 153, 5, 15, 107, 151, 150, + 14, 22, 143, 207, 4, 192, 63, 250, 207, 207, 179, 26, + ]), + Bytes32::new_direct([ + 110, 249, 172, 218, 206, 202, 107, 64, 48, 153, 226, 127, 165, 227, 50, 146, 140, 239, 220, + 252, 188, 157, 77, 210, 92, 73, 38, 6, 16, 87, 244, 66, + ]), + Bytes32::new_direct([ + 39, 217, 230, 91, 60, 231, 96, 137, 37, 58, 93, 51, 79, 222, 132, 171, 196, 109, 155, 4, + 252, 213, 17, 33, 160, 24, 250, 118, 187, 62, 107, 113, + ]), + Bytes32::new_direct([ + 120, 167, 145, 121, 184, 31, 185, 178, 241, 54, 20, 48, 132, 89, 132, 127, 235, 189, 197, + 127, 249, 58, 255, 197, 40, 229, 130, 254, 213, 186, 114, 74, + ]), + Bytes32::new_direct([ + 7, 40, 187, 172, 225, 196, 3, 77, 113, 16, 118, 148, 95, 65, 42, 234, 233, 29, 120, 223, + 105, 77, 250, 119, 245, 20, 21, 155, 177, 13, 56, 151, + ]), + Bytes32::new_direct([ + 22, 248, 25, 75, 36, 179, 251, 57, 101, 170, 213, 19, 216, 64, 164, 253, 151, 199, 88, 5, + 92, 129, 138, 185, 9, 236, 231, 68, 112, 24, 218, 216, + ]), + Bytes32::new_direct([ + 95, 141, 49, 39, 213, 214, 130, 49, 143, 124, 178, 114, 200, 136, 160, 90, 233, 73, 233, + 185, 60, 250, 174, 74, 2, 123, 2, 62, 192, 174, 115, 158, + ]), + Bytes32::new_direct([ + 142, 29, 212, 35, 71, 107, 91, 164, 226, 225, 180, 218, 99, 34, 200, 171, 33, 235, 113, + 105, 191, 78, 105, 70, 221, 135, 167, 148, 24, 225, 6, 146, + ]), + Bytes32::new_direct([ + 176, 194, 115, 243, 138, 104, 3, 247, 184, 74, 81, 60, 173, 45, 29, 189, 252, 202, 206, 66, + 129, 65, 150, 25, 246, 145, 133, 4, 93, 201, 201, 240, + ]), + Bytes32::new_direct([ + 18, 233, 186, 158, 43, 12, 206, 228, 80, 102, 187, 25, 78, 77, 180, 28, 82, 62, 168, 252, + 14, 113, 126, 91, 243, 120, 213, 91, 189, 244, 247, 177, + ]), + Bytes32::new_direct([ + 79, 126, 97, 23, 112, 98, 93, 86, 24, 103, 82, 33, 155, 188, 202, 61, 29, 146, 132, 169, + 116, 207, 216, 35, 29, 229, 213, 120, 135, 240, 129, 205, + ]), + Bytes32::new_direct([ + 146, 121, 255, 202, 145, 53, 46, 8, 102, 205, 56, 234, 49, 42, 85, 231, 217, 114, 235, 141, + 233, 187, 29, 9, 122, 232, 61, 253, 42, 104, 4, 113, + ]), + Bytes32::new_direct([ + 103, 174, 255, 6, 115, 155, 156, 65, 84, 251, 208, 55, 89, 124, 171, 167, 133, 227, 22, + 134, 32, 71, 243, 181, 16, 100, 81, 63, 22, 207, 58, 190, + ]), + Bytes32::new_direct([ + 69, 10, 247, 243, 56, 0, 64, 72, 218, 21, 211, 192, 62, 243, 66, 244, 230, 58, 107, 54, + 180, 29, 216, 23, 86, 211, 173, 181, 118, 188, 238, 72, + ]), + Bytes32::new_direct([ + 25, 179, 4, 93, 169, 76, 76, 69, 158, 3, 24, 146, 130, 9, 225, 198, 102, 238, 29, 73, 74, + 179, 159, 74, 40, 111, 181, 110, 76, 173, 251, 255, + ]), + Bytes32::new_direct([ + 236, 113, 37, 202, 149, 150, 90, 50, 233, 141, 125, 12, 212, 163, 137, 176, 15, 214, 194, + 73, 138, 104, 4, 33, 235, 76, 185, 58, 125, 182, 56, 0, + ]), + Bytes32::new_direct([ + 238, 54, 183, 94, 50, 33, 98, 31, 133, 181, 230, 98, 43, 154, 95, 111, 250, 71, 15, 197, + 156, 60, 8, 90, 208, 50, 62, 127, 30, 18, 181, 176, + ]), + Bytes32::new_direct([ + 246, 143, 72, 228, 143, 15, 15, 131, 178, 105, 113, 46, 85, 36, 165, 116, 63, 131, 61, 228, + 98, 144, 232, 209, 228, 110, 168, 171, 252, 47, 79, 165, + ]), + Bytes32::new_direct([ + 146, 70, 74, 79, 139, 107, 73, 28, 231, 88, 235, 214, 163, 185, 87, 195, 147, 186, 153, + 222, 191, 214, 30, 231, 173, 166, 151, 169, 244, 15, 15, 227, + ]), + Bytes32::new_direct([ + 137, 182, 175, 97, 212, 23, 62, 70, 50, 150, 67, 153, 253, 52, 179, 105, 147, 177, 217, + 170, 125, 251, 1, 96, 4, 127, 196, 37, 254, 7, 217, 100, + ]), + Bytes32::new_direct([ + 32, 253, 229, 209, 120, 43, 120, 189, 245, 227, 178, 79, 134, 175, 240, 107, 25, 124, 5, + 67, 120, 213, 187, 200, 159, 9, 26, 119, 13, 1, 8, 120, + ]), + Bytes32::new_direct([ + 115, 241, 26, 44, 83, 229, 130, 21, 249, 87, 72, 212, 75, 220, 95, 22, 151, 77, 182, 8, + 196, 207, 95, 18, 9, 92, 89, 206, 114, 80, 36, 159, + ]), + Bytes32::new_direct([ + 174, 151, 88, 171, 52, 40, 161, 16, 106, 45, 44, 9, 142, 95, 5, 205, 82, 24, 172, 103, 152, + 202, 187, 34, 217, 173, 236, 129, 32, 203, 205, 38, + ]), ]; const TABLE_ELEMENT_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::new_direct([145, 218, 63, 74, 131, 182, 204, 163, 74, 206, 234, 50, 47, 3, 51, 74, 121, 225, 146, 237, 5, 128, 20, 230, 243, 89, 33, 248, 136, 154, 189, 5]), - Bytes32::new_direct([36, 240, 95, 13, 214, 136, 92, 102, 96, 137, 39, 96, 108, 223, 147, 130, 220, 61, 147, 226, 52, 133, 67, 223, 211, 164, 6, 53, 45, 117, 120, 241]), - Bytes32::new_direct([9, 2, 218, 34, 228, 8, 178, 127, 160, 30, 104, 198, 49, 37, 71, 115, 14, 35, 20, 15, 253, 160, 147, 143, 24, 186, 12, 90, 41, 169, 30, 8]), - Bytes32::new_direct([137, 242, 105, 78, 161, 99, 76, 224, 226, 100, 216, 235, 156, 132, 214, 154, 107, 120, 197, 113, 45, 221, 170, 119, 92, 228, 76, 139, 170, 159, 111, 58]), - Bytes32::new_direct([231, 165, 221, 185, 139, 22, 70, 40, 67, 162, 123, 94, 161, 156, 57, 53, 102, 217, 128, 227, 18, 132, 17, 170, 90, 31, 214, 181, 249, 220, 70, 37]), - Bytes32::new_direct([171, 253, 174, 187, 9, 186, 87, 37, 22, 83, 13, 88, 75, 11, 177, 226, 237, 136, 132, 137, 101, 109, 135, 192, 224, 80, 87, 105, 95, 81, 255, 21]), - Bytes32::new_direct([179, 50, 36, 230, 159, 162, 184, 132, 140, 121, 133, 155, 189, 44, 132, 93, 80, 79, 32, 244, 131, 57, 79, 222, 104, 63, 224, 182, 91, 162, 73, 122]), - Bytes32::new_direct([17, 55, 206, 87, 127, 185, 135, 231, 41, 56, 166, 104, 229, 102, 222, 181, 236, 233, 230, 39, 43, 163, 16, 1, 225, 86, 211, 51, 145, 7, 169, 84]), - Bytes32::new_direct([201, 174, 3, 154, 104, 190, 240, 99, 123, 201, 7, 118, 196, 85, 28, 247, 35, 232, 39, 25, 151, 52, 167, 136, 179, 13, 213, 60, 138, 158, 39, 131]), - Bytes32::new_direct([35, 33, 109, 155, 171, 252, 195, 80, 10, 115, 40, 199, 250, 1, 241, 82, 146, 225, 118, 237, 11, 125, 198, 97, 57, 21, 171, 237, 94, 60, 49, 32]), - Bytes32::new_direct([126, 95, 42, 157, 183, 168, 137, 120, 114, 64, 148, 170, 32, 156, 137, 96, 194, 91, 119, 11, 20, 3, 30, 62, 118, 12, 31, 48, 245, 144, 252, 29]), - Bytes32::new_direct([48, 135, 201, 114, 103, 35, 8, 96, 5, 101, 125, 26, 87, 0, 98, 122, 239, 140, 230, 10, 102, 112, 155, 87, 249, 181, 152, 235, 28, 79, 176, 56]), - Bytes32::new_direct([76, 70, 222, 210, 242, 159, 52, 123, 112, 106, 253, 140, 55, 160, 189, 255, 220, 64, 8, 168, 39, 196, 160, 8, 105, 154, 91, 184, 62, 63, 227, 156]), - Bytes32::new_direct([138, 201, 8, 240, 218, 190, 210, 227, 236, 168, 45, 161, 209, 115, 126, 165, 235, 162, 6, 117, 76, 239, 3, 225, 163, 251, 111, 233, 233, 228, 14, 92]), - Bytes32::new_direct([190, 166, 27, 117, 242, 0, 25, 148, 230, 125, 237, 22, 153, 158, 151, 56, 121, 194, 221, 198, 184, 147, 249, 149, 27, 29, 166, 243, 254, 181, 209, 102]), - Bytes32::new_direct([235, 63, 149, 47, 164, 152, 80, 11, 178, 203, 99, 178, 176, 226, 164, 151, 39, 65, 83, 200, 102, 90, 12, 102, 178, 15, 232, 16, 222, 141, 78, 3]), - Bytes32::new_direct([37, 179, 99, 114, 214, 120, 87, 53, 198, 229, 207, 47, 16, 112, 208, 33, 216, 152, 209, 228, 196, 14, 237, 250, 212, 90, 176, 185, 21, 248, 92, 109]), - Bytes32::new_direct([237, 200, 122, 93, 145, 116, 138, 59, 86, 220, 58, 171, 160, 31, 142, 193, 231, 131, 106, 164, 166, 44, 120, 170, 62, 81, 73, 85, 0, 52, 219, 220]), - Bytes32::new_direct([244, 173, 85, 141, 81, 198, 214, 0, 54, 21, 20, 169, 177, 235, 104, 206, 43, 218, 96, 68, 73, 37, 252, 77, 253, 18, 30, 97, 223, 122, 1, 12]), - Bytes32::new_direct([104, 169, 247, 140, 131, 245, 193, 3, 36, 119, 249, 119, 108, 102, 115, 250, 173, 225, 33, 156, 116, 87, 180, 27, 84, 215, 126, 15, 187, 189, 32, 139]), - Bytes32::new_direct([47, 156, 244, 88, 145, 227, 224, 87, 233, 138, 138, 9, 169, 96, 29, 204, 100, 170, 23, 105, 63, 4, 119, 90, 167, 161, 72, 109, 82, 254, 123, 48]), - Bytes32::new_direct([196, 68, 107, 111, 141, 253, 138, 140, 162, 104, 247, 104, 87, 144, 123, 240, 105, 251, 246, 210, 172, 172, 241, 162, 155, 90, 83, 175, 131, 251, 107, 215]), - Bytes32::new_direct([28, 100, 243, 226, 32, 234, 211, 106, 197, 179, 14, 192, 70, 11, 203, 125, 151, 53, 20, 77, 175, 99, 154, 100, 159, 249, 54, 39, 73, 168, 162, 66]), - Bytes32::new_direct([83, 176, 7, 180, 201, 178, 172, 98, 47, 34, 80, 6, 62, 10, 4, 112, 43, 93, 10, 227, 74, 91, 11, 217, 83, 230, 104, 0, 167, 2, 114, 89]), - Bytes32::new_direct([185, 162, 212, 82, 149, 182, 104, 215, 62, 244, 114, 124, 181, 74, 226, 119, 4, 42, 181, 238, 25, 212, 215, 219, 174, 231, 32, 170, 9, 234, 12, 212]), - Bytes32::new_direct([173, 38, 241, 20, 137, 119, 33, 252, 174, 245, 252, 234, 165, 181, 128, 225, 14, 147, 182, 97, 145, 19, 40, 193, 90, 238, 140, 87, 0, 222, 70, 254]), - Bytes32::new_direct([51, 218, 162, 213, 211, 23, 9, 158, 185, 156, 39, 145, 5, 146, 70, 144, 172, 10, 26, 212, 253, 37, 24, 32, 21, 65, 179, 140, 64, 237, 96, 157]), - Bytes32::new_direct([221, 87, 57, 81, 246, 126, 53, 163, 190, 220, 109, 205, 114, 234, 85, 151, 75, 245, 254, 16, 140, 131, 239, 120, 9, 209, 54, 61, 177, 6, 188, 252]), - Bytes32::new_direct([54, 161, 25, 198, 75, 151, 214, 76, 83, 74, 117, 229, 155, 237, 88, 95, 143, 119, 56, 12, 201, 164, 235, 20, 117, 49, 177, 88, 14, 248, 95, 198]), - Bytes32::new_direct([60, 16, 183, 115, 241, 45, 253, 24, 105, 43, 79, 72, 212, 238, 24, 156, 132, 93, 78, 246, 1, 228, 222, 200, 254, 130, 170, 46, 91, 254, 205, 143]), - Bytes32::new_direct([184, 30, 34, 235, 214, 40, 120, 64, 182, 15, 162, 189, 164, 202, 89, 146, 202, 177, 16, 105, 172, 158, 1, 95, 101, 146, 253, 115, 226, 233, 38, 171]), - Bytes32::new_direct([70, 152, 3, 73, 249, 222, 93, 214, 74, 179, 140, 47, 34, 42, 149, 214, 152, 75, 34, 145, 68, 226, 151, 101, 121, 54, 252, 240, 206, 140, 81, 165]), - Bytes32::new_direct([9, 88, 51, 124, 67, 108, 84, 244, 61, 241, 110, 246, 184, 105, 6, 116, 242, 58, 15, 144, 43, 76, 176, 107, 0, 138, 155, 235, 210, 138, 226, 215]), - Bytes32::new_direct([98, 170, 168, 147, 158, 223, 186, 7, 58, 130, 89, 200, 153, 24, 158, 251, 69, 100, 7, 57, 96, 115, 136, 170, 57, 145, 143, 240, 102, 6, 248, 111]), - Bytes32::new_direct([76, 75, 216, 216, 194, 146, 2, 59, 247, 64, 98, 160, 62, 105, 193, 186, 161, 191, 64, 154, 254, 196, 55, 214, 201, 103, 223, 131, 181, 192, 152, 176]), - Bytes32::new_direct([188, 141, 114, 199, 33, 45, 183, 18, 123, 231, 92, 215, 51, 191, 11, 199, 253, 46, 28, 10, 156, 23, 92, 255, 219, 236, 176, 247, 52, 105, 210, 223]), - Bytes32::new_direct([200, 67, 112, 29, 180, 70, 50, 18, 220, 122, 39, 122, 83, 186, 81, 77, 241, 44, 190, 3, 162, 217, 76, 61, 230, 237, 157, 230, 205, 172, 186, 247]), - Bytes32::new_direct([131, 131, 129, 83, 251, 217, 83, 88, 93, 39, 66, 174, 51, 19, 190, 91, 16, 187, 95, 63, 35, 178, 94, 237, 194, 42, 231, 227, 138, 202, 216, 93]), - Bytes32::new_direct([18, 177, 28, 41, 199, 59, 160, 244, 26, 162, 73, 48, 16, 74, 190, 195, 249, 216, 64, 229, 145, 65, 18, 131, 75, 57, 71, 74, 127, 239, 112, 13]), - Bytes32::new_direct([41, 120, 53, 253, 151, 12, 143, 213, 212, 31, 245, 61, 168, 113, 30, 38, 112, 126, 156, 133, 241, 102, 110, 237, 4, 138, 50, 160, 79, 235, 52, 35]), - Bytes32::new_direct([38, 74, 146, 27, 110, 86, 122, 250, 58, 243, 64, 185, 207, 174, 28, 124, 35, 183, 53, 88, 34, 234, 89, 58, 98, 223, 69, 13, 48, 15, 239, 230]), - Bytes32::new_direct([221, 132, 1, 28, 157, 232, 235, 132, 32, 58, 26, 36, 60, 217, 197, 165, 141, 19, 64, 120, 197, 139, 190, 86, 153, 152, 235, 11, 99, 129, 222, 91]), - Bytes32::new_direct([237, 76, 61, 239, 169, 108, 131, 62, 163, 67, 158, 210, 14, 45, 91, 105, 36, 182, 206, 182, 71, 11, 159, 169, 159, 248, 247, 176, 6, 176, 237, 123]), - Bytes32::new_direct([232, 190, 198, 78, 12, 148, 86, 176, 221, 115, 1, 22, 122, 163, 223, 234, 74, 129, 125, 53, 211, 137, 115, 18, 241, 170, 69, 42, 34, 74, 180, 172]), - Bytes32::new_direct([215, 199, 144, 158, 222, 153, 123, 125, 150, 97, 127, 151, 96, 43, 69, 155, 150, 119, 75, 82, 218, 48, 101, 70, 121, 18, 42, 146, 215, 183, 100, 158]), - Bytes32::new_direct([121, 182, 45, 62, 255, 78, 32, 48, 107, 186, 208, 155, 158, 80, 231, 241, 90, 227, 219, 113, 52, 20, 66, 45, 124, 67, 209, 61, 167, 74, 60, 34]), - Bytes32::new_direct([34, 136, 15, 103, 128, 220, 202, 103, 150, 123, 249, 145, 218, 227, 17, 64, 142, 129, 4, 42, 93, 7, 6, 147, 111, 117, 25, 185, 88, 104, 85, 115]), - Bytes32::new_direct([144, 191, 235, 38, 205, 102, 127, 160, 139, 105, 75, 63, 86, 192, 194, 49, 240, 35, 65, 154, 4, 113, 51, 87, 40, 70, 32, 58, 243, 16, 136, 67]), - Bytes32::new_direct([217, 150, 254, 250, 111, 69, 45, 227, 111, 59, 199, 149, 59, 216, 17, 117, 8, 226, 85, 250, 183, 187, 21, 129, 208, 0, 63, 158, 232, 106, 131, 16]), - Bytes32::new_direct([148, 212, 84, 16, 204, 49, 69, 96, 137, 125, 102, 221, 111, 8, 41, 51, 221, 241, 87, 231, 88, 215, 211, 24, 254, 131, 111, 56, 160, 143, 230, 109]), - Bytes32::new_direct([144, 48, 37, 157, 153, 7, 123, 206, 46, 224, 211, 249, 208, 217, 91, 243, 128, 62, 100, 126, 3, 253, 223, 161, 50, 108, 26, 151, 129, 242, 94, 132]), - Bytes32::new_direct([97, 167, 177, 53, 183, 154, 164, 1, 129, 184, 234, 182, 190, 197, 244, 226, 150, 217, 57, 152, 243, 206, 60, 76, 114, 194, 51, 240, 58, 93, 219, 76]), - Bytes32::new_direct([139, 70, 147, 227, 94, 147, 130, 53, 38, 112, 138, 176, 7, 148, 6, 21, 50, 199, 70, 33, 87, 180, 33, 167, 56, 89, 66, 95, 245, 247, 135, 24]), - Bytes32::new_direct([175, 169, 204, 13, 145, 18, 40, 29, 84, 88, 206, 99, 208, 137, 249, 146, 0, 237, 188, 130, 135, 223, 121, 54, 126, 251, 247, 109, 141, 217, 62, 127]), - Bytes32::new_direct([139, 188, 3, 234, 198, 124, 194, 238, 217, 237, 214, 250, 66, 220, 0, 51, 1, 203, 122, 125, 46, 213, 22, 253, 8, 218, 145, 253, 170, 156, 159, 96]), - Bytes32::new_direct([107, 130, 208, 55, 16, 249, 46, 4, 98, 236, 130, 52, 190, 126, 232, 229, 108, 126, 239, 175, 25, 229, 84, 33, 249, 66, 128, 162, 47, 221, 110, 163]), - Bytes32::new_direct([239, 176, 14, 134, 210, 125, 177, 40, 200, 42, 229, 32, 200, 58, 9, 73, 210, 161, 8, 105, 4, 70, 19, 134, 117, 132, 167, 18, 16, 108, 207, 113]), - Bytes32::new_direct([237, 116, 250, 79, 151, 228, 171, 189, 89, 213, 122, 121, 55, 25, 52, 238, 79, 19, 31, 194, 73, 158, 43, 78, 86, 194, 36, 141, 105, 10, 87, 58]), - Bytes32::new_direct([216, 125, 158, 123, 121, 158, 74, 152, 46, 18, 196, 115, 233, 149, 205, 189, 10, 232, 174, 21, 2, 52, 202, 111, 74, 160, 191, 196, 84, 93, 98, 46]), - Bytes32::new_direct([201, 148, 124, 172, 62, 154, 127, 129, 205, 197, 134, 133, 144, 78, 47, 190, 197, 190, 103, 44, 129, 57, 155, 227, 152, 212, 130, 12, 192, 223, 244, 68]), - Bytes32::new_direct([102, 147, 19, 104, 237, 188, 140, 66, 166, 77, 105, 55, 5, 165, 143, 107, 91, 247, 53, 203, 187, 163, 109, 66, 19, 164, 153, 170, 82, 251, 148, 10]), - Bytes32::new_direct([33, 89, 246, 96, 201, 15, 77, 99, 252, 111, 250, 152, 124, 80, 50, 57, 197, 124, 254, 202, 246, 131, 11, 219, 249, 102, 35, 79, 100, 173, 146, 167]), - Bytes32::new_direct([6, 27, 205, 165, 249, 112, 70, 105, 232, 156, 155, 204, 71, 5, 21, 239, 91, 69, 248, 111, 218, 154, 187, 85, 118, 72, 210, 99, 138, 40, 233, 75]), + Bytes32::new_direct([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ]), + Bytes32::new_direct([ + 145, 218, 63, 74, 131, 182, 204, 163, 74, 206, 234, 50, 47, 3, 51, 74, 121, 225, 146, 237, + 5, 128, 20, 230, 243, 89, 33, 248, 136, 154, 189, 5, + ]), + Bytes32::new_direct([ + 36, 240, 95, 13, 214, 136, 92, 102, 96, 137, 39, 96, 108, 223, 147, 130, 220, 61, 147, 226, + 52, 133, 67, 223, 211, 164, 6, 53, 45, 117, 120, 241, + ]), + Bytes32::new_direct([ + 9, 2, 218, 34, 228, 8, 178, 127, 160, 30, 104, 198, 49, 37, 71, 115, 14, 35, 20, 15, 253, + 160, 147, 143, 24, 186, 12, 90, 41, 169, 30, 8, + ]), + Bytes32::new_direct([ + 137, 242, 105, 78, 161, 99, 76, 224, 226, 100, 216, 235, 156, 132, 214, 154, 107, 120, 197, + 113, 45, 221, 170, 119, 92, 228, 76, 139, 170, 159, 111, 58, + ]), + Bytes32::new_direct([ + 231, 165, 221, 185, 139, 22, 70, 40, 67, 162, 123, 94, 161, 156, 57, 53, 102, 217, 128, + 227, 18, 132, 17, 170, 90, 31, 214, 181, 249, 220, 70, 37, + ]), + Bytes32::new_direct([ + 171, 253, 174, 187, 9, 186, 87, 37, 22, 83, 13, 88, 75, 11, 177, 226, 237, 136, 132, 137, + 101, 109, 135, 192, 224, 80, 87, 105, 95, 81, 255, 21, + ]), + Bytes32::new_direct([ + 179, 50, 36, 230, 159, 162, 184, 132, 140, 121, 133, 155, 189, 44, 132, 93, 80, 79, 32, + 244, 131, 57, 79, 222, 104, 63, 224, 182, 91, 162, 73, 122, + ]), + Bytes32::new_direct([ + 17, 55, 206, 87, 127, 185, 135, 231, 41, 56, 166, 104, 229, 102, 222, 181, 236, 233, 230, + 39, 43, 163, 16, 1, 225, 86, 211, 51, 145, 7, 169, 84, + ]), + Bytes32::new_direct([ + 201, 174, 3, 154, 104, 190, 240, 99, 123, 201, 7, 118, 196, 85, 28, 247, 35, 232, 39, 25, + 151, 52, 167, 136, 179, 13, 213, 60, 138, 158, 39, 131, + ]), + Bytes32::new_direct([ + 35, 33, 109, 155, 171, 252, 195, 80, 10, 115, 40, 199, 250, 1, 241, 82, 146, 225, 118, 237, + 11, 125, 198, 97, 57, 21, 171, 237, 94, 60, 49, 32, + ]), + Bytes32::new_direct([ + 126, 95, 42, 157, 183, 168, 137, 120, 114, 64, 148, 170, 32, 156, 137, 96, 194, 91, 119, + 11, 20, 3, 30, 62, 118, 12, 31, 48, 245, 144, 252, 29, + ]), + Bytes32::new_direct([ + 48, 135, 201, 114, 103, 35, 8, 96, 5, 101, 125, 26, 87, 0, 98, 122, 239, 140, 230, 10, 102, + 112, 155, 87, 249, 181, 152, 235, 28, 79, 176, 56, + ]), + Bytes32::new_direct([ + 76, 70, 222, 210, 242, 159, 52, 123, 112, 106, 253, 140, 55, 160, 189, 255, 220, 64, 8, + 168, 39, 196, 160, 8, 105, 154, 91, 184, 62, 63, 227, 156, + ]), + Bytes32::new_direct([ + 138, 201, 8, 240, 218, 190, 210, 227, 236, 168, 45, 161, 209, 115, 126, 165, 235, 162, 6, + 117, 76, 239, 3, 225, 163, 251, 111, 233, 233, 228, 14, 92, + ]), + Bytes32::new_direct([ + 190, 166, 27, 117, 242, 0, 25, 148, 230, 125, 237, 22, 153, 158, 151, 56, 121, 194, 221, + 198, 184, 147, 249, 149, 27, 29, 166, 243, 254, 181, 209, 102, + ]), + Bytes32::new_direct([ + 235, 63, 149, 47, 164, 152, 80, 11, 178, 203, 99, 178, 176, 226, 164, 151, 39, 65, 83, 200, + 102, 90, 12, 102, 178, 15, 232, 16, 222, 141, 78, 3, + ]), + Bytes32::new_direct([ + 37, 179, 99, 114, 214, 120, 87, 53, 198, 229, 207, 47, 16, 112, 208, 33, 216, 152, 209, + 228, 196, 14, 237, 250, 212, 90, 176, 185, 21, 248, 92, 109, + ]), + Bytes32::new_direct([ + 237, 200, 122, 93, 145, 116, 138, 59, 86, 220, 58, 171, 160, 31, 142, 193, 231, 131, 106, + 164, 166, 44, 120, 170, 62, 81, 73, 85, 0, 52, 219, 220, + ]), + Bytes32::new_direct([ + 244, 173, 85, 141, 81, 198, 214, 0, 54, 21, 20, 169, 177, 235, 104, 206, 43, 218, 96, 68, + 73, 37, 252, 77, 253, 18, 30, 97, 223, 122, 1, 12, + ]), + Bytes32::new_direct([ + 104, 169, 247, 140, 131, 245, 193, 3, 36, 119, 249, 119, 108, 102, 115, 250, 173, 225, 33, + 156, 116, 87, 180, 27, 84, 215, 126, 15, 187, 189, 32, 139, + ]), + Bytes32::new_direct([ + 47, 156, 244, 88, 145, 227, 224, 87, 233, 138, 138, 9, 169, 96, 29, 204, 100, 170, 23, 105, + 63, 4, 119, 90, 167, 161, 72, 109, 82, 254, 123, 48, + ]), + Bytes32::new_direct([ + 196, 68, 107, 111, 141, 253, 138, 140, 162, 104, 247, 104, 87, 144, 123, 240, 105, 251, + 246, 210, 172, 172, 241, 162, 155, 90, 83, 175, 131, 251, 107, 215, + ]), + Bytes32::new_direct([ + 28, 100, 243, 226, 32, 234, 211, 106, 197, 179, 14, 192, 70, 11, 203, 125, 151, 53, 20, 77, + 175, 99, 154, 100, 159, 249, 54, 39, 73, 168, 162, 66, + ]), + Bytes32::new_direct([ + 83, 176, 7, 180, 201, 178, 172, 98, 47, 34, 80, 6, 62, 10, 4, 112, 43, 93, 10, 227, 74, 91, + 11, 217, 83, 230, 104, 0, 167, 2, 114, 89, + ]), + Bytes32::new_direct([ + 185, 162, 212, 82, 149, 182, 104, 215, 62, 244, 114, 124, 181, 74, 226, 119, 4, 42, 181, + 238, 25, 212, 215, 219, 174, 231, 32, 170, 9, 234, 12, 212, + ]), + Bytes32::new_direct([ + 173, 38, 241, 20, 137, 119, 33, 252, 174, 245, 252, 234, 165, 181, 128, 225, 14, 147, 182, + 97, 145, 19, 40, 193, 90, 238, 140, 87, 0, 222, 70, 254, + ]), + Bytes32::new_direct([ + 51, 218, 162, 213, 211, 23, 9, 158, 185, 156, 39, 145, 5, 146, 70, 144, 172, 10, 26, 212, + 253, 37, 24, 32, 21, 65, 179, 140, 64, 237, 96, 157, + ]), + Bytes32::new_direct([ + 221, 87, 57, 81, 246, 126, 53, 163, 190, 220, 109, 205, 114, 234, 85, 151, 75, 245, 254, + 16, 140, 131, 239, 120, 9, 209, 54, 61, 177, 6, 188, 252, + ]), + Bytes32::new_direct([ + 54, 161, 25, 198, 75, 151, 214, 76, 83, 74, 117, 229, 155, 237, 88, 95, 143, 119, 56, 12, + 201, 164, 235, 20, 117, 49, 177, 88, 14, 248, 95, 198, + ]), + Bytes32::new_direct([ + 60, 16, 183, 115, 241, 45, 253, 24, 105, 43, 79, 72, 212, 238, 24, 156, 132, 93, 78, 246, + 1, 228, 222, 200, 254, 130, 170, 46, 91, 254, 205, 143, + ]), + Bytes32::new_direct([ + 184, 30, 34, 235, 214, 40, 120, 64, 182, 15, 162, 189, 164, 202, 89, 146, 202, 177, 16, + 105, 172, 158, 1, 95, 101, 146, 253, 115, 226, 233, 38, 171, + ]), + Bytes32::new_direct([ + 70, 152, 3, 73, 249, 222, 93, 214, 74, 179, 140, 47, 34, 42, 149, 214, 152, 75, 34, 145, + 68, 226, 151, 101, 121, 54, 252, 240, 206, 140, 81, 165, + ]), + Bytes32::new_direct([ + 9, 88, 51, 124, 67, 108, 84, 244, 61, 241, 110, 246, 184, 105, 6, 116, 242, 58, 15, 144, + 43, 76, 176, 107, 0, 138, 155, 235, 210, 138, 226, 215, + ]), + Bytes32::new_direct([ + 98, 170, 168, 147, 158, 223, 186, 7, 58, 130, 89, 200, 153, 24, 158, 251, 69, 100, 7, 57, + 96, 115, 136, 170, 57, 145, 143, 240, 102, 6, 248, 111, + ]), + Bytes32::new_direct([ + 76, 75, 216, 216, 194, 146, 2, 59, 247, 64, 98, 160, 62, 105, 193, 186, 161, 191, 64, 154, + 254, 196, 55, 214, 201, 103, 223, 131, 181, 192, 152, 176, + ]), + Bytes32::new_direct([ + 188, 141, 114, 199, 33, 45, 183, 18, 123, 231, 92, 215, 51, 191, 11, 199, 253, 46, 28, 10, + 156, 23, 92, 255, 219, 236, 176, 247, 52, 105, 210, 223, + ]), + Bytes32::new_direct([ + 200, 67, 112, 29, 180, 70, 50, 18, 220, 122, 39, 122, 83, 186, 81, 77, 241, 44, 190, 3, + 162, 217, 76, 61, 230, 237, 157, 230, 205, 172, 186, 247, + ]), + Bytes32::new_direct([ + 131, 131, 129, 83, 251, 217, 83, 88, 93, 39, 66, 174, 51, 19, 190, 91, 16, 187, 95, 63, 35, + 178, 94, 237, 194, 42, 231, 227, 138, 202, 216, 93, + ]), + Bytes32::new_direct([ + 18, 177, 28, 41, 199, 59, 160, 244, 26, 162, 73, 48, 16, 74, 190, 195, 249, 216, 64, 229, + 145, 65, 18, 131, 75, 57, 71, 74, 127, 239, 112, 13, + ]), + Bytes32::new_direct([ + 41, 120, 53, 253, 151, 12, 143, 213, 212, 31, 245, 61, 168, 113, 30, 38, 112, 126, 156, + 133, 241, 102, 110, 237, 4, 138, 50, 160, 79, 235, 52, 35, + ]), + Bytes32::new_direct([ + 38, 74, 146, 27, 110, 86, 122, 250, 58, 243, 64, 185, 207, 174, 28, 124, 35, 183, 53, 88, + 34, 234, 89, 58, 98, 223, 69, 13, 48, 15, 239, 230, + ]), + Bytes32::new_direct([ + 221, 132, 1, 28, 157, 232, 235, 132, 32, 58, 26, 36, 60, 217, 197, 165, 141, 19, 64, 120, + 197, 139, 190, 86, 153, 152, 235, 11, 99, 129, 222, 91, + ]), + Bytes32::new_direct([ + 237, 76, 61, 239, 169, 108, 131, 62, 163, 67, 158, 210, 14, 45, 91, 105, 36, 182, 206, 182, + 71, 11, 159, 169, 159, 248, 247, 176, 6, 176, 237, 123, + ]), + Bytes32::new_direct([ + 232, 190, 198, 78, 12, 148, 86, 176, 221, 115, 1, 22, 122, 163, 223, 234, 74, 129, 125, 53, + 211, 137, 115, 18, 241, 170, 69, 42, 34, 74, 180, 172, + ]), + Bytes32::new_direct([ + 215, 199, 144, 158, 222, 153, 123, 125, 150, 97, 127, 151, 96, 43, 69, 155, 150, 119, 75, + 82, 218, 48, 101, 70, 121, 18, 42, 146, 215, 183, 100, 158, + ]), + Bytes32::new_direct([ + 121, 182, 45, 62, 255, 78, 32, 48, 107, 186, 208, 155, 158, 80, 231, 241, 90, 227, 219, + 113, 52, 20, 66, 45, 124, 67, 209, 61, 167, 74, 60, 34, + ]), + Bytes32::new_direct([ + 34, 136, 15, 103, 128, 220, 202, 103, 150, 123, 249, 145, 218, 227, 17, 64, 142, 129, 4, + 42, 93, 7, 6, 147, 111, 117, 25, 185, 88, 104, 85, 115, + ]), + Bytes32::new_direct([ + 144, 191, 235, 38, 205, 102, 127, 160, 139, 105, 75, 63, 86, 192, 194, 49, 240, 35, 65, + 154, 4, 113, 51, 87, 40, 70, 32, 58, 243, 16, 136, 67, + ]), + Bytes32::new_direct([ + 217, 150, 254, 250, 111, 69, 45, 227, 111, 59, 199, 149, 59, 216, 17, 117, 8, 226, 85, 250, + 183, 187, 21, 129, 208, 0, 63, 158, 232, 106, 131, 16, + ]), + Bytes32::new_direct([ + 148, 212, 84, 16, 204, 49, 69, 96, 137, 125, 102, 221, 111, 8, 41, 51, 221, 241, 87, 231, + 88, 215, 211, 24, 254, 131, 111, 56, 160, 143, 230, 109, + ]), + Bytes32::new_direct([ + 144, 48, 37, 157, 153, 7, 123, 206, 46, 224, 211, 249, 208, 217, 91, 243, 128, 62, 100, + 126, 3, 253, 223, 161, 50, 108, 26, 151, 129, 242, 94, 132, + ]), + Bytes32::new_direct([ + 97, 167, 177, 53, 183, 154, 164, 1, 129, 184, 234, 182, 190, 197, 244, 226, 150, 217, 57, + 152, 243, 206, 60, 76, 114, 194, 51, 240, 58, 93, 219, 76, + ]), + Bytes32::new_direct([ + 139, 70, 147, 227, 94, 147, 130, 53, 38, 112, 138, 176, 7, 148, 6, 21, 50, 199, 70, 33, 87, + 180, 33, 167, 56, 89, 66, 95, 245, 247, 135, 24, + ]), + Bytes32::new_direct([ + 175, 169, 204, 13, 145, 18, 40, 29, 84, 88, 206, 99, 208, 137, 249, 146, 0, 237, 188, 130, + 135, 223, 121, 54, 126, 251, 247, 109, 141, 217, 62, 127, + ]), + Bytes32::new_direct([ + 139, 188, 3, 234, 198, 124, 194, 238, 217, 237, 214, 250, 66, 220, 0, 51, 1, 203, 122, 125, + 46, 213, 22, 253, 8, 218, 145, 253, 170, 156, 159, 96, + ]), + Bytes32::new_direct([ + 107, 130, 208, 55, 16, 249, 46, 4, 98, 236, 130, 52, 190, 126, 232, 229, 108, 126, 239, + 175, 25, 229, 84, 33, 249, 66, 128, 162, 47, 221, 110, 163, + ]), + Bytes32::new_direct([ + 239, 176, 14, 134, 210, 125, 177, 40, 200, 42, 229, 32, 200, 58, 9, 73, 210, 161, 8, 105, + 4, 70, 19, 134, 117, 132, 167, 18, 16, 108, 207, 113, + ]), + Bytes32::new_direct([ + 237, 116, 250, 79, 151, 228, 171, 189, 89, 213, 122, 121, 55, 25, 52, 238, 79, 19, 31, 194, + 73, 158, 43, 78, 86, 194, 36, 141, 105, 10, 87, 58, + ]), + Bytes32::new_direct([ + 216, 125, 158, 123, 121, 158, 74, 152, 46, 18, 196, 115, 233, 149, 205, 189, 10, 232, 174, + 21, 2, 52, 202, 111, 74, 160, 191, 196, 84, 93, 98, 46, + ]), + Bytes32::new_direct([ + 201, 148, 124, 172, 62, 154, 127, 129, 205, 197, 134, 133, 144, 78, 47, 190, 197, 190, 103, + 44, 129, 57, 155, 227, 152, 212, 130, 12, 192, 223, 244, 68, + ]), + Bytes32::new_direct([ + 102, 147, 19, 104, 237, 188, 140, 66, 166, 77, 105, 55, 5, 165, 143, 107, 91, 247, 53, 203, + 187, 163, 109, 66, 19, 164, 153, 170, 82, 251, 148, 10, + ]), + Bytes32::new_direct([ + 33, 89, 246, 96, 201, 15, 77, 99, 252, 111, 250, 152, 124, 80, 50, 57, 197, 124, 254, 202, + 246, 131, 11, 219, 249, 102, 35, 79, 100, 173, 146, 167, + ]), + Bytes32::new_direct([ + 6, 27, 205, 165, 249, 112, 70, 105, 232, 156, 155, 204, 71, 5, 21, 239, 91, 69, 248, 111, + 218, 154, 187, 85, 118, 72, 210, 99, 138, 40, 233, 75, + ]), ]; const MODULE_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), - Bytes32::new_direct([252, 178, 61, 5, 174, 66, 106, 30, 131, 163, 114, 90, 231, 83, 228, 153, 108, 255, 60, 37, 254, 139, 153, 129, 208, 156, 109, 74, 233, 129, 174, 182]), - Bytes32::new_direct([128, 23, 154, 62, 181, 220, 154, 183, 222, 214, 79, 76, 162, 169, 179, 162, 185, 93, 179, 115, 161, 55, 19, 63, 227, 168, 140, 66, 182, 6, 60, 120]), - Bytes32::new_direct([243, 119, 126, 55, 151, 128, 119, 12, 124, 84, 146, 243, 156, 68, 82, 174, 201, 162, 29, 73, 29, 77, 103, 205, 194, 250, 45, 133, 39, 71, 224, 177]), - Bytes32::new_direct([209, 179, 222, 187, 184, 84, 131, 182, 172, 78, 20, 104, 236, 246, 114, 74, 55, 98, 29, 34, 117, 249, 89, 76, 85, 38, 248, 193, 75, 10, 243, 100]), - Bytes32::new_direct([195, 14, 58, 139, 148, 140, 218, 174, 131, 204, 69, 84, 127, 8, 142, 88, 136, 83, 253, 241, 74, 247, 143, 204, 38, 15, 138, 98, 47, 188, 255, 245]), - Bytes32::new_direct([167, 4, 177, 126, 159, 76, 19, 220, 160, 159, 81, 227, 110, 147, 179, 175, 253, 187, 46, 24, 15, 168, 153, 84, 4, 167, 247, 225, 121, 175, 134, 85]), - Bytes32::new_direct([237, 144, 152, 155, 211, 100, 202, 187, 41, 181, 45, 224, 143, 139, 18, 77, 110, 34, 212, 207, 239, 180, 73, 84, 166, 194, 22, 149, 89, 215, 86, 21]), - Bytes32::new_direct([226, 192, 91, 176, 242, 185, 212, 189, 178, 80, 238, 252, 183, 82, 220, 242, 22, 237, 84, 142, 132, 91, 95, 219, 252, 171, 51, 76, 28, 146, 86, 155]), - Bytes32::new_direct([199, 200, 237, 66, 220, 14, 221, 121, 117, 150, 118, 36, 138, 142, 50, 173, 12, 195, 131, 90, 27, 189, 247, 221, 89, 151, 41, 27, 135, 207, 137, 172]), - Bytes32::new_direct([160, 60, 124, 200, 56, 240, 67, 161, 121, 95, 247, 51, 153, 249, 125, 88, 231, 2, 85, 167, 251, 187, 21, 103, 49, 132, 213, 52, 219, 30, 146, 59]), - Bytes32::new_direct([123, 52, 142, 254, 117, 160, 215, 99, 155, 130, 134, 183, 76, 99, 166, 246, 49, 51, 142, 67, 116, 234, 69, 199, 201, 19, 70, 3, 208, 247, 40, 82]), - Bytes32::new_direct([165, 32, 183, 79, 246, 224, 220, 103, 11, 160, 233, 66, 129, 238, 194, 73, 17, 37, 128, 185, 175, 88, 144, 228, 231, 185, 22, 17, 149, 174, 72, 1]), - Bytes32::new_direct([12, 24, 45, 128, 57, 246, 187, 176, 154, 247, 169, 18, 116, 176, 70, 246, 203, 141, 211, 104, 5, 147, 78, 214, 161, 71, 33, 97, 7, 21, 158, 61]), - Bytes32::new_direct([215, 18, 110, 29, 36, 34, 133, 219, 15, 204, 206, 158, 186, 213, 181, 41, 184, 160, 71, 165, 163, 121, 88, 106, 228, 58, 34, 105, 112, 168, 84, 123]), - Bytes32::new_direct([6, 169, 156, 220, 55, 53, 26, 229, 104, 60, 113, 111, 153, 18, 251, 234, 179, 159, 56, 14, 112, 7, 144, 199, 45, 180, 116, 239, 21, 207, 173, 205]), - Bytes32::new_direct([24, 172, 76, 192, 21, 91, 250, 75, 196, 119, 231, 221, 13, 239, 113, 39, 62, 40, 165, 26, 245, 16, 61, 106, 39, 28, 78, 212, 249, 230, 84, 108]), - Bytes32::new_direct([248, 34, 1, 62, 213, 235, 20, 21, 220, 78, 178, 126, 184, 102, 242, 50, 49, 174, 163, 122, 166, 96, 40, 110, 78, 199, 89, 158, 155, 251, 233, 49]), - Bytes32::new_direct([103, 54, 133, 19, 189, 117, 46, 209, 17, 2, 64, 251, 77, 195, 197, 91, 38, 48, 214, 36, 96, 255, 133, 87, 244, 101, 166, 218, 167, 129, 225, 167]), - Bytes32::new_direct([196, 159, 226, 85, 100, 246, 179, 251, 133, 33, 114, 51, 104, 245, 81, 54, 137, 126, 245, 76, 112, 146, 139, 185, 190, 19, 106, 132, 48, 203, 34, 237]), - Bytes32::new_direct([41, 190, 7, 23, 227, 80, 13, 134, 244, 18, 215, 148, 1, 72, 1, 22, 91, 165, 182, 69, 160, 179, 241, 106, 254, 116, 245, 131, 136, 35, 190, 226]), - Bytes32::new_direct([205, 132, 211, 121, 67, 210, 191, 102, 218, 92, 56, 204, 68, 160, 188, 100, 229, 80, 77, 27, 26, 86, 248, 86, 216, 39, 242, 211, 183, 139, 219, 83]), - Bytes32::new_direct([13, 215, 68, 100, 180, 74, 23, 58, 157, 140, 76, 31, 114, 254, 85, 78, 234, 40, 251, 199, 35, 204, 111, 243, 163, 64, 221, 21, 96, 55, 127, 118]), - Bytes32::new_direct([225, 14, 246, 105, 64, 96, 225, 200, 186, 66, 40, 253, 131, 80, 102, 178, 83, 22, 150, 32, 15, 139, 76, 172, 144, 3, 30, 43, 217, 213, 89, 43]), - Bytes32::new_direct([200, 83, 93, 27, 98, 246, 87, 100, 53, 166, 89, 138, 157, 88, 148, 245, 61, 115, 246, 20, 142, 156, 54, 237, 179, 64, 148, 218, 67, 5, 142, 248]), - Bytes32::new_direct([159, 25, 150, 25, 114, 252, 162, 57, 21, 125, 147, 111, 220, 117, 17, 107, 40, 21, 157, 183, 6, 63, 226, 37, 64, 179, 133, 58, 107, 245, 78, 14]), - Bytes32::new_direct([58, 243, 16, 193, 174, 42, 255, 46, 40, 128, 26, 167, 173, 164, 71, 226, 155, 205, 26, 127, 154, 24, 74, 244, 106, 251, 25, 221, 197, 176, 194, 17]), - Bytes32::new_direct([51, 47, 251, 206, 27, 9, 142, 27, 253, 132, 189, 62, 109, 150, 246, 2, 137, 90, 157, 185, 59, 96, 0, 154, 29, 17, 231, 3, 84, 95, 49, 51]), - Bytes32::new_direct([250, 158, 158, 248, 206, 150, 95, 254, 53, 140, 80, 102, 67, 26, 76, 127, 236, 86, 182, 120, 72, 239, 190, 118, 60, 77, 28, 82, 152, 234, 73, 201]), - Bytes32::new_direct([255, 137, 155, 144, 74, 231, 231, 43, 187, 202, 137, 66, 205, 37, 40, 225, 0, 33, 87, 137, 113, 163, 58, 64, 147, 74, 123, 128, 19, 156, 46, 83]), - Bytes32::new_direct([207, 61, 79, 4, 202, 96, 238, 144, 154, 230, 145, 65, 230, 130, 246, 10, 140, 71, 66, 246, 53, 230, 148, 1, 248, 103, 145, 149, 157, 38, 169, 8]), - Bytes32::new_direct([33, 168, 110, 82, 84, 151, 70, 98, 115, 2, 221, 116, 210, 10, 247, 189, 203, 245, 186, 86, 121, 142, 218, 95, 68, 241, 21, 219, 131, 241, 185, 203]), - Bytes32::new_direct([125, 247, 7, 149, 181, 71, 68, 141, 123, 207, 144, 83, 170, 27, 244, 37, 210, 148, 0, 140, 144, 159, 237, 216, 227, 247, 85, 229, 80, 174, 40, 48]), - Bytes32::new_direct([0, 205, 68, 89, 77, 97, 204, 140, 113, 244, 168, 76, 49, 137, 236, 21, 132, 99, 10, 206, 195, 206, 208, 120, 227, 77, 21, 223, 145, 227, 48, 139]), - Bytes32::new_direct([10, 153, 106, 155, 149, 65, 211, 247, 246, 5, 129, 126, 74, 14, 113, 168, 152, 154, 205, 139, 49, 2, 182, 65, 163, 15, 62, 126, 62, 16, 26, 36]), - Bytes32::new_direct([24, 251, 204, 187, 179, 146, 114, 66, 110, 182, 131, 248, 36, 170, 169, 128, 22, 221, 134, 193, 121, 189, 128, 94, 83, 255, 226, 37, 133, 83, 220, 181]), - Bytes32::new_direct([25, 52, 245, 155, 53, 39, 73, 130, 12, 73, 106, 255, 44, 204, 208, 41, 32, 126, 159, 98, 197, 67, 58, 90, 6, 146, 25, 166, 195, 194, 215, 70]), - Bytes32::new_direct([194, 167, 206, 222, 96, 6, 86, 241, 95, 105, 225, 147, 99, 93, 201, 220, 166, 145, 4, 25, 168, 188, 21, 168, 80, 163, 132, 216, 239, 19, 115, 36]), - Bytes32::new_direct([243, 16, 4, 9, 140, 42, 62, 105, 97, 7, 4, 234, 200, 227, 42, 10, 51, 167, 38, 148, 69, 154, 143, 179, 94, 177, 248, 28, 33, 61, 166, 187]), - Bytes32::new_direct([156, 201, 97, 197, 223, 83, 229, 186, 187, 33, 49, 210, 181, 222, 180, 234, 150, 33, 99, 168, 157, 26, 241, 1, 213, 220, 165, 8, 31, 76, 134, 243]), - Bytes32::new_direct([34, 218, 29, 74, 212, 218, 95, 6, 53, 10, 63, 174, 119, 90, 90, 35, 92, 124, 169, 222, 75, 61, 199, 118, 132, 40, 193, 9, 250, 80, 12, 197]), - Bytes32::new_direct([102, 137, 75, 155, 181, 222, 86, 192, 140, 167, 3, 178, 212, 165, 49, 163, 86, 8, 76, 240, 32, 202, 34, 159, 217, 173, 101, 125, 237, 34, 48, 179]), - Bytes32::new_direct([136, 53, 156, 19, 107, 234, 210, 218, 180, 236, 9, 7, 80, 63, 146, 57, 77, 106, 135, 64, 23, 184, 9, 139, 61, 237, 225, 157, 183, 182, 137, 31]), - Bytes32::new_direct([237, 226, 115, 218, 228, 122, 45, 46, 67, 21, 130, 204, 80, 2, 28, 47, 148, 191, 28, 33, 177, 47, 207, 14, 33, 117, 28, 46, 88, 254, 97, 227]), - Bytes32::new_direct([38, 87, 252, 28, 105, 20, 117, 29, 234, 237, 60, 91, 48, 101, 219, 219, 24, 52, 169, 243, 71, 214, 117, 41, 207, 17, 148, 77, 218, 44, 122, 167]), - Bytes32::new_direct([235, 31, 185, 222, 3, 22, 222, 174, 126, 128, 55, 67, 201, 229, 55, 28, 241, 144, 184, 85, 141, 153, 183, 211, 66, 80, 152, 248, 214, 130, 64, 205]), - Bytes32::new_direct([52, 169, 226, 179, 195, 44, 245, 101, 35, 92, 145, 174, 152, 212, 192, 148, 241, 72, 248, 61, 239, 124, 98, 213, 181, 75, 84, 121, 57, 90, 172, 164]), - Bytes32::new_direct([27, 19, 12, 74, 128, 193, 65, 63, 15, 6, 174, 167, 79, 56, 88, 13, 117, 6, 189, 14, 11, 13, 133, 136, 141, 64, 74, 17, 159, 192, 251, 242]), - Bytes32::new_direct([101, 69, 132, 221, 127, 162, 162, 92, 248, 131, 39, 52, 169, 170, 231, 137, 123, 106, 161, 16, 202, 242, 216, 245, 211, 170, 74, 128, 108, 243, 166, 38]), - Bytes32::new_direct([157, 82, 193, 234, 117, 199, 118, 245, 63, 31, 186, 32, 135, 233, 29, 213, 217, 119, 208, 64, 149, 116, 117, 129, 211, 225, 207, 22, 225, 99, 194, 222]), - Bytes32::new_direct([112, 194, 64, 229, 154, 223, 109, 8, 191, 120, 32, 176, 154, 7, 174, 103, 2, 156, 230, 164, 245, 252, 0, 116, 213, 40, 20, 239, 135, 62, 198, 42]), - Bytes32::new_direct([32, 91, 5, 170, 221, 134, 167, 144, 16, 130, 237, 114, 71, 184, 131, 223, 92, 149, 161, 68, 196, 56, 73, 148, 203, 187, 174, 178, 178, 53, 156, 177]), - Bytes32::new_direct([234, 97, 64, 211, 81, 59, 14, 249, 38, 8, 247, 37, 243, 37, 88, 234, 19, 54, 146, 63, 88, 79, 127, 190, 144, 51, 240, 19, 15, 143, 18, 9]), - Bytes32::new_direct([247, 102, 43, 28, 24, 201, 189, 198, 66, 58, 210, 51, 174, 234, 52, 239, 37, 83, 212, 184, 127, 170, 168, 127, 47, 11, 248, 213, 84, 3, 201, 181]), - Bytes32::new_direct([126, 18, 116, 33, 129, 25, 247, 2, 162, 202, 103, 201, 237, 67, 28, 80, 46, 182, 163, 239, 90, 204, 47, 196, 137, 79, 19, 165, 209, 84, 140, 132]), - Bytes32::new_direct([189, 160, 148, 101, 82, 248, 215, 206, 90, 91, 205, 148, 37, 38, 172, 82, 223, 228, 66, 173, 220, 246, 194, 73, 231, 17, 220, 47, 222, 175, 7, 24]), - Bytes32::new_direct([237, 149, 54, 210, 99, 72, 182, 55, 69, 140, 161, 215, 104, 90, 104, 26, 216, 241, 232, 210, 37, 77, 56, 216, 6, 160, 199, 247, 164, 227, 142, 255]), - Bytes32::new_direct([11, 57, 131, 77, 203, 89, 156, 126, 200, 215, 103, 209, 70, 235, 78, 247, 0, 126, 209, 248, 220, 135, 158, 244, 141, 74, 6, 158, 19, 37, 42, 39]), - Bytes32::new_direct([107, 131, 231, 102, 64, 182, 78, 253, 77, 143, 94, 34, 199, 93, 44, 131, 169, 211, 71, 223, 53, 230, 59, 107, 146, 22, 188, 207, 210, 220, 168, 129]), - Bytes32::new_direct([78, 71, 246, 216, 154, 188, 152, 6, 234, 254, 21, 1, 128, 148, 56, 91, 250, 95, 76, 103, 15, 250, 137, 186, 114, 254, 122, 69, 208, 242, 69, 111]), - Bytes32::new_direct([82, 241, 242, 155, 248, 109, 84, 118, 225, 255, 122, 40, 3, 87, 20, 223, 212, 205, 141, 178, 32, 229, 234, 146, 101, 73, 79, 55, 28, 82, 81, 178]), - Bytes32::new_direct([35, 169, 243, 198, 215, 220, 113, 91, 6, 79, 48, 201, 97, 143, 212, 34, 247, 46, 38, 93, 166, 213, 158, 218, 61, 86, 240, 149, 224, 174, 225, 73]), - Bytes32::new_direct([25, 108, 21, 212, 193, 192, 96, 39, 57, 72, 193, 99, 239, 0, 231, 83, 183, 195, 105, 33, 220, 187, 18, 148, 43, 30, 42, 127, 192, 240, 13, 224]), - Bytes32::new_direct([119, 117, 186, 31, 43, 128, 143, 25, 182, 135, 156, 58, 152, 81, 70, 116, 171, 137, 125, 157, 152, 163, 34, 65, 240, 178, 12, 24, 168, 111, 39, 35]), + Bytes32::new_direct([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ]), + Bytes32::new_direct([ + 252, 178, 61, 5, 174, 66, 106, 30, 131, 163, 114, 90, 231, 83, 228, 153, 108, 255, 60, 37, + 254, 139, 153, 129, 208, 156, 109, 74, 233, 129, 174, 182, + ]), + Bytes32::new_direct([ + 128, 23, 154, 62, 181, 220, 154, 183, 222, 214, 79, 76, 162, 169, 179, 162, 185, 93, 179, + 115, 161, 55, 19, 63, 227, 168, 140, 66, 182, 6, 60, 120, + ]), + Bytes32::new_direct([ + 243, 119, 126, 55, 151, 128, 119, 12, 124, 84, 146, 243, 156, 68, 82, 174, 201, 162, 29, + 73, 29, 77, 103, 205, 194, 250, 45, 133, 39, 71, 224, 177, + ]), + Bytes32::new_direct([ + 209, 179, 222, 187, 184, 84, 131, 182, 172, 78, 20, 104, 236, 246, 114, 74, 55, 98, 29, 34, + 117, 249, 89, 76, 85, 38, 248, 193, 75, 10, 243, 100, + ]), + Bytes32::new_direct([ + 195, 14, 58, 139, 148, 140, 218, 174, 131, 204, 69, 84, 127, 8, 142, 88, 136, 83, 253, 241, + 74, 247, 143, 204, 38, 15, 138, 98, 47, 188, 255, 245, + ]), + Bytes32::new_direct([ + 167, 4, 177, 126, 159, 76, 19, 220, 160, 159, 81, 227, 110, 147, 179, 175, 253, 187, 46, + 24, 15, 168, 153, 84, 4, 167, 247, 225, 121, 175, 134, 85, + ]), + Bytes32::new_direct([ + 237, 144, 152, 155, 211, 100, 202, 187, 41, 181, 45, 224, 143, 139, 18, 77, 110, 34, 212, + 207, 239, 180, 73, 84, 166, 194, 22, 149, 89, 215, 86, 21, + ]), + Bytes32::new_direct([ + 226, 192, 91, 176, 242, 185, 212, 189, 178, 80, 238, 252, 183, 82, 220, 242, 22, 237, 84, + 142, 132, 91, 95, 219, 252, 171, 51, 76, 28, 146, 86, 155, + ]), + Bytes32::new_direct([ + 199, 200, 237, 66, 220, 14, 221, 121, 117, 150, 118, 36, 138, 142, 50, 173, 12, 195, 131, + 90, 27, 189, 247, 221, 89, 151, 41, 27, 135, 207, 137, 172, + ]), + Bytes32::new_direct([ + 160, 60, 124, 200, 56, 240, 67, 161, 121, 95, 247, 51, 153, 249, 125, 88, 231, 2, 85, 167, + 251, 187, 21, 103, 49, 132, 213, 52, 219, 30, 146, 59, + ]), + Bytes32::new_direct([ + 123, 52, 142, 254, 117, 160, 215, 99, 155, 130, 134, 183, 76, 99, 166, 246, 49, 51, 142, + 67, 116, 234, 69, 199, 201, 19, 70, 3, 208, 247, 40, 82, + ]), + Bytes32::new_direct([ + 165, 32, 183, 79, 246, 224, 220, 103, 11, 160, 233, 66, 129, 238, 194, 73, 17, 37, 128, + 185, 175, 88, 144, 228, 231, 185, 22, 17, 149, 174, 72, 1, + ]), + Bytes32::new_direct([ + 12, 24, 45, 128, 57, 246, 187, 176, 154, 247, 169, 18, 116, 176, 70, 246, 203, 141, 211, + 104, 5, 147, 78, 214, 161, 71, 33, 97, 7, 21, 158, 61, + ]), + Bytes32::new_direct([ + 215, 18, 110, 29, 36, 34, 133, 219, 15, 204, 206, 158, 186, 213, 181, 41, 184, 160, 71, + 165, 163, 121, 88, 106, 228, 58, 34, 105, 112, 168, 84, 123, + ]), + Bytes32::new_direct([ + 6, 169, 156, 220, 55, 53, 26, 229, 104, 60, 113, 111, 153, 18, 251, 234, 179, 159, 56, 14, + 112, 7, 144, 199, 45, 180, 116, 239, 21, 207, 173, 205, + ]), + Bytes32::new_direct([ + 24, 172, 76, 192, 21, 91, 250, 75, 196, 119, 231, 221, 13, 239, 113, 39, 62, 40, 165, 26, + 245, 16, 61, 106, 39, 28, 78, 212, 249, 230, 84, 108, + ]), + Bytes32::new_direct([ + 248, 34, 1, 62, 213, 235, 20, 21, 220, 78, 178, 126, 184, 102, 242, 50, 49, 174, 163, 122, + 166, 96, 40, 110, 78, 199, 89, 158, 155, 251, 233, 49, + ]), + Bytes32::new_direct([ + 103, 54, 133, 19, 189, 117, 46, 209, 17, 2, 64, 251, 77, 195, 197, 91, 38, 48, 214, 36, 96, + 255, 133, 87, 244, 101, 166, 218, 167, 129, 225, 167, + ]), + Bytes32::new_direct([ + 196, 159, 226, 85, 100, 246, 179, 251, 133, 33, 114, 51, 104, 245, 81, 54, 137, 126, 245, + 76, 112, 146, 139, 185, 190, 19, 106, 132, 48, 203, 34, 237, + ]), + Bytes32::new_direct([ + 41, 190, 7, 23, 227, 80, 13, 134, 244, 18, 215, 148, 1, 72, 1, 22, 91, 165, 182, 69, 160, + 179, 241, 106, 254, 116, 245, 131, 136, 35, 190, 226, + ]), + Bytes32::new_direct([ + 205, 132, 211, 121, 67, 210, 191, 102, 218, 92, 56, 204, 68, 160, 188, 100, 229, 80, 77, + 27, 26, 86, 248, 86, 216, 39, 242, 211, 183, 139, 219, 83, + ]), + Bytes32::new_direct([ + 13, 215, 68, 100, 180, 74, 23, 58, 157, 140, 76, 31, 114, 254, 85, 78, 234, 40, 251, 199, + 35, 204, 111, 243, 163, 64, 221, 21, 96, 55, 127, 118, + ]), + Bytes32::new_direct([ + 225, 14, 246, 105, 64, 96, 225, 200, 186, 66, 40, 253, 131, 80, 102, 178, 83, 22, 150, 32, + 15, 139, 76, 172, 144, 3, 30, 43, 217, 213, 89, 43, + ]), + Bytes32::new_direct([ + 200, 83, 93, 27, 98, 246, 87, 100, 53, 166, 89, 138, 157, 88, 148, 245, 61, 115, 246, 20, + 142, 156, 54, 237, 179, 64, 148, 218, 67, 5, 142, 248, + ]), + Bytes32::new_direct([ + 159, 25, 150, 25, 114, 252, 162, 57, 21, 125, 147, 111, 220, 117, 17, 107, 40, 21, 157, + 183, 6, 63, 226, 37, 64, 179, 133, 58, 107, 245, 78, 14, + ]), + Bytes32::new_direct([ + 58, 243, 16, 193, 174, 42, 255, 46, 40, 128, 26, 167, 173, 164, 71, 226, 155, 205, 26, 127, + 154, 24, 74, 244, 106, 251, 25, 221, 197, 176, 194, 17, + ]), + Bytes32::new_direct([ + 51, 47, 251, 206, 27, 9, 142, 27, 253, 132, 189, 62, 109, 150, 246, 2, 137, 90, 157, 185, + 59, 96, 0, 154, 29, 17, 231, 3, 84, 95, 49, 51, + ]), + Bytes32::new_direct([ + 250, 158, 158, 248, 206, 150, 95, 254, 53, 140, 80, 102, 67, 26, 76, 127, 236, 86, 182, + 120, 72, 239, 190, 118, 60, 77, 28, 82, 152, 234, 73, 201, + ]), + Bytes32::new_direct([ + 255, 137, 155, 144, 74, 231, 231, 43, 187, 202, 137, 66, 205, 37, 40, 225, 0, 33, 87, 137, + 113, 163, 58, 64, 147, 74, 123, 128, 19, 156, 46, 83, + ]), + Bytes32::new_direct([ + 207, 61, 79, 4, 202, 96, 238, 144, 154, 230, 145, 65, 230, 130, 246, 10, 140, 71, 66, 246, + 53, 230, 148, 1, 248, 103, 145, 149, 157, 38, 169, 8, + ]), + Bytes32::new_direct([ + 33, 168, 110, 82, 84, 151, 70, 98, 115, 2, 221, 116, 210, 10, 247, 189, 203, 245, 186, 86, + 121, 142, 218, 95, 68, 241, 21, 219, 131, 241, 185, 203, + ]), + Bytes32::new_direct([ + 125, 247, 7, 149, 181, 71, 68, 141, 123, 207, 144, 83, 170, 27, 244, 37, 210, 148, 0, 140, + 144, 159, 237, 216, 227, 247, 85, 229, 80, 174, 40, 48, + ]), + Bytes32::new_direct([ + 0, 205, 68, 89, 77, 97, 204, 140, 113, 244, 168, 76, 49, 137, 236, 21, 132, 99, 10, 206, + 195, 206, 208, 120, 227, 77, 21, 223, 145, 227, 48, 139, + ]), + Bytes32::new_direct([ + 10, 153, 106, 155, 149, 65, 211, 247, 246, 5, 129, 126, 74, 14, 113, 168, 152, 154, 205, + 139, 49, 2, 182, 65, 163, 15, 62, 126, 62, 16, 26, 36, + ]), + Bytes32::new_direct([ + 24, 251, 204, 187, 179, 146, 114, 66, 110, 182, 131, 248, 36, 170, 169, 128, 22, 221, 134, + 193, 121, 189, 128, 94, 83, 255, 226, 37, 133, 83, 220, 181, + ]), + Bytes32::new_direct([ + 25, 52, 245, 155, 53, 39, 73, 130, 12, 73, 106, 255, 44, 204, 208, 41, 32, 126, 159, 98, + 197, 67, 58, 90, 6, 146, 25, 166, 195, 194, 215, 70, + ]), + Bytes32::new_direct([ + 194, 167, 206, 222, 96, 6, 86, 241, 95, 105, 225, 147, 99, 93, 201, 220, 166, 145, 4, 25, + 168, 188, 21, 168, 80, 163, 132, 216, 239, 19, 115, 36, + ]), + Bytes32::new_direct([ + 243, 16, 4, 9, 140, 42, 62, 105, 97, 7, 4, 234, 200, 227, 42, 10, 51, 167, 38, 148, 69, + 154, 143, 179, 94, 177, 248, 28, 33, 61, 166, 187, + ]), + Bytes32::new_direct([ + 156, 201, 97, 197, 223, 83, 229, 186, 187, 33, 49, 210, 181, 222, 180, 234, 150, 33, 99, + 168, 157, 26, 241, 1, 213, 220, 165, 8, 31, 76, 134, 243, + ]), + Bytes32::new_direct([ + 34, 218, 29, 74, 212, 218, 95, 6, 53, 10, 63, 174, 119, 90, 90, 35, 92, 124, 169, 222, 75, + 61, 199, 118, 132, 40, 193, 9, 250, 80, 12, 197, + ]), + Bytes32::new_direct([ + 102, 137, 75, 155, 181, 222, 86, 192, 140, 167, 3, 178, 212, 165, 49, 163, 86, 8, 76, 240, + 32, 202, 34, 159, 217, 173, 101, 125, 237, 34, 48, 179, + ]), + Bytes32::new_direct([ + 136, 53, 156, 19, 107, 234, 210, 218, 180, 236, 9, 7, 80, 63, 146, 57, 77, 106, 135, 64, + 23, 184, 9, 139, 61, 237, 225, 157, 183, 182, 137, 31, + ]), + Bytes32::new_direct([ + 237, 226, 115, 218, 228, 122, 45, 46, 67, 21, 130, 204, 80, 2, 28, 47, 148, 191, 28, 33, + 177, 47, 207, 14, 33, 117, 28, 46, 88, 254, 97, 227, + ]), + Bytes32::new_direct([ + 38, 87, 252, 28, 105, 20, 117, 29, 234, 237, 60, 91, 48, 101, 219, 219, 24, 52, 169, 243, + 71, 214, 117, 41, 207, 17, 148, 77, 218, 44, 122, 167, + ]), + Bytes32::new_direct([ + 235, 31, 185, 222, 3, 22, 222, 174, 126, 128, 55, 67, 201, 229, 55, 28, 241, 144, 184, 85, + 141, 153, 183, 211, 66, 80, 152, 248, 214, 130, 64, 205, + ]), + Bytes32::new_direct([ + 52, 169, 226, 179, 195, 44, 245, 101, 35, 92, 145, 174, 152, 212, 192, 148, 241, 72, 248, + 61, 239, 124, 98, 213, 181, 75, 84, 121, 57, 90, 172, 164, + ]), + Bytes32::new_direct([ + 27, 19, 12, 74, 128, 193, 65, 63, 15, 6, 174, 167, 79, 56, 88, 13, 117, 6, 189, 14, 11, 13, + 133, 136, 141, 64, 74, 17, 159, 192, 251, 242, + ]), + Bytes32::new_direct([ + 101, 69, 132, 221, 127, 162, 162, 92, 248, 131, 39, 52, 169, 170, 231, 137, 123, 106, 161, + 16, 202, 242, 216, 245, 211, 170, 74, 128, 108, 243, 166, 38, + ]), + Bytes32::new_direct([ + 157, 82, 193, 234, 117, 199, 118, 245, 63, 31, 186, 32, 135, 233, 29, 213, 217, 119, 208, + 64, 149, 116, 117, 129, 211, 225, 207, 22, 225, 99, 194, 222, + ]), + Bytes32::new_direct([ + 112, 194, 64, 229, 154, 223, 109, 8, 191, 120, 32, 176, 154, 7, 174, 103, 2, 156, 230, 164, + 245, 252, 0, 116, 213, 40, 20, 239, 135, 62, 198, 42, + ]), + Bytes32::new_direct([ + 32, 91, 5, 170, 221, 134, 167, 144, 16, 130, 237, 114, 71, 184, 131, 223, 92, 149, 161, 68, + 196, 56, 73, 148, 203, 187, 174, 178, 178, 53, 156, 177, + ]), + Bytes32::new_direct([ + 234, 97, 64, 211, 81, 59, 14, 249, 38, 8, 247, 37, 243, 37, 88, 234, 19, 54, 146, 63, 88, + 79, 127, 190, 144, 51, 240, 19, 15, 143, 18, 9, + ]), + Bytes32::new_direct([ + 247, 102, 43, 28, 24, 201, 189, 198, 66, 58, 210, 51, 174, 234, 52, 239, 37, 83, 212, 184, + 127, 170, 168, 127, 47, 11, 248, 213, 84, 3, 201, 181, + ]), + Bytes32::new_direct([ + 126, 18, 116, 33, 129, 25, 247, 2, 162, 202, 103, 201, 237, 67, 28, 80, 46, 182, 163, 239, + 90, 204, 47, 196, 137, 79, 19, 165, 209, 84, 140, 132, + ]), + Bytes32::new_direct([ + 189, 160, 148, 101, 82, 248, 215, 206, 90, 91, 205, 148, 37, 38, 172, 82, 223, 228, 66, + 173, 220, 246, 194, 73, 231, 17, 220, 47, 222, 175, 7, 24, + ]), + Bytes32::new_direct([ + 237, 149, 54, 210, 99, 72, 182, 55, 69, 140, 161, 215, 104, 90, 104, 26, 216, 241, 232, + 210, 37, 77, 56, 216, 6, 160, 199, 247, 164, 227, 142, 255, + ]), + Bytes32::new_direct([ + 11, 57, 131, 77, 203, 89, 156, 126, 200, 215, 103, 209, 70, 235, 78, 247, 0, 126, 209, 248, + 220, 135, 158, 244, 141, 74, 6, 158, 19, 37, 42, 39, + ]), + Bytes32::new_direct([ + 107, 131, 231, 102, 64, 182, 78, 253, 77, 143, 94, 34, 199, 93, 44, 131, 169, 211, 71, 223, + 53, 230, 59, 107, 146, 22, 188, 207, 210, 220, 168, 129, + ]), + Bytes32::new_direct([ + 78, 71, 246, 216, 154, 188, 152, 6, 234, 254, 21, 1, 128, 148, 56, 91, 250, 95, 76, 103, + 15, 250, 137, 186, 114, 254, 122, 69, 208, 242, 69, 111, + ]), + Bytes32::new_direct([ + 82, 241, 242, 155, 248, 109, 84, 118, 225, 255, 122, 40, 3, 87, 20, 223, 212, 205, 141, + 178, 32, 229, 234, 146, 101, 73, 79, 55, 28, 82, 81, 178, + ]), + Bytes32::new_direct([ + 35, 169, 243, 198, 215, 220, 113, 91, 6, 79, 48, 201, 97, 143, 212, 34, 247, 46, 38, 93, + 166, 213, 158, 218, 61, 86, 240, 149, 224, 174, 225, 73, + ]), + Bytes32::new_direct([ + 25, 108, 21, 212, 193, 192, 96, 39, 57, 72, 193, 99, 239, 0, 231, 83, 183, 195, 105, 33, + 220, 187, 18, 148, 43, 30, 42, 127, 192, 240, 13, 224, + ]), + Bytes32::new_direct([ + 119, 117, 186, 31, 43, 128, 143, 25, 182, 135, 156, 58, 152, 81, 70, 116, 171, 137, 125, + 157, 152, 163, 34, 65, 240, 178, 12, 24, 168, 111, 39, 35, + ]), ]; +pub const EMPTY_HASH: &Bytes32 = &Bytes32::new_direct([0; 32]); + pub const ZERO_HASHES: &[&[Bytes32; 64]; 7] = &[ VALUE_HASHES, FUNCTION_HASHES, @@ -477,4 +1823,4 @@ pub const ZERO_HASHES: &[&[Bytes32; 64]; 7] = &[ TABLE_HASHES, TABLE_ELEMENT_HASHES, MODULE_HASHES, -]; \ No newline at end of file +]; From b14bc8fa588ebbbea161977a731278ffdee17f16 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 2 May 2024 19:14:54 +0200 Subject: [PATCH 040/140] Fix the merkle_bench. Those pesky shift operators. --- arbitrator/prover/benches/merkle_bench.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs index ee8905964f..a5f3059f97 100644 --- a/arbitrator/prover/benches/merkle_bench.rs +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -44,8 +44,8 @@ fn merkle_benchmark(c: &mut Criterion) { fn merkle_construction(c: &mut Criterion) { let mut rng = rand::thread_rng(); - let mut leaves: Vec = Vec::with_capacity(1 >> 20); - for _ in 0..(1 >> 20) { + let mut leaves: Vec = Vec::with_capacity(1 << 20); + for _ in 0..(1 << 20) { leaves.push(Bytes32::from([rng.gen_range(0u8..9); 32])); } From 0a31e538fcb78d6b26ab958d96a4722fdd7b079f Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 2 May 2024 19:56:30 +0200 Subject: [PATCH 041/140] Maybe 10x performance improvement. This change has the internal mutability implemented with the `Arc>` pattern as well as changing the `memory.rs` to no longer pre-allocate the empty hashes for all of the memory it wants to consume. There is still some inefficency in that the `Merkle::resize()` method is still allocating a bunch of actual leaf entries when it doesn't need to. We should be allocating those when needed by the `Merkle::set` calls. It's also possible that this code doesn't actually work when tied into a real machine. Testing that next. --- arbitrator/bench/src/bin.rs | 1 + arbitrator/prover/src/memory.rs | 22 +++---- arbitrator/prover/src/merkle.rs | 110 +++++++++++++++++++++++++++++++- 3 files changed, 117 insertions(+), 16 deletions(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 23930652c2..a46614bedb 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -33,6 +33,7 @@ struct Args { fn main() -> eyre::Result<()> { let args = Args::parse(); + // let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; if args.always_merkleize { println!("Running benchmark with always merkleize feature on"); diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 72407b15c7..36b5fd1175 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -111,22 +111,19 @@ impl Memory { #[cfg(not(feature = "rayon"))] let leaf_hashes = self.buffer.chunks(Self::LEAF_SIZE); - let mut leaf_hashes: Vec = leaf_hashes + let leaf_hashes: Vec = leaf_hashes .map(|leaf| { let mut full_leaf = [0u8; 32]; full_leaf[..leaf.len()].copy_from_slice(leaf); hash_leaf(full_leaf) }) .collect(); - if leaf_hashes.len() < leaves { - let empty_hash = hash_leaf([0u8; 32]); - leaf_hashes.resize(leaves, empty_hash); + let size = leaf_hashes.len(); + let mut m = Merkle::new_advanced(MerkleType::Memory, leaf_hashes, Self::MEMORY_LAYERS); + if size < leaves { + m.resize(leaves).expect("Couldn't resize merkle tree"); } - Cow::Owned(Merkle::new_advanced( - MerkleType::Memory, - leaf_hashes, - Self::MEMORY_LAYERS, - )) + Cow::Owned(m) } pub fn get_leaf_data(&self, leaf_idx: usize) -> [u8; Self::LEAF_SIZE] { @@ -309,11 +306,10 @@ impl Memory { pub fn resize(&mut self, new_size: usize) { self.buffer.resize(new_size, 0); - if let Some(merkle) = self.merkle.take() { - let extra = new_size - merkle.len(); + if let Some(mut merkle) = self.merkle.take() { merkle - .extend(vec![hash_leaf([0u8; 32]); extra]) - .expect("Couldn't extend merkle tree"); + .resize(new_size) + .expect("Couldn't resize merkle tree"); self.merkle = Some(merkle); } } diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 90671bde17..854dffb995 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -184,6 +184,9 @@ fn hash_node(ty: MerkleType, a: impl AsRef<[u8]>, b: impl AsRef<[u8]>) -> Bytes3 #[inline] fn capacity(layers: &Vec>) -> usize { + if layers.is_empty() { + return 0; + } let base: usize = 2; base.pow((layers.len() - 1).try_into().unwrap()) } @@ -235,7 +238,7 @@ impl Merkle { pub fn new_advanced(ty: MerkleType, hashes: Vec, min_depth: usize) -> Merkle { #[cfg(feature = "counters")] NEW_COUNTERS[&ty].fetch_add(1, Ordering::Relaxed); - if hashes.is_empty() { + if hashes.is_empty() && min_depth == 0 { return Merkle::default(); } let mut depth = (hashes.len() as f64).log2().ceil() as usize; @@ -306,7 +309,6 @@ impl Merkle { // Returns the total number of leaves the tree can hold. #[inline] - #[cfg(test)] fn capacity(&self) -> usize { return capacity(self.layers.lock().unwrap().as_ref()); } @@ -410,6 +412,28 @@ impl Merkle { } Ok(layers[0].len()) } + + /// Resizes the number of leaves the tree can hold. + /// + /// The extra space is filled with empty hashes. + pub fn resize(&mut self, new_len: usize) -> Result { + if new_len > self.capacity() { + return Err( + "Cannot resize to a length greater than the capacity of the tree.".to_owned(), + ); + } + let mut layers = self.layers.lock().unwrap(); + let mut layer_size = new_len; + for (layer_i, layer) in layers.iter_mut().enumerate() { + layer.resize(layer_size, *empty_hash_at(self.ty, layer_i)); + layer_size = max(layer_size >> 1, 1); + } + let start = layers[0].len(); + for i in start..new_len { + self.dirty_layers.lock().unwrap()[0].insert(i); + } + Ok(layers[0].len()) + } } impl PartialEq for Merkle { @@ -525,6 +549,86 @@ fn extend_works() { merkle.prove(1).unwrap(); } +#[test] +fn resize_works() { + let hashes = vec![ + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + Bytes32::from([5; 32]), + ]; + let mut expected = hash_node( + MerkleType::Value, + hash_node( + MerkleType::Value, + hash_node( + MerkleType::Value, + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + ), + ), + hash_node( + MerkleType::Value, + hash_node( + MerkleType::Value, + Bytes32::from([5; 32]), + Bytes32::from([0; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([0; 32]), + Bytes32::from([0; 32]), + ), + ), + ); + let mut merkle = Merkle::new(MerkleType::Value, hashes.clone()); + assert_eq!(merkle.capacity(), 8); + assert_eq!(merkle.root(), expected); + + let new_size = match merkle.resize(6) { + Ok(size) => size, + Err(e) => panic!("{}", e), + }; + assert_eq!(new_size, 6); + merkle.set(5, Bytes32::from([6; 32])); + expected = hash_node( + MerkleType::Value, + hash_node( + MerkleType::Value, + hash_node( + MerkleType::Value, + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + ), + ), + hash_node( + MerkleType::Value, + hash_node( + MerkleType::Value, + Bytes32::from([5; 32]), + Bytes32::from([6; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([0; 32]), + Bytes32::from([0; 32]), + ), + ), + ); + assert_eq!(merkle.root(), expected); +} + #[test] fn correct_capacity() { let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::from([1; 32])]); @@ -536,7 +640,7 @@ fn correct_capacity() { #[test] #[should_panic(expected = "index out of bounds")] fn set_with_bad_index_panics() { - let mut merkle = Merkle::new( + let merkle = Merkle::new( MerkleType::Value, vec![Bytes32::default(), Bytes32::default()], ); From 19fcd64f8fde5635880395588a541b7b41b0c71f Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 2 May 2024 22:20:01 +0200 Subject: [PATCH 042/140] Update the zerohashes to use the ones from memory.rs. Before this change, the MerkleType::MEMORY was loosely coupled to the Memory class. But, the Memory::merkleize() method was doing a lot of work to pass in a long vector of empty leaf hashes, and overriding the default empty node's hash. This change makes it the responsibility of the zerohashes constants to know what the correct empty node hashes are for each layer in a MEMORY merkle tree. But, that just happens to be the same value that the Memory::merkleize method would have used if it were allowed to specify it. This way, the code doesn't break backward compatibility with anywhere the old values were stored. --- arbitrator/prover/src/memory.rs | 14 ++ arbitrator/prover/src/merkle.rs | 31 ++- arbitrator/prover/src/merkle/zerohashes.rs | 257 +++++++++++---------- 3 files changed, 172 insertions(+), 130 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 36b5fd1175..576770fde6 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -319,6 +319,20 @@ impl Memory { mod test { use crate::memory::round_up_to_power_of_two; + #[test] + pub fn empty_leaf_hash() { + let leaf = [0u8; 32]; + let hash = super::hash_leaf(leaf); + print!("Bytes32::new_direct(["); + for i in 0..32 { + print!("{}", hash[i]); + if i < 31 { + print!(", "); + } + } + print!("]);"); + } + #[test] pub fn test_round_up_power_of_two() { assert_eq!(round_up_to_power_of_two(0), 1); diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 854dffb995..560c514ced 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -3,12 +3,12 @@ use arbutil::Bytes32; use digest::Digest; -use itertools::sorted; use enum_iterator::Sequence; #[cfg(feature = "counters")] use enum_iterator::all; +use itertools::Itertools; use std::cmp::max; @@ -274,7 +274,7 @@ impl Merkle { for layer_i in 1..layers.len() { let dirty_i = layer_i - 1; let dirt = dirty_layers[dirty_i].clone(); - for idx in sorted(dirt.iter()) { + for idx in dirt.iter().sorted() { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; let left = layers[layer_i - 1][left_child_idx]; @@ -334,6 +334,7 @@ impl Merkle { /// creates a merkle proof regardless of if the leaf has content #[must_use] pub fn prove_any(&self, mut idx: usize) -> Vec { + self.rehash(); let layers = self.layers.lock().unwrap(); let mut proof = vec![u8::try_from(layers.len() - 1).unwrap()]; for (layer_i, layer) in layers.iter().enumerate() { @@ -637,6 +638,32 @@ fn correct_capacity() { assert_eq!(merkle.capacity(), 1024); } +#[test] +#[ignore = "This is just used for generating the zero hashes for the memory merkle trees."] +fn emit_memory_zerohashes() { + // The following code was generated from the empty_leaf_hash() test in the memory package. + let mut left = Bytes32::new_direct([ + 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, + 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, + ]); + let mut right = Bytes32::new_direct([ + 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, + 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, + ]); + for _ in 0..64 { + print!("Bytes32::new_direct(["); + for i in 0..32 { + print!("{}", left[i]); + if i < 31 { + print!(", "); + } + } + println!("]),"); + left = hash_node(MerkleType::Memory, left, right); + right = hash_node(MerkleType::Memory, left, right); + } +} + #[test] #[should_panic(expected = "index out of bounds")] fn set_with_bad_index_panics() { diff --git a/arbitrator/prover/src/merkle/zerohashes.rs b/arbitrator/prover/src/merkle/zerohashes.rs index acb5757d61..16a4bd8457 100644 --- a/arbitrator/prover/src/merkle/zerohashes.rs +++ b/arbitrator/prover/src/merkle/zerohashes.rs @@ -777,262 +777,263 @@ const INSTRUCTION_HASHES: &[Bytes32; 64] = &[ ]), ]; +/// These have been pre-calculated to match the current implementation of Memory::hash_leaf. const MEMORY_HASHES: &[Bytes32; 64] = &[ Bytes32::new_direct([ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, + 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, + 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, ]), Bytes32::new_direct([ - 66, 208, 130, 169, 194, 116, 5, 27, 68, 75, 235, 175, 164, 169, 41, 91, 88, 134, 51, 194, - 219, 201, 182, 199, 1, 52, 173, 215, 20, 37, 51, 0, + 190, 70, 141, 125, 34, 236, 162, 217, 92, 130, 99, 237, 252, 176, 62, 93, 182, 71, 180, + 204, 178, 127, 225, 18, 119, 68, 89, 244, 245, 143, 151, 9, ]), Bytes32::new_direct([ - 90, 210, 50, 227, 58, 173, 147, 92, 139, 15, 127, 190, 196, 111, 142, 207, 31, 223, 70, 96, - 17, 251, 164, 200, 133, 0, 76, 35, 200, 9, 51, 218, + 138, 210, 20, 48, 168, 152, 201, 72, 74, 157, 83, 120, 248, 186, 217, 22, 74, 60, 199, 181, + 52, 97, 24, 26, 166, 215, 235, 19, 24, 173, 50, 5, ]), Bytes32::new_direct([ - 97, 5, 162, 226, 92, 108, 172, 8, 7, 65, 104, 176, 216, 3, 144, 47, 14, 88, 50, 101, 194, - 94, 10, 132, 192, 76, 37, 152, 42, 73, 30, 2, + 132, 142, 241, 159, 152, 112, 200, 35, 177, 158, 88, 170, 78, 253, 191, 235, 187, 54, 23, + 74, 119, 177, 79, 61, 245, 5, 125, 130, 89, 112, 8, 215, ]), Bytes32::new_direct([ - 68, 59, 208, 14, 89, 37, 33, 1, 177, 225, 235, 66, 129, 28, 103, 156, 46, 206, 94, 141, 33, - 152, 141, 26, 209, 161, 53, 237, 198, 163, 115, 57, + 232, 72, 169, 41, 1, 17, 49, 197, 245, 83, 27, 42, 83, 152, 126, 121, 123, 161, 152, 55, + 217, 150, 120, 17, 175, 27, 60, 133, 32, 99, 101, 250, ]), Bytes32::new_direct([ - 28, 94, 12, 53, 70, 163, 95, 44, 168, 42, 196, 126, 181, 231, 174, 247, 89, 100, 77, 238, - 211, 74, 116, 144, 183, 111, 254, 75, 30, 187, 228, 222, + 209, 26, 146, 121, 215, 34, 75, 215, 173, 237, 120, 5, 194, 146, 223, 43, 239, 13, 187, 30, + 20, 47, 249, 110, 83, 166, 67, 199, 182, 55, 163, 148, ]), Bytes32::new_direct([ - 238, 133, 50, 189, 14, 89, 244, 88, 239, 50, 172, 85, 172, 1, 131, 2, 24, 161, 70, 94, 0, - 204, 50, 199, 48, 107, 30, 70, 6, 8, 18, 90, + 135, 209, 119, 98, 227, 84, 19, 108, 100, 236, 155, 117, 164, 95, 218, 166, 179, 7, 107, + 113, 206, 187, 188, 255, 134, 99, 57, 190, 193, 203, 40, 160, ]), Bytes32::new_direct([ - 165, 239, 71, 173, 192, 165, 25, 35, 4, 130, 148, 158, 177, 193, 129, 45, 115, 209, 7, 233, - 136, 108, 245, 126, 74, 200, 22, 204, 190, 137, 191, 105, + 32, 32, 24, 177, 70, 250, 175, 6, 212, 200, 28, 52, 130, 190, 221, 115, 130, 66, 87, 39, + 149, 242, 233, 170, 150, 241, 111, 201, 37, 170, 53, 157, ]), Bytes32::new_direct([ - 173, 102, 127, 73, 167, 249, 117, 26, 190, 231, 26, 60, 201, 138, 160, 182, 180, 44, 34, - 132, 171, 254, 91, 8, 167, 114, 188, 157, 181, 148, 169, 165, + 46, 83, 161, 19, 97, 192, 213, 207, 160, 235, 147, 29, 45, 186, 80, 204, 85, 149, 79, 64, + 242, 252, 127, 68, 37, 126, 65, 219, 105, 166, 239, 58, ]), Bytes32::new_direct([ - 71, 62, 70, 89, 203, 1, 105, 187, 178, 167, 217, 118, 42, 217, 154, 234, 238, 109, 145, - 231, 247, 199, 40, 110, 162, 11, 173, 144, 103, 110, 99, 101, + 92, 232, 243, 48, 112, 221, 12, 155, 90, 24, 101, 39, 52, 148, 44, 192, 33, 241, 250, 139, + 215, 204, 3, 148, 172, 247, 133, 116, 34, 15, 96, 171, ]), Bytes32::new_direct([ - 121, 36, 94, 4, 25, 134, 16, 98, 198, 109, 123, 42, 56, 151, 224, 7, 232, 155, 231, 154, - 229, 162, 250, 149, 231, 198, 0, 65, 17, 27, 181, 28, + 178, 251, 194, 203, 145, 18, 131, 236, 77, 185, 182, 102, 222, 1, 0, 200, 162, 94, 165, + 131, 73, 210, 194, 149, 123, 198, 77, 105, 40, 162, 188, 220, ]), Bytes32::new_direct([ - 247, 158, 162, 102, 242, 117, 166, 252, 175, 158, 107, 157, 244, 44, 17, 99, 93, 52, 43, - 136, 5, 211, 32, 152, 91, 148, 41, 32, 231, 18, 237, 208, + 212, 120, 226, 169, 131, 103, 29, 244, 133, 118, 133, 194, 150, 180, 119, 78, 209, 199, + 231, 248, 150, 30, 208, 248, 202, 98, 173, 195, 192, 150, 207, 41, ]), Bytes32::new_direct([ - 147, 52, 155, 255, 81, 242, 75, 54, 54, 66, 166, 41, 131, 177, 183, 151, 229, 177, 232, 86, - 146, 137, 106, 68, 226, 117, 20, 210, 224, 170, 249, 68, + 2, 68, 204, 114, 30, 60, 87, 24, 156, 226, 181, 122, 95, 226, 120, 216, 82, 237, 156, 142, + 190, 105, 2, 224, 55, 63, 204, 98, 216, 226, 141, 42, ]), Bytes32::new_direct([ - 160, 89, 180, 156, 119, 172, 38, 10, 97, 101, 64, 56, 98, 133, 199, 228, 58, 66, 139, 128, - 88, 140, 143, 85, 148, 167, 79, 75, 34, 45, 204, 68, + 11, 217, 134, 64, 229, 175, 220, 212, 248, 63, 138, 216, 241, 116, 151, 248, 104, 232, 207, + 232, 67, 106, 138, 62, 180, 178, 46, 83, 36, 101, 169, 244, ]), Bytes32::new_direct([ - 165, 233, 117, 3, 27, 56, 166, 16, 56, 132, 198, 32, 11, 149, 212, 98, 64, 236, 180, 106, - 174, 80, 122, 220, 102, 67, 67, 110, 67, 8, 48, 217, + 178, 176, 193, 132, 188, 190, 13, 56, 161, 182, 230, 231, 145, 233, 98, 31, 142, 60, 139, + 145, 38, 166, 104, 140, 244, 19, 236, 208, 164, 199, 195, 185, ]), Bytes32::new_direct([ - 113, 74, 209, 139, 250, 181, 182, 127, 178, 77, 17, 63, 79, 109, 145, 74, 52, 102, 125, - 154, 22, 241, 177, 177, 34, 189, 124, 22, 4, 200, 201, 76, + 90, 202, 183, 64, 67, 146, 97, 5, 29, 214, 222, 104, 152, 252, 74, 122, 100, 43, 41, 221, + 222, 25, 247, 226, 197, 190, 93, 192, 86, 114, 147, 131, ]), Bytes32::new_direct([ - 67, 7, 240, 151, 128, 149, 238, 113, 130, 127, 174, 223, 142, 124, 230, 10, 91, 89, 113, - 157, 230, 21, 213, 3, 146, 249, 26, 80, 239, 90, 4, 216, + 159, 87, 235, 78, 106, 222, 69, 92, 125, 102, 216, 34, 85, 52, 156, 187, 167, 111, 156, + 183, 215, 169, 246, 3, 194, 74, 194, 158, 239, 123, 204, 201, ]), Bytes32::new_direct([ - 152, 20, 80, 244, 232, 182, 1, 145, 31, 191, 46, 207, 83, 199, 209, 104, 0, 75, 106, 230, - 16, 98, 121, 127, 175, 78, 119, 154, 69, 55, 66, 169, + 79, 225, 161, 133, 98, 124, 23, 177, 237, 126, 97, 48, 89, 98, 189, 200, 80, 234, 250, 231, + 188, 89, 185, 167, 139, 37, 35, 24, 112, 253, 165, 232, ]), Bytes32::new_direct([ - 123, 50, 162, 158, 51, 112, 129, 232, 242, 158, 150, 72, 244, 40, 191, 63, 205, 61, 144, - 39, 65, 122, 28, 88, 253, 146, 29, 29, 15, 40, 122, 95, + 198, 248, 143, 133, 37, 221, 33, 117, 172, 103, 241, 199, 2, 137, 186, 107, 166, 47, 179, + 169, 221, 65, 254, 170, 206, 104, 117, 243, 169, 180, 252, 103, ]), Bytes32::new_direct([ - 231, 253, 202, 45, 165, 158, 212, 29, 104, 165, 209, 179, 188, 154, 89, 18, 216, 23, 140, - 66, 150, 49, 99, 200, 163, 155, 50, 9, 250, 22, 19, 203, + 227, 45, 217, 82, 36, 209, 164, 147, 113, 11, 26, 171, 37, 59, 161, 15, 217, 146, 38, 34, + 13, 149, 85, 67, 113, 115, 113, 192, 144, 255, 31, 227, ]), Bytes32::new_direct([ - 127, 172, 110, 243, 156, 134, 199, 15, 248, 216, 12, 196, 221, 66, 202, 186, 105, 197, 43, - 245, 46, 116, 251, 133, 111, 118, 56, 214, 157, 244, 187, 58, + 232, 69, 104, 93, 119, 165, 151, 208, 91, 19, 184, 192, 189, 65, 2, 101, 113, 11, 201, 57, + 76, 79, 177, 65, 72, 112, 203, 61, 33, 147, 104, 218, ]), Bytes32::new_direct([ - 181, 181, 163, 95, 7, 188, 245, 128, 161, 210, 137, 217, 103, 101, 120, 255, 47, 83, 102, - 68, 238, 195, 206, 105, 24, 150, 216, 50, 74, 6, 94, 95, + 53, 124, 30, 59, 195, 224, 250, 252, 201, 173, 143, 69, 253, 249, 201, 120, 178, 107, 234, + 244, 106, 3, 203, 223, 32, 193, 17, 23, 229, 108, 83, 83, ]), Bytes32::new_direct([ - 171, 250, 198, 40, 153, 26, 240, 152, 96, 169, 15, 123, 33, 155, 57, 172, 89, 205, 9, 65, - 45, 126, 155, 143, 224, 145, 25, 214, 19, 227, 213, 195, + 111, 38, 112, 152, 63, 120, 95, 83, 255, 53, 254, 22, 61, 218, 177, 18, 63, 73, 239, 119, + 109, 21, 2, 171, 152, 196, 246, 85, 251, 83, 141, 107, ]), Bytes32::new_direct([ - 44, 177, 244, 220, 119, 33, 203, 59, 209, 72, 28, 4, 210, 54, 86, 20, 119, 41, 45, 231, - 143, 104, 57, 206, 212, 222, 81, 62, 92, 221, 200, 32, + 12, 210, 136, 9, 253, 193, 146, 161, 74, 199, 75, 177, 83, 196, 149, 95, 8, 100, 216, 157, + 210, 237, 179, 35, 30, 78, 8, 22, 5, 167, 244, 106, ]), Bytes32::new_direct([ - 37, 200, 165, 195, 67, 224, 131, 227, 97, 54, 21, 233, 76, 186, 6, 122, 178, 131, 252, 59, - 97, 218, 239, 62, 124, 255, 201, 178, 241, 236, 4, 214, + 243, 71, 83, 219, 108, 40, 60, 96, 203, 129, 93, 149, 23, 152, 80, 88, 31, 214, 120, 50, + 178, 251, 197, 216, 50, 191, 146, 242, 107, 117, 120, 241, ]), Bytes32::new_direct([ - 77, 171, 229, 183, 46, 112, 203, 177, 89, 90, 64, 114, 109, 220, 32, 120, 41, 223, 72, 86, - 59, 211, 110, 17, 129, 112, 194, 186, 200, 92, 144, 49, + 131, 216, 197, 129, 234, 215, 44, 252, 0, 196, 182, 81, 58, 35, 73, 134, 221, 222, 183, 49, + 234, 120, 75, 197, 162, 30, 175, 200, 138, 50, 29, 53, ]), Bytes32::new_direct([ - 2, 198, 61, 112, 181, 185, 194, 114, 149, 63, 65, 76, 55, 179, 170, 62, 91, 112, 189, 100, - 13, 34, 98, 187, 85, 132, 202, 86, 47, 27, 236, 200, + 192, 239, 89, 211, 179, 226, 174, 23, 223, 197, 246, 12, 192, 241, 143, 221, 244, 36, 31, + 100, 254, 237, 147, 207, 173, 228, 9, 193, 51, 242, 18, 134, ]), Bytes32::new_direct([ - 164, 238, 109, 209, 155, 118, 236, 237, 84, 43, 56, 99, 51, 60, 116, 235, 100, 39, 163, - 105, 34, 93, 8, 187, 228, 213, 35, 200, 43, 8, 32, 68, + 77, 66, 182, 195, 7, 198, 199, 94, 24, 221, 103, 169, 91, 239, 34, 46, 177, 172, 213, 70, + 120, 32, 25, 101, 48, 214, 104, 125, 133, 90, 176, 242, ]), Bytes32::new_direct([ - 32, 220, 39, 200, 214, 245, 102, 200, 167, 204, 3, 54, 140, 126, 129, 35, 139, 60, 112, - 133, 52, 166, 162, 63, 119, 20, 2, 116, 132, 244, 246, 225, + 73, 194, 146, 182, 168, 1, 41, 95, 74, 146, 7, 16, 189, 96, 68, 218, 13, 28, 28, 126, 34, + 95, 188, 90, 36, 37, 123, 123, 53, 210, 23, 71, ]), Bytes32::new_direct([ - 5, 54, 145, 188, 188, 251, 36, 4, 103, 140, 229, 143, 83, 11, 77, 207, 57, 125, 51, 127, - 89, 130, 138, 193, 190, 17, 17, 23, 68, 168, 231, 106, + 160, 84, 92, 145, 163, 106, 94, 229, 208, 172, 17, 30, 90, 138, 5, 21, 70, 113, 113, 24, + 231, 220, 117, 38, 242, 226, 1, 63, 150, 13, 126, 125, ]), Bytes32::new_direct([ - 239, 112, 72, 74, 116, 134, 210, 24, 226, 242, 91, 113, 99, 59, 19, 7, 226, 215, 254, 220, - 14, 225, 75, 245, 11, 234, 138, 52, 195, 86, 79, 124, + 60, 239, 17, 50, 191, 31, 160, 151, 44, 128, 44, 89, 85, 11, 4, 91, 129, 104, 0, 4, 197, + 196, 189, 249, 73, 206, 63, 225, 7, 61, 107, 169, ]), Bytes32::new_direct([ - 187, 35, 132, 188, 162, 128, 96, 71, 124, 213, 251, 229, 73, 52, 187, 22, 166, 35, 214, 14, - 121, 189, 37, 5, 77, 54, 201, 51, 95, 179, 75, 229, + 254, 250, 117, 203, 85, 163, 150, 58, 59, 247, 98, 144, 14, 70, 100, 248, 28, 14, 157, 212, + 104, 137, 17, 133, 43, 206, 209, 152, 236, 229, 94, 67, ]), Bytes32::new_direct([ - 5, 54, 88, 42, 68, 200, 45, 209, 121, 70, 128, 8, 178, 212, 197, 39, 101, 90, 101, 111, 77, - 133, 13, 77, 19, 111, 113, 122, 222, 85, 180, 82, + 49, 191, 233, 164, 188, 247, 147, 203, 222, 173, 79, 244, 84, 143, 112, 144, 96, 96, 165, + 199, 199, 196, 229, 133, 15, 38, 219, 209, 133, 47, 199, 245, ]), Bytes32::new_direct([ - 34, 182, 144, 13, 35, 35, 79, 14, 239, 80, 21, 255, 67, 48, 210, 174, 159, 182, 239, 236, - 68, 46, 125, 105, 243, 202, 218, 64, 53, 94, 159, 253, + 164, 27, 202, 130, 161, 245, 153, 150, 235, 26, 152, 212, 54, 239, 71, 55, 172, 81, 226, + 79, 44, 110, 71, 168, 43, 210, 243, 189, 163, 3, 57, 199, ]), Bytes32::new_direct([ - 224, 189, 145, 186, 43, 169, 131, 161, 223, 161, 72, 72, 229, 97, 113, 233, 2, 250, 109, - 31, 19, 125, 57, 135, 144, 3, 187, 18, 102, 108, 232, 9, + 22, 164, 24, 66, 118, 132, 197, 4, 124, 220, 178, 135, 160, 220, 15, 3, 122, 35, 22, 59, + 233, 15, 104, 230, 58, 145, 34, 216, 88, 153, 185, 112, ]), Bytes32::new_direct([ - 68, 94, 11, 104, 95, 110, 179, 226, 157, 245, 113, 68, 44, 122, 17, 22, 244, 35, 248, 126, - 131, 192, 20, 169, 129, 236, 60, 54, 157, 30, 231, 36, + 0, 205, 118, 44, 73, 143, 223, 186, 81, 174, 155, 253, 228, 4, 180, 221, 161, 180, 52, 21, + 100, 245, 119, 27, 164, 117, 78, 83, 26, 44, 201, 86, ]), Bytes32::new_direct([ - 101, 198, 107, 156, 226, 8, 67, 168, 197, 91, 189, 166, 187, 16, 121, 93, 114, 243, 137, - 162, 125, 142, 50, 206, 160, 168, 165, 27, 207, 10, 22, 19, + 21, 129, 118, 136, 79, 243, 222, 252, 204, 71, 191, 92, 189, 137, 123, 186, 148, 64, 181, + 133, 153, 156, 200, 226, 208, 87, 198, 250, 41, 221, 24, 135, ]), Bytes32::new_direct([ - 222, 29, 134, 137, 98, 73, 58, 143, 166, 134, 210, 47, 68, 23, 214, 237, 241, 207, 226, 83, - 113, 222, 184, 139, 16, 1, 200, 56, 34, 208, 197, 152, + 91, 144, 142, 242, 140, 89, 186, 182, 117, 237, 219, 108, 171, 187, 73, 250, 44, 182, 218, + 198, 56, 95, 124, 63, 224, 243, 199, 197, 205, 91, 161, 154, ]), Bytes32::new_direct([ - 107, 200, 189, 222, 185, 32, 192, 130, 237, 238, 168, 137, 14, 94, 3, 26, 41, 238, 19, 119, - 207, 158, 25, 177, 116, 70, 170, 161, 141, 129, 16, 88, + 10, 144, 56, 15, 178, 20, 198, 125, 196, 91, 57, 157, 241, 65, 123, 5, 195, 57, 107, 168, + 237, 187, 21, 19, 152, 82, 237, 250, 93, 203, 146, 125, ]), Bytes32::new_direct([ - 131, 243, 131, 161, 236, 101, 108, 81, 59, 123, 150, 6, 250, 124, 103, 101, 75, 234, 98, - 223, 129, 87, 202, 59, 184, 173, 44, 191, 200, 30, 223, 66, + 156, 227, 136, 163, 205, 20, 145, 89, 169, 47, 18, 43, 3, 130, 215, 55, 252, 165, 93, 54, + 22, 147, 40, 204, 120, 21, 124, 192, 73, 196, 82, 220, ]), Bytes32::new_direct([ - 17, 226, 72, 31, 180, 33, 229, 83, 154, 39, 104, 45, 93, 117, 153, 249, 216, 127, 120, 182, - 4, 19, 169, 87, 127, 70, 7, 237, 80, 251, 220, 126, + 188, 197, 120, 225, 29, 24, 128, 255, 217, 132, 186, 180, 4, 188, 73, 228, 121, 32, 25, + 163, 176, 41, 243, 225, 186, 81, 164, 24, 79, 5, 35, 227, ]), Bytes32::new_direct([ - 88, 122, 134, 181, 173, 175, 100, 74, 28, 141, 45, 215, 245, 170, 222, 54, 106, 118, 146, - 59, 207, 251, 133, 155, 164, 75, 240, 208, 10, 185, 187, 163, + 84, 113, 19, 5, 166, 195, 71, 42, 97, 34, 54, 121, 3, 80, 24, 196, 230, 57, 170, 145, 165, + 196, 209, 152, 17, 90, 91, 119, 221, 26, 183, 235, ]), Bytes32::new_direct([ - 214, 1, 209, 99, 53, 101, 233, 225, 55, 171, 69, 200, 44, 144, 169, 11, 65, 85, 84, 158, - 233, 227, 37, 59, 42, 52, 153, 13, 0, 158, 122, 208, + 206, 130, 4, 187, 195, 196, 128, 242, 2, 78, 199, 54, 253, 218, 182, 101, 15, 43, 236, 20, + 21, 23, 21, 190, 66, 44, 26, 157, 0, 98, 237, 221, ]), Bytes32::new_direct([ - 124, 146, 1, 221, 33, 138, 233, 130, 184, 163, 121, 110, 95, 242, 123, 251, 110, 46, 41, - 197, 75, 145, 121, 95, 29, 1, 19, 19, 167, 220, 177, 153, + 34, 108, 26, 191, 92, 65, 54, 67, 122, 253, 14, 0, 206, 232, 154, 156, 115, 1, 138, 147, + 206, 80, 14, 100, 8, 45, 10, 59, 92, 161, 247, 128, ]), Bytes32::new_direct([ - 77, 38, 54, 170, 19, 128, 180, 248, 208, 75, 27, 53, 228, 104, 7, 216, 188, 186, 40, 84, - 87, 11, 121, 3, 175, 89, 49, 46, 191, 94, 80, 97, + 33, 254, 66, 47, 39, 246, 253, 139, 15, 24, 173, 65, 172, 180, 203, 209, 251, 63, 93, 61, + 194, 40, 92, 238, 254, 191, 131, 137, 96, 237, 145, 214, ]), Bytes32::new_direct([ - 134, 127, 37, 206, 212, 70, 146, 143, 81, 104, 140, 28, 135, 233, 171, 88, 18, 2, 148, 143, - 111, 208, 149, 138, 167, 84, 183, 100, 67, 181, 243, 135, + 169, 2, 98, 144, 126, 101, 115, 235, 191, 147, 27, 11, 155, 77, 246, 66, 111, 50, 255, 110, + 135, 0, 1, 215, 69, 149, 27, 216, 9, 73, 225, 38, ]), Bytes32::new_direct([ - 218, 16, 220, 189, 192, 237, 252, 168, 45, 33, 177, 81, 53, 115, 141, 190, 99, 138, 113, - 85, 60, 230, 244, 222, 205, 16, 152, 26, 185, 207, 114, 143, + 121, 40, 115, 164, 82, 28, 188, 24, 211, 118, 23, 80, 128, 153, 92, 58, 88, 216, 184, 149, + 223, 221, 166, 100, 194, 220, 229, 218, 38, 15, 248, 238, ]), Bytes32::new_direct([ - 9, 85, 193, 163, 186, 152, 83, 149, 29, 71, 50, 13, 175, 149, 184, 51, 246, 97, 20, 22, 57, - 201, 27, 72, 146, 19, 213, 102, 164, 148, 176, 45, + 161, 215, 55, 238, 78, 56, 105, 60, 180, 70, 67, 195, 251, 65, 176, 52, 192, 50, 125, 100, + 176, 29, 236, 254, 85, 70, 108, 72, 133, 198, 244, 252, ]), Bytes32::new_direct([ - 140, 94, 218, 31, 232, 0, 167, 218, 122, 119, 62, 179, 181, 51, 100, 6, 150, 159, 212, 207, - 160, 94, 212, 108, 225, 196, 190, 210, 145, 110, 120, 114, + 147, 181, 91, 230, 48, 95, 75, 51, 230, 110, 16, 100, 161, 179, 210, 224, 48, 188, 14, 253, + 193, 84, 146, 132, 154, 65, 156, 38, 186, 18, 140, 33, ]), Bytes32::new_direct([ - 152, 169, 229, 240, 162, 212, 61, 59, 167, 135, 124, 147, 212, 248, 177, 85, 243, 72, 150, - 127, 122, 60, 143, 125, 226, 186, 67, 219, 50, 112, 242, 212, + 165, 53, 235, 177, 241, 80, 162, 5, 0, 5, 194, 37, 194, 128, 139, 81, 10, 9, 183, 190, 253, + 249, 183, 68, 238, 65, 170, 118, 64, 27, 11, 247, ]), Bytes32::new_direct([ - 47, 244, 81, 140, 243, 189, 116, 0, 2, 158, 242, 188, 215, 90, 177, 37, 175, 221, 80, 226, - 209, 79, 2, 62, 112, 245, 1, 132, 7, 78, 0, 117, + 81, 161, 108, 242, 250, 24, 230, 19, 215, 71, 127, 99, 143, 60, 107, 94, 206, 84, 253, 61, + 95, 166, 61, 115, 36, 251, 200, 113, 53, 218, 238, 118, ]), Bytes32::new_direct([ - 247, 236, 252, 118, 6, 245, 132, 187, 48, 36, 77, 0, 167, 150, 109, 72, 234, 9, 224, 162, - 223, 191, 21, 19, 180, 201, 138, 56, 109, 97, 152, 170, + 180, 71, 94, 29, 235, 115, 230, 231, 127, 221, 61, 28, 254, 34, 168, 198, 147, 192, 145, + 149, 72, 14, 242, 199, 247, 163, 6, 170, 170, 81, 60, 117, ]), Bytes32::new_direct([ - 77, 23, 112, 52, 78, 204, 135, 173, 2, 206, 148, 200, 60, 155, 60, 179, 201, 111, 73, 138, - 76, 104, 79, 174, 190, 173, 42, 51, 38, 48, 237, 241, + 231, 128, 41, 88, 214, 20, 249, 173, 50, 99, 41, 24, 173, 180, 239, 242, 52, 140, 64, 196, + 136, 157, 70, 127, 249, 136, 95, 72, 17, 218, 147, 135, ]), Bytes32::new_direct([ - 117, 234, 73, 183, 4, 144, 12, 196, 78, 228, 178, 218, 206, 147, 147, 94, 190, 22, 22, 233, - 88, 118, 135, 55, 63, 29, 212, 38, 223, 160, 121, 230, + 16, 126, 81, 169, 209, 164, 223, 20, 51, 200, 127, 87, 33, 90, 84, 163, 27, 203, 109, 158, + 103, 139, 177, 230, 237, 200, 125, 185, 73, 209, 225, 105, ]), Bytes32::new_direct([ - 74, 138, 173, 10, 77, 129, 10, 115, 18, 90, 57, 215, 221, 171, 109, 152, 31, 219, 235, 122, - 189, 201, 210, 186, 52, 200, 81, 218, 112, 79, 80, 54, + 254, 57, 105, 93, 192, 211, 240, 133, 102, 82, 38, 36, 40, 35, 225, 251, 59, 12, 0, 90, + 218, 98, 80, 150, 194, 54, 149, 19, 121, 139, 133, 160, ]), Bytes32::new_direct([ - 189, 150, 224, 30, 110, 73, 249, 62, 100, 244, 206, 110, 206, 239, 233, 213, 61, 213, 65, - 139, 103, 19, 20, 123, 167, 65, 161, 165, 216, 217, 255, 248, + 86, 157, 112, 81, 110, 241, 241, 115, 223, 147, 236, 79, 102, 7, 28, 4, 221, 199, 177, 129, + 70, 220, 204, 33, 204, 224, 9, 73, 43, 147, 248, 254, ]), Bytes32::new_direct([ - 119, 71, 56, 219, 155, 139, 253, 40, 100, 132, 185, 98, 24, 34, 156, 225, 120, 176, 76, - 147, 31, 105, 245, 216, 165, 161, 89, 157, 246, 17, 251, 234, + 113, 250, 103, 109, 150, 73, 88, 15, 107, 161, 114, 23, 138, 205, 223, 15, 144, 152, 219, + 43, 48, 97, 105, 9, 222, 177, 245, 180, 239, 177, 101, 61, ]), Bytes32::new_direct([ - 192, 39, 162, 126, 222, 211, 173, 195, 198, 124, 1, 124, 140, 2, 252, 191, 185, 85, 10, - 125, 226, 7, 88, 221, 164, 13, 221, 74, 200, 7, 249, 177, + 242, 174, 251, 43, 179, 62, 244, 186, 120, 156, 215, 116, 63, 214, 52, 100, 224, 143, 85, + 232, 222, 219, 11, 174, 86, 254, 213, 157, 226, 186, 150, 230, ]), Bytes32::new_direct([ - 251, 226, 24, 5, 54, 89, 9, 93, 217, 202, 148, 172, 208, 197, 65, 172, 98, 96, 58, 194, 61, - 253, 157, 193, 135, 32, 206, 97, 133, 234, 199, 197, + 27, 85, 85, 232, 12, 198, 143, 163, 91, 98, 184, 35, 189, 211, 164, 22, 239, 190, 137, 112, + 91, 173, 225, 226, 70, 62, 72, 228, 24, 98, 76, 20, ]), Bytes32::new_direct([ - 130, 3, 195, 156, 210, 123, 23, 44, 223, 25, 153, 169, 250, 88, 127, 239, 206, 196, 156, - 143, 182, 185, 35, 77, 162, 48, 143, 64, 231, 129, 216, 185, + 13, 36, 217, 220, 17, 175, 152, 226, 44, 101, 141, 85, 241, 126, 202, 89, 228, 213, 87, 3, + 78, 54, 136, 22, 209, 245, 199, 223, 57, 24, 42, 27, ]), Bytes32::new_direct([ - 123, 201, 97, 230, 121, 13, 207, 138, 137, 3, 122, 92, 105, 155, 214, 204, 142, 18, 119, - 138, 135, 165, 249, 58, 184, 53, 27, 31, 109, 214, 176, 147, + 92, 133, 208, 68, 232, 200, 77, 193, 48, 118, 241, 188, 57, 119, 181, 243, 180, 9, 158, + 219, 40, 130, 128, 203, 246, 91, 33, 169, 153, 242, 169, 10, ]), Bytes32::new_direct([ - 46, 71, 246, 155, 247, 109, 236, 225, 147, 51, 250, 72, 97, 116, 162, 36, 115, 164, 80, 28, - 252, 238, 98, 92, 16, 66, 190, 208, 180, 39, 179, 211, + 181, 35, 6, 153, 249, 128, 73, 10, 93, 63, 85, 26, 13, 176, 129, 126, 131, 173, 175, 185, + 91, 127, 162, 93, 199, 126, 27, 12, 114, 120, 235, 76, ]), Bytes32::new_direct([ - 38, 76, 13, 227, 149, 18, 84, 170, 83, 231, 122, 59, 237, 66, 32, 171, 158, 251, 78, 156, - 186, 160, 29, 30, 207, 178, 16, 193, 221, 158, 49, 48, + 117, 84, 164, 120, 249, 77, 72, 94, 182, 107, 122, 35, 142, 16, 243, 149, 74, 84, 22, 0, 8, + 16, 194, 26, 33, 102, 122, 46, 226, 118, 82, 113, ]), Bytes32::new_direct([ - 166, 13, 210, 208, 250, 131, 27, 163, 99, 204, 199, 134, 152, 131, 28, 164, 8, 222, 176, - 200, 34, 40, 74, 188, 120, 46, 167, 44, 95, 199, 86, 225, + 226, 237, 125, 140, 144, 97, 153, 126, 209, 251, 156, 249, 109, 242, 202, 211, 140, 35, + 223, 224, 89, 200, 147, 112, 151, 147, 10, 75, 34, 110, 97, 204, ]), ]; From 9bca51b34ea9b27fa2b9908017dabfea1219b662 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 2 May 2024 22:30:27 +0200 Subject: [PATCH 043/140] Cleanup outdated comment. --- arbitrator/bench/src/bin.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index a46614bedb..23930652c2 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -33,7 +33,6 @@ struct Args { fn main() -> eyre::Result<()> { let args = Args::parse(); - // let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; if args.always_merkleize { println!("Running benchmark with always merkleize feature on"); From 13de7de0f804cd96c5dd75f08bb9681663ac3af1 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 2 May 2024 23:25:02 +0200 Subject: [PATCH 044/140] Remove the extend method. This change also improves the internal mutability contract by making resize take an immutable reference instead of a mutable one. --- arbitrator/prover/benches/merkle_bench.rs | 16 +--- arbitrator/prover/src/memory.rs | 4 +- arbitrator/prover/src/merkle.rs | 107 +--------------------- 3 files changed, 8 insertions(+), 119 deletions(-) diff --git a/arbitrator/prover/benches/merkle_bench.rs b/arbitrator/prover/benches/merkle_bench.rs index 69cdbd7427..98ac09a20e 100644 --- a/arbitrator/prover/benches/merkle_bench.rs +++ b/arbitrator/prover/benches/merkle_bench.rs @@ -3,17 +3,9 @@ use criterion::{criterion_group, criterion_main, Criterion}; use prover::merkle::{Merkle, MerkleType}; use rand::Rng; -fn extend_and_set_leavees(merkle: Merkle, rng: &mut rand::rngs::ThreadRng) { - let new_leaves = vec![ - Bytes32::from([6; 32]), - Bytes32::from([7; 32]), - Bytes32::from([8; 32]), - Bytes32::from([9; 32]), - Bytes32::from([10; 32]), - ]; - +fn resize_and_set_leaves(merkle: Merkle, rng: &mut rand::rngs::ThreadRng) { for _ in 0..100 { - merkle.extend(new_leaves.clone()).expect("extend failed"); + merkle.resize(merkle.len() + 5).expect("resize failed"); for _ in 0..(merkle.len() / 10) { let random_index = rng.gen_range(0..merkle.len()); merkle.set(random_index, Bytes32::from([rng.gen_range(0u8..9); 32])); @@ -33,10 +25,10 @@ fn merkle_benchmark(c: &mut Criterion) { ]; // Perform many calls to set leaves to new values - c.bench_function("extend_set_leaves_and_root", |b| { + c.bench_function("resize_set_leaves_and_root", |b| { b.iter(|| { let merkle = Merkle::new_advanced(MerkleType::Memory, leaves.clone(), 20); - extend_and_set_leavees(merkle.clone(), &mut rng); + resize_and_set_leaves(merkle.clone(), &mut rng); }) }); } diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 576770fde6..d894287db3 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -119,7 +119,7 @@ impl Memory { }) .collect(); let size = leaf_hashes.len(); - let mut m = Merkle::new_advanced(MerkleType::Memory, leaf_hashes, Self::MEMORY_LAYERS); + let m = Merkle::new_advanced(MerkleType::Memory, leaf_hashes, Self::MEMORY_LAYERS); if size < leaves { m.resize(leaves).expect("Couldn't resize merkle tree"); } @@ -306,7 +306,7 @@ impl Memory { pub fn resize(&mut self, new_size: usize) { self.buffer.resize(new_size, 0); - if let Some(mut merkle) = self.merkle.take() { + if let Some(merkle) = self.merkle.take() { merkle .resize(new_size) .expect("Couldn't resize merkle tree"); diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 560c514ced..827652757a 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -391,33 +391,10 @@ impl Merkle { self.dirty_layers.lock().unwrap()[0].insert(idx >> 1); } - /// Extends the leaves of the tree with the given hashes. - /// - /// Returns the new number of leaves in the tree. - /// Erorrs if the number of hashes plus the current leaves is greater than - /// the capacity of the tree. - pub fn extend(&self, hashes: Vec) -> Result { - let mut layers = self.layers.lock().unwrap(); - if hashes.len() > capacity(layers.as_ref()) - layers[0].len() { - return Err("Cannot extend with more leaves than the capicity of the tree.".to_owned()); - } - let mut idx = layers[0].len(); - let mut new_size = idx + hashes.len(); - for (layer_i, layer) in layers.iter_mut().enumerate() { - layer.resize(new_size, *empty_hash_at(self.ty, layer_i)); - new_size = max(new_size >> 1, 1); - } - for hash in hashes { - self.locked_set(&mut layers, idx, hash); - idx += 1; - } - Ok(layers[0].len()) - } - /// Resizes the number of leaves the tree can hold. /// /// The extra space is filled with empty hashes. - pub fn resize(&mut self, new_len: usize) -> Result { + pub fn resize(&self, new_len: usize) -> Result { if new_len > self.capacity() { return Err( "Cannot resize to a length greater than the capacity of the tree.".to_owned(), @@ -470,86 +447,6 @@ pub mod arc_mutex_sedre { } } -#[test] -fn extend_works() { - let hashes = vec![ - Bytes32::from([1; 32]), - Bytes32::from([2; 32]), - Bytes32::from([3; 32]), - Bytes32::from([4; 32]), - Bytes32::from([5; 32]), - ]; - let mut expected = hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - Bytes32::from([1; 32]), - Bytes32::from([2; 32]), - ), - hash_node( - MerkleType::Value, - Bytes32::from([3; 32]), - Bytes32::from([4; 32]), - ), - ), - hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - Bytes32::from([5; 32]), - Bytes32::from([0; 32]), - ), - hash_node( - MerkleType::Value, - Bytes32::from([0; 32]), - Bytes32::from([0; 32]), - ), - ), - ); - let merkle = Merkle::new(MerkleType::Value, hashes.clone()); - assert_eq!(merkle.capacity(), 8); - assert_eq!(merkle.root(), expected); - - let new_size = match merkle.extend(vec![Bytes32::from([6; 32])]) { - Ok(size) => size, - Err(e) => panic!("{}", e), - }; - assert_eq!(new_size, 6); - expected = hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - Bytes32::from([1; 32]), - Bytes32::from([2; 32]), - ), - hash_node( - MerkleType::Value, - Bytes32::from([3; 32]), - Bytes32::from([4; 32]), - ), - ), - hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - Bytes32::from([5; 32]), - Bytes32::from([6; 32]), - ), - hash_node( - MerkleType::Value, - Bytes32::from([0; 32]), - Bytes32::from([0; 32]), - ), - ), - ); - assert_eq!(merkle.root(), expected); - merkle.prove(1).unwrap(); -} - #[test] fn resize_works() { let hashes = vec![ @@ -588,7 +485,7 @@ fn resize_works() { ), ), ); - let mut merkle = Merkle::new(MerkleType::Value, hashes.clone()); + let merkle = Merkle::new(MerkleType::Value, hashes.clone()); assert_eq!(merkle.capacity(), 8); assert_eq!(merkle.root(), expected); From bc55504cf097e44867908b35c369947630fac929 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 3 May 2024 00:04:03 +0200 Subject: [PATCH 045/140] Add a test for serialization and make it pass. --- arbitrator/prover/src/merkle.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 827652757a..515adc1693 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -170,7 +170,7 @@ pub struct Merkle { #[serde(with = "arc_mutex_sedre")] layers: Arc>>>, min_depth: usize, - #[serde(skip)] + #[serde(with = "arc_mutex_sedre")] dirty_layers: Arc>>>, } @@ -561,6 +561,16 @@ fn emit_memory_zerohashes() { } } +#[test] +fn serialization_roundtrip() { + let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); + merkle.resize(4).expect("resize failed"); + merkle.set(3, Bytes32::from([2; 32])); + let serialized = bincode::serialize(&merkle).unwrap(); + let deserialized: Merkle = bincode::deserialize(&serialized).unwrap(); + assert_eq!(merkle, deserialized); +} + #[test] #[should_panic(expected = "index out of bounds")] fn set_with_bad_index_panics() { From 9ebd8ba5c3ea99dad410107295d0bd7257ba66e8 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 3 May 2024 17:13:33 +0200 Subject: [PATCH 046/140] Fix the bugged MEMORY_HASHES in the zerohashes.rs More specfically, the code that was generating them had a stupid bug. --- arbitrator/prover/src/memory.rs | 14 ++ arbitrator/prover/src/merkle.rs | 14 +- arbitrator/prover/src/merkle/zerohashes.rs | 248 ++++++++++----------- 3 files changed, 143 insertions(+), 133 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index d894287db3..4709c406a7 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -317,8 +317,22 @@ impl Memory { #[cfg(test)] mod test { + use arbutil::Bytes32; + use crate::memory::round_up_to_power_of_two; + use super::Memory; + + #[test] + pub fn fixed_memory_hash() { + let module_memory_hash = Bytes32::from([ + 86u8, 177, 192, 60, 217, 123, 221, 153, 118, 79, 229, 122, 210, 48, 187, 104, 40, 84, + 112, 63, 137, 86, 54, 2, 56, 118, 72, 158, 242, 225, 65, 80, + ]); + let memory = Memory::new(65536, 1); + assert_eq!(memory.hash(), module_memory_hash); + } + #[test] pub fn empty_leaf_hash() { let leaf = [0u8; 32]; diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 515adc1693..dc182419eb 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -539,25 +539,21 @@ fn correct_capacity() { #[ignore = "This is just used for generating the zero hashes for the memory merkle trees."] fn emit_memory_zerohashes() { // The following code was generated from the empty_leaf_hash() test in the memory package. - let mut left = Bytes32::new_direct([ + let mut empty_node = Bytes32::new_direct([ 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, - ]); - let mut right = Bytes32::new_direct([ - 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, - 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, - ]); + ]) + .clone(); for _ in 0..64 { print!("Bytes32::new_direct(["); for i in 0..32 { - print!("{}", left[i]); + print!("{}", empty_node[i]); if i < 31 { print!(", "); } } println!("]),"); - left = hash_node(MerkleType::Memory, left, right); - right = hash_node(MerkleType::Memory, left, right); + empty_node = hash_node(MerkleType::Memory, empty_node, empty_node); } } diff --git a/arbitrator/prover/src/merkle/zerohashes.rs b/arbitrator/prover/src/merkle/zerohashes.rs index 16a4bd8457..1eef9b8557 100644 --- a/arbitrator/prover/src/merkle/zerohashes.rs +++ b/arbitrator/prover/src/merkle/zerohashes.rs @@ -788,252 +788,252 @@ const MEMORY_HASHES: &[Bytes32; 64] = &[ 204, 178, 127, 225, 18, 119, 68, 89, 244, 245, 143, 151, 9, ]), Bytes32::new_direct([ - 138, 210, 20, 48, 168, 152, 201, 72, 74, 157, 83, 120, 248, 186, 217, 22, 74, 60, 199, 181, - 52, 97, 24, 26, 166, 215, 235, 19, 24, 173, 50, 5, + 9, 87, 12, 3, 155, 102, 114, 211, 160, 40, 161, 7, 3, 192, 11, 145, 241, 17, 215, 209, 18, + 230, 221, 198, 189, 52, 34, 224, 245, 121, 253, 194, ]), Bytes32::new_direct([ - 132, 142, 241, 159, 152, 112, 200, 35, 177, 158, 88, 170, 78, 253, 191, 235, 187, 54, 23, - 74, 119, 177, 79, 61, 245, 5, 125, 130, 89, 112, 8, 215, + 10, 61, 178, 250, 4, 50, 245, 174, 54, 189, 184, 161, 208, 164, 55, 145, 70, 4, 81, 28, + 129, 97, 216, 23, 41, 192, 91, 97, 9, 83, 1, 215, ]), Bytes32::new_direct([ - 232, 72, 169, 41, 1, 17, 49, 197, 245, 83, 27, 42, 83, 152, 126, 121, 123, 161, 152, 55, - 217, 150, 120, 17, 175, 27, 60, 133, 32, 99, 101, 250, + 244, 167, 192, 124, 155, 131, 227, 49, 180, 187, 181, 23, 114, 255, 114, 237, 129, 149, + 159, 244, 63, 138, 0, 237, 37, 38, 159, 106, 4, 153, 119, 255, ]), Bytes32::new_direct([ - 209, 26, 146, 121, 215, 34, 75, 215, 173, 237, 120, 5, 194, 146, 223, 43, 239, 13, 187, 30, - 20, 47, 249, 110, 83, 166, 67, 199, 182, 55, 163, 148, + 63, 174, 225, 251, 118, 10, 96, 200, 132, 107, 27, 128, 250, 62, 47, 221, 227, 241, 107, + 254, 3, 171, 26, 81, 199, 162, 154, 249, 154, 72, 185, 196, ]), Bytes32::new_direct([ - 135, 209, 119, 98, 227, 84, 19, 108, 100, 236, 155, 117, 164, 95, 218, 166, 179, 7, 107, - 113, 206, 187, 188, 255, 134, 99, 57, 190, 193, 203, 40, 160, + 89, 112, 167, 92, 33, 192, 100, 158, 137, 92, 61, 197, 73, 216, 188, 164, 72, 37, 5, 0, + 161, 144, 254, 18, 10, 4, 248, 174, 26, 5, 149, 142, ]), Bytes32::new_direct([ - 32, 32, 24, 177, 70, 250, 175, 6, 212, 200, 28, 52, 130, 190, 221, 115, 130, 66, 87, 39, - 149, 242, 233, 170, 150, 241, 111, 201, 37, 170, 53, 157, + 202, 243, 125, 81, 15, 253, 233, 83, 91, 186, 151, 205, 84, 225, 16, 241, 42, 27, 7, 15, + 143, 128, 189, 233, 206, 106, 21, 7, 96, 167, 149, 2, ]), Bytes32::new_direct([ - 46, 83, 161, 19, 97, 192, 213, 207, 160, 235, 147, 29, 45, 186, 80, 204, 85, 149, 79, 64, - 242, 252, 127, 68, 37, 126, 65, 219, 105, 166, 239, 58, + 155, 19, 224, 94, 41, 7, 172, 244, 76, 43, 181, 160, 220, 80, 64, 0, 140, 33, 238, 79, 87, + 43, 40, 34, 162, 57, 122, 232, 216, 48, 64, 114, ]), Bytes32::new_direct([ - 92, 232, 243, 48, 112, 221, 12, 155, 90, 24, 101, 39, 52, 148, 44, 192, 33, 241, 250, 139, - 215, 204, 3, 148, 172, 247, 133, 116, 34, 15, 96, 171, + 64, 199, 52, 187, 21, 58, 215, 47, 174, 163, 203, 89, 35, 199, 187, 86, 137, 145, 236, 145, + 66, 21, 218, 151, 88, 61, 109, 238, 61, 58, 215, 247, ]), Bytes32::new_direct([ - 178, 251, 194, 203, 145, 18, 131, 236, 77, 185, 182, 102, 222, 1, 0, 200, 162, 94, 165, - 131, 73, 210, 194, 149, 123, 198, 77, 105, 40, 162, 188, 220, + 197, 59, 74, 219, 191, 151, 46, 252, 54, 248, 228, 94, 22, 143, 69, 197, 114, 247, 37, 212, + 243, 158, 179, 192, 205, 50, 50, 36, 40, 130, 115, 247, ]), Bytes32::new_direct([ - 212, 120, 226, 169, 131, 103, 29, 244, 133, 118, 133, 194, 150, 180, 119, 78, 209, 199, - 231, 248, 150, 30, 208, 248, 202, 98, 173, 195, 192, 150, 207, 41, + 168, 115, 30, 246, 210, 241, 88, 129, 115, 193, 107, 199, 199, 35, 118, 28, 145, 183, 82, + 101, 162, 52, 67, 147, 208, 234, 115, 58, 40, 124, 16, 79, ]), Bytes32::new_direct([ - 2, 68, 204, 114, 30, 60, 87, 24, 156, 226, 181, 122, 95, 226, 120, 216, 82, 237, 156, 142, - 190, 105, 2, 224, 55, 63, 204, 98, 216, 226, 141, 42, + 253, 6, 238, 29, 37, 160, 45, 23, 26, 114, 137, 254, 44, 68, 147, 33, 212, 149, 16, 188, + 28, 174, 189, 22, 12, 228, 99, 101, 60, 248, 174, 34, ]), Bytes32::new_direct([ - 11, 217, 134, 64, 229, 175, 220, 212, 248, 63, 138, 216, 241, 116, 151, 248, 104, 232, 207, - 232, 67, 106, 138, 62, 180, 178, 46, 83, 36, 101, 169, 244, + 0, 89, 208, 120, 115, 63, 79, 9, 29, 16, 81, 231, 78, 251, 117, 98, 172, 207, 54, 97, 38, + 72, 37, 110, 102, 207, 38, 198, 165, 157, 208, 6, ]), Bytes32::new_direct([ - 178, 176, 193, 132, 188, 190, 13, 56, 161, 182, 230, 231, 145, 233, 98, 31, 142, 60, 139, - 145, 38, 166, 104, 140, 244, 19, 236, 208, 164, 199, 195, 185, + 193, 144, 83, 148, 50, 15, 138, 224, 145, 12, 222, 94, 88, 91, 151, 74, 180, 47, 102, 38, + 244, 38, 251, 13, 230, 130, 141, 133, 10, 194, 108, 211, ]), Bytes32::new_direct([ - 90, 202, 183, 64, 67, 146, 97, 5, 29, 214, 222, 104, 152, 252, 74, 122, 100, 43, 41, 221, - 222, 25, 247, 226, 197, 190, 93, 192, 86, 114, 147, 131, + 182, 202, 171, 144, 153, 127, 43, 239, 77, 89, 56, 144, 39, 180, 30, 164, 1, 120, 105, 55, + 21, 17, 147, 96, 185, 219, 67, 146, 86, 42, 44, 117, ]), Bytes32::new_direct([ - 159, 87, 235, 78, 106, 222, 69, 92, 125, 102, 216, 34, 85, 52, 156, 187, 167, 111, 156, - 183, 215, 169, 246, 3, 194, 74, 194, 158, 239, 123, 204, 201, + 240, 76, 90, 37, 238, 134, 53, 105, 125, 238, 19, 80, 162, 60, 63, 104, 193, 201, 233, 10, + 246, 175, 15, 167, 239, 50, 201, 138, 153, 127, 40, 247, ]), Bytes32::new_direct([ - 79, 225, 161, 133, 98, 124, 23, 177, 237, 126, 97, 48, 89, 98, 189, 200, 80, 234, 250, 231, - 188, 89, 185, 167, 139, 37, 35, 24, 112, 253, 165, 232, + 127, 96, 10, 125, 139, 9, 213, 13, 60, 75, 10, 85, 88, 169, 180, 24, 18, 171, 157, 161, + 252, 181, 178, 191, 227, 200, 140, 72, 205, 231, 67, 34, ]), Bytes32::new_direct([ - 198, 248, 143, 133, 37, 221, 33, 117, 172, 103, 241, 199, 2, 137, 186, 107, 166, 47, 179, - 169, 221, 65, 254, 170, 206, 104, 117, 243, 169, 180, 252, 103, + 8, 81, 79, 192, 81, 171, 28, 73, 80, 93, 207, 58, 0, 192, 109, 40, 59, 227, 148, 172, 144, + 146, 237, 103, 47, 77, 112, 155, 215, 125, 49, 205, ]), Bytes32::new_direct([ - 227, 45, 217, 82, 36, 209, 164, 147, 113, 11, 26, 171, 37, 59, 161, 15, 217, 146, 38, 34, - 13, 149, 85, 67, 113, 115, 113, 192, 144, 255, 31, 227, + 181, 244, 223, 157, 69, 161, 149, 150, 31, 65, 52, 113, 11, 233, 51, 145, 135, 161, 34, + 114, 133, 86, 133, 255, 161, 176, 170, 255, 21, 163, 146, 79, ]), Bytes32::new_direct([ - 232, 69, 104, 93, 119, 165, 151, 208, 91, 19, 184, 192, 189, 65, 2, 101, 113, 11, 201, 57, - 76, 79, 177, 65, 72, 112, 203, 61, 33, 147, 104, 218, + 251, 112, 107, 186, 121, 118, 206, 118, 164, 136, 208, 159, 220, 188, 218, 111, 190, 44, + 16, 16, 251, 116, 206, 236, 111, 184, 20, 247, 252, 129, 200, 164, ]), Bytes32::new_direct([ - 53, 124, 30, 59, 195, 224, 250, 252, 201, 173, 143, 69, 253, 249, 201, 120, 178, 107, 234, - 244, 106, 3, 203, 223, 32, 193, 17, 23, 229, 108, 83, 83, + 101, 111, 124, 218, 143, 90, 110, 65, 52, 118, 81, 72, 234, 164, 106, 84, 54, 136, 212, + 192, 46, 87, 56, 241, 227, 38, 37, 101, 250, 134, 254, 144, ]), Bytes32::new_direct([ - 111, 38, 112, 152, 63, 120, 95, 83, 255, 53, 254, 22, 61, 218, 177, 18, 63, 73, 239, 119, - 109, 21, 2, 171, 152, 196, 246, 85, 251, 83, 141, 107, + 209, 232, 185, 167, 159, 116, 4, 11, 114, 98, 71, 225, 233, 246, 135, 173, 175, 126, 125, + 101, 16, 27, 254, 198, 79, 21, 181, 120, 50, 139, 76, 4, ]), Bytes32::new_direct([ - 12, 210, 136, 9, 253, 193, 146, 161, 74, 199, 75, 177, 83, 196, 149, 95, 8, 100, 216, 157, - 210, 237, 179, 35, 30, 78, 8, 22, 5, 167, 244, 106, + 30, 122, 82, 142, 43, 26, 170, 27, 0, 177, 218, 106, 39, 13, 154, 151, 92, 47, 144, 113, + 173, 242, 169, 89, 230, 135, 188, 190, 57, 170, 66, 220, ]), Bytes32::new_direct([ - 243, 71, 83, 219, 108, 40, 60, 96, 203, 129, 93, 149, 23, 152, 80, 88, 31, 214, 120, 50, - 178, 251, 197, 216, 50, 191, 146, 242, 107, 117, 120, 241, + 39, 137, 200, 154, 57, 148, 82, 232, 82, 214, 232, 251, 187, 13, 253, 222, 184, 161, 144, + 231, 67, 116, 160, 231, 214, 47, 228, 88, 146, 14, 244, 108, ]), Bytes32::new_direct([ - 131, 216, 197, 129, 234, 215, 44, 252, 0, 196, 182, 81, 58, 35, 73, 134, 221, 222, 183, 49, - 234, 120, 75, 197, 162, 30, 175, 200, 138, 50, 29, 53, + 122, 9, 214, 205, 84, 161, 177, 137, 68, 9, 178, 177, 141, 219, 162, 109, 116, 124, 124, + 56, 189, 139, 28, 220, 98, 165, 217, 156, 157, 148, 43, 232, ]), Bytes32::new_direct([ - 192, 239, 89, 211, 179, 226, 174, 23, 223, 197, 246, 12, 192, 241, 143, 221, 244, 36, 31, - 100, 254, 237, 147, 207, 173, 228, 9, 193, 51, 242, 18, 134, + 83, 209, 1, 98, 176, 225, 170, 233, 144, 110, 148, 135, 159, 243, 202, 14, 201, 243, 218, + 255, 75, 90, 222, 25, 141, 148, 128, 132, 101, 8, 178, 180, ]), Bytes32::new_direct([ - 77, 66, 182, 195, 7, 198, 199, 94, 24, 221, 103, 169, 91, 239, 34, 46, 177, 172, 213, 70, - 120, 32, 25, 101, 48, 214, 104, 125, 133, 90, 176, 242, + 93, 131, 135, 74, 118, 43, 37, 103, 218, 116, 47, 5, 212, 230, 133, 11, 76, 199, 46, 91, + 17, 222, 122, 114, 166, 228, 113, 213, 31, 5, 32, 164, ]), Bytes32::new_direct([ - 73, 194, 146, 182, 168, 1, 41, 95, 74, 146, 7, 16, 189, 96, 68, 218, 13, 28, 28, 126, 34, - 95, 188, 90, 36, 37, 123, 123, 53, 210, 23, 71, + 230, 49, 245, 147, 146, 113, 214, 229, 67, 34, 234, 170, 14, 37, 33, 105, 12, 192, 127, + 177, 195, 70, 29, 44, 232, 191, 3, 56, 70, 40, 70, 69, ]), Bytes32::new_direct([ - 160, 84, 92, 145, 163, 106, 94, 229, 208, 172, 17, 30, 90, 138, 5, 21, 70, 113, 113, 24, - 231, 220, 117, 38, 242, 226, 1, 63, 150, 13, 126, 125, + 64, 48, 103, 64, 135, 164, 51, 233, 201, 62, 5, 28, 35, 183, 178, 104, 54, 238, 0, 58, 215, + 157, 29, 149, 57, 23, 224, 247, 85, 104, 240, 113, ]), Bytes32::new_direct([ - 60, 239, 17, 50, 191, 31, 160, 151, 44, 128, 44, 89, 85, 11, 4, 91, 129, 104, 0, 4, 197, - 196, 189, 249, 73, 206, 63, 225, 7, 61, 107, 169, + 12, 156, 88, 246, 58, 5, 82, 65, 113, 178, 127, 112, 138, 170, 91, 11, 79, 54, 122, 65, 87, + 104, 104, 93, 134, 176, 56, 5, 139, 142, 73, 54, ]), Bytes32::new_direct([ - 254, 250, 117, 203, 85, 163, 150, 58, 59, 247, 98, 144, 14, 70, 100, 248, 28, 14, 157, 212, - 104, 137, 17, 133, 43, 206, 209, 152, 236, 229, 94, 67, + 92, 41, 81, 165, 165, 210, 34, 91, 127, 46, 250, 148, 104, 192, 211, 77, 108, 49, 111, 57, + 161, 242, 142, 46, 100, 47, 24, 24, 51, 219, 92, 186, ]), Bytes32::new_direct([ - 49, 191, 233, 164, 188, 247, 147, 203, 222, 173, 79, 244, 84, 143, 112, 144, 96, 96, 165, - 199, 199, 196, 229, 133, 15, 38, 219, 209, 133, 47, 199, 245, + 201, 120, 116, 179, 124, 183, 117, 97, 200, 35, 138, 235, 77, 177, 138, 42, 47, 58, 69, + 188, 70, 2, 71, 95, 51, 233, 69, 14, 22, 24, 195, 153, ]), Bytes32::new_direct([ - 164, 27, 202, 130, 161, 245, 153, 150, 235, 26, 152, 212, 54, 239, 71, 55, 172, 81, 226, - 79, 44, 110, 71, 168, 43, 210, 243, 189, 163, 3, 57, 199, + 249, 189, 13, 189, 45, 69, 100, 141, 50, 145, 24, 54, 91, 45, 125, 223, 181, 222, 63, 49, + 66, 49, 106, 175, 55, 85, 112, 25, 69, 187, 44, 171, ]), Bytes32::new_direct([ - 22, 164, 24, 66, 118, 132, 197, 4, 124, 220, 178, 135, 160, 220, 15, 3, 122, 35, 22, 59, - 233, 15, 104, 230, 58, 145, 34, 216, 88, 153, 185, 112, + 86, 114, 135, 219, 78, 73, 34, 205, 239, 144, 56, 231, 164, 101, 129, 115, 51, 167, 158, + 96, 1, 241, 178, 216, 54, 84, 97, 185, 200, 239, 215, 7, ]), Bytes32::new_direct([ - 0, 205, 118, 44, 73, 143, 223, 186, 81, 174, 155, 253, 228, 4, 180, 221, 161, 180, 52, 21, - 100, 245, 119, 27, 164, 117, 78, 83, 26, 44, 201, 86, + 35, 232, 131, 249, 70, 6, 185, 10, 58, 53, 72, 254, 74, 166, 76, 41, 122, 234, 77, 61, 16, + 39, 26, 66, 102, 78, 102, 159, 55, 113, 195, 19, ]), Bytes32::new_direct([ - 21, 129, 118, 136, 79, 243, 222, 252, 204, 71, 191, 92, 189, 137, 123, 186, 148, 64, 181, - 133, 153, 156, 200, 226, 208, 87, 198, 250, 41, 221, 24, 135, + 204, 120, 229, 250, 86, 164, 18, 58, 82, 11, 112, 225, 76, 253, 63, 35, 245, 72, 81, 254, + 193, 182, 255, 159, 200, 120, 135, 60, 253, 180, 185, 112, ]), Bytes32::new_direct([ - 91, 144, 142, 242, 140, 89, 186, 182, 117, 237, 219, 108, 171, 187, 73, 250, 44, 182, 218, - 198, 56, 95, 124, 63, 224, 243, 199, 197, 205, 91, 161, 154, + 35, 194, 73, 72, 85, 35, 3, 215, 21, 38, 67, 254, 195, 250, 173, 177, 156, 70, 47, 13, 178, + 120, 227, 214, 92, 71, 181, 40, 213, 43, 193, 147, ]), Bytes32::new_direct([ - 10, 144, 56, 15, 178, 20, 198, 125, 196, 91, 57, 157, 241, 65, 123, 5, 195, 57, 107, 168, - 237, 187, 21, 19, 152, 82, 237, 250, 93, 203, 146, 125, + 148, 91, 40, 131, 45, 85, 232, 203, 101, 47, 189, 225, 128, 118, 138, 12, 83, 98, 227, 166, + 192, 69, 188, 19, 84, 13, 162, 250, 65, 209, 47, 191, ]), Bytes32::new_direct([ - 156, 227, 136, 163, 205, 20, 145, 89, 169, 47, 18, 43, 3, 130, 215, 55, 252, 165, 93, 54, - 22, 147, 40, 204, 120, 21, 124, 192, 73, 196, 82, 220, + 100, 36, 35, 232, 157, 164, 39, 175, 77, 211, 19, 26, 20, 226, 226, 255, 121, 134, 19, 46, + 185, 213, 2, 4, 6, 92, 47, 239, 206, 240, 225, 58, ]), Bytes32::new_direct([ - 188, 197, 120, 225, 29, 24, 128, 255, 217, 132, 186, 180, 4, 188, 73, 228, 121, 32, 25, - 163, 176, 41, 243, 225, 186, 81, 164, 24, 79, 5, 35, 227, + 121, 36, 6, 138, 185, 33, 130, 28, 55, 238, 127, 203, 99, 32, 56, 245, 237, 135, 207, 190, + 72, 243, 137, 32, 218, 103, 150, 171, 3, 246, 48, 225, ]), Bytes32::new_direct([ - 84, 113, 19, 5, 166, 195, 71, 42, 97, 34, 54, 121, 3, 80, 24, 196, 230, 57, 170, 145, 165, - 196, 209, 152, 17, 90, 91, 119, 221, 26, 183, 235, + 233, 56, 238, 34, 238, 134, 69, 104, 220, 255, 47, 202, 241, 144, 207, 249, 107, 153, 38, + 120, 101, 12, 177, 64, 151, 114, 146, 6, 227, 159, 40, 107, ]), Bytes32::new_direct([ - 206, 130, 4, 187, 195, 196, 128, 242, 2, 78, 199, 54, 253, 218, 182, 101, 15, 43, 236, 20, - 21, 23, 21, 190, 66, 44, 26, 157, 0, 98, 237, 221, + 237, 115, 194, 93, 160, 113, 23, 120, 250, 186, 21, 163, 155, 20, 179, 177, 55, 20, 24, 89, + 77, 113, 163, 0, 176, 130, 228, 133, 239, 122, 177, 65, ]), Bytes32::new_direct([ - 34, 108, 26, 191, 92, 65, 54, 67, 122, 253, 14, 0, 206, 232, 154, 156, 115, 1, 138, 147, - 206, 80, 14, 100, 8, 45, 10, 59, 92, 161, 247, 128, + 108, 150, 128, 44, 189, 57, 148, 254, 56, 134, 118, 165, 95, 15, 168, 179, 162, 252, 169, + 58, 223, 20, 38, 221, 25, 138, 101, 131, 32, 8, 2, 58, ]), Bytes32::new_direct([ - 33, 254, 66, 47, 39, 246, 253, 139, 15, 24, 173, 65, 172, 180, 203, 209, 251, 63, 93, 61, - 194, 40, 92, 238, 254, 191, 131, 137, 96, 237, 145, 214, + 154, 13, 160, 129, 192, 79, 86, 40, 135, 113, 123, 38, 53, 254, 62, 94, 255, 14, 119, 4, + 102, 168, 200, 191, 112, 245, 29, 200, 164, 155, 141, 139, ]), Bytes32::new_direct([ - 169, 2, 98, 144, 126, 101, 115, 235, 191, 147, 27, 11, 155, 77, 246, 66, 111, 50, 255, 110, - 135, 0, 1, 215, 69, 149, 27, 216, 9, 73, 225, 38, + 238, 189, 209, 174, 202, 251, 240, 99, 133, 44, 221, 34, 17, 88, 220, 143, 188, 160, 235, + 121, 167, 96, 106, 249, 213, 176, 31, 84, 26, 144, 201, 89, ]), Bytes32::new_direct([ - 121, 40, 115, 164, 82, 28, 188, 24, 211, 118, 23, 80, 128, 153, 92, 58, 88, 216, 184, 149, - 223, 221, 166, 100, 194, 220, 229, 218, 38, 15, 248, 238, + 178, 186, 146, 221, 228, 41, 150, 76, 220, 216, 144, 64, 108, 178, 242, 120, 153, 191, 212, + 37, 114, 21, 30, 117, 45, 238, 46, 19, 132, 212, 112, 44, ]), Bytes32::new_direct([ - 161, 215, 55, 238, 78, 56, 105, 60, 180, 70, 67, 195, 251, 65, 176, 52, 192, 50, 125, 100, - 176, 29, 236, 254, 85, 70, 108, 72, 133, 198, 244, 252, + 191, 19, 180, 171, 125, 68, 104, 43, 66, 173, 194, 168, 213, 192, 117, 82, 167, 41, 139, + 133, 92, 103, 124, 85, 241, 66, 1, 154, 68, 72, 171, 80, ]), Bytes32::new_direct([ - 147, 181, 91, 230, 48, 95, 75, 51, 230, 110, 16, 100, 161, 179, 210, 224, 48, 188, 14, 253, - 193, 84, 146, 132, 154, 65, 156, 38, 186, 18, 140, 33, + 79, 215, 118, 157, 123, 16, 70, 30, 101, 234, 117, 41, 35, 186, 99, 5, 232, 45, 253, 142, + 185, 18, 172, 187, 36, 50, 218, 252, 111, 184, 158, 254, ]), Bytes32::new_direct([ - 165, 53, 235, 177, 241, 80, 162, 5, 0, 5, 194, 37, 194, 128, 139, 81, 10, 9, 183, 190, 253, - 249, 183, 68, 238, 65, 170, 118, 64, 27, 11, 247, + 17, 193, 206, 44, 67, 98, 171, 63, 78, 209, 71, 20, 196, 255, 64, 114, 191, 19, 246, 131, + 8, 105, 211, 169, 192, 114, 249, 240, 28, 55, 230, 143, ]), Bytes32::new_direct([ - 81, 161, 108, 242, 250, 24, 230, 19, 215, 71, 127, 99, 143, 60, 107, 94, 206, 84, 253, 61, - 95, 166, 61, 115, 36, 251, 200, 113, 53, 218, 238, 118, + 200, 94, 187, 80, 140, 194, 238, 35, 62, 228, 202, 122, 136, 119, 228, 133, 33, 147, 161, + 218, 94, 19, 207, 129, 48, 252, 242, 19, 56, 251, 92, 76, ]), Bytes32::new_direct([ - 180, 71, 94, 29, 235, 115, 230, 231, 127, 221, 61, 28, 254, 34, 168, 198, 147, 192, 145, - 149, 72, 14, 242, 199, 247, 163, 6, 170, 170, 81, 60, 117, + 223, 124, 52, 170, 180, 101, 70, 1, 153, 22, 178, 138, 181, 253, 35, 113, 159, 136, 77, 23, + 158, 62, 11, 48, 6, 185, 147, 81, 220, 191, 94, 3, ]), Bytes32::new_direct([ - 231, 128, 41, 88, 214, 20, 249, 173, 50, 99, 41, 24, 173, 180, 239, 242, 52, 140, 64, 196, - 136, 157, 70, 127, 249, 136, 95, 72, 17, 218, 147, 135, + 126, 124, 205, 157, 16, 239, 172, 241, 70, 70, 205, 98, 211, 8, 84, 204, 149, 9, 208, 56, + 122, 51, 224, 231, 200, 59, 41, 215, 141, 183, 91, 223, ]), Bytes32::new_direct([ - 16, 126, 81, 169, 209, 164, 223, 20, 51, 200, 127, 87, 33, 90, 84, 163, 27, 203, 109, 158, - 103, 139, 177, 230, 237, 200, 125, 185, 73, 209, 225, 105, + 20, 122, 156, 134, 248, 95, 140, 199, 59, 151, 120, 164, 109, 202, 165, 126, 108, 161, 8, + 253, 18, 35, 36, 83, 219, 162, 58, 83, 136, 57, 43, 35, ]), Bytes32::new_direct([ - 254, 57, 105, 93, 192, 211, 240, 133, 102, 82, 38, 36, 40, 35, 225, 251, 59, 12, 0, 90, - 218, 98, 80, 150, 194, 54, 149, 19, 121, 139, 133, 160, + 58, 175, 246, 31, 114, 109, 109, 219, 230, 129, 128, 99, 175, 228, 65, 148, 53, 233, 226, + 171, 44, 254, 222, 211, 200, 28, 193, 130, 251, 152, 160, 210, ]), Bytes32::new_direct([ - 86, 157, 112, 81, 110, 241, 241, 115, 223, 147, 236, 79, 102, 7, 28, 4, 221, 199, 177, 129, - 70, 220, 204, 33, 204, 224, 9, 73, 43, 147, 248, 254, + 177, 255, 19, 82, 14, 229, 84, 206, 156, 198, 252, 176, 126, 211, 226, 255, 154, 231, 131, + 158, 165, 154, 142, 166, 131, 221, 203, 30, 251, 205, 27, 217, ]), Bytes32::new_direct([ - 113, 250, 103, 109, 150, 73, 88, 15, 107, 161, 114, 23, 138, 205, 223, 15, 144, 152, 219, - 43, 48, 97, 105, 9, 222, 177, 245, 180, 239, 177, 101, 61, + 32, 168, 192, 93, 240, 173, 218, 42, 78, 215, 104, 243, 154, 2, 50, 159, 21, 176, 28, 59, + 29, 57, 193, 122, 32, 244, 91, 148, 91, 184, 126, 31, ]), Bytes32::new_direct([ - 242, 174, 251, 43, 179, 62, 244, 186, 120, 156, 215, 116, 63, 214, 52, 100, 224, 143, 85, - 232, 222, 219, 11, 174, 86, 254, 213, 157, 226, 186, 150, 230, + 28, 66, 164, 117, 43, 120, 84, 240, 48, 3, 55, 95, 44, 229, 231, 29, 217, 67, 49, 130, 110, + 209, 72, 71, 46, 208, 63, 81, 218, 98, 167, 207, ]), Bytes32::new_direct([ - 27, 85, 85, 232, 12, 198, 143, 163, 91, 98, 184, 35, 189, 211, 164, 22, 239, 190, 137, 112, - 91, 173, 225, 226, 70, 62, 72, 228, 24, 98, 76, 20, + 38, 192, 60, 175, 136, 217, 168, 69, 90, 236, 62, 137, 9, 116, 244, 151, 181, 57, 229, 198, + 100, 125, 114, 46, 80, 136, 150, 94, 225, 162, 170, 91, ]), Bytes32::new_direct([ - 13, 36, 217, 220, 17, 175, 152, 226, 44, 101, 141, 85, 241, 126, 202, 89, 228, 213, 87, 3, - 78, 54, 136, 22, 209, 245, 199, 223, 57, 24, 42, 27, + 121, 67, 11, 63, 56, 140, 67, 231, 175, 126, 41, 37, 252, 62, 35, 215, 250, 206, 190, 3, + 154, 83, 237, 174, 65, 86, 83, 251, 110, 8, 44, 216, ]), Bytes32::new_direct([ - 92, 133, 208, 68, 232, 200, 77, 193, 48, 118, 241, 188, 57, 119, 181, 243, 180, 9, 158, - 219, 40, 130, 128, 203, 246, 91, 33, 169, 153, 242, 169, 10, + 25, 251, 117, 251, 14, 64, 166, 211, 216, 123, 38, 1, 98, 19, 119, 194, 60, 234, 185, 148, + 118, 201, 4, 233, 69, 135, 13, 191, 8, 6, 136, 240, ]), Bytes32::new_direct([ - 181, 35, 6, 153, 249, 128, 73, 10, 93, 63, 85, 26, 13, 176, 129, 126, 131, 173, 175, 185, - 91, 127, 162, 93, 199, 126, 27, 12, 114, 120, 235, 76, + 137, 1, 201, 130, 166, 152, 216, 48, 178, 242, 46, 3, 66, 92, 4, 81, 11, 145, 205, 82, 253, + 102, 78, 6, 53, 13, 36, 171, 48, 75, 165, 153, ]), Bytes32::new_direct([ - 117, 84, 164, 120, 249, 77, 72, 94, 182, 107, 122, 35, 142, 16, 243, 149, 74, 84, 22, 0, 8, - 16, 194, 26, 33, 102, 122, 46, 226, 118, 82, 113, + 126, 38, 201, 183, 226, 145, 26, 196, 124, 127, 185, 12, 77, 198, 146, 16, 202, 189, 113, + 44, 100, 87, 81, 53, 172, 227, 97, 191, 120, 241, 86, 110, ]), Bytes32::new_direct([ - 226, 237, 125, 140, 144, 97, 153, 126, 209, 251, 156, 249, 109, 242, 202, 211, 140, 35, - 223, 224, 89, 200, 147, 112, 151, 147, 10, 75, 34, 110, 97, 204, + 45, 8, 41, 170, 235, 127, 133, 14, 253, 53, 201, 220, 96, 192, 168, 234, 110, 20, 174, 226, + 18, 4, 230, 182, 204, 99, 138, 27, 82, 209, 28, 68, ]), ]; From 2ce703fd963ecdeafb5930347bdab1116d8b5377 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 3 May 2024 17:55:57 +0200 Subject: [PATCH 047/140] Remove flat_merkle.rs. This implementation change wasn't necessary to speed up performance. And, it wasn't correctly handling the per-layer empty hashes. We *might* want to consider a complete rewrite of the merkle tree implementation to make the datastructures more friendly to various memory caches. But, not yet. --- arbitrator/prover/src/flat_merkle.rs | 226 --------------------------- arbitrator/prover/src/lib.rs | 1 - 2 files changed, 227 deletions(-) delete mode 100644 arbitrator/prover/src/flat_merkle.rs diff --git a/arbitrator/prover/src/flat_merkle.rs b/arbitrator/prover/src/flat_merkle.rs deleted file mode 100644 index 87ce55d14b..0000000000 --- a/arbitrator/prover/src/flat_merkle.rs +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE - -use arbutil::Bytes32; -use digest::Digest; -// use rayon::prelude::*; -use sha3::Keccak256; - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum MerkleType { - Empty, - Value, - Function, - Instruction, - Memory, - Table, - TableElement, - Module, -} - -impl Default for MerkleType { - fn default() -> Self { - Self::Empty - } -} - -impl MerkleType { - pub fn get_prefix(self) -> &'static str { - match self { - MerkleType::Empty => panic!("Attempted to get prefix of empty merkle type"), - MerkleType::Value => "Value merkle tree:", - MerkleType::Function => "Function merkle tree:", - MerkleType::Instruction => "Instruction merkle tree:", - MerkleType::Memory => "Memory merkle tree:", - MerkleType::Table => "Table merkle tree:", - MerkleType::TableElement => "Table element merkle tree:", - MerkleType::Module => "Module merkle tree:", - } - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Default)] -pub struct Merkle { - tree: Vec, - empty_hash: Bytes32, -} - -#[inline] -fn hash_node(a: &[u8], b: &[u8]) -> Bytes32 { - let mut h = Keccak256::new(); - h.update(a); - h.update(b); - h.finalize().into() -} - -impl Merkle { - pub fn new(ty: MerkleType, hashes: Vec) -> Merkle { - Self::new_advanced(ty, hashes, Bytes32::default(), 0) - } - pub fn new_advanced( - _ty: MerkleType, - hashes: Vec, - empty_hash: Bytes32, - min_depth: usize, - ) -> Merkle { - if hashes.is_empty() { - return Merkle::default(); - } - - let empty_layer_hash = hash_node(empty_hash.as_slice(), empty_hash.as_slice()); - - let hash_count = hashes.len(); - let mut current_level_size = hash_count; - - // Calculate the total capacity needed for the tree - let mut total_capacity = hash_count * 32; // 32 bytes per hash - let mut depth = min_depth; - while current_level_size > 1 || depth > 0 { - current_level_size = (current_level_size + 1) / 2; - total_capacity += current_level_size * 32; - depth = depth.saturating_sub(1); - } - let mut tree = Vec::with_capacity(total_capacity); - - // Append initial hashes to the tree - for hash in hashes.into_iter() { - tree.extend_from_slice(hash.as_slice()); - } - - let mut next_level_offset = tree.len(); - let mut depth = min_depth; - - while current_level_size > 1 || depth > 0 { - let mut i = next_level_offset - current_level_size * 32; - while i < next_level_offset { - let left = &tree[i..i + 32]; - let right = if i + 32 < next_level_offset { - &tree[i + 32..i + 64] - } else { - empty_layer_hash.as_slice() - }; - - let parent_hash = hash_node(left, right); - tree.extend(parent_hash.as_slice()); - - i += 64; - } - - current_level_size = (current_level_size + 1) / 2; - next_level_offset = tree.len(); - depth = depth.saturating_sub(1); - } - - Merkle { - tree, - empty_hash: empty_layer_hash, - } - } - - pub fn root(&self) -> Bytes32 { - let len = self.tree.len(); - let mut root = [0u8; 32]; - root.copy_from_slice(&self.tree[len - 32..len]); - root.into() - } - - pub fn leaves(&self) -> &[u8] { - let leaf_layer_size = self.calculate_layer_size(0); - &self.tree[..leaf_layer_size * 32] - } - - pub fn prove(&self, idx: usize) -> Option> { - let leaf_count = self.calculate_layer_size(0); - if idx >= leaf_count { - return None; - } - - let mut proof = Vec::new(); - let mut node_index = idx; - let mut layer_start = 0; - - for depth in 0.. { - let layer_size = self.calculate_layer_size(depth); - if layer_size <= 1 { - break; - } - - let sibling_index = if node_index % 2 == 0 { - node_index + 1 - } else { - node_index - 1 - }; - if sibling_index < layer_size { - proof.extend(self.get_node(layer_start, sibling_index)); - } - - node_index /= 2; - layer_start += layer_size * 32; - } - - Some(proof) - } - - // Helper function to get a node from the tree - #[inline(always)] - fn get_node(&self, layer_start: usize, index: usize) -> Bytes32 { - let start = layer_start + index * 32; - let mut node = [0u8; 32]; - node.copy_from_slice(&self.tree[start..start + 32]); - node.into() - } - - pub fn set(&mut self, mut idx: usize, hash: Bytes32) { - // Calculate the offset in the flat tree for the given index - let mut offset = idx * 32; - - // Check if the hash at the calculated position is the same as the input hash - if &self.tree[offset..offset + 32] == hash.as_slice() { - return; - } - - // Copy the new hash into the tree at the calculated position - self.tree[offset..offset + 32].copy_from_slice(hash.as_slice()); - - // Calculate the total number of nodes in the tree - let total_nodes = self.tree.len() / 32; - - // Update parent hashes up the tree - let mut next_hash = hash; - while idx > 0 { - idx = (idx - 1) / 2; // Move to the parent index - offset = idx * 32; - - // Calculate the position of the sibling in the flat tree - let sibling_idx = if idx % 2 == 0 { idx + 1 } else { idx - 1 }; - let sibling_offset = sibling_idx * 32; - - // Handle the case where the sibling index is out of bounds - let sibling_hash = if sibling_offset < total_nodes * 32 { - &self.tree[sibling_offset..sibling_offset + 32] - } else { - self.empty_hash.as_slice() - }; - - // Calculate the parent hash - next_hash = if idx % 2 == 0 { - hash_node(next_hash.as_slice(), sibling_hash) - } else { - hash_node(sibling_hash, next_hash.as_slice()) - }; - - // Update the parent node in the flat tree - self.tree[offset..offset + 32].copy_from_slice(next_hash.as_slice()); - } - } - - // Helper function to calculate the size of a given layer - #[inline(always)] - fn calculate_layer_size(&self, depth: usize) -> usize { - let mut size = self.tree.len() / 32; // Total number of nodes - for _ in 0..depth { - size = (size + 1) / 2; // Size of the current layer - } - size - } -} diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index 2992c6d13a..4895f0cba7 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -4,7 +4,6 @@ #![allow(clippy::missing_safety_doc, clippy::too_many_arguments)] pub mod binary; -pub mod flat_merkle; mod host; #[cfg(feature = "native")] mod kzg; From e67b0e1d1baa929526e13b59e58cbb8ef9c6f104 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 3 May 2024 18:23:07 +0200 Subject: [PATCH 048/140] Remove inlined capacity function. At some point, it was being used on its own, but now, it can just be a method on Merkle. --- arbitrator/prover/src/merkle.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index dc182419eb..b429be2d64 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -182,15 +182,6 @@ fn hash_node(ty: MerkleType, a: impl AsRef<[u8]>, b: impl AsRef<[u8]>) -> Bytes3 h.finalize().into() } -#[inline] -fn capacity(layers: &Vec>) -> usize { - if layers.is_empty() { - return 0; - } - let base: usize = 2; - base.pow((layers.len() - 1).try_into().unwrap()) -} - const fn empty_hash_at(ty: MerkleType, layer_i: usize) -> &'static Bytes32 { match ty { MerkleType::Empty => EMPTY_HASH, @@ -310,7 +301,12 @@ impl Merkle { // Returns the total number of leaves the tree can hold. #[inline] fn capacity(&self) -> usize { - return capacity(self.layers.lock().unwrap().as_ref()); + let layers = self.layers.lock().unwrap(); + if layers.is_empty() { + return 0; + } + let base: usize = 2; + base.pow((layers.len() - 1).try_into().unwrap()) } // Returns the number of leaves in the tree. From fc9e88ffda73e1a8538e9e6a80f784338a870137 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 3 May 2024 18:25:34 +0200 Subject: [PATCH 049/140] Remove the locked_set method. This was shared at one point between the set and expand functions. Since expand was replaced by `resize`, it is no longer needed. --- arbitrator/prover/src/merkle.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index b429be2d64..5a3cbadbc7 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -30,7 +30,7 @@ use sha3::Keccak256; use std::{ collections::HashSet, convert::{TryFrom, TryInto}, - sync::{Arc, Mutex, MutexGuard}, + sync::{Arc, Mutex}, }; #[cfg(feature = "rayon")] @@ -371,19 +371,10 @@ impl Merkle { #[cfg(feature = "counters")] SET_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); let mut layers = self.layers.lock().unwrap(); - self.locked_set(&mut layers, idx, hash); - } - - fn locked_set( - &self, - locked_layers: &mut MutexGuard>>, - idx: usize, - hash: Bytes32, - ) { - if locked_layers[0][idx] == hash { + if layers[0][idx] == hash { return; } - locked_layers[0][idx] = hash; + layers[0][idx] = hash; self.dirty_layers.lock().unwrap()[0].insert(idx >> 1); } From 35ce996eb1399126cbfb31125fb97e274839968c Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 8 May 2024 13:49:20 +0200 Subject: [PATCH 050/140] Use the json format from the go code for ValidationInputs. This allows us to dump ValidationInput messages from a runing nitro node, or even a system test, and use them to drive the benchmarking code. --- arbitrator/Cargo.lock | 168 ++++++++++++++++++++++++- arbitrator/bench/Cargo.toml | 5 +- arbitrator/bench/src/bin.rs | 10 +- arbitrator/bench/src/parse_input.rs | 187 ++++++++-------------------- arbitrator/bench/src/prepare.rs | 18 ++- 5 files changed, 234 insertions(+), 154 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 7c05d1fcf4..312042cfb0 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -55,6 +55,21 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anes" version = "0.1.6" @@ -181,6 +196,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bench" version = "0.1.0" @@ -191,6 +212,9 @@ dependencies = [ "gperftools", "hex", "prover", + "serde", + "serde_json", + "serde_with 3.8.1", ] [[package]] @@ -375,6 +399,19 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets 0.52.5", +] + [[package]] name = "ciborium" version = "0.2.2" @@ -469,6 +506,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + [[package]] name = "corosensei" version = "0.1.4" @@ -704,6 +747,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", + "strsim 0.10.0", "syn 2.0.52", ] @@ -742,6 +786,16 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1050,6 +1104,32 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] [[package]] name = "ident_case" @@ -1071,6 +1151,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", + "serde", ] [[package]] @@ -1081,6 +1162,7 @@ checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", + "serde", ] [[package]] @@ -1376,6 +1458,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" version = "0.4.2" @@ -1558,6 +1646,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1637,7 +1731,7 @@ dependencies = [ "rustc-demangle", "serde", "serde_json", - "serde_with", + "serde_with 1.14.0", "sha2 0.9.9", "sha3 0.9.1", "smallvec", @@ -1966,7 +2060,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ "serde", - "serde_with_macros", + "serde_with_macros 1.5.2", +] + +[[package]] +name = "serde_with" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.2.5", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros 3.8.1", + "time", ] [[package]] @@ -1981,6 +2093,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "serde_with_macros" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" +dependencies = [ + "darling 0.20.8", + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "sha2" version = "0.9.9" @@ -2219,6 +2343,37 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -2682,6 +2837,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.5", +] + [[package]] name = "windows-sys" version = "0.33.0" diff --git a/arbitrator/bench/Cargo.toml b/arbitrator/bench/Cargo.toml index 396988ed83..3ab5b99b08 100644 --- a/arbitrator/bench/Cargo.toml +++ b/arbitrator/bench/Cargo.toml @@ -12,12 +12,15 @@ name = "benchbin" path = "src/bin.rs" [dependencies] -hex = "0.4.3" +hex = { version = "0.4.3", features = ["serde"] } eyre = "0.6.5" prover = { path = "../prover" } arbutil = { path = "../arbutil" } clap = { version = "4.4.8", features = ["derive"] } gperftools = { version = "0.2.0", optional = true } +serde = { version = "1.0.130", features = ["derive", "rc"] } +serde_json = "1.0.67" +serde_with = { version = "3.8.1", features = ["base64"] } [features] counters = [] diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 23930652c2..5fc7bae72f 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -33,7 +33,7 @@ struct Args { fn main() -> eyre::Result<()> { let args = Args::parse(); - let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; + let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24, 1 << 26, 1 << 28]; if args.always_merkleize { println!("Running benchmark with always merkleize feature on"); } else { @@ -82,14 +82,16 @@ fn main() -> eyre::Result<()> { bail!("Machine too far => position {}", machine.get_steps()) } MachineStatus::Running => {} - MachineStatus::Finished => return Ok(()), + MachineStatus::Finished => { + break; + } } let start = std::time::Instant::now(); let _ = machine.hash(); let hash_end_time = start.elapsed(); hash_times.push(hash_end_time); num_iters += 1; - if num_iters == 100 { + if num_iters == 200 { break; } } @@ -102,7 +104,7 @@ fn main() -> eyre::Result<()> { let total_end_time = total.elapsed(); println!( - "avg hash time {:>12?}, avg step time {:>12?}, step size {:>8}, num_iters {}, total time {:>12?}", + "avg hash time {:>11?}, avg step time {:>12?}, step size {:>9}, num_iters {:>3}, total time {:>12?}", average(&hash_times), average(&step_times), step_size, diff --git a/arbitrator/bench/src/parse_input.rs b/arbitrator/bench/src/parse_input.rs index 32f1c15ed3..f04150ea22 100644 --- a/arbitrator/bench/src/parse_input.rs +++ b/arbitrator/bench/src/parse_input.rs @@ -1,163 +1,76 @@ -use std::io::{self, BufRead}; +use arbutil::Bytes32; +use serde::{Deserialize, Serialize}; +use serde_json; +use serde_with::base64::Base64; +use serde_with::As; +use serde_with::DisplayFromStr; +use std::{ + collections::HashMap, + io::{self, BufRead}, +}; + +mod prefixed_hex { + use serde::{self, Deserialize, Deserializer, Serializer}; + + pub fn serialize(bytes: &Vec, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(&format!("0x{}", hex::encode(bytes))) + } -#[derive(Debug, Clone)] -pub struct Preimage { - pub type_: u32, - pub hash: Vec, - pub data: Vec, + pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + if s.starts_with("0x") { + hex::decode(&s[2..]).map_err(serde::de::Error::custom) + } else { + Err(serde::de::Error::custom("missing 0x prefix")) + } + } } -#[derive(Debug, Clone)] -pub struct Item { - pub preimages: Vec, -} +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct PreimageMap(HashMap>); -#[derive(Debug)] +#[derive(Debug, Clone, Deserialize, Serialize)] +#[serde(rename_all = "PascalCase")] pub struct BatchInfo { pub number: u64, - pub data: Vec, + #[serde(with = "As::")] + pub data_b64: Vec, } -#[derive(Debug)] +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "PascalCase")] pub struct StartState { + #[serde(with = "prefixed_hex")] pub block_hash: Vec, + #[serde(with = "prefixed_hex")] pub send_root: Vec, pub batch: u64, pub pos_in_batch: u64, } -#[derive(Debug)] +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "PascalCase")] pub struct FileData { pub id: u64, pub has_delayed_msg: bool, pub delayed_msg_nr: u64, - pub items: Vec, - pub batch_info: BatchInfo, - pub delayed_msg: Vec, + #[serde(with = "As::>>")] + pub preimages_b64: HashMap>>, + pub batch_info: Vec, + #[serde(with = "As::")] + pub delayed_msg_b64: Vec, pub start_state: StartState, } impl FileData { pub fn from_reader(mut reader: R) -> io::Result { - let mut items = Vec::new(); - let mut batch_info = BatchInfo { - number: 0, - data: Vec::new(), - }; - let mut id = 0; - let mut has_delayed_msg = false; - let mut delayed_msg_nr = 0; - let mut delayed_msg = Vec::new(); - let mut start_state = StartState { - block_hash: Vec::new(), - send_root: Vec::new(), - batch: 0, - pos_in_batch: 0, - }; - - let mut line = String::new(); - while reader.read_line(&mut line)? > 0 { - if line.starts_with("Id:") { - id = line.split(':').nth(1).unwrap().trim().parse().unwrap(); - } else if line.starts_with("HasDelayedMsg:") { - has_delayed_msg = line.split(':').nth(1).unwrap().trim().parse().unwrap(); - } else if line.starts_with("DelayedMsgNr:") { - delayed_msg_nr = line.split(':').nth(1).unwrap().trim().parse().unwrap(); - } else if line.starts_with("Preimages:") { - items.push(Item::from_reader(&mut reader, &mut line)?); - } else if line.starts_with("BatchInfo:") { - let parts: Vec<_> = line.split(',').collect(); - batch_info.number = parts[0].split(':').nth(2).unwrap().trim().parse().unwrap(); - batch_info.data = hex::decode(parts[1].split(':').nth(1).unwrap().trim()).unwrap(); - } else if line.starts_with("DelayedMsg:") { - delayed_msg = hex::decode(line.split(':').nth(1).unwrap().trim()).unwrap(); - } else if line.starts_with("StartState:") { - let parts: Vec<_> = line.split(',').collect(); - - // Parsing block_hash - let block_hash_str = parts[0].split("BlockHash:").nth(1).unwrap().trim(); - start_state.block_hash = - hex::decode(block_hash_str.strip_prefix("0x").unwrap()).unwrap(); - - // Parsing send_root - let send_root_str = parts[1].split(':').nth(1).unwrap().trim(); - start_state.send_root = - hex::decode(send_root_str.strip_prefix("0x").unwrap()).unwrap(); - - // Parsing batch - start_state.batch = parts[2] - .split(':') - .nth(1) - .unwrap() - .trim() - .parse::() - .unwrap(); - - // Parsing pos_in_batch - start_state.pos_in_batch = parts[3] - .split(':') - .nth(1) - .unwrap() - .trim() - .parse::() - .unwrap(); - } - line.clear(); - } - - Ok(FileData { - id, - has_delayed_msg, - delayed_msg_nr, - items, - batch_info, - delayed_msg, - start_state, - }) - } -} - -impl Item { - pub fn from_reader(reader: &mut R, line: &mut String) -> io::Result { - let mut preimages = Vec::new(); - - loop { - if line.is_empty() - || line.starts_with("BatchInfo:") - || line.starts_with("DelayedMsg:") - || line.starts_with("StartState:") - { - break; - } - if line.starts_with("Preimages:") { - line.clear(); - while reader.read_line(line)? > 0 && line.starts_with('\t') { - let parts: Vec<_> = line.trim().split(',').collect(); - let type_ = parts[0].split(':').nth(1).unwrap().trim().parse().unwrap(); - let hash = hex::decode( - parts[1] - .split(':') - .nth(1) - .unwrap() - .trim() - .strip_prefix("0x") - .unwrap(), - ) - .unwrap(); - let data = hex::decode(parts[2].split(':').nth(1).unwrap().trim()).unwrap(); - preimages.push(Preimage { type_, hash, data }); - line.clear(); - } - continue; // To skip line.clear() at the end of the loop for this case - } - - line.clear(); - if reader.read_line(line)? == 0 { - // If EOF is reached - break; - } - } - - Ok(Item { preimages }) + let data = serde_json::from_reader(&mut reader)?; + return Ok(data); } } diff --git a/arbitrator/bench/src/prepare.rs b/arbitrator/bench/src/prepare.rs index daf0f48f8f..3cc884db6d 100644 --- a/arbitrator/bench/src/prepare.rs +++ b/arbitrator/bench/src/prepare.rs @@ -18,15 +18,11 @@ pub fn prepare_machine( let reader = BufReader::new(file); let data = FileData::from_reader(reader)?; - let item = data.items.first().unwrap().clone(); - let preimages = item.preimages; - let preimages = preimages + let preimages = data + .preimages_b64 .into_iter() - .map(|preimage| { - let hash: [u8; 32] = preimage.hash.try_into().unwrap(); - let hash: Bytes32 = hash.into(); - (hash, preimage.data) - }) + .map(|preimage| preimage.1.into_iter().map(|(k, v)| (k, v))) + .flatten() .collect::>>(); let preimage_resolver = move |_: u64, _: PreimageType, hash: Bytes32| -> Option { preimages @@ -59,11 +55,13 @@ pub fn prepare_machine( // println!("Adding sequencer inbox message"); let identifier = argument_data_to_inbox(0).unwrap(); - mach.add_inbox_msg(identifier, data.batch_info.number, data.batch_info.data); + for batch_info in data.batch_info.iter() { + mach.add_inbox_msg(identifier, batch_info.number, batch_info.data_b64.clone()); + } // println!("Adding delayed inbox message"); let identifier = argument_data_to_inbox(1).unwrap(); - mach.add_inbox_msg(identifier, data.delayed_msg_nr, data.delayed_msg); + mach.add_inbox_msg(identifier, data.delayed_msg_nr, data.delayed_msg_b64); Ok(mach) } From b9bad0c6892ab0a49cedb0c77c9f6e39cd8cdc3e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 8 May 2024 17:00:31 +0200 Subject: [PATCH 051/140] Fix a bug in Memory::store_slice_aligned() The method was taking the value of the merkle tree and not returning it. --- arbitrator/prover/src/memory.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 4709c406a7..bba8e4124f 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -263,6 +263,7 @@ impl Memory { merkle.set(start_leaf, hash_leaf(self.get_leaf_data(start_leaf))); // No need for second merkle assert!(value.len() <= Self::LEAF_SIZE); + self.merkle = Some(merkle); } true From 9453b4024108b88a6b680fee27707ba48fe8f5ca Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 10 May 2024 16:41:52 +0200 Subject: [PATCH 052/140] Add more counters. We need to be able to see how frequently the memory is being hashed and from where. The problem is that with always_merkleize off, there are thousands of fewer calls to `Merkle::root()` and this is to help us figure out where the calls are coming from. Spoiler alert: It's from the flush_module macro. --- arbitrator/bench/src/bin.rs | 16 ++++++++++++--- arbitrator/prover/src/lib.rs | 2 +- arbitrator/prover/src/machine.rs | 34 ++++++++++++++++++++++++++++++++ arbitrator/prover/src/memory.rs | 22 +++++++++++++++++++++ arbitrator/prover/src/merkle.rs | 23 +++++++++++++++++++-- 5 files changed, 91 insertions(+), 6 deletions(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 5fc7bae72f..185f7e2642 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -13,7 +13,7 @@ use gperftools::heap_profiler::HEAP_PROFILER; use prover::machine::MachineStatus; #[cfg(feature = "counters")] -use prover::merkle; +use prover::{machine, memory, merkle}; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] @@ -34,6 +34,8 @@ struct Args { fn main() -> eyre::Result<()> { let args = Args::parse(); let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24, 1 << 26, 1 << 28]; + // let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; + if args.always_merkleize { println!("Running benchmark with always merkleize feature on"); } else { @@ -65,7 +67,11 @@ fn main() -> eyre::Result<()> { .unwrap(); #[cfg(feature = "counters")] - merkle::reset_counters(); + { + machine::reset_counters(); + memory::reset_counters(); + merkle::reset_counters(); + } let total = std::time::Instant::now(); loop { let start = std::time::Instant::now(); @@ -112,7 +118,11 @@ fn main() -> eyre::Result<()> { total_end_time, ); #[cfg(feature = "counters")] - merkle::print_counters(); + { + machine::print_counters(); + memory::print_counters(); + merkle::print_counters(); + } } Ok(()) } diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index 4895f0cba7..1e3ecf4cd6 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -9,7 +9,7 @@ mod host; mod kzg; pub mod machine; /// cbindgen:ignore -mod memory; +pub mod memory; pub mod merkle; mod print; pub mod programs; diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index 6b0e1df3e1..fbbacd9fb6 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -32,6 +32,10 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; use sha3::Keccak256; use smallvec::SmallVec; + +#[cfg(feature = "counters")] +use std::sync::atomic::{AtomicUsize, Ordering}; + use std::{ borrow::Cow, convert::{TryFrom, TryInto}, @@ -44,12 +48,37 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; + use wasmer_types::FunctionIndex; use wasmparser::{DataKind, ElementItems, ElementKind, Operator, RefType, TableType}; #[cfg(feature = "rayon")] use rayon::prelude::*; +#[cfg(feature = "counters")] +static GET_MODULES_MERKLE_COUNTER: AtomicUsize = AtomicUsize::new(0); + +#[cfg(feature = "counters")] +static FLUSH_MODULE_COUNTER: AtomicUsize = AtomicUsize::new(0); + +#[cfg(feature = "counters")] +pub fn print_counters() { + println!( + "GET_MODULES_MERKLE_COUNTER: {}", + GET_MODULES_MERKLE_COUNTER.load(Ordering::Relaxed) + ); + println!( + "FLUSH_MODULE_COUNTER: {}", + FLUSH_MODULE_COUNTER.load(Ordering::Relaxed) + ); +} + +#[cfg(feature = "counters")] +pub fn reset_counters() { + GET_MODULES_MERKLE_COUNTER.store(0, Ordering::Relaxed); + FLUSH_MODULE_COUNTER.store(0, Ordering::Relaxed); +} + fn hash_call_indirect_data(table: u32, ty: &FunctionType) -> Bytes32 { let mut h = Keccak256::new(); h.update("Call indirect:"); @@ -1918,6 +1947,8 @@ impl Machine { } macro_rules! flush_module { () => { + #[cfg(feature = "counters")] + FLUSH_MODULE_COUNTER.fetch_add(1, Ordering::Relaxed); if let Some(merkle) = self.modules_merkle.as_mut() { merkle.set(self.pc.module(), module.hash()); } @@ -2696,6 +2727,9 @@ impl Machine { } fn get_modules_merkle(&self) -> Cow { + #[cfg(feature = "counters")] + GET_MODULES_MERKLE_COUNTER.fetch_add(1, Ordering::Relaxed); + if let Some(merkle) = &self.modules_merkle { Cow::Borrowed(merkle) } else { diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index bba8e4124f..0c49a1b54b 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -11,11 +11,31 @@ use eyre::{bail, ErrReport, Result}; use serde::{Deserialize, Serialize}; use sha3::Keccak256; use std::{borrow::Cow, convert::TryFrom}; + +#[cfg(feature = "counters")] +use std::sync::atomic::{AtomicUsize, Ordering}; + use wasmer_types::Pages; #[cfg(feature = "rayon")] use rayon::prelude::*; +#[cfg(feature = "counters")] +static MEM_HASH_COUNTER: AtomicUsize = AtomicUsize::new(0); + +#[cfg(feature = "counters")] +pub fn reset_counters() { + MEM_HASH_COUNTER.store(0, Ordering::Relaxed); +} + +#[cfg(feature = "counters")] +pub fn print_counters() { + println!( + "Memory hash count: {}", + MEM_HASH_COUNTER.load(Ordering::Relaxed) + ); +} + pub struct MemoryType { pub min: Pages, pub max: Option, @@ -138,6 +158,8 @@ impl Memory { } pub fn hash(&self) -> Bytes32 { + #[cfg(feature = "counters")] + MEM_HASH_COUNTER.fetch_add(1, Ordering::Relaxed); let mut h = Keccak256::new(); h.update("Memory:"); h.update((self.buffer.len() as u64).to_be_bytes()); diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 5a3cbadbc7..82c03e5d66 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -87,6 +87,21 @@ lazy_static! { map }; } +#[cfg(feature = "counters")] +lazy_static! { + static ref RESIZE_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { + let mut map = HashMap::new(); + map.insert(&MerkleType::Empty, AtomicUsize::new(0)); + map.insert(&MerkleType::Value, AtomicUsize::new(0)); + map.insert(&MerkleType::Function, AtomicUsize::new(0)); + map.insert(&MerkleType::Instruction, AtomicUsize::new(0)); + map.insert(&MerkleType::Memory, AtomicUsize::new(0)); + map.insert(&MerkleType::Table, AtomicUsize::new(0)); + map.insert(&MerkleType::TableElement, AtomicUsize::new(0)); + map.insert(&MerkleType::Module, AtomicUsize::new(0)); + map + }; +} #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Serialize, Deserialize, Sequence)] pub enum MerkleType { @@ -113,11 +128,12 @@ pub fn print_counters() { continue; } println!( - "{} New: {}, Root: {}, Set: {}", + "{} New: {}, Root: {}, Set: {} Resize: {}", ty.get_prefix(), NEW_COUNTERS[&ty].load(Ordering::Relaxed), ROOT_COUNTERS[&ty].load(Ordering::Relaxed), - SET_COUNTERS[&ty].load(Ordering::Relaxed) + SET_COUNTERS[&ty].load(Ordering::Relaxed), + RESIZE_COUNTERS[&ty].load(Ordering::Relaxed), ); } } @@ -131,6 +147,7 @@ pub fn reset_counters() { NEW_COUNTERS[&ty].store(0, Ordering::Relaxed); ROOT_COUNTERS[&ty].store(0, Ordering::Relaxed); SET_COUNTERS[&ty].store(0, Ordering::Relaxed); + RESIZE_COUNTERS[&ty].store(0, Ordering::Relaxed); } } @@ -382,6 +399,8 @@ impl Merkle { /// /// The extra space is filled with empty hashes. pub fn resize(&self, new_len: usize) -> Result { + #[cfg(feature = "counters")] + RESIZE_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); if new_len > self.capacity() { return Err( "Cannot resize to a length greater than the capacity of the tree.".to_owned(), From e8c750adc5fa5ecc39a8efbeb1a3eea60382ccf5 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 10 May 2024 17:02:09 +0200 Subject: [PATCH 053/140] Remove flush_module macro. The high-level benefit of this change is a 16.5% reduction in block processing time from ~17.6s to ~14.7s. The only job of that macro was to recalculate the hash of the module and update the module merkle tree's corresponding leaf with the new hash. Instead, the waits until the hash for the module is about to be calculated and calls `Merkle::set()` for each module in the modules vector. This eliminates thousands of calls to the possibly expensive `Merkle::root()` call on the `Memory` of each module. This pattern of delaying when to actually update the leaves of merkle trees until they will be used has a lot of potential for additional performance boosts. --- arbitrator/prover/src/machine.rs | 34 +++----------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index fbbacd9fb6..5c4471a9fd 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -58,25 +58,17 @@ use rayon::prelude::*; #[cfg(feature = "counters")] static GET_MODULES_MERKLE_COUNTER: AtomicUsize = AtomicUsize::new(0); -#[cfg(feature = "counters")] -static FLUSH_MODULE_COUNTER: AtomicUsize = AtomicUsize::new(0); - #[cfg(feature = "counters")] pub fn print_counters() { println!( "GET_MODULES_MERKLE_COUNTER: {}", GET_MODULES_MERKLE_COUNTER.load(Ordering::Relaxed) ); - println!( - "FLUSH_MODULE_COUNTER: {}", - FLUSH_MODULE_COUNTER.load(Ordering::Relaxed) - ); } #[cfg(feature = "counters")] pub fn reset_counters() { GET_MODULES_MERKLE_COUNTER.store(0, Ordering::Relaxed); - FLUSH_MODULE_COUNTER.store(0, Ordering::Relaxed); } fn hash_call_indirect_data(table: u32, ty: &FunctionType) -> Bytes32 { @@ -1945,22 +1937,11 @@ impl Machine { func = &module.funcs[self.pc.func()]; }; } - macro_rules! flush_module { - () => { - #[cfg(feature = "counters")] - FLUSH_MODULE_COUNTER.fetch_add(1, Ordering::Relaxed); - if let Some(merkle) = self.modules_merkle.as_mut() { - merkle.set(self.pc.module(), module.hash()); - } - }; - } macro_rules! error { () => { error!("") }; ($format:expr $(, $message:expr)*) => {{ - flush_module!(); - if self.debug_info { println!("\n{} {}", "error on line".grey(), line!().pink()); println!($format, $($message.pink()),*); @@ -1979,7 +1960,6 @@ impl Machine { continue; } self.status = MachineStatus::Errored; - module = &mut self.modules[self.pc.module()]; break; }}; } @@ -1990,7 +1970,6 @@ impl Machine { println!("\n{}", "Machine out of steps".red()); self.status = MachineStatus::Errored; self.print_backtrace(true); - module = &mut self.modules[self.pc.module()]; break; } @@ -2050,9 +2029,6 @@ impl Machine { Value::RefNull => error!(), Value::InternalRef(pc) => { let changing_module = pc.module != self.pc.module; - if changing_module { - flush_module!(); - } self.pc = pc; if changing_module { module = &mut self.modules[self.pc.module()]; @@ -2072,7 +2048,6 @@ impl Machine { func = &module.funcs[self.pc.func()]; } Opcode::CrossModuleCall => { - flush_module!(); value_stack.push(Value::InternalRef(self.pc)); value_stack.push(self.pc.module.into()); value_stack.push(module.internals_offset.into()); @@ -2083,7 +2058,6 @@ impl Machine { reset_refs!(); } Opcode::CrossModuleForward => { - flush_module!(); let frame = frame_stack.last().unwrap(); value_stack.push(Value::InternalRef(self.pc)); value_stack.push(frame.caller_module.into()); @@ -2095,7 +2069,6 @@ impl Machine { reset_refs!(); } Opcode::CrossModuleInternalCall => { - flush_module!(); let call_internal = inst.argument_data as u32; let call_module = value_stack.pop().unwrap().assume_u32(); value_stack.push(Value::InternalRef(self.pc)); @@ -2118,7 +2091,6 @@ impl Machine { .ok() .and_then(|o| current_frame.caller_module_internals.checked_add(o)) .expect("Internal call function index overflow"); - flush_module!(); self.pc.module = current_frame.caller_module; self.pc.func = func_idx; self.pc.inst = 0; @@ -2550,7 +2522,6 @@ impl Machine { let dots = (modules.len() > 16).then_some("...").unwrap_or_default(); bail!("no program for {hash} in {{{}{dots}}}", keys.join(", ")) }; - flush_module!(); // put the new module's offset on the stack let index = self.modules.len() as u32; @@ -2563,7 +2534,6 @@ impl Machine { reset_refs!(); } Opcode::UnlinkModule => { - flush_module!(); self.modules.pop(); if let Some(cached) = &mut self.modules_merkle { cached.pop_leaf(); @@ -2603,7 +2573,6 @@ impl Machine { } } } - flush_module!(); if self.is_halted() && !self.stdio_output.is_empty() { // If we halted, print out any trailing output that didn't have a newline. Self::say(String::from_utf8_lossy(&self.stdio_output)); @@ -2731,6 +2700,9 @@ impl Machine { GET_MODULES_MERKLE_COUNTER.fetch_add(1, Ordering::Relaxed); if let Some(merkle) = &self.modules_merkle { + for (i, module) in self.modules.iter().enumerate() { + merkle.set(i, module.hash()); + } Cow::Borrowed(merkle) } else { Cow::Owned(Merkle::new( From 6ba0a693f58289c5acf9ff9c4bcaf604c7cb2d93 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Mon, 13 May 2024 14:27:03 +0200 Subject: [PATCH 054/140] Speed up block validation by another 27%. This change just marks memory as dirty when storing new values rather than actually calculating the new hash for the data in memory and then calculates the hashes for dirty indices just before creating the merkle tree. On one test block, this ended up saving 23 million calls to keccack. --- arbitrator/bench/src/bin.rs | 1 - arbitrator/prover/src/memory.rs | 50 ++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 185f7e2642..3b527fb8dd 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -34,7 +34,6 @@ struct Args { fn main() -> eyre::Result<()> { let args = Args::parse(); let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24, 1 << 26, 1 << 28]; - // let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24]; if args.always_merkleize { println!("Running benchmark with always merkleize feature on"); diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 0c49a1b54b..78b5ba7259 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -10,7 +10,13 @@ use digest::Digest; use eyre::{bail, ErrReport, Result}; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::{borrow::Cow, convert::TryFrom}; +use std::{ + borrow::Cow, + collections::HashSet, + convert::TryFrom, + ops::Deref, + sync::{Arc, Mutex}, +}; #[cfg(feature = "counters")] use std::sync::atomic::{AtomicUsize, Ordering}; @@ -64,12 +70,14 @@ impl TryFrom<&wasmparser::MemoryType> for MemoryType { } } -#[derive(PartialEq, Eq, Clone, Debug, Default, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, Serialize, Deserialize)] pub struct Memory { buffer: Vec, #[serde(skip)] pub merkle: Option, pub max_size: u64, + #[serde(skip)] + dirty_indices: Arc>>, } fn hash_leaf(bytes: [u8; Memory::LEAF_SIZE]) -> Bytes32 { @@ -98,6 +106,16 @@ fn div_round_up(num: usize, denom: usize) -> usize { res } +impl PartialEq for Memory { + fn eq(&self, other: &Memory) -> bool { + self.buffer == other.buffer + && self.merkle == other.merkle + && self.max_size == other.max_size + && self.dirty_indices.lock().unwrap().deref() + == other.dirty_indices.lock().unwrap().deref() + } +} + impl Memory { pub const LEAF_SIZE: usize = 32; /// Only used when initializing a memory to determine its size @@ -111,6 +129,7 @@ impl Memory { buffer: vec![0u8; size], merkle: None, max_size, + dirty_indices: Arc::new(Mutex::new(HashSet::new())), } } @@ -120,6 +139,11 @@ impl Memory { pub fn merkelize(&self) -> Cow<'_, Merkle> { if let Some(m) = &self.merkle { + for idx in self.dirty_indices.lock().unwrap().iter() { + let leaf_idx = idx / Self::LEAF_SIZE; + m.set(leaf_idx, hash_leaf(self.get_leaf_data(leaf_idx))); + } + self.dirty_indices.lock().unwrap().clear(); return Cow::Borrowed(m); } // Round the size up to 8 byte long leaves, then round up to the next power of two number of leaves @@ -143,6 +167,7 @@ impl Memory { if size < leaves { m.resize(leaves).expect("Couldn't resize merkle tree"); } + self.dirty_indices.lock().unwrap().clear(); Cow::Owned(m) } @@ -251,16 +276,8 @@ impl Memory { let end_idx = end_idx as usize; let buf = value.to_le_bytes(); self.buffer[idx..end_idx].copy_from_slice(&buf[..bytes.into()]); - - if let Some(merkle) = self.merkle.take() { - let start_leaf = idx / Self::LEAF_SIZE; - merkle.set(start_leaf, hash_leaf(self.get_leaf_data(start_leaf))); - let end_leaf = (end_idx - 1) / Self::LEAF_SIZE; - if end_leaf != start_leaf { - merkle.set(end_leaf, hash_leaf(self.get_leaf_data(end_leaf))); - } - self.merkle = Some(merkle); - } + self.dirty_indices.lock().unwrap().insert(idx); + self.dirty_indices.lock().unwrap().insert(end_idx - 1); true } @@ -279,14 +296,7 @@ impl Memory { let idx = idx as usize; let end_idx = end_idx as usize; self.buffer[idx..end_idx].copy_from_slice(value); - - if let Some(merkle) = self.merkle.take() { - let start_leaf = idx / Self::LEAF_SIZE; - merkle.set(start_leaf, hash_leaf(self.get_leaf_data(start_leaf))); - // No need for second merkle - assert!(value.len() <= Self::LEAF_SIZE); - self.merkle = Some(merkle); - } + self.dirty_indices.lock().unwrap().insert(idx); true } From d247ebdca167fe6208325197f13c47de3575b88e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Mon, 13 May 2024 15:23:22 +0200 Subject: [PATCH 055/140] Enable always_merkleize everywhere. This is to prove that the code is still fast enough to pass the test-go suite of tests if the `always_merkleize` feature is enabled. --- arbitrator/prover/src/lib.rs | 4 ++-- arbitrator/prover/src/machine.rs | 2 +- arbitrator/stylus/src/test/mod.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index 1e3ecf4cd6..b9dc032f40 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -101,7 +101,7 @@ unsafe fn arbitrator_load_machine_impl( &libraries, binary_path, true, - false, + true, false, debug_chain, debug_chain, @@ -117,7 +117,7 @@ unsafe fn arbitrator_load_machine_impl( pub unsafe extern "C" fn arbitrator_load_wavm_binary(binary_path: *const c_char) -> *mut Machine { let binary_path = cstr_to_string(binary_path); let binary_path = Path::new(&binary_path); - match Machine::new_from_wavm(binary_path, false) { + match Machine::new_from_wavm(binary_path, true) { Ok(mach) => Box::into_raw(Box::new(mach)), Err(err) => { eprintln!("Error loading binary: {err}"); diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index 5c4471a9fd..5aa7954653 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -1276,7 +1276,7 @@ impl Machine { &[soft_float, wasi_stub, user_test], bin, false, - false, + true, false, compile.debug.debug_funcs, true, diff --git a/arbitrator/stylus/src/test/mod.rs b/arbitrator/stylus/src/test/mod.rs index d7f3248d31..2f8819df86 100644 --- a/arbitrator/stylus/src/test/mod.rs +++ b/arbitrator/stylus/src/test/mod.rs @@ -150,7 +150,7 @@ fn new_test_machine(path: &str, compile: &CompileConfig) -> Result { &[lib], bin, false, - false, + true, true, compile.debug.debug_funcs, true, From 701327647c1a17b21e6c59ae297e5b9227a79b90 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Mon, 13 May 2024 16:24:03 +0200 Subject: [PATCH 056/140] Make always_merkleize the only strategy. This is now fast enough to just use it as the only implementation and simplify the code a bit. --- arbitrator/bench/src/bin.rs | 16 ++----------- arbitrator/bench/src/prepare.rs | 8 ++----- arbitrator/prover/src/lib.rs | 3 +-- arbitrator/prover/src/machine.rs | 37 +++++++++---------------------- arbitrator/prover/src/main.rs | 3 --- arbitrator/stylus/src/test/mod.rs | 1 - 6 files changed, 16 insertions(+), 52 deletions(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 3b527fb8dd..5c71448991 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -25,27 +25,15 @@ struct Args { /// Path to a machine.wavm.br #[arg(short, long)] machine_path: PathBuf, - - /// Should the memory tree always Merkleize - #[arg(short, long)] - always_merkleize: bool, } fn main() -> eyre::Result<()> { let args = Args::parse(); let step_sizes = [1, 1 << 10, 1 << 15, 1 << 20, 1 << 24, 1 << 26, 1 << 28]; - if args.always_merkleize { - println!("Running benchmark with always merkleize feature on"); - } else { - println!("Running benchmark with always merkleize feature off"); - } + println!("Running benchmark with always merkleize feature on"); for step_size in step_sizes { - let mut machine = prepare_machine( - args.preimages_path.clone(), - args.machine_path.clone(), - args.always_merkleize, - )?; + let mut machine = prepare_machine(args.preimages_path.clone(), args.machine_path.clone())?; let _ = machine.hash(); let mut hash_times = vec![]; let mut step_times = vec![]; diff --git a/arbitrator/bench/src/prepare.rs b/arbitrator/bench/src/prepare.rs index 3cc884db6d..aebc7ae895 100644 --- a/arbitrator/bench/src/prepare.rs +++ b/arbitrator/bench/src/prepare.rs @@ -9,11 +9,7 @@ use std::sync::Arc; use crate::parse_input::*; -pub fn prepare_machine( - preimages: PathBuf, - machines: PathBuf, - always_merkleize: bool, -) -> eyre::Result { +pub fn prepare_machine(preimages: PathBuf, machines: PathBuf) -> eyre::Result { let file = File::open(preimages)?; let reader = BufReader::new(file); @@ -33,7 +29,7 @@ pub fn prepare_machine( let binary_path = Path::new(&machines); // println!("Creating machine from binary_path"); - let mut mach = Machine::new_from_wavm(binary_path, always_merkleize)?; + let mut mach = Machine::new_from_wavm(binary_path)?; let block_hash: [u8; 32] = data.start_state.block_hash.try_into().unwrap(); let block_hash: Bytes32 = block_hash.into(); diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index b9dc032f40..0f537478eb 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -102,7 +102,6 @@ unsafe fn arbitrator_load_machine_impl( binary_path, true, true, - false, debug_chain, debug_chain, Default::default(), @@ -117,7 +116,7 @@ unsafe fn arbitrator_load_machine_impl( pub unsafe extern "C" fn arbitrator_load_wavm_binary(binary_path: *const c_char) -> *mut Machine { let binary_path = cstr_to_string(binary_path); let binary_path = Path::new(&binary_path); - match Machine::new_from_wavm(binary_path, true) { + match Machine::new_from_wavm(binary_path) { Ok(mach) => Box::into_raw(Box::new(mach)), Err(err) => { eprintln!("Error loading binary: {err}"); diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index 5aa7954653..c7550e642a 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -1221,7 +1221,6 @@ impl Machine { library_paths: &[PathBuf], binary_path: &Path, language_support: bool, - always_merkleize: bool, allow_hostapi_from_main: bool, debug_funcs: bool, debug_info: bool, @@ -1246,7 +1245,6 @@ impl Machine { &libraries, bin, language_support, - always_merkleize, allow_hostapi_from_main, debug_funcs, debug_info, @@ -1277,7 +1275,6 @@ impl Machine { bin, false, true, - false, compile.debug.debug_funcs, true, GlobalState::default(), @@ -1324,7 +1321,6 @@ impl Machine { libraries: &[WasmBinary<'_>], bin: WasmBinary<'_>, runtime_support: bool, - always_merkleize: bool, allow_hostapi_from_main: bool, debug_funcs: bool, debug_info: bool, @@ -1527,18 +1523,12 @@ impl Machine { let tables_hashes: Result<_, _> = module.tables.iter().map(Table::hash).collect(); module.tables_merkle = Merkle::new(MerkleType::Table, tables_hashes?); - - if always_merkleize { - module.memory.cache_merkle_tree(); - } - } - let mut modules_merkle = None; - if always_merkleize { - modules_merkle = Some(Merkle::new( - MerkleType::Module, - modules.iter().map(Module::hash).collect(), - )); + module.memory.cache_merkle_tree(); } + let modules_merkle = Some(Merkle::new( + MerkleType::Module, + modules.iter().map(Module::hash).collect(), + )); // find the first inbox index that's out of bounds let first_too_far = inbox_contents @@ -1572,7 +1562,7 @@ impl Machine { Ok(mach) } - pub fn new_from_wavm(wavm_binary: &Path, always_merkleize: bool) -> Result { + pub fn new_from_wavm(wavm_binary: &Path) -> Result { let mut modules: Vec = { let compressed = std::fs::read(wavm_binary)?; let Ok(modules) = brotli::decompress(&compressed, Dictionary::Empty) else { @@ -1598,17 +1588,12 @@ impl Machine { MerkleType::Function, module.funcs.iter().map(Function::hash).collect(), )); - if always_merkleize { - module.memory.cache_merkle_tree(); - } - } - let mut modules_merkle: Option = None; - if always_merkleize { - modules_merkle = Some(Merkle::new( - MerkleType::Module, - modules.iter().map(Module::hash).collect(), - )); + module.memory.cache_merkle_tree(); } + let modules_merkle = Some(Merkle::new( + MerkleType::Module, + modules.iter().map(Module::hash).collect(), + )); let mut mach = Machine { status: MachineStatus::Running, thread_state: ThreadState::Main, diff --git a/arbitrator/prover/src/main.rs b/arbitrator/prover/src/main.rs index 697d178fc7..01001b0794 100644 --- a/arbitrator/prover/src/main.rs +++ b/arbitrator/prover/src/main.rs @@ -35,8 +35,6 @@ struct Opts { #[structopt(long)] inbox_add_stub_headers: bool, #[structopt(long)] - always_merkleize: bool, - #[structopt(long)] debug_funcs: bool, #[structopt(long)] /// print modules to the console @@ -192,7 +190,6 @@ fn main() -> Result<()> { &opts.libraries, &opts.binary, true, - opts.always_merkleize, opts.allow_hostapi, opts.debug_funcs, true, diff --git a/arbitrator/stylus/src/test/mod.rs b/arbitrator/stylus/src/test/mod.rs index 2f8819df86..236e5639e6 100644 --- a/arbitrator/stylus/src/test/mod.rs +++ b/arbitrator/stylus/src/test/mod.rs @@ -151,7 +151,6 @@ fn new_test_machine(path: &str, compile: &CompileConfig) -> Result { bin, false, true, - true, compile.debug.debug_funcs, true, GlobalState::default(), From 4087fd466ff87a01e9c621be77ef1eabb931e3d1 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 17 May 2024 17:28:53 +0200 Subject: [PATCH 057/140] Fix the Cargo.lock file It had been merged incorrectly from master. --- arbitrator/Cargo.lock | 237 ++++++++++++++++++++++++------------------ 1 file changed, 133 insertions(+), 104 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 1a0cc4f053..3d2ddcc04e 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -55,6 +55,12 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "ansi_term" version = "0.12.1" @@ -66,47 +72,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -349,9 +356,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" dependencies = [ "jobserver", "libc", @@ -443,7 +450,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.64", ] [[package]] @@ -454,9 +461,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "convert_case" @@ -667,12 +674,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" dependencies = [ - "darling_core 0.20.8", - "darling_macro 0.20.8", + "darling_core 0.20.9", + "darling_macro 0.20.9", ] [[package]] @@ -691,15 +698,15 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -715,13 +722,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ - "darling_core 0.20.8", + "darling_core 0.20.9", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -808,9 +815,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "enum-iterator" @@ -823,11 +830,11 @@ dependencies = [ [[package]] name = "enum-iterator" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0b48d2b80ff6b002339547442496ea29d66a8c66ce8e1a6bd8c58b9cec7cf3" +checksum = "c280b9e6b3ae19e152d8e31cf47f18389781e119d4013a2a2bb0180e5facc635" dependencies = [ - "enum-iterator-derive 1.3.1", + "enum-iterator-derive 1.4.0", ] [[package]] @@ -843,13 +850,13 @@ dependencies = [ [[package]] name = "enum-iterator-derive" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19cbb53d33b57ac4df1f0af6b92c38c107cded663c4aea9fae1189dcfc17cf5" +checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.64", ] [[package]] @@ -867,10 +874,10 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "darling 0.20.8", + "darling 0.20.9", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -1114,6 +1121,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -1194,9 +1207,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.154" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libfuzzer-sys" @@ -1348,9 +1361,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -1362,20 +1375,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -1388,7 +1400,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -1413,11 +1425,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -1460,7 +1471,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -1519,7 +1530,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -1528,6 +1539,40 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1569,9 +1614,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -1587,7 +1632,7 @@ dependencies = [ "criterion", "derivative", "digest 0.9.0", - "enum-iterator 2.0.1", + "enum-iterator 2.1.0", "eyre", "fnv", "hex", @@ -1835,9 +1880,9 @@ checksum = "89dc553bc0cf4512a8b96caa2e21ed5f6e4b66bf28a1bd08fd9eb07c0b39b28c" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" @@ -1850,9 +1895,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -1883,15 +1928,15 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] @@ -1909,20 +1954,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -2130,9 +2175,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" dependencies = [ "proc-macro2", "quote", @@ -2162,22 +2207,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -2225,9 +2270,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" [[package]] name = "toml_edit" @@ -2259,7 +2304,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -2367,7 +2412,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", "wasm-bindgen-shared", ] @@ -2389,7 +2434,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2639,11 +2684,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -2690,22 +2735,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.5", ] -[[package]] -name = "windows-targets" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" -dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", -] - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.5" @@ -2804,22 +2833,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.33" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "087eca3c1eaf8c47b94d02790dd086cd594b912d2043d4de4bfdd466b3befb7c" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.33" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4b6c273f496d8fd4eaf18853e6b448760225dc030ff2c485a786859aea6393" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] [[package]] @@ -2839,5 +2868,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.64", ] From ccc1ee02b3e3bbc010790e4a2a156c9dbb0fed4c Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 17 May 2024 18:54:38 +0200 Subject: [PATCH 058/140] Regenerate the Cargo.lock --- arbitrator/Cargo.lock | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 5b82f10e8e..af9a89b149 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -55,6 +55,21 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anes" version = "0.1.6" @@ -396,7 +411,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-targets 0.52.5", + "windows-targets", ] [[package]] @@ -734,6 +749,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", + "strsim 0.11.1", "syn 2.0.64", ] @@ -1148,6 +1164,7 @@ checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.5", + "serde", ] [[package]] @@ -1644,6 +1661,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2065,7 +2088,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", @@ -2091,10 +2114,10 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" dependencies = [ - "darling 0.20.8", + "darling 0.20.9", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.64", ] [[package]] @@ -2835,7 +2858,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets", ] [[package]] From d8c832a01589ef8e3267432bfa9326ea62185ff7 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 21 May 2024 09:18:32 +0200 Subject: [PATCH 059/140] Move the layer data and dirty indices to a struct. This allows us to lock a single Mutex to gain access to both parts of the data structure. This helps us to prevent deadlocks caused by accessing the separate locks in different order from various call sites. --- arbitrator/prover/src/merkle.rs | 80 ++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 5a3cbadbc7..b37e0140ba 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -149,6 +149,12 @@ impl MerkleType { } } +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +struct Layers { + data: Vec>, + dirt: Vec>, +} + /// A Merkle tree with a fixed number of layers /// /// https://en.wikipedia.org/wiki/Merkle_tree @@ -168,10 +174,8 @@ impl MerkleType { pub struct Merkle { ty: MerkleType, #[serde(with = "arc_mutex_sedre")] - layers: Arc>>>, + layers: Arc>, min_depth: usize, - #[serde(with = "arc_mutex_sedre")] - dirty_layers: Arc>>>, } fn hash_node(ty: MerkleType, a: impl AsRef<[u8]>, b: impl AsRef<[u8]>) -> Bytes32 { @@ -247,42 +251,43 @@ impl Merkle { layers.push(new_layer); layer_i += 1; } - let dirty_layers = Arc::new(Mutex::new(dirty_indices)); + let layers = Arc::new(Mutex::new(Layers { + data: layers, + dirt: dirty_indices, + })); Merkle { ty, - layers: Arc::new(Mutex::new(layers)), + layers, min_depth, - dirty_layers, } } fn rehash(&self) { - let dirty_layers = &mut self.dirty_layers.lock().unwrap(); - if dirty_layers.is_empty() || dirty_layers[0].is_empty() { + let layers = &mut self.layers.lock().unwrap(); + if layers.dirt.is_empty() || layers.dirt[0].is_empty() { return; } - let layers = &mut self.layers.lock().unwrap(); - for layer_i in 1..layers.len() { + for layer_i in 1..layers.data.len() { let dirty_i = layer_i - 1; - let dirt = dirty_layers[dirty_i].clone(); + let dirt = layers.dirt[dirty_i].clone(); for idx in dirt.iter().sorted() { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; - let left = layers[layer_i - 1][left_child_idx]; - let right = layers[layer_i - 1] + let left = layers.data[layer_i - 1][left_child_idx]; + let right = layers.data[layer_i - 1] .get(right_child_idx) .unwrap_or(empty_hash_at(self.ty, layer_i - 1)); let new_hash = hash_node(self.ty, left, right); - if *idx < layers[layer_i].len() { - layers[layer_i][*idx] = new_hash; + if *idx < layers.data[layer_i].len() { + layers.data[layer_i][*idx] = new_hash; } else { - layers[layer_i].push(new_hash); + layers.data[layer_i].push(new_hash); } - if layer_i < layers.len() - 1 { - dirty_layers[dirty_i + 1].insert(idx >> 1); + if layer_i < layers.data.len() - 1 { + layers.dirt[dirty_i + 1].insert(idx >> 1); } } - dirty_layers[dirty_i].clear(); + layers.dirt[dirty_i].clear(); } } @@ -290,7 +295,7 @@ impl Merkle { #[cfg(feature = "counters")] ROOT_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); self.rehash(); - if let Some(layer) = self.layers.lock().unwrap().last() { + if let Some(layer) = self.layers.lock().unwrap().data.last() { assert_eq!(layer.len(), 1); layer[0] } else { @@ -302,26 +307,27 @@ impl Merkle { #[inline] fn capacity(&self) -> usize { let layers = self.layers.lock().unwrap(); - if layers.is_empty() { + if layers.data.is_empty() { return 0; } let base: usize = 2; - base.pow((layers.len() - 1).try_into().unwrap()) + base.pow((layers.data.len() - 1).try_into().unwrap()) } // Returns the number of leaves in the tree. pub fn len(&self) -> usize { - self.layers.lock().unwrap()[0].len() + self.layers.lock().unwrap().data[0].len() } pub fn is_empty(&self) -> bool { let layers = self.layers.lock().unwrap(); - layers.is_empty() || layers[0].is_empty() + layers.data.is_empty() || layers.data[0].is_empty() } #[must_use] pub fn prove(&self, idx: usize) -> Option> { - if self.layers.lock().unwrap().is_empty() || idx >= self.layers.lock().unwrap()[0].len() { + let layers = self.layers.lock().unwrap(); + if layers.data.is_empty() || idx >= layers.data[0].len() { return None; } Some(self.prove_any(idx)) @@ -332,9 +338,9 @@ impl Merkle { pub fn prove_any(&self, mut idx: usize) -> Vec { self.rehash(); let layers = self.layers.lock().unwrap(); - let mut proof = vec![u8::try_from(layers.len() - 1).unwrap()]; - for (layer_i, layer) in layers.iter().enumerate() { - if layer_i == layers.len() - 1 { + let mut proof = vec![u8::try_from(layers.data.len() - 1).unwrap()]; + for (layer_i, layer) in layers.data.iter().enumerate() { + if layer_i == layers.data.len() - 1 { break; } let counterpart = idx ^ 1; @@ -352,7 +358,7 @@ impl Merkle { /// Adds a new leaf to the merkle /// Currently O(n) in the number of leaves (could be log(n)) pub fn push_leaf(&mut self, leaf: Bytes32) { - let mut leaves = self.layers.lock().unwrap().swap_remove(0); + let mut leaves = self.layers.lock().unwrap().data.swap_remove(0); leaves.push(leaf); *self = Self::new_advanced(self.ty, leaves, self.min_depth); } @@ -360,7 +366,7 @@ impl Merkle { /// Removes the rightmost leaf from the merkle /// Currently O(n) in the number of leaves (could be log(n)) pub fn pop_leaf(&mut self) { - let mut leaves = self.layers.lock().unwrap().swap_remove(0); + let mut leaves = self.layers.lock().unwrap().data.swap_remove(0); leaves.pop(); *self = Self::new_advanced(self.ty, leaves, self.min_depth); } @@ -371,11 +377,11 @@ impl Merkle { #[cfg(feature = "counters")] SET_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); let mut layers = self.layers.lock().unwrap(); - if layers[0][idx] == hash { + if layers.data[0][idx] == hash { return; } - layers[0][idx] = hash; - self.dirty_layers.lock().unwrap()[0].insert(idx >> 1); + layers.data[0][idx] = hash; + layers.dirt[0].insert(idx >> 1); } /// Resizes the number of leaves the tree can hold. @@ -389,15 +395,15 @@ impl Merkle { } let mut layers = self.layers.lock().unwrap(); let mut layer_size = new_len; - for (layer_i, layer) in layers.iter_mut().enumerate() { + for (layer_i, layer) in layers.data.iter_mut().enumerate() { layer.resize(layer_size, *empty_hash_at(self.ty, layer_i)); layer_size = max(layer_size >> 1, 1); } - let start = layers[0].len(); + let start = layers.data[0].len(); for i in start..new_len { - self.dirty_layers.lock().unwrap()[0].insert(i); + layers.dirt[0].insert(i); } - Ok(layers[0].len()) + Ok(layers.data[0].len()) } } From bd49d472689554433b6b49f1d952fee50da29605 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 21 May 2024 12:52:01 +0200 Subject: [PATCH 060/140] Remove deadlocks. --- arbitrator/prover/src/merkle.rs | 51 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index b37e0140ba..70884da096 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -6,6 +6,8 @@ use digest::Digest; use enum_iterator::Sequence; +use parking_lot::Mutex; + #[cfg(feature = "counters")] use enum_iterator::all; use itertools::Itertools; @@ -30,7 +32,7 @@ use sha3::Keccak256; use std::{ collections::HashSet, convert::{TryFrom, TryInto}, - sync::{Arc, Mutex}, + sync::Arc, }; #[cfg(feature = "rayon")] @@ -262,8 +264,7 @@ impl Merkle { } } - fn rehash(&self) { - let layers = &mut self.layers.lock().unwrap(); + fn rehash(&self, layers: &mut Layers) { if layers.dirt.is_empty() || layers.dirt[0].is_empty() { return; } @@ -294,8 +295,9 @@ impl Merkle { pub fn root(&self) -> Bytes32 { #[cfg(feature = "counters")] ROOT_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); - self.rehash(); - if let Some(layer) = self.layers.lock().unwrap().data.last() { + let mut layers = self.layers.lock(); + self.rehash(&mut layers); + if let Some(layer) = layers.data.last() { assert_eq!(layer.len(), 1); layer[0] } else { @@ -306,7 +308,7 @@ impl Merkle { // Returns the total number of leaves the tree can hold. #[inline] fn capacity(&self) -> usize { - let layers = self.layers.lock().unwrap(); + let layers = self.layers.lock(); if layers.data.is_empty() { return 0; } @@ -316,18 +318,17 @@ impl Merkle { // Returns the number of leaves in the tree. pub fn len(&self) -> usize { - self.layers.lock().unwrap().data[0].len() + self.layers.lock().data[0].len() } pub fn is_empty(&self) -> bool { - let layers = self.layers.lock().unwrap(); + let layers = self.layers.lock(); layers.data.is_empty() || layers.data[0].is_empty() } #[must_use] pub fn prove(&self, idx: usize) -> Option> { - let layers = self.layers.lock().unwrap(); - if layers.data.is_empty() || idx >= layers.data[0].len() { + if self.layers.lock().data.is_empty() || idx >= self.layers.lock().data[0].len() { return None; } Some(self.prove_any(idx)) @@ -336,8 +337,8 @@ impl Merkle { /// creates a merkle proof regardless of if the leaf has content #[must_use] pub fn prove_any(&self, mut idx: usize) -> Vec { - self.rehash(); - let layers = self.layers.lock().unwrap(); + let mut layers = self.layers.lock(); + self.rehash(&mut layers); let mut proof = vec![u8::try_from(layers.data.len() - 1).unwrap()]; for (layer_i, layer) in layers.data.iter().enumerate() { if layer_i == layers.data.len() - 1 { @@ -358,7 +359,7 @@ impl Merkle { /// Adds a new leaf to the merkle /// Currently O(n) in the number of leaves (could be log(n)) pub fn push_leaf(&mut self, leaf: Bytes32) { - let mut leaves = self.layers.lock().unwrap().data.swap_remove(0); + let mut leaves = self.layers.lock().data.swap_remove(0); leaves.push(leaf); *self = Self::new_advanced(self.ty, leaves, self.min_depth); } @@ -366,7 +367,7 @@ impl Merkle { /// Removes the rightmost leaf from the merkle /// Currently O(n) in the number of leaves (could be log(n)) pub fn pop_leaf(&mut self) { - let mut leaves = self.layers.lock().unwrap().data.swap_remove(0); + let mut leaves = self.layers.lock().data.swap_remove(0); leaves.pop(); *self = Self::new_advanced(self.ty, leaves, self.min_depth); } @@ -376,7 +377,7 @@ impl Merkle { pub fn set(&self, idx: usize, hash: Bytes32) { #[cfg(feature = "counters")] SET_COUNTERS[&self.ty].fetch_add(1, Ordering::Relaxed); - let mut layers = self.layers.lock().unwrap(); + let mut layers = self.layers.lock(); if layers.data[0][idx] == hash { return; } @@ -393,7 +394,7 @@ impl Merkle { "Cannot resize to a length greater than the capacity of the tree.".to_owned(), ); } - let mut layers = self.layers.lock().unwrap(); + let mut layers = self.layers.lock(); let mut layer_size = new_len; for (layer_i, layer) in layers.data.iter_mut().enumerate() { layer.resize(layer_size, *empty_hash_at(self.ty, layer_i)); @@ -416,27 +417,23 @@ impl PartialEq for Merkle { impl Eq for Merkle {} pub mod arc_mutex_sedre { - pub fn serialize( - data: &std::sync::Arc>, - serializer: S, - ) -> Result + use parking_lot::Mutex; + use std::sync::Arc; + + pub fn serialize(data: &Arc>, serializer: S) -> Result where S: serde::Serializer, T: serde::Serialize, { - data.lock().unwrap().serialize(serializer) + data.lock().serialize(serializer) } - pub fn deserialize<'de, D, T>( - deserializer: D, - ) -> Result>, D::Error> + pub fn deserialize<'de, D, T>(deserializer: D) -> Result>, D::Error> where D: serde::Deserializer<'de>, T: serde::Deserialize<'de>, { - Ok(std::sync::Arc::new(std::sync::Mutex::new(T::deserialize( - deserializer, - )?))) + Ok(Arc::new(Mutex::new(T::deserialize(deserializer)?))) } } From d2398d85d7fbee5897de260ed76308ab48c3f898 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 21 May 2024 13:33:32 +0200 Subject: [PATCH 061/140] Remove --always-merkleize The prover no longer runs in any other mode. --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 53b89c8d72..223fc08593 100644 --- a/Makefile +++ b/Makefile @@ -427,10 +427,10 @@ $(stylus_test_erc20_wasm): $(stylus_test_erc20_src) @touch -c $@ # cargo might decide to not rebuild the binary contracts/test/prover/proofs/float%.json: $(arbitrator_cases)/float%.wasm $(prover_bin) $(output_latest)/soft-float.wasm - $(prover_bin) $< -l $(output_latest)/soft-float.wasm -o $@ -b --allow-hostapi --require-success --always-merkleize + $(prover_bin) $< -l $(output_latest)/soft-float.wasm -o $@ -b --allow-hostapi --require-success contracts/test/prover/proofs/no-stack-pollution.json: $(arbitrator_cases)/no-stack-pollution.wasm $(prover_bin) - $(prover_bin) $< -o $@ --allow-hostapi --require-success --always-merkleize + $(prover_bin) $< -o $@ --allow-hostapi --require-success target/testdata/preimages.bin: mkdir -p `dirname $@` @@ -454,19 +454,19 @@ contracts/test/prover/proofs/global-state.json: echo "[]" > $@ contracts/test/prover/proofs/forward-test.json: $(arbitrator_cases)/forward-test.wasm $(arbitrator_tests_forward_deps) $(prover_bin) - $(prover_bin) $< -o $@ --allow-hostapi --always-merkleize $(patsubst %,-l %, $(arbitrator_tests_forward_deps)) + $(prover_bin) $< -o $@ --allow-hostapi $(patsubst %,-l %, $(arbitrator_tests_forward_deps)) contracts/test/prover/proofs/link.json: $(arbitrator_cases)/link.wasm $(arbitrator_tests_link_deps) $(prover_bin) - $(prover_bin) $< -o $@ --allow-hostapi --always-merkleize --stylus-modules $(arbitrator_tests_link_deps) --require-success + $(prover_bin) $< -o $@ --allow-hostapi --stylus-modules $(arbitrator_tests_link_deps) --require-success contracts/test/prover/proofs/dynamic.json: $(patsubst %,$(arbitrator_cases)/%.wasm, dynamic user) $(prover_bin) - $(prover_bin) $< -o $@ --allow-hostapi --always-merkleize --stylus-modules $(arbitrator_cases)/user.wasm --require-success + $(prover_bin) $< -o $@ --allow-hostapi --stylus-modules $(arbitrator_cases)/user.wasm --require-success contracts/test/prover/proofs/bulk-memory.json: $(patsubst %,$(arbitrator_cases)/%.wasm, bulk-memory) $(prover_bin) - $(prover_bin) $< -o $@ --allow-hostapi --always-merkleize --stylus-modules $(arbitrator_cases)/user.wasm -b + $(prover_bin) $< -o $@ --allow-hostapi --stylus-modules $(arbitrator_cases)/user.wasm -b contracts/test/prover/proofs/%.json: $(arbitrator_cases)/%.wasm $(prover_bin) - $(prover_bin) $< -o $@ --allow-hostapi --always-merkleize + $(prover_bin) $< -o $@ --allow-hostapi # strategic rules to minimize dependency building From 9539e9a2fbb9b8fe62e7912072315fba691466e2 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 22 May 2024 11:20:44 +0200 Subject: [PATCH 062/140] Make clone create completely independent layers structs. The default behavior of an Arc is to allow sharing between different threads and different instances. So, the derived behavior for cloning was to put the same references on the clone as on the orignal. But, we actually want separate clones of our merkle trees to be independent. That is, changing the data on the clone, should have no affect on the original (and vice versa.) The test added in this commit failed before the change and passes afer. --- arbitrator/prover/src/merkle.rs | 35 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index ab7b458fda..56cbf56d99 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -32,7 +32,6 @@ use sha3::Keccak256; use std::{ collections::HashSet, convert::{TryFrom, TryInto}, - sync::Arc, }; #[cfg(feature = "rayon")] @@ -189,11 +188,11 @@ struct Layers { /// and passing a minimum depth. /// /// This structure does not contain the data itself, only the hashes. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Default, Serialize, Deserialize)] pub struct Merkle { ty: MerkleType, - #[serde(with = "arc_mutex_sedre")] - layers: Arc>, + #[serde(with = "mutex_sedre")] + layers: Mutex, min_depth: usize, } @@ -239,6 +238,12 @@ fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) new_layer } +impl Clone for Merkle { + fn clone(&self) -> Self { + Merkle::new_advanced(self.ty, self.layers.lock().data[0].clone(), self.min_depth) + } +} + impl Merkle { /// Creates a new Merkle tree with the given type and leaf hashes. /// The tree is built up to the minimum depth necessary to hold all the @@ -270,10 +275,10 @@ impl Merkle { layers.push(new_layer); layer_i += 1; } - let layers = Arc::new(Mutex::new(Layers { + let layers = Mutex::new(Layers { data: layers, dirt: dirty_indices, - })); + }); Merkle { ty, layers, @@ -435,11 +440,10 @@ impl PartialEq for Merkle { impl Eq for Merkle {} -pub mod arc_mutex_sedre { +pub mod mutex_sedre { use parking_lot::Mutex; - use std::sync::Arc; - pub fn serialize(data: &Arc>, serializer: S) -> Result + pub fn serialize(data: &Mutex, serializer: S) -> Result where S: serde::Serializer, T: serde::Serialize, @@ -447,12 +451,12 @@ pub mod arc_mutex_sedre { data.lock().serialize(serializer) } - pub fn deserialize<'de, D, T>(deserializer: D) -> Result>, D::Error> + pub fn deserialize<'de, D, T>(deserializer: D) -> Result, D::Error> where D: serde::Deserializer<'de>, T: serde::Deserialize<'de>, { - Ok(Arc::new(Mutex::new(T::deserialize(deserializer)?))) + Ok(Mutex::new(T::deserialize(deserializer)?)) } } @@ -566,6 +570,15 @@ fn emit_memory_zerohashes() { } } +#[test] +fn clone_is_separate() { + let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); + let m2 = merkle.clone(); + m2.resize(4).expect("resize failed"); + m2.set(3, Bytes32::from([2; 32])); + assert_ne!(merkle, m2); +} + #[test] fn serialization_roundtrip() { let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); From ef7313d8af33d93002ceb95334c461bbc43e8d71 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 22 May 2024 11:20:44 +0200 Subject: [PATCH 063/140] Make clone create completely independent layers structs. The default behavior of an Arc is to allow sharing between different threads and different instances. So, the derived behavior for cloning was to put the same references on the clone as on the orignal. But, we actually want separate clones of our merkle trees to be independent. That is, changing the data on the clone, should have no affect on the original (and vice versa.) The test added in this commit failed before the change and passes afer. --- arbitrator/prover/src/merkle.rs | 35 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 70884da096..be1eef8b69 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -32,7 +32,6 @@ use sha3::Keccak256; use std::{ collections::HashSet, convert::{TryFrom, TryInto}, - sync::Arc, }; #[cfg(feature = "rayon")] @@ -172,11 +171,11 @@ struct Layers { /// and passing a minimum depth. /// /// This structure does not contain the data itself, only the hashes. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Default, Serialize, Deserialize)] pub struct Merkle { ty: MerkleType, - #[serde(with = "arc_mutex_sedre")] - layers: Arc>, + #[serde(with = "mutex_sedre")] + layers: Mutex, min_depth: usize, } @@ -222,6 +221,12 @@ fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) new_layer } +impl Clone for Merkle { + fn clone(&self) -> Self { + Merkle::new_advanced(self.ty, self.layers.lock().data[0].clone(), self.min_depth) + } +} + impl Merkle { /// Creates a new Merkle tree with the given type and leaf hashes. /// The tree is built up to the minimum depth necessary to hold all the @@ -253,10 +258,10 @@ impl Merkle { layers.push(new_layer); layer_i += 1; } - let layers = Arc::new(Mutex::new(Layers { + let layers = Mutex::new(Layers { data: layers, dirt: dirty_indices, - })); + }); Merkle { ty, layers, @@ -416,11 +421,10 @@ impl PartialEq for Merkle { impl Eq for Merkle {} -pub mod arc_mutex_sedre { +pub mod mutex_sedre { use parking_lot::Mutex; - use std::sync::Arc; - pub fn serialize(data: &Arc>, serializer: S) -> Result + pub fn serialize(data: &Mutex, serializer: S) -> Result where S: serde::Serializer, T: serde::Serialize, @@ -428,12 +432,12 @@ pub mod arc_mutex_sedre { data.lock().serialize(serializer) } - pub fn deserialize<'de, D, T>(deserializer: D) -> Result>, D::Error> + pub fn deserialize<'de, D, T>(deserializer: D) -> Result, D::Error> where D: serde::Deserializer<'de>, T: serde::Deserialize<'de>, { - Ok(Arc::new(Mutex::new(T::deserialize(deserializer)?))) + Ok(Mutex::new(T::deserialize(deserializer)?)) } } @@ -547,6 +551,15 @@ fn emit_memory_zerohashes() { } } +#[test] +fn clone_is_separate() { + let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); + let m2 = merkle.clone(); + m2.resize(4).expect("resize failed"); + m2.set(3, Bytes32::from([2; 32])); + assert_ne!(merkle, m2); +} + #[test] fn serialization_roundtrip() { let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); From 4306ec3e05a57950e7681d88316b4c29b1a53ce6 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 22 May 2024 13:22:00 +0200 Subject: [PATCH 064/140] Handle the empty leaves case. During a clone of an empty Merkle tree, there was an index out of bounds error. --- arbitrator/prover/src/merkle.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index be1eef8b69..005d3dae16 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -223,7 +223,12 @@ fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) impl Clone for Merkle { fn clone(&self) -> Self { - Merkle::new_advanced(self.ty, self.layers.lock().data[0].clone(), self.min_depth) + let leaves = if self.layers.lock().data.is_empty() { + vec![] + } else { + self.layers.lock().data[0].clone() + }; + Merkle::new_advanced(self.ty, leaves, self.min_depth) } } From b075b20e3b99805fa3b12218ec8b341f9f203871 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Mon, 27 May 2024 16:14:48 +0200 Subject: [PATCH 065/140] Make clippy happy. --- arbitrator/bench/src/parse_input.rs | 6 +++--- arbitrator/bench/src/prepare.rs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arbitrator/bench/src/parse_input.rs b/arbitrator/bench/src/parse_input.rs index f04150ea22..decc67372a 100644 --- a/arbitrator/bench/src/parse_input.rs +++ b/arbitrator/bench/src/parse_input.rs @@ -24,8 +24,8 @@ mod prefixed_hex { D: Deserializer<'de>, { let s = String::deserialize(deserializer)?; - if s.starts_with("0x") { - hex::decode(&s[2..]).map_err(serde::de::Error::custom) + if let Some(s) = s.strip_prefix("0x") { + hex::decode(s).map_err(serde::de::Error::custom) } else { Err(serde::de::Error::custom("missing 0x prefix")) } @@ -71,6 +71,6 @@ pub struct FileData { impl FileData { pub fn from_reader(mut reader: R) -> io::Result { let data = serde_json::from_reader(&mut reader)?; - return Ok(data); + Ok(data) } } diff --git a/arbitrator/bench/src/prepare.rs b/arbitrator/bench/src/prepare.rs index aebc7ae895..668f5e1120 100644 --- a/arbitrator/bench/src/prepare.rs +++ b/arbitrator/bench/src/prepare.rs @@ -17,8 +17,7 @@ pub fn prepare_machine(preimages: PathBuf, machines: PathBuf) -> eyre::Result>>(); let preimage_resolver = move |_: u64, _: PreimageType, hash: Bytes32| -> Option { preimages From db2a1dfdb8cffb8e1f86160bfd092bd41e2dd080 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 4 Jun 2024 10:26:53 +0200 Subject: [PATCH 066/140] Update Cargo.lock --- arbitrator/Cargo.lock | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 45b2c551dd..1222576846 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -450,7 +450,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.66", ] [[package]] @@ -856,7 +856,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.66", ] [[package]] @@ -1899,6 +1899,15 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scopeguard" version = "1.2.0" From 8d074df86d199012b7ed7c1a5121b23730aea503 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 5 Jun 2024 16:49:40 +0200 Subject: [PATCH 067/140] Fix Clone for the Memory type. This was causing problems across with the CGo bindings. --- arbitrator/prover/src/memory.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 78b5ba7259..d5d0a0855d 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -10,13 +10,7 @@ use digest::Digest; use eyre::{bail, ErrReport, Result}; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::{ - borrow::Cow, - collections::HashSet, - convert::TryFrom, - ops::Deref, - sync::{Arc, Mutex}, -}; +use std::{borrow::Cow, collections::HashSet, convert::TryFrom, ops::Deref, sync::Mutex}; #[cfg(feature = "counters")] use std::sync::atomic::{AtomicUsize, Ordering}; @@ -70,14 +64,14 @@ impl TryFrom<&wasmparser::MemoryType> for MemoryType { } } -#[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[derive(Debug, Default, Serialize, Deserialize)] pub struct Memory { buffer: Vec, #[serde(skip)] pub merkle: Option, pub max_size: u64, #[serde(skip)] - dirty_indices: Arc>>, + dirty_indices: Mutex>, } fn hash_leaf(bytes: [u8; Memory::LEAF_SIZE]) -> Bytes32 { @@ -116,6 +110,17 @@ impl PartialEq for Memory { } } +impl Clone for Memory { + fn clone(&self) -> Self { + Memory { + buffer: self.buffer.clone(), + merkle: self.merkle.clone(), + max_size: self.max_size, + dirty_indices: Mutex::new(self.dirty_indices.lock().unwrap().clone()), + } + } +} + impl Memory { pub const LEAF_SIZE: usize = 32; /// Only used when initializing a memory to determine its size @@ -129,7 +134,7 @@ impl Memory { buffer: vec![0u8; size], merkle: None, max_size, - dirty_indices: Arc::new(Mutex::new(HashSet::new())), + dirty_indices: Mutex::new(HashSet::new()), } } From 1974d33cc467b7c4568746bb4376c446c72fa2a2 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 6 Jun 2024 11:53:43 +0200 Subject: [PATCH 068/140] Remove race condition in merkelize. --- arbitrator/prover/src/memory.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index d5d0a0855d..441d25bd18 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -144,11 +144,12 @@ impl Memory { pub fn merkelize(&self) -> Cow<'_, Merkle> { if let Some(m) = &self.merkle { - for idx in self.dirty_indices.lock().unwrap().iter() { + let mut dirt = self.dirty_indices.lock().unwrap(); + for idx in dirt.iter() { let leaf_idx = idx / Self::LEAF_SIZE; m.set(leaf_idx, hash_leaf(self.get_leaf_data(leaf_idx))); } - self.dirty_indices.lock().unwrap().clear(); + dirt.clear(); return Cow::Borrowed(m); } // Round the size up to 8 byte long leaves, then round up to the next power of two number of leaves From fc5dd2adc5e80393bbcacfc28db43f02a78adb56 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 11 Jun 2024 10:25:56 +0200 Subject: [PATCH 069/140] Update Cargo.lock --- arbitrator/Cargo.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 0e0c8f5e82..5175b6b609 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -749,6 +749,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", + "strsim 0.11.1", "syn 2.0.66", ] @@ -2116,7 +2117,7 @@ dependencies = [ "darling 0.20.9", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.66", ] [[package]] From 8471f77754723394e65e0077825bb76a6b2b1de8 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 19 Jun 2024 13:08:29 +0200 Subject: [PATCH 070/140] Address review feedback. --- arbitrator/bench/src/bin.rs | 1 - arbitrator/bench/src/prepare.rs | 6 --- arbitrator/prover/src/memory.rs | 13 ++++-- arbitrator/prover/src/merkle.rs | 71 +++++++++++++-------------------- 4 files changed, 37 insertions(+), 54 deletions(-) diff --git a/arbitrator/bench/src/bin.rs b/arbitrator/bench/src/bin.rs index 23930652c2..09ce670f05 100644 --- a/arbitrator/bench/src/bin.rs +++ b/arbitrator/bench/src/bin.rs @@ -76,7 +76,6 @@ fn main() -> eyre::Result<()> { MachineStatus::Errored => { println!("Errored"); break; - // bail!("Machine errored => position {}", machine.get_steps()) } MachineStatus::TooFar => { bail!("Machine too far => position {}", machine.get_steps()) diff --git a/arbitrator/bench/src/prepare.rs b/arbitrator/bench/src/prepare.rs index daf0f48f8f..1bdbf88144 100644 --- a/arbitrator/bench/src/prepare.rs +++ b/arbitrator/bench/src/prepare.rs @@ -36,7 +36,6 @@ pub fn prepare_machine( let preimage_resolver = Arc::new(Box::new(preimage_resolver)); let binary_path = Path::new(&machines); - // println!("Creating machine from binary_path"); let mut mach = Machine::new_from_wavm(binary_path, always_merkleize)?; let block_hash: [u8; 32] = data.start_state.block_hash.try_into().unwrap(); @@ -50,18 +49,13 @@ pub fn prepare_machine( u64_vals, }; - //println!("Setting global state"); mach.set_global_state(start_state); - // println!("After setting global state: {:?}", mach.get_global_state()); - // println!("Setting preimage resolver"); mach.set_preimage_resolver(preimage_resolver); - // println!("Adding sequencer inbox message"); let identifier = argument_data_to_inbox(0).unwrap(); mach.add_inbox_msg(identifier, data.batch_info.number, data.batch_info.data); - // println!("Adding delayed inbox message"); let identifier = argument_data_to_inbox(1).unwrap(); mach.add_inbox_msg(identifier, data.delayed_msg_nr, data.delayed_msg); diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index bba8e4124f..0fdb61411f 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -121,7 +121,10 @@ impl Memory { let size = leaf_hashes.len(); let m = Merkle::new_advanced(MerkleType::Memory, leaf_hashes, Self::MEMORY_LAYERS); if size < leaves { - m.resize(leaves).expect("Couldn't resize merkle tree"); + m.resize(leaves).expect(&format!( + "Couldn't resize merkle tree from {} to {}", + size, leaves + )); } Cow::Owned(m) } @@ -308,9 +311,11 @@ impl Memory { pub fn resize(&mut self, new_size: usize) { self.buffer.resize(new_size, 0); if let Some(merkle) = self.merkle.take() { - merkle - .resize(new_size) - .expect("Couldn't resize merkle tree"); + merkle.resize(new_size).expect(&format!( + "Couldn't resize merkle tree from {} to {}", + merkle.len(), + new_size + )); self.merkle = Some(merkle); } } diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 005d3dae16..9952f84631 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -44,50 +44,26 @@ use zerohashes::ZERO_HASHES; use self::zerohashes::EMPTY_HASH; #[cfg(feature = "counters")] -lazy_static! { - static ref NEW_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { - let mut map = HashMap::new(); - map.insert(&MerkleType::Empty, AtomicUsize::new(0)); - map.insert(&MerkleType::Value, AtomicUsize::new(0)); - map.insert(&MerkleType::Function, AtomicUsize::new(0)); - map.insert(&MerkleType::Instruction, AtomicUsize::new(0)); - map.insert(&MerkleType::Memory, AtomicUsize::new(0)); - map.insert(&MerkleType::Table, AtomicUsize::new(0)); - map.insert(&MerkleType::TableElement, AtomicUsize::new(0)); - map.insert(&MerkleType::Module, AtomicUsize::new(0)); - map +macro_rules! init_counters { + ($name:ident) => { + lazy_static! { + static ref $name: HashMap<&'static MerkleType, AtomicUsize> = { + let mut map = HashMap::new(); + $(map.insert(&MerkleType::$variant, AtomicUsize::new(0));)* + map + }; + } }; } + #[cfg(feature = "counters")] -lazy_static! { - static ref ROOT_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { - let mut map = HashMap::new(); - map.insert(&MerkleType::Empty, AtomicUsize::new(0)); - map.insert(&MerkleType::Value, AtomicUsize::new(0)); - map.insert(&MerkleType::Function, AtomicUsize::new(0)); - map.insert(&MerkleType::Instruction, AtomicUsize::new(0)); - map.insert(&MerkleType::Memory, AtomicUsize::new(0)); - map.insert(&MerkleType::Table, AtomicUsize::new(0)); - map.insert(&MerkleType::TableElement, AtomicUsize::new(0)); - map.insert(&MerkleType::Module, AtomicUsize::new(0)); - map - }; -} +init_counters!(NEW_COUNTERS); + #[cfg(feature = "counters")] -lazy_static! { - static ref SET_COUNTERS: HashMap<&'static MerkleType, AtomicUsize> = { - let mut map = HashMap::new(); - map.insert(&MerkleType::Empty, AtomicUsize::new(0)); - map.insert(&MerkleType::Value, AtomicUsize::new(0)); - map.insert(&MerkleType::Function, AtomicUsize::new(0)); - map.insert(&MerkleType::Instruction, AtomicUsize::new(0)); - map.insert(&MerkleType::Memory, AtomicUsize::new(0)); - map.insert(&MerkleType::Table, AtomicUsize::new(0)); - map.insert(&MerkleType::TableElement, AtomicUsize::new(0)); - map.insert(&MerkleType::Module, AtomicUsize::new(0)); - map - }; -} +init_counters!(ROOT_COUNTERS); + +#[cfg(feature = "counters")] +init_counters!(SET_COUNTERS); #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Serialize, Deserialize, Sequence)] pub enum MerkleType { @@ -213,7 +189,7 @@ fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) #[inline] #[cfg(not(feature = "rayon"))] -fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) -> Vec { +fn new_layer(ty: MerkleType, layer: &[Bytes32], empty_hash: &'static Bytes32) -> Vec { let new_layer = layer .chunks(2) .map(|chunk| hash_node(ty, chunk[0], chunk.get(1).unwrap_or(empty_hash))) @@ -275,15 +251,23 @@ impl Merkle { } fn rehash(&self, layers: &mut Layers) { + // If nothing is dirty, then there's no need to rehash. if layers.dirt.is_empty() || layers.dirt[0].is_empty() { return; } + // Process dirty indices starting from layer 1 (layer 0 is the leaves). for layer_i in 1..layers.data.len() { let dirty_i = layer_i - 1; - let dirt = layers.dirt[dirty_i].clone(); + // Consume this layer's dirty indices. + let dirt = std::mem::take(&mut layers.dirt[dirty_i]); + // It is important to process the dirty indices in order because + // when the leaves grown since the last rehash, the new parent is + // simply pused to the end of the layer's data. for idx in dirt.iter().sorted() { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; + // The left child is guaranteed to exist, but the right one + // might not if the number of child nodes is odd. let left = layers.data[layer_i - 1][left_child_idx]; let right = layers.data[layer_i - 1] .get(right_child_idx) @@ -292,13 +276,14 @@ impl Merkle { if *idx < layers.data[layer_i].len() { layers.data[layer_i][*idx] = new_hash; } else { + // Push the new parent hash onto the end of the layer. layers.data[layer_i].push(new_hash); } + // Mark the node's parent as dirty unless it's the root. if layer_i < layers.data.len() - 1 { layers.dirt[dirty_i + 1].insert(idx >> 1); } } - layers.dirt[dirty_i].clear(); } } From b378cea1d23497ab4e8e78cb7e6ae21c905ef410 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Wed, 19 Jun 2024 13:45:23 +0200 Subject: [PATCH 071/140] Make clippy happier. --- arbitrator/prover/src/memory.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 0fdb61411f..c7aa2af794 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -121,10 +121,9 @@ impl Memory { let size = leaf_hashes.len(); let m = Merkle::new_advanced(MerkleType::Memory, leaf_hashes, Self::MEMORY_LAYERS); if size < leaves { - m.resize(leaves).expect(&format!( - "Couldn't resize merkle tree from {} to {}", - size, leaves - )); + m.resize(leaves).unwrap_or_else(|_| { + panic!("Couldn't resize merkle tree from {} to {}", size, leaves) + }); } Cow::Owned(m) } @@ -311,11 +310,13 @@ impl Memory { pub fn resize(&mut self, new_size: usize) { self.buffer.resize(new_size, 0); if let Some(merkle) = self.merkle.take() { - merkle.resize(new_size).expect(&format!( - "Couldn't resize merkle tree from {} to {}", - merkle.len(), - new_size - )); + merkle.resize(new_size).unwrap_or_else(|_| { + panic!( + "Couldn't resize merkle tree from {} to {}", + merkle.len(), + new_size + ) + }); self.merkle = Some(merkle); } } From 21bf88cfa8a7f891c7d4742b6430abaec5ba8820 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Fri, 28 Jun 2024 18:49:18 +0200 Subject: [PATCH 072/140] Inline cloning the layers into a new Merkle. This was a suggestion from Lee to keep from taking the lock twice. --- arbitrator/prover/src/merkle.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 9952f84631..28b3df5810 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -199,11 +199,7 @@ fn new_layer(ty: MerkleType, layer: &[Bytes32], empty_hash: &'static Bytes32) -> impl Clone for Merkle { fn clone(&self) -> Self { - let leaves = if self.layers.lock().data.is_empty() { - vec![] - } else { - self.layers.lock().data[0].clone() - }; + let leaves = self.layers.lock().data.get(0).cloned().unwrap_or_default(); Merkle::new_advanced(self.ty, leaves, self.min_depth) } } From 3afb90a922bd39a1cdbf82e21f74f9b90f601635 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 2 Jul 2024 22:45:33 +0200 Subject: [PATCH 073/140] Divide the bytes of memory by the leaf size. Without this we end up with Merkle trees that are 32 times larger than they need to be. --- arbitrator/prover/src/memory.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index c7aa2af794..9443d87667 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -310,13 +310,15 @@ impl Memory { pub fn resize(&mut self, new_size: usize) { self.buffer.resize(new_size, 0); if let Some(merkle) = self.merkle.take() { - merkle.resize(new_size).unwrap_or_else(|_| { - panic!( - "Couldn't resize merkle tree from {} to {}", - merkle.len(), - new_size - ) - }); + merkle + .resize(new_size / Self::LEAF_SIZE) + .unwrap_or_else(|_| { + panic!( + "Couldn't resize merkle tree from {} to {}", + merkle.len(), + new_size + ) + }); self.merkle = Some(merkle); } } From fe8c159eaf4fbf2e80dc1b234739ebd49991829c Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 2 Jul 2024 23:16:26 +0200 Subject: [PATCH 074/140] Make clippy happy. --- arbitrator/prover/src/merkle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 241828f1e9..c58d31b1b1 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -204,7 +204,7 @@ fn new_layer(ty: MerkleType, layer: &[Bytes32], empty_hash: &'static Bytes32) -> impl Clone for Merkle { fn clone(&self) -> Self { - let leaves = self.layers.lock().data.get(0).cloned().unwrap_or_default(); + let leaves = self.layers.lock().data.first().cloned().unwrap_or_default(); Merkle::new_advanced(self.ty, leaves, self.min_depth) } } From 2acfea2f839131e75bafd7dbd2fd2c606c6e6c4f Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 2 Jul 2024 23:24:03 +0200 Subject: [PATCH 075/140] Make clippy happy. --- arbitrator/prover/src/merkle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 28b3df5810..595bf67d69 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -199,7 +199,7 @@ fn new_layer(ty: MerkleType, layer: &[Bytes32], empty_hash: &'static Bytes32) -> impl Clone for Merkle { fn clone(&self) -> Self { - let leaves = self.layers.lock().data.get(0).cloned().unwrap_or_default(); + let leaves = self.layers.lock().data.first().cloned().unwrap_or_default(); Merkle::new_advanced(self.ty, leaves, self.min_depth) } } From 96f5642e64cfefb17b1f62c9956d934bf2410747 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 09:49:01 +0200 Subject: [PATCH 076/140] Remove the new_direct method from Bytes32 This is completely superfluous. It is sufficient to just call `Bytes32(arr)`. --- arbitrator/arbutil/src/types.rs | 6 - arbitrator/prover/src/merkle.rs | 2 +- arbitrator/prover/src/merkle/zerohashes.rs | 898 ++++++++++----------- 3 files changed, 450 insertions(+), 456 deletions(-) diff --git a/arbitrator/arbutil/src/types.rs b/arbitrator/arbutil/src/types.rs index 9c6eaff1e8..6cf1d6cdf7 100644 --- a/arbitrator/arbutil/src/types.rs +++ b/arbitrator/arbutil/src/types.rs @@ -27,12 +27,6 @@ pub enum PreimageType { #[repr(C)] pub struct Bytes32(pub [u8; 32]); -impl Bytes32 { - pub const fn new_direct(x: [u8; 32]) -> Self { - Self(x) - } -} - impl Deref for Bytes32 { type Target = [u8; 32]; diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index c58d31b1b1..3e50dbd1a9 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -526,7 +526,7 @@ fn correct_capacity() { #[ignore = "This is just used for generating the zero hashes for the memory merkle trees."] fn emit_memory_zerohashes() { // The following code was generated from the empty_leaf_hash() test in the memory package. - let mut empty_node = Bytes32::new_direct([ + let mut empty_node = Bytes32([ 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, ]) diff --git a/arbitrator/prover/src/merkle/zerohashes.rs b/arbitrator/prover/src/merkle/zerohashes.rs index 1eef9b8557..a4724a609d 100644 --- a/arbitrator/prover/src/merkle/zerohashes.rs +++ b/arbitrator/prover/src/merkle/zerohashes.rs @@ -1,777 +1,777 @@ use arbutil::Bytes32; const VALUE_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([ + Bytes32([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]), - Bytes32::new_direct([ + Bytes32([ 119, 47, 167, 222, 218, 156, 26, 105, 57, 248, 170, 182, 183, 151, 18, 150, 142, 70, 138, 253, 54, 123, 132, 86, 170, 76, 157, 52, 113, 138, 253, 254, ]), - Bytes32::new_direct([ + Bytes32([ 8, 117, 27, 211, 196, 42, 6, 98, 185, 88, 231, 145, 14, 3, 207, 145, 158, 255, 69, 52, 198, 196, 148, 154, 59, 94, 229, 157, 93, 51, 200, 69, ]), - Bytes32::new_direct([ + Bytes32([ 247, 208, 196, 206, 204, 168, 129, 100, 238, 95, 52, 26, 132, 138, 233, 149, 196, 72, 179, 226, 60, 114, 27, 94, 173, 189, 197, 100, 163, 232, 180, 63, ]), - Bytes32::new_direct([ + Bytes32([ 178, 100, 198, 112, 40, 33, 187, 175, 130, 245, 59, 210, 133, 234, 158, 158, 133, 64, 213, 72, 222, 157, 216, 42, 210, 134, 36, 13, 211, 156, 163, 211, ]), - Bytes32::new_direct([ + Bytes32([ 203, 127, 32, 130, 225, 40, 219, 15, 35, 236, 47, 201, 161, 48, 53, 145, 134, 169, 109, 29, 26, 29, 178, 201, 118, 217, 57, 165, 116, 172, 232, 4, ]), - Bytes32::new_direct([ + Bytes32([ 209, 109, 33, 102, 227, 251, 133, 224, 170, 130, 65, 90, 185, 209, 146, 77, 244, 145, 181, 206, 159, 70, 209, 64, 241, 19, 149, 223, 138, 31, 163, 61, ]), - Bytes32::new_direct([ + Bytes32([ 145, 168, 124, 48, 254, 12, 34, 41, 4, 213, 245, 86, 61, 29, 177, 192, 67, 165, 237, 236, 87, 126, 193, 191, 15, 126, 104, 173, 165, 186, 1, 107, ]), - Bytes32::new_direct([ + Bytes32([ 235, 161, 247, 143, 69, 95, 210, 40, 243, 76, 102, 29, 118, 86, 180, 54, 81, 144, 103, 54, 202, 164, 81, 83, 180, 90, 154, 184, 54, 28, 7, 220, ]), - Bytes32::new_direct([ + Bytes32([ 203, 62, 12, 83, 35, 122, 214, 199, 125, 61, 236, 8, 253, 64, 145, 34, 127, 116, 217, 118, 245, 107, 15, 81, 9, 7, 31, 154, 89, 28, 123, 132, ]), - Bytes32::new_direct([ + Bytes32([ 222, 94, 234, 109, 142, 74, 142, 176, 248, 3, 172, 30, 204, 138, 241, 195, 121, 232, 104, 219, 32, 54, 240, 77, 125, 247, 70, 137, 80, 46, 221, 247, ]), - Bytes32::new_direct([ + Bytes32([ 162, 122, 237, 101, 178, 31, 12, 62, 50, 133, 242, 82, 111, 215, 166, 136, 138, 185, 72, 220, 163, 58, 58, 97, 6, 97, 167, 114, 179, 227, 19, 170, ]), - Bytes32::new_direct([ + Bytes32([ 67, 251, 144, 11, 175, 194, 149, 65, 173, 179, 69, 140, 213, 191, 133, 59, 81, 175, 161, 115, 252, 125, 232, 150, 52, 241, 102, 164, 122, 32, 70, 229, ]), - Bytes32::new_direct([ + Bytes32([ 249, 161, 115, 93, 215, 247, 145, 182, 75, 191, 48, 38, 123, 220, 232, 47, 246, 46, 81, 164, 98, 41, 141, 249, 137, 173, 93, 213, 96, 15, 151, 245, ]), - Bytes32::new_direct([ + Bytes32([ 222, 93, 144, 194, 107, 42, 144, 4, 242, 153, 203, 176, 146, 242, 94, 72, 9, 222, 194, 2, 73, 200, 167, 147, 106, 9, 67, 73, 59, 127, 174, 178, ]), - Bytes32::new_direct([ + Bytes32([ 56, 228, 248, 59, 153, 215, 120, 224, 111, 48, 159, 82, 171, 227, 93, 214, 208, 151, 78, 67, 112, 31, 218, 94, 219, 3, 79, 250, 227, 24, 222, 207, ]), - Bytes32::new_direct([ + Bytes32([ 26, 171, 68, 22, 162, 195, 65, 97, 219, 55, 51, 46, 178, 6, 247, 65, 123, 219, 128, 86, 193, 3, 253, 0, 239, 228, 187, 94, 184, 240, 67, 11, ]), - Bytes32::new_direct([ + Bytes32([ 250, 36, 5, 131, 94, 0, 99, 187, 112, 155, 252, 52, 68, 236, 185, 152, 93, 239, 0, 185, 101, 101, 182, 92, 112, 5, 67, 55, 121, 203, 100, 245, ]), - Bytes32::new_direct([ + Bytes32([ 208, 57, 149, 71, 227, 213, 246, 213, 175, 88, 95, 238, 93, 122, 168, 223, 149, 84, 30, 89, 98, 228, 113, 72, 90, 48, 112, 171, 231, 67, 113, 216, ]), - Bytes32::new_direct([ + Bytes32([ 125, 48, 157, 119, 154, 38, 14, 211, 223, 68, 87, 187, 159, 126, 234, 72, 84, 60, 236, 237, 227, 130, 87, 43, 217, 105, 81, 196, 159, 238, 240, 10, ]), - Bytes32::new_direct([ + Bytes32([ 141, 217, 59, 213, 245, 231, 7, 85, 178, 197, 115, 188, 31, 49, 126, 237, 83, 199, 56, 196, 133, 169, 239, 218, 90, 131, 178, 70, 126, 132, 114, 186, ]), - Bytes32::new_direct([ + Bytes32([ 18, 2, 140, 12, 121, 238, 8, 160, 7, 208, 89, 194, 105, 136, 211, 58, 179, 200, 226, 138, 186, 242, 4, 237, 18, 113, 131, 135, 31, 222, 28, 195, ]), - Bytes32::new_direct([ + Bytes32([ 156, 222, 183, 39, 119, 110, 130, 60, 33, 221, 36, 39, 223, 155, 33, 2, 71, 32, 209, 25, 194, 172, 209, 1, 40, 105, 235, 140, 160, 18, 63, 168, ]), - Bytes32::new_direct([ + Bytes32([ 211, 210, 123, 27, 217, 111, 97, 42, 167, 191, 112, 239, 66, 42, 199, 131, 124, 213, 89, 56, 92, 245, 166, 238, 185, 42, 48, 2, 113, 255, 156, 7, ]), - Bytes32::new_direct([ + Bytes32([ 66, 255, 87, 69, 86, 6, 54, 162, 162, 5, 93, 138, 194, 194, 151, 195, 57, 155, 58, 17, 21, 149, 77, 2, 134, 107, 125, 54, 220, 247, 160, 209, ]), - Bytes32::new_direct([ + Bytes32([ 169, 216, 13, 41, 251, 216, 191, 87, 91, 55, 236, 6, 242, 103, 98, 209, 46, 202, 29, 55, 2, 50, 233, 76, 107, 92, 82, 156, 113, 226, 78, 211, ]), - Bytes32::new_direct([ + Bytes32([ 88, 189, 113, 129, 119, 11, 141, 60, 128, 134, 113, 107, 7, 186, 81, 200, 14, 76, 197, 14, 96, 19, 247, 220, 95, 62, 81, 153, 61, 231, 26, 86, ]), - Bytes32::new_direct([ + Bytes32([ 41, 214, 41, 96, 151, 11, 231, 7, 203, 70, 242, 156, 247, 133, 49, 223, 254, 164, 202, 154, 188, 104, 124, 120, 225, 229, 148, 203, 141, 218, 228, 56, ]), - Bytes32::new_direct([ + Bytes32([ 181, 157, 136, 110, 158, 152, 105, 61, 125, 220, 32, 180, 53, 115, 155, 189, 91, 152, 96, 172, 7, 121, 65, 143, 82, 180, 3, 69, 118, 219, 31, 244, ]), - Bytes32::new_direct([ + Bytes32([ 29, 12, 159, 30, 12, 37, 126, 102, 218, 149, 67, 116, 182, 125, 134, 208, 184, 199, 181, 191, 87, 144, 48, 150, 87, 67, 222, 218, 254, 118, 12, 160, ]), - Bytes32::new_direct([ + Bytes32([ 193, 249, 209, 245, 102, 95, 15, 55, 160, 156, 203, 160, 49, 198, 203, 30, 99, 172, 89, 92, 235, 89, 131, 205, 53, 254, 219, 168, 202, 195, 10, 242, ]), - Bytes32::new_direct([ + Bytes32([ 131, 64, 102, 7, 226, 96, 60, 111, 221, 120, 41, 86, 239, 157, 121, 38, 57, 244, 221, 55, 32, 237, 13, 20, 244, 238, 133, 189, 89, 118, 204, 247, ]), - Bytes32::new_direct([ + Bytes32([ 239, 211, 89, 185, 191, 211, 243, 207, 134, 159, 59, 19, 87, 254, 115, 27, 152, 156, 120, 226, 39, 63, 155, 51, 77, 130, 162, 63, 16, 43, 112, 121, ]), - Bytes32::new_direct([ + Bytes32([ 10, 146, 190, 23, 235, 67, 23, 169, 33, 140, 54, 209, 129, 176, 29, 218, 40, 55, 13, 80, 57, 68, 92, 97, 44, 82, 209, 240, 207, 214, 22, 119, ]), - Bytes32::new_direct([ + Bytes32([ 59, 161, 125, 95, 7, 155, 141, 55, 253, 106, 238, 72, 109, 158, 201, 200, 236, 157, 227, 178, 176, 47, 166, 84, 87, 111, 25, 133, 194, 55, 244, 254, ]), - Bytes32::new_direct([ + Bytes32([ 8, 134, 213, 182, 108, 15, 225, 138, 152, 138, 132, 240, 27, 80, 231, 117, 194, 157, 205, 20, 110, 239, 166, 37, 50, 46, 213, 165, 216, 101, 245, 98, ]), - Bytes32::new_direct([ + Bytes32([ 137, 57, 186, 173, 198, 113, 221, 42, 0, 211, 127, 200, 128, 7, 112, 97, 75, 155, 152, 224, 71, 220, 16, 124, 32, 50, 30, 48, 251, 132, 120, 147, ]), - Bytes32::new_direct([ + Bytes32([ 201, 8, 226, 108, 147, 192, 3, 240, 168, 237, 131, 47, 150, 51, 251, 126, 23, 182, 223, 99, 162, 167, 248, 248, 233, 8, 121, 99, 71, 212, 120, 251, ]), - Bytes32::new_direct([ + Bytes32([ 140, 30, 196, 244, 166, 80, 95, 116, 140, 218, 94, 20, 236, 233, 241, 129, 175, 187, 110, 88, 174, 173, 152, 203, 67, 75, 51, 232, 225, 6, 17, 134, ]), - Bytes32::new_direct([ + Bytes32([ 92, 132, 115, 164, 66, 159, 201, 147, 233, 228, 16, 95, 81, 233, 129, 254, 155, 148, 38, 239, 186, 40, 118, 104, 144, 134, 17, 46, 99, 150, 211, 9, ]), - Bytes32::new_direct([ + Bytes32([ 81, 73, 72, 117, 215, 159, 240, 86, 136, 196, 69, 201, 149, 208, 48, 245, 105, 153, 97, 107, 221, 85, 49, 121, 197, 129, 32, 140, 206, 231, 120, 123, ]), - Bytes32::new_direct([ + Bytes32([ 0, 203, 34, 135, 242, 129, 113, 204, 198, 134, 219, 134, 187, 240, 235, 59, 44, 163, 180, 83, 174, 40, 66, 141, 95, 99, 71, 221, 186, 216, 37, 250, ]), - Bytes32::new_direct([ + Bytes32([ 225, 181, 151, 12, 26, 209, 127, 99, 248, 177, 126, 113, 215, 220, 252, 89, 149, 123, 19, 65, 89, 122, 180, 169, 195, 87, 147, 9, 196, 31, 203, 178, ]), - Bytes32::new_direct([ + Bytes32([ 125, 81, 154, 100, 204, 138, 194, 248, 156, 95, 119, 58, 60, 221, 150, 248, 216, 19, 123, 15, 198, 108, 228, 228, 224, 122, 16, 249, 223, 84, 117, 89, ]), - Bytes32::new_direct([ + Bytes32([ 99, 153, 60, 217, 168, 254, 244, 149, 214, 115, 250, 90, 117, 112, 66, 163, 143, 207, 121, 70, 108, 92, 2, 47, 56, 109, 56, 207, 152, 27, 196, 141, ]), - Bytes32::new_direct([ + Bytes32([ 99, 251, 124, 97, 158, 155, 101, 251, 98, 124, 239, 73, 50, 50, 173, 142, 39, 208, 167, 53, 5, 151, 85, 239, 25, 77, 36, 52, 141, 225, 66, 186, ]), - Bytes32::new_direct([ + Bytes32([ 235, 44, 31, 180, 197, 243, 114, 60, 199, 242, 167, 21, 206, 27, 116, 165, 18, 76, 162, 163, 14, 91, 109, 104, 118, 51, 33, 172, 9, 165, 214, 38, ]), - Bytes32::new_direct([ + Bytes32([ 188, 4, 5, 50, 169, 70, 231, 90, 220, 90, 226, 214, 89, 19, 159, 207, 201, 80, 241, 214, 32, 240, 63, 74, 6, 251, 177, 182, 236, 19, 156, 92, ]), - Bytes32::new_direct([ + Bytes32([ 128, 150, 66, 27, 197, 229, 103, 137, 175, 252, 19, 131, 213, 63, 112, 172, 182, 255, 235, 246, 226, 37, 25, 180, 24, 38, 35, 138, 207, 149, 186, 175, ]), - Bytes32::new_direct([ + Bytes32([ 5, 123, 231, 106, 12, 171, 157, 189, 58, 109, 144, 7, 38, 97, 4, 148, 1, 138, 124, 123, 2, 202, 108, 221, 194, 160, 53, 73, 115, 36, 231, 142, ]), - Bytes32::new_direct([ + Bytes32([ 160, 157, 243, 224, 214, 120, 59, 206, 24, 30, 231, 209, 123, 227, 15, 221, 86, 30, 128, 117, 210, 109, 132, 117, 204, 87, 243, 213, 231, 224, 91, 75, ]), - Bytes32::new_direct([ + Bytes32([ 74, 238, 110, 147, 63, 110, 246, 102, 252, 212, 120, 225, 124, 218, 145, 204, 129, 63, 13, 34, 1, 0, 15, 9, 27, 221, 39, 199, 24, 231, 9, 38, ]), - Bytes32::new_direct([ + Bytes32([ 194, 20, 160, 161, 90, 2, 118, 75, 103, 228, 51, 42, 191, 220, 63, 150, 140, 32, 85, 172, 218, 29, 251, 31, 99, 96, 98, 46, 130, 157, 201, 61, ]), - Bytes32::new_direct([ + Bytes32([ 88, 123, 95, 139, 94, 66, 69, 27, 223, 223, 216, 130, 99, 210, 130, 54, 248, 35, 226, 252, 151, 238, 7, 175, 12, 97, 188, 43, 233, 129, 82, 222, ]), - Bytes32::new_direct([ + Bytes32([ 179, 248, 157, 243, 50, 157, 172, 17, 139, 10, 245, 208, 241, 210, 67, 199, 135, 233, 234, 39, 127, 38, 54, 39, 40, 159, 94, 122, 36, 221, 180, 195, ]), - Bytes32::new_direct([ + Bytes32([ 190, 185, 147, 237, 82, 32, 165, 236, 252, 183, 173, 181, 68, 44, 216, 20, 110, 243, 158, 213, 88, 209, 218, 207, 244, 241, 121, 239, 136, 167, 245, 155, ]), - Bytes32::new_direct([ + Bytes32([ 114, 131, 254, 248, 183, 0, 175, 217, 194, 58, 178, 238, 250, 119, 158, 205, 19, 74, 94, 35, 100, 175, 114, 55, 186, 192, 239, 126, 42, 86, 60, 119, ]), - Bytes32::new_direct([ + Bytes32([ 1, 253, 107, 150, 25, 240, 27, 172, 252, 185, 151, 152, 107, 105, 164, 230, 221, 242, 7, 166, 142, 53, 237, 83, 19, 30, 81, 149, 150, 39, 123, 220, ]), - Bytes32::new_direct([ + Bytes32([ 57, 240, 92, 232, 26, 238, 69, 252, 110, 171, 164, 109, 199, 73, 110, 49, 11, 253, 109, 69, 155, 26, 84, 52, 155, 204, 115, 99, 90, 38, 247, 167, ]), - Bytes32::new_direct([ + Bytes32([ 46, 87, 146, 25, 215, 40, 208, 78, 73, 60, 35, 19, 194, 41, 34, 186, 215, 131, 205, 29, 107, 100, 95, 169, 45, 1, 242, 115, 30, 226, 93, 48, ]), - Bytes32::new_direct([ + Bytes32([ 95, 183, 66, 0, 196, 173, 44, 27, 175, 151, 17, 0, 159, 168, 123, 236, 124, 198, 85, 181, 118, 89, 21, 52, 169, 104, 178, 111, 120, 173, 94, 109, ]), - Bytes32::new_direct([ + Bytes32([ 13, 111, 162, 25, 133, 108, 250, 75, 197, 221, 19, 160, 147, 36, 130, 70, 224, 39, 134, 144, 149, 166, 187, 96, 155, 154, 123, 90, 241, 154, 44, 102, ]), - Bytes32::new_direct([ + Bytes32([ 95, 171, 183, 135, 121, 205, 161, 160, 212, 226, 64, 232, 180, 166, 176, 95, 51, 96, 110, 20, 76, 143, 47, 96, 197, 132, 210, 109, 174, 132, 13, 95, ]), - Bytes32::new_direct([ + Bytes32([ 66, 51, 176, 1, 106, 199, 192, 16, 106, 180, 212, 53, 72, 121, 218, 148, 77, 26, 15, 244, 124, 131, 88, 84, 147, 211, 254, 156, 187, 91, 193, 120, ]), ]; const FUNCTION_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([ + Bytes32([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]), - Bytes32::new_direct([ + Bytes32([ 239, 247, 49, 255, 201, 159, 228, 149, 22, 115, 41, 139, 56, 117, 149, 46, 67, 155, 98, 70, 216, 225, 85, 100, 113, 242, 144, 167, 97, 238, 117, 207, ]), - Bytes32::new_direct([ + Bytes32([ 46, 87, 136, 101, 122, 12, 6, 120, 39, 121, 167, 193, 66, 146, 150, 1, 90, 240, 97, 225, 179, 150, 197, 127, 56, 214, 116, 24, 180, 109, 96, 51, ]), - Bytes32::new_direct([ + Bytes32([ 54, 125, 90, 195, 243, 1, 115, 18, 251, 68, 203, 216, 48, 156, 216, 200, 215, 250, 80, 152, 203, 58, 245, 128, 70, 112, 221, 104, 34, 125, 234, 138, ]), - Bytes32::new_direct([ + Bytes32([ 103, 99, 44, 86, 57, 0, 102, 201, 99, 214, 249, 24, 45, 112, 234, 183, 225, 196, 9, 162, 168, 33, 121, 118, 93, 184, 14, 70, 148, 135, 211, 214, ]), - Bytes32::new_direct([ + Bytes32([ 69, 7, 89, 47, 41, 94, 148, 139, 67, 197, 99, 98, 100, 63, 25, 230, 100, 118, 213, 25, 28, 129, 5, 39, 69, 89, 71, 21, 102, 84, 101, 175, ]), - Bytes32::new_direct([ + Bytes32([ 232, 195, 82, 123, 189, 200, 139, 61, 179, 141, 208, 69, 102, 58, 127, 66, 69, 127, 7, 179, 108, 128, 253, 154, 207, 254, 201, 18, 192, 241, 99, 208, ]), - Bytes32::new_direct([ + Bytes32([ 138, 25, 185, 215, 159, 159, 214, 251, 161, 103, 180, 78, 209, 215, 131, 132, 134, 180, 177, 37, 79, 219, 19, 93, 45, 30, 53, 125, 142, 194, 114, 34, ]), - Bytes32::new_direct([ + Bytes32([ 185, 24, 200, 28, 68, 7, 118, 226, 65, 240, 85, 120, 123, 174, 239, 85, 247, 210, 104, 247, 20, 229, 41, 91, 242, 5, 2, 121, 132, 69, 43, 33, ]), - Bytes32::new_direct([ + Bytes32([ 78, 191, 92, 97, 205, 120, 114, 216, 112, 101, 44, 98, 148, 2, 112, 221, 168, 199, 254, 55, 160, 116, 116, 105, 109, 227, 130, 219, 194, 32, 209, 196, ]), - Bytes32::new_direct([ + Bytes32([ 177, 203, 26, 1, 216, 115, 242, 158, 202, 107, 60, 221, 81, 167, 8, 233, 247, 235, 49, 54, 45, 133, 202, 193, 34, 158, 205, 29, 232, 245, 195, 194, ]), - Bytes32::new_direct([ + Bytes32([ 193, 118, 182, 153, 10, 237, 67, 229, 136, 193, 253, 250, 46, 125, 141, 22, 107, 168, 74, 130, 60, 193, 194, 196, 249, 129, 153, 82, 162, 143, 188, 42, ]), - Bytes32::new_direct([ + Bytes32([ 239, 57, 105, 90, 116, 61, 160, 214, 55, 191, 17, 228, 44, 149, 103, 180, 229, 4, 175, 240, 209, 231, 141, 95, 109, 195, 78, 142, 122, 177, 227, 20, ]), - Bytes32::new_direct([ + Bytes32([ 153, 247, 105, 126, 178, 44, 190, 57, 12, 63, 169, 27, 206, 19, 151, 38, 33, 83, 35, 3, 177, 97, 36, 182, 37, 78, 150, 243, 222, 32, 180, 148, ]), - Bytes32::new_direct([ + Bytes32([ 29, 109, 110, 167, 27, 136, 235, 226, 147, 175, 241, 236, 138, 135, 163, 200, 21, 94, 220, 238, 23, 84, 46, 14, 44, 100, 47, 131, 134, 43, 98, 173, ]), - Bytes32::new_direct([ + Bytes32([ 73, 241, 108, 102, 184, 200, 64, 80, 58, 162, 29, 211, 173, 150, 6, 195, 2, 137, 246, 51, 155, 132, 41, 255, 21, 71, 74, 143, 197, 180, 217, 159, ]), - Bytes32::new_direct([ + Bytes32([ 109, 189, 226, 33, 70, 157, 161, 166, 223, 31, 224, 221, 37, 112, 27, 215, 163, 250, 217, 155, 168, 121, 119, 232, 100, 177, 104, 210, 10, 118, 215, 0, ]), - Bytes32::new_direct([ + Bytes32([ 175, 156, 32, 156, 238, 82, 62, 25, 96, 251, 146, 24, 13, 2, 115, 174, 163, 50, 14, 251, 196, 173, 5, 87, 171, 228, 191, 9, 90, 84, 156, 63, ]), - Bytes32::new_direct([ + Bytes32([ 244, 161, 238, 217, 14, 60, 162, 139, 34, 84, 68, 121, 213, 11, 230, 95, 57, 221, 174, 107, 103, 105, 76, 137, 58, 247, 65, 209, 167, 63, 96, 212, ]), - Bytes32::new_direct([ + Bytes32([ 31, 177, 221, 130, 152, 92, 190, 4, 59, 90, 122, 63, 128, 180, 140, 201, 75, 239, 200, 151, 94, 65, 36, 227, 21, 250, 10, 253, 26, 114, 238, 188, ]), - Bytes32::new_direct([ + Bytes32([ 48, 216, 87, 30, 113, 214, 69, 1, 9, 112, 244, 232, 127, 55, 43, 162, 156, 83, 235, 199, 126, 132, 241, 106, 65, 209, 240, 32, 11, 179, 219, 135, ]), - Bytes32::new_direct([ + Bytes32([ 20, 55, 225, 132, 0, 219, 175, 17, 235, 73, 236, 16, 24, 227, 250, 155, 32, 83, 234, 123, 191, 209, 157, 133, 215, 202, 3, 221, 135, 223, 221, 90, ]), - Bytes32::new_direct([ + Bytes32([ 113, 185, 118, 164, 139, 219, 203, 140, 245, 123, 21, 186, 102, 22, 54, 14, 19, 230, 223, 120, 211, 114, 203, 77, 173, 214, 61, 80, 151, 10, 2, 205, ]), - Bytes32::new_direct([ + Bytes32([ 50, 20, 214, 105, 232, 5, 9, 101, 16, 72, 46, 139, 177, 188, 25, 93, 14, 57, 60, 168, 49, 147, 134, 5, 62, 181, 120, 75, 193, 229, 107, 67, ]), - Bytes32::new_direct([ + Bytes32([ 92, 167, 117, 18, 186, 193, 28, 56, 86, 25, 75, 64, 1, 8, 126, 212, 56, 163, 157, 242, 34, 73, 65, 58, 187, 2, 112, 58, 225, 229, 113, 58, ]), - Bytes32::new_direct([ + Bytes32([ 173, 139, 156, 215, 250, 231, 15, 123, 8, 5, 98, 192, 164, 48, 106, 203, 152, 189, 118, 120, 245, 221, 214, 26, 79, 39, 148, 232, 217, 88, 34, 246, ]), - Bytes32::new_direct([ + Bytes32([ 8, 207, 11, 196, 253, 51, 182, 90, 62, 110, 125, 142, 209, 154, 5, 203, 252, 62, 117, 215, 226, 136, 140, 201, 227, 210, 71, 34, 113, 160, 42, 68, ]), - Bytes32::new_direct([ + Bytes32([ 108, 135, 226, 117, 179, 142, 93, 181, 20, 186, 189, 217, 49, 154, 66, 244, 180, 170, 122, 233, 153, 214, 104, 71, 44, 57, 103, 240, 97, 80, 170, 198, ]), - Bytes32::new_direct([ + Bytes32([ 123, 168, 184, 254, 241, 78, 23, 91, 32, 77, 218, 176, 179, 189, 61, 162, 114, 158, 212, 7, 201, 15, 58, 4, 161, 211, 188, 156, 190, 2, 20, 183, ]), - Bytes32::new_direct([ + Bytes32([ 60, 170, 86, 130, 38, 170, 202, 88, 97, 206, 67, 69, 140, 122, 201, 38, 70, 229, 144, 202, 146, 10, 146, 148, 21, 247, 119, 196, 150, 223, 110, 67, ]), - Bytes32::new_direct([ + Bytes32([ 102, 154, 215, 132, 143, 248, 151, 101, 101, 253, 80, 211, 254, 64, 179, 73, 96, 132, 144, 216, 225, 130, 48, 56, 14, 39, 97, 223, 134, 10, 124, 138, ]), - Bytes32::new_direct([ + Bytes32([ 197, 131, 194, 166, 168, 160, 24, 116, 47, 120, 89, 3, 44, 154, 83, 250, 142, 64, 77, 63, 15, 60, 97, 100, 150, 39, 227, 139, 42, 146, 146, 104, ]), - Bytes32::new_direct([ + Bytes32([ 7, 160, 246, 93, 64, 79, 76, 208, 66, 80, 60, 123, 13, 51, 115, 251, 196, 209, 145, 106, 61, 105, 136, 58, 7, 129, 142, 203, 205, 69, 45, 203, ]), - Bytes32::new_direct([ + Bytes32([ 64, 162, 48, 187, 213, 182, 41, 85, 62, 148, 26, 161, 227, 108, 173, 249, 195, 106, 203, 18, 28, 59, 184, 85, 249, 16, 224, 222, 114, 200, 99, 22, ]), - Bytes32::new_direct([ + Bytes32([ 246, 194, 74, 122, 165, 216, 211, 144, 101, 143, 134, 9, 53, 229, 197, 227, 121, 248, 89, 169, 48, 220, 104, 216, 117, 118, 36, 234, 108, 135, 81, 162, ]), - Bytes32::new_direct([ + Bytes32([ 232, 59, 196, 2, 103, 242, 44, 129, 41, 231, 226, 115, 238, 151, 166, 210, 158, 110, 43, 45, 86, 163, 127, 8, 162, 81, 131, 145, 165, 252, 170, 12, ]), - Bytes32::new_direct([ + Bytes32([ 204, 88, 102, 180, 241, 148, 27, 183, 223, 71, 157, 119, 155, 31, 102, 239, 4, 83, 204, 246, 38, 228, 234, 20, 97, 233, 203, 149, 186, 67, 143, 51, ]), - Bytes32::new_direct([ + Bytes32([ 246, 170, 233, 8, 202, 38, 67, 219, 175, 13, 250, 174, 98, 36, 84, 166, 6, 75, 27, 43, 62, 128, 106, 23, 163, 191, 86, 115, 164, 50, 127, 151, ]), - Bytes32::new_direct([ + Bytes32([ 204, 72, 199, 57, 106, 136, 244, 66, 217, 155, 183, 211, 166, 71, 140, 211, 210, 181, 178, 218, 204, 91, 200, 204, 153, 60, 22, 32, 24, 153, 131, 31, ]), - Bytes32::new_direct([ + Bytes32([ 204, 193, 13, 167, 214, 136, 121, 99, 198, 137, 11, 223, 85, 40, 167, 126, 153, 80, 187, 35, 226, 31, 226, 42, 9, 175, 31, 206, 119, 67, 153, 39, ]), - Bytes32::new_direct([ + Bytes32([ 63, 82, 16, 182, 255, 45, 123, 220, 252, 52, 199, 222, 76, 172, 123, 232, 133, 182, 143, 202, 223, 161, 203, 91, 239, 225, 123, 184, 231, 53, 19, 253, ]), - Bytes32::new_direct([ + Bytes32([ 5, 13, 255, 217, 70, 105, 205, 70, 41, 25, 44, 3, 245, 136, 16, 255, 101, 61, 189, 225, 142, 201, 210, 226, 9, 237, 171, 109, 63, 204, 204, 139, ]), - Bytes32::new_direct([ + Bytes32([ 161, 218, 126, 252, 32, 196, 32, 105, 98, 13, 201, 117, 64, 37, 232, 32, 159, 106, 48, 121, 250, 139, 219, 137, 129, 3, 83, 194, 102, 251, 148, 71, ]), - Bytes32::new_direct([ + Bytes32([ 72, 17, 9, 21, 142, 89, 135, 91, 81, 155, 72, 247, 56, 232, 136, 57, 251, 182, 211, 35, 207, 169, 87, 123, 31, 222, 72, 85, 212, 92, 159, 171, ]), - Bytes32::new_direct([ + Bytes32([ 193, 253, 238, 224, 198, 216, 154, 52, 59, 87, 183, 80, 242, 162, 238, 7, 218, 195, 253, 210, 92, 116, 43, 181, 109, 40, 74, 38, 154, 211, 102, 173, ]), - Bytes32::new_direct([ + Bytes32([ 193, 88, 249, 81, 11, 128, 242, 239, 220, 1, 237, 199, 235, 12, 153, 73, 145, 158, 15, 111, 108, 244, 19, 51, 159, 206, 66, 25, 147, 215, 157, 165, ]), - Bytes32::new_direct([ + Bytes32([ 195, 90, 0, 163, 8, 199, 55, 59, 47, 117, 186, 204, 5, 42, 205, 164, 239, 233, 203, 210, 69, 205, 244, 152, 113, 184, 206, 110, 101, 197, 120, 101, ]), - Bytes32::new_direct([ + Bytes32([ 114, 169, 222, 11, 169, 15, 123, 245, 42, 25, 120, 198, 66, 140, 125, 123, 201, 107, 3, 50, 245, 226, 52, 46, 162, 44, 134, 157, 226, 11, 115, 186, ]), - Bytes32::new_direct([ + Bytes32([ 6, 47, 131, 89, 216, 138, 92, 250, 126, 232, 238, 50, 181, 78, 69, 115, 227, 25, 49, 50, 116, 138, 47, 61, 179, 75, 121, 124, 127, 106, 228, 178, ]), - Bytes32::new_direct([ + Bytes32([ 152, 253, 228, 228, 120, 255, 82, 66, 24, 145, 159, 223, 39, 185, 81, 201, 81, 110, 47, 57, 105, 128, 8, 42, 130, 119, 92, 7, 14, 247, 137, 135, ]), - Bytes32::new_direct([ + Bytes32([ 162, 28, 11, 245, 48, 21, 8, 137, 161, 131, 84, 18, 129, 70, 197, 122, 165, 39, 71, 213, 142, 115, 159, 52, 46, 213, 81, 10, 217, 212, 74, 20, ]), - Bytes32::new_direct([ + Bytes32([ 129, 250, 71, 119, 46, 25, 220, 212, 143, 120, 0, 101, 85, 101, 109, 107, 142, 20, 107, 174, 39, 134, 128, 244, 237, 155, 190, 19, 110, 10, 240, 94, ]), - Bytes32::new_direct([ + Bytes32([ 90, 70, 190, 48, 191, 45, 227, 17, 185, 162, 159, 12, 18, 94, 186, 251, 252, 238, 95, 174, 253, 99, 194, 204, 5, 178, 117, 139, 50, 154, 93, 170, ]), - Bytes32::new_direct([ + Bytes32([ 201, 8, 48, 126, 70, 22, 83, 82, 229, 84, 168, 86, 100, 169, 227, 175, 196, 154, 217, 150, 2, 36, 1, 100, 48, 216, 141, 205, 113, 148, 109, 126, ]), - Bytes32::new_direct([ + Bytes32([ 16, 182, 10, 119, 255, 70, 127, 242, 64, 68, 67, 44, 52, 195, 63, 185, 227, 97, 138, 244, 53, 246, 110, 99, 41, 176, 146, 206, 81, 168, 66, 140, ]), - Bytes32::new_direct([ + Bytes32([ 95, 9, 211, 227, 219, 119, 221, 132, 248, 92, 236, 190, 110, 227, 153, 109, 103, 63, 121, 221, 165, 212, 20, 141, 33, 95, 52, 157, 69, 76, 2, 70, ]), - Bytes32::new_direct([ + Bytes32([ 216, 138, 115, 198, 102, 135, 226, 247, 235, 185, 206, 147, 130, 9, 48, 166, 92, 22, 41, 158, 169, 52, 233, 1, 60, 229, 165, 208, 60, 161, 194, 166, ]), - Bytes32::new_direct([ + Bytes32([ 129, 241, 87, 138, 103, 241, 79, 26, 52, 35, 125, 237, 54, 147, 253, 137, 101, 146, 235, 127, 124, 113, 60, 203, 181, 4, 250, 12, 72, 27, 24, 7, ]), - Bytes32::new_direct([ + Bytes32([ 52, 120, 68, 97, 147, 229, 251, 178, 161, 233, 142, 136, 38, 40, 85, 46, 121, 156, 115, 186, 72, 95, 128, 43, 252, 176, 176, 51, 113, 83, 154, 232, ]), - Bytes32::new_direct([ + Bytes32([ 227, 11, 188, 57, 98, 160, 248, 247, 112, 49, 247, 92, 94, 224, 135, 182, 211, 230, 69, 185, 138, 154, 141, 157, 18, 34, 138, 236, 67, 243, 26, 132, ]), - Bytes32::new_direct([ + Bytes32([ 61, 246, 31, 52, 44, 146, 190, 215, 214, 105, 253, 86, 172, 174, 140, 112, 30, 154, 82, 173, 62, 199, 157, 180, 255, 104, 73, 136, 163, 79, 210, 252, ]), - Bytes32::new_direct([ + Bytes32([ 200, 155, 200, 87, 142, 123, 62, 176, 250, 44, 18, 238, 229, 121, 125, 109, 102, 173, 60, 203, 88, 65, 33, 122, 22, 111, 157, 143, 164, 7, 214, 26, ]), - Bytes32::new_direct([ + Bytes32([ 179, 76, 168, 179, 139, 86, 151, 173, 26, 70, 236, 116, 202, 123, 63, 80, 106, 208, 63, 138, 179, 225, 114, 64, 48, 34, 78, 124, 132, 210, 224, 190, ]), - Bytes32::new_direct([ + Bytes32([ 138, 116, 89, 240, 28, 79, 42, 149, 199, 118, 149, 49, 146, 212, 104, 62, 17, 137, 138, 223, 225, 187, 152, 43, 134, 60, 95, 55, 175, 128, 95, 144, ]), ]; const INSTRUCTION_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([ + Bytes32([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]), - Bytes32::new_direct([ + Bytes32([ 248, 140, 83, 29, 241, 220, 66, 40, 126, 248, 5, 153, 77, 179, 26, 64, 221, 108, 205, 162, 173, 52, 179, 140, 202, 105, 0, 170, 166, 130, 120, 176, ]), - Bytes32::new_direct([ + Bytes32([ 35, 74, 103, 235, 245, 71, 66, 212, 99, 147, 15, 200, 1, 237, 95, 163, 10, 146, 122, 251, 243, 239, 93, 186, 46, 74, 206, 130, 63, 17, 199, 80, ]), - Bytes32::new_direct([ + Bytes32([ 113, 169, 40, 37, 169, 205, 28, 78, 37, 104, 52, 28, 29, 222, 39, 32, 208, 183, 215, 38, 255, 69, 87, 70, 174, 113, 221, 183, 206, 62, 192, 118, ]), - Bytes32::new_direct([ + Bytes32([ 1, 148, 183, 39, 234, 23, 138, 182, 169, 58, 52, 158, 248, 212, 186, 127, 60, 42, 25, 210, 20, 170, 182, 139, 20, 185, 196, 85, 241, 214, 181, 64, ]), - Bytes32::new_direct([ + Bytes32([ 241, 14, 59, 8, 168, 222, 232, 125, 149, 227, 125, 41, 223, 198, 88, 135, 54, 146, 140, 212, 164, 76, 239, 106, 10, 20, 67, 180, 24, 159, 174, 99, ]), - Bytes32::new_direct([ + Bytes32([ 117, 111, 220, 19, 204, 227, 211, 18, 61, 239, 179, 46, 142, 75, 67, 98, 159, 221, 205, 158, 125, 42, 221, 227, 148, 162, 193, 229, 147, 70, 214, 127, ]), - Bytes32::new_direct([ + Bytes32([ 20, 72, 211, 188, 38, 126, 166, 75, 54, 22, 225, 21, 113, 155, 167, 89, 161, 6, 37, 78, 227, 211, 219, 141, 161, 199, 151, 122, 81, 45, 159, 187, ]), - Bytes32::new_direct([ + Bytes32([ 69, 198, 100, 170, 106, 174, 208, 152, 152, 121, 118, 66, 111, 89, 131, 14, 159, 115, 142, 200, 205, 173, 89, 77, 68, 234, 5, 171, 105, 248, 199, 83, ]), - Bytes32::new_direct([ + Bytes32([ 17, 1, 220, 13, 154, 194, 88, 60, 253, 223, 149, 35, 44, 184, 107, 141, 205, 177, 185, 32, 22, 99, 212, 96, 194, 91, 255, 179, 121, 153, 254, 40, ]), - Bytes32::new_direct([ + Bytes32([ 222, 247, 186, 138, 222, 183, 135, 183, 170, 79, 182, 23, 69, 89, 70, 68, 88, 87, 235, 22, 178, 134, 114, 220, 249, 153, 70, 71, 229, 139, 10, 190, ]), - Bytes32::new_direct([ + Bytes32([ 183, 77, 65, 51, 207, 78, 55, 149, 222, 3, 100, 82, 232, 230, 21, 115, 249, 177, 36, 89, 12, 41, 70, 31, 199, 254, 213, 3, 184, 2, 85, 137, ]), - Bytes32::new_direct([ + Bytes32([ 82, 15, 215, 135, 95, 18, 143, 49, 239, 237, 6, 15, 213, 113, 153, 49, 149, 54, 50, 139, 100, 192, 128, 226, 168, 9, 120, 167, 157, 42, 45, 19, ]), - Bytes32::new_direct([ + Bytes32([ 70, 32, 130, 243, 186, 144, 224, 217, 130, 222, 175, 221, 218, 190, 179, 222, 217, 115, 70, 160, 141, 231, 221, 96, 2, 173, 27, 17, 158, 66, 180, 58, ]), - Bytes32::new_direct([ + Bytes32([ 76, 243, 65, 235, 12, 31, 48, 195, 62, 176, 202, 57, 99, 80, 237, 222, 138, 199, 124, 251, 143, 243, 205, 226, 18, 164, 67, 64, 68, 238, 53, 71, ]), - Bytes32::new_direct([ + Bytes32([ 70, 52, 254, 193, 211, 92, 63, 238, 92, 2, 160, 29, 154, 25, 221, 136, 2, 49, 96, 27, 15, 152, 238, 57, 241, 253, 32, 131, 73, 38, 229, 243, ]), - Bytes32::new_direct([ + Bytes32([ 214, 162, 82, 44, 146, 145, 61, 77, 36, 3, 131, 81, 217, 39, 127, 81, 66, 82, 172, 230, 246, 3, 243, 217, 210, 38, 201, 109, 240, 143, 253, 79, ]), - Bytes32::new_direct([ + Bytes32([ 127, 18, 198, 116, 112, 141, 16, 39, 115, 118, 37, 208, 118, 119, 147, 46, 196, 124, 19, 196, 34, 183, 172, 157, 18, 91, 4, 210, 77, 195, 220, 59, ]), - Bytes32::new_direct([ + Bytes32([ 87, 54, 42, 60, 39, 223, 84, 148, 158, 230, 70, 53, 191, 1, 108, 103, 139, 111, 58, 220, 114, 46, 46, 110, 20, 211, 84, 1, 173, 104, 175, 191, ]), - Bytes32::new_direct([ + Bytes32([ 182, 147, 66, 127, 229, 144, 125, 93, 84, 220, 116, 107, 51, 13, 24, 161, 68, 172, 165, 50, 12, 198, 229, 173, 49, 26, 114, 159, 84, 190, 6, 42, ]), - Bytes32::new_direct([ + Bytes32([ 183, 20, 36, 145, 76, 36, 61, 136, 224, 139, 89, 23, 124, 29, 210, 137, 1, 160, 22, 128, 48, 242, 234, 85, 84, 24, 206, 49, 143, 185, 237, 110, ]), - Bytes32::new_direct([ + Bytes32([ 38, 19, 77, 150, 92, 129, 177, 155, 139, 162, 90, 91, 231, 146, 216, 21, 54, 152, 18, 5, 98, 21, 67, 160, 154, 113, 175, 65, 214, 78, 19, 97, ]), - Bytes32::new_direct([ + Bytes32([ 163, 236, 47, 120, 121, 17, 217, 4, 200, 247, 206, 178, 211, 212, 163, 48, 38, 172, 111, 123, 75, 221, 63, 117, 42, 3, 252, 233, 104, 13, 210, 203, ]), - Bytes32::new_direct([ + Bytes32([ 127, 106, 132, 246, 28, 129, 245, 83, 159, 109, 196, 219, 68, 81, 230, 77, 254, 166, 55, 73, 169, 179, 93, 97, 117, 176, 53, 74, 121, 238, 184, 240, ]), - Bytes32::new_direct([ + Bytes32([ 255, 23, 108, 186, 145, 182, 196, 67, 163, 95, 173, 17, 67, 239, 199, 189, 145, 153, 120, 152, 159, 126, 255, 39, 55, 178, 230, 173, 91, 165, 229, 106, ]), - Bytes32::new_direct([ + Bytes32([ 184, 156, 20, 114, 222, 219, 89, 218, 102, 62, 130, 200, 179, 237, 32, 237, 127, 75, 251, 163, 160, 2, 221, 34, 166, 30, 172, 97, 115, 137, 179, 175, ]), - Bytes32::new_direct([ + Bytes32([ 244, 165, 127, 27, 66, 22, 38, 243, 235, 107, 30, 181, 31, 193, 210, 174, 254, 129, 39, 71, 59, 117, 186, 37, 217, 129, 138, 23, 146, 114, 96, 78, ]), - Bytes32::new_direct([ + Bytes32([ 27, 57, 244, 93, 208, 90, 64, 181, 161, 110, 161, 188, 62, 180, 46, 103, 136, 233, 63, 1, 243, 202, 236, 206, 173, 45, 45, 218, 238, 184, 83, 121, ]), - Bytes32::new_direct([ + Bytes32([ 138, 185, 33, 206, 120, 214, 246, 27, 100, 91, 106, 213, 60, 177, 39, 182, 149, 204, 11, 225, 254, 5, 87, 9, 19, 186, 166, 210, 33, 67, 146, 37, ]), - Bytes32::new_direct([ + Bytes32([ 243, 161, 7, 52, 35, 240, 227, 144, 29, 50, 232, 3, 101, 174, 192, 139, 89, 75, 204, 245, 173, 55, 139, 76, 126, 19, 142, 18, 230, 57, 219, 227, ]), - Bytes32::new_direct([ + Bytes32([ 97, 73, 36, 70, 120, 55, 49, 114, 107, 193, 66, 219, 47, 122, 201, 194, 52, 142, 12, 163, 108, 2, 107, 58, 185, 251, 168, 146, 57, 189, 150, 134, ]), - Bytes32::new_direct([ + Bytes32([ 11, 215, 29, 229, 151, 208, 62, 1, 172, 253, 253, 156, 177, 31, 117, 214, 161, 192, 68, 255, 140, 131, 66, 23, 247, 161, 107, 98, 199, 57, 123, 110, ]), - Bytes32::new_direct([ + Bytes32([ 41, 166, 54, 134, 242, 64, 153, 167, 5, 230, 226, 128, 71, 10, 251, 160, 19, 187, 70, 4, 95, 98, 77, 233, 181, 24, 11, 239, 142, 152, 229, 215, ]), - Bytes32::new_direct([ + Bytes32([ 221, 220, 68, 168, 143, 124, 235, 77, 241, 190, 214, 6, 102, 40, 32, 245, 131, 114, 170, 151, 134, 49, 79, 57, 242, 124, 85, 172, 83, 81, 68, 99, ]), - Bytes32::new_direct([ + Bytes32([ 142, 200, 102, 97, 170, 43, 14, 11, 139, 207, 150, 163, 99, 103, 2, 46, 44, 63, 109, 61, 62, 64, 199, 104, 36, 194, 155, 232, 139, 250, 97, 224, ]), - Bytes32::new_direct([ + Bytes32([ 162, 15, 26, 217, 96, 195, 70, 196, 253, 70, 127, 156, 39, 120, 120, 232, 197, 154, 192, 147, 104, 33, 104, 189, 120, 160, 36, 129, 208, 237, 128, 23, ]), - Bytes32::new_direct([ + Bytes32([ 42, 228, 74, 47, 20, 55, 197, 252, 173, 70, 178, 8, 2, 43, 97, 238, 155, 124, 87, 225, 217, 6, 103, 134, 136, 235, 193, 175, 33, 228, 219, 217, ]), - Bytes32::new_direct([ + Bytes32([ 219, 143, 25, 70, 78, 155, 119, 63, 126, 20, 158, 54, 27, 181, 104, 184, 74, 192, 75, 157, 42, 204, 45, 122, 25, 248, 247, 24, 225, 207, 51, 251, ]), - Bytes32::new_direct([ + Bytes32([ 151, 253, 36, 33, 104, 222, 126, 234, 112, 74, 59, 94, 239, 58, 36, 114, 90, 195, 208, 46, 250, 138, 165, 200, 178, 54, 238, 154, 219, 238, 6, 183, ]), - Bytes32::new_direct([ + Bytes32([ 205, 57, 187, 174, 221, 9, 164, 77, 76, 143, 54, 212, 115, 196, 67, 182, 200, 147, 78, 194, 245, 92, 173, 114, 180, 160, 168, 5, 200, 82, 217, 64, ]), - Bytes32::new_direct([ + Bytes32([ 211, 104, 62, 114, 157, 56, 254, 26, 32, 168, 208, 248, 62, 195, 142, 68, 53, 13, 7, 36, 216, 5, 127, 153, 97, 88, 222, 206, 91, 42, 14, 114, ]), - Bytes32::new_direct([ + Bytes32([ 203, 158, 225, 200, 62, 223, 202, 52, 207, 179, 250, 236, 29, 144, 181, 31, 87, 192, 203, 66, 56, 39, 123, 25, 123, 157, 196, 161, 34, 245, 22, 130, ]), - Bytes32::new_direct([ + Bytes32([ 147, 247, 233, 96, 190, 104, 227, 251, 99, 2, 16, 8, 77, 119, 1, 97, 243, 78, 103, 46, 24, 228, 217, 65, 219, 238, 135, 18, 164, 219, 132, 39, ]), - Bytes32::new_direct([ + Bytes32([ 239, 153, 72, 139, 52, 60, 171, 44, 72, 218, 138, 124, 45, 30, 143, 122, 147, 158, 12, 62, 213, 151, 217, 217, 212, 51, 110, 75, 122, 67, 134, 80, ]), - Bytes32::new_direct([ + Bytes32([ 46, 47, 130, 237, 178, 232, 239, 217, 165, 114, 255, 202, 132, 214, 18, 8, 72, 8, 255, 0, 162, 82, 5, 228, 141, 201, 70, 135, 255, 21, 220, 3, ]), - Bytes32::new_direct([ + Bytes32([ 21, 11, 196, 5, 215, 241, 194, 200, 198, 129, 133, 244, 204, 47, 131, 70, 138, 38, 107, 39, 211, 243, 72, 72, 34, 145, 35, 42, 14, 69, 218, 227, ]), - Bytes32::new_direct([ + Bytes32([ 73, 103, 117, 195, 67, 126, 242, 57, 232, 74, 142, 64, 169, 248, 113, 69, 110, 103, 127, 185, 177, 51, 212, 178, 48, 183, 247, 44, 246, 69, 35, 208, ]), - Bytes32::new_direct([ + Bytes32([ 125, 8, 83, 22, 215, 82, 179, 234, 169, 227, 213, 39, 170, 164, 195, 187, 63, 38, 59, 146, 144, 101, 38, 0, 110, 212, 202, 20, 245, 105, 187, 201, ]), - Bytes32::new_direct([ + Bytes32([ 186, 231, 186, 148, 68, 208, 226, 170, 120, 80, 68, 79, 23, 41, 51, 205, 240, 201, 10, 16, 24, 38, 137, 151, 7, 102, 92, 244, 3, 194, 228, 229, ]), - Bytes32::new_direct([ + Bytes32([ 46, 8, 51, 150, 63, 114, 126, 210, 30, 130, 76, 142, 13, 149, 14, 0, 205, 199, 48, 90, 86, 75, 151, 135, 164, 224, 129, 77, 174, 194, 212, 112, ]), - Bytes32::new_direct([ + Bytes32([ 150, 239, 42, 111, 3, 112, 25, 168, 179, 36, 106, 73, 212, 188, 215, 79, 180, 142, 191, 29, 219, 12, 244, 74, 254, 205, 160, 54, 68, 144, 81, 207, ]), - Bytes32::new_direct([ + Bytes32([ 23, 164, 189, 201, 250, 65, 212, 148, 132, 125, 94, 209, 115, 123, 29, 66, 3, 172, 57, 58, 46, 191, 96, 7, 212, 25, 226, 79, 120, 68, 202, 210, ]), - Bytes32::new_direct([ + Bytes32([ 252, 13, 137, 225, 208, 6, 84, 75, 97, 32, 177, 156, 248, 191, 113, 97, 254, 122, 86, 194, 3, 103, 219, 74, 227, 160, 231, 202, 13, 126, 46, 255, ]), - Bytes32::new_direct([ + Bytes32([ 70, 35, 27, 128, 17, 79, 226, 131, 144, 118, 248, 125, 188, 110, 20, 15, 255, 73, 205, 69, 0, 227, 26, 66, 39, 61, 191, 224, 239, 234, 83, 170, ]), - Bytes32::new_direct([ + Bytes32([ 129, 52, 148, 121, 230, 84, 28, 112, 75, 68, 181, 197, 80, 227, 107, 22, 60, 118, 81, 209, 198, 125, 233, 190, 84, 189, 18, 25, 72, 143, 2, 190, ]), - Bytes32::new_direct([ + Bytes32([ 244, 237, 81, 131, 251, 35, 56, 158, 229, 102, 150, 122, 213, 206, 119, 38, 54, 238, 158, 159, 1, 214, 31, 147, 245, 9, 172, 247, 156, 115, 209, 140, ]), - Bytes32::new_direct([ + Bytes32([ 47, 5, 174, 62, 80, 172, 77, 111, 136, 114, 188, 85, 249, 157, 182, 175, 187, 207, 29, 43, 152, 88, 130, 156, 138, 30, 188, 51, 82, 105, 145, 161, ]), - Bytes32::new_direct([ + Bytes32([ 102, 2, 197, 195, 206, 149, 53, 224, 61, 219, 163, 246, 208, 218, 140, 47, 16, 42, 196, 20, 145, 158, 101, 31, 225, 135, 49, 68, 95, 5, 228, 92, ]), - Bytes32::new_direct([ + Bytes32([ 78, 136, 176, 216, 253, 15, 136, 48, 162, 5, 57, 120, 93, 222, 179, 174, 129, 40, 8, 63, 18, 102, 97, 41, 58, 214, 1, 52, 58, 126, 186, 146, ]), - Bytes32::new_direct([ + Bytes32([ 145, 56, 231, 59, 247, 191, 104, 137, 240, 113, 32, 245, 235, 129, 255, 54, 99, 176, 109, 175, 107, 232, 201, 235, 95, 104, 54, 67, 252, 184, 200, 54, ]), - Bytes32::new_direct([ + Bytes32([ 181, 3, 229, 152, 113, 182, 55, 93, 138, 137, 21, 67, 27, 204, 96, 69, 72, 247, 237, 216, 28, 36, 115, 185, 111, 149, 224, 69, 66, 121, 188, 228, ]), - Bytes32::new_direct([ + Bytes32([ 212, 25, 201, 68, 187, 25, 10, 96, 40, 88, 100, 216, 145, 200, 26, 203, 220, 14, 14, 11, 190, 62, 143, 137, 53, 208, 233, 158, 37, 34, 8, 15, ]), - Bytes32::new_direct([ + Bytes32([ 80, 101, 192, 136, 203, 90, 189, 204, 181, 36, 28, 107, 220, 69, 119, 99, 145, 227, 198, 55, 37, 237, 212, 114, 31, 27, 19, 90, 231, 143, 87, 149, ]), - Bytes32::new_direct([ + Bytes32([ 248, 97, 168, 33, 15, 230, 128, 82, 157, 26, 186, 89, 200, 7, 101, 210, 117, 111, 75, 233, 244, 187, 1, 180, 30, 220, 15, 21, 203, 5, 243, 223, ]), @@ -779,1042 +779,1042 @@ const INSTRUCTION_HASHES: &[Bytes32; 64] = &[ /// These have been pre-calculated to match the current implementation of Memory::hash_leaf. const MEMORY_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([ + Bytes32([ 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, ]), - Bytes32::new_direct([ + Bytes32([ 190, 70, 141, 125, 34, 236, 162, 217, 92, 130, 99, 237, 252, 176, 62, 93, 182, 71, 180, 204, 178, 127, 225, 18, 119, 68, 89, 244, 245, 143, 151, 9, ]), - Bytes32::new_direct([ + Bytes32([ 9, 87, 12, 3, 155, 102, 114, 211, 160, 40, 161, 7, 3, 192, 11, 145, 241, 17, 215, 209, 18, 230, 221, 198, 189, 52, 34, 224, 245, 121, 253, 194, ]), - Bytes32::new_direct([ + Bytes32([ 10, 61, 178, 250, 4, 50, 245, 174, 54, 189, 184, 161, 208, 164, 55, 145, 70, 4, 81, 28, 129, 97, 216, 23, 41, 192, 91, 97, 9, 83, 1, 215, ]), - Bytes32::new_direct([ + Bytes32([ 244, 167, 192, 124, 155, 131, 227, 49, 180, 187, 181, 23, 114, 255, 114, 237, 129, 149, 159, 244, 63, 138, 0, 237, 37, 38, 159, 106, 4, 153, 119, 255, ]), - Bytes32::new_direct([ + Bytes32([ 63, 174, 225, 251, 118, 10, 96, 200, 132, 107, 27, 128, 250, 62, 47, 221, 227, 241, 107, 254, 3, 171, 26, 81, 199, 162, 154, 249, 154, 72, 185, 196, ]), - Bytes32::new_direct([ + Bytes32([ 89, 112, 167, 92, 33, 192, 100, 158, 137, 92, 61, 197, 73, 216, 188, 164, 72, 37, 5, 0, 161, 144, 254, 18, 10, 4, 248, 174, 26, 5, 149, 142, ]), - Bytes32::new_direct([ + Bytes32([ 202, 243, 125, 81, 15, 253, 233, 83, 91, 186, 151, 205, 84, 225, 16, 241, 42, 27, 7, 15, 143, 128, 189, 233, 206, 106, 21, 7, 96, 167, 149, 2, ]), - Bytes32::new_direct([ + Bytes32([ 155, 19, 224, 94, 41, 7, 172, 244, 76, 43, 181, 160, 220, 80, 64, 0, 140, 33, 238, 79, 87, 43, 40, 34, 162, 57, 122, 232, 216, 48, 64, 114, ]), - Bytes32::new_direct([ + Bytes32([ 64, 199, 52, 187, 21, 58, 215, 47, 174, 163, 203, 89, 35, 199, 187, 86, 137, 145, 236, 145, 66, 21, 218, 151, 88, 61, 109, 238, 61, 58, 215, 247, ]), - Bytes32::new_direct([ + Bytes32([ 197, 59, 74, 219, 191, 151, 46, 252, 54, 248, 228, 94, 22, 143, 69, 197, 114, 247, 37, 212, 243, 158, 179, 192, 205, 50, 50, 36, 40, 130, 115, 247, ]), - Bytes32::new_direct([ + Bytes32([ 168, 115, 30, 246, 210, 241, 88, 129, 115, 193, 107, 199, 199, 35, 118, 28, 145, 183, 82, 101, 162, 52, 67, 147, 208, 234, 115, 58, 40, 124, 16, 79, ]), - Bytes32::new_direct([ + Bytes32([ 253, 6, 238, 29, 37, 160, 45, 23, 26, 114, 137, 254, 44, 68, 147, 33, 212, 149, 16, 188, 28, 174, 189, 22, 12, 228, 99, 101, 60, 248, 174, 34, ]), - Bytes32::new_direct([ + Bytes32([ 0, 89, 208, 120, 115, 63, 79, 9, 29, 16, 81, 231, 78, 251, 117, 98, 172, 207, 54, 97, 38, 72, 37, 110, 102, 207, 38, 198, 165, 157, 208, 6, ]), - Bytes32::new_direct([ + Bytes32([ 193, 144, 83, 148, 50, 15, 138, 224, 145, 12, 222, 94, 88, 91, 151, 74, 180, 47, 102, 38, 244, 38, 251, 13, 230, 130, 141, 133, 10, 194, 108, 211, ]), - Bytes32::new_direct([ + Bytes32([ 182, 202, 171, 144, 153, 127, 43, 239, 77, 89, 56, 144, 39, 180, 30, 164, 1, 120, 105, 55, 21, 17, 147, 96, 185, 219, 67, 146, 86, 42, 44, 117, ]), - Bytes32::new_direct([ + Bytes32([ 240, 76, 90, 37, 238, 134, 53, 105, 125, 238, 19, 80, 162, 60, 63, 104, 193, 201, 233, 10, 246, 175, 15, 167, 239, 50, 201, 138, 153, 127, 40, 247, ]), - Bytes32::new_direct([ + Bytes32([ 127, 96, 10, 125, 139, 9, 213, 13, 60, 75, 10, 85, 88, 169, 180, 24, 18, 171, 157, 161, 252, 181, 178, 191, 227, 200, 140, 72, 205, 231, 67, 34, ]), - Bytes32::new_direct([ + Bytes32([ 8, 81, 79, 192, 81, 171, 28, 73, 80, 93, 207, 58, 0, 192, 109, 40, 59, 227, 148, 172, 144, 146, 237, 103, 47, 77, 112, 155, 215, 125, 49, 205, ]), - Bytes32::new_direct([ + Bytes32([ 181, 244, 223, 157, 69, 161, 149, 150, 31, 65, 52, 113, 11, 233, 51, 145, 135, 161, 34, 114, 133, 86, 133, 255, 161, 176, 170, 255, 21, 163, 146, 79, ]), - Bytes32::new_direct([ + Bytes32([ 251, 112, 107, 186, 121, 118, 206, 118, 164, 136, 208, 159, 220, 188, 218, 111, 190, 44, 16, 16, 251, 116, 206, 236, 111, 184, 20, 247, 252, 129, 200, 164, ]), - Bytes32::new_direct([ + Bytes32([ 101, 111, 124, 218, 143, 90, 110, 65, 52, 118, 81, 72, 234, 164, 106, 84, 54, 136, 212, 192, 46, 87, 56, 241, 227, 38, 37, 101, 250, 134, 254, 144, ]), - Bytes32::new_direct([ + Bytes32([ 209, 232, 185, 167, 159, 116, 4, 11, 114, 98, 71, 225, 233, 246, 135, 173, 175, 126, 125, 101, 16, 27, 254, 198, 79, 21, 181, 120, 50, 139, 76, 4, ]), - Bytes32::new_direct([ + Bytes32([ 30, 122, 82, 142, 43, 26, 170, 27, 0, 177, 218, 106, 39, 13, 154, 151, 92, 47, 144, 113, 173, 242, 169, 89, 230, 135, 188, 190, 57, 170, 66, 220, ]), - Bytes32::new_direct([ + Bytes32([ 39, 137, 200, 154, 57, 148, 82, 232, 82, 214, 232, 251, 187, 13, 253, 222, 184, 161, 144, 231, 67, 116, 160, 231, 214, 47, 228, 88, 146, 14, 244, 108, ]), - Bytes32::new_direct([ + Bytes32([ 122, 9, 214, 205, 84, 161, 177, 137, 68, 9, 178, 177, 141, 219, 162, 109, 116, 124, 124, 56, 189, 139, 28, 220, 98, 165, 217, 156, 157, 148, 43, 232, ]), - Bytes32::new_direct([ + Bytes32([ 83, 209, 1, 98, 176, 225, 170, 233, 144, 110, 148, 135, 159, 243, 202, 14, 201, 243, 218, 255, 75, 90, 222, 25, 141, 148, 128, 132, 101, 8, 178, 180, ]), - Bytes32::new_direct([ + Bytes32([ 93, 131, 135, 74, 118, 43, 37, 103, 218, 116, 47, 5, 212, 230, 133, 11, 76, 199, 46, 91, 17, 222, 122, 114, 166, 228, 113, 213, 31, 5, 32, 164, ]), - Bytes32::new_direct([ + Bytes32([ 230, 49, 245, 147, 146, 113, 214, 229, 67, 34, 234, 170, 14, 37, 33, 105, 12, 192, 127, 177, 195, 70, 29, 44, 232, 191, 3, 56, 70, 40, 70, 69, ]), - Bytes32::new_direct([ + Bytes32([ 64, 48, 103, 64, 135, 164, 51, 233, 201, 62, 5, 28, 35, 183, 178, 104, 54, 238, 0, 58, 215, 157, 29, 149, 57, 23, 224, 247, 85, 104, 240, 113, ]), - Bytes32::new_direct([ + Bytes32([ 12, 156, 88, 246, 58, 5, 82, 65, 113, 178, 127, 112, 138, 170, 91, 11, 79, 54, 122, 65, 87, 104, 104, 93, 134, 176, 56, 5, 139, 142, 73, 54, ]), - Bytes32::new_direct([ + Bytes32([ 92, 41, 81, 165, 165, 210, 34, 91, 127, 46, 250, 148, 104, 192, 211, 77, 108, 49, 111, 57, 161, 242, 142, 46, 100, 47, 24, 24, 51, 219, 92, 186, ]), - Bytes32::new_direct([ + Bytes32([ 201, 120, 116, 179, 124, 183, 117, 97, 200, 35, 138, 235, 77, 177, 138, 42, 47, 58, 69, 188, 70, 2, 71, 95, 51, 233, 69, 14, 22, 24, 195, 153, ]), - Bytes32::new_direct([ + Bytes32([ 249, 189, 13, 189, 45, 69, 100, 141, 50, 145, 24, 54, 91, 45, 125, 223, 181, 222, 63, 49, 66, 49, 106, 175, 55, 85, 112, 25, 69, 187, 44, 171, ]), - Bytes32::new_direct([ + Bytes32([ 86, 114, 135, 219, 78, 73, 34, 205, 239, 144, 56, 231, 164, 101, 129, 115, 51, 167, 158, 96, 1, 241, 178, 216, 54, 84, 97, 185, 200, 239, 215, 7, ]), - Bytes32::new_direct([ + Bytes32([ 35, 232, 131, 249, 70, 6, 185, 10, 58, 53, 72, 254, 74, 166, 76, 41, 122, 234, 77, 61, 16, 39, 26, 66, 102, 78, 102, 159, 55, 113, 195, 19, ]), - Bytes32::new_direct([ + Bytes32([ 204, 120, 229, 250, 86, 164, 18, 58, 82, 11, 112, 225, 76, 253, 63, 35, 245, 72, 81, 254, 193, 182, 255, 159, 200, 120, 135, 60, 253, 180, 185, 112, ]), - Bytes32::new_direct([ + Bytes32([ 35, 194, 73, 72, 85, 35, 3, 215, 21, 38, 67, 254, 195, 250, 173, 177, 156, 70, 47, 13, 178, 120, 227, 214, 92, 71, 181, 40, 213, 43, 193, 147, ]), - Bytes32::new_direct([ + Bytes32([ 148, 91, 40, 131, 45, 85, 232, 203, 101, 47, 189, 225, 128, 118, 138, 12, 83, 98, 227, 166, 192, 69, 188, 19, 84, 13, 162, 250, 65, 209, 47, 191, ]), - Bytes32::new_direct([ + Bytes32([ 100, 36, 35, 232, 157, 164, 39, 175, 77, 211, 19, 26, 20, 226, 226, 255, 121, 134, 19, 46, 185, 213, 2, 4, 6, 92, 47, 239, 206, 240, 225, 58, ]), - Bytes32::new_direct([ + Bytes32([ 121, 36, 6, 138, 185, 33, 130, 28, 55, 238, 127, 203, 99, 32, 56, 245, 237, 135, 207, 190, 72, 243, 137, 32, 218, 103, 150, 171, 3, 246, 48, 225, ]), - Bytes32::new_direct([ + Bytes32([ 233, 56, 238, 34, 238, 134, 69, 104, 220, 255, 47, 202, 241, 144, 207, 249, 107, 153, 38, 120, 101, 12, 177, 64, 151, 114, 146, 6, 227, 159, 40, 107, ]), - Bytes32::new_direct([ + Bytes32([ 237, 115, 194, 93, 160, 113, 23, 120, 250, 186, 21, 163, 155, 20, 179, 177, 55, 20, 24, 89, 77, 113, 163, 0, 176, 130, 228, 133, 239, 122, 177, 65, ]), - Bytes32::new_direct([ + Bytes32([ 108, 150, 128, 44, 189, 57, 148, 254, 56, 134, 118, 165, 95, 15, 168, 179, 162, 252, 169, 58, 223, 20, 38, 221, 25, 138, 101, 131, 32, 8, 2, 58, ]), - Bytes32::new_direct([ + Bytes32([ 154, 13, 160, 129, 192, 79, 86, 40, 135, 113, 123, 38, 53, 254, 62, 94, 255, 14, 119, 4, 102, 168, 200, 191, 112, 245, 29, 200, 164, 155, 141, 139, ]), - Bytes32::new_direct([ + Bytes32([ 238, 189, 209, 174, 202, 251, 240, 99, 133, 44, 221, 34, 17, 88, 220, 143, 188, 160, 235, 121, 167, 96, 106, 249, 213, 176, 31, 84, 26, 144, 201, 89, ]), - Bytes32::new_direct([ + Bytes32([ 178, 186, 146, 221, 228, 41, 150, 76, 220, 216, 144, 64, 108, 178, 242, 120, 153, 191, 212, 37, 114, 21, 30, 117, 45, 238, 46, 19, 132, 212, 112, 44, ]), - Bytes32::new_direct([ + Bytes32([ 191, 19, 180, 171, 125, 68, 104, 43, 66, 173, 194, 168, 213, 192, 117, 82, 167, 41, 139, 133, 92, 103, 124, 85, 241, 66, 1, 154, 68, 72, 171, 80, ]), - Bytes32::new_direct([ + Bytes32([ 79, 215, 118, 157, 123, 16, 70, 30, 101, 234, 117, 41, 35, 186, 99, 5, 232, 45, 253, 142, 185, 18, 172, 187, 36, 50, 218, 252, 111, 184, 158, 254, ]), - Bytes32::new_direct([ + Bytes32([ 17, 193, 206, 44, 67, 98, 171, 63, 78, 209, 71, 20, 196, 255, 64, 114, 191, 19, 246, 131, 8, 105, 211, 169, 192, 114, 249, 240, 28, 55, 230, 143, ]), - Bytes32::new_direct([ + Bytes32([ 200, 94, 187, 80, 140, 194, 238, 35, 62, 228, 202, 122, 136, 119, 228, 133, 33, 147, 161, 218, 94, 19, 207, 129, 48, 252, 242, 19, 56, 251, 92, 76, ]), - Bytes32::new_direct([ + Bytes32([ 223, 124, 52, 170, 180, 101, 70, 1, 153, 22, 178, 138, 181, 253, 35, 113, 159, 136, 77, 23, 158, 62, 11, 48, 6, 185, 147, 81, 220, 191, 94, 3, ]), - Bytes32::new_direct([ + Bytes32([ 126, 124, 205, 157, 16, 239, 172, 241, 70, 70, 205, 98, 211, 8, 84, 204, 149, 9, 208, 56, 122, 51, 224, 231, 200, 59, 41, 215, 141, 183, 91, 223, ]), - Bytes32::new_direct([ + Bytes32([ 20, 122, 156, 134, 248, 95, 140, 199, 59, 151, 120, 164, 109, 202, 165, 126, 108, 161, 8, 253, 18, 35, 36, 83, 219, 162, 58, 83, 136, 57, 43, 35, ]), - Bytes32::new_direct([ + Bytes32([ 58, 175, 246, 31, 114, 109, 109, 219, 230, 129, 128, 99, 175, 228, 65, 148, 53, 233, 226, 171, 44, 254, 222, 211, 200, 28, 193, 130, 251, 152, 160, 210, ]), - Bytes32::new_direct([ + Bytes32([ 177, 255, 19, 82, 14, 229, 84, 206, 156, 198, 252, 176, 126, 211, 226, 255, 154, 231, 131, 158, 165, 154, 142, 166, 131, 221, 203, 30, 251, 205, 27, 217, ]), - Bytes32::new_direct([ + Bytes32([ 32, 168, 192, 93, 240, 173, 218, 42, 78, 215, 104, 243, 154, 2, 50, 159, 21, 176, 28, 59, 29, 57, 193, 122, 32, 244, 91, 148, 91, 184, 126, 31, ]), - Bytes32::new_direct([ + Bytes32([ 28, 66, 164, 117, 43, 120, 84, 240, 48, 3, 55, 95, 44, 229, 231, 29, 217, 67, 49, 130, 110, 209, 72, 71, 46, 208, 63, 81, 218, 98, 167, 207, ]), - Bytes32::new_direct([ + Bytes32([ 38, 192, 60, 175, 136, 217, 168, 69, 90, 236, 62, 137, 9, 116, 244, 151, 181, 57, 229, 198, 100, 125, 114, 46, 80, 136, 150, 94, 225, 162, 170, 91, ]), - Bytes32::new_direct([ + Bytes32([ 121, 67, 11, 63, 56, 140, 67, 231, 175, 126, 41, 37, 252, 62, 35, 215, 250, 206, 190, 3, 154, 83, 237, 174, 65, 86, 83, 251, 110, 8, 44, 216, ]), - Bytes32::new_direct([ + Bytes32([ 25, 251, 117, 251, 14, 64, 166, 211, 216, 123, 38, 1, 98, 19, 119, 194, 60, 234, 185, 148, 118, 201, 4, 233, 69, 135, 13, 191, 8, 6, 136, 240, ]), - Bytes32::new_direct([ + Bytes32([ 137, 1, 201, 130, 166, 152, 216, 48, 178, 242, 46, 3, 66, 92, 4, 81, 11, 145, 205, 82, 253, 102, 78, 6, 53, 13, 36, 171, 48, 75, 165, 153, ]), - Bytes32::new_direct([ + Bytes32([ 126, 38, 201, 183, 226, 145, 26, 196, 124, 127, 185, 12, 77, 198, 146, 16, 202, 189, 113, 44, 100, 87, 81, 53, 172, 227, 97, 191, 120, 241, 86, 110, ]), - Bytes32::new_direct([ + Bytes32([ 45, 8, 41, 170, 235, 127, 133, 14, 253, 53, 201, 220, 96, 192, 168, 234, 110, 20, 174, 226, 18, 4, 230, 182, 204, 99, 138, 27, 82, 209, 28, 68, ]), ]; const TABLE_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([ + Bytes32([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]), - Bytes32::new_direct([ + Bytes32([ 164, 47, 121, 69, 150, 44, 30, 204, 210, 181, 242, 154, 59, 111, 5, 10, 47, 121, 213, 80, 163, 196, 205, 188, 241, 64, 202, 26, 242, 47, 50, 205, ]), - Bytes32::new_direct([ + Bytes32([ 166, 9, 224, 145, 14, 138, 194, 78, 202, 114, 110, 38, 244, 33, 189, 185, 170, 85, 144, 229, 123, 63, 229, 194, 59, 130, 156, 6, 184, 154, 187, 17, ]), - Bytes32::new_direct([ + Bytes32([ 32, 51, 186, 232, 39, 244, 218, 98, 243, 254, 82, 247, 63, 120, 34, 123, 128, 240, 220, 145, 41, 114, 251, 208, 209, 244, 10, 9, 179, 5, 105, 181, ]), - Bytes32::new_direct([ + Bytes32([ 73, 148, 74, 132, 241, 45, 129, 169, 83, 223, 101, 12, 184, 60, 10, 201, 169, 197, 75, 17, 198, 168, 79, 171, 207, 195, 123, 47, 249, 30, 176, 216, ]), - Bytes32::new_direct([ + Bytes32([ 145, 224, 51, 196, 211, 137, 189, 133, 232, 210, 170, 157, 227, 160, 218, 143, 15, 82, 170, 226, 241, 83, 7, 112, 138, 227, 58, 59, 149, 168, 81, 94, ]), - Bytes32::new_direct([ + Bytes32([ 241, 90, 42, 7, 231, 63, 36, 86, 238, 131, 19, 20, 38, 118, 65, 180, 109, 121, 147, 147, 213, 142, 203, 244, 239, 75, 5, 160, 16, 85, 221, 95, ]), - Bytes32::new_direct([ + Bytes32([ 213, 113, 178, 221, 213, 107, 77, 153, 222, 48, 148, 140, 250, 1, 17, 59, 73, 19, 110, 106, 94, 195, 126, 49, 126, 109, 65, 55, 104, 111, 18, 171, ]), - Bytes32::new_direct([ + Bytes32([ 43, 198, 12, 197, 95, 201, 76, 108, 96, 235, 76, 8, 117, 99, 42, 20, 177, 45, 112, 40, 2, 180, 68, 19, 25, 11, 210, 168, 170, 178, 99, 27, ]), - Bytes32::new_direct([ + Bytes32([ 142, 205, 24, 125, 81, 234, 138, 161, 206, 121, 163, 225, 50, 9, 180, 102, 0, 25, 93, 180, 137, 164, 206, 249, 222, 20, 175, 177, 199, 14, 115, 207, ]), - Bytes32::new_direct([ + Bytes32([ 213, 41, 249, 19, 173, 165, 236, 103, 42, 146, 223, 6, 190, 229, 161, 13, 96, 163, 110, 23, 203, 238, 24, 95, 130, 203, 35, 211, 63, 234, 32, 137, ]), - Bytes32::new_direct([ + Bytes32([ 176, 82, 229, 48, 113, 46, 179, 38, 231, 83, 50, 136, 179, 190, 242, 126, 152, 210, 141, 102, 191, 21, 20, 96, 235, 245, 81, 254, 231, 117, 159, 146, ]), - Bytes32::new_direct([ + Bytes32([ 216, 15, 120, 147, 70, 215, 12, 160, 223, 73, 246, 73, 195, 189, 200, 3, 19, 131, 102, 61, 173, 79, 50, 76, 39, 150, 151, 147, 35, 251, 200, 0, ]), - Bytes32::new_direct([ + Bytes32([ 88, 215, 168, 30, 218, 72, 206, 159, 91, 121, 14, 133, 241, 220, 195, 46, 93, 244, 179, 53, 158, 75, 211, 161, 8, 120, 167, 141, 235, 16, 232, 42, ]), - Bytes32::new_direct([ + Bytes32([ 114, 99, 218, 52, 203, 162, 199, 16, 225, 154, 182, 20, 59, 121, 250, 249, 166, 35, 118, 18, 142, 57, 122, 131, 32, 219, 83, 126, 147, 91, 116, 16, ]), - Bytes32::new_direct([ + Bytes32([ 193, 157, 15, 251, 179, 155, 215, 190, 98, 93, 30, 167, 23, 175, 178, 172, 142, 143, 222, 20, 18, 157, 215, 42, 105, 107, 64, 16, 216, 143, 109, 45, ]), - Bytes32::new_direct([ + Bytes32([ 178, 2, 203, 32, 83, 90, 114, 97, 124, 210, 81, 81, 179, 213, 71, 19, 181, 173, 227, 88, 226, 83, 48, 169, 134, 163, 62, 103, 222, 82, 128, 30, ]), - Bytes32::new_direct([ + Bytes32([ 252, 17, 142, 50, 185, 19, 111, 148, 204, 30, 199, 138, 143, 207, 30, 212, 254, 7, 129, 43, 100, 167, 52, 115, 247, 143, 64, 106, 220, 5, 7, 89, ]), - Bytes32::new_direct([ + Bytes32([ 117, 136, 111, 98, 95, 97, 253, 43, 82, 22, 43, 187, 65, 154, 132, 105, 55, 194, 240, 148, 170, 199, 185, 91, 157, 138, 43, 117, 218, 176, 110, 101, ]), - Bytes32::new_direct([ + Bytes32([ 228, 56, 186, 202, 73, 47, 253, 151, 48, 173, 2, 101, 153, 197, 108, 145, 227, 170, 247, 86, 80, 70, 30, 93, 232, 148, 63, 211, 197, 135, 23, 97, ]), - Bytes32::new_direct([ + Bytes32([ 162, 35, 93, 45, 208, 241, 87, 57, 138, 79, 231, 83, 75, 81, 102, 91, 115, 58, 1, 205, 193, 197, 62, 210, 144, 88, 59, 52, 149, 234, 121, 224, ]), - Bytes32::new_direct([ + Bytes32([ 165, 67, 16, 239, 234, 92, 207, 81, 64, 93, 227, 154, 132, 33, 54, 53, 102, 198, 90, 134, 24, 29, 190, 158, 121, 23, 127, 30, 27, 239, 140, 88, ]), - Bytes32::new_direct([ + Bytes32([ 61, 125, 183, 139, 186, 82, 193, 166, 2, 147, 231, 215, 179, 107, 163, 67, 122, 0, 90, 188, 142, 216, 72, 20, 63, 146, 85, 89, 231, 41, 153, 117, ]), - Bytes32::new_direct([ + Bytes32([ 206, 31, 38, 182, 78, 170, 183, 207, 211, 114, 212, 4, 108, 84, 62, 99, 245, 196, 10, 1, 188, 63, 240, 199, 27, 85, 68, 101, 212, 222, 85, 12, ]), - Bytes32::new_direct([ + Bytes32([ 106, 0, 225, 130, 195, 87, 113, 106, 101, 80, 56, 119, 93, 45, 74, 168, 240, 209, 155, 123, 8, 129, 73, 225, 204, 125, 42, 73, 102, 122, 228, 158, ]), - Bytes32::new_direct([ + Bytes32([ 251, 63, 88, 92, 59, 176, 71, 194, 46, 19, 18, 27, 83, 57, 197, 231, 202, 242, 155, 63, 252, 240, 205, 216, 96, 130, 161, 197, 123, 110, 175, 220, ]), - Bytes32::new_direct([ + Bytes32([ 239, 6, 249, 150, 189, 234, 197, 18, 79, 222, 80, 72, 205, 147, 251, 135, 226, 33, 46, 111, 186, 185, 4, 33, 219, 129, 30, 182, 57, 229, 34, 16, ]), - Bytes32::new_direct([ + Bytes32([ 192, 35, 149, 149, 16, 111, 3, 119, 173, 215, 223, 247, 70, 25, 31, 107, 104, 5, 249, 243, 193, 66, 99, 48, 107, 158, 25, 147, 163, 151, 96, 149, ]), - Bytes32::new_direct([ + Bytes32([ 197, 133, 241, 197, 67, 52, 255, 227, 180, 235, 137, 164, 174, 160, 183, 9, 159, 254, 210, 180, 231, 140, 176, 165, 113, 215, 182, 1, 177, 204, 219, 246, ]), - Bytes32::new_direct([ + Bytes32([ 51, 32, 109, 173, 131, 6, 99, 63, 75, 191, 207, 187, 73, 26, 5, 139, 167, 216, 123, 26, 199, 176, 84, 215, 158, 243, 105, 0, 91, 254, 59, 146, ]), - Bytes32::new_direct([ + Bytes32([ 229, 120, 15, 22, 225, 50, 131, 240, 190, 232, 83, 119, 169, 246, 172, 35, 99, 163, 58, 146, 234, 253, 252, 83, 5, 48, 54, 142, 172, 91, 145, 13, ]), - Bytes32::new_direct([ + Bytes32([ 159, 9, 100, 20, 215, 92, 217, 43, 208, 254, 65, 234, 124, 167, 250, 53, 159, 151, 124, 70, 26, 0, 113, 28, 78, 44, 238, 8, 34, 255, 19, 36, ]), - Bytes32::new_direct([ + Bytes32([ 193, 135, 44, 144, 13, 46, 76, 43, 127, 208, 79, 196, 229, 58, 125, 33, 71, 118, 215, 240, 80, 123, 44, 181, 174, 47, 102, 42, 137, 98, 190, 41, ]), - Bytes32::new_direct([ + Bytes32([ 78, 19, 3, 217, 174, 154, 142, 109, 189, 14, 241, 12, 23, 185, 224, 152, 209, 108, 223, 202, 191, 11, 190, 149, 31, 236, 104, 234, 22, 38, 196, 3, ]), - Bytes32::new_direct([ + Bytes32([ 60, 93, 237, 228, 186, 222, 179, 231, 151, 95, 147, 20, 188, 10, 191, 34, 126, 57, 253, 161, 154, 117, 182, 108, 143, 72, 48, 102, 191, 240, 81, 208, ]), - Bytes32::new_direct([ + Bytes32([ 179, 114, 163, 89, 172, 211, 154, 204, 11, 125, 140, 186, 107, 90, 17, 116, 214, 31, 165, 94, 36, 187, 184, 151, 210, 208, 76, 215, 75, 166, 107, 91, ]), - Bytes32::new_direct([ + Bytes32([ 125, 131, 52, 139, 120, 156, 163, 243, 206, 143, 204, 221, 123, 140, 1, 103, 235, 186, 64, 82, 194, 191, 205, 2, 32, 242, 38, 77, 184, 23, 236, 228, ]), - Bytes32::new_direct([ + Bytes32([ 137, 224, 90, 1, 116, 95, 215, 47, 8, 3, 227, 132, 154, 232, 216, 63, 3, 80, 52, 18, 42, 29, 85, 38, 117, 255, 9, 99, 88, 233, 129, 92, ]), - Bytes32::new_direct([ + Bytes32([ 54, 182, 145, 174, 54, 24, 168, 13, 71, 43, 178, 49, 153, 246, 94, 79, 228, 254, 134, 0, 21, 210, 176, 242, 82, 117, 76, 40, 221, 181, 30, 62, ]), - Bytes32::new_direct([ + Bytes32([ 145, 171, 156, 87, 15, 174, 31, 111, 175, 161, 31, 116, 123, 123, 37, 216, 43, 147, 197, 79, 218, 49, 236, 111, 35, 49, 44, 188, 197, 79, 136, 45, ]), - Bytes32::new_direct([ + Bytes32([ 169, 48, 186, 93, 10, 48, 80, 103, 68, 226, 103, 31, 176, 154, 146, 199, 166, 89, 48, 149, 116, 101, 157, 149, 149, 72, 123, 54, 153, 26, 210, 122, ]), - Bytes32::new_direct([ + Bytes32([ 225, 45, 163, 167, 213, 84, 40, 87, 106, 253, 206, 80, 189, 71, 153, 5, 15, 107, 151, 150, 14, 22, 143, 207, 4, 192, 63, 250, 207, 207, 179, 26, ]), - Bytes32::new_direct([ + Bytes32([ 110, 249, 172, 218, 206, 202, 107, 64, 48, 153, 226, 127, 165, 227, 50, 146, 140, 239, 220, 252, 188, 157, 77, 210, 92, 73, 38, 6, 16, 87, 244, 66, ]), - Bytes32::new_direct([ + Bytes32([ 39, 217, 230, 91, 60, 231, 96, 137, 37, 58, 93, 51, 79, 222, 132, 171, 196, 109, 155, 4, 252, 213, 17, 33, 160, 24, 250, 118, 187, 62, 107, 113, ]), - Bytes32::new_direct([ + Bytes32([ 120, 167, 145, 121, 184, 31, 185, 178, 241, 54, 20, 48, 132, 89, 132, 127, 235, 189, 197, 127, 249, 58, 255, 197, 40, 229, 130, 254, 213, 186, 114, 74, ]), - Bytes32::new_direct([ + Bytes32([ 7, 40, 187, 172, 225, 196, 3, 77, 113, 16, 118, 148, 95, 65, 42, 234, 233, 29, 120, 223, 105, 77, 250, 119, 245, 20, 21, 155, 177, 13, 56, 151, ]), - Bytes32::new_direct([ + Bytes32([ 22, 248, 25, 75, 36, 179, 251, 57, 101, 170, 213, 19, 216, 64, 164, 253, 151, 199, 88, 5, 92, 129, 138, 185, 9, 236, 231, 68, 112, 24, 218, 216, ]), - Bytes32::new_direct([ + Bytes32([ 95, 141, 49, 39, 213, 214, 130, 49, 143, 124, 178, 114, 200, 136, 160, 90, 233, 73, 233, 185, 60, 250, 174, 74, 2, 123, 2, 62, 192, 174, 115, 158, ]), - Bytes32::new_direct([ + Bytes32([ 142, 29, 212, 35, 71, 107, 91, 164, 226, 225, 180, 218, 99, 34, 200, 171, 33, 235, 113, 105, 191, 78, 105, 70, 221, 135, 167, 148, 24, 225, 6, 146, ]), - Bytes32::new_direct([ + Bytes32([ 176, 194, 115, 243, 138, 104, 3, 247, 184, 74, 81, 60, 173, 45, 29, 189, 252, 202, 206, 66, 129, 65, 150, 25, 246, 145, 133, 4, 93, 201, 201, 240, ]), - Bytes32::new_direct([ + Bytes32([ 18, 233, 186, 158, 43, 12, 206, 228, 80, 102, 187, 25, 78, 77, 180, 28, 82, 62, 168, 252, 14, 113, 126, 91, 243, 120, 213, 91, 189, 244, 247, 177, ]), - Bytes32::new_direct([ + Bytes32([ 79, 126, 97, 23, 112, 98, 93, 86, 24, 103, 82, 33, 155, 188, 202, 61, 29, 146, 132, 169, 116, 207, 216, 35, 29, 229, 213, 120, 135, 240, 129, 205, ]), - Bytes32::new_direct([ + Bytes32([ 146, 121, 255, 202, 145, 53, 46, 8, 102, 205, 56, 234, 49, 42, 85, 231, 217, 114, 235, 141, 233, 187, 29, 9, 122, 232, 61, 253, 42, 104, 4, 113, ]), - Bytes32::new_direct([ + Bytes32([ 103, 174, 255, 6, 115, 155, 156, 65, 84, 251, 208, 55, 89, 124, 171, 167, 133, 227, 22, 134, 32, 71, 243, 181, 16, 100, 81, 63, 22, 207, 58, 190, ]), - Bytes32::new_direct([ + Bytes32([ 69, 10, 247, 243, 56, 0, 64, 72, 218, 21, 211, 192, 62, 243, 66, 244, 230, 58, 107, 54, 180, 29, 216, 23, 86, 211, 173, 181, 118, 188, 238, 72, ]), - Bytes32::new_direct([ + Bytes32([ 25, 179, 4, 93, 169, 76, 76, 69, 158, 3, 24, 146, 130, 9, 225, 198, 102, 238, 29, 73, 74, 179, 159, 74, 40, 111, 181, 110, 76, 173, 251, 255, ]), - Bytes32::new_direct([ + Bytes32([ 236, 113, 37, 202, 149, 150, 90, 50, 233, 141, 125, 12, 212, 163, 137, 176, 15, 214, 194, 73, 138, 104, 4, 33, 235, 76, 185, 58, 125, 182, 56, 0, ]), - Bytes32::new_direct([ + Bytes32([ 238, 54, 183, 94, 50, 33, 98, 31, 133, 181, 230, 98, 43, 154, 95, 111, 250, 71, 15, 197, 156, 60, 8, 90, 208, 50, 62, 127, 30, 18, 181, 176, ]), - Bytes32::new_direct([ + Bytes32([ 246, 143, 72, 228, 143, 15, 15, 131, 178, 105, 113, 46, 85, 36, 165, 116, 63, 131, 61, 228, 98, 144, 232, 209, 228, 110, 168, 171, 252, 47, 79, 165, ]), - Bytes32::new_direct([ + Bytes32([ 146, 70, 74, 79, 139, 107, 73, 28, 231, 88, 235, 214, 163, 185, 87, 195, 147, 186, 153, 222, 191, 214, 30, 231, 173, 166, 151, 169, 244, 15, 15, 227, ]), - Bytes32::new_direct([ + Bytes32([ 137, 182, 175, 97, 212, 23, 62, 70, 50, 150, 67, 153, 253, 52, 179, 105, 147, 177, 217, 170, 125, 251, 1, 96, 4, 127, 196, 37, 254, 7, 217, 100, ]), - Bytes32::new_direct([ + Bytes32([ 32, 253, 229, 209, 120, 43, 120, 189, 245, 227, 178, 79, 134, 175, 240, 107, 25, 124, 5, 67, 120, 213, 187, 200, 159, 9, 26, 119, 13, 1, 8, 120, ]), - Bytes32::new_direct([ + Bytes32([ 115, 241, 26, 44, 83, 229, 130, 21, 249, 87, 72, 212, 75, 220, 95, 22, 151, 77, 182, 8, 196, 207, 95, 18, 9, 92, 89, 206, 114, 80, 36, 159, ]), - Bytes32::new_direct([ + Bytes32([ 174, 151, 88, 171, 52, 40, 161, 16, 106, 45, 44, 9, 142, 95, 5, 205, 82, 24, 172, 103, 152, 202, 187, 34, 217, 173, 236, 129, 32, 203, 205, 38, ]), ]; const TABLE_ELEMENT_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([ + Bytes32([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]), - Bytes32::new_direct([ + Bytes32([ 145, 218, 63, 74, 131, 182, 204, 163, 74, 206, 234, 50, 47, 3, 51, 74, 121, 225, 146, 237, 5, 128, 20, 230, 243, 89, 33, 248, 136, 154, 189, 5, ]), - Bytes32::new_direct([ + Bytes32([ 36, 240, 95, 13, 214, 136, 92, 102, 96, 137, 39, 96, 108, 223, 147, 130, 220, 61, 147, 226, 52, 133, 67, 223, 211, 164, 6, 53, 45, 117, 120, 241, ]), - Bytes32::new_direct([ + Bytes32([ 9, 2, 218, 34, 228, 8, 178, 127, 160, 30, 104, 198, 49, 37, 71, 115, 14, 35, 20, 15, 253, 160, 147, 143, 24, 186, 12, 90, 41, 169, 30, 8, ]), - Bytes32::new_direct([ + Bytes32([ 137, 242, 105, 78, 161, 99, 76, 224, 226, 100, 216, 235, 156, 132, 214, 154, 107, 120, 197, 113, 45, 221, 170, 119, 92, 228, 76, 139, 170, 159, 111, 58, ]), - Bytes32::new_direct([ + Bytes32([ 231, 165, 221, 185, 139, 22, 70, 40, 67, 162, 123, 94, 161, 156, 57, 53, 102, 217, 128, 227, 18, 132, 17, 170, 90, 31, 214, 181, 249, 220, 70, 37, ]), - Bytes32::new_direct([ + Bytes32([ 171, 253, 174, 187, 9, 186, 87, 37, 22, 83, 13, 88, 75, 11, 177, 226, 237, 136, 132, 137, 101, 109, 135, 192, 224, 80, 87, 105, 95, 81, 255, 21, ]), - Bytes32::new_direct([ + Bytes32([ 179, 50, 36, 230, 159, 162, 184, 132, 140, 121, 133, 155, 189, 44, 132, 93, 80, 79, 32, 244, 131, 57, 79, 222, 104, 63, 224, 182, 91, 162, 73, 122, ]), - Bytes32::new_direct([ + Bytes32([ 17, 55, 206, 87, 127, 185, 135, 231, 41, 56, 166, 104, 229, 102, 222, 181, 236, 233, 230, 39, 43, 163, 16, 1, 225, 86, 211, 51, 145, 7, 169, 84, ]), - Bytes32::new_direct([ + Bytes32([ 201, 174, 3, 154, 104, 190, 240, 99, 123, 201, 7, 118, 196, 85, 28, 247, 35, 232, 39, 25, 151, 52, 167, 136, 179, 13, 213, 60, 138, 158, 39, 131, ]), - Bytes32::new_direct([ + Bytes32([ 35, 33, 109, 155, 171, 252, 195, 80, 10, 115, 40, 199, 250, 1, 241, 82, 146, 225, 118, 237, 11, 125, 198, 97, 57, 21, 171, 237, 94, 60, 49, 32, ]), - Bytes32::new_direct([ + Bytes32([ 126, 95, 42, 157, 183, 168, 137, 120, 114, 64, 148, 170, 32, 156, 137, 96, 194, 91, 119, 11, 20, 3, 30, 62, 118, 12, 31, 48, 245, 144, 252, 29, ]), - Bytes32::new_direct([ + Bytes32([ 48, 135, 201, 114, 103, 35, 8, 96, 5, 101, 125, 26, 87, 0, 98, 122, 239, 140, 230, 10, 102, 112, 155, 87, 249, 181, 152, 235, 28, 79, 176, 56, ]), - Bytes32::new_direct([ + Bytes32([ 76, 70, 222, 210, 242, 159, 52, 123, 112, 106, 253, 140, 55, 160, 189, 255, 220, 64, 8, 168, 39, 196, 160, 8, 105, 154, 91, 184, 62, 63, 227, 156, ]), - Bytes32::new_direct([ + Bytes32([ 138, 201, 8, 240, 218, 190, 210, 227, 236, 168, 45, 161, 209, 115, 126, 165, 235, 162, 6, 117, 76, 239, 3, 225, 163, 251, 111, 233, 233, 228, 14, 92, ]), - Bytes32::new_direct([ + Bytes32([ 190, 166, 27, 117, 242, 0, 25, 148, 230, 125, 237, 22, 153, 158, 151, 56, 121, 194, 221, 198, 184, 147, 249, 149, 27, 29, 166, 243, 254, 181, 209, 102, ]), - Bytes32::new_direct([ + Bytes32([ 235, 63, 149, 47, 164, 152, 80, 11, 178, 203, 99, 178, 176, 226, 164, 151, 39, 65, 83, 200, 102, 90, 12, 102, 178, 15, 232, 16, 222, 141, 78, 3, ]), - Bytes32::new_direct([ + Bytes32([ 37, 179, 99, 114, 214, 120, 87, 53, 198, 229, 207, 47, 16, 112, 208, 33, 216, 152, 209, 228, 196, 14, 237, 250, 212, 90, 176, 185, 21, 248, 92, 109, ]), - Bytes32::new_direct([ + Bytes32([ 237, 200, 122, 93, 145, 116, 138, 59, 86, 220, 58, 171, 160, 31, 142, 193, 231, 131, 106, 164, 166, 44, 120, 170, 62, 81, 73, 85, 0, 52, 219, 220, ]), - Bytes32::new_direct([ + Bytes32([ 244, 173, 85, 141, 81, 198, 214, 0, 54, 21, 20, 169, 177, 235, 104, 206, 43, 218, 96, 68, 73, 37, 252, 77, 253, 18, 30, 97, 223, 122, 1, 12, ]), - Bytes32::new_direct([ + Bytes32([ 104, 169, 247, 140, 131, 245, 193, 3, 36, 119, 249, 119, 108, 102, 115, 250, 173, 225, 33, 156, 116, 87, 180, 27, 84, 215, 126, 15, 187, 189, 32, 139, ]), - Bytes32::new_direct([ + Bytes32([ 47, 156, 244, 88, 145, 227, 224, 87, 233, 138, 138, 9, 169, 96, 29, 204, 100, 170, 23, 105, 63, 4, 119, 90, 167, 161, 72, 109, 82, 254, 123, 48, ]), - Bytes32::new_direct([ + Bytes32([ 196, 68, 107, 111, 141, 253, 138, 140, 162, 104, 247, 104, 87, 144, 123, 240, 105, 251, 246, 210, 172, 172, 241, 162, 155, 90, 83, 175, 131, 251, 107, 215, ]), - Bytes32::new_direct([ + Bytes32([ 28, 100, 243, 226, 32, 234, 211, 106, 197, 179, 14, 192, 70, 11, 203, 125, 151, 53, 20, 77, 175, 99, 154, 100, 159, 249, 54, 39, 73, 168, 162, 66, ]), - Bytes32::new_direct([ + Bytes32([ 83, 176, 7, 180, 201, 178, 172, 98, 47, 34, 80, 6, 62, 10, 4, 112, 43, 93, 10, 227, 74, 91, 11, 217, 83, 230, 104, 0, 167, 2, 114, 89, ]), - Bytes32::new_direct([ + Bytes32([ 185, 162, 212, 82, 149, 182, 104, 215, 62, 244, 114, 124, 181, 74, 226, 119, 4, 42, 181, 238, 25, 212, 215, 219, 174, 231, 32, 170, 9, 234, 12, 212, ]), - Bytes32::new_direct([ + Bytes32([ 173, 38, 241, 20, 137, 119, 33, 252, 174, 245, 252, 234, 165, 181, 128, 225, 14, 147, 182, 97, 145, 19, 40, 193, 90, 238, 140, 87, 0, 222, 70, 254, ]), - Bytes32::new_direct([ + Bytes32([ 51, 218, 162, 213, 211, 23, 9, 158, 185, 156, 39, 145, 5, 146, 70, 144, 172, 10, 26, 212, 253, 37, 24, 32, 21, 65, 179, 140, 64, 237, 96, 157, ]), - Bytes32::new_direct([ + Bytes32([ 221, 87, 57, 81, 246, 126, 53, 163, 190, 220, 109, 205, 114, 234, 85, 151, 75, 245, 254, 16, 140, 131, 239, 120, 9, 209, 54, 61, 177, 6, 188, 252, ]), - Bytes32::new_direct([ + Bytes32([ 54, 161, 25, 198, 75, 151, 214, 76, 83, 74, 117, 229, 155, 237, 88, 95, 143, 119, 56, 12, 201, 164, 235, 20, 117, 49, 177, 88, 14, 248, 95, 198, ]), - Bytes32::new_direct([ + Bytes32([ 60, 16, 183, 115, 241, 45, 253, 24, 105, 43, 79, 72, 212, 238, 24, 156, 132, 93, 78, 246, 1, 228, 222, 200, 254, 130, 170, 46, 91, 254, 205, 143, ]), - Bytes32::new_direct([ + Bytes32([ 184, 30, 34, 235, 214, 40, 120, 64, 182, 15, 162, 189, 164, 202, 89, 146, 202, 177, 16, 105, 172, 158, 1, 95, 101, 146, 253, 115, 226, 233, 38, 171, ]), - Bytes32::new_direct([ + Bytes32([ 70, 152, 3, 73, 249, 222, 93, 214, 74, 179, 140, 47, 34, 42, 149, 214, 152, 75, 34, 145, 68, 226, 151, 101, 121, 54, 252, 240, 206, 140, 81, 165, ]), - Bytes32::new_direct([ + Bytes32([ 9, 88, 51, 124, 67, 108, 84, 244, 61, 241, 110, 246, 184, 105, 6, 116, 242, 58, 15, 144, 43, 76, 176, 107, 0, 138, 155, 235, 210, 138, 226, 215, ]), - Bytes32::new_direct([ + Bytes32([ 98, 170, 168, 147, 158, 223, 186, 7, 58, 130, 89, 200, 153, 24, 158, 251, 69, 100, 7, 57, 96, 115, 136, 170, 57, 145, 143, 240, 102, 6, 248, 111, ]), - Bytes32::new_direct([ + Bytes32([ 76, 75, 216, 216, 194, 146, 2, 59, 247, 64, 98, 160, 62, 105, 193, 186, 161, 191, 64, 154, 254, 196, 55, 214, 201, 103, 223, 131, 181, 192, 152, 176, ]), - Bytes32::new_direct([ + Bytes32([ 188, 141, 114, 199, 33, 45, 183, 18, 123, 231, 92, 215, 51, 191, 11, 199, 253, 46, 28, 10, 156, 23, 92, 255, 219, 236, 176, 247, 52, 105, 210, 223, ]), - Bytes32::new_direct([ + Bytes32([ 200, 67, 112, 29, 180, 70, 50, 18, 220, 122, 39, 122, 83, 186, 81, 77, 241, 44, 190, 3, 162, 217, 76, 61, 230, 237, 157, 230, 205, 172, 186, 247, ]), - Bytes32::new_direct([ + Bytes32([ 131, 131, 129, 83, 251, 217, 83, 88, 93, 39, 66, 174, 51, 19, 190, 91, 16, 187, 95, 63, 35, 178, 94, 237, 194, 42, 231, 227, 138, 202, 216, 93, ]), - Bytes32::new_direct([ + Bytes32([ 18, 177, 28, 41, 199, 59, 160, 244, 26, 162, 73, 48, 16, 74, 190, 195, 249, 216, 64, 229, 145, 65, 18, 131, 75, 57, 71, 74, 127, 239, 112, 13, ]), - Bytes32::new_direct([ + Bytes32([ 41, 120, 53, 253, 151, 12, 143, 213, 212, 31, 245, 61, 168, 113, 30, 38, 112, 126, 156, 133, 241, 102, 110, 237, 4, 138, 50, 160, 79, 235, 52, 35, ]), - Bytes32::new_direct([ + Bytes32([ 38, 74, 146, 27, 110, 86, 122, 250, 58, 243, 64, 185, 207, 174, 28, 124, 35, 183, 53, 88, 34, 234, 89, 58, 98, 223, 69, 13, 48, 15, 239, 230, ]), - Bytes32::new_direct([ + Bytes32([ 221, 132, 1, 28, 157, 232, 235, 132, 32, 58, 26, 36, 60, 217, 197, 165, 141, 19, 64, 120, 197, 139, 190, 86, 153, 152, 235, 11, 99, 129, 222, 91, ]), - Bytes32::new_direct([ + Bytes32([ 237, 76, 61, 239, 169, 108, 131, 62, 163, 67, 158, 210, 14, 45, 91, 105, 36, 182, 206, 182, 71, 11, 159, 169, 159, 248, 247, 176, 6, 176, 237, 123, ]), - Bytes32::new_direct([ + Bytes32([ 232, 190, 198, 78, 12, 148, 86, 176, 221, 115, 1, 22, 122, 163, 223, 234, 74, 129, 125, 53, 211, 137, 115, 18, 241, 170, 69, 42, 34, 74, 180, 172, ]), - Bytes32::new_direct([ + Bytes32([ 215, 199, 144, 158, 222, 153, 123, 125, 150, 97, 127, 151, 96, 43, 69, 155, 150, 119, 75, 82, 218, 48, 101, 70, 121, 18, 42, 146, 215, 183, 100, 158, ]), - Bytes32::new_direct([ + Bytes32([ 121, 182, 45, 62, 255, 78, 32, 48, 107, 186, 208, 155, 158, 80, 231, 241, 90, 227, 219, 113, 52, 20, 66, 45, 124, 67, 209, 61, 167, 74, 60, 34, ]), - Bytes32::new_direct([ + Bytes32([ 34, 136, 15, 103, 128, 220, 202, 103, 150, 123, 249, 145, 218, 227, 17, 64, 142, 129, 4, 42, 93, 7, 6, 147, 111, 117, 25, 185, 88, 104, 85, 115, ]), - Bytes32::new_direct([ + Bytes32([ 144, 191, 235, 38, 205, 102, 127, 160, 139, 105, 75, 63, 86, 192, 194, 49, 240, 35, 65, 154, 4, 113, 51, 87, 40, 70, 32, 58, 243, 16, 136, 67, ]), - Bytes32::new_direct([ + Bytes32([ 217, 150, 254, 250, 111, 69, 45, 227, 111, 59, 199, 149, 59, 216, 17, 117, 8, 226, 85, 250, 183, 187, 21, 129, 208, 0, 63, 158, 232, 106, 131, 16, ]), - Bytes32::new_direct([ + Bytes32([ 148, 212, 84, 16, 204, 49, 69, 96, 137, 125, 102, 221, 111, 8, 41, 51, 221, 241, 87, 231, 88, 215, 211, 24, 254, 131, 111, 56, 160, 143, 230, 109, ]), - Bytes32::new_direct([ + Bytes32([ 144, 48, 37, 157, 153, 7, 123, 206, 46, 224, 211, 249, 208, 217, 91, 243, 128, 62, 100, 126, 3, 253, 223, 161, 50, 108, 26, 151, 129, 242, 94, 132, ]), - Bytes32::new_direct([ + Bytes32([ 97, 167, 177, 53, 183, 154, 164, 1, 129, 184, 234, 182, 190, 197, 244, 226, 150, 217, 57, 152, 243, 206, 60, 76, 114, 194, 51, 240, 58, 93, 219, 76, ]), - Bytes32::new_direct([ + Bytes32([ 139, 70, 147, 227, 94, 147, 130, 53, 38, 112, 138, 176, 7, 148, 6, 21, 50, 199, 70, 33, 87, 180, 33, 167, 56, 89, 66, 95, 245, 247, 135, 24, ]), - Bytes32::new_direct([ + Bytes32([ 175, 169, 204, 13, 145, 18, 40, 29, 84, 88, 206, 99, 208, 137, 249, 146, 0, 237, 188, 130, 135, 223, 121, 54, 126, 251, 247, 109, 141, 217, 62, 127, ]), - Bytes32::new_direct([ + Bytes32([ 139, 188, 3, 234, 198, 124, 194, 238, 217, 237, 214, 250, 66, 220, 0, 51, 1, 203, 122, 125, 46, 213, 22, 253, 8, 218, 145, 253, 170, 156, 159, 96, ]), - Bytes32::new_direct([ + Bytes32([ 107, 130, 208, 55, 16, 249, 46, 4, 98, 236, 130, 52, 190, 126, 232, 229, 108, 126, 239, 175, 25, 229, 84, 33, 249, 66, 128, 162, 47, 221, 110, 163, ]), - Bytes32::new_direct([ + Bytes32([ 239, 176, 14, 134, 210, 125, 177, 40, 200, 42, 229, 32, 200, 58, 9, 73, 210, 161, 8, 105, 4, 70, 19, 134, 117, 132, 167, 18, 16, 108, 207, 113, ]), - Bytes32::new_direct([ + Bytes32([ 237, 116, 250, 79, 151, 228, 171, 189, 89, 213, 122, 121, 55, 25, 52, 238, 79, 19, 31, 194, 73, 158, 43, 78, 86, 194, 36, 141, 105, 10, 87, 58, ]), - Bytes32::new_direct([ + Bytes32([ 216, 125, 158, 123, 121, 158, 74, 152, 46, 18, 196, 115, 233, 149, 205, 189, 10, 232, 174, 21, 2, 52, 202, 111, 74, 160, 191, 196, 84, 93, 98, 46, ]), - Bytes32::new_direct([ + Bytes32([ 201, 148, 124, 172, 62, 154, 127, 129, 205, 197, 134, 133, 144, 78, 47, 190, 197, 190, 103, 44, 129, 57, 155, 227, 152, 212, 130, 12, 192, 223, 244, 68, ]), - Bytes32::new_direct([ + Bytes32([ 102, 147, 19, 104, 237, 188, 140, 66, 166, 77, 105, 55, 5, 165, 143, 107, 91, 247, 53, 203, 187, 163, 109, 66, 19, 164, 153, 170, 82, 251, 148, 10, ]), - Bytes32::new_direct([ + Bytes32([ 33, 89, 246, 96, 201, 15, 77, 99, 252, 111, 250, 152, 124, 80, 50, 57, 197, 124, 254, 202, 246, 131, 11, 219, 249, 102, 35, 79, 100, 173, 146, 167, ]), - Bytes32::new_direct([ + Bytes32([ 6, 27, 205, 165, 249, 112, 70, 105, 232, 156, 155, 204, 71, 5, 21, 239, 91, 69, 248, 111, 218, 154, 187, 85, 118, 72, 210, 99, 138, 40, 233, 75, ]), ]; const MODULE_HASHES: &[Bytes32; 64] = &[ - Bytes32::new_direct([ + Bytes32([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]), - Bytes32::new_direct([ + Bytes32([ 252, 178, 61, 5, 174, 66, 106, 30, 131, 163, 114, 90, 231, 83, 228, 153, 108, 255, 60, 37, 254, 139, 153, 129, 208, 156, 109, 74, 233, 129, 174, 182, ]), - Bytes32::new_direct([ + Bytes32([ 128, 23, 154, 62, 181, 220, 154, 183, 222, 214, 79, 76, 162, 169, 179, 162, 185, 93, 179, 115, 161, 55, 19, 63, 227, 168, 140, 66, 182, 6, 60, 120, ]), - Bytes32::new_direct([ + Bytes32([ 243, 119, 126, 55, 151, 128, 119, 12, 124, 84, 146, 243, 156, 68, 82, 174, 201, 162, 29, 73, 29, 77, 103, 205, 194, 250, 45, 133, 39, 71, 224, 177, ]), - Bytes32::new_direct([ + Bytes32([ 209, 179, 222, 187, 184, 84, 131, 182, 172, 78, 20, 104, 236, 246, 114, 74, 55, 98, 29, 34, 117, 249, 89, 76, 85, 38, 248, 193, 75, 10, 243, 100, ]), - Bytes32::new_direct([ + Bytes32([ 195, 14, 58, 139, 148, 140, 218, 174, 131, 204, 69, 84, 127, 8, 142, 88, 136, 83, 253, 241, 74, 247, 143, 204, 38, 15, 138, 98, 47, 188, 255, 245, ]), - Bytes32::new_direct([ + Bytes32([ 167, 4, 177, 126, 159, 76, 19, 220, 160, 159, 81, 227, 110, 147, 179, 175, 253, 187, 46, 24, 15, 168, 153, 84, 4, 167, 247, 225, 121, 175, 134, 85, ]), - Bytes32::new_direct([ + Bytes32([ 237, 144, 152, 155, 211, 100, 202, 187, 41, 181, 45, 224, 143, 139, 18, 77, 110, 34, 212, 207, 239, 180, 73, 84, 166, 194, 22, 149, 89, 215, 86, 21, ]), - Bytes32::new_direct([ + Bytes32([ 226, 192, 91, 176, 242, 185, 212, 189, 178, 80, 238, 252, 183, 82, 220, 242, 22, 237, 84, 142, 132, 91, 95, 219, 252, 171, 51, 76, 28, 146, 86, 155, ]), - Bytes32::new_direct([ + Bytes32([ 199, 200, 237, 66, 220, 14, 221, 121, 117, 150, 118, 36, 138, 142, 50, 173, 12, 195, 131, 90, 27, 189, 247, 221, 89, 151, 41, 27, 135, 207, 137, 172, ]), - Bytes32::new_direct([ + Bytes32([ 160, 60, 124, 200, 56, 240, 67, 161, 121, 95, 247, 51, 153, 249, 125, 88, 231, 2, 85, 167, 251, 187, 21, 103, 49, 132, 213, 52, 219, 30, 146, 59, ]), - Bytes32::new_direct([ + Bytes32([ 123, 52, 142, 254, 117, 160, 215, 99, 155, 130, 134, 183, 76, 99, 166, 246, 49, 51, 142, 67, 116, 234, 69, 199, 201, 19, 70, 3, 208, 247, 40, 82, ]), - Bytes32::new_direct([ + Bytes32([ 165, 32, 183, 79, 246, 224, 220, 103, 11, 160, 233, 66, 129, 238, 194, 73, 17, 37, 128, 185, 175, 88, 144, 228, 231, 185, 22, 17, 149, 174, 72, 1, ]), - Bytes32::new_direct([ + Bytes32([ 12, 24, 45, 128, 57, 246, 187, 176, 154, 247, 169, 18, 116, 176, 70, 246, 203, 141, 211, 104, 5, 147, 78, 214, 161, 71, 33, 97, 7, 21, 158, 61, ]), - Bytes32::new_direct([ + Bytes32([ 215, 18, 110, 29, 36, 34, 133, 219, 15, 204, 206, 158, 186, 213, 181, 41, 184, 160, 71, 165, 163, 121, 88, 106, 228, 58, 34, 105, 112, 168, 84, 123, ]), - Bytes32::new_direct([ + Bytes32([ 6, 169, 156, 220, 55, 53, 26, 229, 104, 60, 113, 111, 153, 18, 251, 234, 179, 159, 56, 14, 112, 7, 144, 199, 45, 180, 116, 239, 21, 207, 173, 205, ]), - Bytes32::new_direct([ + Bytes32([ 24, 172, 76, 192, 21, 91, 250, 75, 196, 119, 231, 221, 13, 239, 113, 39, 62, 40, 165, 26, 245, 16, 61, 106, 39, 28, 78, 212, 249, 230, 84, 108, ]), - Bytes32::new_direct([ + Bytes32([ 248, 34, 1, 62, 213, 235, 20, 21, 220, 78, 178, 126, 184, 102, 242, 50, 49, 174, 163, 122, 166, 96, 40, 110, 78, 199, 89, 158, 155, 251, 233, 49, ]), - Bytes32::new_direct([ + Bytes32([ 103, 54, 133, 19, 189, 117, 46, 209, 17, 2, 64, 251, 77, 195, 197, 91, 38, 48, 214, 36, 96, 255, 133, 87, 244, 101, 166, 218, 167, 129, 225, 167, ]), - Bytes32::new_direct([ + Bytes32([ 196, 159, 226, 85, 100, 246, 179, 251, 133, 33, 114, 51, 104, 245, 81, 54, 137, 126, 245, 76, 112, 146, 139, 185, 190, 19, 106, 132, 48, 203, 34, 237, ]), - Bytes32::new_direct([ + Bytes32([ 41, 190, 7, 23, 227, 80, 13, 134, 244, 18, 215, 148, 1, 72, 1, 22, 91, 165, 182, 69, 160, 179, 241, 106, 254, 116, 245, 131, 136, 35, 190, 226, ]), - Bytes32::new_direct([ + Bytes32([ 205, 132, 211, 121, 67, 210, 191, 102, 218, 92, 56, 204, 68, 160, 188, 100, 229, 80, 77, 27, 26, 86, 248, 86, 216, 39, 242, 211, 183, 139, 219, 83, ]), - Bytes32::new_direct([ + Bytes32([ 13, 215, 68, 100, 180, 74, 23, 58, 157, 140, 76, 31, 114, 254, 85, 78, 234, 40, 251, 199, 35, 204, 111, 243, 163, 64, 221, 21, 96, 55, 127, 118, ]), - Bytes32::new_direct([ + Bytes32([ 225, 14, 246, 105, 64, 96, 225, 200, 186, 66, 40, 253, 131, 80, 102, 178, 83, 22, 150, 32, 15, 139, 76, 172, 144, 3, 30, 43, 217, 213, 89, 43, ]), - Bytes32::new_direct([ + Bytes32([ 200, 83, 93, 27, 98, 246, 87, 100, 53, 166, 89, 138, 157, 88, 148, 245, 61, 115, 246, 20, 142, 156, 54, 237, 179, 64, 148, 218, 67, 5, 142, 248, ]), - Bytes32::new_direct([ + Bytes32([ 159, 25, 150, 25, 114, 252, 162, 57, 21, 125, 147, 111, 220, 117, 17, 107, 40, 21, 157, 183, 6, 63, 226, 37, 64, 179, 133, 58, 107, 245, 78, 14, ]), - Bytes32::new_direct([ + Bytes32([ 58, 243, 16, 193, 174, 42, 255, 46, 40, 128, 26, 167, 173, 164, 71, 226, 155, 205, 26, 127, 154, 24, 74, 244, 106, 251, 25, 221, 197, 176, 194, 17, ]), - Bytes32::new_direct([ + Bytes32([ 51, 47, 251, 206, 27, 9, 142, 27, 253, 132, 189, 62, 109, 150, 246, 2, 137, 90, 157, 185, 59, 96, 0, 154, 29, 17, 231, 3, 84, 95, 49, 51, ]), - Bytes32::new_direct([ + Bytes32([ 250, 158, 158, 248, 206, 150, 95, 254, 53, 140, 80, 102, 67, 26, 76, 127, 236, 86, 182, 120, 72, 239, 190, 118, 60, 77, 28, 82, 152, 234, 73, 201, ]), - Bytes32::new_direct([ + Bytes32([ 255, 137, 155, 144, 74, 231, 231, 43, 187, 202, 137, 66, 205, 37, 40, 225, 0, 33, 87, 137, 113, 163, 58, 64, 147, 74, 123, 128, 19, 156, 46, 83, ]), - Bytes32::new_direct([ + Bytes32([ 207, 61, 79, 4, 202, 96, 238, 144, 154, 230, 145, 65, 230, 130, 246, 10, 140, 71, 66, 246, 53, 230, 148, 1, 248, 103, 145, 149, 157, 38, 169, 8, ]), - Bytes32::new_direct([ + Bytes32([ 33, 168, 110, 82, 84, 151, 70, 98, 115, 2, 221, 116, 210, 10, 247, 189, 203, 245, 186, 86, 121, 142, 218, 95, 68, 241, 21, 219, 131, 241, 185, 203, ]), - Bytes32::new_direct([ + Bytes32([ 125, 247, 7, 149, 181, 71, 68, 141, 123, 207, 144, 83, 170, 27, 244, 37, 210, 148, 0, 140, 144, 159, 237, 216, 227, 247, 85, 229, 80, 174, 40, 48, ]), - Bytes32::new_direct([ + Bytes32([ 0, 205, 68, 89, 77, 97, 204, 140, 113, 244, 168, 76, 49, 137, 236, 21, 132, 99, 10, 206, 195, 206, 208, 120, 227, 77, 21, 223, 145, 227, 48, 139, ]), - Bytes32::new_direct([ + Bytes32([ 10, 153, 106, 155, 149, 65, 211, 247, 246, 5, 129, 126, 74, 14, 113, 168, 152, 154, 205, 139, 49, 2, 182, 65, 163, 15, 62, 126, 62, 16, 26, 36, ]), - Bytes32::new_direct([ + Bytes32([ 24, 251, 204, 187, 179, 146, 114, 66, 110, 182, 131, 248, 36, 170, 169, 128, 22, 221, 134, 193, 121, 189, 128, 94, 83, 255, 226, 37, 133, 83, 220, 181, ]), - Bytes32::new_direct([ + Bytes32([ 25, 52, 245, 155, 53, 39, 73, 130, 12, 73, 106, 255, 44, 204, 208, 41, 32, 126, 159, 98, 197, 67, 58, 90, 6, 146, 25, 166, 195, 194, 215, 70, ]), - Bytes32::new_direct([ + Bytes32([ 194, 167, 206, 222, 96, 6, 86, 241, 95, 105, 225, 147, 99, 93, 201, 220, 166, 145, 4, 25, 168, 188, 21, 168, 80, 163, 132, 216, 239, 19, 115, 36, ]), - Bytes32::new_direct([ + Bytes32([ 243, 16, 4, 9, 140, 42, 62, 105, 97, 7, 4, 234, 200, 227, 42, 10, 51, 167, 38, 148, 69, 154, 143, 179, 94, 177, 248, 28, 33, 61, 166, 187, ]), - Bytes32::new_direct([ + Bytes32([ 156, 201, 97, 197, 223, 83, 229, 186, 187, 33, 49, 210, 181, 222, 180, 234, 150, 33, 99, 168, 157, 26, 241, 1, 213, 220, 165, 8, 31, 76, 134, 243, ]), - Bytes32::new_direct([ + Bytes32([ 34, 218, 29, 74, 212, 218, 95, 6, 53, 10, 63, 174, 119, 90, 90, 35, 92, 124, 169, 222, 75, 61, 199, 118, 132, 40, 193, 9, 250, 80, 12, 197, ]), - Bytes32::new_direct([ + Bytes32([ 102, 137, 75, 155, 181, 222, 86, 192, 140, 167, 3, 178, 212, 165, 49, 163, 86, 8, 76, 240, 32, 202, 34, 159, 217, 173, 101, 125, 237, 34, 48, 179, ]), - Bytes32::new_direct([ + Bytes32([ 136, 53, 156, 19, 107, 234, 210, 218, 180, 236, 9, 7, 80, 63, 146, 57, 77, 106, 135, 64, 23, 184, 9, 139, 61, 237, 225, 157, 183, 182, 137, 31, ]), - Bytes32::new_direct([ + Bytes32([ 237, 226, 115, 218, 228, 122, 45, 46, 67, 21, 130, 204, 80, 2, 28, 47, 148, 191, 28, 33, 177, 47, 207, 14, 33, 117, 28, 46, 88, 254, 97, 227, ]), - Bytes32::new_direct([ + Bytes32([ 38, 87, 252, 28, 105, 20, 117, 29, 234, 237, 60, 91, 48, 101, 219, 219, 24, 52, 169, 243, 71, 214, 117, 41, 207, 17, 148, 77, 218, 44, 122, 167, ]), - Bytes32::new_direct([ + Bytes32([ 235, 31, 185, 222, 3, 22, 222, 174, 126, 128, 55, 67, 201, 229, 55, 28, 241, 144, 184, 85, 141, 153, 183, 211, 66, 80, 152, 248, 214, 130, 64, 205, ]), - Bytes32::new_direct([ + Bytes32([ 52, 169, 226, 179, 195, 44, 245, 101, 35, 92, 145, 174, 152, 212, 192, 148, 241, 72, 248, 61, 239, 124, 98, 213, 181, 75, 84, 121, 57, 90, 172, 164, ]), - Bytes32::new_direct([ + Bytes32([ 27, 19, 12, 74, 128, 193, 65, 63, 15, 6, 174, 167, 79, 56, 88, 13, 117, 6, 189, 14, 11, 13, 133, 136, 141, 64, 74, 17, 159, 192, 251, 242, ]), - Bytes32::new_direct([ + Bytes32([ 101, 69, 132, 221, 127, 162, 162, 92, 248, 131, 39, 52, 169, 170, 231, 137, 123, 106, 161, 16, 202, 242, 216, 245, 211, 170, 74, 128, 108, 243, 166, 38, ]), - Bytes32::new_direct([ + Bytes32([ 157, 82, 193, 234, 117, 199, 118, 245, 63, 31, 186, 32, 135, 233, 29, 213, 217, 119, 208, 64, 149, 116, 117, 129, 211, 225, 207, 22, 225, 99, 194, 222, ]), - Bytes32::new_direct([ + Bytes32([ 112, 194, 64, 229, 154, 223, 109, 8, 191, 120, 32, 176, 154, 7, 174, 103, 2, 156, 230, 164, 245, 252, 0, 116, 213, 40, 20, 239, 135, 62, 198, 42, ]), - Bytes32::new_direct([ + Bytes32([ 32, 91, 5, 170, 221, 134, 167, 144, 16, 130, 237, 114, 71, 184, 131, 223, 92, 149, 161, 68, 196, 56, 73, 148, 203, 187, 174, 178, 178, 53, 156, 177, ]), - Bytes32::new_direct([ + Bytes32([ 234, 97, 64, 211, 81, 59, 14, 249, 38, 8, 247, 37, 243, 37, 88, 234, 19, 54, 146, 63, 88, 79, 127, 190, 144, 51, 240, 19, 15, 143, 18, 9, ]), - Bytes32::new_direct([ + Bytes32([ 247, 102, 43, 28, 24, 201, 189, 198, 66, 58, 210, 51, 174, 234, 52, 239, 37, 83, 212, 184, 127, 170, 168, 127, 47, 11, 248, 213, 84, 3, 201, 181, ]), - Bytes32::new_direct([ + Bytes32([ 126, 18, 116, 33, 129, 25, 247, 2, 162, 202, 103, 201, 237, 67, 28, 80, 46, 182, 163, 239, 90, 204, 47, 196, 137, 79, 19, 165, 209, 84, 140, 132, ]), - Bytes32::new_direct([ + Bytes32([ 189, 160, 148, 101, 82, 248, 215, 206, 90, 91, 205, 148, 37, 38, 172, 82, 223, 228, 66, 173, 220, 246, 194, 73, 231, 17, 220, 47, 222, 175, 7, 24, ]), - Bytes32::new_direct([ + Bytes32([ 237, 149, 54, 210, 99, 72, 182, 55, 69, 140, 161, 215, 104, 90, 104, 26, 216, 241, 232, 210, 37, 77, 56, 216, 6, 160, 199, 247, 164, 227, 142, 255, ]), - Bytes32::new_direct([ + Bytes32([ 11, 57, 131, 77, 203, 89, 156, 126, 200, 215, 103, 209, 70, 235, 78, 247, 0, 126, 209, 248, 220, 135, 158, 244, 141, 74, 6, 158, 19, 37, 42, 39, ]), - Bytes32::new_direct([ + Bytes32([ 107, 131, 231, 102, 64, 182, 78, 253, 77, 143, 94, 34, 199, 93, 44, 131, 169, 211, 71, 223, 53, 230, 59, 107, 146, 22, 188, 207, 210, 220, 168, 129, ]), - Bytes32::new_direct([ + Bytes32([ 78, 71, 246, 216, 154, 188, 152, 6, 234, 254, 21, 1, 128, 148, 56, 91, 250, 95, 76, 103, 15, 250, 137, 186, 114, 254, 122, 69, 208, 242, 69, 111, ]), - Bytes32::new_direct([ + Bytes32([ 82, 241, 242, 155, 248, 109, 84, 118, 225, 255, 122, 40, 3, 87, 20, 223, 212, 205, 141, 178, 32, 229, 234, 146, 101, 73, 79, 55, 28, 82, 81, 178, ]), - Bytes32::new_direct([ + Bytes32([ 35, 169, 243, 198, 215, 220, 113, 91, 6, 79, 48, 201, 97, 143, 212, 34, 247, 46, 38, 93, 166, 213, 158, 218, 61, 86, 240, 149, 224, 174, 225, 73, ]), - Bytes32::new_direct([ + Bytes32([ 25, 108, 21, 212, 193, 192, 96, 39, 57, 72, 193, 99, 239, 0, 231, 83, 183, 195, 105, 33, 220, 187, 18, 148, 43, 30, 42, 127, 192, 240, 13, 224, ]), - Bytes32::new_direct([ + Bytes32([ 119, 117, 186, 31, 43, 128, 143, 25, 182, 135, 156, 58, 152, 81, 70, 116, 171, 137, 125, 157, 152, 163, 34, 65, 240, 178, 12, 24, 168, 111, 39, 35, ]), ]; -pub const EMPTY_HASH: &Bytes32 = &Bytes32::new_direct([0; 32]); +pub const EMPTY_HASH: &Bytes32 = &Bytes32([0; 32]); pub const ZERO_HASHES: &[&[Bytes32; 64]; 7] = &[ VALUE_HASHES, From d967a828dbc9aa92c5b5c2accbc2fd61853894ff Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 09:53:04 +0200 Subject: [PATCH 077/140] Also remove new_direct from the zero-hash generation tests --- arbitrator/prover/src/memory.rs | 2 +- arbitrator/prover/src/merkle.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 47249560cd..793c50035a 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -384,7 +384,7 @@ mod test { pub fn empty_leaf_hash() { let leaf = [0u8; 32]; let hash = super::hash_leaf(leaf); - print!("Bytes32::new_direct(["); + print!("Bytes32(["); for i in 0..32 { print!("{}", hash[i]); if i < 31 { diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 3e50dbd1a9..1f5d611a0a 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -532,7 +532,7 @@ fn emit_memory_zerohashes() { ]) .clone(); for _ in 0..64 { - print!("Bytes32::new_direct(["); + print!("Bytes32(["); for i in 0..32 { print!("{}", empty_node[i]); if i < 31 { From dc2ed78bc8a2ab5fa2619669c7c6a5666661f547 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 10:44:23 +0200 Subject: [PATCH 078/140] Remove the PartialEq implementation It isn't needed by any of the code that interacts with Memory objects. --- arbitrator/prover/src/memory.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 793c50035a..0d935b824a 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -100,16 +100,6 @@ fn div_round_up(num: usize, denom: usize) -> usize { res } -impl PartialEq for Memory { - fn eq(&self, other: &Memory) -> bool { - self.buffer == other.buffer - && self.merkle == other.merkle - && self.max_size == other.max_size - && self.dirty_indices.lock().unwrap().deref() - == other.dirty_indices.lock().unwrap().deref() - } -} - impl Clone for Memory { fn clone(&self) -> Self { Memory { From 3cd78571d793c5733c52d301ac2f618cee8c3a99 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 10:47:42 +0200 Subject: [PATCH 079/140] Switch to the parking_lot crate's Mutex Primarily because it has a nicer API which avoids having to call unwrap() so much. --- arbitrator/prover/src/memory.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 0d935b824a..5140dffc63 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -8,9 +8,10 @@ use crate::{ use arbutil::Bytes32; use digest::Digest; use eyre::{bail, ErrReport, Result}; +use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::{borrow::Cow, collections::HashSet, convert::TryFrom, ops::Deref, sync::Mutex}; +use std::{borrow::Cow, collections::HashSet, convert::TryFrom, ops::Deref}; #[cfg(feature = "counters")] use std::sync::atomic::{AtomicUsize, Ordering}; @@ -106,7 +107,7 @@ impl Clone for Memory { buffer: self.buffer.clone(), merkle: self.merkle.clone(), max_size: self.max_size, - dirty_indices: Mutex::new(self.dirty_indices.lock().unwrap().clone()), + dirty_indices: Mutex::new(self.dirty_indices.lock().clone()), } } } @@ -134,7 +135,7 @@ impl Memory { pub fn merkelize(&self) -> Cow<'_, Merkle> { if let Some(m) = &self.merkle { - let mut dirt = self.dirty_indices.lock().unwrap(); + let mut dirt = self.dirty_indices.lock(); for idx in dirt.iter() { let leaf_idx = idx / Self::LEAF_SIZE; m.set(leaf_idx, hash_leaf(self.get_leaf_data(leaf_idx))); @@ -165,7 +166,7 @@ impl Memory { panic!("Couldn't resize merkle tree from {} to {}", size, leaves) }); } - self.dirty_indices.lock().unwrap().clear(); + self.dirty_indices.lock().clear(); Cow::Owned(m) } @@ -274,8 +275,8 @@ impl Memory { let end_idx = end_idx as usize; let buf = value.to_le_bytes(); self.buffer[idx..end_idx].copy_from_slice(&buf[..bytes.into()]); - self.dirty_indices.lock().unwrap().insert(idx); - self.dirty_indices.lock().unwrap().insert(end_idx - 1); + self.dirty_indices.lock().insert(idx); + self.dirty_indices.lock().insert(end_idx - 1); true } @@ -294,7 +295,7 @@ impl Memory { let idx = idx as usize; let end_idx = end_idx as usize; self.buffer[idx..end_idx].copy_from_slice(value); - self.dirty_indices.lock().unwrap().insert(idx); + self.dirty_indices.lock().insert(idx); true } From 9676230920eb38a042dc39062aa28f1a7123062e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 10:48:45 +0200 Subject: [PATCH 080/140] Remove the unused ops:Dref --- arbitrator/prover/src/memory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 5140dffc63..8c619b47d8 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -11,7 +11,7 @@ use eyre::{bail, ErrReport, Result}; use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use sha3::Keccak256; -use std::{borrow::Cow, collections::HashSet, convert::TryFrom, ops::Deref}; +use std::{borrow::Cow, collections::HashSet, convert::TryFrom}; #[cfg(feature = "counters")] use std::sync::atomic::{AtomicUsize, Ordering}; From bd93ab7b3618c5b125dd8178c287bdf1ef051536 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 11:09:02 +0200 Subject: [PATCH 081/140] Switch the dirty_indices to dirty_leaves This provides a 32x reduction in the size of the dirty tracking. It makes sense because if any index in the memory which contributes to a leaf changes, then they hash for that leaf has to be recalculated. So, we don't need to track the dirty indices in memory, but the dirty leaves in the corresponding merkle tree. This commit also removes a useless take() call, and documents some invariantes when storing to memory. --- arbitrator/prover/src/memory.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 8c619b47d8..390d39db57 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -72,7 +72,7 @@ pub struct Memory { pub merkle: Option, pub max_size: u64, #[serde(skip)] - dirty_indices: Mutex>, + dirty_leaves: Mutex>, } fn hash_leaf(bytes: [u8; Memory::LEAF_SIZE]) -> Bytes32 { @@ -107,7 +107,7 @@ impl Clone for Memory { buffer: self.buffer.clone(), merkle: self.merkle.clone(), max_size: self.max_size, - dirty_indices: Mutex::new(self.dirty_indices.lock().clone()), + dirty_leaves: Mutex::new(self.dirty_leaves.lock().clone()), } } } @@ -125,7 +125,7 @@ impl Memory { buffer: vec![0u8; size], merkle: None, max_size, - dirty_indices: Mutex::new(HashSet::new()), + dirty_leaves: Mutex::new(HashSet::new()), } } @@ -135,12 +135,10 @@ impl Memory { pub fn merkelize(&self) -> Cow<'_, Merkle> { if let Some(m) = &self.merkle { - let mut dirt = self.dirty_indices.lock(); - for idx in dirt.iter() { - let leaf_idx = idx / Self::LEAF_SIZE; + let mut dirt = self.dirty_leaves.lock(); + for leaf_idx in dirt.drain() { m.set(leaf_idx, hash_leaf(self.get_leaf_data(leaf_idx))); } - dirt.clear(); return Cow::Borrowed(m); } // Round the size up to 8 byte long leaves, then round up to the next power of two number of leaves @@ -166,7 +164,7 @@ impl Memory { panic!("Couldn't resize merkle tree from {} to {}", size, leaves) }); } - self.dirty_indices.lock().clear(); + self.dirty_leaves.lock().clear(); Cow::Owned(m) } @@ -264,7 +262,11 @@ impl Memory { } #[must_use] + // Stores a value in memory, returns false if the value would overflow the buffer. + // + // bytes is the number of bytes to store. It must be <= 8. pub fn store_value(&mut self, idx: u64, value: u64, bytes: u8) -> bool { + assert!(bytes <= 8); let Some(end_idx) = idx.checked_add(bytes.into()) else { return false; }; @@ -275,14 +277,19 @@ impl Memory { let end_idx = end_idx as usize; let buf = value.to_le_bytes(); self.buffer[idx..end_idx].copy_from_slice(&buf[..bytes.into()]); - self.dirty_indices.lock().insert(idx); - self.dirty_indices.lock().insert(end_idx - 1); + let mut dirty_leaves = self.dirty_leaves.lock(); + dirty_leaves.insert(idx / Self::LEAF_SIZE); + dirty_leaves.insert((end_idx - 1) / Self::LEAF_SIZE); true } #[must_use] + // Stores a slice in memory, returns false if the value would overflow the buffer. + // + // The length of value <= 32. pub fn store_slice_aligned(&mut self, idx: u64, value: &[u8]) -> bool { + assert!(value.len() <= Self::LEAF_SIZE); if idx % Self::LEAF_SIZE as u64 != 0 { return false; } @@ -295,7 +302,7 @@ impl Memory { let idx = idx as usize; let end_idx = end_idx as usize; self.buffer[idx..end_idx].copy_from_slice(value); - self.dirty_indices.lock().insert(idx); + self.dirty_leaves.lock().insert(idx / Self::LEAF_SIZE); true } @@ -338,7 +345,7 @@ impl Memory { pub fn resize(&mut self, new_size: usize) { self.buffer.resize(new_size, 0); - if let Some(merkle) = self.merkle.take() { + if let Some(merkle) = &mut self.merkle { merkle .resize(new_size / Self::LEAF_SIZE) .unwrap_or_else(|_| { @@ -348,7 +355,6 @@ impl Memory { new_size ) }); - self.merkle = Some(merkle); } } } From c58378a341ee1eca9273046174d742b6180e32a1 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 12:17:05 +0200 Subject: [PATCH 082/140] Add a test to confirm that all the zero hashes are what we expect. --- arbitrator/prover/src/memory.rs | 15 +++- arbitrator/prover/src/merkle.rs | 130 +++++++++++++++++++------------- 2 files changed, 91 insertions(+), 54 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 390d39db57..4aceee2c30 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -359,11 +359,23 @@ impl Memory { } } +pub mod testing { + use arbutil::Bytes32; + + pub fn empty_leaf_hash() -> Bytes32 { + let leaf = [0u8; 32]; + return super::hash_leaf(leaf); + } +} + #[cfg(test)] mod test { + use core::hash; + use arbutil::Bytes32; use crate::memory::round_up_to_power_of_two; + use crate::memory::testing; use super::Memory; @@ -379,8 +391,7 @@ mod test { #[test] pub fn empty_leaf_hash() { - let leaf = [0u8; 32]; - let hash = super::hash_leaf(leaf); + let hash = testing::empty_leaf_hash(); print!("Bytes32(["); for i in 0..32 { print!("{}", hash[i]); diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 1f5d611a0a..b2d9a15b62 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -39,7 +39,7 @@ use rayon::prelude::*; mod zerohashes; -use zerohashes::ZERO_HASHES; +use self::zerohashes::ZERO_HASHES; use self::zerohashes::EMPTY_HASH; @@ -514,62 +514,88 @@ fn resize_works() { assert_eq!(merkle.root(), expected); } -#[test] -fn correct_capacity() { - let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::from([1; 32])]); - assert_eq!(merkle.capacity(), 1); - let merkle = Merkle::new_advanced(MerkleType::Memory, vec![Bytes32::from([1; 32])], 11); - assert_eq!(merkle.capacity(), 1024); -} +#[cfg(test)] +mod test { + use super::*; + use crate::memory; + use arbutil::Bytes32; + use enum_iterator::all; + + #[test] + fn correct_capacity() { + let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::from([1; 32])]); + assert_eq!(merkle.capacity(), 1); + let merkle = Merkle::new_advanced(MerkleType::Memory, vec![Bytes32::from([1; 32])], 11); + assert_eq!(merkle.capacity(), 1024); + } -#[test] -#[ignore = "This is just used for generating the zero hashes for the memory merkle trees."] -fn emit_memory_zerohashes() { - // The following code was generated from the empty_leaf_hash() test in the memory package. - let mut empty_node = Bytes32([ - 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, 186, - 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, - ]) - .clone(); - for _ in 0..64 { - print!("Bytes32(["); - for i in 0..32 { - print!("{}", empty_node[i]); - if i < 31 { - print!(", "); + #[test] + #[ignore = "This is just used for generating the zero hashes for the memory merkle trees."] + fn emit_memory_zerohashes() { + // The following code was generated from the empty_leaf_hash() test in the memory package. + let mut empty_node = Bytes32([ + 57, 29, 211, 154, 252, 227, 18, 99, 65, 126, 203, 166, 252, 232, 32, 3, 98, 194, 254, + 186, 118, 14, 139, 192, 101, 156, 55, 194, 101, 11, 11, 168, + ]) + .clone(); + for _ in 0..64 { + print!("Bytes32(["); + for i in 0..32 { + print!("{}", empty_node[i]); + if i < 31 { + print!(", "); + } } + println!("]),"); + empty_node = hash_node(MerkleType::Memory, empty_node, empty_node); } - println!("]),"); - empty_node = hash_node(MerkleType::Memory, empty_node, empty_node); } -} -#[test] -fn clone_is_separate() { - let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); - let m2 = merkle.clone(); - m2.resize(4).expect("resize failed"); - m2.set(3, Bytes32::from([2; 32])); - assert_ne!(merkle, m2); -} + #[test] + fn clone_is_separate() { + let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); + let m2 = merkle.clone(); + m2.resize(4).expect("resize failed"); + m2.set(3, Bytes32::from([2; 32])); + assert_ne!(merkle, m2); + } -#[test] -fn serialization_roundtrip() { - let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); - merkle.resize(4).expect("resize failed"); - merkle.set(3, Bytes32::from([2; 32])); - let serialized = bincode::serialize(&merkle).unwrap(); - let deserialized: Merkle = bincode::deserialize(&serialized).unwrap(); - assert_eq!(merkle, deserialized); -} + #[test] + fn serialization_roundtrip() { + let merkle = Merkle::new_advanced(MerkleType::Value, vec![Bytes32::from([1; 32])], 4); + merkle.resize(4).expect("resize failed"); + merkle.set(3, Bytes32::from([2; 32])); + let serialized = bincode::serialize(&merkle).unwrap(); + let deserialized: Merkle = bincode::deserialize(&serialized).unwrap(); + assert_eq!(merkle, deserialized); + } -#[test] -#[should_panic(expected = "index out of bounds")] -fn set_with_bad_index_panics() { - let merkle = Merkle::new( - MerkleType::Value, - vec![Bytes32::default(), Bytes32::default()], - ); - assert_eq!(merkle.capacity(), 2); - merkle.set(2, Bytes32::default()); + #[test] + #[should_panic(expected = "index out of bounds")] + fn set_with_bad_index_panics() { + let merkle = Merkle::new( + MerkleType::Value, + vec![Bytes32::default(), Bytes32::default()], + ); + assert_eq!(merkle.capacity(), 2); + merkle.set(2, Bytes32::default()); + } + + #[test] + fn test_zero_hashes() { + for ty in all::() { + if ty == MerkleType::Empty { + continue; + } + let mut empty_hash = Bytes32::from([0; 32]); + if ty == MerkleType::Memory { + empty_hash = memory::testing::empty_leaf_hash(); + } + for layer in 0..64 { + // empty_hash_at is just a lookup, but empty_hash is calculated iteratively. + assert_eq!(empty_hash_at(ty, layer), &empty_hash); + empty_hash = hash_node(ty, &empty_hash, &empty_hash); + } + } + } } From afaef9708283ac20960215aaea30ca256c16b3d9 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 12:17:58 +0200 Subject: [PATCH 083/140] Remove accidental import --- arbitrator/prover/src/memory.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 4aceee2c30..dd4198f7b8 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -370,8 +370,6 @@ pub mod testing { #[cfg(test)] mod test { - use core::hash; - use arbutil::Bytes32; use crate::memory::round_up_to_power_of_two; From cc2a84dc4cdaa1dca4b810cf4de04485d70dd506 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 12:23:37 +0200 Subject: [PATCH 084/140] Organize imports better --- arbitrator/prover/src/merkle.rs | 38 +++++++++++---------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index b2d9a15b62..8db5084994 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -2,33 +2,14 @@ // For license information, see https://github.com/nitro/blob/master/LICENSE use arbutil::Bytes32; +use core::panic; use digest::Digest; - use enum_iterator::Sequence; - -use parking_lot::Mutex; - -#[cfg(feature = "counters")] -use enum_iterator::all; use itertools::Itertools; - -use std::cmp::max; - -#[cfg(feature = "counters")] -use std::sync::atomic::AtomicUsize; - -#[cfg(feature = "counters")] -use std::sync::atomic::Ordering; - -#[cfg(feature = "counters")] -use lazy_static::lazy_static; - -#[cfg(feature = "counters")] -use std::collections::HashMap; - -use core::panic; +use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use sha3::Keccak256; +use std::cmp::max; use std::{ collections::HashSet, convert::{TryFrom, TryInto}, @@ -38,10 +19,15 @@ use std::{ use rayon::prelude::*; mod zerohashes; - -use self::zerohashes::ZERO_HASHES; - -use self::zerohashes::EMPTY_HASH; +use self::zerohashes::{EMPTY_HASH, ZERO_HASHES}; +#[cfg(feature = "counters")] +use { + enum_iterator::all, + itertools::Itertools, + lazy_static::lazy_static, + std::collections::HashMap, + std::sync::atomic::{AtomicUsize, Ordering}, +}; #[cfg(feature = "counters")] macro_rules! init_counters { From 420f11615a9638f762fb027e5cae7f1d149b3e9e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 12:45:31 +0200 Subject: [PATCH 085/140] Fix up the counters feature There were a few bugs, and the code was sort of disorganized. --- arbitrator/prover/src/merkle.rs | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 8db5084994..d79a1e8324 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -23,36 +23,27 @@ use self::zerohashes::{EMPTY_HASH, ZERO_HASHES}; #[cfg(feature = "counters")] use { enum_iterator::all, - itertools::Itertools, lazy_static::lazy_static, std::collections::HashMap, std::sync::atomic::{AtomicUsize, Ordering}, }; #[cfg(feature = "counters")] -macro_rules! init_counters { - ($name:ident) => { - lazy_static! { - static ref $name: HashMap<&'static MerkleType, AtomicUsize> = { - let mut map = HashMap::new(); - $(map.insert(&MerkleType::$variant, AtomicUsize::new(0));)* - map - }; - } - }; +fn create_counters_hashmap() -> HashMap { + let mut map = HashMap::new(); + for ty in all::() { + map.insert(ty, AtomicUsize::new(0)); + } + map } #[cfg(feature = "counters")] -init_counters!(NEW_COUNTERS); - -#[cfg(feature = "counters")] -init_counters!(ROOT_COUNTERS); - -#[cfg(feature = "counters")] -init_counters!(SET_COUNTERS); - -#[cfg(feature = "counters")] -init_counters!(RESIZE_COUNTERS); +lazy_static! { + static ref NEW_COUNTERS: HashMap = create_counters_hashmap(); + static ref ROOT_COUNTERS: HashMap = create_counters_hashmap(); + static ref SET_COUNTERS: HashMap = create_counters_hashmap(); + static ref RESIZE_COUNTERS: HashMap = create_counters_hashmap(); +} #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Serialize, Deserialize, Sequence)] pub enum MerkleType { From a7665f3989b1234d1dc48df1e95ec5a3137962a4 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 12:47:44 +0200 Subject: [PATCH 086/140] Use a &[Bytes32] instead of a Vec --- arbitrator/prover/src/merkle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index d79a1e8324..1bdb6df6db 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -160,7 +160,7 @@ const fn empty_hash_at(ty: MerkleType, layer_i: usize) -> &'static Bytes32 { #[inline] #[cfg(feature = "rayon")] -fn new_layer(ty: MerkleType, layer: &Vec, empty_hash: &'static Bytes32) -> Vec { +fn new_layer(ty: MerkleType, layer: &[Bytes32], empty_hash: &'static Bytes32) -> Vec { let mut new_layer: Vec = Vec::with_capacity(layer.len() >> 1); let chunks = layer.par_chunks(2); chunks From bb0b24b3abc40ffd44faadd4b054b7064dc31268 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 13:10:49 +0200 Subject: [PATCH 087/140] Change how depth is calculated This way uses integer math and is slightly more efficient. --- arbitrator/prover/src/merkle.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 1bdb6df6db..4e0ec8b0af 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -202,8 +202,11 @@ impl Merkle { if hashes.is_empty() && min_depth == 0 { return Merkle::default(); } - let mut depth = (hashes.len() as f64).log2().ceil() as usize; - depth = depth.max(min_depth); + let depth = if hashes.len() > 1 { + min_depth.max(((hashes.len() - 1).ilog2() + 1).try_into().unwrap()) + } else { + min_depth + }; let mut layers: Vec> = Vec::with_capacity(depth); layers.push(hashes); let mut dirty_indices: Vec> = Vec::with_capacity(depth); @@ -500,8 +503,15 @@ mod test { #[test] fn correct_capacity() { + let merkle: Merkle = Merkle::new(MerkleType::Value, vec![]); + assert_eq!(merkle.capacity(), 0); let merkle = Merkle::new(MerkleType::Value, vec![Bytes32::from([1; 32])]); assert_eq!(merkle.capacity(), 1); + let merkle = Merkle::new( + MerkleType::Value, + vec![Bytes32::from([1; 32]), Bytes32::from([2; 32])], + ); + assert_eq!(merkle.capacity(), 2); let merkle = Merkle::new_advanced(MerkleType::Memory, vec![Bytes32::from([1; 32])], 11); assert_eq!(merkle.capacity(), 1024); } From c35200763475e97e9efd5dcb0c38e21225c64f2e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 13:53:44 +0200 Subject: [PATCH 088/140] Assert that resizing from 5 to 6 doesn't change the root hash Because the merkle tree still has a capacity of 8, and we haven't changed the value of any of the leaves, the root hash should still be the same. --- arbitrator/prover/src/merkle.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 4e0ec8b0af..8d1f8596f6 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -461,6 +461,8 @@ fn resize_works() { Err(e) => panic!("{}", e), }; assert_eq!(new_size, 6); + assert_eq!(merkle.root(), expected); + merkle.set(5, Bytes32::from([6; 32])); expected = hash_node( MerkleType::Value, From 899f8c33b05e9f170029429be51a294b2cd2b5bc Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 13:56:26 +0200 Subject: [PATCH 089/140] Remove a doulbe-lock on a Mutex --- arbitrator/prover/src/merkle.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 8d1f8596f6..d5f31c6ed2 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -304,8 +304,11 @@ impl Merkle { #[must_use] pub fn prove(&self, idx: usize) -> Option> { - if self.layers.lock().data.is_empty() || idx >= self.layers.lock().data[0].len() { - return None; + { + let layers = self.layers.lock(); + if layers.data.is_empty() || idx >= layers.data[0].len() { + return None; + } } Some(self.prove_any(idx)) } From 04b42bdc87a6da7ad780ad8999c7d86f05f44e2b Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 13:58:40 +0200 Subject: [PATCH 090/140] Use a more efficient calculation of capacity. --- arbitrator/prover/src/merkle.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index d5f31c6ed2..10505b30aa 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -288,8 +288,7 @@ impl Merkle { if layers.data.is_empty() { return 0; } - let base: usize = 2; - base.pow((layers.data.len() - 1).try_into().unwrap()) + 1 << (layers.data.len() - 1) } // Returns the number of leaves in the tree. From 56f248ba51a11f31c9e6f6aa118d19ac4023b8b2 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 14:02:17 +0200 Subject: [PATCH 091/140] Add an assertion on index being equal to length This should always be the case because the dirt is cleaned up in order. But, this asserttion can catch it if we get it wrong. --- arbitrator/prover/src/merkle.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 10505b30aa..13ed1a6936 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -258,6 +258,7 @@ impl Merkle { layers.data[layer_i][*idx] = new_hash; } else { // Push the new parent hash onto the end of the layer. + assert_eq!(*idx, layers.data[layer_i].len()); layers.data[layer_i].push(new_hash); } // Mark the node's parent as dirty unless it's the root. From 981158be5718de97a2092663086a2078f3b16bdb Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 14:13:37 +0200 Subject: [PATCH 092/140] Explain why comparing root hashes is the right implementation of equals --- arbitrator/prover/src/merkle.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 13ed1a6936..33e6c01e13 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -390,6 +390,19 @@ impl Merkle { } impl PartialEq for Merkle { + // There are only three members of a Merkle, the type, the layers, and the min_depth. + // + // It should be obvious that only if the type and layers are equal, will the root hash + // be equal. So, it is sufficient to compare the root hash when checking equality. + // + // However, it is possible that the min_depth may differ between two merkle trees which + // have the same type and layers. The root hash will still be equal unless the min_depth + // is larger than the depth required to hold the data in the layers. + // + // For example, a Merkle tree with 5 leaves requires 3 layeers to hold the data. If the + // min_depth is 1 on one tree and 2 on another, the root has would still be equal + // because the same nodes are hashed together. However, the min_dpeth was 4, then, + // there would be 4 layers in that tree, and the root hash would be different. fn eq(&self, other: &Self) -> bool { self.root() == other.root() } From 195a009e52c9a529335edc4c907d9b0b86c3aada Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 16:24:50 +0200 Subject: [PATCH 093/140] Switch to layers.len() - 1 during constuction Keeping track of the layers_i wasn't really making the code easier to read. --- arbitrator/prover/src/merkle.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 33e6c01e13..7eb9dfe645 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -210,15 +210,13 @@ impl Merkle { let mut layers: Vec> = Vec::with_capacity(depth); layers.push(hashes); let mut dirty_indices: Vec> = Vec::with_capacity(depth); - let mut layer_i = 0usize; while layers.last().unwrap().len() > 1 || layers.len() < min_depth { let layer = layers.last().unwrap(); - let empty_hash = empty_hash_at(ty, layer_i); + let empty_hash = empty_hash_at(ty, layers.len() - 1); let new_layer = new_layer(ty, layer, empty_hash); dirty_indices.push(HashSet::with_capacity(new_layer.len())); layers.push(new_layer); - layer_i += 1; } let layers = Mutex::new(Layers { data: layers, From 0a890a92cc8922a4484c4253a76381d68708aeb7 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 17:08:40 +0200 Subject: [PATCH 094/140] Only track the dirt for the leaves' parents on the heap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the code a little cleaner, and it performs the same or slightly better. Before: ``` Running benchmark with always merkleize feature on avg hash time 226.487µs, avg step time 226ns, step size 1, num_iters 200, total time 45.356958ms avg hash time 285.669µs, avg step time 3.454µs, step size 1024, num_iters 200, total time 57.836958ms avg hash time 673.086µs, avg step time 141.763µs, step size 32768, num_iters 200, total time 162.983ms avg hash time 800.159µs, avg step time 3.333175ms, step size 1048576, num_iters 200, total time 826.676667ms avg hash time 2.394079ms, avg step time 54.744735ms, step size 16777216, num_iters 134, total time 7.711356917s avg hash time 6.981576ms, avg step time 221.284475ms, step size 67108864, num_iters 33, total time 7.754069s avg hash time 23.845249ms, avg step time 826.907254ms, step size 268435456, num_iters 8, total time 7.632934667s ``` After: ``` Running benchmark with always merkleize feature on avg hash time 223.077µs, avg step time 196ns, step size 1, num_iters 200, total time 44.670042ms avg hash time 283.239µs, avg step time 4.477µs, step size 1024, num_iters 200, total time 57.556875ms avg hash time 631.034µs, avg step time 139.475µs, step size 32768, num_iters 200, total time 154.115083ms avg hash time 813.914µs, avg step time 3.357342ms, step size 1048576, num_iters 200, total time 834.265ms avg hash time 2.39359ms, avg step time 55.253016ms, step size 16777216, num_iters 134, total time 7.779911875s avg hash time 6.768607ms, avg step time 222.297451ms, step size 67108864, num_iters 33, total time 7.781483917s avg hash time 25.057057ms, avg step time 840.610754ms, step size 268435456, num_iters 8, total time 7.765957833s ``` --- arbitrator/prover/src/merkle.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 7eb9dfe645..36ccadd0be 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -111,7 +111,7 @@ impl MerkleType { #[derive(Debug, Clone, Default, Serialize, Deserialize)] struct Layers { data: Vec>, - dirt: Vec>, + dirty_leaf_parents: HashSet, } /// A Merkle tree with a fixed number of layers @@ -208,19 +208,18 @@ impl Merkle { min_depth }; let mut layers: Vec> = Vec::with_capacity(depth); + let dirty_leaf_parents = HashSet::with_capacity(hashes.len() / 2); layers.push(hashes); - let mut dirty_indices: Vec> = Vec::with_capacity(depth); while layers.last().unwrap().len() > 1 || layers.len() < min_depth { let layer = layers.last().unwrap(); let empty_hash = empty_hash_at(ty, layers.len() - 1); let new_layer = new_layer(ty, layer, empty_hash); - dirty_indices.push(HashSet::with_capacity(new_layer.len())); layers.push(new_layer); } let layers = Mutex::new(Layers { data: layers, - dirt: dirty_indices, + dirty_leaf_parents, }); Merkle { ty, @@ -231,14 +230,14 @@ impl Merkle { fn rehash(&self, layers: &mut Layers) { // If nothing is dirty, then there's no need to rehash. - if layers.dirt.is_empty() || layers.dirt[0].is_empty() { + if layers.dirty_leaf_parents.is_empty() { return; } + // Consume the leaf parents dirty indices. + let mut dirt = std::mem::take(&mut layers.dirty_leaf_parents); // Process dirty indices starting from layer 1 (layer 0 is the leaves). for layer_i in 1..layers.data.len() { - let dirty_i = layer_i - 1; - // Consume this layer's dirty indices. - let dirt = std::mem::take(&mut layers.dirt[dirty_i]); + let mut new_dirt = HashSet::with_capacity(dirt.len() / 2); // It is important to process the dirty indices in order because // when the leaves grown since the last rehash, the new parent is // simply pused to the end of the layer's data. @@ -261,9 +260,10 @@ impl Merkle { } // Mark the node's parent as dirty unless it's the root. if layer_i < layers.data.len() - 1 { - layers.dirt[dirty_i + 1].insert(idx >> 1); + new_dirt.insert(idx >> 1); } } + dirt = new_dirt; } } @@ -359,7 +359,7 @@ impl Merkle { return; } layers.data[0][idx] = hash; - layers.dirt[0].insert(idx >> 1); + layers.dirty_leaf_parents.insert(idx >> 1); } /// Resizes the number of leaves the tree can hold. @@ -381,7 +381,7 @@ impl Merkle { } let start = layers.data[0].len(); for i in start..new_len { - layers.dirt[0].insert(i); + layers.dirty_leaf_parents.insert(i); } Ok(layers.data[0].len()) } From 613e9dd8aec1702bd14d51ad31af8e4f1d3ddd7f Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 22:42:42 +0200 Subject: [PATCH 095/140] Use bitvec instead of HashMap for dirty indices This commit also caught an error in the logic of the resize() impleentation, and fixes it. --- arbitrator/Cargo.lock | 2 + arbitrator/prover/Cargo.toml | 1 + arbitrator/prover/src/merkle.rs | 191 +++++++++++++++++--------------- 3 files changed, 102 insertions(+), 92 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 5175b6b609..01774c0c4d 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -247,6 +247,7 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", + "serde", "tap", "wyz", ] @@ -1721,6 +1722,7 @@ version = "0.1.0" dependencies = [ "arbutil", "bincode", + "bitvec", "brotli", "c-kzg", "criterion", diff --git a/arbitrator/prover/Cargo.toml b/arbitrator/prover/Cargo.toml index a55c86695e..5475647765 100644 --- a/arbitrator/prover/Cargo.toml +++ b/arbitrator/prover/Cargo.toml @@ -8,6 +8,7 @@ publish = false bincode = "1.3.3" derivative = "2.2.0" digest = "0.9.0" +bitvec = { version = "1", features = ["serde"] } eyre = "0.6.5" fnv = "1.0.7" hex = "0.4.3" diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 36ccadd0be..232ac78d87 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -2,18 +2,15 @@ // For license information, see https://github.com/nitro/blob/master/LICENSE use arbutil::Bytes32; +use bitvec::prelude::*; use core::panic; use digest::Digest; use enum_iterator::Sequence; -use itertools::Itertools; use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use sha3::Keccak256; use std::cmp::max; -use std::{ - collections::HashSet, - convert::{TryFrom, TryInto}, -}; +use std::convert::{TryFrom, TryInto}; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -111,7 +108,7 @@ impl MerkleType { #[derive(Debug, Clone, Default, Serialize, Deserialize)] struct Layers { data: Vec>, - dirty_leaf_parents: HashSet, + dirty_leaf_parents: BitVec, } /// A Merkle tree with a fixed number of layers @@ -208,7 +205,7 @@ impl Merkle { min_depth }; let mut layers: Vec> = Vec::with_capacity(depth); - let dirty_leaf_parents = HashSet::with_capacity(hashes.len() / 2); + let dirty_leaf_parents = bitvec![0; hashes.len() + 1 >> 1]; layers.push(hashes); while layers.last().unwrap().len() > 1 || layers.len() < min_depth { let layer = layers.last().unwrap(); @@ -233,15 +230,18 @@ impl Merkle { if layers.dirty_leaf_parents.is_empty() { return; } - // Consume the leaf parents dirty indices. - let mut dirt = std::mem::take(&mut layers.dirty_leaf_parents); + // Replace the dirty leaf parents with clean ones. + let mut dirt = std::mem::replace( + &mut layers.dirty_leaf_parents, + bitvec![0; (layers.data[0].len() + 1) >> 1], + ); // Process dirty indices starting from layer 1 (layer 0 is the leaves). for layer_i in 1..layers.data.len() { - let mut new_dirt = HashSet::with_capacity(dirt.len() / 2); + let mut new_dirt = bitvec![0; dirt.len() + 1 >> 1]; // It is important to process the dirty indices in order because // when the leaves grown since the last rehash, the new parent is // simply pused to the end of the layer's data. - for idx in dirt.iter().sorted() { + for idx in dirt.iter_ones() { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; // The left child is guaranteed to exist, but the right one @@ -251,16 +251,16 @@ impl Merkle { .get(right_child_idx) .unwrap_or(empty_hash_at(self.ty, layer_i - 1)); let new_hash = hash_node(self.ty, left, right); - if *idx < layers.data[layer_i].len() { - layers.data[layer_i][*idx] = new_hash; + if idx < layers.data[layer_i].len() { + layers.data[layer_i][idx] = new_hash; } else { // Push the new parent hash onto the end of the layer. - assert_eq!(*idx, layers.data[layer_i].len()); + assert_eq!(idx, layers.data[layer_i].len()); layers.data[layer_i].push(new_hash); } // Mark the node's parent as dirty unless it's the root. if layer_i < layers.data.len() - 1 { - new_dirt.insert(idx >> 1); + new_dirt.set(idx >> 1, true); } } dirt = new_dirt; @@ -359,7 +359,7 @@ impl Merkle { return; } layers.data[0][idx] = hash; - layers.dirty_leaf_parents.insert(idx >> 1); + layers.dirty_leaf_parents.set(idx >> 1, true); } /// Resizes the number of leaves the tree can hold. @@ -374,14 +374,20 @@ impl Merkle { ); } let mut layers = self.layers.lock(); + let start = layers.data[0].len(); let mut layer_size = new_len; for (layer_i, layer) in layers.data.iter_mut().enumerate() { layer.resize(layer_size, *empty_hash_at(self.ty, layer_i)); layer_size = max(layer_size >> 1, 1); } - let start = layers.data[0].len(); for i in start..new_len { - layers.dirty_leaf_parents.insert(i); + let parent_i = i >> 1; + assert!(parent_i <= layers.dirty_leaf_parents.len()); + if parent_i == layers.dirty_leaf_parents.len() { + layers.dirty_leaf_parents.push(true); + } else if parent_i < layers.dirty_leaf_parents.len() { + layers.dirty_leaf_parents.set(parent_i, true); + } } Ok(layers.data[0].len()) } @@ -428,94 +434,95 @@ pub mod mutex_sedre { } } -#[test] -fn resize_works() { - let hashes = vec![ - Bytes32::from([1; 32]), - Bytes32::from([2; 32]), - Bytes32::from([3; 32]), - Bytes32::from([4; 32]), - Bytes32::from([5; 32]), - ]; - let mut expected = hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - Bytes32::from([1; 32]), - Bytes32::from([2; 32]), - ), - hash_node( - MerkleType::Value, - Bytes32::from([3; 32]), - Bytes32::from([4; 32]), - ), - ), - hash_node( - MerkleType::Value, - hash_node( - MerkleType::Value, - Bytes32::from([5; 32]), - Bytes32::from([0; 32]), - ), - hash_node( - MerkleType::Value, - Bytes32::from([0; 32]), - Bytes32::from([0; 32]), - ), - ), - ); - let merkle = Merkle::new(MerkleType::Value, hashes.clone()); - assert_eq!(merkle.capacity(), 8); - assert_eq!(merkle.root(), expected); - - let new_size = match merkle.resize(6) { - Ok(size) => size, - Err(e) => panic!("{}", e), - }; - assert_eq!(new_size, 6); - assert_eq!(merkle.root(), expected); - - merkle.set(5, Bytes32::from([6; 32])); - expected = hash_node( - MerkleType::Value, - hash_node( +#[cfg(test)] +mod test { + use super::*; + use crate::memory; + use arbutil::Bytes32; + use core::panic; + use enum_iterator::all; + + #[test] + fn resize_works() { + let hashes = vec![ + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + Bytes32::from([5; 32]), + ]; + let mut expected = hash_node( MerkleType::Value, hash_node( MerkleType::Value, - Bytes32::from([1; 32]), - Bytes32::from([2; 32]), + hash_node( + MerkleType::Value, + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + ), ), hash_node( MerkleType::Value, - Bytes32::from([3; 32]), - Bytes32::from([4; 32]), + hash_node( + MerkleType::Value, + Bytes32::from([5; 32]), + Bytes32::from([0; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([0; 32]), + Bytes32::from([0; 32]), + ), ), - ), - hash_node( + ); + let merkle = Merkle::new(MerkleType::Value, hashes.clone()); + assert_eq!(merkle.capacity(), 8); + assert_eq!(merkle.root(), expected); + + let new_size = match merkle.resize(6) { + Ok(size) => size, + Err(e) => panic!("{}", e), + }; + assert_eq!(new_size, 6); + assert_eq!(merkle.root(), expected); + + merkle.set(5, Bytes32::from([6; 32])); + expected = hash_node( MerkleType::Value, hash_node( MerkleType::Value, - Bytes32::from([5; 32]), - Bytes32::from([6; 32]), + hash_node( + MerkleType::Value, + Bytes32::from([1; 32]), + Bytes32::from([2; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([3; 32]), + Bytes32::from([4; 32]), + ), ), hash_node( MerkleType::Value, - Bytes32::from([0; 32]), - Bytes32::from([0; 32]), + hash_node( + MerkleType::Value, + Bytes32::from([5; 32]), + Bytes32::from([6; 32]), + ), + hash_node( + MerkleType::Value, + Bytes32::from([0; 32]), + Bytes32::from([0; 32]), + ), ), - ), - ); - assert_eq!(merkle.root(), expected); -} - -#[cfg(test)] -mod test { - use super::*; - use crate::memory; - use arbutil::Bytes32; - use enum_iterator::all; + ); + assert_eq!(merkle.root(), expected); + } #[test] fn correct_capacity() { From 4ddf81f5420860ad21bbad77840ac6a3daf100fe Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 18 Jul 2024 22:46:58 +0200 Subject: [PATCH 096/140] Remove obsolete code comment --- arbitrator/prover/src/merkle.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index 232ac78d87..a3b063786f 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -238,9 +238,6 @@ impl Merkle { // Process dirty indices starting from layer 1 (layer 0 is the leaves). for layer_i in 1..layers.data.len() { let mut new_dirt = bitvec![0; dirt.len() + 1 >> 1]; - // It is important to process the dirty indices in order because - // when the leaves grown since the last rehash, the new parent is - // simply pused to the end of the layer's data. for idx in dirt.iter_ones() { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; From ffe3a59c1e9c2d969c45dcea69cd0acc33a487d2 Mon Sep 17 00:00:00 2001 From: Maciej Kulawik Date: Wed, 8 May 2024 22:06:12 +0200 Subject: [PATCH 097/140] add pathdb related notes --- arbos/arbosState/arbosstate.go | 1 + arbos/arbosState/initialize.go | 4 +++- arbos/storage/storage.go | 1 + cmd/pruning/pruning.go | 1 + cmd/staterecovery/staterecovery.go | 1 + execution/gethexec/blockchain.go | 3 +++ 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index 9ff3dd3aa5..7cce64a426 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -115,6 +115,7 @@ func OpenSystemArbosStateOrPanic(stateDB vm.StateDB, tracingInfo *util.TracingIn // NewArbosMemoryBackedArbOSState creates and initializes a memory-backed ArbOS state (for testing only) func NewArbosMemoryBackedArbOSState() (*ArbosState, *state.StateDB) { raw := rawdb.NewMemoryDatabase() + // TODO pathdb db := state.NewDatabase(raw) statedb, err := state.New(common.Hash{}, db, nil) if err != nil { diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 486c6ae33a..7c4bff3188 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/holiman/uint256" "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/burn" @@ -52,7 +53,8 @@ func MakeGenesisBlock(parentHash common.Hash, blockNumber uint64, timestamp uint } func InitializeArbosInDatabase(db ethdb.Database, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (common.Hash, error) { - stateDatabase := state.NewDatabase(db) + // TODO pathdb + stateDatabase := state.NewDatabaseWithConfig(db, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}) statedb, err := state.New(common.Hash{}, stateDatabase, nil) if err != nil { log.Crit("failed to init empty statedb", "error", err) diff --git a/arbos/storage/storage.go b/arbos/storage/storage.go index 158b8896c1..8b8877caf1 100644 --- a/arbos/storage/storage.go +++ b/arbos/storage/storage.go @@ -81,6 +81,7 @@ func NewMemoryBacked(burner burn.Burner) *Storage { // NewMemoryBackedStateDB uses Geth's memory-backed database to create a statedb func NewMemoryBackedStateDB() vm.StateDB { raw := rawdb.NewMemoryDatabase() + // TODO pathdb db := state.NewDatabase(raw) statedb, err := state.New(common.Hash{}, db, nil) if err != nil { diff --git a/cmd/pruning/pruning.go b/cmd/pruning/pruning.go index ab6ec80942..2eeff3c88d 100644 --- a/cmd/pruning/pruning.go +++ b/cmd/pruning/pruning.go @@ -233,6 +233,7 @@ func findImportantRoots(ctx context.Context, chainDb ethdb.Database, stack *node } func PruneChainDb(ctx context.Context, chainDb ethdb.Database, stack *node.Node, initConfig *conf.InitConfig, cacheConfig *core.CacheConfig, persistentConfig *conf.PersistentConfig, l1Client arbutil.L1Interface, rollupAddrs chaininfo.RollupAddresses, validatorRequired bool) error { + // TODO pathdb doesn't need and doesn't support prunning if initConfig.Prune == "" { return pruner.RecoverPruning(stack.InstanceDir(), chainDb, initConfig.PruneThreads) } diff --git a/cmd/staterecovery/staterecovery.go b/cmd/staterecovery/staterecovery.go index 19ed51ef2d..19c8bdef57 100644 --- a/cmd/staterecovery/staterecovery.go +++ b/cmd/staterecovery/staterecovery.go @@ -30,6 +30,7 @@ func RecreateMissingStates(chainDb ethdb.Database, bc *core.BlockChain, cacheCon if previousBlock == nil { return fmt.Errorf("start block parent is missing, parent block number: %d", current-1) } + // TODO pathdb hashConfig := *hashdb.Defaults hashConfig.CleanCacheSize = cacheConfig.TrieCleanLimit * 1024 * 1024 trieConfig := &triedb.Config{ diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 1d5060ca8a..aba07d6bc9 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -105,6 +105,9 @@ func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core SnapshotRestoreMaxGas: cachingConfig.SnapshotRestoreGasLimit, MaxNumberOfBlocksToSkipStateSaving: cachingConfig.MaxNumberOfBlocksToSkipStateSaving, MaxAmountOfGasToSkipStateSaving: cachingConfig.MaxAmountOfGasToSkipStateSaving, + + // TODO pathdb + StateScheme: rawdb.PathScheme, } } From 3249cbb4300c11177cdc8fd05681f600073f861f Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 16 May 2024 16:43:21 -0300 Subject: [PATCH 098/140] adds --execution.caching.state-scheme command line flag --- cmd/nitro/config_test.go | 18 ++++++++++++++++++ cmd/nitro/nitro.go | 8 ++++++++ execution/gethexec/blockchain.go | 27 +++++++++++++++++++++++++-- execution/gethexec/node.go | 3 +++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/cmd/nitro/config_test.go b/cmd/nitro/config_test.go index f94f941e0b..3861aa497e 100644 --- a/cmd/nitro/config_test.go +++ b/cmd/nitro/config_test.go @@ -17,8 +17,10 @@ import ( "github.com/offchainlabs/nitro/cmd/genericconf" "github.com/offchainlabs/nitro/cmd/util/confighelpers" "github.com/offchainlabs/nitro/das" + "github.com/offchainlabs/nitro/execution/gethexec" "github.com/offchainlabs/nitro/util/colors" "github.com/offchainlabs/nitro/util/testhelpers" + "github.com/pkg/errors" "github.com/r3labs/diff/v3" flag "github.com/spf13/pflag" @@ -59,6 +61,22 @@ func TestValidatorConfig(t *testing.T) { Require(t, err) } +func TestInvalidCachingStateSchemeForValidator(t *testing.T) { + args := strings.Split("--execution.caching.state-scheme path --persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --parent-chain.wallet.pathname /l1keystore --parent-chain.wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null", " ") + _, _, _, err := ParseNode(context.Background(), args) + if !errors.Is(err, invalidCachingStateSchemeForValidator) { + Fail(t, "failed to detect invalid state scheme for validator") + } +} + +func TestInvalidArchiveConfig(t *testing.T) { + args := strings.Split("--execution.caching.archive --execution.caching.state-scheme path --persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --parent-chain.wallet.pathname /l1keystore --parent-chain.wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null", " ") + _, _, _, err := ParseNode(context.Background(), args) + if !errors.Is(err, gethexec.InvalidStateSchemeForArchive) { + Fail(t, "failed to detect invalid state scheme for archive") + } +} + func TestAggregatorConfig(t *testing.T) { args := strings.Split("--persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --node.batch-poster.parent-chain-wallet.pathname /l1keystore --node.batch-poster.parent-chain-wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.sequencer --execution.sequencer.enable --node.feed.output.enable --node.feed.output.port 9642 --node.data-availability.enable --node.data-availability.rpc-aggregator.backends [{\"url\":\"http://localhost:8547\",\"pubkey\":\"abc==\"}]", " ") _, _, err := ParseNode(context.Background(), args) diff --git a/cmd/nitro/nitro.go b/cmd/nitro/nitro.go index 3a34229768..fd06e509dc 100644 --- a/cmd/nitro/nitro.go +++ b/cmd/nitro/nitro.go @@ -30,6 +30,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/arbitrum" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" _ "github.com/ethereum/go-ethereum/eth/tracers/js" @@ -817,6 +818,10 @@ func (c *NodeConfig) CanReload(new *NodeConfig) error { return err } +var ( + invalidCachingStateSchemeForValidator = errors.New("PathScheme cannot be used as Caching.StateScheme when validator is required") +) + func (c *NodeConfig) Validate() error { if c.Init.RecreateMissingStateFrom > 0 && !c.Execution.Caching.Archive { return errors.New("recreate-missing-state-from enabled for a non-archive node") @@ -836,6 +841,9 @@ func (c *NodeConfig) Validate() error { if err := c.BlocksReExecutor.Validate(); err != nil { return err } + if c.Node.ValidatorRequired() && (c.Execution.Caching.StateScheme == rawdb.PathScheme) { + return invalidCachingStateSchemeForValidator + } return c.Persistent.Validate() } diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index aba07d6bc9..a25c636a40 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -38,6 +38,7 @@ type CachingConfig struct { MaxNumberOfBlocksToSkipStateSaving uint32 `koanf:"max-number-of-blocks-to-skip-state-saving"` MaxAmountOfGasToSkipStateSaving uint64 `koanf:"max-amount-of-gas-to-skip-state-saving"` StylusLRUCache uint32 `koanf:"stylus-lru-cache"` + StateScheme string `koanf:"state-scheme"` } func CachingConfigAddOptions(prefix string, f *flag.FlagSet) { @@ -53,6 +54,7 @@ func CachingConfigAddOptions(prefix string, f *flag.FlagSet) { f.Uint32(prefix+".max-number-of-blocks-to-skip-state-saving", DefaultCachingConfig.MaxNumberOfBlocksToSkipStateSaving, "maximum number of blocks to skip state saving to persistent storage (archive node only) -- warning: this option seems to cause issues") f.Uint64(prefix+".max-amount-of-gas-to-skip-state-saving", DefaultCachingConfig.MaxAmountOfGasToSkipStateSaving, "maximum amount of gas in blocks to skip saving state to Persistent storage (archive node only) -- warning: this option seems to cause issues") f.Uint32(prefix+".stylus-lru-cache", DefaultCachingConfig.StylusLRUCache, "initialized stylus programs to keep in LRU cache") + f.String(prefix+".state-scheme", DefaultCachingConfig.StateScheme, "scheme to use for state trie storage (hashdb, pathdb)") } var DefaultCachingConfig = CachingConfig{ @@ -68,6 +70,7 @@ var DefaultCachingConfig = CachingConfig{ MaxNumberOfBlocksToSkipStateSaving: 0, MaxAmountOfGasToSkipStateSaving: 0, StylusLRUCache: 256, + StateScheme: rawdb.HashScheme, } var TestCachingConfig = CachingConfig{ @@ -83,8 +86,13 @@ var TestCachingConfig = CachingConfig{ MaxNumberOfBlocksToSkipStateSaving: 0, MaxAmountOfGasToSkipStateSaving: 0, StylusLRUCache: 0, + StateScheme: rawdb.PathScheme, } +var ( + InvalidStateSchemeForArchive = errors.New("Archive cannot be set when using PathScheme as the StateScheme") +) + // TODO remove stack from parameters as it is no longer needed here func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core.CacheConfig { baseConf := ethconfig.Defaults @@ -105,10 +113,25 @@ func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core SnapshotRestoreMaxGas: cachingConfig.SnapshotRestoreGasLimit, MaxNumberOfBlocksToSkipStateSaving: cachingConfig.MaxNumberOfBlocksToSkipStateSaving, MaxAmountOfGasToSkipStateSaving: cachingConfig.MaxAmountOfGasToSkipStateSaving, + StateScheme: cachingConfig.StateScheme, + } +} - // TODO pathdb - StateScheme: rawdb.PathScheme, +func (c *CachingConfig) validateStateScheme() error { + switch c.StateScheme { + case rawdb.HashScheme: + case rawdb.PathScheme: + if c.Archive { + return InvalidStateSchemeForArchive + } + default: + return errors.New("Invalid StateScheme") } + return nil +} + +func (c *CachingConfig) Validate() error { + return c.validateStateScheme() } func WriteOrTestGenblock(chainDb ethdb.Database, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, accountsPerSync uint) error { diff --git a/execution/gethexec/node.go b/execution/gethexec/node.go index 8ee16095d9..2fb0684124 100644 --- a/execution/gethexec/node.go +++ b/execution/gethexec/node.go @@ -57,6 +57,9 @@ type Config struct { } func (c *Config) Validate() error { + if err := c.Caching.Validate(); err != nil { + return err + } if err := c.Sequencer.Validate(); err != nil { return err } From 16ef2838b0ad88571bbd200143a808bcc741a131 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 17 May 2024 09:31:31 -0300 Subject: [PATCH 099/140] use pathdb or hashdb according with command line flag --- cmd/pruning/pruning.go | 5 ++++- cmd/staterecovery/staterecovery.go | 15 +++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cmd/pruning/pruning.go b/cmd/pruning/pruning.go index 2eeff3c88d..096bb4b1ae 100644 --- a/cmd/pruning/pruning.go +++ b/cmd/pruning/pruning.go @@ -233,7 +233,10 @@ func findImportantRoots(ctx context.Context, chainDb ethdb.Database, stack *node } func PruneChainDb(ctx context.Context, chainDb ethdb.Database, stack *node.Node, initConfig *conf.InitConfig, cacheConfig *core.CacheConfig, persistentConfig *conf.PersistentConfig, l1Client arbutil.L1Interface, rollupAddrs chaininfo.RollupAddresses, validatorRequired bool) error { - // TODO pathdb doesn't need and doesn't support prunning + if cacheConfig.StateScheme == rawdb.PathScheme { + return nil + } + if initConfig.Prune == "" { return pruner.RecoverPruning(stack.InstanceDir(), chainDb, initConfig.PruneThreads) } diff --git a/cmd/staterecovery/staterecovery.go b/cmd/staterecovery/staterecovery.go index 19c8bdef57..716989aa41 100644 --- a/cmd/staterecovery/staterecovery.go +++ b/cmd/staterecovery/staterecovery.go @@ -5,12 +5,14 @@ import ( "time" "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/triedb" "github.com/ethereum/go-ethereum/triedb/hashdb" + "github.com/ethereum/go-ethereum/triedb/pathdb" ) func RecreateMissingStates(chainDb ethdb.Database, bc *core.BlockChain, cacheConfig *core.CacheConfig, startBlock uint64) error { @@ -30,13 +32,18 @@ func RecreateMissingStates(chainDb ethdb.Database, bc *core.BlockChain, cacheCon if previousBlock == nil { return fmt.Errorf("start block parent is missing, parent block number: %d", current-1) } - // TODO pathdb - hashConfig := *hashdb.Defaults - hashConfig.CleanCacheSize = cacheConfig.TrieCleanLimit * 1024 * 1024 + trieConfig := &triedb.Config{ Preimages: false, - HashDB: &hashConfig, } + if cacheConfig.StateScheme == rawdb.PathScheme { + trieConfig.PathDB = pathdb.Defaults + } else { + hashConfig := *hashdb.Defaults + hashConfig.CleanCacheSize = cacheConfig.TrieCleanLimit * 1024 * 1024 + trieConfig.HashDB = &hashConfig + } + database := state.NewDatabaseWithConfig(chainDb, trieConfig) defer database.TrieDB().Close() previousState, err := state.New(previousBlock.Root(), database, nil) From 07eb9833205e7e9a672aac987f0bc9b0fd383a7f Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 17 May 2024 09:32:30 -0300 Subject: [PATCH 100/140] use pathdb on memory backed state db --- arbos/arbosState/arbosstate.go | 5 +++-- arbos/storage/storage.go | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index 7cce64a426..aa775b6d07 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -15,6 +15,8 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbos/addressSet" @@ -115,8 +117,7 @@ func OpenSystemArbosStateOrPanic(stateDB vm.StateDB, tracingInfo *util.TracingIn // NewArbosMemoryBackedArbOSState creates and initializes a memory-backed ArbOS state (for testing only) func NewArbosMemoryBackedArbOSState() (*ArbosState, *state.StateDB) { raw := rawdb.NewMemoryDatabase() - // TODO pathdb - db := state.NewDatabase(raw) + db := state.NewDatabaseWithConfig(raw, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}) statedb, err := state.New(common.Hash{}, db, nil) if err != nil { log.Crit("failed to init empty statedb", "error", err) diff --git a/arbos/storage/storage.go b/arbos/storage/storage.go index 8b8877caf1..be4cd435be 100644 --- a/arbos/storage/storage.go +++ b/arbos/storage/storage.go @@ -18,6 +18,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/arbos/util" "github.com/offchainlabs/nitro/util/arbmath" @@ -73,16 +75,17 @@ func NewGeth(statedb vm.StateDB, burner burn.Burner) *Storage { } } -// NewMemoryBacked uses Geth's memory-backed database to create an evm key-value store +// NewMemoryBacked uses Geth's memory-backed database to create an evm key-value store. +// Only used for testing. func NewMemoryBacked(burner burn.Burner) *Storage { return NewGeth(NewMemoryBackedStateDB(), burner) } // NewMemoryBackedStateDB uses Geth's memory-backed database to create a statedb +// Only used for testing. func NewMemoryBackedStateDB() vm.StateDB { raw := rawdb.NewMemoryDatabase() - // TODO pathdb - db := state.NewDatabase(raw) + db := state.NewDatabaseWithConfig(raw, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}) statedb, err := state.New(common.Hash{}, db, nil) if err != nil { panic("failed to init empty statedb") From 2d0e08c9c2bac0b9b32e5dc901119cf6b6c2a7d8 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 17 May 2024 11:21:32 -0300 Subject: [PATCH 101/140] StateHistory caching option --- cmd/staterecovery/staterecovery.go | 8 +++++++- execution/gethexec/blockchain.go | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/staterecovery/staterecovery.go b/cmd/staterecovery/staterecovery.go index 716989aa41..f7dc87971d 100644 --- a/cmd/staterecovery/staterecovery.go +++ b/cmd/staterecovery/staterecovery.go @@ -37,7 +37,13 @@ func RecreateMissingStates(chainDb ethdb.Database, bc *core.BlockChain, cacheCon Preimages: false, } if cacheConfig.StateScheme == rawdb.PathScheme { - trieConfig.PathDB = pathdb.Defaults + // TODO: RecreateMissingStates should only be used for archive nodes, + // check if it is worth keeping this option here + trieConfig.PathDB = &pathdb.Config{ + StateHistory: cacheConfig.StateHistory, + CleanCacheSize: cacheConfig.TrieCleanLimit * 1024 * 1024, + DirtyCacheSize: cacheConfig.TrieDirtyLimit * 1024 * 1024, + } } else { hashConfig := *hashdb.Defaults hashConfig.CleanCacheSize = cacheConfig.TrieCleanLimit * 1024 * 1024 diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index a25c636a40..7b550e9601 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -39,6 +39,7 @@ type CachingConfig struct { MaxAmountOfGasToSkipStateSaving uint64 `koanf:"max-amount-of-gas-to-skip-state-saving"` StylusLRUCache uint32 `koanf:"stylus-lru-cache"` StateScheme string `koanf:"state-scheme"` + StateHistory uint64 `koanf:"state-history"` } func CachingConfigAddOptions(prefix string, f *flag.FlagSet) { @@ -55,6 +56,7 @@ func CachingConfigAddOptions(prefix string, f *flag.FlagSet) { f.Uint64(prefix+".max-amount-of-gas-to-skip-state-saving", DefaultCachingConfig.MaxAmountOfGasToSkipStateSaving, "maximum amount of gas in blocks to skip saving state to Persistent storage (archive node only) -- warning: this option seems to cause issues") f.Uint32(prefix+".stylus-lru-cache", DefaultCachingConfig.StylusLRUCache, "initialized stylus programs to keep in LRU cache") f.String(prefix+".state-scheme", DefaultCachingConfig.StateScheme, "scheme to use for state trie storage (hashdb, pathdb)") + f.Uint64(prefix+".state-history", DefaultCachingConfig.StateHistory, "number of recent blocks to retain state history for (pathdb state-scheme only)") } var DefaultCachingConfig = CachingConfig{ @@ -71,6 +73,7 @@ var DefaultCachingConfig = CachingConfig{ MaxAmountOfGasToSkipStateSaving: 0, StylusLRUCache: 256, StateScheme: rawdb.HashScheme, + StateHistory: 90000, } var TestCachingConfig = CachingConfig{ @@ -114,6 +117,7 @@ func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core MaxNumberOfBlocksToSkipStateSaving: cachingConfig.MaxNumberOfBlocksToSkipStateSaving, MaxAmountOfGasToSkipStateSaving: cachingConfig.MaxAmountOfGasToSkipStateSaving, StateScheme: cachingConfig.StateScheme, + StateHistory: cachingConfig.StateHistory, } } From ab10d4cb9d30992fbf9f6c8bb41f191ffaef9616 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 17 May 2024 16:36:55 -0300 Subject: [PATCH 102/140] define pathdb as the default state scheme to be used in tests --- arbnode/inbox_test.go | 3 ++- arbos/arbosState/initialization_test.go | 4 +++- execution/gethexec/blockchain.go | 6 ++++++ execution/gethexec/node.go | 2 ++ system_tests/block_validator_test.go | 3 +++ system_tests/debug_trace_test.go | 2 ++ system_tests/program_test.go | 2 ++ system_tests/pruning_test.go | 2 ++ system_tests/recreatestate_rpc_test.go | 9 +++++++++ system_tests/staterecovery_test.go | 2 ++ system_tests/triedb_race_test.go | 2 ++ 11 files changed, 35 insertions(+), 2 deletions(-) diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go index ef4acd038c..64879b7eb4 100644 --- a/arbnode/inbox_test.go +++ b/arbnode/inbox_test.go @@ -59,7 +59,8 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (* arbDb := rawdb.NewMemoryDatabase() initReader := statetransfer.NewMemoryInitDataReader(&initData) - bc, err := gethexec.WriteOrTestBlockChain(chainDb, nil, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefaultTest().TxLookupLimit, 0) + cacheConfig := core.DefaultCacheConfigWithScheme(rawdb.PathScheme) + bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefaultTest().TxLookupLimit, 0) if err != nil { Fail(t, err) diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index 0ef9cea4c5..c400d9e7a0 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -13,6 +13,8 @@ import ( "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/statetransfer" @@ -63,7 +65,7 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin stateroot, err := InitializeArbosInDatabase(raw, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) Require(t, err) - stateDb, err := state.New(stateroot, state.NewDatabase(raw), nil) + stateDb, err := state.New(stateroot, state.NewDatabaseWithConfig(raw, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}), nil) Require(t, err) arbState, err := OpenArbosState(stateDb, &burn.SystemBurner{}) diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 7b550e9601..fca86157b7 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -96,6 +96,12 @@ var ( InvalidStateSchemeForArchive = errors.New("Archive cannot be set when using PathScheme as the StateScheme") ) +func DefaultTestCachingConfig() CachingConfig { + c := DefaultCachingConfig + c.StateScheme = rawdb.PathScheme + return c +} + // TODO remove stack from parameters as it is no longer needed here func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core.CacheConfig { baseConf := ethconfig.Defaults diff --git a/execution/gethexec/node.go b/execution/gethexec/node.go index 2fb0684124..d52021745a 100644 --- a/execution/gethexec/node.go +++ b/execution/gethexec/node.go @@ -115,6 +115,7 @@ func ConfigDefaultNonSequencerTest() *Config { config.Sequencer.Enable = false config.Forwarder = DefaultTestForwarderConfig config.ForwardingTarget = "null" + config.Caching = DefaultTestCachingConfig() _ = config.Validate() @@ -127,6 +128,7 @@ func ConfigDefaultTest() *Config { config.Sequencer = TestSequencerConfig config.ParentChainReader = headerreader.TestConfig config.ForwardingTarget = "null" + config.Caching = DefaultTestCachingConfig() _ = config.Validate() diff --git a/system_tests/block_validator_test.go b/system_tests/block_validator_test.go index b4dafbff15..2915288f9e 100644 --- a/system_tests/block_validator_test.go +++ b/system_tests/block_validator_test.go @@ -16,6 +16,7 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" @@ -68,6 +69,8 @@ func testBlockValidatorSimple(t *testing.T, opts Options) { builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder = builder.WithWasmRootDir(opts.wasmRootDir) + // By now PathDB is not supported when using block validation + builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.nodeConfig = l1NodeConfigA builder.chainConfig = chainConfig builder.L2Info = nil diff --git a/system_tests/debug_trace_test.go b/system_tests/debug_trace_test.go index 1a83e5ad2f..0c080df686 100644 --- a/system_tests/debug_trace_test.go +++ b/system_tests/debug_trace_test.go @@ -13,6 +13,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" ) @@ -22,6 +23,7 @@ func TestDebugTraceCallForRecentBlock(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true + builder.execConfig.Caching.StateScheme = rawdb.HashScheme cleanup := builder.Build(t) defer cleanup() builder.L2Info.GenerateAccount("User2") diff --git a/system_tests/program_test.go b/system_tests/program_test.go index b748739cdc..5515888574 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -20,6 +20,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" @@ -1474,6 +1475,7 @@ func setupProgramTest(t *testing.T, jit bool, builderOpts ...func(*NodeBuilder)) opt(builder) } + builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.nodeConfig.BlockValidator.Enable = false builder.nodeConfig.Staker.Enable = true builder.nodeConfig.BatchPoster.Enable = true diff --git a/system_tests/pruning_test.go b/system_tests/pruning_test.go index 041781ac48..90ac3c6909 100644 --- a/system_tests/pruning_test.go +++ b/system_tests/pruning_test.go @@ -35,6 +35,8 @@ func TestPruning(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) + // PathScheme prunes the state trie by itself, so only HashScheme should be tested + builder.execConfig.Caching.StateScheme = rawdb.HashScheme _ = builder.Build(t) l2cleanupDone := false defer func() { diff --git a/system_tests/recreatestate_rpc_test.go b/system_tests/recreatestate_rpc_test.go index de123aee78..e23cb5c392 100644 --- a/system_tests/recreatestate_rpc_test.go +++ b/system_tests/recreatestate_rpc_test.go @@ -100,6 +100,7 @@ func TestRecreateStateForRPCNoDepthLimit(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + execConfig.Caching.StateScheme = rawdb.HashScheme execConfig.Caching.SnapshotCache = 0 // disable snapshots // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -136,6 +137,7 @@ func TestRecreateStateForRPCBigEnoughDepthLimit(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 0 @@ -171,6 +173,7 @@ func TestRecreateStateForRPCDepthLimitExceeded(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 0 @@ -206,6 +209,7 @@ func TestRecreateStateForRPCMissingBlockParent(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 0 @@ -252,6 +256,7 @@ func TestRecreateStateForRPCBeyondGenesis(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 0 @@ -288,6 +293,7 @@ func TestRecreateStateForRPCBlockNotFoundWhileRecreating(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -429,6 +435,7 @@ func testSkippingSavingStateAndRecreatingAfterRestart(t *testing.T, cacheConfig func TestSkippingSavingStateAndRecreatingAfterRestart(t *testing.T) { cacheConfig := gethexec.TestCachingConfig cacheConfig.Archive = true + cacheConfig.StateScheme = rawdb.HashScheme cacheConfig.SnapshotCache = 0 // disable snapshots cacheConfig.BlockAge = 0 // use only Caching.BlockCount to keep only last N blocks in dirties cache, no matter how new they are @@ -512,6 +519,7 @@ func TestGettingStateForRPCHybridArchiveNode(t *testing.T) { defer cancel() execConfig := gethexec.ConfigDefaultTest() execConfig.Caching.Archive = true + execConfig.Caching.StateScheme = rawdb.HashScheme execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 128 execConfig.Caching.BlockCount = 128 execConfig.Caching.SnapshotCache = 0 // disable snapshots @@ -558,6 +566,7 @@ func TestStateAndHeaderForRecentBlock(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true + builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.RPC.MaxRecreateStateDepth = 0 cleanup := builder.Build(t) defer cleanup() diff --git a/system_tests/staterecovery_test.go b/system_tests/staterecovery_test.go index 1dd4be2444..0e3e391b40 100644 --- a/system_tests/staterecovery_test.go +++ b/system_tests/staterecovery_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/trie" @@ -19,6 +20,7 @@ func TestRectreateMissingStates(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true + builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 16 builder.execConfig.Caching.SnapshotCache = 0 // disable snapshots _ = builder.Build(t) diff --git a/system_tests/triedb_race_test.go b/system_tests/triedb_race_test.go index 9f14f08898..d2ae9dd56b 100644 --- a/system_tests/triedb_race_test.go +++ b/system_tests/triedb_race_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/arbitrum" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rpc" "github.com/offchainlabs/nitro/util/testhelpers" @@ -23,6 +24,7 @@ func TestTrieDBCommitRace(t *testing.T) { builder.execConfig.Sequencer.MaxBlockSpeed = 0 builder.execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 builder.execConfig.Caching.Archive = true + builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.Caching.BlockCount = 127 builder.execConfig.Caching.BlockAge = 0 builder.execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 127 From e8956ed62f6cd6357713f44083a41b0dd6898f3e Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 20 May 2024 12:18:40 -0300 Subject: [PATCH 103/140] pathdb support in InitializeArbosInDatabase --- arbos/arbosState/initialization_test.go | 10 +++++---- arbos/arbosState/initialize.go | 27 ++++++++++++++++++++++--- execution/gethexec/blockchain.go | 6 +++--- system_tests/state_fuzz_test.go | 5 ++++- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index c400d9e7a0..ae9c826544 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -10,11 +10,10 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/statetransfer" @@ -62,10 +61,13 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin initReader := statetransfer.NewMemoryInitDataReader(&initData) chainConfig := params.ArbitrumDevTestChainConfig() - stateroot, err := InitializeArbosInDatabase(raw, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) + + cacheConfig := core.DefaultCacheConfigWithScheme(rawdb.PathScheme) + stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) Require(t, err) - stateDb, err := state.New(stateroot, state.NewDatabaseWithConfig(raw, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}), nil) + triedbConfig := TriedbConfig(cacheConfig) + stateDb, err := state.New(stateroot, state.NewDatabaseWithConfig(raw, triedbConfig), nil) Require(t, err) arbState, err := OpenArbosState(stateDb, &burn.SystemBurner{}) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 7c4bff3188..b8cdc69446 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -9,12 +9,15 @@ import ( "sort" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/trie/triedb/hashdb" "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/holiman/uint256" "github.com/offchainlabs/nitro/arbos/arbostypes" @@ -52,9 +55,27 @@ func MakeGenesisBlock(parentHash common.Hash, blockNumber uint64, timestamp uint return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)) } -func InitializeArbosInDatabase(db ethdb.Database, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (common.Hash, error) { - // TODO pathdb - stateDatabase := state.NewDatabaseWithConfig(db, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}) +func TriedbConfig(c *core.CacheConfig) *trie.Config { + config := &trie.Config{Preimages: c.Preimages} + if c.StateScheme == rawdb.HashScheme { + config.HashDB = &hashdb.Config{ + CleanCacheSize: c.TrieCleanLimit * 1024 * 1024, + } + } + if c.StateScheme == rawdb.PathScheme { + config.PathDB = &pathdb.Config{ + StateHistory: c.StateHistory, + CleanCacheSize: c.TrieCleanLimit * 1024 * 1024, + DirtyCacheSize: c.TrieDirtyLimit * 1024 * 1024, + } + } + return config +} + +func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (common.Hash, error) { + triedbConfig := TriedbConfig(cacheConfig) + triedbConfig.Preimages = false + stateDatabase := state.NewDatabaseWithConfig(db, triedbConfig) statedb, err := state.New(common.Hash{}, stateDatabase, nil) if err != nil { log.Crit("failed to init empty statedb", "error", err) diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index fca86157b7..29bc77e17c 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -144,7 +144,7 @@ func (c *CachingConfig) Validate() error { return c.validateStateScheme() } -func WriteOrTestGenblock(chainDb ethdb.Database, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, accountsPerSync uint) error { +func WriteOrTestGenblock(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, accountsPerSync uint) error { EmptyHash := common.Hash{} prevHash := EmptyHash prevDifficulty := big.NewInt(0) @@ -165,7 +165,7 @@ func WriteOrTestGenblock(chainDb ethdb.Database, initData statetransfer.InitData } timestamp = prevHeader.Time } - stateRoot, err := arbosState.InitializeArbosInDatabase(chainDb, initData, chainConfig, initMessage, timestamp, accountsPerSync) + stateRoot, err := arbosState.InitializeArbosInDatabase(chainDb, cacheConfig, initData, chainConfig, initMessage, timestamp, accountsPerSync) if err != nil { return err } @@ -233,7 +233,7 @@ func GetBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, chainC } func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, txLookupLimit uint64, accountsPerSync uint) (*core.BlockChain, error) { - err := WriteOrTestGenblock(chainDb, initData, chainConfig, initMessage, accountsPerSync) + err := WriteOrTestGenblock(chainDb, cacheConfig, initData, chainConfig, initMessage, accountsPerSync) if err != nil { return nil, err } diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go index bb78bda480..09ca6d265c 100644 --- a/system_tests/state_fuzz_test.go +++ b/system_tests/state_fuzz_test.go @@ -137,8 +137,10 @@ func FuzzStateTransition(f *testing.F) { ChainConfig: chainConfig, SerializedChainConfig: serializedChainConfig, } + cacheConfig := core.DefaultCacheConfigWithScheme(rawdb.PathScheme) stateRoot, err := arbosState.InitializeArbosInDatabase( chainDb, + cacheConfig, statetransfer.NewMemoryInitDataReader(&statetransfer.ArbosInitializationInfo{}), chainConfig, initMessage, @@ -148,7 +150,8 @@ func FuzzStateTransition(f *testing.F) { if err != nil { panic(err) } - statedb, err := state.New(stateRoot, state.NewDatabase(chainDb), nil) + trieDBConfig := arbosState.TriedbConfig(cacheConfig) + statedb, err := state.New(stateRoot, state.NewDatabaseWithConfig(chainDb, trieDBConfig), nil) if err != nil { panic(err) } From e8c1b302a2bc2ff79eeca982bf1ebed6c47948b2 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 20 May 2024 14:38:45 -0300 Subject: [PATCH 104/140] general improvements when testing state-scheme args --- cmd/nitro/config_test.go | 11 +++++++---- cmd/nitro/nitro.go | 2 +- execution/gethexec/blockchain.go | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/nitro/config_test.go b/cmd/nitro/config_test.go index 3861aa497e..af902fab0f 100644 --- a/cmd/nitro/config_test.go +++ b/cmd/nitro/config_test.go @@ -55,6 +55,8 @@ func TestUnsafeStakerConfig(t *testing.T) { Require(t, err) } +const validatorArgs = "--persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --node.staker.parent-chain-wallet.pathname /l1keystore --node.staker.parent-chain-wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null" + func TestValidatorConfig(t *testing.T) { args := strings.Split("--persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --node.staker.parent-chain-wallet.pathname /l1keystore --node.staker.parent-chain-wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null", " ") _, _, err := ParseNode(context.Background(), args) @@ -62,16 +64,17 @@ func TestValidatorConfig(t *testing.T) { } func TestInvalidCachingStateSchemeForValidator(t *testing.T) { - args := strings.Split("--execution.caching.state-scheme path --persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --parent-chain.wallet.pathname /l1keystore --parent-chain.wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null", " ") - _, _, _, err := ParseNode(context.Background(), args) + validatorArgsWithPathScheme := fmt.Sprintf("%s --execution.caching.state-scheme path", validatorArgs) + args := strings.Split(validatorArgsWithPathScheme, " ") + _, _, err := ParseNode(context.Background(), args) if !errors.Is(err, invalidCachingStateSchemeForValidator) { Fail(t, "failed to detect invalid state scheme for validator") } } func TestInvalidArchiveConfig(t *testing.T) { - args := strings.Split("--execution.caching.archive --execution.caching.state-scheme path --persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --parent-chain.wallet.pathname /l1keystore --parent-chain.wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null", " ") - _, _, _, err := ParseNode(context.Background(), args) + args := strings.Split("--execution.caching.archive --execution.caching.state-scheme path --persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --node.staker.parent-chain-wallet.pathname /l1keystore --node.staker.parent-chain-wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null", " ") + _, _, err := ParseNode(context.Background(), args) if !errors.Is(err, gethexec.InvalidStateSchemeForArchive) { Fail(t, "failed to detect invalid state scheme for archive") } diff --git a/cmd/nitro/nitro.go b/cmd/nitro/nitro.go index fd06e509dc..0b979d5624 100644 --- a/cmd/nitro/nitro.go +++ b/cmd/nitro/nitro.go @@ -819,7 +819,7 @@ func (c *NodeConfig) CanReload(new *NodeConfig) error { } var ( - invalidCachingStateSchemeForValidator = errors.New("PathScheme cannot be used as Caching.StateScheme when validator is required") + invalidCachingStateSchemeForValidator = errors.New("path cannot be used as execution.caching.state-scheme when validator is required") ) func (c *NodeConfig) Validate() error { diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 29bc77e17c..47436ab173 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -93,7 +93,7 @@ var TestCachingConfig = CachingConfig{ } var ( - InvalidStateSchemeForArchive = errors.New("Archive cannot be set when using PathScheme as the StateScheme") + InvalidStateSchemeForArchive = errors.New("archive cannot be set when using path as the state-scheme") ) func DefaultTestCachingConfig() CachingConfig { From 5364d3945db320227278d12662f7f809f25c7cd3 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 20 May 2024 14:59:14 -0300 Subject: [PATCH 105/140] recreate missing states fails if is executed with path scheme recreate missing states should be run in archive mode, and by now path scheme doesn't support archive mode --- cmd/staterecovery/staterecovery.go | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/cmd/staterecovery/staterecovery.go b/cmd/staterecovery/staterecovery.go index f7dc87971d..bb01477414 100644 --- a/cmd/staterecovery/staterecovery.go +++ b/cmd/staterecovery/staterecovery.go @@ -12,7 +12,6 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/triedb" "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" ) func RecreateMissingStates(chainDb ethdb.Database, bc *core.BlockChain, cacheConfig *core.CacheConfig, startBlock uint64) error { @@ -33,21 +32,15 @@ func RecreateMissingStates(chainDb ethdb.Database, bc *core.BlockChain, cacheCon return fmt.Errorf("start block parent is missing, parent block number: %d", current-1) } + if cacheConfig.StateScheme == rawdb.PathScheme { + return fmt.Errorf("recreating missing states, which is supposed to only run in archive mode, is not supported with path scheme") + } + + hashConfig := *hashdb.Defaults + hashConfig.CleanCacheSize = cacheConfig.TrieCleanLimit * 1024 * 1024 trieConfig := &triedb.Config{ Preimages: false, - } - if cacheConfig.StateScheme == rawdb.PathScheme { - // TODO: RecreateMissingStates should only be used for archive nodes, - // check if it is worth keeping this option here - trieConfig.PathDB = &pathdb.Config{ - StateHistory: cacheConfig.StateHistory, - CleanCacheSize: cacheConfig.TrieCleanLimit * 1024 * 1024, - DirtyCacheSize: cacheConfig.TrieDirtyLimit * 1024 * 1024, - } - } else { - hashConfig := *hashdb.Defaults - hashConfig.CleanCacheSize = cacheConfig.TrieCleanLimit * 1024 * 1024 - trieConfig.HashDB = &hashConfig + HashDB: &hashConfig, } database := state.NewDatabaseWithConfig(chainDb, trieConfig) From 1a15b72e0b5365a93a8ddad6f3dcb92c89b7d484 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 20 May 2024 15:14:32 -0300 Subject: [PATCH 106/140] add comment on why HashScheme is being used in setupProgramTest --- system_tests/program_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 5515888574..4b13b5fa15 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -1475,6 +1475,8 @@ func setupProgramTest(t *testing.T, jit bool, builderOpts ...func(*NodeBuilder)) opt(builder) } + // setupProgramTest is being called from tests that validate blocks. + // By now validation only works with HashScheme set. builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.nodeConfig.BlockValidator.Enable = false builder.nodeConfig.Staker.Enable = true From a2bf33157c872fd17cb61a2bf36558e86d13e2d3 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 20 May 2024 19:54:55 -0300 Subject: [PATCH 107/140] gracefully fails if provided state scheme is incompatible with stored trie --- cmd/nitro/init.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index ea48ec8784..c8b4011c54 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -423,6 +423,10 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo return nil, nil, err } chainDb := rawdb.WrapDatabaseWithWasm(chainData, wasmDb, 1) + _, err = rawdb.ParseStateScheme(cacheConfig.StateScheme, chainDb) + if err != nil { + return nil, nil, err + } err = pruning.PruneChainDb(ctx, chainDb, stack, &config.Init, cacheConfig, persistentConfig, l1Client, rollupAddrs, config.Node.ValidatorRequired()) if err != nil { return chainDb, nil, fmt.Errorf("error pruning: %w", err) @@ -533,6 +537,10 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo return nil, nil, err } chainDb := rawdb.WrapDatabaseWithWasm(chainData, wasmDb, 1) + _, err = rawdb.ParseStateScheme(cacheConfig.StateScheme, chainDb) + if err != nil { + return nil, nil, err + } // Rebuilding wasm store is not required when just starting out err = gethexec.WriteToKeyValueStore(wasmDb, gethexec.RebuildingPositionKey, gethexec.RebuildingDone) From 7c508685f704bab76c34e8293530b172e0908959 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Tue, 21 May 2024 15:11:20 -0300 Subject: [PATCH 108/140] fix challenger tests, some of them require hashdb by now --- system_tests/full_challenge_impl_test.go | 3 +++ system_tests/program_test.go | 2 +- system_tests/staker_test.go | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/system_tests/full_challenge_impl_test.go b/system_tests/full_challenge_impl_test.go index bf95c390ba..520886af2a 100644 --- a/system_tests/full_challenge_impl_test.go +++ b/system_tests/full_challenge_impl_test.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/log" @@ -262,6 +263,8 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall if useStubs { mockSpawn, valStack = createMockValidationNode(t, ctx, &builder.valnodeConfig.Arbitrator) } else { + // By now validation only works with HashScheme set + builder.execConfig.Caching.StateScheme = rawdb.HashScheme _, valStack = createTestValidationNode(t, ctx, builder.valnodeConfig) } configByValidationNode(conf, valStack) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 4b13b5fa15..53b771361c 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -1475,7 +1475,7 @@ func setupProgramTest(t *testing.T, jit bool, builderOpts ...func(*NodeBuilder)) opt(builder) } - // setupProgramTest is being called from tests that validate blocks. + // setupProgramTest is being called by tests that validate blocks. // By now validation only works with HashScheme set. builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.nodeConfig.BlockValidator.Enable = false diff --git a/system_tests/staker_test.go b/system_tests/staker_test.go index 52f16614f7..993f2d0612 100644 --- a/system_tests/staker_test.go +++ b/system_tests/staker_test.go @@ -76,6 +76,9 @@ func stakerTestImpl(t *testing.T, faultyStaker bool, honestStakerInactive bool) transferGas, ) + // By now validation only works with HashScheme set + builder.execConfig.Caching.StateScheme = rawdb.HashScheme + builder.nodeConfig.BatchPoster.MaxDelay = -1000 * time.Hour cleanupA := builder.Build(t) defer cleanupA() From d30e66ca5f98db1bd563dc036416773feab30d9a Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 23 May 2024 17:40:38 -0300 Subject: [PATCH 109/140] Closes stateDatabase.TrieDB() after finishing using it --- arbos/arbosState/initialize.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index b8cdc69446..d8b2af9d7d 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -72,10 +72,13 @@ func TriedbConfig(c *core.CacheConfig) *trie.Config { return config } -func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (common.Hash, error) { +func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (root common.Hash, err error) { triedbConfig := TriedbConfig(cacheConfig) triedbConfig.Preimages = false stateDatabase := state.NewDatabaseWithConfig(db, triedbConfig) + defer func() { + err = stateDatabase.TrieDB().Close() + }() statedb, err := state.New(common.Hash{}, stateDatabase, nil) if err != nil { log.Crit("failed to init empty statedb", "error", err) From 3426e473ceff4a8144ba4772ef1751d94ca70551 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 24 May 2024 09:42:57 -0300 Subject: [PATCH 110/140] Removes DefaultTestCachingConfig --- execution/gethexec/blockchain.go | 6 ------ execution/gethexec/node.go | 2 -- system_tests/staterecovery_test.go | 4 +++- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 47436ab173..60740af039 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -96,12 +96,6 @@ var ( InvalidStateSchemeForArchive = errors.New("archive cannot be set when using path as the state-scheme") ) -func DefaultTestCachingConfig() CachingConfig { - c := DefaultCachingConfig - c.StateScheme = rawdb.PathScheme - return c -} - // TODO remove stack from parameters as it is no longer needed here func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core.CacheConfig { baseConf := ethconfig.Defaults diff --git a/execution/gethexec/node.go b/execution/gethexec/node.go index d52021745a..2fb0684124 100644 --- a/execution/gethexec/node.go +++ b/execution/gethexec/node.go @@ -115,7 +115,6 @@ func ConfigDefaultNonSequencerTest() *Config { config.Sequencer.Enable = false config.Forwarder = DefaultTestForwarderConfig config.ForwardingTarget = "null" - config.Caching = DefaultTestCachingConfig() _ = config.Validate() @@ -128,7 +127,6 @@ func ConfigDefaultTest() *Config { config.Sequencer = TestSequencerConfig config.ParentChainReader = headerreader.TestConfig config.ForwardingTarget = "null" - config.Caching = DefaultTestCachingConfig() _ = config.Validate() diff --git a/system_tests/staterecovery_test.go b/system_tests/staterecovery_test.go index 0e3e391b40..60445c2f29 100644 --- a/system_tests/staterecovery_test.go +++ b/system_tests/staterecovery_test.go @@ -55,7 +55,9 @@ func TestRectreateMissingStates(t *testing.T) { chainDb, err := stack.OpenDatabaseWithExtraOptions("l2chaindata", 0, 0, "l2chaindata/", false, conf.PersistentConfigDefault.Pebble.ExtraOptions("l2chaindata")) Require(t, err) defer chainDb.Close() - cacheConfig := gethexec.DefaultCacheConfigFor(stack, &gethexec.TestCachingConfig) + cachingConfig := gethexec.TestCachingConfig + cachingConfig.StateScheme = rawdb.HashScheme + cacheConfig := gethexec.DefaultCacheConfigFor(stack, &cachingConfig) bc, err := gethexec.GetBlockChain(chainDb, cacheConfig, builder.chainConfig, builder.execConfig.TxLookupLimit) Require(t, err) err = staterecovery.RecreateMissingStates(chainDb, bc, cacheConfig, 1) From 74775729566fd9b77d0cf4e5e166c6c37c54c2c1 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 24 May 2024 14:54:59 -0300 Subject: [PATCH 111/140] Only calls TrieDB.Commit once for PathScheme in InitializeArbosInDatabase --- arbos/arbosState/initialize.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index d8b2af9d7d..8b46c19fde 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -84,14 +84,21 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, log.Crit("failed to init empty statedb", "error", err) } + // commit avoids keeping the entire state in memory while importing the state. + // At some time it was also used to avoid reprocessing the whole import in case of a crash. commit := func() (common.Hash, error) { root, err := statedb.Commit(chainConfig.ArbitrumChainParams.GenesisBlockNum, true) if err != nil { return common.Hash{}, err } - err = stateDatabase.TrieDB().Commit(root, true) - if err != nil { - return common.Hash{}, err + // When using PathScheme TrieDB.Commit should only be called once. + // When using HashScheme it is called multiple times to avoid keeping + // the entire trie in memory. + if cacheConfig.StateScheme == rawdb.HashScheme { + err = stateDatabase.TrieDB().Commit(root, true) + if err != nil { + return common.Hash{}, err + } } statedb, err = state.New(root, stateDatabase, nil) if err != nil { @@ -189,7 +196,18 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, if err := accountDataReader.Close(); err != nil { return common.Hash{}, err } - return commit() + + root, err = commit() + if err != nil { + return common.Hash{}, err + } + if cacheConfig.StateScheme == rawdb.PathScheme { + err = stateDatabase.TrieDB().Commit(root, true) + if err != nil { + return common.Hash{}, err + } + } + return root, nil } func initializeRetryables(statedb *state.StateDB, rs *retryables.RetryableState, initData statetransfer.RetryableDataReader, currentTimestamp uint64) error { From 924fbefe47a93ee1e1975133d83b4da68514a7d8 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 24 May 2024 20:40:12 -0300 Subject: [PATCH 112/140] Test for openInitializeChainDb --- cmd/nitro/init_test.go | 78 +++++++++++++++++++++++++++++++-- system_tests/common_test.go | 29 +++--------- system_tests/das_test.go | 3 +- system_tests/program_test.go | 2 +- util/testhelpers/stackconfig.go | 23 ++++++++++ 5 files changed, 107 insertions(+), 28 deletions(-) create mode 100644 util/testhelpers/stackconfig.go diff --git a/cmd/nitro/init_test.go b/cmd/nitro/init_test.go index 6c363972e9..add13feee1 100644 --- a/cmd/nitro/init_test.go +++ b/cmd/nitro/init_test.go @@ -1,6 +1,3 @@ -// Copyright 2021-2022, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE - package main import ( @@ -10,6 +7,7 @@ import ( "encoding/hex" "errors" "fmt" + "math/big" "net" "net/http" "os" @@ -19,8 +17,13 @@ import ( "testing" "time" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/node" + "github.com/offchainlabs/nitro/arbnode" + "github.com/offchainlabs/nitro/cmd/chaininfo" "github.com/offchainlabs/nitro/cmd/conf" + "github.com/offchainlabs/nitro/execution/gethexec" "github.com/offchainlabs/nitro/util/testhelpers" ) @@ -361,3 +364,72 @@ func TestEmptyDatabaseDir(t *testing.T) { }) } } + +func TestOpenInitializeChainDbIncompatibleStateScheme(t *testing.T) { + t.Parallel() + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + stackConfig := testhelpers.CreateStackConfigForTest(t.TempDir()) + stack, err := node.New(stackConfig) + defer stack.Close() + Require(t, err) + + nodeConfig := NodeConfigDefault + nodeConfig.Execution.Caching.StateScheme = rawdb.PathScheme + nodeConfig.Chain.ID = 42161 + nodeConfig.Node = *arbnode.ConfigDefaultL2Test() + nodeConfig.Init.DevInit = true + nodeConfig.Init.DevInitAddress = "0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E" + + l1Client := ethclient.NewClient(stack.Attach()) + + // opening for the first time doesn't error + chainDb, blockchain, err := openInitializeChainDb( + ctx, + stack, + &nodeConfig, + new(big.Int).SetUint64(nodeConfig.Chain.ID), + gethexec.DefaultCacheConfigFor(stack, &nodeConfig.Execution.Caching), + &nodeConfig.Persistent, + l1Client, + chaininfo.RollupAddresses{}, + ) + Require(t, err) + blockchain.Stop() + err = chainDb.Close() + Require(t, err) + + // opening for the second time doesn't error + chainDb, blockchain, err = openInitializeChainDb( + ctx, + stack, + &nodeConfig, + new(big.Int).SetUint64(nodeConfig.Chain.ID), + gethexec.DefaultCacheConfigFor(stack, &nodeConfig.Execution.Caching), + &nodeConfig.Persistent, + l1Client, + chaininfo.RollupAddresses{}, + ) + Require(t, err) + blockchain.Stop() + err = chainDb.Close() + Require(t, err) + + // opening with a different state scheme errors + nodeConfig.Execution.Caching.StateScheme = rawdb.HashScheme + _, _, err = openInitializeChainDb( + ctx, + stack, + &nodeConfig, + new(big.Int).SetUint64(nodeConfig.Chain.ID), + gethexec.DefaultCacheConfigFor(stack, &nodeConfig.Execution.Caching), + &nodeConfig.Persistent, + l1Client, + chaininfo.RollupAddresses{}, + ) + if !strings.Contains(err.Error(), "incompatible state scheme, stored: path, provided: hash") { + t.Fatalf("Failed to detect incompatible state scheme") + } +} diff --git a/system_tests/common_test.go b/system_tests/common_test.go index b0748f8639..191a33cb22 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -19,6 +19,7 @@ import ( "time" "github.com/go-redis/redis/v8" + "github.com/offchainlabs/nitro/arbos" "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/util" "github.com/offchainlabs/nitro/arbstate/daprovider" @@ -66,7 +67,6 @@ import ( "github.com/ethereum/go-ethereum/rpc" "github.com/offchainlabs/nitro/arbnode" - "github.com/offchainlabs/nitro/arbos" "github.com/offchainlabs/nitro/arbutil" _ "github.com/offchainlabs/nitro/execution/nodeInterface" "github.com/offchainlabs/nitro/solgen/go/bridgegen" @@ -194,8 +194,8 @@ func (b *NodeBuilder) DefaultConfig(t *testing.T, withL1 bool) *NodeBuilder { b.L1Info = NewL1TestInfo(t) b.L2Info = NewArbTestInfo(t, b.chainConfig.ChainID) b.dataDir = t.TempDir() - b.l1StackConfig = createStackConfigForTest(b.dataDir) - b.l2StackConfig = createStackConfigForTest(b.dataDir) + b.l1StackConfig = testhelpers.CreateStackConfigForTest(b.dataDir) + b.l2StackConfig = testhelpers.CreateStackConfigForTest(b.dataDir) cp := valnode.TestValidationConfig b.valnodeConfig = &cp b.execConfig = gethexec.ConfigDefaultTest() @@ -681,23 +681,6 @@ func (c *staticNodeConfigFetcher) Started() bool { return true } -func createStackConfigForTest(dataDir string) *node.Config { - stackConf := node.DefaultConfig - stackConf.DataDir = dataDir - stackConf.UseLightweightKDF = true - stackConf.WSPort = 0 - stackConf.WSModules = append(stackConf.WSModules, "eth", "debug") - stackConf.HTTPPort = 0 - stackConf.HTTPHost = "" - stackConf.HTTPModules = append(stackConf.HTTPModules, "eth", "debug") - stackConf.P2P.NoDiscovery = true - stackConf.P2P.NoDial = true - stackConf.P2P.ListenAddr = "" - stackConf.P2P.NAT = nil - stackConf.DBEngine = "leveldb" // TODO Try pebble again in future once iterator race condition issues are fixed - return &stackConf -} - func createRedisGroup(ctx context.Context, t *testing.T, streamName string, client redis.UniversalClient) { t.Helper() // Stream name and group name are the same. @@ -809,7 +792,7 @@ func createTestL1BlockChain(t *testing.T, l1info info) (info, *ethclient.Client, if l1info == nil { l1info = NewL1TestInfo(t) } - stackConfig := createStackConfigForTest(t.TempDir()) + stackConfig := testhelpers.CreateStackConfigForTest(t.TempDir()) l1info.GenerateAccount("Faucet") chainConfig := params.ArbitrumDevTestChainConfig() @@ -944,7 +927,7 @@ func createL2BlockChainWithStackConfig( var stack *node.Node var err error if stackConfig == nil { - stackConfig = createStackConfigForTest(dataDir) + stackConfig = testhelpers.CreateStackConfigForTest(dataDir) } stack, err = node.New(stackConfig) Require(t, err) @@ -1032,7 +1015,7 @@ func Create2ndNodeWithConfig( l1client := ethclient.NewClient(l1rpcClient) if stackConfig == nil { - stackConfig = createStackConfigForTest(t.TempDir()) + stackConfig = testhelpers.CreateStackConfigForTest(t.TempDir()) } l2stack, err := node.New(stackConfig) Require(t, err) diff --git a/system_tests/das_test.go b/system_tests/das_test.go index 76ec2d7493..3dfe38b7af 100644 --- a/system_tests/das_test.go +++ b/system_tests/das_test.go @@ -29,6 +29,7 @@ import ( "github.com/offchainlabs/nitro/solgen/go/bridgegen" "github.com/offchainlabs/nitro/solgen/go/precompilesgen" "github.com/offchainlabs/nitro/util/headerreader" + "github.com/offchainlabs/nitro/util/testhelpers" "golang.org/x/exp/slog" ) @@ -153,7 +154,7 @@ func TestDASRekey(t *testing.T) { // Restart the node on the new keyset against the new DAS server running on the same disk as the first with new keys builder.nodeConfig.DataAvailability.RPCAggregator = aggConfigForBackend(t, backendConfigB) - builder.l2StackConfig = createStackConfigForTest(builder.dataDir) + builder.l2StackConfig = testhelpers.CreateStackConfigForTest(builder.dataDir) cleanup := builder.BuildL2OnL1(t) defer cleanup() diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 53b771361c..389426d2e1 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -1683,7 +1683,7 @@ func testWasmRecreate(t *testing.T, builder *NodeBuilder, storeTx *types.Transac Require(t, err) testDir := t.TempDir() - nodeBStack := createStackConfigForTest(testDir) + nodeBStack := testhelpers.CreateStackConfigForTest(testDir) nodeB, cleanupB := builder.Build2ndNode(t, &SecondNodeParams{stackConfig: nodeBStack}) _, err = EnsureTxSucceeded(ctx, nodeB.Client, storeTx) diff --git a/util/testhelpers/stackconfig.go b/util/testhelpers/stackconfig.go new file mode 100644 index 0000000000..a15e6f94a9 --- /dev/null +++ b/util/testhelpers/stackconfig.go @@ -0,0 +1,23 @@ +// Copyright 2021-2024, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE + +package testhelpers + +import "github.com/ethereum/go-ethereum/node" + +func CreateStackConfigForTest(dataDir string) *node.Config { + stackConf := node.DefaultConfig + stackConf.DataDir = dataDir + stackConf.UseLightweightKDF = true + stackConf.WSPort = 0 + stackConf.WSModules = append(stackConf.WSModules, "eth", "debug") + stackConf.HTTPPort = 0 + stackConf.HTTPHost = "" + stackConf.HTTPModules = append(stackConf.HTTPModules, "eth", "debug") + stackConf.P2P.NoDiscovery = true + stackConf.P2P.NoDial = true + stackConf.P2P.ListenAddr = "" + stackConf.P2P.NAT = nil + stackConf.DBEngine = "leveldb" // TODO Try pebble again in future once iterator race condition issues are fixed + return &stackConf +} From b1a695255dbb1ede65f12f8eda69c703245402dd Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 27 May 2024 15:54:07 -0300 Subject: [PATCH 113/140] fix state-scheme flag usage --- execution/gethexec/blockchain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 60740af039..0053d7f4eb 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -55,8 +55,8 @@ func CachingConfigAddOptions(prefix string, f *flag.FlagSet) { f.Uint32(prefix+".max-number-of-blocks-to-skip-state-saving", DefaultCachingConfig.MaxNumberOfBlocksToSkipStateSaving, "maximum number of blocks to skip state saving to persistent storage (archive node only) -- warning: this option seems to cause issues") f.Uint64(prefix+".max-amount-of-gas-to-skip-state-saving", DefaultCachingConfig.MaxAmountOfGasToSkipStateSaving, "maximum amount of gas in blocks to skip saving state to Persistent storage (archive node only) -- warning: this option seems to cause issues") f.Uint32(prefix+".stylus-lru-cache", DefaultCachingConfig.StylusLRUCache, "initialized stylus programs to keep in LRU cache") - f.String(prefix+".state-scheme", DefaultCachingConfig.StateScheme, "scheme to use for state trie storage (hashdb, pathdb)") - f.Uint64(prefix+".state-history", DefaultCachingConfig.StateHistory, "number of recent blocks to retain state history for (pathdb state-scheme only)") + f.String(prefix+".state-scheme", DefaultCachingConfig.StateScheme, "scheme to use for state trie storage (hash, path)") + f.Uint64(prefix+".state-history", DefaultCachingConfig.StateHistory, "number of recent blocks to retain state history for (path state-scheme only)") } var DefaultCachingConfig = CachingConfig{ From 588d99373137b140bd7965c31cf9b418eae2b39c Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 17 Jun 2024 09:48:13 -0300 Subject: [PATCH 114/140] Fix tests. --- system_tests/program_test.go | 2 +- system_tests/snap_sync_test.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 389426d2e1..f5aa83b814 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -1820,7 +1820,7 @@ func TestWasmStoreRebuilding(t *testing.T) { Require(t, err) testDir := t.TempDir() - nodeBStack := createStackConfigForTest(testDir) + nodeBStack := testhelpers.CreateStackConfigForTest(testDir) nodeB, cleanupB := builder.Build2ndNode(t, &SecondNodeParams{stackConfig: nodeBStack}) _, err = EnsureTxSucceeded(ctx, nodeB.Client, storeTx) diff --git a/system_tests/snap_sync_test.go b/system_tests/snap_sync_test.go index 31d5ea8492..e0bba4b37c 100644 --- a/system_tests/snap_sync_test.go +++ b/system_tests/snap_sync_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/params" @@ -17,6 +18,7 @@ import ( "github.com/offchainlabs/nitro/arbnode" "github.com/offchainlabs/nitro/arbos/l2pricing" "github.com/offchainlabs/nitro/util" + "github.com/offchainlabs/nitro/util/testhelpers" ) func TestSnapSync(t *testing.T) { @@ -27,6 +29,9 @@ func TestSnapSync(t *testing.T) { // 1st node with sequencer, stays up all the time. builder := NewNodeBuilder(ctx).DefaultConfig(t, true) + // TODO: check why snap sync is not working with path scheme. + // At least nodeB and nodeC should be able to use path scheme. + builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.L2Info = NewBlockChainTestInfo( t, types.NewArbitrumSigner(types.NewLondonSigner(builder.chainConfig.ChainID)), big.NewInt(l2pricing.InitialBaseFeeWei*2), @@ -38,7 +43,7 @@ func TestSnapSync(t *testing.T) { // 2nd node without sequencer, syncs up to the first node. // This node will be stopped in middle and arbitrumdata will be deleted. testDir := t.TempDir() - nodeBStack := createStackConfigForTest(testDir) + nodeBStack := testhelpers.CreateStackConfigForTest(testDir) nodeBConfig := builder.nodeConfig nodeBConfig.BatchPoster.Enable = false nodeBParams := &SecondNodeParams{ From cbf365626fbb71ef286cf94f9727fd6b4eec5dbc Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 13 Jun 2024 11:30:18 -0300 Subject: [PATCH 115/140] use pebble instead of leveldb in CreateStackConfigForTest --- util/testhelpers/stackconfig.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/testhelpers/stackconfig.go b/util/testhelpers/stackconfig.go index a15e6f94a9..a3c794ff28 100644 --- a/util/testhelpers/stackconfig.go +++ b/util/testhelpers/stackconfig.go @@ -18,6 +18,6 @@ func CreateStackConfigForTest(dataDir string) *node.Config { stackConf.P2P.NoDial = true stackConf.P2P.ListenAddr = "" stackConf.P2P.NAT = nil - stackConf.DBEngine = "leveldb" // TODO Try pebble again in future once iterator race condition issues are fixed + stackConf.DBEngine = "pebble" return &stackConf } From 54fc0561cc3a365f5e72be64400fd0bac234a3ad Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 14 Jun 2024 12:30:40 -0300 Subject: [PATCH 116/140] Gets state scheme to use in tests through an env var --- arbnode/inbox_test.go | 2 +- arbos/arbosState/initialization_test.go | 2 +- execution/gethexec/blockchain.go | 3 ++- system_tests/state_fuzz_test.go | 3 ++- util/testhelpers/statescheme.go | 23 +++++++++++++++++++++++ 5 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 util/testhelpers/statescheme.go diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go index 64879b7eb4..63f960e37a 100644 --- a/arbnode/inbox_test.go +++ b/arbnode/inbox_test.go @@ -59,7 +59,7 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (* arbDb := rawdb.NewMemoryDatabase() initReader := statetransfer.NewMemoryInitDataReader(&initData) - cacheConfig := core.DefaultCacheConfigWithScheme(rawdb.PathScheme) + cacheConfig := core.DefaultCacheConfigWithScheme(testhelpers.GetTestStateScheme()) bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefaultTest().TxLookupLimit, 0) if err != nil { diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index ae9c826544..3d12a2c2c3 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -62,7 +62,7 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin initReader := statetransfer.NewMemoryInitDataReader(&initData) chainConfig := params.ArbitrumDevTestChainConfig() - cacheConfig := core.DefaultCacheConfigWithScheme(rawdb.PathScheme) + cacheConfig := core.DefaultCacheConfigWithScheme(testhelpers.GetTestStateScheme()) stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) Require(t, err) diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 0053d7f4eb..d599b12743 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -23,6 +23,7 @@ import ( "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/gethhook" "github.com/offchainlabs/nitro/statetransfer" + "github.com/offchainlabs/nitro/util/testhelpers" ) type CachingConfig struct { @@ -89,7 +90,7 @@ var TestCachingConfig = CachingConfig{ MaxNumberOfBlocksToSkipStateSaving: 0, MaxAmountOfGasToSkipStateSaving: 0, StylusLRUCache: 0, - StateScheme: rawdb.PathScheme, + StateScheme: testhelpers.GetTestStateScheme(), } var ( diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go index 09ca6d265c..39c3f01b9f 100644 --- a/system_tests/state_fuzz_test.go +++ b/system_tests/state_fuzz_test.go @@ -28,6 +28,7 @@ import ( "github.com/offchainlabs/nitro/arbstate" "github.com/offchainlabs/nitro/arbstate/daprovider" "github.com/offchainlabs/nitro/statetransfer" + "github.com/offchainlabs/nitro/util/testhelpers" ) func BuildBlock( @@ -137,7 +138,7 @@ func FuzzStateTransition(f *testing.F) { ChainConfig: chainConfig, SerializedChainConfig: serializedChainConfig, } - cacheConfig := core.DefaultCacheConfigWithScheme(rawdb.PathScheme) + cacheConfig := core.DefaultCacheConfigWithScheme(testhelpers.GetTestStateScheme()) stateRoot, err := arbosState.InitializeArbosInDatabase( chainDb, cacheConfig, diff --git a/util/testhelpers/statescheme.go b/util/testhelpers/statescheme.go new file mode 100644 index 0000000000..96394b1db2 --- /dev/null +++ b/util/testhelpers/statescheme.go @@ -0,0 +1,23 @@ +// Copyright 2021-2024, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE + +package testhelpers + +import ( + "os" + + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/log" +) + +// There are two CI steps, one to run tests using the path state scheme, and one to run tests using the hash state scheme. +// An environment controls that behavior. +func GetTestStateScheme() string { + envTestStateScheme := os.Getenv("TEST_STATE_SCHEME") + stateScheme := rawdb.PathScheme + if envTestStateScheme == rawdb.PathScheme || envTestStateScheme == rawdb.HashScheme { + stateScheme = envTestStateScheme + } + log.Debug("test state scheme", "testStateScheme", stateScheme) + return stateScheme +} From 6832aca93c212adc49df63c84427b41f970c1f75 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 14 Jun 2024 14:52:42 -0300 Subject: [PATCH 117/140] Runs tests with hash and path states scheme in github ci --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe26b1044b..450d9ab313 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,8 +141,10 @@ jobs: echo "GOMEMLIMIT=6GiB" >> "$GITHUB_ENV" echo "GOGC=80" >> "$GITHUB_ENV" - - name: run tests without race detection + - name: run tests without race detection and path state scheme if: matrix.test-mode == 'defaults' + env: + TEST_STATE_SCHEME: path run: | packages=`go list ./...` for package in $packages; do @@ -152,6 +154,14 @@ jobs: fi done + - name: run tests without race detection and hash state scheme + if: matrix.test-mode == 'defaults' + env: + TEST_STATE_SCHEME: hash + run: | + packages=`go list ./...` + stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -timeout 20m -parallel=8 + - name: run tests with race detection if: matrix.test-mode == 'race' run: | @@ -214,4 +224,3 @@ jobs: files: ./coverage.txt,./coverage-redis.txt verbose: false token: ${{ secrets.CODECOV_TOKEN }} - From cfb5947e107cb2e77fd0883079aeada503da1762 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 14 Jun 2024 18:45:47 -0300 Subject: [PATCH 118/140] Default Caching.StateHistory based on DefaultSequencerConfig.MaxBlockSpeed --- execution/gethexec/blockchain.go | 6 +++++- execution/gethexec/blockchain_test.go | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 execution/gethexec/blockchain_test.go diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index d599b12743..f4479dd131 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -60,6 +60,10 @@ func CachingConfigAddOptions(prefix string, f *flag.FlagSet) { f.Uint64(prefix+".state-history", DefaultCachingConfig.StateHistory, "number of recent blocks to retain state history for (path state-scheme only)") } +func getStateHistory(maxBlockSpeed time.Duration) uint64 { + return uint64(24 * time.Hour / maxBlockSpeed) +} + var DefaultCachingConfig = CachingConfig{ Archive: false, BlockCount: 128, @@ -74,7 +78,7 @@ var DefaultCachingConfig = CachingConfig{ MaxAmountOfGasToSkipStateSaving: 0, StylusLRUCache: 256, StateScheme: rawdb.HashScheme, - StateHistory: 90000, + StateHistory: getStateHistory(DefaultSequencerConfig.MaxBlockSpeed), } var TestCachingConfig = CachingConfig{ diff --git a/execution/gethexec/blockchain_test.go b/execution/gethexec/blockchain_test.go new file mode 100644 index 0000000000..375488cedc --- /dev/null +++ b/execution/gethexec/blockchain_test.go @@ -0,0 +1,18 @@ +// Copyright 2021-2024, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE + +package gethexec + +import ( + "testing" + "time" +) + +func TestGetStateHistory(t *testing.T) { + maxBlockSpeed := time.Millisecond * 250 + expectedStateHistory := uint64(345600) + actualStateHistory := getStateHistory(maxBlockSpeed) + if actualStateHistory != expectedStateHistory { + t.Errorf("Expected state history to be %d, but got %d", expectedStateHistory, actualStateHistory) + } +} From f6c9ca59611bf2a607282fb3cd52c18a0775df8c Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 14 Jun 2024 18:55:30 -0300 Subject: [PATCH 119/140] Adds copyright to init_test.go --- cmd/nitro/init_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/nitro/init_test.go b/cmd/nitro/init_test.go index add13feee1..0797ac9b46 100644 --- a/cmd/nitro/init_test.go +++ b/cmd/nitro/init_test.go @@ -1,3 +1,6 @@ +// Copyright 2021-2024, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE + package main import ( From 3b1cd936b9cb43e523d606c82a989dd2d8d2a847 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 14 Jun 2024 19:17:03 -0300 Subject: [PATCH 120/140] Adds comments regarding why using HashScheme for Archive tests --- system_tests/debug_trace_test.go | 1 + system_tests/recreatestate_rpc_test.go | 9 +++++++++ system_tests/staterecovery_test.go | 2 ++ system_tests/triedb_race_test.go | 1 + 4 files changed, 13 insertions(+) diff --git a/system_tests/debug_trace_test.go b/system_tests/debug_trace_test.go index 0c080df686..fffef1522b 100644 --- a/system_tests/debug_trace_test.go +++ b/system_tests/debug_trace_test.go @@ -23,6 +23,7 @@ func TestDebugTraceCallForRecentBlock(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true + // By now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme cleanup := builder.Build(t) defer cleanup() diff --git a/system_tests/recreatestate_rpc_test.go b/system_tests/recreatestate_rpc_test.go index e23cb5c392..0bcfd4c21e 100644 --- a/system_tests/recreatestate_rpc_test.go +++ b/system_tests/recreatestate_rpc_test.go @@ -100,6 +100,7 @@ func TestRecreateStateForRPCNoDepthLimit(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + // By now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme execConfig.Caching.SnapshotCache = 0 // disable snapshots // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there @@ -137,6 +138,7 @@ func TestRecreateStateForRPCBigEnoughDepthLimit(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + // By now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -173,6 +175,7 @@ func TestRecreateStateForRPCDepthLimitExceeded(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + // By now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -209,6 +212,7 @@ func TestRecreateStateForRPCMissingBlockParent(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + // By now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -256,6 +260,7 @@ func TestRecreateStateForRPCBeyondGenesis(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + // By now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -293,6 +298,7 @@ func TestRecreateStateForRPCBlockNotFoundWhileRecreating(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true + // By now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -435,6 +441,7 @@ func testSkippingSavingStateAndRecreatingAfterRestart(t *testing.T, cacheConfig func TestSkippingSavingStateAndRecreatingAfterRestart(t *testing.T) { cacheConfig := gethexec.TestCachingConfig cacheConfig.Archive = true + // By now Archive node should use HashScheme cacheConfig.StateScheme = rawdb.HashScheme cacheConfig.SnapshotCache = 0 // disable snapshots cacheConfig.BlockAge = 0 // use only Caching.BlockCount to keep only last N blocks in dirties cache, no matter how new they are @@ -519,6 +526,7 @@ func TestGettingStateForRPCHybridArchiveNode(t *testing.T) { defer cancel() execConfig := gethexec.ConfigDefaultTest() execConfig.Caching.Archive = true + // By now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 128 execConfig.Caching.BlockCount = 128 @@ -566,6 +574,7 @@ func TestStateAndHeaderForRecentBlock(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true + // By now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.RPC.MaxRecreateStateDepth = 0 cleanup := builder.Build(t) diff --git a/system_tests/staterecovery_test.go b/system_tests/staterecovery_test.go index 60445c2f29..0b3efe6f73 100644 --- a/system_tests/staterecovery_test.go +++ b/system_tests/staterecovery_test.go @@ -20,6 +20,7 @@ func TestRectreateMissingStates(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true + // By now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 16 builder.execConfig.Caching.SnapshotCache = 0 // disable snapshots @@ -56,6 +57,7 @@ func TestRectreateMissingStates(t *testing.T) { Require(t, err) defer chainDb.Close() cachingConfig := gethexec.TestCachingConfig + // By now Archive node should use HashScheme cachingConfig.StateScheme = rawdb.HashScheme cacheConfig := gethexec.DefaultCacheConfigFor(stack, &cachingConfig) bc, err := gethexec.GetBlockChain(chainDb, cacheConfig, builder.chainConfig, builder.execConfig.TxLookupLimit) diff --git a/system_tests/triedb_race_test.go b/system_tests/triedb_race_test.go index d2ae9dd56b..606dfc901d 100644 --- a/system_tests/triedb_race_test.go +++ b/system_tests/triedb_race_test.go @@ -24,6 +24,7 @@ func TestTrieDBCommitRace(t *testing.T) { builder.execConfig.Sequencer.MaxBlockSpeed = 0 builder.execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 builder.execConfig.Caching.Archive = true + // By now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.Caching.BlockCount = 127 builder.execConfig.Caching.BlockAge = 0 From d9d3ffcab47a85d6a5a407e13c581872c1ddf8d8 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 14 Jun 2024 19:22:58 -0300 Subject: [PATCH 121/140] Adds missing word in comment --- util/testhelpers/statescheme.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/testhelpers/statescheme.go b/util/testhelpers/statescheme.go index 96394b1db2..31e1c1070d 100644 --- a/util/testhelpers/statescheme.go +++ b/util/testhelpers/statescheme.go @@ -11,7 +11,7 @@ import ( ) // There are two CI steps, one to run tests using the path state scheme, and one to run tests using the hash state scheme. -// An environment controls that behavior. +// An environment variable controls that behavior. func GetTestStateScheme() string { envTestStateScheme := os.Getenv("TEST_STATE_SCHEME") stateScheme := rawdb.PathScheme From 39e313dc5badbbb0e11f2e9b61992b6a6bfdb0c4 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 17 Jun 2024 11:13:24 -0300 Subject: [PATCH 122/140] Uses env var to define trie in NewMemoryBackedStateDB and NewArbosMemoryBackedArbOSState --- arbnode/inbox_test.go | 3 ++- arbos/arbosState/arbosstate.go | 8 +++++++- arbos/arbosState/initialization_test.go | 3 ++- arbos/storage/storage.go | 8 +++++++- execution/gethexec/blockchain.go | 4 ++-- system_tests/state_fuzz_test.go | 4 ++-- util/{testhelpers/statescheme.go => env/env.go} | 2 +- 7 files changed, 23 insertions(+), 9 deletions(-) rename util/{testhelpers/statescheme.go => env/env.go} (97%) diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go index 63f960e37a..88120a9b37 100644 --- a/arbnode/inbox_test.go +++ b/arbnode/inbox_test.go @@ -18,6 +18,7 @@ import ( "github.com/offchainlabs/nitro/statetransfer" "github.com/offchainlabs/nitro/util/arbmath" + "github.com/offchainlabs/nitro/util/env" "github.com/offchainlabs/nitro/util/testhelpers" "github.com/ethereum/go-ethereum/common" @@ -59,7 +60,7 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (* arbDb := rawdb.NewMemoryDatabase() initReader := statetransfer.NewMemoryInitDataReader(&initData) - cacheConfig := core.DefaultCacheConfigWithScheme(testhelpers.GetTestStateScheme()) + cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefaultTest().TxLookupLimit, 0) if err != nil { diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index aa775b6d07..e1b21871e5 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -16,6 +16,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/trie/triedb/hashdb" "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/offchainlabs/nitro/arbcompress" @@ -31,6 +32,7 @@ import ( "github.com/offchainlabs/nitro/arbos/retryables" "github.com/offchainlabs/nitro/arbos/storage" "github.com/offchainlabs/nitro/arbos/util" + "github.com/offchainlabs/nitro/util/env" ) // ArbosState contains ArbOS-related state. It is backed by ArbOS's storage in the persistent stateDB. @@ -117,7 +119,11 @@ func OpenSystemArbosStateOrPanic(stateDB vm.StateDB, tracingInfo *util.TracingIn // NewArbosMemoryBackedArbOSState creates and initializes a memory-backed ArbOS state (for testing only) func NewArbosMemoryBackedArbOSState() (*ArbosState, *state.StateDB) { raw := rawdb.NewMemoryDatabase() - db := state.NewDatabaseWithConfig(raw, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}) + trieConfig := &trie.Config{Preimages: false, PathDB: pathdb.Defaults} + if env.GetTestStateScheme() == rawdb.HashScheme { + trieConfig = &trie.Config{Preimages: false, HashDB: hashdb.Defaults} + } + db := state.NewDatabaseWithConfig(raw, trieConfig) statedb, err := state.New(common.Hash{}, db, nil) if err != nil { log.Crit("failed to init empty statedb", "error", err) diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index 3d12a2c2c3..aed84799aa 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -17,6 +17,7 @@ import ( "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/statetransfer" + "github.com/offchainlabs/nitro/util/env" "github.com/offchainlabs/nitro/util/testhelpers" ) @@ -62,7 +63,7 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin initReader := statetransfer.NewMemoryInitDataReader(&initData) chainConfig := params.ArbitrumDevTestChainConfig() - cacheConfig := core.DefaultCacheConfigWithScheme(testhelpers.GetTestStateScheme()) + cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) Require(t, err) diff --git a/arbos/storage/storage.go b/arbos/storage/storage.go index be4cd435be..3ee4149914 100644 --- a/arbos/storage/storage.go +++ b/arbos/storage/storage.go @@ -19,10 +19,12 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" + "github.com/ethereum/go-ethereum/trie/triedb/hashdb" "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/arbos/util" "github.com/offchainlabs/nitro/util/arbmath" + "github.com/offchainlabs/nitro/util/env" ) // Storage allows ArbOS to store data persistently in the Ethereum-compatible stateDB. This is represented in @@ -85,7 +87,11 @@ func NewMemoryBacked(burner burn.Burner) *Storage { // Only used for testing. func NewMemoryBackedStateDB() vm.StateDB { raw := rawdb.NewMemoryDatabase() - db := state.NewDatabaseWithConfig(raw, &trie.Config{Preimages: false, PathDB: pathdb.Defaults}) + trieConfig := &trie.Config{Preimages: false, PathDB: pathdb.Defaults} + if env.GetTestStateScheme() == rawdb.HashScheme { + trieConfig = &trie.Config{Preimages: false, HashDB: hashdb.Defaults} + } + db := state.NewDatabaseWithConfig(raw, trieConfig) statedb, err := state.New(common.Hash{}, db, nil) if err != nil { panic("failed to init empty statedb") diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index f4479dd131..e43d8bf477 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -23,7 +23,7 @@ import ( "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/gethhook" "github.com/offchainlabs/nitro/statetransfer" - "github.com/offchainlabs/nitro/util/testhelpers" + "github.com/offchainlabs/nitro/util/env" ) type CachingConfig struct { @@ -94,7 +94,7 @@ var TestCachingConfig = CachingConfig{ MaxNumberOfBlocksToSkipStateSaving: 0, MaxAmountOfGasToSkipStateSaving: 0, StylusLRUCache: 0, - StateScheme: testhelpers.GetTestStateScheme(), + StateScheme: env.GetTestStateScheme(), } var ( diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go index 39c3f01b9f..5c63eb858a 100644 --- a/system_tests/state_fuzz_test.go +++ b/system_tests/state_fuzz_test.go @@ -28,7 +28,7 @@ import ( "github.com/offchainlabs/nitro/arbstate" "github.com/offchainlabs/nitro/arbstate/daprovider" "github.com/offchainlabs/nitro/statetransfer" - "github.com/offchainlabs/nitro/util/testhelpers" + "github.com/offchainlabs/nitro/util/env" ) func BuildBlock( @@ -138,7 +138,7 @@ func FuzzStateTransition(f *testing.F) { ChainConfig: chainConfig, SerializedChainConfig: serializedChainConfig, } - cacheConfig := core.DefaultCacheConfigWithScheme(testhelpers.GetTestStateScheme()) + cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) stateRoot, err := arbosState.InitializeArbosInDatabase( chainDb, cacheConfig, diff --git a/util/testhelpers/statescheme.go b/util/env/env.go similarity index 97% rename from util/testhelpers/statescheme.go rename to util/env/env.go index 31e1c1070d..d20b1770c8 100644 --- a/util/testhelpers/statescheme.go +++ b/util/env/env.go @@ -1,7 +1,7 @@ // Copyright 2021-2024, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE -package testhelpers +package env import ( "os" From 6cfde26ed2bd6b6d0ca57bf821655bf0452c2ef6 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 8 Jul 2024 12:36:02 -0300 Subject: [PATCH 123/140] Do not create new error variables --- cmd/nitro/config_test.go | 6 ++---- cmd/nitro/nitro.go | 6 +----- execution/gethexec/blockchain.go | 6 +----- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/cmd/nitro/config_test.go b/cmd/nitro/config_test.go index af902fab0f..33feac887b 100644 --- a/cmd/nitro/config_test.go +++ b/cmd/nitro/config_test.go @@ -17,10 +17,8 @@ import ( "github.com/offchainlabs/nitro/cmd/genericconf" "github.com/offchainlabs/nitro/cmd/util/confighelpers" "github.com/offchainlabs/nitro/das" - "github.com/offchainlabs/nitro/execution/gethexec" "github.com/offchainlabs/nitro/util/colors" "github.com/offchainlabs/nitro/util/testhelpers" - "github.com/pkg/errors" "github.com/r3labs/diff/v3" flag "github.com/spf13/pflag" @@ -67,7 +65,7 @@ func TestInvalidCachingStateSchemeForValidator(t *testing.T) { validatorArgsWithPathScheme := fmt.Sprintf("%s --execution.caching.state-scheme path", validatorArgs) args := strings.Split(validatorArgsWithPathScheme, " ") _, _, err := ParseNode(context.Background(), args) - if !errors.Is(err, invalidCachingStateSchemeForValidator) { + if !strings.Contains(err.Error(), "path cannot be used as execution.caching.state-scheme when validator is required") { Fail(t, "failed to detect invalid state scheme for validator") } } @@ -75,7 +73,7 @@ func TestInvalidCachingStateSchemeForValidator(t *testing.T) { func TestInvalidArchiveConfig(t *testing.T) { args := strings.Split("--execution.caching.archive --execution.caching.state-scheme path --persistent.chain /tmp/data --init.dev-init --node.parent-chain-reader.enable=false --parent-chain.id 5 --chain.id 421613 --node.staker.parent-chain-wallet.pathname /l1keystore --node.staker.parent-chain-wallet.password passphrase --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --node.staker.enable --node.staker.strategy MakeNodes --node.staker.staker-interval 10s --execution.forwarding-target null", " ") _, _, err := ParseNode(context.Background(), args) - if !errors.Is(err, gethexec.InvalidStateSchemeForArchive) { + if !strings.Contains(err.Error(), "archive cannot be set when using path as the state-scheme") { Fail(t, "failed to detect invalid state scheme for archive") } } diff --git a/cmd/nitro/nitro.go b/cmd/nitro/nitro.go index 0b979d5624..9861bb673e 100644 --- a/cmd/nitro/nitro.go +++ b/cmd/nitro/nitro.go @@ -818,10 +818,6 @@ func (c *NodeConfig) CanReload(new *NodeConfig) error { return err } -var ( - invalidCachingStateSchemeForValidator = errors.New("path cannot be used as execution.caching.state-scheme when validator is required") -) - func (c *NodeConfig) Validate() error { if c.Init.RecreateMissingStateFrom > 0 && !c.Execution.Caching.Archive { return errors.New("recreate-missing-state-from enabled for a non-archive node") @@ -842,7 +838,7 @@ func (c *NodeConfig) Validate() error { return err } if c.Node.ValidatorRequired() && (c.Execution.Caching.StateScheme == rawdb.PathScheme) { - return invalidCachingStateSchemeForValidator + return errors.New("path cannot be used as execution.caching.state-scheme when validator is required") } return c.Persistent.Validate() } diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index e43d8bf477..1b2cbdc332 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -97,10 +97,6 @@ var TestCachingConfig = CachingConfig{ StateScheme: env.GetTestStateScheme(), } -var ( - InvalidStateSchemeForArchive = errors.New("archive cannot be set when using path as the state-scheme") -) - // TODO remove stack from parameters as it is no longer needed here func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core.CacheConfig { baseConf := ethconfig.Defaults @@ -131,7 +127,7 @@ func (c *CachingConfig) validateStateScheme() error { case rawdb.HashScheme: case rawdb.PathScheme: if c.Archive { - return InvalidStateSchemeForArchive + return errors.New("archive cannot be set when using path as the state-scheme") } default: return errors.New("Invalid StateScheme") From ffda7a715d5c624dd658d5cb250fb416651fec0c Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 8 Jul 2024 12:38:39 -0300 Subject: [PATCH 124/140] Runs race tests with hash and path schemes --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 450d9ab313..9b60fcc206 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,8 +162,10 @@ jobs: packages=`go list ./...` stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -timeout 20m -parallel=8 - - name: run tests with race detection + - name: run tests with race detection and path state scheme if: matrix.test-mode == 'race' + env: + TEST_STATE_SCHEME: path run: | packages=`go list ./...` for package in $packages; do @@ -173,6 +175,14 @@ jobs: fi done + - name: run tests with race detection and hash state scheme + if: matrix.test-mode == 'race' + env: + TEST_STATE_SCHEME: hash + run: | + packages=`go list ./...` + stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -race -timeout 30m -parallel=8 + - name: run redis tests if: matrix.test-mode == 'defaults' run: TEST_REDIS=redis://localhost:6379/0 gotestsum --format short-verbose -- -p 1 -run TestRedis ./arbnode/... ./system_tests/... -coverprofile=coverage-redis.txt -covermode=atomic -coverpkg=./... From 875d815d3814fe8ec3d5552cd4f974154237a8cb Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 11 Jul 2024 23:07:45 -0300 Subject: [PATCH 125/140] Removes unncessary path logic when initializing arbos in database --- arbos/arbosState/initialize.go | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 8b46c19fde..1893308055 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -91,14 +91,9 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, if err != nil { return common.Hash{}, err } - // When using PathScheme TrieDB.Commit should only be called once. - // When using HashScheme it is called multiple times to avoid keeping - // the entire trie in memory. - if cacheConfig.StateScheme == rawdb.HashScheme { - err = stateDatabase.TrieDB().Commit(root, true) - if err != nil { - return common.Hash{}, err - } + err = stateDatabase.TrieDB().Commit(root, true) + if err != nil { + return common.Hash{}, err } statedb, err = state.New(root, stateDatabase, nil) if err != nil { @@ -196,18 +191,7 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, if err := accountDataReader.Close(); err != nil { return common.Hash{}, err } - - root, err = commit() - if err != nil { - return common.Hash{}, err - } - if cacheConfig.StateScheme == rawdb.PathScheme { - err = stateDatabase.TrieDB().Commit(root, true) - if err != nil { - return common.Hash{}, err - } - } - return root, nil + return commit() } func initializeRetryables(statedb *state.StateDB, rs *retryables.RetryableState, initData statetransfer.RetryableDataReader, currentTimestamp uint64) error { From e3a0460a792a4208e1ef82f8d919b572e182b6e6 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 18 Jul 2024 16:17:40 -0300 Subject: [PATCH 126/140] By now -> For now --- system_tests/block_validator_test.go | 2 +- system_tests/debug_trace_test.go | 2 +- system_tests/full_challenge_impl_test.go | 2 +- system_tests/program_test.go | 2 +- system_tests/recreatestate_rpc_test.go | 18 +++++++++--------- system_tests/seqfeed_test.go | 2 +- system_tests/staker_test.go | 2 +- system_tests/staterecovery_test.go | 4 ++-- system_tests/triedb_race_test.go | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/system_tests/block_validator_test.go b/system_tests/block_validator_test.go index 2915288f9e..6b4e6d2088 100644 --- a/system_tests/block_validator_test.go +++ b/system_tests/block_validator_test.go @@ -69,7 +69,7 @@ func testBlockValidatorSimple(t *testing.T, opts Options) { builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder = builder.WithWasmRootDir(opts.wasmRootDir) - // By now PathDB is not supported when using block validation + // For now PathDB is not supported when using block validation builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.nodeConfig = l1NodeConfigA builder.chainConfig = chainConfig diff --git a/system_tests/debug_trace_test.go b/system_tests/debug_trace_test.go index fffef1522b..13d9ed834b 100644 --- a/system_tests/debug_trace_test.go +++ b/system_tests/debug_trace_test.go @@ -23,7 +23,7 @@ func TestDebugTraceCallForRecentBlock(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme cleanup := builder.Build(t) defer cleanup() diff --git a/system_tests/full_challenge_impl_test.go b/system_tests/full_challenge_impl_test.go index 520886af2a..ddc229074c 100644 --- a/system_tests/full_challenge_impl_test.go +++ b/system_tests/full_challenge_impl_test.go @@ -263,7 +263,7 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall if useStubs { mockSpawn, valStack = createMockValidationNode(t, ctx, &builder.valnodeConfig.Arbitrator) } else { - // By now validation only works with HashScheme set + // For now validation only works with HashScheme set builder.execConfig.Caching.StateScheme = rawdb.HashScheme _, valStack = createTestValidationNode(t, ctx, builder.valnodeConfig) } diff --git a/system_tests/program_test.go b/system_tests/program_test.go index f5aa83b814..20bc873adc 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -1476,7 +1476,7 @@ func setupProgramTest(t *testing.T, jit bool, builderOpts ...func(*NodeBuilder)) } // setupProgramTest is being called by tests that validate blocks. - // By now validation only works with HashScheme set. + // For now validation only works with HashScheme set. builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.nodeConfig.BlockValidator.Enable = false builder.nodeConfig.Staker.Enable = true diff --git a/system_tests/recreatestate_rpc_test.go b/system_tests/recreatestate_rpc_test.go index 0bcfd4c21e..0debc42143 100644 --- a/system_tests/recreatestate_rpc_test.go +++ b/system_tests/recreatestate_rpc_test.go @@ -100,7 +100,7 @@ func TestRecreateStateForRPCNoDepthLimit(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme execConfig.Caching.SnapshotCache = 0 // disable snapshots // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there @@ -138,7 +138,7 @@ func TestRecreateStateForRPCBigEnoughDepthLimit(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -175,7 +175,7 @@ func TestRecreateStateForRPCDepthLimitExceeded(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -212,7 +212,7 @@ func TestRecreateStateForRPCMissingBlockParent(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -260,7 +260,7 @@ func TestRecreateStateForRPCBeyondGenesis(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -298,7 +298,7 @@ func TestRecreateStateForRPCBlockNotFoundWhileRecreating(t *testing.T) { execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme // disable trie/Database.cleans cache, so as states removed from ChainDb won't be cached there execConfig.Caching.TrieCleanCache = 0 @@ -441,7 +441,7 @@ func testSkippingSavingStateAndRecreatingAfterRestart(t *testing.T, cacheConfig func TestSkippingSavingStateAndRecreatingAfterRestart(t *testing.T) { cacheConfig := gethexec.TestCachingConfig cacheConfig.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme cacheConfig.StateScheme = rawdb.HashScheme cacheConfig.SnapshotCache = 0 // disable snapshots cacheConfig.BlockAge = 0 // use only Caching.BlockCount to keep only last N blocks in dirties cache, no matter how new they are @@ -526,7 +526,7 @@ func TestGettingStateForRPCHybridArchiveNode(t *testing.T) { defer cancel() execConfig := gethexec.ConfigDefaultTest() execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 128 execConfig.Caching.BlockCount = 128 @@ -574,7 +574,7 @@ func TestStateAndHeaderForRecentBlock(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.RPC.MaxRecreateStateDepth = 0 cleanup := builder.Build(t) diff --git a/system_tests/seqfeed_test.go b/system_tests/seqfeed_test.go index e3a98b4961..9637c7d4fc 100644 --- a/system_tests/seqfeed_test.go +++ b/system_tests/seqfeed_test.go @@ -333,7 +333,7 @@ func testBlockHashComparison(t *testing.T, blockHash *common.Hash, mustMismatch } wsBroadcastServer.Broadcast(&broadcastMessage) - // By now, even though block hash mismatch, the transaction should still be processed + // For now, even though block hash mismatch, the transaction should still be processed _, err = WaitForTx(ctx, testClient.Client, tx.Hash(), time.Second*15) if err != nil { t.Fatal("error waiting for tx:", err) diff --git a/system_tests/staker_test.go b/system_tests/staker_test.go index 993f2d0612..f57b68ad8a 100644 --- a/system_tests/staker_test.go +++ b/system_tests/staker_test.go @@ -76,7 +76,7 @@ func stakerTestImpl(t *testing.T, faultyStaker bool, honestStakerInactive bool) transferGas, ) - // By now validation only works with HashScheme set + // For now validation only works with HashScheme set builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.nodeConfig.BatchPoster.MaxDelay = -1000 * time.Hour diff --git a/system_tests/staterecovery_test.go b/system_tests/staterecovery_test.go index 0b3efe6f73..986c8eeda7 100644 --- a/system_tests/staterecovery_test.go +++ b/system_tests/staterecovery_test.go @@ -20,7 +20,7 @@ func TestRectreateMissingStates(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) builder.execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.Caching.MaxNumberOfBlocksToSkipStateSaving = 16 builder.execConfig.Caching.SnapshotCache = 0 // disable snapshots @@ -57,7 +57,7 @@ func TestRectreateMissingStates(t *testing.T) { Require(t, err) defer chainDb.Close() cachingConfig := gethexec.TestCachingConfig - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme cachingConfig.StateScheme = rawdb.HashScheme cacheConfig := gethexec.DefaultCacheConfigFor(stack, &cachingConfig) bc, err := gethexec.GetBlockChain(chainDb, cacheConfig, builder.chainConfig, builder.execConfig.TxLookupLimit) diff --git a/system_tests/triedb_race_test.go b/system_tests/triedb_race_test.go index 606dfc901d..609a4c0b60 100644 --- a/system_tests/triedb_race_test.go +++ b/system_tests/triedb_race_test.go @@ -24,7 +24,7 @@ func TestTrieDBCommitRace(t *testing.T) { builder.execConfig.Sequencer.MaxBlockSpeed = 0 builder.execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 builder.execConfig.Caching.Archive = true - // By now Archive node should use HashScheme + // For now Archive node should use HashScheme builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.execConfig.Caching.BlockCount = 127 builder.execConfig.Caching.BlockAge = 0 From 82c5ec71a02d0d267a08bb9e996b88abb7e715fa Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 18 Jul 2024 18:04:15 -0300 Subject: [PATCH 127/140] Moves GetTestStateScheme to util/testhelpers/env --- arbnode/inbox_test.go | 2 +- arbos/arbosState/arbosstate.go | 2 +- arbos/arbosState/initialization_test.go | 2 +- arbos/storage/storage.go | 2 +- execution/gethexec/blockchain.go | 2 +- system_tests/state_fuzz_test.go | 2 +- util/{ => testhelpers}/env/env.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename util/{ => testhelpers}/env/env.go (94%) diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go index 88120a9b37..54b783cf9d 100644 --- a/arbnode/inbox_test.go +++ b/arbnode/inbox_test.go @@ -18,8 +18,8 @@ import ( "github.com/offchainlabs/nitro/statetransfer" "github.com/offchainlabs/nitro/util/arbmath" - "github.com/offchainlabs/nitro/util/env" "github.com/offchainlabs/nitro/util/testhelpers" + "github.com/offchainlabs/nitro/util/testhelpers/env" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index e1b21871e5..357fe265b5 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -32,7 +32,7 @@ import ( "github.com/offchainlabs/nitro/arbos/retryables" "github.com/offchainlabs/nitro/arbos/storage" "github.com/offchainlabs/nitro/arbos/util" - "github.com/offchainlabs/nitro/util/env" + "github.com/offchainlabs/nitro/util/testhelpers/env" ) // ArbosState contains ArbOS-related state. It is backed by ArbOS's storage in the persistent stateDB. diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index aed84799aa..ffba4cf9b1 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -17,8 +17,8 @@ import ( "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/statetransfer" - "github.com/offchainlabs/nitro/util/env" "github.com/offchainlabs/nitro/util/testhelpers" + "github.com/offchainlabs/nitro/util/testhelpers/env" ) func TestJsonMarshalUnmarshal(t *testing.T) { diff --git a/arbos/storage/storage.go b/arbos/storage/storage.go index 3ee4149914..8d7fa09304 100644 --- a/arbos/storage/storage.go +++ b/arbos/storage/storage.go @@ -24,7 +24,7 @@ import ( "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/arbos/util" "github.com/offchainlabs/nitro/util/arbmath" - "github.com/offchainlabs/nitro/util/env" + "github.com/offchainlabs/nitro/util/testhelpers/env" ) // Storage allows ArbOS to store data persistently in the Ethereum-compatible stateDB. This is represented in diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 1b2cbdc332..adfe8ffb1c 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -23,7 +23,7 @@ import ( "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/gethhook" "github.com/offchainlabs/nitro/statetransfer" - "github.com/offchainlabs/nitro/util/env" + "github.com/offchainlabs/nitro/util/testhelpers/env" ) type CachingConfig struct { diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go index 5c63eb858a..5cff2108cf 100644 --- a/system_tests/state_fuzz_test.go +++ b/system_tests/state_fuzz_test.go @@ -28,7 +28,7 @@ import ( "github.com/offchainlabs/nitro/arbstate" "github.com/offchainlabs/nitro/arbstate/daprovider" "github.com/offchainlabs/nitro/statetransfer" - "github.com/offchainlabs/nitro/util/env" + "github.com/offchainlabs/nitro/util/testhelpers/env" ) func BuildBlock( diff --git a/util/env/env.go b/util/testhelpers/env/env.go similarity index 94% rename from util/env/env.go rename to util/testhelpers/env/env.go index d20b1770c8..27d74465de 100644 --- a/util/env/env.go +++ b/util/testhelpers/env/env.go @@ -1,4 +1,4 @@ -// Copyright 2021-2024, Offchain Labs, Inc. +// Copyright 2024, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE package env From 6256b5bb95324d6b85f107c4a1b6a92f5462e795 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 19 Jul 2024 16:12:48 -0300 Subject: [PATCH 128/140] Do not WriteOrTestGenBlock when blockchain is not empty and using path scheme. --- cmd/nitro/init.go | 4 ++++ execution/gethexec/blockchain.go | 8 ++++++++ system_tests/snap_sync_test.go | 2 -- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index c8b4011c54..a958572458 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -681,6 +681,10 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo log.Warn("Created fake init message as L1Reader is disabled and serialized chain config from init message is not available", "json", string(serializedChainConfig)) } + emptyBlockChain := rawdb.ReadHeadHeader(chainDb) == nil + if !emptyBlockChain && (cacheConfig.StateScheme == rawdb.PathScheme) && config.Init.Force { + return chainDb, nil, errors.New("It is not possible to force init with non-empty blockchain when using path scheme") + } l2BlockChain, err = gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initDataReader, chainConfig, parsedInitMessage, config.Execution.TxLookupLimit, config.Init.AccountsPerSync) if err != nil { return chainDb, nil, err diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index adfe8ffb1c..dfa044676b 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -228,6 +228,14 @@ func GetBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, chainC } func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, txLookupLimit uint64, accountsPerSync uint) (*core.BlockChain, error) { + emptyBlockChain := rawdb.ReadHeadHeader(chainDb) == nil + if !emptyBlockChain && (cacheConfig.StateScheme == rawdb.PathScheme) { + // When using path scheme, and the stored state trie is not empty, + // WriteOrTestGenBlock is not able to recover EmptyRootHash state trie node. + // In that case Nitro doesn't test genblock, but just returns the BlockChain. + return GetBlockChain(chainDb, cacheConfig, chainConfig, txLookupLimit) + } + err := WriteOrTestGenblock(chainDb, cacheConfig, initData, chainConfig, initMessage, accountsPerSync) if err != nil { return nil, err diff --git a/system_tests/snap_sync_test.go b/system_tests/snap_sync_test.go index e0bba4b37c..a04d9f5bf3 100644 --- a/system_tests/snap_sync_test.go +++ b/system_tests/snap_sync_test.go @@ -29,8 +29,6 @@ func TestSnapSync(t *testing.T) { // 1st node with sequencer, stays up all the time. builder := NewNodeBuilder(ctx).DefaultConfig(t, true) - // TODO: check why snap sync is not working with path scheme. - // At least nodeB and nodeC should be able to use path scheme. builder.execConfig.Caching.StateScheme = rawdb.HashScheme builder.L2Info = NewBlockChainTestInfo( t, From 3379ab6d0e49820435d76f1c209165f139ef2ae2 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 19 Jul 2024 19:38:34 -0300 Subject: [PATCH 129/140] Fixes TrieDB().Close() error handling in InitializeArbosInDatabase --- arbos/arbosState/initialize.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 1893308055..e2a4a3c5e0 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -77,7 +77,7 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, triedbConfig.Preimages = false stateDatabase := state.NewDatabaseWithConfig(db, triedbConfig) defer func() { - err = stateDatabase.TrieDB().Close() + err = errors.Join(err, stateDatabase.TrieDB().Close()) }() statedb, err := state.New(common.Hash{}, stateDatabase, nil) if err != nil { From 18575a75915b27ac4bbe8119223f3cce61f99380 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 19 Jul 2024 19:48:19 -0300 Subject: [PATCH 130/140] Fixex github defaults test for hash scheme --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b60fcc206..05c3f3cbd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,7 +160,7 @@ jobs: TEST_STATE_SCHEME: hash run: | packages=`go list ./...` - stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -timeout 20m -parallel=8 + stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -timeout 20m -parallel=8 -tags=cionly - name: run tests with race detection and path state scheme if: matrix.test-mode == 'race' From 24252954ce2c07bf33b7f6d0a5018ca65909d710 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 18 Jul 2024 19:30:29 -0300 Subject: [PATCH 131/140] Moves test configs from gethexec to system_tests --- arbnode/inbox_test.go | 2 +- execution/gethexec/blockchain.go | 17 ------ execution/gethexec/forwarder.go | 9 --- execution/gethexec/node.go | 25 -------- execution/gethexec/sequencer.go | 18 ------ system_tests/common_test.go | 79 ++++++++++++++++++++++++-- system_tests/forwarder_test.go | 9 ++- system_tests/recreatestate_rpc_test.go | 20 +++---- system_tests/retryable_test.go | 3 +- system_tests/staterecovery_test.go | 2 +- 10 files changed, 91 insertions(+), 93 deletions(-) diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go index 54b783cf9d..70392598d6 100644 --- a/arbnode/inbox_test.go +++ b/arbnode/inbox_test.go @@ -61,7 +61,7 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (* initReader := statetransfer.NewMemoryInitDataReader(&initData) cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) - bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefaultTest().TxLookupLimit, 0) + bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefault.TxLookupLimit, 0) if err != nil { Fail(t, err) diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index dfa044676b..996b87a9e6 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -23,7 +23,6 @@ import ( "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/gethhook" "github.com/offchainlabs/nitro/statetransfer" - "github.com/offchainlabs/nitro/util/testhelpers/env" ) type CachingConfig struct { @@ -81,22 +80,6 @@ var DefaultCachingConfig = CachingConfig{ StateHistory: getStateHistory(DefaultSequencerConfig.MaxBlockSpeed), } -var TestCachingConfig = CachingConfig{ - Archive: false, - BlockCount: 128, - BlockAge: 30 * time.Minute, - TrieTimeLimit: time.Hour, - TrieDirtyCache: 1024, - TrieCleanCache: 600, - SnapshotCache: 400, - DatabaseCache: 2048, - SnapshotRestoreGasLimit: 300_000_000_000, - MaxNumberOfBlocksToSkipStateSaving: 0, - MaxAmountOfGasToSkipStateSaving: 0, - StylusLRUCache: 0, - StateScheme: env.GetTestStateScheme(), -} - // TODO remove stack from parameters as it is no longer needed here func DefaultCacheConfigFor(stack *node.Node, cachingConfig *CachingConfig) *core.CacheConfig { baseConf := ethconfig.Defaults diff --git a/execution/gethexec/forwarder.go b/execution/gethexec/forwarder.go index 984c7224e8..cdb4f394e5 100644 --- a/execution/gethexec/forwarder.go +++ b/execution/gethexec/forwarder.go @@ -35,15 +35,6 @@ type ForwarderConfig struct { RetryInterval time.Duration `koanf:"retry-interval"` } -var DefaultTestForwarderConfig = ForwarderConfig{ - ConnectionTimeout: 2 * time.Second, - IdleConnectionTimeout: 2 * time.Second, - MaxIdleConnections: 1, - RedisUrl: "", - UpdateInterval: time.Millisecond * 10, - RetryInterval: time.Millisecond * 3, -} - var DefaultNodeForwarderConfig = ForwarderConfig{ ConnectionTimeout: 30 * time.Second, IdleConnectionTimeout: 15 * time.Second, diff --git a/execution/gethexec/node.go b/execution/gethexec/node.go index 2fb0684124..93f643b8a1 100644 --- a/execution/gethexec/node.go +++ b/execution/gethexec/node.go @@ -108,31 +108,6 @@ var ConfigDefault = Config{ EnablePrefetchBlock: true, } -func ConfigDefaultNonSequencerTest() *Config { - config := ConfigDefault - config.Caching = TestCachingConfig - config.ParentChainReader = headerreader.TestConfig - config.Sequencer.Enable = false - config.Forwarder = DefaultTestForwarderConfig - config.ForwardingTarget = "null" - - _ = config.Validate() - - return &config -} - -func ConfigDefaultTest() *Config { - config := ConfigDefault - config.Caching = TestCachingConfig - config.Sequencer = TestSequencerConfig - config.ParentChainReader = headerreader.TestConfig - config.ForwardingTarget = "null" - - _ = config.Validate() - - return &config -} - type ConfigFetcher func() *Config type ExecutionNode struct { diff --git a/execution/gethexec/sequencer.go b/execution/gethexec/sequencer.go index c5e97342d2..e620e6ccd1 100644 --- a/execution/gethexec/sequencer.go +++ b/execution/gethexec/sequencer.go @@ -132,24 +132,6 @@ var DefaultSequencerConfig = SequencerConfig{ EnableProfiling: false, } -var TestSequencerConfig = SequencerConfig{ - Enable: true, - MaxBlockSpeed: time.Millisecond * 10, - MaxRevertGasReject: params.TxGas + 10000, - MaxAcceptableTimestampDelta: time.Hour, - SenderWhitelist: "", - Forwarder: DefaultTestForwarderConfig, - QueueSize: 128, - QueueTimeout: time.Second * 5, - NonceCacheSize: 4, - MaxTxDataSize: 95000, - NonceFailureCacheSize: 1024, - NonceFailureCacheExpiry: time.Second, - ExpectedSurplusSoftThreshold: "default", - ExpectedSurplusHardThreshold: "default", - EnableProfiling: false, -} - func SequencerConfigAddOptions(prefix string, f *flag.FlagSet) { f.Bool(prefix+".enable", DefaultSequencerConfig.Enable, "act and post to l1 as sequencer") f.Duration(prefix+".max-block-speed", DefaultSequencerConfig.MaxBlockSpeed, "minimum delay between blocks (sets a maximum speed of block production)") diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 191a33cb22..1bc9043a26 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -75,6 +75,7 @@ import ( "github.com/offchainlabs/nitro/solgen/go/upgrade_executorgen" "github.com/offchainlabs/nitro/statetransfer" "github.com/offchainlabs/nitro/util/testhelpers" + "github.com/offchainlabs/nitro/util/testhelpers/env" "github.com/offchainlabs/nitro/util/testhelpers/github" "golang.org/x/exp/slog" ) @@ -151,6 +152,74 @@ func (tc *TestClient) EnsureTxSucceededWithTimeout(transaction *types.Transactio return EnsureTxSucceededWithTimeout(tc.ctx, tc.Client, transaction, timeout) } +var TestCachingConfig = gethexec.CachingConfig{ + Archive: false, + BlockCount: 128, + BlockAge: 30 * time.Minute, + TrieTimeLimit: time.Hour, + TrieDirtyCache: 1024, + TrieCleanCache: 600, + SnapshotCache: 400, + DatabaseCache: 2048, + SnapshotRestoreGasLimit: 300_000_000_000, + MaxNumberOfBlocksToSkipStateSaving: 0, + MaxAmountOfGasToSkipStateSaving: 0, + StylusLRUCache: 0, + StateScheme: env.GetTestStateScheme(), +} + +var DefaultTestForwarderConfig = gethexec.ForwarderConfig{ + ConnectionTimeout: 2 * time.Second, + IdleConnectionTimeout: 2 * time.Second, + MaxIdleConnections: 1, + RedisUrl: "", + UpdateInterval: time.Millisecond * 10, + RetryInterval: time.Millisecond * 3, +} + +var TestSequencerConfig = gethexec.SequencerConfig{ + Enable: true, + MaxBlockSpeed: time.Millisecond * 10, + MaxRevertGasReject: params.TxGas + 10000, + MaxAcceptableTimestampDelta: time.Hour, + SenderWhitelist: "", + Forwarder: DefaultTestForwarderConfig, + QueueSize: 128, + QueueTimeout: time.Second * 5, + NonceCacheSize: 4, + MaxTxDataSize: 95000, + NonceFailureCacheSize: 1024, + NonceFailureCacheExpiry: time.Second, + ExpectedSurplusSoftThreshold: "default", + ExpectedSurplusHardThreshold: "default", + EnableProfiling: false, +} + +func ExecConfigDefaultNonSequencerTest() *gethexec.Config { + config := gethexec.ConfigDefault + config.Caching = TestCachingConfig + config.ParentChainReader = headerreader.TestConfig + config.Sequencer.Enable = false + config.Forwarder = DefaultTestForwarderConfig + config.ForwardingTarget = "null" + + _ = config.Validate() + + return &config +} + +func ExecConfigDefaultTest() *gethexec.Config { + config := gethexec.ConfigDefault + config.Caching = TestCachingConfig + config.Sequencer = TestSequencerConfig + config.ParentChainReader = headerreader.TestConfig + config.ForwardingTarget = "null" + + _ = config.Validate() + + return &config +} + type NodeBuilder struct { // NodeBuilder configuration ctx context.Context @@ -198,7 +267,7 @@ func (b *NodeBuilder) DefaultConfig(t *testing.T, withL1 bool) *NodeBuilder { b.l2StackConfig = testhelpers.CreateStackConfigForTest(b.dataDir) cp := valnode.TestValidationConfig b.valnodeConfig = &cp - b.execConfig = gethexec.ConfigDefaultTest() + b.execConfig = ExecConfigDefaultTest() return b } @@ -231,7 +300,7 @@ func (b *NodeBuilder) CheckConfig(t *testing.T) { b.nodeConfig = arbnode.ConfigDefaultL1Test() } if b.execConfig == nil { - b.execConfig = gethexec.ConfigDefaultTest() + b.execConfig = ExecConfigDefaultTest() } if b.L1Info == nil { b.L1Info = NewL1TestInfo(t) @@ -955,7 +1024,7 @@ func createL2BlockChainWithStackConfig( if cacheConfig != nil { coreCacheConfig = gethexec.DefaultCacheConfigFor(stack, cacheConfig) } - blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, gethexec.ConfigDefaultTest().TxLookupLimit, 0) + blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest().TxLookupLimit, 0) Require(t, err) return l2info, stack, chainDb, arbDb, blockchain @@ -1008,7 +1077,7 @@ func Create2ndNodeWithConfig( nodeConfig = arbnode.ConfigDefaultL1NonSequencerTest() } if execConfig == nil { - execConfig = gethexec.ConfigDefaultNonSequencerTest() + execConfig = ExecConfigDefaultNonSequencerTest() } feedErrChan := make(chan error, 10) l1rpcClient := l1stack.Attach() @@ -1038,7 +1107,7 @@ func Create2ndNodeWithConfig( chainConfig := firstExec.ArbInterface.BlockChain().Config() coreCacheConfig := gethexec.DefaultCacheConfigFor(l2stack, &execConfig.Caching) - l2blockchain, err := gethexec.WriteOrTestBlockChain(l2chainDb, coreCacheConfig, initReader, chainConfig, initMessage, gethexec.ConfigDefaultTest().TxLookupLimit, 0) + l2blockchain, err := gethexec.WriteOrTestBlockChain(l2chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest().TxLookupLimit, 0) Require(t, err) AddDefaultValNode(t, ctx, nodeConfig, true, "", valnodeConfig.Wasm.RootPath) diff --git a/system_tests/forwarder_test.go b/system_tests/forwarder_test.go index d29e82c12c..2919377d6f 100644 --- a/system_tests/forwarder_test.go +++ b/system_tests/forwarder_test.go @@ -17,7 +17,6 @@ import ( "github.com/alicebob/miniredis/v2" "github.com/ethereum/go-ethereum/ethclient" "github.com/offchainlabs/nitro/arbnode" - "github.com/offchainlabs/nitro/execution/gethexec" "github.com/offchainlabs/nitro/util/redisutil" ) @@ -39,7 +38,7 @@ func TestStaticForwarder(t *testing.T) { clientA := builder.L2.Client nodeConfigB := arbnode.ConfigDefaultL1Test() - execConfigB := gethexec.ConfigDefaultTest() + execConfigB := ExecConfigDefaultTest() execConfigB.Sequencer.Enable = false nodeConfigB.Sequencer = false nodeConfigB.DelayedSequencer.Enable = false @@ -110,7 +109,7 @@ func createForwardingNode(t *testing.T, builder *NodeBuilder, ipcPath string, re nodeConfig.Sequencer = false nodeConfig.DelayedSequencer.Enable = false nodeConfig.BatchPoster.Enable = false - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.Sequencer.Enable = false execConfig.Forwarder.RedisUrl = redisUrl execConfig.ForwardingTarget = fallbackPath @@ -264,7 +263,7 @@ func TestRedisForwarder(t *testing.T) { tx := builder.L2Info.PrepareTx(userA, userB, builder.L2Info.TransferGas, transferAmount, nil) sendFunc := func() error { return forwardingClient.SendTransaction(ctx, tx) } - if err := tryWithTimeout(ctx, sendFunc, gethexec.DefaultTestForwarderConfig.UpdateInterval*10); err != nil { + if err := tryWithTimeout(ctx, sendFunc, DefaultTestForwarderConfig.UpdateInterval*10); err != nil { t.Fatalf("Client: %v, error sending transaction: %v", i, err) } _, err := EnsureTxSucceeded(ctx, seqClients[i], tx) @@ -309,7 +308,7 @@ func TestRedisForwarderFallbackNoRedis(t *testing.T) { builder.L2Info.GenerateAccount(user) tx := builder.L2Info.PrepareTx("Owner", "User2", builder.L2Info.TransferGas, transferAmount, nil) sendFunc := func() error { return forwardingClient.SendTransaction(ctx, tx) } - err := tryWithTimeout(ctx, sendFunc, gethexec.DefaultTestForwarderConfig.UpdateInterval*10) + err := tryWithTimeout(ctx, sendFunc, DefaultTestForwarderConfig.UpdateInterval*10) Require(t, err) _, err = builder.L2.EnsureTxSucceeded(tx) diff --git a/system_tests/recreatestate_rpc_test.go b/system_tests/recreatestate_rpc_test.go index 0debc42143..985ca09f19 100644 --- a/system_tests/recreatestate_rpc_test.go +++ b/system_tests/recreatestate_rpc_test.go @@ -95,7 +95,7 @@ func removeStatesFromDb(t *testing.T, bc *core.BlockChain, db ethdb.Database, fr func TestRecreateStateForRPCNoDepthLimit(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.RPC.MaxRecreateStateDepth = arbitrum.InfiniteMaxRecreateStateDepth execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 @@ -133,7 +133,7 @@ func TestRecreateStateForRPCBigEnoughDepthLimit(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() depthGasLimit := int64(256 * util.NormalizeL2GasForL1GasInitial(800_000, params.GWei)) - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.RPC.MaxRecreateStateDepth = depthGasLimit execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 @@ -170,7 +170,7 @@ func TestRecreateStateForRPCBigEnoughDepthLimit(t *testing.T) { func TestRecreateStateForRPCDepthLimitExceeded(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.RPC.MaxRecreateStateDepth = int64(200) execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 @@ -207,7 +207,7 @@ func TestRecreateStateForRPCMissingBlockParent(t *testing.T) { var headerCacheLimit uint64 = 512 ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.RPC.MaxRecreateStateDepth = arbitrum.InfiniteMaxRecreateStateDepth execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 @@ -255,7 +255,7 @@ func TestRecreateStateForRPCBeyondGenesis(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.RPC.MaxRecreateStateDepth = arbitrum.InfiniteMaxRecreateStateDepth execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 @@ -293,7 +293,7 @@ func TestRecreateStateForRPCBlockNotFoundWhileRecreating(t *testing.T) { var blockCacheLimit uint64 = 256 ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.RPC.MaxRecreateStateDepth = arbitrum.InfiniteMaxRecreateStateDepth execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 @@ -341,7 +341,7 @@ func testSkippingSavingStateAndRecreatingAfterRestart(t *testing.T, cacheConfig ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.RPC.MaxRecreateStateDepth = maxRecreateStateDepth execConfig.Sequencer.MaxBlockSpeed = 0 execConfig.Sequencer.MaxTxDataSize = 150 // 1 test tx ~= 110 @@ -439,7 +439,7 @@ func testSkippingSavingStateAndRecreatingAfterRestart(t *testing.T, cacheConfig } func TestSkippingSavingStateAndRecreatingAfterRestart(t *testing.T) { - cacheConfig := gethexec.TestCachingConfig + cacheConfig := TestCachingConfig cacheConfig.Archive = true // For now Archive node should use HashScheme cacheConfig.StateScheme = rawdb.HashScheme @@ -482,7 +482,7 @@ func TestSkippingSavingStateAndRecreatingAfterRestart(t *testing.T) { func TestGettingStateForRPCFullNode(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.Caching.SnapshotCache = 0 // disable snapshots execConfig.Caching.BlockAge = 0 // use only Caching.BlockCount to keep only last N blocks in dirties cache, no matter how new they are execConfig.Sequencer.MaxBlockSpeed = 0 @@ -524,7 +524,7 @@ func TestGettingStateForRPCFullNode(t *testing.T) { func TestGettingStateForRPCHybridArchiveNode(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - execConfig := gethexec.ConfigDefaultTest() + execConfig := ExecConfigDefaultTest() execConfig.Caching.Archive = true // For now Archive node should use HashScheme execConfig.Caching.StateScheme = rawdb.HashScheme diff --git a/system_tests/retryable_test.go b/system_tests/retryable_test.go index 268d59ac98..8f9507aea2 100644 --- a/system_tests/retryable_test.go +++ b/system_tests/retryable_test.go @@ -22,7 +22,6 @@ import ( "github.com/offchainlabs/nitro/arbos/l2pricing" "github.com/offchainlabs/nitro/arbos/retryables" "github.com/offchainlabs/nitro/arbos/util" - "github.com/offchainlabs/nitro/execution/gethexec" "github.com/offchainlabs/nitro/solgen/go/bridgegen" "github.com/offchainlabs/nitro/solgen/go/mocksgen" @@ -940,7 +939,7 @@ func elevateL2Basefee(t *testing.T, ctx context.Context, builder *NodeBuilder) { _, err = precompilesgen.NewArbosTest(common.HexToAddress("0x69"), builder.L2.Client) Require(t, err, "failed to deploy ArbosTest") - burnAmount := gethexec.ConfigDefaultTest().RPC.RPCGasCap + burnAmount := ExecConfigDefaultTest().RPC.RPCGasCap burnTarget := uint64(5 * l2pricing.InitialSpeedLimitPerSecondV6 * l2pricing.InitialBacklogTolerance) for i := uint64(0); i < (burnTarget+burnAmount)/burnAmount; i++ { burnArbGas := arbostestabi.Methods["burnArbGas"] diff --git a/system_tests/staterecovery_test.go b/system_tests/staterecovery_test.go index 986c8eeda7..42faee7e0d 100644 --- a/system_tests/staterecovery_test.go +++ b/system_tests/staterecovery_test.go @@ -56,7 +56,7 @@ func TestRectreateMissingStates(t *testing.T) { chainDb, err := stack.OpenDatabaseWithExtraOptions("l2chaindata", 0, 0, "l2chaindata/", false, conf.PersistentConfigDefault.Pebble.ExtraOptions("l2chaindata")) Require(t, err) defer chainDb.Close() - cachingConfig := gethexec.TestCachingConfig + cachingConfig := TestCachingConfig // For now Archive node should use HashScheme cachingConfig.StateScheme = rawdb.HashScheme cacheConfig := gethexec.DefaultCacheConfigFor(stack, &cachingConfig) From 5993bc8d0da7f7f066d61e8e06a2b2c9e54590cb Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Fri, 19 Jul 2024 22:04:35 -0300 Subject: [PATCH 132/140] Fixes triedb import from geth --- arbos/arbosState/arbosstate.go | 10 +++++----- arbos/arbosState/initialize.go | 9 +++++---- arbos/storage/storage.go | 10 +++++----- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index 357fe265b5..91c2207aae 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -15,9 +15,9 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/triedb/hashdb" - "github.com/ethereum/go-ethereum/trie/triedb/pathdb" + "github.com/ethereum/go-ethereum/triedb" + "github.com/ethereum/go-ethereum/triedb/hashdb" + "github.com/ethereum/go-ethereum/triedb/pathdb" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbos/addressSet" @@ -119,9 +119,9 @@ func OpenSystemArbosStateOrPanic(stateDB vm.StateDB, tracingInfo *util.TracingIn // NewArbosMemoryBackedArbOSState creates and initializes a memory-backed ArbOS state (for testing only) func NewArbosMemoryBackedArbOSState() (*ArbosState, *state.StateDB) { raw := rawdb.NewMemoryDatabase() - trieConfig := &trie.Config{Preimages: false, PathDB: pathdb.Defaults} + trieConfig := &triedb.Config{Preimages: false, PathDB: pathdb.Defaults} if env.GetTestStateScheme() == rawdb.HashScheme { - trieConfig = &trie.Config{Preimages: false, HashDB: hashdb.Defaults} + trieConfig = &triedb.Config{Preimages: false, HashDB: hashdb.Defaults} } db := state.NewDatabaseWithConfig(raw, trieConfig) statedb, err := state.New(common.Hash{}, db, nil) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index e2a4a3c5e0..d7b277970d 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -17,8 +17,9 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/triedb/hashdb" - "github.com/ethereum/go-ethereum/trie/triedb/pathdb" + "github.com/ethereum/go-ethereum/triedb" + "github.com/ethereum/go-ethereum/triedb/hashdb" + "github.com/ethereum/go-ethereum/triedb/pathdb" "github.com/holiman/uint256" "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/burn" @@ -55,8 +56,8 @@ func MakeGenesisBlock(parentHash common.Hash, blockNumber uint64, timestamp uint return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)) } -func TriedbConfig(c *core.CacheConfig) *trie.Config { - config := &trie.Config{Preimages: c.Preimages} +func TriedbConfig(c *core.CacheConfig) *triedb.Config { + config := &triedb.Config{Preimages: c.Preimages} if c.StateScheme == rawdb.HashScheme { config.HashDB = &hashdb.Config{ CleanCacheSize: c.TrieCleanLimit * 1024 * 1024, diff --git a/arbos/storage/storage.go b/arbos/storage/storage.go index 8d7fa09304..6e6c976644 100644 --- a/arbos/storage/storage.go +++ b/arbos/storage/storage.go @@ -18,9 +18,9 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/trie/triedb/hashdb" - "github.com/ethereum/go-ethereum/trie/triedb/pathdb" + "github.com/ethereum/go-ethereum/triedb" + "github.com/ethereum/go-ethereum/triedb/hashdb" + "github.com/ethereum/go-ethereum/triedb/pathdb" "github.com/offchainlabs/nitro/arbos/burn" "github.com/offchainlabs/nitro/arbos/util" "github.com/offchainlabs/nitro/util/arbmath" @@ -87,9 +87,9 @@ func NewMemoryBacked(burner burn.Burner) *Storage { // Only used for testing. func NewMemoryBackedStateDB() vm.StateDB { raw := rawdb.NewMemoryDatabase() - trieConfig := &trie.Config{Preimages: false, PathDB: pathdb.Defaults} + trieConfig := &triedb.Config{Preimages: false, PathDB: pathdb.Defaults} if env.GetTestStateScheme() == rawdb.HashScheme { - trieConfig = &trie.Config{Preimages: false, HashDB: hashdb.Defaults} + trieConfig = &triedb.Config{Preimages: false, HashDB: hashdb.Defaults} } db := state.NewDatabaseWithConfig(raw, trieConfig) statedb, err := state.New(common.Hash{}, db, nil) From 5736c56857bafd6d04d09cb2381593f928b27d86 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 22 Jul 2024 09:35:08 -0300 Subject: [PATCH 133/140] Fixes ci, runs gotestsum package by package --- .github/workflows/ci.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05c3f3cbd3..c5dc37148b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,7 +160,12 @@ jobs: TEST_STATE_SCHEME: hash run: | packages=`go list ./...` - stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -timeout 20m -parallel=8 -tags=cionly + for package in $packages; do + echo running tests for $package + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -timeout 20m -tags=cionly; then + exit 1 + fi + done - name: run tests with race detection and path state scheme if: matrix.test-mode == 'race' @@ -181,7 +186,12 @@ jobs: TEST_STATE_SCHEME: hash run: | packages=`go list ./...` - stdbuf -oL gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 --no-color=false -- ./... -race -timeout 30m -parallel=8 + for package in $packages; do + echo running tests for $package + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -race -timeout 30m; then + exit 1 + fi + done - name: run redis tests if: matrix.test-mode == 'defaults' From fc900cc6dbe011cddcdd770ca5cd59c810f52b15 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 22 Jul 2024 13:35:53 -0300 Subject: [PATCH 134/140] Updates go-ethereum --- go-ethereum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go-ethereum b/go-ethereum index 18256c2dfc..334c337af3 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 18256c2dfcce8fd567aa05e03fbc11a4c17aa550 +Subproject commit 334c337af3e58523a23170aaa8dd0139bc57671e From 6f04d12aa3c87aae00284cb2e26fa1b88733af3b Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 22 Jul 2024 13:40:34 -0300 Subject: [PATCH 135/140] Uses TriedbConfig from geth --- arbos/arbosState/initialization_test.go | 2 +- arbos/arbosState/initialize.go | 23 +---------------------- system_tests/state_fuzz_test.go | 2 +- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index ffba4cf9b1..34802392fe 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -67,7 +67,7 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) Require(t, err) - triedbConfig := TriedbConfig(cacheConfig) + triedbConfig := cacheConfig.TriedbConfig() stateDb, err := state.New(stateroot, state.NewDatabaseWithConfig(raw, triedbConfig), nil) Require(t, err) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index d7b277970d..c44febf386 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -10,16 +10,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" - "github.com/ethereum/go-ethereum/triedb" - "github.com/ethereum/go-ethereum/triedb/hashdb" - "github.com/ethereum/go-ethereum/triedb/pathdb" "github.com/holiman/uint256" "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbos/burn" @@ -56,25 +52,8 @@ func MakeGenesisBlock(parentHash common.Hash, blockNumber uint64, timestamp uint return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)) } -func TriedbConfig(c *core.CacheConfig) *triedb.Config { - config := &triedb.Config{Preimages: c.Preimages} - if c.StateScheme == rawdb.HashScheme { - config.HashDB = &hashdb.Config{ - CleanCacheSize: c.TrieCleanLimit * 1024 * 1024, - } - } - if c.StateScheme == rawdb.PathScheme { - config.PathDB = &pathdb.Config{ - StateHistory: c.StateHistory, - CleanCacheSize: c.TrieCleanLimit * 1024 * 1024, - DirtyCacheSize: c.TrieDirtyLimit * 1024 * 1024, - } - } - return config -} - func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (root common.Hash, err error) { - triedbConfig := TriedbConfig(cacheConfig) + triedbConfig := cacheConfig.TriedbConfig() triedbConfig.Preimages = false stateDatabase := state.NewDatabaseWithConfig(db, triedbConfig) defer func() { diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go index 5cff2108cf..713aefcfba 100644 --- a/system_tests/state_fuzz_test.go +++ b/system_tests/state_fuzz_test.go @@ -151,7 +151,7 @@ func FuzzStateTransition(f *testing.F) { if err != nil { panic(err) } - trieDBConfig := arbosState.TriedbConfig(cacheConfig) + trieDBConfig := cacheConfig.TriedbConfig() statedb, err := state.New(stateRoot, state.NewDatabaseWithConfig(chainDb, trieDBConfig), nil) if err != nil { panic(err) From d63fc0ef077f7c814ef07c0f16583aa519a16b7c Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Jul 2024 15:01:12 +0200 Subject: [PATCH 136/140] Make two comments proper Rust doc comments This way online documentation can be generated correctly. --- arbitrator/prover/src/memory.rs | 12 ++++++------ arbitrator/wasm-libraries/Cargo.lock | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index dd4198f7b8..139ddcf272 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -262,9 +262,9 @@ impl Memory { } #[must_use] - // Stores a value in memory, returns false if the value would overflow the buffer. - // - // bytes is the number of bytes to store. It must be <= 8. + /// Stores a value in memory, returns false if the value would overflow the buffer. + /// + /// bytes is the number of bytes to store. It must be <= 8. pub fn store_value(&mut self, idx: u64, value: u64, bytes: u8) -> bool { assert!(bytes <= 8); let Some(end_idx) = idx.checked_add(bytes.into()) else { @@ -285,9 +285,9 @@ impl Memory { } #[must_use] - // Stores a slice in memory, returns false if the value would overflow the buffer. - // - // The length of value <= 32. + /// Stores a slice in memory, returns false if the value would overflow the buffer. + /// + /// The length of value <= 32. pub fn store_slice_aligned(&mut self, idx: u64, value: &[u8]) -> bool { assert!(value.len() <= Self::LEAF_SIZE); if idx % Self::LEAF_SIZE as u64 != 0 { diff --git a/arbitrator/wasm-libraries/Cargo.lock b/arbitrator/wasm-libraries/Cargo.lock index 3817d0b40f..88525ececa 100644 --- a/arbitrator/wasm-libraries/Cargo.lock +++ b/arbitrator/wasm-libraries/Cargo.lock @@ -120,6 +120,7 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", + "serde", "tap", "wyz", ] @@ -885,6 +886,7 @@ version = "0.1.0" dependencies = [ "arbutil", "bincode", + "bitvec", "brotli", "derivative", "digest 0.9.0", From f3a9b4dd8c145166a526d152fd8794c45134b99a Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Jul 2024 15:40:42 +0200 Subject: [PATCH 137/140] Simplify the resizing of the dirty_leaf_parents --- arbitrator/prover/src/merkle.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index a3b063786f..ebaefbe401 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -377,15 +377,8 @@ impl Merkle { layer.resize(layer_size, *empty_hash_at(self.ty, layer_i)); layer_size = max(layer_size >> 1, 1); } - for i in start..new_len { - let parent_i = i >> 1; - assert!(parent_i <= layers.dirty_leaf_parents.len()); - if parent_i == layers.dirty_leaf_parents.len() { - layers.dirty_leaf_parents.push(true); - } else if parent_i < layers.dirty_leaf_parents.len() { - layers.dirty_leaf_parents.set(parent_i, true); - } - } + layers.dirty_leaf_parents[(start >> 1)..].fill(true); + layers.dirty_leaf_parents.resize(new_len >> 1, true); Ok(layers.data[0].len()) } } From 62b5246ba2f2995a90f14d7016dcb7455e5ad059 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Jul 2024 16:18:48 +0200 Subject: [PATCH 138/140] Just clone the dirty_leaf_parents and fill(false) This way, it's clearer what the end-state of the `dirty_leaf_parents` is after `rehash` is called? --- arbitrator/prover/src/merkle.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index ebaefbe401..d6d666eb62 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -230,11 +230,7 @@ impl Merkle { if layers.dirty_leaf_parents.is_empty() { return; } - // Replace the dirty leaf parents with clean ones. - let mut dirt = std::mem::replace( - &mut layers.dirty_leaf_parents, - bitvec![0; (layers.data[0].len() + 1) >> 1], - ); + let mut dirt = layers.dirty_leaf_parents.clone(); // Process dirty indices starting from layer 1 (layer 0 is the leaves). for layer_i in 1..layers.data.len() { let mut new_dirt = bitvec![0; dirt.len() + 1 >> 1]; @@ -262,6 +258,7 @@ impl Merkle { } dirt = new_dirt; } + layers.dirty_leaf_parents.fill(false); } pub fn root(&self) -> Bytes32 { @@ -377,7 +374,9 @@ impl Merkle { layer.resize(layer_size, *empty_hash_at(self.ty, layer_i)); layer_size = max(layer_size >> 1, 1); } + // This will set one or no values depending on if the length was even or odd. layers.dirty_leaf_parents[(start >> 1)..].fill(true); + // This then resizes and marks the dirty leaf parents as dirty. layers.dirty_leaf_parents.resize(new_len >> 1, true); Ok(layers.data[0].len()) } @@ -398,7 +397,7 @@ impl PartialEq for Merkle { // because the same nodes are hashed together. However, the min_dpeth was 4, then, // there would be 4 layers in that tree, and the root hash would be different. fn eq(&self, other: &Self) -> bool { - self.root() == other.root() + self.root() == other.root() && self.ty == other.ty } } From 963a23bb2e901617100a0bd45c0ee0016c9f2a2e Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 23 Jul 2024 16:34:00 +0200 Subject: [PATCH 139/140] Make clippy happy. --- arbitrator/prover/src/memory.rs | 2 +- arbitrator/prover/src/merkle.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arbitrator/prover/src/memory.rs b/arbitrator/prover/src/memory.rs index 139ddcf272..5853dc87e1 100644 --- a/arbitrator/prover/src/memory.rs +++ b/arbitrator/prover/src/memory.rs @@ -364,7 +364,7 @@ pub mod testing { pub fn empty_leaf_hash() -> Bytes32 { let leaf = [0u8; 32]; - return super::hash_leaf(leaf); + super::hash_leaf(leaf) } } diff --git a/arbitrator/prover/src/merkle.rs b/arbitrator/prover/src/merkle.rs index d6d666eb62..98ba6591f0 100644 --- a/arbitrator/prover/src/merkle.rs +++ b/arbitrator/prover/src/merkle.rs @@ -205,7 +205,7 @@ impl Merkle { min_depth }; let mut layers: Vec> = Vec::with_capacity(depth); - let dirty_leaf_parents = bitvec![0; hashes.len() + 1 >> 1]; + let dirty_leaf_parents = bitvec![0; (hashes.len() + 1) >> 1]; layers.push(hashes); while layers.last().unwrap().len() > 1 || layers.len() < min_depth { let layer = layers.last().unwrap(); @@ -233,7 +233,7 @@ impl Merkle { let mut dirt = layers.dirty_leaf_parents.clone(); // Process dirty indices starting from layer 1 (layer 0 is the leaves). for layer_i in 1..layers.data.len() { - let mut new_dirt = bitvec![0; dirt.len() + 1 >> 1]; + let mut new_dirt = bitvec![0; (dirt.len() + 1) >> 1]; for idx in dirt.iter_ones() { let left_child_idx = idx << 1; let right_child_idx = left_child_idx + 1; From a517597a2e4f119efc28b08f50547135823ccf5f Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Tue, 23 Jul 2024 14:10:15 -0300 Subject: [PATCH 140/140] Increases number of CI reruns. --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5dc37148b..b9fcfba7fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,7 +149,7 @@ jobs: packages=`go list ./...` for package in $packages; do echo running tests for $package - if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -timeout 20m -tags=cionly > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=2 --no-color=false -- -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -timeout 20m -tags=cionly > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then exit 1 fi done @@ -162,7 +162,7 @@ jobs: packages=`go list ./...` for package in $packages; do echo running tests for $package - if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -timeout 20m -tags=cionly; then + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=2 --no-color=false -- -timeout 20m -tags=cionly; then exit 1 fi done @@ -175,7 +175,7 @@ jobs: packages=`go list ./...` for package in $packages; do echo running tests for $package - if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -race -timeout 30m > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=2 --no-color=false -- -race -timeout 30m > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then exit 1 fi done @@ -188,7 +188,7 @@ jobs: packages=`go list ./...` for package in $packages; do echo running tests for $package - if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -race -timeout 30m; then + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=2 --no-color=false -- -race -timeout 30m; then exit 1 fi done @@ -203,7 +203,7 @@ jobs: packages=`go list ./...` for package in $packages; do echo running tests for $package - if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=challengetest -run=TestChallenge > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=2 --no-color=false -- -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=challengetest -run=TestChallenge > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then exit 1 fi done @@ -214,7 +214,7 @@ jobs: packages=`go list ./...` for package in $packages; do echo running tests for $package - if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -timeout 60m -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=stylustest -run="TestProgramArbitrator" > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=2 --no-color=false -- -timeout 60m -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=stylustest -run="TestProgramArbitrator" > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then exit 1 fi done @@ -225,7 +225,7 @@ jobs: packages=`go list ./...` for package in $packages; do echo running tests for $package - if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=1 --no-color=false -- -timeout 60m -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=stylustest -run="TestProgramLong" > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then + if ! stdbuf -oL gotestsum --format short-verbose --packages="$package" --rerun-fails=2 --no-color=false -- -timeout 60m -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=stylustest -run="TestProgramLong" > >(stdbuf -oL tee -a full.log | grep -vE "INFO|seal"); then exit 1 fi done