Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Mar 27, 2024
1 parent ad62b18 commit 4e8d5b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion starknet-core/src/chain_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub const TESTNET2: Felt = Felt::from_raw([
1663542769632127759,
]);

pub const SEPOLIA: FieldElement = FieldElement::from_mont([
pub const SEPOLIA: Felt = Felt::from_raw([
1555806712078248243,
18446744073708869172,
18446744073709551615,
Expand Down
12 changes: 6 additions & 6 deletions starknet-core/src/types/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ enum BytecodeSegmentStructure {
/// Represents a leaf in the bytecode segment tree.
struct BytecodeLeaf {
// NOTE: change this to a slice?
data: Vec<FieldElement>,
data: Vec<Felt>,
}

/// Internal structure used for post-Sierra-1.5.0 CASM hash calculation.
Expand Down Expand Up @@ -565,7 +565,7 @@ impl CompiledClass {
// `visited_pcs` should be given in reverse order, and is consumed by the function. Returns the
// BytecodeSegmentStructure and the total length of the processed segment.
fn create_bytecode_segment_structure_inner(
bytecode: &[FieldElement],
bytecode: &[Felt],
bytecode_segment_lengths: &IntOrList,
visited_pcs: &mut Vec<u64>,
bytecode_offset: &mut u64,
Expand Down Expand Up @@ -649,7 +649,7 @@ impl CompiledClass {
}

impl BytecodeSegmentStructure {
fn hash(&self) -> FieldElement {
fn hash(&self) -> Felt {
match self {
Self::BytecodeLeaf(inner) => inner.hash(),
Self::BytecodeSegmentedNode(inner) => inner.hash(),
Expand All @@ -658,19 +658,19 @@ impl BytecodeSegmentStructure {
}

impl BytecodeLeaf {
fn hash(&self) -> FieldElement {
fn hash(&self) -> Felt {
poseidon_hash_many(&self.data)
}
}

impl BytecodeSegmentedNode {
fn hash(&self) -> FieldElement {
fn hash(&self) -> Felt {
let mut hasher = PoseidonHasher::new();
for node in self.segments.iter() {
hasher.update(node.segment_length.into());
hasher.update(node.inner_structure.hash());
}
hasher.finalize() + FieldElement::ONE
hasher.finalize() + Felt::ONE
}
}

Expand Down

0 comments on commit 4e8d5b6

Please sign in to comment.