-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(katana): classes trie hash #2876
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
use bonsai_trie::{BonsaiDatabase, BonsaiPersistentDatabase, MultiProof}; | ||
use katana_primitives::block::BlockNumber; | ||
use katana_primitives::class::{ClassHash, CompiledClassHash}; | ||
use katana_primitives::hash::Pedersen; | ||
use katana_primitives::hash::{Poseidon, StarkHash}; | ||
use katana_primitives::Felt; | ||
use starknet::macros::short_string; | ||
use starknet_types_core::hash::{Poseidon, StarkHash}; | ||
|
||
use crate::id::CommitId; | ||
|
||
|
@@ -15,7 +14,7 @@ impl ClassesMultiProof { | |
// TODO: maybe perform results check in this method as well. make it accept the compiled class | ||
// hashes | ||
pub fn verify(&self, root: Felt, class_hashes: Vec<ClassHash>) -> Vec<Felt> { | ||
crate::verify_proof::<Pedersen>(&self.0, root, class_hashes) | ||
crate::verify_proof::<Poseidon>(&self.0, root, class_hashes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Ohayo! Test files need updating, sensei! The switch to Poseidon affects these test files:
Please update the test cases to use Poseidon instead of Pedersen to maintain consistency with the production code. 🔗 Analysis chainVerify compatibility with existing callers, sensei! The switch from Pedersen to Poseidon in 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for all calls to verify_proof to ensure they're updated
rg -l "verify_proof::<.*Pedersen>"
Length of output: 115 Script: #!/bin/bash
# Check the actual usage in both files
echo "=== storage/db/src/trie/mod.rs ==="
rg "verify_proof::<.*Pedersen>" crates/katana/storage/db/src/trie/mod.rs -B 2 -A 2
echo -e "\n=== rpc/rpc/tests/proofs.rs ==="
rg "verify_proof::<.*Pedersen>" crates/katana/rpc/rpc/tests/proofs.rs -B 2 -A 2
Length of output: 1531 |
||
} | ||
} | ||
|
||
|
@@ -27,7 +26,7 @@ impl From<MultiProof> for ClassesMultiProof { | |
|
||
#[derive(Debug)] | ||
pub struct ClassesTrie<DB: BonsaiDatabase> { | ||
trie: crate::BonsaiTrie<DB, Pedersen>, | ||
trie: crate::BonsaiTrie<DB, Poseidon>, | ||
} | ||
|
||
////////////////////////////////////////////////////////////// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Inconsistent hash function usage detected, sensei!
While classes verification has been updated to use Poseidon, contract and storage proofs are still using Pedersen. This inconsistency could lead to:
Consider: