Skip to content

Commit 83f6c50

Browse files
committed
chore: update rust-simplicity dependency to git master and adapt to new API
Switch to master branch of rust-simplicity, which removes the `Jet` type parameter from nodes and renames broken lock distance/ duration jets. Update all call sites to match the new API and deprecate example files that use the renamed jets.
1 parent 88b6226 commit 83f6c50

12 files changed

Lines changed: 75 additions & 119 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ docs = []
3636
base64 = "0.21.2"
3737
serde = { version = "1.0.188", features = ["derive"], optional = true }
3838
serde_json = { version = "1.0.105", optional = true }
39-
simplicity-lang = { version = "0.7.0" }
39+
simplicity-lang = { version = "0.7.1" }
4040
miniscript = "12.3.1"
4141
either = "1.12.0"
4242
itertools = "0.13.0"

examples/escrow_with_delay.simf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn timeout_spend(sender_sig: Signature) {
5151
let sender_pk: Pubkey = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798; // 1 * G
5252
checksig(sender_pk, sender_sig);
5353
let timeout: Distance = 1000;
54-
jet::check_lock_distance(timeout);
54+
jet::broken_do_not_use_check_lock_distance(timeout);
5555
}
5656

5757
fn main() {

examples/last_will.simf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn recursive_covenant() {
2424

2525
fn inherit_spend(inheritor_sig: Signature) {
2626
let days_180: Distance = 25920;
27-
jet::check_lock_distance(days_180);
27+
jet::broken_do_not_use_check_lock_distance(days_180);
2828
let inheritor_pk: Pubkey = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798; // 1 * G
2929
checksig(inheritor_pk, inheritor_sig);
3030
}

examples/presigned_vault.simf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn checksig(pk: Pubkey, sig: Signature) {
2323

2424
fn complete_spend(hot_sig: Signature) {
2525
let timeout: Distance = 1000;
26-
jet::check_lock_distance(timeout);
26+
jet::broken_do_not_use_check_lock_distance(timeout);
2727
let hot_pk: Pubkey = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798; // 1 * G
2828
checksig(hot_pk, hot_sig);
2929
}

src/compile/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::value::StructuralValue;
2626
use crate::witness::Arguments;
2727
use crate::Value;
2828

29-
type ProgNode<'brand> = Arc<named::ConstructNode<'brand, Elements>>;
29+
type ProgNode<'brand> = Arc<named::ConstructNode<'brand>>;
3030

3131
/// Each SimplicityHL expression expects an _input value_.
3232
/// A SimplicityHL expression is translated into a Simplicity expression
@@ -263,7 +263,7 @@ impl Program {
263263
&self,
264264
arguments: Arguments,
265265
include_debug_symbols: bool,
266-
) -> Result<Arc<named::CommitNode<Elements>>, RichError> {
266+
) -> Result<Arc<named::CommitNode>, RichError> {
267267
types::Context::with_context(|ctx| {
268268
let mut scope = Scope::new(
269269
ctx,
@@ -379,7 +379,7 @@ impl Call {
379379

380380
match self.name() {
381381
CallName::Jet(name) => {
382-
let jet = ProgNode::jet(scope.ctx(), *name);
382+
let jet = ProgNode::jet(scope.ctx(), name);
383383
scope.with_debug_symbol(args, &jet, self)
384384
}
385385
CallName::UnwrapLeft(..) => {
@@ -410,7 +410,7 @@ impl Call {
410410
args.comp(&body).with_span(self)
411411
}
412412
CallName::Assert => {
413-
let jet = ProgNode::jet(scope.ctx(), Elements::Verify);
413+
let jet = ProgNode::jet(scope.ctx(), &Elements::Verify);
414414
scope.with_debug_symbol(args, &jet, self)
415415
}
416416
CallName::Panic => {

src/docs/jet.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,11 @@ Using the notation of BIP-0341, it returns the SHA256 hash of c[33: 33 + 32m]."#
607607
- The result of [`output_surjection_proofs_hash`] (32 bytes).
608608
- The result of [`input_utxos_hash`] (32 bytes)."#,
609609
// Time locks
610-
Elements::CheckLockDistance => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_distance`] is greater than or equal to the given value.
610+
Elements::BrokenDoNotUseCheckLockDistance => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_distance`] is greater than or equal to the given value.
611611
612612
## Panics
613613
The assertion fails."#,
614-
Elements::CheckLockDuration => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_duration`] is greater than or equal to the given value.
614+
Elements::BrokenDoNotUseCheckLockDuration => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_duration`] is greater than or equal to the given value.
615615
616616
## Panics
617617
The assertion fails"#,
@@ -624,8 +624,8 @@ The assertion fails."#,
624624
## Panics
625625
The assertion fails."#,
626626
Elements::TxIsFinal => "Check if the sequence numbers of all transaction inputs are at their maximum value.",
627-
Elements::TxLockDistance => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Distance`] value of any transaction input. Return zeroes otherwise.",
628-
Elements::TxLockDuration => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Duration`] value of any transaction input. Return zeroes otherwise.",
627+
Elements::BrokenDoNotUseTxLockDistance => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Distance`] value of any transaction input. Return zeroes otherwise.",
628+
Elements::BrokenDoNotUseTxLockDuration => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Duration`] value of any transaction input. Return zeroes otherwise.",
629629
Elements::TxLockHeight => "If [`tx_is_final`] returns false, then try to parse the transaction's lock time as a [`Height`] value. Return zeroes otherwise.",
630630
Elements::TxLockTime => "If [`tx_is_final`] returns false, then try to parse the transaction's lock time as a [`Time`] value. Return zeroes otherwise.",
631631
// Issuance
@@ -794,10 +794,10 @@ Return zero for any asset without fees."#,
794794
fn is_deprecated(&self) -> bool {
795795
matches!(
796796
self,
797-
Elements::CheckLockDistance
798-
| Elements::CheckLockDuration
799-
| Elements::TxLockDistance
800-
| Elements::TxLockDuration
797+
Elements::BrokenDoNotUseCheckLockDistance
798+
| Elements::BrokenDoNotUseCheckLockDuration
799+
| Elements::BrokenDoNotUseTxLockDistance
800+
| Elements::BrokenDoNotUseTxLockDuration
801801
| Elements::CheckSigVerify
802802
| Elements::Verify
803803
)
@@ -991,7 +991,7 @@ const SIGNATURE_HASH_MODES: [Elements; 35] = [
991991
];
992992
#[rustfmt::skip]
993993
const TIME_LOCKS: [Elements; 9] = [
994-
Elements::CheckLockDistance, Elements::CheckLockDuration, Elements::CheckLockHeight, Elements::CheckLockTime, Elements::TxIsFinal, Elements::TxLockDistance, Elements::TxLockDuration, Elements::TxLockHeight, Elements::TxLockTime
994+
Elements::BrokenDoNotUseCheckLockDistance, Elements::BrokenDoNotUseCheckLockDuration, Elements::CheckLockHeight, Elements::CheckLockTime, Elements::TxIsFinal, Elements::BrokenDoNotUseTxLockDistance, Elements::BrokenDoNotUseTxLockDuration, Elements::TxLockHeight, Elements::TxLockTime
995995
];
996996
#[rustfmt::skip]
997997
const ISSUANCE: [Elements; 9] = [

src/jet.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,12 @@ pub fn source_type(jet: Elements) -> Vec<AliasedType> {
450450
* Time locks
451451
*/
452452
Elements::CheckLockTime => vec![Time.into()],
453-
Elements::CheckLockDistance => vec![Distance.into()],
454-
Elements::CheckLockDuration => vec![Duration.into()],
453+
Elements::BrokenDoNotUseCheckLockDistance => vec![Distance.into()],
454+
Elements::BrokenDoNotUseCheckLockDuration => vec![Duration.into()],
455455
Elements::CheckLockHeight => vec![Height.into()],
456456
Elements::TxLockTime
457-
| Elements::TxLockDistance
458-
| Elements::TxLockDuration
457+
| Elements::BrokenDoNotUseTxLockDistance
458+
| Elements::BrokenDoNotUseTxLockDuration
459459
| Elements::TxLockHeight
460460
| Elements::TxIsFinal => vec![],
461461
/*
@@ -956,13 +956,13 @@ pub fn target_type(jet: Elements) -> AliasedType {
956956
* Time locks
957957
*/
958958
Elements::CheckLockTime
959-
| Elements::CheckLockDistance
960-
| Elements::CheckLockDuration
959+
| Elements::BrokenDoNotUseCheckLockDistance
960+
| Elements::BrokenDoNotUseCheckLockDuration
961961
| Elements::CheckLockHeight => AliasedType::unit(),
962962
Elements::TxIsFinal => bool(),
963963
Elements::TxLockTime => Time.into(),
964-
Elements::TxLockDistance => Distance.into(),
965-
Elements::TxLockDuration => Duration.into(),
964+
Elements::BrokenDoNotUseTxLockDistance => Distance.into(),
965+
Elements::BrokenDoNotUseTxLockDuration => Duration.into(),
966966
Elements::TxLockHeight => Height.into(),
967967
/*
968968
* Issuance

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mod witness;
2929
use std::sync::Arc;
3030

3131
use simplicity::jet::elements::ElementsEnv;
32-
use simplicity::{jet::Elements, CommitNode, RedeemNode};
32+
use simplicity::{CommitNode, RedeemNode};
3333

3434
pub extern crate either;
3535
pub extern crate simplicity;
@@ -174,7 +174,7 @@ impl TemplateProgram {
174174
/// A SimplicityHL program, compiled to Simplicity.
175175
#[derive(Clone, Debug)]
176176
pub struct CompiledProgram {
177-
simplicity: Arc<named::CommitNode<Elements>>,
177+
simplicity: Arc<named::CommitNode>,
178178
witness_types: WitnessTypes,
179179
debug_symbols: DebugSymbols,
180180
parameter_types: Parameters,
@@ -218,7 +218,7 @@ impl CompiledProgram {
218218
}
219219

220220
/// Access the Simplicity target code, without witness data.
221-
pub fn commit(&self) -> Arc<CommitNode<Elements>> {
221+
pub fn commit(&self) -> Arc<CommitNode> {
222222
named::forget_names(&self.simplicity)
223223
}
224224

@@ -275,7 +275,7 @@ pub struct AbiMeta {
275275
/// A SimplicityHL program, compiled to Simplicity and satisfied with witness data.
276276
#[derive(Clone, Debug, PartialEq, Eq)]
277277
pub struct SatisfiedProgram {
278-
simplicity: Arc<RedeemNode<Elements>>,
278+
simplicity: Arc<RedeemNode>,
279279
debug_symbols: DebugSymbols,
280280
}
281281

@@ -298,7 +298,7 @@ impl SatisfiedProgram {
298298
}
299299

300300
/// Access the Simplicity target code, including witness data.
301-
pub fn redeem(&self) -> &Arc<RedeemNode<Elements>> {
301+
pub fn redeem(&self) -> &Arc<RedeemNode> {
302302
&self.simplicity
303303
}
304304

0 commit comments

Comments
 (0)