Skip to content

Commit

Permalink
introduce fast_forward_singleton(), to change the coin of a singleton…
Browse files Browse the repository at this point in the history
… spend
  • Loading branch information
arvidn committed Oct 21, 2023
1 parent bf14e37 commit 6892143
Show file tree
Hide file tree
Showing 8 changed files with 566 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ clvmr = "=0.3.0"
hex = "=0.4.3"
pyo3 = { version = ">=0.19.0", optional = true }
clvm-utils = { version = "=0.2.7", path = "clvm-utils" }
chia-traits = { version = "=0.1.0", path = "chia-traits" }
clvm-traits = { version = "=0.1.0", path = "clvm-traits" }
clvm-derive = { version = "=0.1.0", path = "clvm-derive" }
chia-protocol = { version = "=0.2.7", path = "chia-protocol" }
chia-wallet = { version = "=0.1.0", path = "chia-wallet" }
hex-literal = "=0.4.1"
thiserror = "1.0.44"

Expand Down
6 changes: 6 additions & 0 deletions chia-protocol/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ impl<'a, const N: usize> From<&'a BytesImpl<N>> for &'a [u8; N] {
}
}

impl<const N: usize> From<&BytesImpl<N>> for [u8; N] {
fn from(v: &BytesImpl<N>) -> [u8; N] {
v.0
}
}

impl<'a, const N: usize> From<&'a BytesImpl<N>> for &'a [u8] {
fn from(v: &'a BytesImpl<N>) -> &'a [u8] {
&v.0
Expand Down
Binary file added ff-tests/bb13.spend
Binary file not shown.
Binary file added ff-tests/e3c0.spend
Binary file not shown.
41 changes: 41 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use crate::gen::validation_error::ValidationErr;
use clvmr::reduction::EvalErr;
use thiserror::Error;

#[derive(Debug, Clone, PartialEq, Eq, Error)]
pub enum Error {
#[error("CLVM {0}")]
Clvm(#[from] clvm_traits::Error),

#[error("Eval {0}")]
Eval(#[from] EvalErr),

#[error("Validation {0}")]
Validation(#[from] ValidationErr),

#[error("not a singleton mod hash")]
NotSingletonModHash,

#[error("inner puzzle hash mismatch")]
InnerPuzzleHashMismatch,

#[error("puzzle hash mismatch")]
PuzzleHashMismatch,

#[error("coin amount mismatch")]
CoinAmountMismatch,

#[error("coin amount is even")]
CoinAmountEven,

#[error("parent coin mismatch")]
ParentCoinMismatch,

#[error("coin mismatch")]
CoinMismatch,

#[error("{0}")]
Custom(String),
}

pub type Result<T> = std::result::Result<T, Error>;
Loading

0 comments on commit 6892143

Please sign in to comment.