Skip to content

Commit 06e656a

Browse files
committed
Merge #310: Release 0.6.0 of simplicity-lang and simplicity-sys
2d45fda bump version of simplicity-lang to 0.6.0 (Andrew Poelstra) b36efa2 bump version of simplicity-sys to 0.6.0 (Andrew Poelstra) 196a39d clean up README example; add some top-level docs to library (Andrew Poelstra) Pull request description: Cut a new release with the FFI fixes and ghostcell stuff. ACKs for top commit: canndrew: ACK 2d45fda Tree-SHA512: 2c6b23b0a8556f36bcc97aa9ec59de780347ce72debb032896000782d2a778aa590382e2a55373fbf45d1ec0b863e9a457c87e4fbea85759a4178c8dde375e9f
2 parents 8b56eb6 + 2d45fda commit 06e656a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2595
-2536
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 0.6.0 - 2025-09-17
2+
3+
* Improve FFI API and fix soundness issues [#307](https://github.com/BlockstreamResearch/rust-simplicity/pull/288)
4+
* Decrease MSRV to 1.74.0, matching rust-bitcoin [#308](https://github.com/BlockstreamResearch/rust-simplicity/pull/308)
5+
* Use `ghost_cell` within `types::Context`, requiring users to construct programs within a single Rust lexical scope [#305](https://github.com/BlockstreamResearch/rust-simplicity/pull/305)
6+
17
# 0.5.0 - 2025-07-29
28

39
* Add generic `CaseTracker` in bit machine for debugging [#288](https://github.com/BlockstreamResearch/rust-simplicity/pull/288)

Cargo-recent.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
425425
name = "simpcli"
426426
version = "0.3.0"
427427
dependencies = [
428-
"simplicity-lang 0.5.0",
428+
"simplicity-lang 0.6.0",
429429
]
430430

431431
[[package]]
@@ -435,7 +435,7 @@ dependencies = [
435435
"base64 0.22.1",
436436
"libfuzzer-sys",
437437
"simplicity-lang 0.3.1",
438-
"simplicity-lang 0.5.0",
438+
"simplicity-lang 0.6.0",
439439
]
440440

441441
[[package]]
@@ -455,7 +455,7 @@ dependencies = [
455455

456456
[[package]]
457457
name = "simplicity-lang"
458-
version = "0.5.0"
458+
version = "0.6.0"
459459
dependencies = [
460460
"bitcoin",
461461
"bitcoin_hashes",
@@ -467,7 +467,7 @@ dependencies = [
467467
"miniscript",
468468
"santiago",
469469
"serde",
470-
"simplicity-sys 0.5.0",
470+
"simplicity-sys 0.6.0",
471471
]
472472

473473
[[package]]
@@ -482,7 +482,7 @@ dependencies = [
482482

483483
[[package]]
484484
name = "simplicity-sys"
485-
version = "0.5.0"
485+
version = "0.6.0"
486486
dependencies = [
487487
"bitcoin_hashes",
488488
"cc",

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "simplicity-lang"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"]
55
license = "CC0-1.0"
66
homepage = "https://github.com/BlockstreamResearch/rust-simplicity/"
@@ -30,14 +30,14 @@ ghost-cell = { version = "0.2.6", default-features = false }
3030
hashes = { package = "bitcoin_hashes", version = "0.14" }
3131
hex = { package = "hex-conservative", version = "0.2.1" }
3232
santiago = "1.3"
33-
simplicity-sys = { version = "0.5.0", path = "./simplicity-sys" }
33+
simplicity-sys = { version = "0.6.0", path = "./simplicity-sys" }
3434
serde = { version = "1.0.103", features = ["derive"], optional = true }
3535

3636
[target.wasm32-unknown-unknown.dependencies]
3737
getrandom = { version = "0.2", features = ["js"] }
3838

3939
[dev-dependencies]
40-
simplicity-sys = { version = "0.5.0", path = "./simplicity-sys", features = [
40+
simplicity-sys = { version = "0.6.0", path = "./simplicity-sys", features = [
4141
"test-utils",
4242
] }
4343

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,19 @@ simplicity-lang = "0.5"
5858
```rust
5959
use simplicity::node::CoreConstructible;
6060
use simplicity::types::Context;
61-
use simplicity::{ConstructNode, Core};
61+
use simplicity::{ConstructNode, jet::Core};
6262
use std::sync::Arc;
6363

6464
// Create a trivial Simplicity program
65-
let ctx = Context::new();
66-
let program = Arc::<ConstructNode<Core>>::unit(&ctx);
65+
let program = Context::with_context(|ctx| {
66+
let construct = Arc::<ConstructNode<Core>>::unit(&ctx);
67+
construct.finalize_types().unwrap()
68+
});
6769

6870
// Encode the program to bytes
69-
let encoded = simplicity::bit_encoding::write_to_vec(|w| {
71+
let encoded: Vec<u8> = simplicity::write_to_vec(|w| {
7072
program.encode_without_witness(w)
71-
}).unwrap();
73+
});
7274
```
7375

7476
## Relationship to libsimplicity

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ path = "fuzz_lib/lib.rs"
1616
libfuzzer-sys = "0.4"
1717
# We shouldn't need an explicit version on the next line, but Andrew's tools
1818
# choke on it otherwise. See https://github.com/nix-community/crate2nix/issues/373
19-
simplicity-lang = { path = "..", features = ["test-utils"], version = "0.5.0" }
19+
simplicity-lang = { path = "..", features = ["test-utils"], version = "0.6.0" }
2020
old_simplicity = { package = "simplicity-lang", version = "0.3.1", default-features = false }
2121

2222
[dev-dependencies]

fuzz/generate-files.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ path = "fuzz_lib/lib.rs"
2727
libfuzzer-sys = "0.4"
2828
# We shouldn't need an explicit version on the next line, but Andrew's tools
2929
# choke on it otherwise. See https://github.com/nix-community/crate2nix/issues/373
30-
simplicity-lang = { path = "..", features = ["test-utils"], version = "0.4.0" }
30+
simplicity-lang = { path = "..", features = ["test-utils"], version = "0.6.0" }
3131
old_simplicity = { package = "simplicity-lang", version = "0.3.1", default-features = false }
3232
3333
[dev-dependencies]

simpcli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77

88
[dependencies]
99
# todo add lexopt for command line parsing
10-
simplicity-lang = { version = "0.5", path = "..", features = [ "base64", "serde", "elements" ] }
10+
simplicity-lang = { version = "0.6.0", path = "..", features = [ "base64", "serde", "elements" ] }
1111

1212
[[bin]]
1313
name = "simpcli"

simplicity-sys/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "simplicity-sys"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
license = "CC0-1.0"
55
homepage = "https://github.com/BlockstreamResearch/rust-simplicity/"
66
repository = "https://github.com/BlockstreamResearch/rust-simplicity/"
@@ -9,7 +9,7 @@ description = "FFI bindings to libsimplicity"
99
edition = "2021"
1010
rust-version = "1.74.0"
1111
build = "build.rs"
12-
links = "rustsimplicity_0_5"
12+
links = "rustsimplicity_0_6"
1313

1414
[build-dependencies]
1515
cc = "1.0.83"

simplicity-sys/depend/env.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ typedef rawElementsInput rawInput;
1111
typedef rawElementsTransaction rawTransaction;
1212
typedef rawElementsTapEnv rawTapEnv;
1313

14-
const size_t rustsimplicity_0_5_c_sizeof_rawElementsBuffer = sizeof(rawElementsBuffer);
15-
const size_t rustsimplicity_0_5_c_sizeof_rawElementsOutput = sizeof(rawElementsOutput);
16-
const size_t rustsimplicity_0_5_c_sizeof_rawElementsInput = sizeof(rawElementsInput);
17-
const size_t rustsimplicity_0_5_c_sizeof_rawElementsTransaction = sizeof(rawElementsTransaction);
18-
const size_t rustsimplicity_0_5_c_sizeof_rawElementsTapEnv = sizeof(rawElementsTapEnv);
19-
const size_t rustsimplicity_0_5_c_sizeof_txEnv = sizeof(txEnv);
14+
const size_t rustsimplicity_0_6_c_sizeof_rawElementsBuffer = sizeof(rawElementsBuffer);
15+
const size_t rustsimplicity_0_6_c_sizeof_rawElementsOutput = sizeof(rawElementsOutput);
16+
const size_t rustsimplicity_0_6_c_sizeof_rawElementsInput = sizeof(rawElementsInput);
17+
const size_t rustsimplicity_0_6_c_sizeof_rawElementsTransaction = sizeof(rawElementsTransaction);
18+
const size_t rustsimplicity_0_6_c_sizeof_rawElementsTapEnv = sizeof(rawElementsTapEnv);
19+
const size_t rustsimplicity_0_6_c_sizeof_txEnv = sizeof(txEnv);
2020

21-
const size_t rustsimplicity_0_5_c_alignof_rawElementsBuffer = alignof(rawElementsBuffer);
22-
const size_t rustsimplicity_0_5_c_alignof_rawElementsOutput = alignof(rawElementsOutput);
23-
const size_t rustsimplicity_0_5_c_alignof_rawElementsInput = alignof(rawElementsInput);
24-
const size_t rustsimplicity_0_5_c_alignof_rawElementsTransaction = alignof(rawElementsTransaction);
25-
const size_t rustsimplicity_0_5_c_alignof_rawElementsTapEnv = alignof(rawElementsTapEnv);
26-
const size_t rustsimplicity_0_5_c_alignof_txEnv = alignof(txEnv);
21+
const size_t rustsimplicity_0_6_c_alignof_rawElementsBuffer = alignof(rawElementsBuffer);
22+
const size_t rustsimplicity_0_6_c_alignof_rawElementsOutput = alignof(rawElementsOutput);
23+
const size_t rustsimplicity_0_6_c_alignof_rawElementsInput = alignof(rawElementsInput);
24+
const size_t rustsimplicity_0_6_c_alignof_rawElementsTransaction = alignof(rawElementsTransaction);
25+
const size_t rustsimplicity_0_6_c_alignof_rawElementsTapEnv = alignof(rawElementsTapEnv);
26+
const size_t rustsimplicity_0_6_c_alignof_txEnv = alignof(txEnv);
2727

28-
void rustsimplicity_0_5_c_set_txEnv(txEnv *result, const elementsTransaction *tx, const elementsTapEnv *taproot, const unsigned char *genesisHash, unsigned int ix)
28+
void rustsimplicity_0_6_c_set_txEnv(txEnv *result, const elementsTransaction *tx, const elementsTapEnv *taproot, const unsigned char *genesisHash, unsigned int ix)
2929
{
3030
sha256_midstate genesis;
3131
sha256_toMidstate(genesis.s, genesisHash);
32-
*result = rustsimplicity_0_5_elements_build_txEnv(tx, taproot, &genesis, ix);
32+
*result = rustsimplicity_0_6_elements_build_txEnv(tx, taproot, &genesis, ix);
3333
}

simplicity-sys/depend/simplicity/bitstream.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Precondition: NULL != stream
1212
*/
13-
simplicity_err rustsimplicity_0_5_closeBitstream(bitstream* stream) {
13+
simplicity_err rustsimplicity_0_6_closeBitstream(bitstream* stream) {
1414
if (1 < stream->len) return SIMPLICITY_ERR_BITSTREAM_TRAILING_BYTES; /* If there is more than one byte remaining. */
1515
if (1 == stream->len) {
1616
if (0 == stream->offset) return SIMPLICITY_ERR_BITSTREAM_TRAILING_BYTES; /* If there is one byte remaining */
@@ -30,8 +30,8 @@ simplicity_err rustsimplicity_0_5_closeBitstream(bitstream* stream) {
3030
* Precondition: 0 <= n < 32
3131
* NULL != stream
3232
*/
33-
int32_t rustsimplicity_0_5_readNBits(int n, bitstream* stream) {
34-
rustsimplicity_0_5_assert(0 <= n && n < 32);
33+
int32_t rustsimplicity_0_6_readNBits(int n, bitstream* stream) {
34+
rustsimplicity_0_6_assert(0 <= n && n < 32);
3535

3636
uint32_t result = 0;
3737
while (CHAR_BIT <= stream->offset + n) {
@@ -109,7 +109,7 @@ static int32_t decodeUpto3Bits(int32_t* result, bitstream* stream) {
109109
} else {
110110
int32_t n = decodeUpto3(stream);
111111
if (0 <= n) {
112-
*result = rustsimplicity_0_5_readNBits(n, stream);
112+
*result = rustsimplicity_0_6_readNBits(n, stream);
113113
if (*result < 0) return *result;
114114
}
115115
return n;
@@ -153,7 +153,7 @@ static int32_t decodeUpto15Bits(int32_t* result, bitstream* stream) {
153153
} else {
154154
int32_t n = decodeUpto15(stream);
155155
if (0 <= n) {
156-
*result = rustsimplicity_0_5_readNBits(n, stream);
156+
*result = rustsimplicity_0_6_readNBits(n, stream);
157157
if (*result < 0) return *result;
158158
}
159159
return n;
@@ -184,7 +184,7 @@ static int32_t decodeUpto65535(bitstream* stream) {
184184
*
185185
* Precondition: NULL != stream
186186
*/
187-
int32_t rustsimplicity_0_5_decodeUptoMaxInt(bitstream* stream) {
187+
int32_t rustsimplicity_0_6_decodeUptoMaxInt(bitstream* stream) {
188188
int32_t bit = read1Bit(stream);
189189
if (bit < 0) return bit;
190190
if (0 == bit) {
@@ -194,7 +194,7 @@ int32_t rustsimplicity_0_5_decodeUptoMaxInt(bitstream* stream) {
194194
if (n < 0) return n;
195195
if (30 < n) return SIMPLICITY_ERR_DATA_OUT_OF_RANGE;
196196
{
197-
int32_t result = rustsimplicity_0_5_readNBits(n, stream);
197+
int32_t result = rustsimplicity_0_6_readNBits(n, stream);
198198
if (result < 0) return result;
199199
return ((1 << n) | result);
200200
}
@@ -211,9 +211,9 @@ int32_t rustsimplicity_0_5_decodeUptoMaxInt(bitstream* stream) {
211211
* n <= 2^31
212212
* NULL != stream
213213
*/
214-
simplicity_err rustsimplicity_0_5_readBitstring(bitstring* result, size_t n, bitstream* stream) {
214+
simplicity_err rustsimplicity_0_6_readBitstring(bitstring* result, size_t n, bitstream* stream) {
215215
static_assert(0x80000000u + 2*(CHAR_BIT - 1) <= SIZE_MAX, "size_t needs to be at least 32-bits");
216-
rustsimplicity_0_5_assert(n <= 0x80000000u);
216+
rustsimplicity_0_6_assert(n <= 0x80000000u);
217217
size_t total_offset = n + stream->offset;
218218
/* |= stream->len * CHAR_BIT < total_offset iff stream->len < (total_offset + (CHAR_BIT - 1)) / CHAR_BIT */
219219
if (stream->len < (total_offset + (CHAR_BIT - 1)) / CHAR_BIT) return SIMPLICITY_ERR_BITSTREAM_EOF;

0 commit comments

Comments
 (0)