Skip to content

Commit 7d37b65

Browse files
committed
chore: update rust-simplicity dependency to git master and adapt to new API
Switch to later 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 6059156 commit 7d37b65

14 files changed

Lines changed: 62 additions & 85 deletions

Cargo.lock

Lines changed: 2 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ docs = []
3232
base64 = "0.21.2"
3333
serde = { version = "1.0.188", features = ["derive"], optional = true }
3434
serde_json = { version = "1.0.105", optional = true }
35-
simplicity-lang = { version = "0.7.0" }
35+
# simplicity-lang = { version = "0.7.0" }
36+
simplicity-lang = { git="https://github.com/BlockstreamResearch/rust-simplicity.git", branch="master" }
3637
miniscript = "12.3.1"
3738
either = "1.12.0"
3839
itertools = "0.13.0"

examples/escrow_with_delay.simf renamed to examples/deprecated/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() {
File renamed without changes.
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
}
File renamed without changes.
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/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

0 commit comments

Comments
 (0)