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

Revert "Implement clawbacks" #135

Merged
merged 1 commit into from
Nov 28, 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
3 changes: 0 additions & 3 deletions crates/chia-sdk-driver/src/driver_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,4 @@ pub enum DriverError {

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

#[error("invalid merkle proof")]
InvalidMerkleProof,
}
12 changes: 4 additions & 8 deletions crates/chia-sdk-driver/src/layers.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
mod augmented_condition_layer;
mod cat_layer;
mod did_layer;
mod nft_ownership_layer;
mod nft_state_layer;
mod p2_curried_layer;
mod p2_delegated_conditions_layer;
mod p2_delegated_singleton_layer;
mod p2_one_of_many_layer;
mod p2_singleton_layer;
mod p2_one_of_many;
mod p2_singleton;
mod royalty_transfer_layer;
mod settlement_layer;
mod singleton_layer;
mod standard_layer;

pub use augmented_condition_layer::*;
pub use cat_layer::*;
pub use did_layer::*;
pub use nft_ownership_layer::*;
pub use nft_state_layer::*;
pub use p2_curried_layer::*;
pub use p2_delegated_conditions_layer::*;
pub use p2_delegated_singleton_layer::*;
pub use p2_one_of_many_layer::*;
pub use p2_singleton_layer::*;
pub use p2_one_of_many::*;
pub use p2_singleton::*;
pub use royalty_transfer_layer::*;
pub use settlement_layer::*;
pub use singleton_layer::*;
Expand Down
117 changes: 0 additions & 117 deletions crates/chia-sdk-driver/src/layers/augmented_condition_layer.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clvm_utils::{CurriedProgram, ToTreeHash, TreeHash};
use clvmr::{Allocator, NodePtr};
use hex_literal::hex;

use crate::{DriverError, Layer, MerkleProof, Puzzle, SpendContext};
use crate::{DriverError, Layer, Puzzle, SpendContext};

#[allow(clippy::doc_markdown)]
/// The Delegation [`Layer`] is used to enable DataLayer delegation capabilities
Expand Down Expand Up @@ -159,7 +159,7 @@ impl DelegationLayerArgs {
#[derive(ToClvm, FromClvm, Debug, Clone, PartialEq, Eq)]
#[clvm(list)]
pub struct DelegationLayerSolution<P, S> {
pub merkle_proof: Option<MerkleProof>,
pub merkle_proof: Option<(u32, Vec<Bytes32>)>,
pub puzzle_reveal: P,
pub puzzle_solution: S,
}
Expand Down
112 changes: 0 additions & 112 deletions crates/chia-sdk-driver/src/layers/p2_curried_layer.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
use chia_protocol::Bytes32;
use clvm_traits::{FromClvm, ToClvm};
use clvm_utils::{CurriedProgram, ToTreeHash, TreeHash};
use clvm_utils::{CurriedProgram, TreeHash};
use clvmr::{Allocator, NodePtr};
use hex_literal::hex;

use crate::{DriverError, Layer, MerkleProof, Puzzle, SpendContext};
use crate::{DriverError, Layer, Puzzle, SpendContext};

/// The p2 1 of n [`Layer`] allows for picking from several delegated puzzles at runtime without revealing up front.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct P2OneOfManyLayer {
pub struct P2OneOfMany {
/// The merkle root used to lookup the delegated puzzle as part of the solution.
pub merkle_root: Bytes32,
}

impl P2OneOfManyLayer {
pub fn new(merkle_root: Bytes32) -> Self {
Self { merkle_root }
}
}

impl Layer for P2OneOfManyLayer {
impl Layer for P2OneOfMany {
type Solution = P2OneOfManySolution<NodePtr, NodePtr>;

fn parse_puzzle(allocator: &Allocator, puzzle: Puzzle) -> Result<Option<Self>, DriverError> {
Expand Down Expand Up @@ -66,46 +60,20 @@ impl Layer for P2OneOfManyLayer {
}
}

impl ToTreeHash for P2OneOfManyLayer {
fn tree_hash(&self) -> TreeHash {
CurriedProgram {
program: P2_ONE_OF_MANY_PUZZLE_HASH,
args: P2OneOfManyArgs::new(self.merkle_root),
}
.tree_hash()
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)]
#[clvm(curry)]
pub struct P2OneOfManyArgs {
pub merkle_root: Bytes32,
}

impl P2OneOfManyArgs {
pub fn new(merkle_root: Bytes32) -> Self {
Self { merkle_root }
}
}

#[derive(Debug, Clone, PartialEq, Eq, ToClvm, FromClvm)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)]
#[clvm(list)]
pub struct P2OneOfManySolution<P, S> {
pub merkle_proof: MerkleProof,
pub merkle_proof: Bytes32,
pub puzzle: P,
pub solution: S,
}

impl<P, S> P2OneOfManySolution<P, S> {
pub fn new(merkle_proof: MerkleProof, puzzle: P, solution: S) -> Self {
Self {
merkle_proof,
puzzle,
solution,
}
}
}

pub const P2_ONE_OF_MANY_PUZZLE: [u8; 280] = hex!(
"
ff02ffff01ff02ffff03ffff09ff05ffff02ff06ffff04ff02ffff04ffff0bff
Expand Down
Loading