From 3912f25a94f2c423f0e646e8597d00b58d97a156 Mon Sep 17 00:00:00 2001 From: topologoanatom Date: Thu, 5 Feb 2026 12:15:34 +0200 Subject: [PATCH 1/3] add deprecated timelock wrappers and sanity check --- Cargo.lock | 2 +- Cargo.toml | 2 +- codegen/src/jet.rs | 12 +++++++++++- src/jet.rs | 16 ++++++++++++++++ src/lib.rs | 40 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 68 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f78c57..5ecb678 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,7 +337,7 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "core" version = "0.1.0" -source = "git+https://github.com/BlockstreamResearch/simplicity-unchained.git?rev=f9196424bf3fbe5a3da36bd1f1e0bcb488574d2f#f9196424bf3fbe5a3da36bd1f1e0bcb488574d2f" +source = "git+https://github.com/BlockstreamResearch/simplicity-unchained.git?rev=663da9ed3b27e10c6a4a4a0919b5596cf9253402#663da9ed3b27e10c6a4a4a0919b5596cf9253402" dependencies = [ "hal-simplicity", "hex 0.4.3", diff --git a/Cargo.toml b/Cargo.toml index 615b761..4d58674 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ itertools = "0.13.0" arbitrary = { version = "1", optional = true, features = ["derive"] } clap = "4.5.37" -simplicity-unchained = { git = "https://github.com/BlockstreamResearch/simplicity-unchained.git", rev = "f9196424bf3fbe5a3da36bd1f1e0bcb488574d2f", package = "core"} +simplicity-unchained = { git = "https://github.com/BlockstreamResearch/simplicity-unchained.git", rev = "663da9ed3b27e10c6a4a4a0919b5596cf9253402", package = "core"} [target.wasm32-unknown-unknown.dependencies] getrandom = { version = "0.2", features = ["js"] } diff --git a/codegen/src/jet.rs b/codegen/src/jet.rs index ff9efda..66fd1e8 100644 --- a/codegen/src/jet.rs +++ b/codegen/src/jet.rs @@ -1,4 +1,6 @@ -use simplicityhl::simplicity_unchained::jets::elements::ElementsExtension; +use simplicityhl::simplicity_unchained::jets::elements::{ + ElementsExtension, ElementsTimelockDeprJets, +}; use simplicityhl::simplicity::jet::Elements; use std::fmt; @@ -805,6 +807,14 @@ Return zero for any asset without fees."#, ElementsExtension::GetPubkeyFromScript => r#"Each pubkey is encoded as: [OP_PUSHBYTES_33][0x02 or 0x03][32 bytes X coordinate]. Returns X only pubkeys from a script at the given index. Index should point to OP_PUSHBYTES_33 opcode in the script."#, + ElementsExtension::ElementsTimelockDeprJets(inner_jet) => { + match inner_jet { + ElementsTimelockDeprJets::CheckLockDistance => documentation(ElementsExtension::Elements(Elements::CheckLockDistance)), + ElementsTimelockDeprJets::CheckLockDuration => documentation(ElementsExtension::Elements(Elements::CheckLockDuration)), + ElementsTimelockDeprJets::TxLockDistance => documentation(ElementsExtension::Elements(Elements::TxLockDistance)), + ElementsTimelockDeprJets::TxLockDuration => documentation(ElementsExtension::Elements(Elements::TxLockDuration)), + } + } } } diff --git a/src/jet.rs b/src/jet.rs index 0d412a5..20aa594 100644 --- a/src/jet.rs +++ b/src/jet.rs @@ -8,6 +8,7 @@ use simplicity_unchained::jets::bitcoin::CoreExtension; use simplicity_unchained::jets::elements::ElementsExtension; use simplicity::jet::Elements; +use simplicity_unchained::jets::elements::ElementsTimelockDeprJets; fn tuple, I: IntoIterator>(elements: I) -> AliasedType { AliasedType::tuple(elements.into_iter().map(A::into)) @@ -624,6 +625,14 @@ pub fn source_type_elements_extension(jet: ElementsExtension) -> Vec vec![U8.into()], ElementsExtension::GetPubkeyFromScript => vec![U8.into()], + // Wrappers for deprecated jets + ElementsExtension::ElementsTimelockDeprJets(inner_jet) => match inner_jet { + ElementsTimelockDeprJets::CheckLockDistance => vec![Distance.into()], + ElementsTimelockDeprJets::CheckLockDuration => vec![Duration.into()], + ElementsTimelockDeprJets::TxLockDistance | ElementsTimelockDeprJets::TxLockDuration => { + vec![] + } + }, } } @@ -1615,6 +1624,13 @@ pub fn target_type_elements_extension(jet: ElementsExtension) -> AliasedType { */ ElementsExtension::GetOpcodeFromScript => U8.into(), ElementsExtension::GetPubkeyFromScript => Pubkey.into(), + // Deprecated jets wrapper + ElementsExtension::ElementsTimelockDeprJets(inner_jet) => match inner_jet { + ElementsTimelockDeprJets::CheckLockDistance + | ElementsTimelockDeprJets::CheckLockDuration => AliasedType::unit(), + ElementsTimelockDeprJets::TxLockDistance => Distance.into(), + ElementsTimelockDeprJets::TxLockDuration => Duration.into(), + }, } } diff --git a/src/lib.rs b/src/lib.rs index 9a1c535..7bfcddb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -330,6 +330,7 @@ pub(crate) mod tests { use std::borrow::Cow; use std::path::Path; + use crate::tracker::{DefaultTracker, TrackerLogLevel}; use crate::*; pub(crate) struct TestCase { @@ -473,7 +474,12 @@ pub(crate) mod tests { fn run(self) -> Result<(), simplicity::bit_machine::ExecutionError> { let env = dummy_env::dummy_with(self.lock_time, self.sequence, self.include_fee_output); - let pruned = self.program.redeem().prune(&env)?; + let mut tracker = DefaultTracker::new(self.program.debug_symbols()) + .with_log_level(TrackerLogLevel::Trace); + let pruned = self + .program + .redeem() + .prune_with_tracker(&env, &mut tracker)?; let mut mac = BitMachine::for_program(&pruned) .expect("program should be within reasonable bounds"); mac.exec(&pruned, &env).map(|_| ()) @@ -735,4 +741,36 @@ fn main() { .with_witness_values(WitnessValues::::default()) .assert_run_success(); } + + const LOCK_DISTANCE: &str = r#"fn main() { + let _: u16 = jet::tx_lock_distance(); + jet::check_lock_distance(10); +} +"#; + + const LOCK_DURATION: &str = r#"fn main() { + let _: u16 = jet::tx_lock_duration(); + jet::check_lock_duration(10); +} +"#; + + #[test] + fn test_timelock_sanity() { + let mut distance = TestCase::>::program_text( + std::borrow::Cow::Borrowed(LOCK_DISTANCE), + ); + distance.sequence = elements::Sequence::from_height(100); + + let mut duration = TestCase::>::program_text( + std::borrow::Cow::Borrowed(LOCK_DURATION), + ); + duration.sequence = elements::Sequence::from_512_second_intervals(100); + + distance + .with_witness_values(WitnessValues::default()) + .assert_run_success(); + duration + .with_witness_values(WitnessValues::default()) + .assert_run_success(); + } } From 1bcc7abcfc12533ab4775ce5aa2cf288a305508b Mon Sep 17 00:00:00 2001 From: topologoanatom Date: Mon, 9 Feb 2026 10:54:33 +0200 Subject: [PATCH 2/3] sync with origin --- Cargo.lock | 2 +- Cargo.toml | 2 +- codegen/src/jet.rs | 12 +----------- src/jet.rs | 16 ---------------- 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ecb678..9a9e8c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,7 +337,7 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "core" version = "0.1.0" -source = "git+https://github.com/BlockstreamResearch/simplicity-unchained.git?rev=663da9ed3b27e10c6a4a4a0919b5596cf9253402#663da9ed3b27e10c6a4a4a0919b5596cf9253402" +source = "git+https://github.com/BlockstreamResearch/simplicity-unchained.git?rev=205c56ec85528643121c71cbff5262ab8ca64de9#205c56ec85528643121c71cbff5262ab8ca64de9" dependencies = [ "hal-simplicity", "hex 0.4.3", diff --git a/Cargo.toml b/Cargo.toml index 4d58674..652cf13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ itertools = "0.13.0" arbitrary = { version = "1", optional = true, features = ["derive"] } clap = "4.5.37" -simplicity-unchained = { git = "https://github.com/BlockstreamResearch/simplicity-unchained.git", rev = "663da9ed3b27e10c6a4a4a0919b5596cf9253402", package = "core"} +simplicity-unchained = { git = "https://github.com/BlockstreamResearch/simplicity-unchained.git", rev = "205c56ec85528643121c71cbff5262ab8ca64de9", package = "core"} [target.wasm32-unknown-unknown.dependencies] getrandom = { version = "0.2", features = ["js"] } diff --git a/codegen/src/jet.rs b/codegen/src/jet.rs index 66fd1e8..ff9efda 100644 --- a/codegen/src/jet.rs +++ b/codegen/src/jet.rs @@ -1,6 +1,4 @@ -use simplicityhl::simplicity_unchained::jets::elements::{ - ElementsExtension, ElementsTimelockDeprJets, -}; +use simplicityhl::simplicity_unchained::jets::elements::ElementsExtension; use simplicityhl::simplicity::jet::Elements; use std::fmt; @@ -807,14 +805,6 @@ Return zero for any asset without fees."#, ElementsExtension::GetPubkeyFromScript => r#"Each pubkey is encoded as: [OP_PUSHBYTES_33][0x02 or 0x03][32 bytes X coordinate]. Returns X only pubkeys from a script at the given index. Index should point to OP_PUSHBYTES_33 opcode in the script."#, - ElementsExtension::ElementsTimelockDeprJets(inner_jet) => { - match inner_jet { - ElementsTimelockDeprJets::CheckLockDistance => documentation(ElementsExtension::Elements(Elements::CheckLockDistance)), - ElementsTimelockDeprJets::CheckLockDuration => documentation(ElementsExtension::Elements(Elements::CheckLockDuration)), - ElementsTimelockDeprJets::TxLockDistance => documentation(ElementsExtension::Elements(Elements::TxLockDistance)), - ElementsTimelockDeprJets::TxLockDuration => documentation(ElementsExtension::Elements(Elements::TxLockDuration)), - } - } } } diff --git a/src/jet.rs b/src/jet.rs index 20aa594..0d412a5 100644 --- a/src/jet.rs +++ b/src/jet.rs @@ -8,7 +8,6 @@ use simplicity_unchained::jets::bitcoin::CoreExtension; use simplicity_unchained::jets::elements::ElementsExtension; use simplicity::jet::Elements; -use simplicity_unchained::jets::elements::ElementsTimelockDeprJets; fn tuple, I: IntoIterator>(elements: I) -> AliasedType { AliasedType::tuple(elements.into_iter().map(A::into)) @@ -625,14 +624,6 @@ pub fn source_type_elements_extension(jet: ElementsExtension) -> Vec vec![U8.into()], ElementsExtension::GetPubkeyFromScript => vec![U8.into()], - // Wrappers for deprecated jets - ElementsExtension::ElementsTimelockDeprJets(inner_jet) => match inner_jet { - ElementsTimelockDeprJets::CheckLockDistance => vec![Distance.into()], - ElementsTimelockDeprJets::CheckLockDuration => vec![Duration.into()], - ElementsTimelockDeprJets::TxLockDistance | ElementsTimelockDeprJets::TxLockDuration => { - vec![] - } - }, } } @@ -1624,13 +1615,6 @@ pub fn target_type_elements_extension(jet: ElementsExtension) -> AliasedType { */ ElementsExtension::GetOpcodeFromScript => U8.into(), ElementsExtension::GetPubkeyFromScript => Pubkey.into(), - // Deprecated jets wrapper - ElementsExtension::ElementsTimelockDeprJets(inner_jet) => match inner_jet { - ElementsTimelockDeprJets::CheckLockDistance - | ElementsTimelockDeprJets::CheckLockDuration => AliasedType::unit(), - ElementsTimelockDeprJets::TxLockDistance => Distance.into(), - ElementsTimelockDeprJets::TxLockDuration => Duration.into(), - }, } } From 7c3a7947f29dc4f0f98ceeaf2c194ee889abe182 Mon Sep 17 00:00:00 2001 From: topologoanatom Date: Wed, 11 Feb 2026 10:53:29 +0200 Subject: [PATCH 3/3] reference commit --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a9e8c7..6e247f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,7 +337,7 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "core" version = "0.1.0" -source = "git+https://github.com/BlockstreamResearch/simplicity-unchained.git?rev=205c56ec85528643121c71cbff5262ab8ca64de9#205c56ec85528643121c71cbff5262ab8ca64de9" +source = "git+https://github.com/BlockstreamResearch/simplicity-unchained.git?rev=26625522e11e21c441773a347c3546ce1b72397f#26625522e11e21c441773a347c3546ce1b72397f" dependencies = [ "hal-simplicity", "hex 0.4.3", diff --git a/Cargo.toml b/Cargo.toml index 652cf13..bd1c44d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ itertools = "0.13.0" arbitrary = { version = "1", optional = true, features = ["derive"] } clap = "4.5.37" -simplicity-unchained = { git = "https://github.com/BlockstreamResearch/simplicity-unchained.git", rev = "205c56ec85528643121c71cbff5262ab8ca64de9", package = "core"} +simplicity-unchained = { git = "https://github.com/BlockstreamResearch/simplicity-unchained.git", rev = "26625522e11e21c441773a347c3546ce1b72397f", package = "core"} [target.wasm32-unknown-unknown.dependencies] getrandom = { version = "0.2", features = ["js"] }