Skip to content

Commit

Permalink
Merge pull request #879 from Chia-Network/chia-puzzle-types
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity authored Jan 15, 2025
2 parents 0b6571e + ba4872c commit 39f2398
Show file tree
Hide file tree
Showing 25 changed files with 39 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ jobs:
cd crates/chia-protocol
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: Fuzz (chia-puzzles)
- name: Fuzz (chia-puzzle-types)
run: |
cd crates/chia-puzzles
cd crates/chia-puzzle-types
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: Fuzz (clvm-traits)
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ dependencies = [
"chia-client",
"chia-consensus",
"chia-protocol",
"chia-puzzles",
"chia-puzzle-types",
"chia-secp",
"chia-sha2 0.17.0",
"chia-ssl",
Expand Down Expand Up @@ -363,7 +363,7 @@ version = "0.18.0"
dependencies = [
"chia-bls 0.18.0",
"chia-protocol",
"chia-puzzles",
"chia-puzzle-types",
"chia-sha2 0.17.0",
"chia-traits 0.18.0",
"chia_py_streamable_macro",
Expand Down Expand Up @@ -431,7 +431,7 @@ dependencies = [
]

[[package]]
name = "chia-puzzles"
name = "chia-puzzle-types"
version = "0.18.0"
dependencies = [
"anyhow",
Expand All @@ -448,10 +448,10 @@ dependencies = [
]

[[package]]
name = "chia-puzzles-fuzz"
name = "chia-puzzle-types-fuzz"
version = "0.16.0"
dependencies = [
"chia-puzzles",
"chia-puzzle-types",
"clvm-traits",
"clvmr",
"libfuzzer-sys",
Expand Down Expand Up @@ -509,7 +509,7 @@ dependencies = [
"chia-bls 0.18.0",
"chia-consensus",
"chia-protocol",
"chia-puzzles",
"chia-puzzle-types",
"chia-traits 0.18.0",
"clap",
"clvm-traits",
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ chia-consensus = { workspace = true, optional = true }
chia-protocol = { workspace = true, optional = true }
chia-ssl = { workspace = true, optional = true }
chia-traits = { workspace = true, optional = true }
chia-puzzles = { workspace = true, optional = true }
chia-puzzle-types = { workspace = true, optional = true }
chia-sha2 = { workspace = true, optional = true }
clvm-traits = { workspace = true, optional = true }
clvm-utils = { workspace = true, optional = true }
Expand All @@ -78,7 +78,7 @@ default = [
"protocol",
"ssl",
"traits",
"puzzles",
"puzzle-types",
"sha2",
"clvm-traits",
"clvm-utils"
Expand All @@ -91,7 +91,7 @@ consensus = ["dep:chia-consensus"]
protocol = ["dep:chia-protocol"]
ssl = ["dep:chia-ssl"]
traits = ["dep:chia-traits"]
puzzles = ["dep:chia-puzzles"]
puzzle-types = ["dep:chia-puzzle-types"]
sha2 = ["dep:chia-sha2"]
clvm-traits = ["dep:clvm-traits"]
clvm-utils = ["dep:clvm-utils"]
Expand All @@ -111,15 +111,15 @@ chia-protocol = { path = "./crates/chia-protocol", version = "0.18.0" }
chia-secp = { path = "./crates/chia-secp", version = "0.17.0" }
chia-ssl = { path = "./crates/chia-ssl", version = "0.17.0" }
chia-traits = { path = "./crates/chia-traits", version = "0.18.0" }
chia-puzzles = { path = "./crates/chia-puzzles", version = "0.18.0" }
chia-puzzle-types = { path = "./crates/chia-puzzle-types", version = "0.18.0" }
chia-sha2 = { path = "./crates/chia-sha2", version = "0.17.0" }
clvm-traits = { path = "./crates/clvm-traits", version = "0.18.0" }
clvm-utils = { path = "./crates/clvm-utils", version = "0.18.0" }
clvm-derive = { path = "./crates/clvm-derive", version = "0.17.0" }
chia-fuzz = { path = "./crates/chia-consensus/fuzz", version = "0.16.0" }
chia-bls-fuzz = { path = "./crates/chia-bls/fuzz", version = "0.16.0" }
chia-protocol-fuzz = { path = "./crates/chia-protocol/fuzz", version = "0.16.0" }
chia-puzzles-fuzz = { path = "./crates/chia-puzzles/fuzz", version = "0.16.0" }
chia-puzzle-types-fuzz = { path = "./crates/chia-puzzle-types/fuzz", version = "0.16.0" }
clvm-traits-fuzz = { path = "./crates/clvm-traits/fuzz", version = "0.16.0" }
clvm-utils-fuzz = { path = "./crates/clvm-utils/fuzz", version = "0.16.0" }
blst = { version = "0.3.12", features = ["portable"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ The following crates have fuzzers:
- chia-bls
- chia-consensus
- chia-protocol
- chia-puzzles
- chia-puzzle-types
- clvm-utils

To list and run fuzzers:
Expand Down
10 changes: 7 additions & 3 deletions bump-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
"crates/chia-tools",
"crates/clvm-utils",
"crates/clvm-derive",
"crates/chia-puzzles",
"crates/chia-puzzle-types",
"crates/chia-client",
"crates/chia-ssl",
"crates/chia-consensus",
"crates/chia-consensus/fuzz",
"crates/chia-puzzles/fuzz",
"crates/chia-puzzle-types/fuzz",
"crates/clvm-utils/fuzz",
]


def crates_with_changes() -> set[str]:
ret = set()
for c in our_crates:
Expand All @@ -42,6 +43,7 @@ def crates_with_changes() -> set[str]:
ret.add("wheel")
return ret


def update_cargo(name: str, crates: set[str]) -> None:
subst = ""
with open(f"{name}/Cargo.toml") as f:
Expand All @@ -54,7 +56,9 @@ def update_cargo(name: str, crates: set[str]) -> None:
if split[0] == "version" and name in crates:
line = f'version = "{v}"\n'
elif split[0] in crates and line.startswith(split[0] + " = "):
line = re.sub('version = "([>=^]?)\d+\.\d+\.\d+"', f'version = "\\g<1>{v}"', line)
line = re.sub(
'version = "([>=^]?)\d+\.\d+\.\d+"', f'version = "\\g<1>{v}"', line
)
subst += line

with open(f"{name}/Cargo.toml", "w") as f:
Expand Down
2 changes: 1 addition & 1 deletion crates/chia-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ chia-sha2 = { workspace = true }
chia-traits = { workspace = true }
clvm-traits = { workspace = true }
chia-protocol = { workspace = true }
chia-puzzles = { workspace = true }
chia-puzzle-types = { workspace = true }
chia-bls = { workspace = true }
hex-literal = { workspace = true }
thiserror = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/chia-consensus/src/fast_forward.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::error::{Error, Result};
use chia_protocol::Bytes32;
use chia_protocol::Coin;
use chia_puzzles::singleton::{
use chia_puzzle_types::singleton::{
SingletonArgs, SingletonSolution, SingletonStruct, SINGLETON_TOP_LAYER_PUZZLE_HASH,
};
use chia_puzzles::Proof;
use chia_puzzle_types::Proof;
use clvm_traits::{FromClvm, ToClvm};
use clvm_utils::CurriedProgram;
use clvm_utils::TreeHash;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "chia-puzzles"
name = "chia-puzzle-types"
version = "0.18.0"
edition = "2021"
license = "Apache-2.0"
description = "Chia primitives needed for building wallets."
description = "CLVM types for standard Chia puzzles."
authors = ["Brandon Haggstrom <[email protected]>"]
homepage = "https://github.com/Chia-Network/chia_rs"
repository = "https://github.com/Chia-Network/chia_rs"
Expand All @@ -28,6 +28,3 @@ arbitrary = { workspace = true, features = ["derive"], optional = true }
[dev-dependencies]
hex = { workspace = true }
anyhow = { workspace = true }

[lib]
crate-type = ["rlib"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "chia-puzzles-fuzz"
name = "chia-puzzle-types-fuzz"
version = "0.16.0"
authors = ["Automatically generated"]
publish = false
Expand All @@ -14,7 +14,7 @@ workspace = true
[dependencies]
libfuzzer-sys = { workspace = true }
clvmr = { workspace = true }
chia-puzzles = { workspace = true, features = ["arbitrary"] }
chia-puzzle-types = { workspace = true, features = ["arbitrary"] }
clvm-traits = { workspace = true }

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::fmt;

use chia_puzzles::{nft::NftMetadata, Proof};
use chia_puzzle_types::{nft::NftMetadata, Proof};
use clvm_traits::{FromClvm, ToClvm};
use clvmr::Allocator;
use libfuzzer_sys::arbitrary::{Arbitrary, Unstructured};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/chia-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ chia-protocol = { workspace = true }
chia-traits = { workspace = true }
clvm-utils = { workspace = true }
clvm-traits = { workspace = true }
chia-puzzles = { workspace = true }
chia-puzzle-types = { workspace = true }
chia-bls = { workspace = true }
chia-consensus = { workspace = true }
clvmr = { workspace = true, features = ["counters"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/chia-tools/src/bin/gen-corpus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use chia_traits::streamable::Streamable;

use chia_bls::G2Element;
use chia_protocol::{Bytes32, Coin, CoinSpend, Program, SpendBundle};
use chia_puzzles::singleton::SINGLETON_TOP_LAYER_PUZZLE_HASH;
use chia_puzzle_types::singleton::SINGLETON_TOP_LAYER_PUZZLE_HASH;
use clvm_traits::FromClvm;
use clvm_utils::{tree_hash, CurriedProgram};
use clvmr::allocator::NodePtr;
Expand Down
12 changes: 7 additions & 5 deletions crates/chia-tools/src/bin/run-spend.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
use chia_consensus::gen::conditions::Condition;
use chia_puzzles::Proof;
use chia_puzzle_types::Proof;
use chia_traits::Streamable;
use clap::Parser;
use clvm_traits::{FromClvm, ToClvm};
use clvm_utils::tree_hash;
use clvm_utils::CurriedProgram;
use clvmr::{allocator::NodePtr, Allocator};

use chia_puzzles::cat::{CatArgs, CatSolution, CAT_PUZZLE_HASH};
use chia_puzzles::did::{DidArgs, DidSolution, DID_INNER_PUZZLE_HASH};
use chia_puzzles::singleton::{SingletonArgs, SingletonSolution, SINGLETON_TOP_LAYER_PUZZLE_HASH};
use chia_puzzles::standard::{StandardArgs, StandardSolution, STANDARD_PUZZLE_HASH};
use chia_puzzle_types::cat::{CatArgs, CatSolution, CAT_PUZZLE_HASH};
use chia_puzzle_types::did::{DidArgs, DidSolution, DID_INNER_PUZZLE_HASH};
use chia_puzzle_types::singleton::{
SingletonArgs, SingletonSolution, SINGLETON_TOP_LAYER_PUZZLE_HASH,
};
use chia_puzzle_types::standard::{StandardArgs, StandardSolution, STANDARD_PUZZLE_HASH};

/// Run a puzzle given a solution and print the resulting conditions
#[derive(Parser, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub use chia_bls as bls;
pub use chia_client as client;
pub use chia_consensus as consensus;
pub use chia_protocol as protocol;
pub use chia_puzzles as puzzles;
pub use chia_puzzle_types as puzzles;
pub use chia_secp as secp;
pub use chia_sha2 as sha2;
pub use chia_ssl as ssl;
Expand Down

0 comments on commit 39f2398

Please sign in to comment.