mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-06 15:53:10 +00:00
Merge pull request #725 from mir-protocol/eth_trie_utils_lib
Replaced `PartialTrie` definitions with `eth-trie-utils` crate
This commit is contained in:
commit
928e8bc0e9
@ -7,6 +7,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
plonky2 = { path = "../plonky2", default-features = false, features = ["rand", "timing"] }
|
||||
plonky2_util = { path = "../util" }
|
||||
eth-trie-utils = { git = "https://github.com/mir-protocol/eth-trie-utils.git", rev = "3ca443fd18e3f6d209dd96cbad851e05ae058b34" }
|
||||
maybe_rayon = { path = "../maybe_rayon" }
|
||||
anyhow = "1.0.40"
|
||||
env_logger = "0.9.0"
|
||||
@ -21,6 +22,7 @@ pest_derive = "2.1.0"
|
||||
rand = "0.8.5"
|
||||
rand_chacha = "0.3.1"
|
||||
rlp = "0.5.1"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
keccak-hash = "0.9.0"
|
||||
tiny-keccak = "2.0.2"
|
||||
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
use eth_trie_utils::partial_trie::PartialTrie;
|
||||
use ethereum_types::Address;
|
||||
use plonky2::field::extension::Extendable;
|
||||
use plonky2::field::polynomial::PolynomialValues;
|
||||
use plonky2::field::types::Field;
|
||||
use plonky2::hash::hash_types::RichField;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::all_stark::{AllStark, NUM_TABLES};
|
||||
use crate::config::StarkConfig;
|
||||
use crate::cpu::bootstrap_kernel::generate_bootstrap_kernel;
|
||||
use crate::cpu::columns::NUM_CPU_COLUMNS;
|
||||
use crate::cpu::kernel::global_metadata::GlobalMetadata;
|
||||
use crate::generation::partial_trie::PartialTrie;
|
||||
use crate::generation::state::GenerationState;
|
||||
use crate::memory::segments::Segment;
|
||||
use crate::memory::NUM_CHANNELS;
|
||||
@ -17,9 +18,9 @@ use crate::proof::{BlockMetadata, PublicValues, TrieRoots};
|
||||
use crate::util::trace_rows_to_poly_values;
|
||||
|
||||
pub(crate) mod memory;
|
||||
pub mod partial_trie;
|
||||
pub(crate) mod state;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
/// Inputs needed for trace generation.
|
||||
pub struct GenerationInputs {
|
||||
pub signed_txns: Vec<Vec<u8>>,
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
use ethereum_types::U256;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
/// A partial trie, or a sub-trie thereof. This mimics the structure of an Ethereum trie, except
|
||||
/// with an additional `Hash` node type, representing a node whose data is not needed to process
|
||||
/// our transaction.
|
||||
pub enum PartialTrie {
|
||||
/// An empty trie.
|
||||
Empty,
|
||||
/// The digest of trie whose data does not need to be stored.
|
||||
Hash(U256),
|
||||
/// A branch node, which consists of 16 children and an optional value.
|
||||
Branch {
|
||||
children: [Box<PartialTrie>; 16],
|
||||
value: Option<U256>,
|
||||
},
|
||||
/// An extension node, which consists of a list of nibbles and a single child.
|
||||
Extension {
|
||||
nibbles: Nibbles,
|
||||
child: Box<PartialTrie>,
|
||||
},
|
||||
/// A leaf node, which consists of a list of nibbles and a value.
|
||||
Leaf { nibbles: Nibbles, value: Vec<u8> },
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
/// A sequence of nibbles.
|
||||
pub struct Nibbles {
|
||||
/// The number of nibbles in this sequence.
|
||||
pub count: usize,
|
||||
/// A packed encoding of these nibbles. Only the first (least significant) `4 * count` bits are
|
||||
/// used. The rest are unused and should be zero.
|
||||
pub packed: U256,
|
||||
}
|
||||
@ -12,6 +12,7 @@ use plonky2::hash::merkle_tree::MerkleCap;
|
||||
use plonky2::iop::ext_target::ExtensionTarget;
|
||||
use plonky2::iop::target::Target;
|
||||
use plonky2::plonk::config::GenericConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::all_stark::NUM_TABLES;
|
||||
use crate::config::StarkConfig;
|
||||
@ -58,7 +59,7 @@ pub struct TrieRoots {
|
||||
pub receipts_root: U256,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
||||
pub struct BlockMetadata {
|
||||
pub block_beneficiary: Address,
|
||||
pub block_timestamp: U256,
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
use eth_trie_utils::partial_trie::PartialTrie;
|
||||
use hex_literal::hex;
|
||||
use plonky2::field::goldilocks_field::GoldilocksField;
|
||||
use plonky2::plonk::config::PoseidonGoldilocksConfig;
|
||||
use plonky2::util::timing::TimingTree;
|
||||
use plonky2_evm::all_stark::AllStark;
|
||||
use plonky2_evm::config::StarkConfig;
|
||||
use plonky2_evm::generation::partial_trie::PartialTrie;
|
||||
use plonky2_evm::generation::GenerationInputs;
|
||||
use plonky2_evm::proof::BlockMetadata;
|
||||
use plonky2_evm::prover::prove;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user