From f592bd8e5701e3ca20d5e82f29efafe9d1975f11 Mon Sep 17 00:00:00 2001 From: aritkulova Date: Fri, 19 Jun 2026 14:39:50 +0300 Subject: [PATCH 1/5] updated contracts to use modules and imports --- simf/{mock => }/asserts_mock.simf | 52 +------------------- simf/helper.simf | 3 ++ simf/{ => lib}/asserts.simf | 25 +++++----- simf/{ => lib}/logical_operations.simf | 9 ++-- simf/{mock => }/logical_operations_mock.simf | 13 +---- tests/asserts_test.rs | 4 +- tests/logical_operations_test.rs | 4 +- 7 files changed, 24 insertions(+), 86 deletions(-) rename simf/{mock => }/asserts_mock.simf (72%) create mode 100644 simf/helper.simf rename simf/{ => lib}/asserts.simf (65%) rename simf/{ => lib}/logical_operations.simf (69%) rename simf/{mock => }/logical_operations_mock.simf (50%) diff --git a/simf/mock/asserts_mock.simf b/simf/asserts_mock.simf similarity index 72% rename from simf/mock/asserts_mock.simf rename to simf/asserts_mock.simf index fe2fb62..32daeb6 100644 --- a/simf/mock/asserts_mock.simf +++ b/simf/asserts_mock.simf @@ -1,54 +1,6 @@ -// todo: switch to function import when available -fn assert_eq_8(a: u8, b: u8) { // 0 - assert!(jet::eq_8(a, b)); -} - -fn assert_eq_16(a: u16, b: u16) { // 1 - assert!(jet::eq_16(a, b)); -} - -fn assert_eq_32(a: u32, b: u32) { // 2 - assert!(jet::eq_32(a, b)); -} - -fn assert_eq_64(a: u64, b: u64) { // 3 - assert!(jet::eq_64(a, b)); -} - -// todo: assert_eq_128 - -fn assert_eq_256(a: u256, b: u256) { // 4 - assert!(jet::eq_256(a, b)); -} - -fn assert_none_8(val: Option) { // 5 - assert!(is_none::(val)); -} +use crate::lib::asserts::{assert_eq_8, assert_eq_16, assert_eq_32, assert_eq_64, assert_eq_256, assert_none_8, assert_none_16, assert_none_32, assert_none_64,assert_none_128, assert_none_256}; -fn assert_none_16(val: Option) { // 6 - assert!(is_none::(val)); -} - -fn assert_none_32(val: Option) { // 7 - assert!(is_none::(val)); -} - -fn assert_none_64(val: Option) { // 8 - assert!(is_none::(val)); -} - -fn assert_none_128(val: Option) { // 9 - assert!(is_none::(val)); -} - -fn assert_none_256(val: Option) { // 10 - assert!(is_none::(val)); -} - -// helper -fn if_test_this_function(index: u8, flag: u8) -> bool { - jet::eq_8(index, flag) -} +use crate::helper::if_test_this_function; fn main() { let function_index: u8 = witness::FUNCTION_INDEX; diff --git a/simf/helper.simf b/simf/helper.simf new file mode 100644 index 0000000..60ae726 --- /dev/null +++ b/simf/helper.simf @@ -0,0 +1,3 @@ +pub fn if_test_this_function(index: u8, flag: u8) -> bool { + jet::eq_8(index, flag) +} diff --git a/simf/asserts.simf b/simf/lib/asserts.simf similarity index 65% rename from simf/asserts.simf rename to simf/lib/asserts.simf index 7707a59..e5121d4 100644 --- a/simf/asserts.simf +++ b/simf/lib/asserts.simf @@ -1,59 +1,56 @@ /// Asserts that two u8 are equal -fn assert_eq_8(a: u8, b: u8) { +pub fn assert_eq_8(a: u8, b: u8) { assert!(jet::eq_8(a, b)); } /// Asserts that two u16 are equal -fn assert_eq_16(a: u16, b: u16) { +pub fn assert_eq_16(a: u16, b: u16) { assert!(jet::eq_16(a, b)); } /// Asserts that two u32 are equal -fn assert_eq_32(a: u32, b: u32) { +pub fn assert_eq_32(a: u32, b: u32) { assert!(jet::eq_32(a, b)); } /// Asserts that two u64 are equal -fn assert_eq_64(a: u64, b: u64) { +pub fn assert_eq_64(a: u64, b: u64) { assert!(jet::eq_64(a, b)); } // todo: assert_eq_128 /// Asserts that two u256 are equal -fn assert_eq_256(a: u256, b: u256) { +pub fn assert_eq_256(a: u256, b: u256) { assert!(jet::eq_256(a, b)); } /// Asserts that provided u8 Option value is a None -fn assert_none_8(val: Option) { +pub fn assert_none_8(val: Option) { assert!(is_none::(val)); } /// Asserts that provided u16 Option value is a None -fn assert_none_16(val: Option) { +pub fn assert_none_16(val: Option) { assert!(is_none::(val)); } /// Asserts that provided u32 Option value is a None -fn assert_none_32(val: Option) { +pub fn assert_none_32(val: Option) { assert!(is_none::(val)); } /// Asserts that provided u64 Option value is a None -fn assert_none_64(val: Option) { +pub fn assert_none_64(val: Option) { assert!(is_none::(val)); } /// Asserts that provided u128 Option value is a None -fn assert_none_128(val: Option) { +pub fn assert_none_128(val: Option) { assert!(is_none::(val)); } /// Asserts that provided u256 Option value is a None -fn assert_none_256(val: Option) { +pub fn assert_none_256(val: Option) { assert!(is_none::(val)); } - -// todo: remove after module functionality is implemented -fn main() {} diff --git a/simf/logical_operations.simf b/simf/lib/logical_operations.simf similarity index 69% rename from simf/logical_operations.simf rename to simf/lib/logical_operations.simf index a8b94de..63ea8e6 100644 --- a/simf/logical_operations.simf +++ b/simf/lib/logical_operations.simf @@ -1,17 +1,14 @@ /// Returns the result of the NOT operation on the provided value -fn not(bit: bool) -> bool { +pub fn not(bit: bool) -> bool { ::into(jet::complement_1(::into(bit))) } /// Returns the result of the OR operation on the provided values -fn or(a: bool, b: bool) -> bool { +pub fn or(a: bool, b: bool) -> bool { ::into(jet::or_1(::into(a), ::into(b))) } /// Returns the result of the AND operation on the provided values -fn and(a: bool, b: bool) -> bool { +pub fn and(a: bool, b: bool) -> bool { ::into(jet::and_1(::into(a), ::into(b))) } - -// todo: remove after module functionality is implemented -fn main() {} diff --git a/simf/mock/logical_operations_mock.simf b/simf/logical_operations_mock.simf similarity index 50% rename from simf/mock/logical_operations_mock.simf rename to simf/logical_operations_mock.simf index 4ab4e22..e428ec6 100644 --- a/simf/mock/logical_operations_mock.simf +++ b/simf/logical_operations_mock.simf @@ -1,15 +1,4 @@ -// todo: switch to function import when available -fn not(bit: bool) -> bool { - ::into(jet::complement_1(::into(bit))) -} - -fn or(a: bool, b: bool) -> bool { - ::into(jet::or_1(::into(a), ::into(b))) -} - -fn and(a: bool, b: bool) -> bool { - ::into(jet::and_1(::into(a), ::into(b))) -} +use crate::lib::logical_operations::{not, or, and}; fn main() { assert!(not(false)); diff --git a/tests/asserts_test.rs b/tests/asserts_test.rs index b593cee..70244de 100644 --- a/tests/asserts_test.rs +++ b/tests/asserts_test.rs @@ -2,8 +2,8 @@ use simplex::simplicityhl::elements::Script; use simplex::transaction::{FinalTransaction, PartialInput, ProgramInput, RequiredSignature}; -use simplicityhl_std::artifacts::mock::asserts_mock::AssertsMockProgram; -use simplicityhl_std::artifacts::mock::asserts_mock::derived_asserts_mock::{ +use simplicityhl_std::artifacts::asserts_mock::AssertsMockProgram; +use simplicityhl_std::artifacts::asserts_mock::derived_asserts_mock::{ AssertsMockArguments, AssertsMockWitness, }; diff --git a/tests/logical_operations_test.rs b/tests/logical_operations_test.rs index 035211d..55fb092 100644 --- a/tests/logical_operations_test.rs +++ b/tests/logical_operations_test.rs @@ -2,8 +2,8 @@ use simplex::simplicityhl::elements::Script; use simplex::transaction::{FinalTransaction, PartialInput, ProgramInput, RequiredSignature}; -use simplicityhl_std::artifacts::mock::logical_operations_mock::LogicalOperationsMockProgram; -use simplicityhl_std::artifacts::mock::logical_operations_mock::derived_logical_operations_mock::{ +use simplicityhl_std::artifacts::logical_operations_mock::LogicalOperationsMockProgram; +use simplicityhl_std::artifacts::logical_operations_mock::derived_logical_operations_mock::{ LogicalOperationsMockArguments, LogicalOperationsMockWitness, }; From b406e37a67a6410202935343060defc569977331 Mon Sep 17 00:00:00 2001 From: aritkulova Date: Tue, 23 Jun 2026 20:37:13 +0300 Subject: [PATCH 2/5] updated u8, u16, u32 and u64 contracts to use modules and imports --- simf/{ => lib}/u16.simf | 19 ++++++-------- simf/{ => lib}/u32.simf | 19 ++++++-------- simf/{ => lib}/u64.simf | 19 ++++++-------- simf/{ => lib}/u8.simf | 19 ++++++-------- simf/u16_mock.simf | 58 ++--------------------------------------- simf/u32_mock.simf | 58 ++--------------------------------------- simf/u64_mock.simf | 58 ++--------------------------------------- simf/u8_mock.simf | 58 ++--------------------------------------- tests/u16_test.rs | 6 ++--- tests/u32_test.rs | 6 ++--- tests/u64_test.rs | 6 ++--- tests/u8_test.rs | 4 +-- 12 files changed, 48 insertions(+), 282 deletions(-) rename simf/{ => lib}/u16.simf (76%) rename simf/{ => lib}/u32.simf (76%) rename simf/{ => lib}/u64.simf (76%) rename simf/{ => lib}/u8.simf (77%) diff --git a/simf/u16.simf b/simf/lib/u16.simf similarity index 76% rename from simf/u16.simf rename to simf/lib/u16.simf index f868482..4b1da2a 100644 --- a/simf/u16.simf +++ b/simf/lib/u16.simf @@ -1,5 +1,5 @@ /// Returns the sum of two u16 values wrapped in Some, or None if the result overflows u16 -fn checked_add_16(a: u16, b: u16) -> Option { +pub fn checked_add_16(a: u16, b: u16) -> Option { let (carry, sum): (bool, u16) = jet::add_16(a, b); match carry { @@ -9,12 +9,12 @@ fn checked_add_16(a: u16, b: u16) -> Option { } /// Returns the sum of two u16 values, panics if the result overflows u16 -fn safe_add_16(a: u16, b: u16) -> u16 { +pub fn safe_add_16(a: u16, b: u16) -> u16 { unwrap(checked_add_16(a, b)) } /// Returns the difference of two u16 values wrapped in Some, or None if the result overflows u16 -fn checked_sub_16(a: u16, b: u16) -> Option { +pub fn checked_sub_16(a: u16, b: u16) -> Option { let (borrow, diff): (bool, u16) = jet::subtract_16(a, b); match borrow { @@ -24,12 +24,12 @@ fn checked_sub_16(a: u16, b: u16) -> Option { } /// Returns the difference of two u16 values, panics if the result overflows u16 -fn safe_sub_16(a: u16, b: u16) -> u16 { +pub fn safe_sub_16(a: u16, b: u16) -> u16 { unwrap(checked_sub_16(a, b)) } /// Returns the product of two u16 values wrapped in Some, or None if the result overflows u16 -fn checked_mul_16(a: u16, b: u16) -> Option { +pub fn checked_mul_16(a: u16, b: u16) -> Option { let result: u32 = jet::multiply_16(a, b); let (high, low): (u16, u16) = ::into(result); @@ -41,12 +41,12 @@ fn checked_mul_16(a: u16, b: u16) -> Option { } /// Returns the product of two u16 values, panics if the result overflows u16 -fn safe_mul_16(a: u16, b: u16) -> u16 { +pub fn safe_mul_16(a: u16, b: u16) -> u16 { unwrap(checked_mul_16(a, b)) } /// Returns the quotient of two u16 values wrapped in Some, or None if the result overflows u16 -fn checked_div_16(a: u16, b: u16) -> Option { +pub fn checked_div_16(a: u16, b: u16) -> Option { match jet::is_zero_16(b) { true => None, false => Some(jet::divide_16(a, b)), @@ -54,9 +54,6 @@ fn checked_div_16(a: u16, b: u16) -> Option { } /// Returns the quotient of two u16 values, panics if the result overflows u16 -fn safe_div_16(a: u16, b: u16) -> u16 { +pub fn safe_div_16(a: u16, b: u16) -> u16 { unwrap(checked_div_16(a, b)) } - -// todo: remove after module functionality is implemented -fn main() {} diff --git a/simf/u32.simf b/simf/lib/u32.simf similarity index 76% rename from simf/u32.simf rename to simf/lib/u32.simf index 500e9cb..909fc56 100644 --- a/simf/u32.simf +++ b/simf/lib/u32.simf @@ -1,5 +1,5 @@ /// Returns the sum of two u32 values wrapped in Some, or None if the result overflows u32 -fn checked_add_32(a: u32, b: u32) -> Option { +pub fn checked_add_32(a: u32, b: u32) -> Option { let (carry, sum): (bool, u32) = jet::add_32(a, b); match carry { @@ -9,12 +9,12 @@ fn checked_add_32(a: u32, b: u32) -> Option { } /// Returns the sum of two u32 values, panics if the result overflows u32 -fn safe_add_32(a: u32, b: u32) -> u32 { +pub fn safe_add_32(a: u32, b: u32) -> u32 { unwrap(checked_add_32(a, b)) } /// Returns the sum of two u32 values, panics if the result overflows u32 -fn checked_sub_32(a: u32, b: u32) -> Option { +pub fn checked_sub_32(a: u32, b: u32) -> Option { let (borrow, diff): (bool, u32) = jet::subtract_32(a, b); match borrow { @@ -24,12 +24,12 @@ fn checked_sub_32(a: u32, b: u32) -> Option { } /// Returns the difference of two u32 values, panics if the result overflows u32 -fn safe_sub_32(a: u32, b: u32) -> u32 { +pub fn safe_sub_32(a: u32, b: u32) -> u32 { unwrap(checked_sub_32(a, b)) } /// Returns the product of two u32 values wrapped in Some, or None if the result overflows u32 -fn checked_mul_32(a: u32, b: u32) -> Option { +pub fn checked_mul_32(a: u32, b: u32) -> Option { let result: u64 = jet::multiply_32(a, b); let (high, low): (u32, u32) = ::into(result); @@ -41,12 +41,12 @@ fn checked_mul_32(a: u32, b: u32) -> Option { } /// Returns the product of two u32 values, panics if the result overflows u32 -fn safe_mul_32(a: u32, b: u32) -> u32 { +pub fn safe_mul_32(a: u32, b: u32) -> u32 { unwrap(checked_mul_32(a, b)) } /// Returns the quotient of two u32 values wrapped in Some, or None if the result overflows u32 -fn checked_div_32(a: u32, b: u32) -> Option { +pub fn checked_div_32(a: u32, b: u32) -> Option { match jet::is_zero_32(b) { true => None, false => Some(jet::divide_32(a, b)), @@ -54,9 +54,6 @@ fn checked_div_32(a: u32, b: u32) -> Option { } /// Returns the quotient of two u32 values, panics if the result overflows u32 -fn safe_div_32(a: u32, b: u32) -> u32 { +pub fn safe_div_32(a: u32, b: u32) -> u32 { unwrap(checked_div_32(a, b)) } - -// todo: remove after module functionality is implemented -fn main() {} diff --git a/simf/u64.simf b/simf/lib/u64.simf similarity index 76% rename from simf/u64.simf rename to simf/lib/u64.simf index e4bf114..913dbdc 100644 --- a/simf/u64.simf +++ b/simf/lib/u64.simf @@ -1,5 +1,5 @@ /// Returns the sum of two u64 values wrapped in Some, or None if the result overflows u64 -fn checked_add_64(a: u64, b: u64) -> Option { +pub fn checked_add_64(a: u64, b: u64) -> Option { let (carry, sum): (bool, u64) = jet::add_64(a, b); match carry { @@ -9,12 +9,12 @@ fn checked_add_64(a: u64, b: u64) -> Option { } /// Returns the sum of two u64 values, panics if the result overflows u64 -fn safe_add_64(a: u64, b: u64) -> u64 { +pub fn safe_add_64(a: u64, b: u64) -> u64 { unwrap(checked_add_64(a, b)) } /// Returns the sum of two u64 values, panics if the result overflows u64 -fn checked_sub_64(a: u64, b: u64) -> Option { +pub fn checked_sub_64(a: u64, b: u64) -> Option { let (borrow, diff): (bool, u64) = jet::subtract_64(a, b); match borrow { @@ -24,12 +24,12 @@ fn checked_sub_64(a: u64, b: u64) -> Option { } /// Returns the difference of two u64 values, panics if the result overflows u64 -fn safe_sub_64(a: u64, b: u64) -> u64 { +pub fn safe_sub_64(a: u64, b: u64) -> u64 { unwrap(checked_sub_64(a, b)) } /// Returns the product of two u64 values wrapped in Some, or None if the result overflows u64 -fn checked_mul_64(a: u64, b: u64) -> Option { +pub fn checked_mul_64(a: u64, b: u64) -> Option { let result: u128 = jet::multiply_64(a, b); let (high, low): (u64, u64) = ::into(result); @@ -41,12 +41,12 @@ fn checked_mul_64(a: u64, b: u64) -> Option { } /// Returns the product of two u64 values, panics if the result overflows u64 -fn safe_mul_64(a: u64, b: u64) -> u64 { +pub fn safe_mul_64(a: u64, b: u64) -> u64 { unwrap(checked_mul_64(a, b)) } /// Returns the quotient of two u64 values wrapped in Some, or None if the result overflows u64 -fn checked_div_64(a: u64, b: u64) -> Option { +pub fn checked_div_64(a: u64, b: u64) -> Option { match jet::is_zero_64(b) { true => None, false => Some(jet::divide_64(a, b)), @@ -54,9 +54,6 @@ fn checked_div_64(a: u64, b: u64) -> Option { } /// Returns the quotient of two u64 values, panics if the result overflows u64 -fn safe_div_64(a: u64, b: u64) -> u64 { +pub fn safe_div_64(a: u64, b: u64) -> u64 { unwrap(checked_div_64(a, b)) } - -// todo: remove after module functionality is implemented -fn main() {} diff --git a/simf/u8.simf b/simf/lib/u8.simf similarity index 77% rename from simf/u8.simf rename to simf/lib/u8.simf index c5ea0ec..d3b87f7 100644 --- a/simf/u8.simf +++ b/simf/lib/u8.simf @@ -1,5 +1,5 @@ /// Returns the sum of two u8 values wrapped in Some, or None if the result overflows u8 -fn checked_add_8(a: u8, b: u8) -> Option { +pub fn checked_add_8(a: u8, b: u8) -> Option { let (carry, sum): (bool, u8) = jet::add_8(a, b); match carry { @@ -9,12 +9,12 @@ fn checked_add_8(a: u8, b: u8) -> Option { } /// Returns the sum of two u8 values, panics if the result overflows u8 -fn safe_add_8(a: u8, b: u8) -> u8 { +pub fn safe_add_8(a: u8, b: u8) -> u8 { unwrap(checked_add_8(a, b)) } /// Returns the difference of two u8 values wrapped in Some, or None if the result overflows u8 -fn checked_sub_8(a: u8, b: u8) -> Option { +pub fn checked_sub_8(a: u8, b: u8) -> Option { let (borrow, diff): (bool, u8) = jet::subtract_8(a, b); match borrow { @@ -24,12 +24,12 @@ fn checked_sub_8(a: u8, b: u8) -> Option { } /// Returns the difference of two u8 values, panics if the result overflows u8 -fn safe_sub_8(a: u8, b: u8) -> u8 { +pub fn safe_sub_8(a: u8, b: u8) -> u8 { unwrap(checked_sub_8(a, b)) } /// Returns the product of two u8 values wrapped in Some, or None if the result overflows u8 -fn checked_mul_8(a: u8, b: u8) -> Option { +pub fn checked_mul_8(a: u8, b: u8) -> Option { let result: u16 = jet::multiply_8(a, b); let (high, low): (u8, u8) = ::into(result); @@ -41,12 +41,12 @@ fn checked_mul_8(a: u8, b: u8) -> Option { } /// Returns the product of two u8 values, panics if the result overflows u8 -fn safe_mul_8(a: u8, b: u8) -> u8 { +pub fn safe_mul_8(a: u8, b: u8) -> u8 { unwrap(checked_mul_8(a, b)) } /// Returns the quotient of two u8 values wrapped in Some, or None if the result overflows u8 -fn checked_div_8(a: u8, b: u8) -> Option { +pub fn checked_div_8(a: u8, b: u8) -> Option { match jet::is_zero_8(b) { true => None, false => Some(jet::divide_8(a, b)), @@ -54,9 +54,6 @@ fn checked_div_8(a: u8, b: u8) -> Option { } /// Returns the quotient of two u8 values, panics if the result overflows u8 -fn safe_div_8(a: u8, b: u8) -> u8 { +pub fn safe_div_8(a: u8, b: u8) -> u8 { unwrap(checked_div_8(a, b)) } - -// todo: remove after module functionality is implemented -fn main() {} diff --git a/simf/u16_mock.simf b/simf/u16_mock.simf index ff893d4..ffe58c0 100644 --- a/simf/u16_mock.simf +++ b/simf/u16_mock.simf @@ -1,60 +1,6 @@ -// todo: switch to function import when available -fn checked_add_16(a: u16, b: u16) -> Option { - let (carry, sum): (bool, u16) = jet::add_16(a, b); +use crate::lib::u16::{checked_add_16, safe_add_16, checked_sub_16, safe_sub_16, checked_mul_16, safe_mul_16, checked_div_16, safe_div_16}; - match carry { - true => None, - false => Some(sum), - } -} - -fn safe_add_16(a: u16, b: u16) -> u16 { - unwrap(checked_add_16(a, b)) -} - -fn checked_sub_16(a: u16, b: u16) -> Option { - let (borrow, diff): (bool, u16) = jet::subtract_16(a, b); - - match borrow { - true => None, - false => Some(diff), - } -} - -fn safe_sub_16(a: u16, b: u16) -> u16 { - unwrap(checked_sub_16(a, b)) -} - -fn checked_mul_16(a: u16, b: u16) -> Option { - let result: u32 = jet::multiply_16(a, b); - - let (high, low): (u16, u16) = ::into(result); - - match jet::is_zero_16(high) { - true => Some(low), - false => None, - } -} - -fn safe_mul_16(a: u16, b: u16) -> u16 { - unwrap(checked_mul_16(a, b)) -} - -fn checked_div_16(a: u16, b: u16) -> Option { - match jet::is_zero_16(b) { - true => None, - false => Some(jet::divide_16(a, b)), - } -} - -fn safe_div_16(a: u16, b: u16) -> u16 { - unwrap(checked_div_16(a, b)) -} - -// helper -fn if_test_this_function(index: u8, flag: u8) -> bool { - jet::eq_8(index, flag) -} +use crate::helper::if_test_this_function; fn main() { let function_index: u8 = witness::FUNCTION_INDEX; diff --git a/simf/u32_mock.simf b/simf/u32_mock.simf index 2c14b28..a1ae4b4 100644 --- a/simf/u32_mock.simf +++ b/simf/u32_mock.simf @@ -1,60 +1,6 @@ -// todo: switch to function import when available -fn checked_add_32(a: u32, b: u32) -> Option { - let (carry, sum): (bool, u32) = jet::add_32(a, b); +use crate::lib::u32::{checked_add_32, safe_add_32, checked_sub_32, safe_sub_32, checked_mul_32, safe_mul_32, checked_div_32, safe_div_32}; - match carry { - true => None, - false => Some(sum), - } -} - -fn safe_add_32(a: u32, b: u32) -> u32 { - unwrap(checked_add_32(a, b)) -} - -fn checked_sub_32(a: u32, b: u32) -> Option { - let (borrow, diff): (bool, u32) = jet::subtract_32(a, b); - - match borrow { - true => None, - false => Some(diff), - } -} - -fn safe_sub_32(a: u32, b: u32) -> u32 { - unwrap(checked_sub_32(a, b)) -} - -fn checked_mul_32(a: u32, b: u32) -> Option { - let result: u64 = jet::multiply_32(a, b); - - let (high, low): (u32, u32) = ::into(result); - - match jet::is_zero_32(high) { - true => Some(low), - false => None, - } -} - -fn safe_mul_32(a: u32, b: u32) -> u32 { - unwrap(checked_mul_32(a, b)) -} - -fn checked_div_32(a: u32, b: u32) -> Option { - match jet::is_zero_32(b) { - true => None, - false => Some(jet::divide_32(a, b)), - } -} - -fn safe_div_32(a: u32, b: u32) -> u32 { - unwrap(checked_div_32(a, b)) -} - -// helper -fn if_test_this_function(index: u8, flag: u8) -> bool { - jet::eq_8(index, flag) -} +use crate::helper::if_test_this_function; fn main() { let function_index: u8 = witness::FUNCTION_INDEX; diff --git a/simf/u64_mock.simf b/simf/u64_mock.simf index 55ae8e0..5f20922 100644 --- a/simf/u64_mock.simf +++ b/simf/u64_mock.simf @@ -1,60 +1,6 @@ -// todo: switch to function import when available -fn checked_add_64(a: u64, b: u64) -> Option { - let (carry, sum): (bool, u64) = jet::add_64(a, b); +use crate::lib::u64::{checked_add_64, safe_add_64, checked_sub_64, safe_sub_64, checked_mul_64, safe_mul_64, checked_div_64, safe_div_64}; - match carry { - true => None, - false => Some(sum), - } -} - -fn safe_add_64(a: u64, b: u64) -> u64 { - unwrap(checked_add_64(a, b)) -} - -fn checked_sub_64(a: u64, b: u64) -> Option { - let (borrow, diff): (bool, u64) = jet::subtract_64(a, b); - - match borrow { - true => None, - false => Some(diff), - } -} - -fn safe_sub_64(a: u64, b: u64) -> u64 { - unwrap(checked_sub_64(a, b)) -} - -fn checked_mul_64(a: u64, b: u64) -> Option { - let result: u128 = jet::multiply_64(a, b); - - let (high, low): (u64, u64) = ::into(result); - - match jet::is_zero_64(high) { - true => Some(low), - false => None, - } -} - -fn safe_mul_64(a: u64, b: u64) -> u64 { - unwrap(checked_mul_64(a, b)) -} - -fn checked_div_64(a: u64, b: u64) -> Option { - match jet::is_zero_64(b) { - true => None, - false => Some(jet::divide_64(a, b)), - } -} - -fn safe_div_64(a: u64, b: u64) -> u64 { - unwrap(checked_div_64(a, b)) -} - -// helper -fn if_test_this_function(index: u8, flag: u8) -> bool { - jet::eq_8(index, flag) -} +use crate::helper::if_test_this_function; fn main() { let function_index: u8 = witness::FUNCTION_INDEX; diff --git a/simf/u8_mock.simf b/simf/u8_mock.simf index 8f03ab1..d45fcd3 100644 --- a/simf/u8_mock.simf +++ b/simf/u8_mock.simf @@ -1,60 +1,6 @@ -// todo: switch to function import when available -fn checked_add_8(a: u8, b: u8) -> Option { - let (carry, sum): (bool, u8) = jet::add_8(a, b); +use crate::lib::u8::{checked_add_8, safe_add_8, checked_sub_8, safe_sub_8, checked_mul_8, safe_mul_8, checked_div_8, safe_div_8}; - match carry { - true => None, - false => Some(sum), - } -} - -fn safe_add_8(a: u8, b: u8) -> u8 { - unwrap(checked_add_8(a, b)) -} - -fn checked_sub_8(a: u8, b: u8) -> Option { - let (borrow, diff): (bool, u8) = jet::subtract_8(a, b); - - match borrow { - true => None, - false => Some(diff), - } -} - -fn safe_sub_8(a: u8, b: u8) -> u8 { - unwrap(checked_sub_8(a, b)) -} - -fn checked_mul_8(a: u8, b: u8) -> Option { - let result: u16 = jet::multiply_8(a, b); - - let (high, low): (u8, u8) = ::into(result); - - match jet::is_zero_8(high) { - true => Some(low), - false => None, - } -} - -fn safe_mul_8(a: u8, b: u8) -> u8 { - unwrap(checked_mul_8(a, b)) -} - -fn checked_div_8(a: u8, b: u8) -> Option { - match jet::is_zero_8(b) { - true => None, - false => Some(jet::divide_8(a, b)), - } -} - -fn safe_div_8(a: u8, b: u8) -> u8 { - unwrap(checked_div_8(a, b)) -} - -// helper -fn if_test_this_function(index: u8, flag: u8) -> bool { - jet::eq_8(index, flag) -} +use crate::helper::if_test_this_function; fn main() { let function_index: u8 = witness::FUNCTION_INDEX; diff --git a/tests/u16_test.rs b/tests/u16_test.rs index ecf5942..70fd686 100644 --- a/tests/u16_test.rs +++ b/tests/u16_test.rs @@ -4,10 +4,8 @@ use simplex::simplicityhl::elements::Script; use simplex::transaction::{FinalTransaction, PartialInput, ProgramInput, RequiredSignature}; -use simplicityhl_std::artifacts::mock::u16_mock::U16MockProgram; -use simplicityhl_std::artifacts::mock::u16_mock::derived_u16_mock::{ - U16MockArguments, U16MockWitness, -}; +use simplicityhl_std::artifacts::u16_mock::U16MockProgram; +use simplicityhl_std::artifacts::u16_mock::derived_u16_mock::{U16MockArguments, U16MockWitness}; mod helper; diff --git a/tests/u32_test.rs b/tests/u32_test.rs index 53f8810..43b4718 100644 --- a/tests/u32_test.rs +++ b/tests/u32_test.rs @@ -4,10 +4,8 @@ use simplex::simplicityhl::elements::Script; use simplex::transaction::{FinalTransaction, PartialInput, ProgramInput, RequiredSignature}; -use simplicityhl_std::artifacts::mock::u32_mock::U32MockProgram; -use simplicityhl_std::artifacts::mock::u32_mock::derived_u32_mock::{ - U32MockArguments, U32MockWitness, -}; +use simplicityhl_std::artifacts::u32_mock::U32MockProgram; +use simplicityhl_std::artifacts::u32_mock::derived_u32_mock::{U32MockArguments, U32MockWitness}; mod helper; diff --git a/tests/u64_test.rs b/tests/u64_test.rs index 39f00d7..2372073 100644 --- a/tests/u64_test.rs +++ b/tests/u64_test.rs @@ -4,10 +4,8 @@ use simplex::simplicityhl::elements::Script; use simplex::transaction::{FinalTransaction, PartialInput, ProgramInput, RequiredSignature}; -use simplicityhl_std::artifacts::mock::u64_mock::U64MockProgram; -use simplicityhl_std::artifacts::mock::u64_mock::derived_u64_mock::{ - U64MockArguments, U64MockWitness, -}; +use simplicityhl_std::artifacts::u64_mock::U64MockProgram; +use simplicityhl_std::artifacts::u64_mock::derived_u64_mock::{U64MockArguments, U64MockWitness}; mod helper; diff --git a/tests/u8_test.rs b/tests/u8_test.rs index e8e5ccf..4ce3178 100644 --- a/tests/u8_test.rs +++ b/tests/u8_test.rs @@ -4,8 +4,8 @@ use simplex::simplicityhl::elements::Script; use simplex::transaction::{FinalTransaction, PartialInput, ProgramInput, RequiredSignature}; -use simplicityhl_std::artifacts::mock::u8_mock::U8MockProgram; -use simplicityhl_std::artifacts::mock::u8_mock::derived_u8_mock::{U8MockArguments, U8MockWitness}; +use simplicityhl_std::artifacts::u8_mock::U8MockProgram; +use simplicityhl_std::artifacts::u8_mock::derived_u8_mock::{U8MockArguments, U8MockWitness}; mod helper; From 4fde478597be9796094e0d81888bc390992f92c2 Mon Sep 17 00:00:00 2001 From: aritkulova Date: Wed, 24 Jun 2026 21:06:20 +0300 Subject: [PATCH 3/5] fixing ci by using smplx from specific commit --- .github/workflows/tests.yml | 2 + Cargo.lock | 469 ++++++++++++++++-------------------- Cargo.toml | 3 +- 3 files changed, 205 insertions(+), 269 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2178d4a..f244b82 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,6 +46,8 @@ jobs: - name: Install simplex-cli uses: ./.github/actions/setup-smplx + with: + commit-sha: '3afcc04' - name: Generate contract artifacts shell: bash diff --git a/Cargo.lock b/Cargo.lock index c59c2ed..328caf1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "f02882884d3e1bc524fb12c79f107f6ad0e1cfd498c536ffb494301740995dfe" [[package]] name = "autocfg" @@ -94,11 +94,33 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "aws-lc-rs" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ec2f1fc3ec205783a5da9a7e6c1509cc69dedf09a1949e412c1e18469326d00" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a2f9779ce85b93ab6170dd940ad0169b5766ff848247aff13bb788b832fe3f4" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + [[package]] name = "base58ck" -version = "0.1.100" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec5dc7e09f7bb15f0062da7c03086d6b71a2c84e0af4fccbbc7d8c6559847816" +checksum = "365c0acd5b2e8dd0111a46c4faea83fb3cfb6e39a49a7c73a06e090db7b2eff0" dependencies = [ "bitcoin_hashes", ] @@ -136,9 +158,9 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.32.100" +version = "0.32.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39581299241111285f3268ba75ddf372746fd041620918b145c1af9d75e91b6c" +checksum = "8ed8ccb78a9ff7a6fbb90e2fb9b8588b4a9928d49d8af3cb789108a84ea6b0ce" dependencies = [ "base58ck", "base64 0.21.7", @@ -146,17 +168,38 @@ dependencies = [ "bitcoin-io", "bitcoin-units", "bitcoin_hashes", - "hex-conservative", + "hex-conservative 0.2.2", "hex_lit", "secp256k1", "serde", ] +[[package]] +name = "bitcoin-consensus-encoding" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2d6094e2a1ba3c93b5a596fe5a10d1a10c3c6e06785cde89f693a044c01aa40" +dependencies = [ + "bitcoin-internals", +] + +[[package]] +name = "bitcoin-internals" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a30a22d1f112dde8e16be7b45c63645dc165cef254f835b3e1e9553e485cfa64" +dependencies = [ + "hex-conservative 0.3.2", +] + [[package]] name = "bitcoin-io" -version = "0.1.100" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11301df0b06f22dea7bb1916403fdd88a371031e495c49b8f96931b28189e175" +checksum = "bb5de036369d1ac59d3c1819ebc4d850f89466f5401c571a285b6ed564a4cb78" +dependencies = [ + "bitcoin-consensus-encoding", +] [[package]] name = "bitcoin-private" @@ -166,21 +209,22 @@ checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" [[package]] name = "bitcoin-units" -version = "0.1.100" +version = "0.1.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bad157b78d0d1b22c4cbb6a35a566211fc4d14866a37f2c780652b50f3b845" +checksum = "9cb95693f371d089a4b5b6fc41c6f3ea6e01ee8c15388335dfac8ea685173b51" dependencies = [ + "bitcoin-consensus-encoding", "serde", ] [[package]] name = "bitcoin_hashes" -version = "0.14.100" +version = "0.14.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9901a56e133a1fc86eeb1113e2591f45f4682451ca893bff494d2f88918e3f" +checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2" dependencies = [ "bitcoin-io", - "hex-conservative", + "hex-conservative 0.2.2", "serde", ] @@ -266,11 +310,13 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.2.63" +version = "1.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f" +checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -321,6 +367,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + [[package]] name = "colorchoice" version = "1.0.5" @@ -382,6 +437,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dyn-clone" version = "1.0.20" @@ -424,9 +485,9 @@ dependencies = [ [[package]] name = "elements" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b2569d3495bfdfce36c504fd4d78752ff4a7699f8a33e6f3ee523bddf9f6ad" +checksum = "83c63a04238f4b7f3564fe9705921452c2900efd00982545e5c634fac9024fe2" dependencies = [ "bech32", "bitcoin", @@ -481,6 +542,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures-core" version = "0.3.32" @@ -530,15 +597,25 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.4.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", - "wasip3", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", ] [[package]] @@ -594,12 +671,6 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - [[package]] name = "hex" version = "0.4.3" @@ -615,6 +686,15 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "hex-conservative" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830e599c2904b08f0834ee6337d8fe8f0ed4a63b5d9e7a7f49c0ffa06d08d360" +dependencies = [ + "arrayvec", +] + [[package]] name = "hex_lit" version = "0.1.1" @@ -639,12 +719,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - [[package]] name = "ignore" version = "0.4.26" @@ -669,8 +743,6 @@ checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", "hashbrown 0.17.1", - "serde", - "serde_core", ] [[package]] @@ -694,11 +766,21 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + [[package]] name = "js-sys" -version = "0.3.100" +version = "0.3.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2025f20d7a4fa7785846e7b63d10a76d3f1cee98ee5cb79ea59703f95e42162" +checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31" dependencies = [ "cfg-if", "futures-util", @@ -712,17 +794,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3662a38d341d77efecb73caf01420cfa5aa63c0253fd7bc05289ef9f6616e1bf" dependencies = [ "base64 0.13.1", - "minreq", + "minreq 2.14.1", "serde", "serde_json", ] -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - [[package]] name = "libc" version = "0.2.186" @@ -743,15 +819,15 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "log" -version = "0.4.32" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" [[package]] name = "memchr" -version = "2.8.1" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" +checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" [[package]] name = "memoffset" @@ -777,6 +853,16 @@ name = "minreq" version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05015102dad0f7d61691ca347e9d9d9006685a64aefb3d79eecf62665de2153d" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "minreq" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "659579df697b372ef9e36f02fcbb41f6d6f157dcec7db9c9618fa0f23cf0fc20" dependencies = [ "rustls", "rustls-webpki", @@ -878,13 +964,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.45" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "r-efi" version = "6.0.0" @@ -921,18 +1013,6 @@ dependencies = [ "getrandom 0.2.17", ] -[[package]] -name = "regex" -version = "1.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.14", - "regex-syntax 0.8.11", -] - [[package]] name = "regex-automata" version = "0.3.9" @@ -1009,23 +1089,37 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.12" +version = "0.23.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +checksum = "6b92b125634d9b795e7beca796cc790df15a7fb38323bf3196fda83292d06b1f" dependencies = [ + "aws-lc-rs", "log", - "ring", + "once_cell", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "zeroize", ] [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.103.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" dependencies = [ + "aws-lc-rs", "ring", + "rustls-pki-types", "untrusted", ] @@ -1044,25 +1138,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "santiago" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de36022292bc2086eb8f55bffa460fef3475e4459b478820711f4c421feb87ec" -dependencies = [ - "regex", -] - -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "secp256k1" version = "0.29.1" @@ -1107,12 +1182,6 @@ dependencies = [ "secp256k1-sys", ] -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" - [[package]] name = "serde" version = "1.0.228" @@ -1184,9 +1253,9 @@ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] name = "simplicity-lang" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e57bd4d84853974a212eab24ed89da54f49fbccf5e33e93bcd29f0a6591cd5" +checksum = "13ed081e3046d66c146d7201bcbf3b655ca3436cb83f6efc26d7895bd2b79d06" dependencies = [ "bitcoin", "bitcoin_hashes", @@ -1194,17 +1263,16 @@ dependencies = [ "elements", "getrandom 0.2.17", "ghost-cell", - "hex-conservative", + "hex-conservative 0.2.2", "miniscript", - "santiago", "simplicity-sys", ] [[package]] name = "simplicity-sys" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3401ee7331f183a5458c0f5a4b3d5d00bde0fd12e2e03728c537df34efae289" +checksum = "96d1ec5477c7650b8ef511aa56dccb28f2e8cdb6e87f260ecffdaf0ebfef2d3b" dependencies = [ "bitcoin_hashes", "cc", @@ -1212,9 +1280,8 @@ dependencies = [ [[package]] name = "simplicityhl" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25de8990174fe3e1a843df138cacc4265d05839ebd2550c18b9196f567d55e81" +version = "0.6.0-rc.0" +source = "git+https://github.com/BlockstreamResearch/SimplicityHL.git#4eb97f5dcb28d294f23bee15cb8f2e85027cd1f6" dependencies = [ "base64 0.21.7", "chumsky", @@ -1246,8 +1313,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smplx-build" version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb75724fd0329de24895b58a4010efeeca9773092294845a324aee141ec3c864" +source = "git+https://github.com/BlockstreamResearch/smplx.git?rev=3afcc04#3afcc04aae8a0a92722b28bc1d16ef27983d4aa1" dependencies = [ "glob", "globwalk", @@ -1265,8 +1331,7 @@ dependencies = [ [[package]] name = "smplx-macros" version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4777f6ff9a27faf98396181d67f04f720e0c472c2a3f1db76c5475b45da8963f" +source = "git+https://github.com/BlockstreamResearch/smplx.git?rev=3afcc04#3afcc04aae8a0a92722b28bc1d16ef27983d4aa1" dependencies = [ "smplx-build", "smplx-test", @@ -1276,8 +1341,7 @@ dependencies = [ [[package]] name = "smplx-regtest" version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf3711284f8ad7859ae0605841e90316bdf41be5b09011639e765667f07feb5d" +source = "git+https://github.com/BlockstreamResearch/smplx.git?rev=3afcc04#3afcc04aae8a0a92722b28bc1d16ef27983d4aa1" dependencies = [ "electrsd", "hex", @@ -1292,8 +1356,7 @@ dependencies = [ [[package]] name = "smplx-sdk" version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96c7de4f86f4a74dc4c910d6d0541d63cd661e3f616566054a36e589ffcda2c" +source = "git+https://github.com/BlockstreamResearch/smplx.git?rev=3afcc04#3afcc04aae8a0a92722b28bc1d16ef27983d4aa1" dependencies = [ "bip39", "bitcoin_hashes", @@ -1301,7 +1364,7 @@ dependencies = [ "electrsd", "elements-miniscript", "hex", - "minreq", + "minreq 3.0.0", "serde", "serde_json", "sha2", @@ -1312,8 +1375,7 @@ dependencies = [ [[package]] name = "smplx-std" version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38cef91f2523cfb6e8937bb1c8004869d539e0dcd8c62fef68c93cc3a6233117" +source = "git+https://github.com/BlockstreamResearch/smplx.git?rev=3afcc04#3afcc04aae8a0a92722b28bc1d16ef27983d4aa1" dependencies = [ "either", "serde", @@ -1326,8 +1388,7 @@ dependencies = [ [[package]] name = "smplx-test" version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9c8878fae6868b9fbf7ed7cb3e261dc308b55ea418bb4421685dad99f98fc1f" +source = "git+https://github.com/BlockstreamResearch/smplx.git?rev=3afcc04#3afcc04aae8a0a92722b28bc1d16ef27983d4aa1" dependencies = [ "electrsd", "proc-macro2", @@ -1368,9 +1429,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.117" +version = "2.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" dependencies = [ "proc-macro2", "quote", @@ -1384,7 +1445,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.2", + "getrandom 0.4.3", "once_cell", "rustix 1.1.4", "windows-sys 0.61.2", @@ -1491,12 +1552,6 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "untrusted" version = "0.9.0" @@ -1533,27 +1588,18 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.3+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" -dependencies = [ - "wit-bindgen 0.57.1", -] - -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ - "wit-bindgen 0.51.0", + "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.123" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a254a4b10c19a76f09a27640e7ffbf9bc30bf67e16a3bf28aaefa4920fe81563" +checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a" dependencies = [ "cfg-if", "once_cell", @@ -1564,9 +1610,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.123" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a40fc75b0ec6f3746ceb10d36f53a93dcd68a93b11b6445983945d79eba0dc" +checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1574,9 +1620,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.123" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "908f34bd9b9ce3d4caf07b72dfab63d61504d156856c6bd3cd87fa350cf3985b" +checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd" dependencies = [ "bumpalo", "proc-macro2", @@ -1587,53 +1633,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.123" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acbf7616c27b194bbb550bf77ed0c2c3e5b7fd1260a93082b95fb7f47959b92" +checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f" dependencies = [ "unicode-ident", ] [[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" +name = "webpki-roots" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +checksum = "bf85cb06032201fa7c6f829d7db5a7e5aa45bcc0655327713065f6f0576731bf" dependencies = [ - "bitflags 2.13.0", - "hashbrown 0.15.5", - "indexmap", - "semver", + "rustls-pki-types", ] -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - [[package]] name = "which" version = "4.4.2" @@ -1764,100 +1779,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" -[[package]] -name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - [[package]] name = "wit-bindgen" version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags 2.13.0", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - [[package]] name = "zerocopy" version = "0.8.52" @@ -1878,6 +1805,12 @@ dependencies = [ "syn", ] +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + [[package]] name = "zmij" version = "1.0.21" diff --git a/Cargo.toml b/Cargo.toml index c2cd2be..23aeac9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,8 @@ rust-version = "1.91.0" version = "0.1.0" [dependencies] -smplx-std = { version = ">=0.0.6, <0.1.0" } +# todo: Replace git dependency with crates.io version that supports modules once available +smplx-std = { git = "https://github.com/BlockstreamResearch/smplx.git", rev = "3afcc04" } anyhow = { version = "1.0.101" } rand = { version = "0.8.6" } From 079781d665add31b39a384a32fd361b27cf9719f Mon Sep 17 00:00:00 2001 From: aritkulova Date: Thu, 25 Jun 2026 13:03:10 +0300 Subject: [PATCH 4/5] trying to fix ci --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f244b82..f1d8ca2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,7 +47,7 @@ jobs: - name: Install simplex-cli uses: ./.github/actions/setup-smplx with: - commit-sha: '3afcc04' + commit-sha: '3afcc04aae8a0a92722b28bc1d16ef27983d4aa1' - name: Generate contract artifacts shell: bash From ee46bbc08b52c4e749d08a23aac3df3902936479 Mon Sep 17 00:00:00 2001 From: aritkulova Date: Thu, 25 Jun 2026 14:50:08 +0300 Subject: [PATCH 5/5] updated readme --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8e198c8..c6ef5c7 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,13 @@ This repository contains the standard library for [SimplicityHL](https://github.com/BlockstreamResearch/SimplicityHL). +> [!NOTE] +> If you are using the VS Code syntax highlighting extension, you may see errors because the extension does not support modules and imports yet. + ## Dev Info ### Installation -> Project currently uses Simplex version 0.0.6. +> Project currently uses Simplex version 0.0.6 from the dev branch. To compile the project, execute the following command: @@ -19,10 +22,10 @@ To download simplexup, run: curl -L https://smplx.simplicity-lang.org | bash ``` -To install a specific Simplex version (in this case the v0.0.6 version): +To install a specific Simplex version (in this case from the specific commit): ```bash -simplexup --install v0.0.6 +simplexup --commit 3afcc04aae8a0a92722b28bc1d16ef27983d4aa1 ``` ### Compilation