Skip to content

Commit 4c6a841

Browse files
committed
Merge BlockstreamResearch#280: fuzz: add regression test for value encoding
d3b240d fuzz: add regression fuzztest for value encoding (Andrew Poelstra) ea61344 fuzz: add value construction fuzz test (Andrew Poelstra) aa415af value: add typeskip optimization for compact decoding (Andrew Poelstra) c06d581 value: cap maximum initial allocation (Andrew Poelstra) fe44b28 fuzz: add lib; add target that constructs a type to demo it (Andrew Poelstra) Pull request description: Despite the branch name this does *not* fix the Windows build. It adds a regression test for value encoding, which after running 250 CPU-hours locally has failed to find any regressions. But I did find some unrelated issues, mainly around memory allocations. Fixes BlockstreamResearch#279 Fixes BlockstreamResearch#278 ACKs for top commit: uncomputable: ACK d3b240d Tree-SHA512: ee5b902a97fa57472c7ad40aebb5ab6a2275711f7c37a0eb25286cbbf7504393ac6a1dadf2fdf271cd7366501eaf41bc978346cc8f5f62997cd8a904614118a0
2 parents 54f8f7f + d3b240d commit 4c6a841

File tree

9 files changed

+571
-8
lines changed

9 files changed

+571
-8
lines changed

.github/workflows/fuzz.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
fuzz_target: [
20+
construct_type,
21+
construct_value,
2022
c_rust_merkle,
2123
decode_natural,
2224
decode_program,
2325
parse_human,
26+
regression_value,
2427
]
2528
steps:
2629
- name: Checkout Crate

Cargo-recent.lock

+29-3
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ name = "simpcli"
419419
version = "0.3.0"
420420
dependencies = [
421421
"base64 0.21.7",
422-
"simplicity-lang",
422+
"simplicity-lang 0.4.0",
423423
]
424424

425425
[[package]]
@@ -428,7 +428,23 @@ version = "0.0.1"
428428
dependencies = [
429429
"base64 0.22.1",
430430
"libfuzzer-sys",
431-
"simplicity-lang",
431+
"simplicity-lang 0.3.1",
432+
"simplicity-lang 0.4.0",
433+
]
434+
435+
[[package]]
436+
name = "simplicity-lang"
437+
version = "0.3.1"
438+
source = "registry+https://github.com/rust-lang/crates.io-index"
439+
checksum = "d75c8fb4a18e63fbce4cf16026c36a6c38066e4f4a09ce5e81be817d0e36d8f8"
440+
dependencies = [
441+
"bitcoin_hashes",
442+
"byteorder",
443+
"getrandom",
444+
"hex-conservative 0.1.2",
445+
"miniscript",
446+
"santiago",
447+
"simplicity-sys 0.3.0",
432448
]
433449

434450
[[package]]
@@ -444,7 +460,17 @@ dependencies = [
444460
"miniscript",
445461
"santiago",
446462
"serde",
447-
"simplicity-sys",
463+
"simplicity-sys 0.4.0",
464+
]
465+
466+
[[package]]
467+
name = "simplicity-sys"
468+
version = "0.3.0"
469+
source = "registry+https://github.com/rust-lang/crates.io-index"
470+
checksum = "4cd2cc5d458a8032d328ea85e824f54f61664ab84c3d42b3b7f8804fb9b81572"
471+
dependencies = [
472+
"bitcoin_hashes",
473+
"cc",
448474
]
449475

450476
[[package]]

fuzz/Cargo.toml

+28-1
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,36 @@ publish = false
99
[package.metadata]
1010
cargo-fuzz = true
1111

12+
[lib]
13+
path = "fuzz_lib/lib.rs"
14+
1215
[dependencies]
1316
libfuzzer-sys = "0.4"
14-
simplicity-lang = { path = "..", features = ["test-utils"] }
17+
# We shouldn't need an explicit version on the next line, but Andrew's tools
18+
# choke on it otherwise. See https://github.com/nix-community/crate2nix/issues/373
19+
simplicity-lang = { path = "..", features = ["test-utils"], version = "0.4.0" }
20+
old_simplicity = { package = "simplicity-lang", version = "0.3.1", default-features = false }
1521

1622
[dev-dependencies]
1723
base64 = "0.22.1"
1824

1925
[lints.rust]
2026
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
2127

28+
[[bin]]
29+
name = "construct_type"
30+
path = "fuzz_targets/construct_type.rs"
31+
test = false
32+
doc = false
33+
bench = false
34+
35+
[[bin]]
36+
name = "construct_value"
37+
path = "fuzz_targets/construct_value.rs"
38+
test = false
39+
doc = false
40+
bench = false
41+
2242
[[bin]]
2343
name = "c_rust_merkle"
2444
path = "fuzz_targets/c_rust_merkle.rs"
@@ -46,3 +66,10 @@ path = "fuzz_targets/parse_human.rs"
4666
test = false
4767
doc = false
4868
bench = false
69+
70+
[[bin]]
71+
name = "regression_value"
72+
path = "fuzz_targets/regression_value.rs"
73+
test = false
74+
doc = false
75+
bench = false

0 commit comments

Comments
 (0)