Skip to content

Commit

Permalink
Remove clvm-traits in favor of adding implementations back to chia_rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Jan 9, 2024
1 parent 4e59b6b commit 213cb56
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 313 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ lazy_static = "1.4.0"
num-bigint = "0.4.3"
num-traits = "0.2.15"
num-integer = "0.1.45"
clvm-traits = "0.3.2"
chia-bls = "0.3.1"
sha2 = "0.10.8"
openssl = { version = "=0.10.55", features = ["vendored"], optional = true }
Expand Down
37 changes: 0 additions & 37 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::err_utils::err;
use crate::number::{node_from_number, number_from_u8, Number};
use crate::reduction::EvalErr;
use chia_bls::{G1Element, G2Element};
use clvm_traits::{ClvmDecoder, ClvmEncoder, FromClvmError, ToClvmError};

const MAX_NUM_ATOMS: usize = 62500000;
const MAX_NUM_PAIRS: usize = 62500000;
Expand Down Expand Up @@ -377,42 +376,6 @@ impl Allocator {
}
}

impl ClvmEncoder for Allocator {
type Node = NodePtr;

fn encode_atom(&mut self, bytes: &[u8]) -> Result<Self::Node, ToClvmError> {
self.new_atom(bytes).or(Err(ToClvmError::OutOfMemory))
}

fn encode_pair(
&mut self,
first: Self::Node,
rest: Self::Node,
) -> Result<Self::Node, ToClvmError> {
self.new_pair(first, rest).or(Err(ToClvmError::OutOfMemory))
}
}

impl ClvmDecoder for Allocator {
type Node = NodePtr;

fn decode_atom(&self, node: &Self::Node) -> Result<&[u8], FromClvmError> {
if let SExp::Atom = self.sexp(*node) {
Ok(self.atom(*node))
} else {
Err(FromClvmError::ExpectedAtom)
}
}

fn decode_pair(&self, node: &Self::Node) -> Result<(Self::Node, Self::Node), FromClvmError> {
if let SExp::Pair(first, rest) = self.sexp(*node) {
Ok((first, rest))
} else {
Err(FromClvmError::ExpectedPair)
}
}
}

#[test]
fn test_node_as_index() {
assert_eq!(NodePtr::new(ObjectType::Pair, 0).as_index(), 0);
Expand Down
115 changes: 0 additions & 115 deletions src/from_node_ptr.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ pub mod serde;
pub mod sha2;
pub mod traverse_path;

pub mod from_node_ptr;
pub mod to_node_ptr;

pub use from_node_ptr::FromNodePtr;
pub use to_node_ptr::ToNodePtr;

pub use allocator::{Allocator, NodePtr};
pub use chia_dialect::ChiaDialect;
pub use run_program::run_program;
Expand Down
143 changes: 0 additions & 143 deletions src/to_node_ptr.rs

This file was deleted.

0 comments on commit 213cb56

Please sign in to comment.