Skip to content

Commit 6e9c7c4

Browse files
authored
Merge pull request #673 from Chia-Network/merkle_blob
`chia-datalayer`
2 parents 070826c + f227fb0 commit 6e9c7c4

File tree

15 files changed

+3077
-3
lines changed

15 files changed

+3077
-3
lines changed

Cargo.lock

+363-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+9
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ chia-bls = { workspace = true, optional = true }
5555
chia-secp = { workspace = true, optional = true }
5656
chia-client = { workspace = true, optional = true }
5757
chia-consensus = { workspace = true, optional = true }
58+
chia-datalayer = { workspace = true, optional = true }
5859
chia-protocol = { workspace = true, optional = true }
5960
chia-ssl = { workspace = true, optional = true }
6061
chia-traits = { workspace = true, optional = true }
@@ -75,6 +76,7 @@ default = [
7576
"secp",
7677
"client",
7778
"consensus",
79+
"datalayer",
7880
"protocol",
7981
"ssl",
8082
"traits",
@@ -88,6 +90,7 @@ bls = ["dep:chia-bls", "clvm-traits/chia-bls"]
8890
secp = ["dep:chia-secp", "clvm-traits/chia-secp"]
8991
client = ["dep:chia-client"]
9092
consensus = ["dep:chia-consensus"]
93+
datalayer = ["dep:chia-datalayer"]
9194
protocol = ["dep:chia-protocol"]
9295
ssl = ["dep:chia-ssl"]
9396
traits = ["dep:chia-traits"]
@@ -107,6 +110,7 @@ chia_streamable_macro = { path = "./crates/chia_streamable_macro", version = "0.
107110
chia-bls = { path = "./crates/chia-bls", version = "0.16.0" }
108111
chia-client = { path = "./crates/chia-client", version = "0.16.0" }
109112
chia-consensus = { path = "./crates/chia-consensus", version = "0.16.0" }
113+
chia-datalayer = { path = "./crates/chia-datalayer", version = "0.16.0" }
110114
chia-protocol = { path = "./crates/chia-protocol", version = "0.16.0" }
111115
chia-secp = { path = "./crates/chia-secp", version = "0.16.0" }
112116
chia-ssl = { path = "./crates/chia-ssl", version = "0.11.0" }
@@ -118,6 +122,7 @@ clvm-utils = { path = "./crates/clvm-utils", version = "0.16.0" }
118122
clvm-derive = { path = "./crates/clvm-derive", version = "0.13.0" }
119123
chia-fuzz = { path = "./crates/chia-consensus/fuzz", version = "0.16.0" }
120124
chia-bls-fuzz = { path = "./crates/chia-bls/fuzz", version = "0.16.0" }
125+
chia-datalayer-fuzz = { path = "./crates/chia-datalayer/fuzz", version = "0.16.0" }
121126
chia-protocol-fuzz = { path = "./crates/chia-protocol/fuzz", version = "0.16.0" }
122127
chia-puzzles-fuzz = { path = "./crates/chia-puzzles/fuzz", version = "0.16.0" }
123128
clvm-traits-fuzz = { path = "./crates/clvm-traits/fuzz", version = "0.16.0" }
@@ -138,6 +143,7 @@ arbitrary = "1.4.1"
138143
rand = "0.8.5"
139144
criterion = "0.5.1"
140145
rstest = "0.22.0"
146+
expect-test = "1.5.0"
141147
tokio = "1.42.0"
142148
tokio-tungstenite = "0.24.0"
143149
futures-util = "0.3.31"
@@ -160,3 +166,6 @@ openssl = "0.10.68"
160166
k256 = "0.13.4"
161167
p256 = "0.13.2"
162168
rand_chacha = "0.3.1"
169+
open = "5.3.0"
170+
url = "2.5.2"
171+
percent-encoding = "2.3.1"

crates/chia-datalayer/Cargo.toml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[package]
2+
name = "chia-datalayer"
3+
version = "0.16.0"
4+
edition = "2021"
5+
license = "Apache-2.0"
6+
description = "DataLayer modules for Chia blockchain"
7+
authors = ["Chia Network, Inc. <[email protected]>"]
8+
homepage = "https://github.com/Chia-Network/chia_rs"
9+
repository = "https://github.com/Chia-Network/chia_rs"
10+
11+
[lints]
12+
workspace = true
13+
14+
[features]
15+
py-bindings = ["dep:pyo3"]
16+
17+
[lib]
18+
crate-type = ["rlib"]
19+
20+
[dependencies]
21+
clvmr = { workspace = true }
22+
num-traits = { workspace = true }
23+
pyo3 = { workspace = true, optional = true }
24+
thiserror = { workspace = true }
25+
chia_streamable_macro = { workspace = true }
26+
chia-traits = { workspace = true }
27+
chia-sha2 = { workspace = true }
28+
chia-protocol = { workspace = true }
29+
30+
[dev-dependencies]
31+
clvm-utils = { workspace = true }
32+
expect-test = { workspace = true }
33+
hex = { workspace = true }
34+
hex-literal = { workspace = true }
35+
open = { workspace = true }
36+
percent-encoding = { workspace = true }
37+
rstest = { workspace = true }
38+
url = { workspace = true }
39+
40+
[package.metadata.cargo-machete]
41+
ignored = ["chia-sha2"]

crates/chia-datalayer/fuzz/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target
2+
corpus
3+
artifacts
4+
coverage

crates/chia-datalayer/fuzz/Cargo.toml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "chia-datalayer-fuzz"
3+
version = "0.16.0"
4+
publish = false
5+
edition = "2021"
6+
7+
[package.metadata]
8+
cargo-fuzz = true
9+
10+
[dependencies]
11+
libfuzzer-sys = "0.4"
12+
13+
[dependencies.chia-datalayer]
14+
path = ".."
15+
16+
[[bin]]
17+
name = "merkle_blob_new"
18+
path = "fuzz_targets/merkle_blob_new.rs"
19+
test = false
20+
doc = false
21+
bench = false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![no_main]
2+
3+
use libfuzzer_sys::{arbitrary::Unstructured, fuzz_target};
4+
5+
use chia_datalayer::{MerkleBlob, BLOCK_SIZE};
6+
7+
fuzz_target!(|data: &[u8]| {
8+
let mut unstructured = Unstructured::new(data);
9+
let block_count = unstructured.int_in_range(0..=1000).unwrap();
10+
let mut bytes = vec![0u8; block_count * BLOCK_SIZE];
11+
unstructured.fill_buffer(&mut bytes).unwrap();
12+
13+
let Ok(mut blob) = MerkleBlob::new(bytes) else {
14+
return;
15+
};
16+
blob.check_integrity_on_drop = false;
17+
let _ = blob.check_integrity();
18+
});

crates/chia-datalayer/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mod merkle;
2+
3+
pub use merkle::*;

0 commit comments

Comments
 (0)