-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #673 from Chia-Network/merkle_blob
`chia-datalayer`
- Loading branch information
Showing
15 changed files
with
3,077 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[package] | ||
name = "chia-datalayer" | ||
version = "0.16.0" | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
description = "DataLayer modules for Chia blockchain" | ||
authors = ["Chia Network, Inc. <[email protected]>"] | ||
homepage = "https://github.com/Chia-Network/chia_rs" | ||
repository = "https://github.com/Chia-Network/chia_rs" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[features] | ||
py-bindings = ["dep:pyo3"] | ||
|
||
[lib] | ||
crate-type = ["rlib"] | ||
|
||
[dependencies] | ||
clvmr = { workspace = true } | ||
num-traits = { workspace = true } | ||
pyo3 = { workspace = true, optional = true } | ||
thiserror = { workspace = true } | ||
chia_streamable_macro = { workspace = true } | ||
chia-traits = { workspace = true } | ||
chia-sha2 = { workspace = true } | ||
chia-protocol = { workspace = true } | ||
|
||
[dev-dependencies] | ||
clvm-utils = { workspace = true } | ||
expect-test = { workspace = true } | ||
hex = { workspace = true } | ||
hex-literal = { workspace = true } | ||
open = { workspace = true } | ||
percent-encoding = { workspace = true } | ||
rstest = { workspace = true } | ||
url = { workspace = true } | ||
|
||
[package.metadata.cargo-machete] | ||
ignored = ["chia-sha2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
corpus | ||
artifacts | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "chia-datalayer-fuzz" | ||
version = "0.16.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
|
||
[dependencies.chia-datalayer] | ||
path = ".." | ||
|
||
[[bin]] | ||
name = "merkle_blob_new" | ||
path = "fuzz_targets/merkle_blob_new.rs" | ||
test = false | ||
doc = false | ||
bench = false |
18 changes: 18 additions & 0 deletions
18
crates/chia-datalayer/fuzz/fuzz_targets/merkle_blob_new.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![no_main] | ||
|
||
use libfuzzer_sys::{arbitrary::Unstructured, fuzz_target}; | ||
|
||
use chia_datalayer::{MerkleBlob, BLOCK_SIZE}; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
let mut unstructured = Unstructured::new(data); | ||
let block_count = unstructured.int_in_range(0..=1000).unwrap(); | ||
let mut bytes = vec![0u8; block_count * BLOCK_SIZE]; | ||
unstructured.fill_buffer(&mut bytes).unwrap(); | ||
|
||
let Ok(mut blob) = MerkleBlob::new(bytes) else { | ||
return; | ||
}; | ||
blob.check_integrity_on_drop = false; | ||
let _ = blob.check_integrity(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod merkle; | ||
|
||
pub use merkle::*; |
Oops, something went wrong.