Skip to content

Commit

Permalink
Progress
Browse files Browse the repository at this point in the history
  • Loading branch information
wborgeaud committed Oct 18, 2023
1 parent 95e5cc1 commit a706cda
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static_assertions = "1.1.0"
hashbrown = { version = "0.14.0" }
tiny-keccak = "2.0.2"
serde_json = "1.0"
smt_utils = { path = "../../smt_utils"}

[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = "0.5.0"
Expand Down
12 changes: 5 additions & 7 deletions evm/src/cpu/kernel/constants/smt_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ use crate::Node;

#[derive(Copy, Clone, Debug)]
pub(crate) enum PartialSmtType {
Default = 0,
Hash = 1,
Internal = 2,
Leaf = 3,
Hash = 0,
Internal = 1,
Leaf = 2,
}

impl PartialSmtType {
pub(crate) const COUNT: usize = 4;
pub(crate) const COUNT: usize = 3;

pub(crate) fn of(trie: &HashedPartialTrie) -> Self {
todo!()
Expand All @@ -28,13 +27,12 @@ impl PartialSmtType {
}

pub(crate) fn all() -> [Self; Self::COUNT] {
[Self::Default, Self::Hash, Self::Internal, Self::Leaf]
[Self::Hash, Self::Internal, Self::Leaf]
}

/// The variable name that gets passed into kernel assembly code.
pub(crate) fn var_name(&self) -> &'static str {
match self {
Self::Default => "SMT_NODE_EMPTY",
Self::Hash => "SMT_NODE_HASH",
Self::Internal => "SMT_NODE_BRANCH",
Self::Leaf => "SMT_NODE_LEAF",
Expand Down
5 changes: 3 additions & 2 deletions evm/src/generation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use plonky2::hash::hash_types::RichField;
use plonky2::timed;
use plonky2::util::timing::TimingTree;
use serde::{Deserialize, Serialize};
use smt_utils::smt::{hash_serialize, Smt};
use GlobalMetadata::{
ReceiptTrieRootDigestAfter, ReceiptTrieRootDigestBefore, StateTrieRootDigestAfter,
StateTrieRootDigestBefore, TransactionTrieRootDigestAfter, TransactionTrieRootDigestBefore,
Expand Down Expand Up @@ -73,7 +74,7 @@ pub struct GenerationInputs {
pub struct TrieInputs {
/// A partial version of the state trie prior to these transactions. It should include all nodes
/// that will be accessed by these transactions.
pub state_trie: HashedPartialTrie,
pub state_trie: Vec<U256>,

/// A partial version of the transaction trie prior to these transactions. It should include all
/// nodes that will be accessed by these transactions.
Expand Down Expand Up @@ -124,7 +125,7 @@ fn apply_metadata_and_tries_memops<F: RichField + Extendable<D>, const D: usize>
),
(
GlobalMetadata::StateTrieRootDigestBefore,
h2u(tries.state_trie.hash()),
h2u(hash_serialize(&tries.state_trie)),
),
(
GlobalMetadata::TransactionTrieRootDigestBefore,
Expand Down

0 comments on commit a706cda

Please sign in to comment.