Skip to content
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

export ENABLE_KECCAK flag in the root of crate #505

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl PartialEq for Atom<'_> {
}
}

impl<'a> AsRef<[u8]> for Atom<'a> {
impl AsRef<[u8]> for Atom<'_> {
fn as_ref(&self) -> &[u8] {
match self {
Self::Borrowed(bytes) => bytes,
Expand All @@ -132,15 +132,15 @@ impl<'a> AsRef<[u8]> for Atom<'a> {
}
}

impl<'a> Deref for Atom<'a> {
impl Deref for Atom<'_> {
type Target = [u8];

fn deref(&self) -> &Self::Target {
self.as_ref()
}
}

impl<'a> Borrow<[u8]> for Atom<'a> {
impl Borrow<[u8]> for Atom<'_> {
fn borrow(&self) -> &[u8] {
self.as_ref()
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pub use allocator::{Allocator, Atom, NodePtr, SExp};
pub use chia_dialect::ChiaDialect;
pub use run_program::run_program;

pub use chia_dialect::{LIMIT_HEAP, MEMPOOL_MODE, NO_UNKNOWN_OPS};
pub use chia_dialect::{
ENABLE_KECCAK, ENABLE_KECCAK_OPS_OUTSIDE_GUARD, LIMIT_HEAP, MEMPOOL_MODE, NO_UNKNOWN_OPS,
};

#[cfg(feature = "counters")]
pub use run_program::run_program_with_counters;
Expand Down
6 changes: 2 additions & 4 deletions src/serde/de_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ fn skip_or_sha_bytes<R: Read>(
}
}

/// parse a serialized clvm object tree to an array of `ParsedTriple` objects
type ParsedTriplesOutput = (Vec<ParsedTriple>, Option<Vec<[u8; 32]>>);

/// parse a serialized clvm object tree to an array of `ParsedTriple` objects
/// This alternative mechanism of deserialization generates an array of
/// references to each clvm object. A reference contains three values:
/// a start offset within the blob, an end offset, and a third value that
Expand All @@ -111,9 +112,6 @@ fn skip_or_sha_bytes<R: Read>(
///
/// Since these values are offsets into the original buffer, that buffer needs
/// to be kept around to get the original atoms.

type ParsedTriplesOutput = (Vec<ParsedTriple>, Option<Vec<[u8; 32]>>);

pub fn parse_triples<R: Read>(
f: &mut R,
calculate_tree_hashes: bool,
Expand Down
2 changes: 0 additions & 2 deletions src/serde/object_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ impl<'a, T: Clone> ObjectCache<'a, T> {
}

/// calculate the standard `sha256tree` has for a node
pub fn treehash(
cache: &mut ObjectCache<Bytes32>,
allocator: &Allocator,
Expand All @@ -97,7 +96,6 @@ pub fn treehash(

/// calculate the serialized length (without backrefs) of a node. This is used
/// to check if using backrefs is actually smaller.
pub fn serialized_length(
cache: &mut ObjectCache<u64>,
allocator: &Allocator,
Expand Down
1 change: 0 additions & 1 deletion src/serde/write_atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::io::ErrorKind;
/// from 0x00-0x7f also have a prefix encoding their length. This function
/// writes the correct prefix for an atom of size `size` whose first byte is `atom_0`.
/// If the atom is of size 0, use any placeholder first byte, as it's ignored anyway.

fn write_atom_encoding_prefix_with_size<W: io::Write>(
f: &mut W,
atom_0: u8,
Expand Down
Loading