From e8048d8676e234b9b996c34422bda1f3e66c3d8c Mon Sep 17 00:00:00 2001 From: ivanlele Date: Fri, 6 Mar 2026 16:30:21 +0200 Subject: [PATCH] Separate Jet env from Jet trait --- jets-bench/benches/elements/main.rs | 10 +- jets-bench/src/input.rs | 18 +- simplicity-sys/src/c_jets/jets_ffi.rs-r | 949 ------------------------ src/bit_machine/mod.rs | 36 +- src/human_encoding/mod.rs | 55 +- src/human_encoding/parse/mod.rs | 22 +- src/jet/bitcoin/mod.rs | 20 + src/jet/core/mod.rs | 33 + src/jet/elements/mod.rs | 24 + src/jet/init/mod.rs | 5 +- src/jet/mod.rs | 30 +- src/node/commit.rs | 4 +- src/node/construct.rs | 8 +- src/node/redeem.rs | 29 +- 14 files changed, 211 insertions(+), 1032 deletions(-) delete mode 100644 simplicity-sys/src/c_jets/jets_ffi.rs-r create mode 100644 src/jet/core/mod.rs diff --git a/jets-bench/benches/elements/main.rs b/jets-bench/benches/elements/main.rs index cc92a04e..d84f46e4 100644 --- a/jets-bench/benches/elements/main.rs +++ b/jets-bench/benches/elements/main.rs @@ -5,7 +5,7 @@ use elements::confidential; use rand::rngs::ThreadRng; use simplicity::elements; use simplicity::jet::elements::ElementsEnv; -use simplicity::jet::{Elements, Jet}; +use simplicity::jet::{Elements, ElementsTxEnv, Jet, JetEnvironment}; use simplicity::types; use simplicity::types::Final; use simplicity::Value; @@ -625,7 +625,7 @@ fn bench(c: &mut Criterion) { let (src, dst) = buffer.write(&src_ty, params, &mut rng); (dst, src, &env, buffer) }, - |(mut dst, src, env, _buffer)| jet.c_jet_ptr()(&mut dst, src, env.c_tx_env()), + |(mut dst, src, env, _buffer)| ElementsTxEnv::c_jet_ptr(&jet)(&mut dst, src, env.c_tx_env()), BatchSize::SmallInput, ) }); @@ -743,7 +743,7 @@ fn bench(c: &mut Criterion) { let (src, dst) = buffer.write(&src_ty, params, &mut rng); (dst, src, buffer) }, - |(mut dst, src, _buffer)| jet.c_jet_ptr()(&mut dst, src, env.c_tx_env()), + |(mut dst, src, _buffer)| ElementsTxEnv::c_jet_ptr(&jet)(&mut dst, src, env.c_tx_env()), BatchSize::SmallInput, ) }); @@ -806,7 +806,7 @@ fn bench(c: &mut Criterion) { let (src, dst) = buffer.write(&src_ty, params, &mut rng); (dst, src, buffer) }, - |(mut dst, src, _buffer)| jet.c_jet_ptr()(&mut dst, src, env.c_tx_env()), + |(mut dst, src, _buffer)| ElementsTxEnv::c_jet_ptr(&jet)(&mut dst, src, env.c_tx_env()), BatchSize::SmallInput, ) }); @@ -903,7 +903,7 @@ fn bench(c: &mut Criterion) { let (src, dst) = buffer.write(&src_ty, params, &mut rng); (dst, src, buffer) }, - |(mut dst, src, _buffer)| jet.c_jet_ptr()(&mut dst, src, env.c_tx_env()), + |(mut dst, src, _buffer)| ElementsTxEnv::c_jet_ptr(&jet)(&mut dst, src, env.c_tx_env()), BatchSize::SmallInput, ) }); diff --git a/jets-bench/src/input.rs b/jets-bench/src/input.rs index 8b6ed0ba..c6c3f84f 100644 --- a/jets-bench/src/input.rs +++ b/jets-bench/src/input.rs @@ -8,7 +8,7 @@ use simplicity::ffi::c_jets::frame_ffi::c_writeBit; use simplicity::ffi::ffi::UWORD; use simplicity::ffi::CFrameItem; use simplicity::hashes::Hash; -use simplicity::jet::Elements; +use simplicity::jet::{Elements, ElementsTxEnv, JetEnvironment}; use simplicity::types::{self, CompleteBound}; use simplicity::Value; @@ -296,7 +296,6 @@ impl FlatValue { fn call_jet(&self, jet: Elements, dest_bits: usize) -> Self { use core::{mem, ptr}; use simplicity::ffi::c_jets::uword_width; - use simplicity::jet::Jet as _; assert!(dest_bits <= 8 * MAX_VALUE_BYTES); let mut ret = Self::zero_n_bits(dest_bits); @@ -354,10 +353,11 @@ impl FlatValue { // We can assert this because in our sampling code jets should never // fail. In the benchmarking code they might. - assert!(jet.c_jet_ptr()( + + assert!(ElementsTxEnv::c_jet_ptr(&jet)( &mut dst_write_frame, src_read_frame, - Elements::c_jet_env(&env) + env.c_tx_env() )); // The write frame winds up as an array of usizes with all bytes in // reverse order. (The bytes of the usizes are in reverse order due @@ -1366,8 +1366,12 @@ impl InputSample for DivMod12864Input { for (bit1, bit2) in sample_1.bit_iter().zip(sample_2.bit_iter()) { match (bit1, bit2) { (false, false) | (true, true) => {} // both equal - (true, false) => return FlatValue::product(&[sample_2, UniformBits.sample(0, 64), sample_1]), - (false, true) => return FlatValue::product(&[sample_1, UniformBits.sample(0, 64), sample_2]), + (true, false) => { + return FlatValue::product(&[sample_2, UniformBits.sample(0, 64), sample_1]) + } + (false, true) => { + return FlatValue::product(&[sample_1, UniformBits.sample(0, 64), sample_2]) + } } } unreachable!("if we get here, two uniform 63-bit samples were exactly equal") @@ -1428,7 +1432,7 @@ mod tests { let (src, mut dst) = buffer.write(&src_ty, ¶ms, &mut rand::thread_rng()); - jet.c_jet_ptr()(&mut dst, src, env.c_tx_env()); + ElementsTxEnv::c_jet_ptr(&jet)(&mut dst, src, env.c_tx_env()); } #[test] diff --git a/simplicity-sys/src/c_jets/jets_ffi.rs-r b/simplicity-sys/src/c_jets/jets_ffi.rs-r deleted file mode 100644 index 3f96ba03..00000000 --- a/simplicity-sys/src/c_jets/jets_ffi.rs-r +++ /dev/null @@ -1,949 +0,0 @@ -/* This file has been automatically generated. */ - -use crate::ffi::c_void; -use crate::{CElementsTxEnv, CFrameItem}; - -extern "C" { - #[link_name = "c_add_16"] - pub fn add_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_add_32"] - pub fn add_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_add_64"] - pub fn add_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_add_8"] - pub fn add_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_all_16"] - pub fn all_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_all_32"] - pub fn all_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_all_64"] - pub fn all_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_all_8"] - pub fn all_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_and_1"] - pub fn and_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_and_16"] - pub fn and_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_and_32"] - pub fn and_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_and_64"] - pub fn and_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_and_8"] - pub fn and_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_annex_hash"] - pub fn annex_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_asset_amount_hash"] - pub fn asset_amount_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_bip_0340_verify"] - pub fn bip_0340_verify(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_broken_do_not_use_check_lock_distance"] - pub fn broken_do_not_use_check_lock_distance(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_broken_do_not_use_check_lock_duration"] - pub fn broken_do_not_use_check_lock_duration(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_broken_do_not_use_tx_lock_distance"] - pub fn broken_do_not_use_tx_lock_distance(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_broken_do_not_use_tx_lock_duration"] - pub fn broken_do_not_use_tx_lock_duration(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_build_tapbranch"] - pub fn build_tapbranch(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_build_tapleaf_simplicity"] - pub fn build_tapleaf_simplicity(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_build_taptweak"] - pub fn build_taptweak(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_calculate_asset"] - pub fn calculate_asset(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_calculate_confidential_token"] - pub fn calculate_confidential_token(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_calculate_explicit_token"] - pub fn calculate_explicit_token(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_calculate_issuance_entropy"] - pub fn calculate_issuance_entropy(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_ch_1"] - pub fn ch_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_ch_16"] - pub fn ch_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_ch_32"] - pub fn ch_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_ch_64"] - pub fn ch_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_ch_8"] - pub fn ch_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_check_lock_height"] - pub fn check_lock_height(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_check_lock_time"] - pub fn check_lock_time(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_check_sig_verify"] - pub fn check_sig_verify(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_complement_1"] - pub fn complement_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_complement_16"] - pub fn complement_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_complement_32"] - pub fn complement_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_complement_64"] - pub fn complement_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_complement_8"] - pub fn complement_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_current_amount"] - pub fn current_amount(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_annex_hash"] - pub fn current_annex_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_asset"] - pub fn current_asset(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_index"] - pub fn current_index(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_issuance_asset_amount"] - pub fn current_issuance_asset_amount(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_issuance_asset_proof"] - pub fn current_issuance_asset_proof(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_issuance_token_amount"] - pub fn current_issuance_token_amount(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_issuance_token_proof"] - pub fn current_issuance_token_proof(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_new_issuance_contract"] - pub fn current_new_issuance_contract(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_pegin"] - pub fn current_pegin(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_prev_outpoint"] - pub fn current_prev_outpoint(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_reissuance_blinding"] - pub fn current_reissuance_blinding(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_reissuance_entropy"] - pub fn current_reissuance_entropy(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_script_hash"] - pub fn current_script_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_script_sig_hash"] - pub fn current_script_sig_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_current_sequence"] - pub fn current_sequence(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_decompress"] - pub fn decompress(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_decrement_16"] - pub fn decrement_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_decrement_32"] - pub fn decrement_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_decrement_64"] - pub fn decrement_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_decrement_8"] - pub fn decrement_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_div_mod_128_64"] - pub fn div_mod_128_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_div_mod_16"] - pub fn div_mod_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_div_mod_32"] - pub fn div_mod_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_div_mod_64"] - pub fn div_mod_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_div_mod_8"] - pub fn div_mod_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divide_16"] - pub fn divide_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divide_32"] - pub fn divide_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divide_64"] - pub fn divide_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divide_8"] - pub fn divide_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divides_16"] - pub fn divides_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divides_32"] - pub fn divides_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divides_64"] - pub fn divides_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_divides_8"] - pub fn divides_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_eq_1"] - pub fn eq_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_eq_16"] - pub fn eq_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_eq_256"] - pub fn eq_256(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_eq_32"] - pub fn eq_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_eq_64"] - pub fn eq_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_eq_8"] - pub fn eq_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_add"] - pub fn fe_add(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_invert"] - pub fn fe_invert(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_is_odd"] - pub fn fe_is_odd(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_is_zero"] - pub fn fe_is_zero(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_multiply"] - pub fn fe_multiply(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_multiply_beta"] - pub fn fe_multiply_beta(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_negate"] - pub fn fe_negate(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_normalize"] - pub fn fe_normalize(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_square"] - pub fn fe_square(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_fe_square_root"] - pub fn fe_square_root(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_add_16"] - pub fn full_add_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_add_32"] - pub fn full_add_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_add_64"] - pub fn full_add_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_add_8"] - pub fn full_add_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_decrement_16"] - pub fn full_decrement_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_decrement_32"] - pub fn full_decrement_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_decrement_64"] - pub fn full_decrement_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_decrement_8"] - pub fn full_decrement_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_increment_16"] - pub fn full_increment_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_increment_32"] - pub fn full_increment_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_increment_64"] - pub fn full_increment_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_increment_8"] - pub fn full_increment_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_16_1"] - pub fn full_left_shift_16_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_16_2"] - pub fn full_left_shift_16_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_16_4"] - pub fn full_left_shift_16_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_16_8"] - pub fn full_left_shift_16_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_32_1"] - pub fn full_left_shift_32_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_32_16"] - pub fn full_left_shift_32_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_32_2"] - pub fn full_left_shift_32_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_32_4"] - pub fn full_left_shift_32_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_32_8"] - pub fn full_left_shift_32_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_64_1"] - pub fn full_left_shift_64_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_64_16"] - pub fn full_left_shift_64_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_64_2"] - pub fn full_left_shift_64_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_64_32"] - pub fn full_left_shift_64_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_64_4"] - pub fn full_left_shift_64_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_64_8"] - pub fn full_left_shift_64_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_8_1"] - pub fn full_left_shift_8_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_8_2"] - pub fn full_left_shift_8_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_left_shift_8_4"] - pub fn full_left_shift_8_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_multiply_16"] - pub fn full_multiply_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_multiply_32"] - pub fn full_multiply_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_multiply_64"] - pub fn full_multiply_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_multiply_8"] - pub fn full_multiply_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_16_1"] - pub fn full_right_shift_16_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_16_2"] - pub fn full_right_shift_16_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_16_4"] - pub fn full_right_shift_16_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_16_8"] - pub fn full_right_shift_16_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_32_1"] - pub fn full_right_shift_32_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_32_16"] - pub fn full_right_shift_32_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_32_2"] - pub fn full_right_shift_32_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_32_4"] - pub fn full_right_shift_32_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_32_8"] - pub fn full_right_shift_32_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_64_1"] - pub fn full_right_shift_64_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_64_16"] - pub fn full_right_shift_64_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_64_2"] - pub fn full_right_shift_64_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_64_32"] - pub fn full_right_shift_64_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_64_4"] - pub fn full_right_shift_64_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_64_8"] - pub fn full_right_shift_64_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_8_1"] - pub fn full_right_shift_8_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_8_2"] - pub fn full_right_shift_8_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_right_shift_8_4"] - pub fn full_right_shift_8_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_subtract_16"] - pub fn full_subtract_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_subtract_32"] - pub fn full_subtract_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_subtract_64"] - pub fn full_subtract_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_full_subtract_8"] - pub fn full_subtract_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_ge_is_on_curve"] - pub fn ge_is_on_curve(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_ge_negate"] - pub fn ge_negate(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_add"] - pub fn gej_add(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_double"] - pub fn gej_double(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_equiv"] - pub fn gej_equiv(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_ge_add"] - pub fn gej_ge_add(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_ge_add_ex"] - pub fn gej_ge_add_ex(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_ge_equiv"] - pub fn gej_ge_equiv(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_infinity"] - pub fn gej_infinity(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_is_infinity"] - pub fn gej_is_infinity(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_is_on_curve"] - pub fn gej_is_on_curve(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_negate"] - pub fn gej_negate(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_normalize"] - pub fn gej_normalize(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_rescale"] - pub fn gej_rescale(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_x_equiv"] - pub fn gej_x_equiv(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_gej_y_is_odd"] - pub fn gej_y_is_odd(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_generate"] - pub fn generate(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_genesis_block_hash"] - pub fn genesis_block_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_hash_to_curve"] - pub fn hash_to_curve(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_high_1"] - pub fn high_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_high_16"] - pub fn high_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_high_32"] - pub fn high_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_high_64"] - pub fn high_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_high_8"] - pub fn high_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_increment_16"] - pub fn increment_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_increment_32"] - pub fn increment_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_increment_64"] - pub fn increment_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_increment_8"] - pub fn increment_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_input_amount"] - pub fn input_amount(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_amounts_hash"] - pub fn input_amounts_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_annex_hash"] - pub fn input_annex_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_annexes_hash"] - pub fn input_annexes_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_asset"] - pub fn input_asset(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_hash"] - pub fn input_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_outpoints_hash"] - pub fn input_outpoints_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_pegin"] - pub fn input_pegin(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_prev_outpoint"] - pub fn input_prev_outpoint(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_script_hash"] - pub fn input_script_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_script_sig_hash"] - pub fn input_script_sig_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_script_sigs_hash"] - pub fn input_script_sigs_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_scripts_hash"] - pub fn input_scripts_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_sequence"] - pub fn input_sequence(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_sequences_hash"] - pub fn input_sequences_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_utxo_hash"] - pub fn input_utxo_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_input_utxos_hash"] - pub fn input_utxos_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_inputs_hash"] - pub fn inputs_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_internal_key"] - pub fn internal_key(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_is_one_16"] - pub fn is_one_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_is_one_32"] - pub fn is_one_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_is_one_64"] - pub fn is_one_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_is_one_8"] - pub fn is_one_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_is_zero_16"] - pub fn is_zero_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_is_zero_32"] - pub fn is_zero_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_is_zero_64"] - pub fn is_zero_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_is_zero_8"] - pub fn is_zero_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_issuance"] - pub fn issuance(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_asset"] - pub fn issuance_asset(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_asset_amount"] - pub fn issuance_asset_amount(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_asset_amounts_hash"] - pub fn issuance_asset_amounts_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_asset_proof"] - pub fn issuance_asset_proof(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_blinding_entropy_hash"] - pub fn issuance_blinding_entropy_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_entropy"] - pub fn issuance_entropy(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_hash"] - pub fn issuance_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_range_proofs_hash"] - pub fn issuance_range_proofs_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_token"] - pub fn issuance_token(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_token_amount"] - pub fn issuance_token_amount(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_token_amounts_hash"] - pub fn issuance_token_amounts_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuance_token_proof"] - pub fn issuance_token_proof(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_issuances_hash"] - pub fn issuances_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_lbtc_asset"] - pub fn lbtc_asset(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_le_16"] - pub fn le_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_le_32"] - pub fn le_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_le_64"] - pub fn le_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_le_8"] - pub fn le_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_16_32"] - pub fn left_extend_16_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_16_64"] - pub fn left_extend_16_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_1_16"] - pub fn left_extend_1_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_1_32"] - pub fn left_extend_1_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_1_64"] - pub fn left_extend_1_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_1_8"] - pub fn left_extend_1_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_32_64"] - pub fn left_extend_32_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_8_16"] - pub fn left_extend_8_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_8_32"] - pub fn left_extend_8_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_extend_8_64"] - pub fn left_extend_8_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_16_32"] - pub fn left_pad_high_16_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_16_64"] - pub fn left_pad_high_16_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_1_16"] - pub fn left_pad_high_1_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_1_32"] - pub fn left_pad_high_1_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_1_64"] - pub fn left_pad_high_1_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_1_8"] - pub fn left_pad_high_1_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_32_64"] - pub fn left_pad_high_32_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_8_16"] - pub fn left_pad_high_8_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_8_32"] - pub fn left_pad_high_8_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_high_8_64"] - pub fn left_pad_high_8_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_16_32"] - pub fn left_pad_low_16_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_16_64"] - pub fn left_pad_low_16_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_1_16"] - pub fn left_pad_low_1_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_1_32"] - pub fn left_pad_low_1_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_1_64"] - pub fn left_pad_low_1_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_1_8"] - pub fn left_pad_low_1_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_32_64"] - pub fn left_pad_low_32_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_8_16"] - pub fn left_pad_low_8_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_8_32"] - pub fn left_pad_low_8_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_pad_low_8_64"] - pub fn left_pad_low_8_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_rotate_16"] - pub fn left_rotate_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_rotate_32"] - pub fn left_rotate_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_rotate_64"] - pub fn left_rotate_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_rotate_8"] - pub fn left_rotate_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_16"] - pub fn left_shift_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_32"] - pub fn left_shift_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_64"] - pub fn left_shift_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_8"] - pub fn left_shift_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_with_16"] - pub fn left_shift_with_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_with_32"] - pub fn left_shift_with_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_with_64"] - pub fn left_shift_with_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_left_shift_with_8"] - pub fn left_shift_with_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_16_1"] - pub fn leftmost_16_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_16_2"] - pub fn leftmost_16_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_16_4"] - pub fn leftmost_16_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_16_8"] - pub fn leftmost_16_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_32_1"] - pub fn leftmost_32_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_32_16"] - pub fn leftmost_32_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_32_2"] - pub fn leftmost_32_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_32_4"] - pub fn leftmost_32_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_32_8"] - pub fn leftmost_32_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_64_1"] - pub fn leftmost_64_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_64_16"] - pub fn leftmost_64_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_64_2"] - pub fn leftmost_64_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_64_32"] - pub fn leftmost_64_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_64_4"] - pub fn leftmost_64_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_64_8"] - pub fn leftmost_64_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_8_1"] - pub fn leftmost_8_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_8_2"] - pub fn leftmost_8_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_leftmost_8_4"] - pub fn leftmost_8_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_linear_combination_1"] - pub fn linear_combination_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_linear_verify_1"] - pub fn linear_verify_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_lock_time"] - pub fn lock_time(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_low_1"] - pub fn low_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_low_16"] - pub fn low_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_low_32"] - pub fn low_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_low_64"] - pub fn low_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_low_8"] - pub fn low_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_lt_16"] - pub fn lt_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_lt_32"] - pub fn lt_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_lt_64"] - pub fn lt_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_lt_8"] - pub fn lt_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_maj_1"] - pub fn maj_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_maj_16"] - pub fn maj_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_maj_32"] - pub fn maj_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_maj_64"] - pub fn maj_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_maj_8"] - pub fn maj_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_max_16"] - pub fn max_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_max_32"] - pub fn max_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_max_64"] - pub fn max_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_max_8"] - pub fn max_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_median_16"] - pub fn median_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_median_32"] - pub fn median_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_median_64"] - pub fn median_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_median_8"] - pub fn median_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_min_16"] - pub fn min_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_min_32"] - pub fn min_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_min_64"] - pub fn min_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_min_8"] - pub fn min_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_modulo_16"] - pub fn modulo_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_modulo_32"] - pub fn modulo_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_modulo_64"] - pub fn modulo_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_modulo_8"] - pub fn modulo_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_multiply_16"] - pub fn multiply_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_multiply_32"] - pub fn multiply_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_multiply_64"] - pub fn multiply_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_multiply_8"] - pub fn multiply_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_negate_16"] - pub fn negate_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_negate_32"] - pub fn negate_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_negate_64"] - pub fn negate_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_negate_8"] - pub fn negate_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_new_issuance_contract"] - pub fn new_issuance_contract(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_nonce_hash"] - pub fn nonce_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_num_inputs"] - pub fn num_inputs(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_num_outputs"] - pub fn num_outputs(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_one_16"] - pub fn one_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_one_32"] - pub fn one_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_one_64"] - pub fn one_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_one_8"] - pub fn one_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_or_1"] - pub fn or_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_or_16"] - pub fn or_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_or_32"] - pub fn or_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_or_64"] - pub fn or_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_or_8"] - pub fn or_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_outpoint_hash"] - pub fn outpoint_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_amount"] - pub fn output_amount(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_amounts_hash"] - pub fn output_amounts_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_asset"] - pub fn output_asset(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_hash"] - pub fn output_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_is_fee"] - pub fn output_is_fee(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_nonce"] - pub fn output_nonce(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_nonces_hash"] - pub fn output_nonces_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_null_datum"] - pub fn output_null_datum(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_range_proof"] - pub fn output_range_proof(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_range_proofs_hash"] - pub fn output_range_proofs_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_script_hash"] - pub fn output_script_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_scripts_hash"] - pub fn output_scripts_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_surjection_proof"] - pub fn output_surjection_proof(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_output_surjection_proofs_hash"] - pub fn output_surjection_proofs_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_outputs_hash"] - pub fn outputs_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_parse_lock"] - pub fn parse_lock(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_parse_sequence"] - pub fn parse_sequence(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_point_verify_1"] - pub fn point_verify_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_reissuance_blinding"] - pub fn reissuance_blinding(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_reissuance_entropy"] - pub fn reissuance_entropy(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_right_extend_16_32"] - pub fn right_extend_16_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_extend_16_64"] - pub fn right_extend_16_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_extend_32_64"] - pub fn right_extend_32_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_extend_8_16"] - pub fn right_extend_8_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_extend_8_32"] - pub fn right_extend_8_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_extend_8_64"] - pub fn right_extend_8_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_16_32"] - pub fn right_pad_high_16_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_16_64"] - pub fn right_pad_high_16_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_1_16"] - pub fn right_pad_high_1_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_1_32"] - pub fn right_pad_high_1_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_1_64"] - pub fn right_pad_high_1_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_1_8"] - pub fn right_pad_high_1_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_32_64"] - pub fn right_pad_high_32_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_8_16"] - pub fn right_pad_high_8_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_8_32"] - pub fn right_pad_high_8_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_high_8_64"] - pub fn right_pad_high_8_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_16_32"] - pub fn right_pad_low_16_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_16_64"] - pub fn right_pad_low_16_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_1_16"] - pub fn right_pad_low_1_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_1_32"] - pub fn right_pad_low_1_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_1_64"] - pub fn right_pad_low_1_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_1_8"] - pub fn right_pad_low_1_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_32_64"] - pub fn right_pad_low_32_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_8_16"] - pub fn right_pad_low_8_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_8_32"] - pub fn right_pad_low_8_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_pad_low_8_64"] - pub fn right_pad_low_8_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_rotate_16"] - pub fn right_rotate_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_rotate_32"] - pub fn right_rotate_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_rotate_64"] - pub fn right_rotate_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_rotate_8"] - pub fn right_rotate_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_16"] - pub fn right_shift_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_32"] - pub fn right_shift_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_64"] - pub fn right_shift_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_8"] - pub fn right_shift_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_with_16"] - pub fn right_shift_with_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_with_32"] - pub fn right_shift_with_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_with_64"] - pub fn right_shift_with_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_right_shift_with_8"] - pub fn right_shift_with_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_16_1"] - pub fn rightmost_16_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_16_2"] - pub fn rightmost_16_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_16_4"] - pub fn rightmost_16_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_16_8"] - pub fn rightmost_16_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_32_1"] - pub fn rightmost_32_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_32_16"] - pub fn rightmost_32_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_32_2"] - pub fn rightmost_32_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_32_4"] - pub fn rightmost_32_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_32_8"] - pub fn rightmost_32_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_64_1"] - pub fn rightmost_64_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_64_16"] - pub fn rightmost_64_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_64_2"] - pub fn rightmost_64_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_64_32"] - pub fn rightmost_64_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_64_4"] - pub fn rightmost_64_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_64_8"] - pub fn rightmost_64_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_8_1"] - pub fn rightmost_8_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_8_2"] - pub fn rightmost_8_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_rightmost_8_4"] - pub fn rightmost_8_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_add"] - pub fn scalar_add(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_invert"] - pub fn scalar_invert(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_is_zero"] - pub fn scalar_is_zero(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_multiply"] - pub fn scalar_multiply(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_multiply_lambda"] - pub fn scalar_multiply_lambda(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_negate"] - pub fn scalar_negate(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_normalize"] - pub fn scalar_normalize(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scalar_square"] - pub fn scalar_square(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_scale"] - pub fn scale(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_script_cmr"] - pub fn script_cmr(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_sha_256_block"] - pub fn sha_256_block(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_1"] - pub fn sha_256_ctx_8_add_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_128"] - pub fn sha_256_ctx_8_add_128(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_16"] - pub fn sha_256_ctx_8_add_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_2"] - pub fn sha_256_ctx_8_add_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_256"] - pub fn sha_256_ctx_8_add_256(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_32"] - pub fn sha_256_ctx_8_add_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_4"] - pub fn sha_256_ctx_8_add_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_512"] - pub fn sha_256_ctx_8_add_512(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_64"] - pub fn sha_256_ctx_8_add_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_8"] - pub fn sha_256_ctx_8_add_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_add_buffer_511"] - pub fn sha_256_ctx_8_add_buffer_511(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_finalize"] - pub fn sha_256_ctx_8_finalize(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_ctx_8_init"] - pub fn sha_256_ctx_8_init(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sha_256_iv"] - pub fn sha_256_iv(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_sig_all_hash"] - pub fn sig_all_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_some_1"] - pub fn some_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_some_16"] - pub fn some_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_some_32"] - pub fn some_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_some_64"] - pub fn some_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_some_8"] - pub fn some_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_subtract_16"] - pub fn subtract_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_subtract_32"] - pub fn subtract_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_subtract_64"] - pub fn subtract_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_subtract_8"] - pub fn subtract_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_swu"] - pub fn swu(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_tap_env_hash"] - pub fn tap_env_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tapdata_init"] - pub fn tapdata_init(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_tapleaf_hash"] - pub fn tapleaf_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tapleaf_version"] - pub fn tapleaf_version(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tappath"] - pub fn tappath(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tappath_hash"] - pub fn tappath_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_total_fee"] - pub fn total_fee(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_transaction_id"] - pub fn transaction_id(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tx_hash"] - pub fn tx_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tx_is_final"] - pub fn tx_is_final(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tx_lock_height"] - pub fn tx_lock_height(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_tx_lock_time"] - pub fn tx_lock_time(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_verify"] - pub fn verify(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_version"] - pub fn version(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; - #[link_name = "c_xor_1"] - pub fn xor_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_16"] - pub fn xor_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_32"] - pub fn xor_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_64"] - pub fn xor_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_8"] - pub fn xor_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_xor_1"] - pub fn xor_xor_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_xor_16"] - pub fn xor_xor_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_xor_32"] - pub fn xor_xor_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_xor_64"] - pub fn xor_xor_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; - #[link_name = "c_xor_xor_8"] - pub fn xor_xor_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const c_void) -> bool; -} diff --git a/src/bit_machine/mod.rs b/src/bit_machine/mod.rs index 39c7b35e..e5c466de 100644 --- a/src/bit_machine/mod.rs +++ b/src/bit_machine/mod.rs @@ -15,6 +15,7 @@ use std::fmt; use std::sync::Arc; use crate::analysis; +use crate::jet::JetEnvironment; use crate::jet::{Jet, JetFailed}; use crate::node::{self, RedeemNode}; use crate::types::Final; @@ -60,9 +61,9 @@ impl BitMachine { } #[cfg(test)] - pub fn test_exec( - program: Arc>, - env: &J::Environment, + pub fn test_exec( + program: Arc>, + env: &JE, ) -> Result { use crate::node::SimpleFinalizer; @@ -220,10 +221,10 @@ impl BitMachine { /// ## Precondition /// /// The Bit Machine is constructed via [`Self::for_program()`] to ensure enough space. - pub fn exec( + pub fn exec( &mut self, - program: &RedeemNode, - env: &J::Environment, + program: &RedeemNode, + env: &JE, ) -> Result { self.exec_with_tracker(program, env, &mut NoTracker) } @@ -236,14 +237,14 @@ impl BitMachine { /// ## Precondition /// /// The Bit Machine is constructed via [`Self::for_program()`] to ensure enough space. - pub fn exec_with_tracker>( + pub fn exec_with_tracker>( &mut self, - program: &RedeemNode, - env: &J::Environment, + program: &RedeemNode, + env: &JE, tracker: &mut T, ) -> Result { - enum CallStack<'a, J: Jet> { - Goto(&'a RedeemNode), + enum CallStack<'a, JE: JetEnvironment> { + Goto(&'a RedeemNode), MoveWriteFrameToRead, DropReadFrame, CopyFwd(usize), @@ -251,7 +252,7 @@ impl BitMachine { } // Not used, but useful for debugging, so keep it around - impl fmt::Debug for CallStack<'_, J> { + impl fmt::Debug for CallStack<'_, JE> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { CallStack::Goto(ins) => write!(f, "goto {}", ins.inner()), @@ -268,7 +269,7 @@ impl BitMachine { } let mut ip = program; - let mut call_stack = vec![]; + let mut call_stack: Vec> = vec![]; let output_width = ip.arrow().target.bit_width(); if output_width > 0 { @@ -435,7 +436,7 @@ impl BitMachine { } } - fn exec_jet(&mut self, jet: J, env: &J::Environment) -> Result<(), JetFailed> { + fn exec_jet(&mut self, jet: JE::Jet, env: &JE) -> Result<(), JetFailed> { use crate::ffi::c_jets::frame_ffi::{c_readBit, c_writeBit, CFrameItem}; use crate::ffi::c_jets::uword_width; use crate::ffi::ffi::UWORD; @@ -524,8 +525,8 @@ impl BitMachine { let (input_read_frame, _input_buffer) = unsafe { get_input_frame(self, input_width) }; let (mut output_write_frame, output_buffer) = unsafe { get_output_frame(output_width) }; - let jet_fn = jet.c_jet_ptr(); - let c_env = J::c_jet_env(env); + let jet_fn = JE::c_jet_ptr(&jet); + let c_env = env.c_jet_env(); let success = jet_fn(&mut output_write_frame, input_read_frame, c_env); if !success { @@ -598,6 +599,7 @@ impl From for ExecutionError { mod tests { use super::*; + use crate::jet::CoreEnv; #[cfg(feature = "elements")] use crate::jet::{elements::ElementsEnv, Elements}; #[cfg(feature = "elements")] @@ -697,7 +699,7 @@ mod tests { for _ in 0..100 { bomb = Node::pair(&bomb, &bomb).unwrap(); } - let _ = bomb.finalize_pruned(&()); + let _ = bomb.finalize_pruned(&CoreEnv::new()); }); } } diff --git a/src/human_encoding/mod.rs b/src/human_encoding/mod.rs index 4db0b355..b433e0e0 100644 --- a/src/human_encoding/mod.rs +++ b/src/human_encoding/mod.rs @@ -224,19 +224,19 @@ impl Forest { #[cfg(test)] mod tests { use crate::human_encoding::Forest; - use crate::jet::{Core, Jet}; + use crate::jet::{CoreEnv, JetEnvironment}; use crate::types; use crate::{BitMachine, Value}; use std::collections::HashMap; use std::sync::Arc; - fn assert_finalize_ok( + fn assert_finalize_ok( s: &str, witness: &HashMap, Value>, - env: &J::Environment, + env: &JE, ) { types::Context::with_context(|ctx| { - let program = Forest::::parse(s) + let program = Forest::::parse(s) .expect("Failed to parse human encoding") .to_witness_node(&ctx, witness) .expect("Forest is missing expected root") @@ -247,14 +247,14 @@ mod tests { }); } - fn assert_finalize_err( + fn assert_finalize_err( s: &str, witness: &HashMap, Value>, - env: &J::Environment, + env: &JE, err_msg: &'static str, ) { types::Context::with_context(|ctx| { - let program = match Forest::::parse(s) + let program = match Forest::::parse(s) .expect("Failed to parse human encoding") .to_witness_node(&ctx, witness) .expect("Forest is missing expected root") @@ -290,19 +290,24 @@ mod tests { (Arc::from("a"), Value::u8(0x00)), (Arc::from("b"), Value::u8(0x01)), ]); - assert_finalize_ok::(s, &a_less_than_b, &()); + assert_finalize_ok::(s, &a_less_than_b, &CoreEnv::new()); let b_greater_equal_a = HashMap::from([ (Arc::from("a"), Value::u8(0x01)), (Arc::from("b"), Value::u8(0x01)), ]); - assert_finalize_err::(s, &b_greater_equal_a, &(), "Jet failed during execution"); + assert_finalize_err::( + s, + &b_greater_equal_a, + &CoreEnv::new(), + "Jet failed during execution", + ); } #[test] fn executed_witness_without_value() { let witness = HashMap::from([(Arc::from("wit1"), Value::u32(1337))]); - assert_finalize_err::( + assert_finalize_err::( " wit1 := witness : 1 -> 2^32 wit2 := witness : 1 -> 2^32 @@ -311,7 +316,7 @@ mod tests { main := comp wits_are_equal jet_verify : 1 -> 1 ", &witness, - &(), + &CoreEnv::new(), "Jet failed during execution", ); } @@ -326,42 +331,47 @@ mod tests { main := comp input comp process jet_verify : 1 -> 1 "; let wit2_is_pruned = HashMap::from([(Arc::from("wit1"), Value::u1(0))]); - assert_finalize_ok::(s, &wit2_is_pruned, &()); + assert_finalize_ok::(s, &wit2_is_pruned, &CoreEnv::new()); let wit2_is_missing = HashMap::from([(Arc::from("wit1"), Value::u1(1))]); - assert_finalize_err::(s, &wit2_is_missing, &(), "Jet failed during execution"); + assert_finalize_err::( + s, + &wit2_is_missing, + &CoreEnv::new(), + "Jet failed during execution", + ); let wit2_is_present = HashMap::from([ (Arc::from("wit1"), Value::u1(1)), (Arc::from("wit2"), Value::u64(u64::MAX)), ]); - assert_finalize_ok::(s, &wit2_is_present, &()); + assert_finalize_ok::(s, &wit2_is_present, &CoreEnv::new()); } #[test] fn executed_hole_with_value() { let empty = HashMap::new(); - assert_finalize_ok::( + assert_finalize_ok::( " id1 := iden : 2^256 * 1 -> 2^256 * 1 main := comp (disconnect id1 ?hole) unit hole := unit ", &empty, - &(), + &CoreEnv::new(), ); } #[test] fn executed_hole_without_value() { let empty = HashMap::new(); - assert_finalize_err::( + assert_finalize_err::( " wit1 := witness main := comp wit1 comp disconnect iden ?dis2 unit ", &empty, - &(), + &CoreEnv::new(), "disconnect node had one child (redeem time); must have two", ); } @@ -374,9 +384,14 @@ mod tests { main := comp wit2 jet_verify : 1 -> 1 "; let wit1_populated = HashMap::from([(Arc::from("wit1"), Value::u1(1))]); - assert_finalize_err::(s, &wit1_populated, &(), "Jet failed during execution"); + assert_finalize_err::( + s, + &wit1_populated, + &CoreEnv::new(), + "Jet failed during execution", + ); let wit2_populated = HashMap::from([(Arc::from("wit2"), Value::u1(1))]); - assert_finalize_ok::(s, &wit2_populated, &()); + assert_finalize_ok::(s, &wit2_populated, &CoreEnv::new()); } } diff --git a/src/human_encoding/parse/mod.rs b/src/human_encoding/parse/mod.rs index 4df591c9..e57e3518 100644 --- a/src/human_encoding/parse/mod.rs +++ b/src/human_encoding/parse/mod.rs @@ -586,18 +586,18 @@ mod tests { use crate::dag::MaxSharing; use crate::human_encoding::Forest; - use crate::jet::{Core, Jet}; + use crate::jet::{Core, CoreEnv, Jet, JetEnvironment}; use crate::node::Inner; use crate::value::Word; use crate::{BitMachine, Value}; - fn assert_cmr_witness( + fn assert_cmr_witness( s: &str, cmr: &str, witness: &HashMap, Value>, - env: &J::Environment, + env: &JE, ) { - match parse::(s) { + match parse::(s) { Ok(forest) => { assert_eq!(forest.len(), 1); let main = &forest["main"]; @@ -673,18 +673,18 @@ mod tests { #[test] fn simple_program() { let empty = HashMap::new(); - assert_cmr_witness::( + assert_cmr_witness::( "main := unit", "c40a10263f7436b4160acbef1c36fba4be4d95df181a968afeab5eac247adff7", &empty, - &(), + &CoreEnv::new(), ); let witness = HashMap::from([ (Arc::from("wit1"), Value::u32(0x00010203)), (Arc::from("wit2"), Value::u32(0x00010203)), ]); - assert_cmr_witness::( + assert_cmr_witness::( " wit1 := witness : 1 -> 2^32 wit2 := witness : 1 -> 2^32 @@ -694,7 +694,7 @@ mod tests { ", "ee2d966aeccfba7f1f1e54bc130237a6ae575db9c1132193d513aeb14b18151a", &witness, - &(), + &CoreEnv::new(), ); } @@ -716,11 +716,11 @@ mod tests { #[cfg(feature = "elements")] fn bip340_program() { use crate::jet::elements::ElementsEnv; - use crate::jet::Elements; + use crate::jet::ElementsTxEnv; let empty = HashMap::new(); let dummy = ElementsEnv::dummy(); - assert_cmr_witness::( + assert_cmr_witness::( "main := unit", "c40a10263f7436b4160acbef1c36fba4be4d95df181a968afeab5eac247adff7", &empty, @@ -737,7 +737,7 @@ mod tests { ]; let signature = HashMap::from([(Arc::from("wit1"), Value::u512(sig))]); - assert_cmr_witness::( + assert_cmr_witness::( " -- Witnesses wit1 := witness : 1 -> 2^512 diff --git a/src/jet/bitcoin/mod.rs b/src/jet/bitcoin/mod.rs index 560821af..20ee978c 100644 --- a/src/jet/bitcoin/mod.rs +++ b/src/jet/bitcoin/mod.rs @@ -3,3 +3,23 @@ mod environment; pub use environment::BitcoinEnv; + +use super::init::bitcoin::Bitcoin; +use super::JetEnvironment; +use crate::jet::Jet; +use simplicity_sys::c_jets::frame_ffi::CFrameItem; + +impl JetEnvironment for BitcoinEnv { + type Jet = Bitcoin; + type CJetEnvironment = (); + + fn c_jet_env(&self) -> &Self::CJetEnvironment { + &() + } + + fn c_jet_ptr( + jet: &Self::Jet, + ) -> &dyn Fn(&mut CFrameItem, CFrameItem, &Self::CJetEnvironment) -> bool { + jet.c_jet_ptr() + } +} diff --git a/src/jet/core/mod.rs b/src/jet/core/mod.rs new file mode 100644 index 00000000..1c9e6e51 --- /dev/null +++ b/src/jet/core/mod.rs @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: CC0-1.0 + +use super::init::core::Core; +use super::JetEnvironment; +use crate::jet::Jet; +use simplicity_sys::c_jets::frame_ffi::CFrameItem; + +/// Type alias for the Core jet environment. +#[derive(Default, Debug)] +pub struct CoreEnv { + _inner: (), +} + +impl CoreEnv { + pub fn new() -> Self { + Self { _inner: () } + } +} + +impl JetEnvironment for CoreEnv { + type Jet = Core; + type CJetEnvironment = (); + + fn c_jet_env(&self) -> &Self::CJetEnvironment { + &() + } + + fn c_jet_ptr( + jet: &Self::Jet, + ) -> &dyn Fn(&mut CFrameItem, CFrameItem, &Self::CJetEnvironment) -> bool { + jet.c_jet_ptr() + } +} diff --git a/src/jet/elements/mod.rs b/src/jet/elements/mod.rs index fd4c6736..e5f2af2a 100644 --- a/src/jet/elements/mod.rs +++ b/src/jet/elements/mod.rs @@ -6,3 +6,27 @@ mod environment; mod tests; pub use environment::{ElementsEnv, ElementsUtxo}; + +use super::init::elements::Elements; +use super::JetEnvironment; +use crate::jet::Jet; +use simplicity_sys::c_jets::frame_ffi::CFrameItem; +use simplicity_sys::CElementsTxEnv; + +/// Type alias for the Elements transaction environment. +pub type ElementsTxEnv = ElementsEnv>; + +impl JetEnvironment for ElementsTxEnv { + type Jet = Elements; + type CJetEnvironment = CElementsTxEnv; + + fn c_jet_env(&self) -> &Self::CJetEnvironment { + self.c_tx_env() + } + + fn c_jet_ptr( + jet: &Self::Jet, + ) -> &dyn Fn(&mut CFrameItem, CFrameItem, &Self::CJetEnvironment) -> bool { + jet.c_jet_ptr() + } +} diff --git a/src/jet/init/mod.rs b/src/jet/init/mod.rs index c0770f99..6185bda3 100644 --- a/src/jet/init/mod.rs +++ b/src/jet/init/mod.rs @@ -1,11 +1,12 @@ // SPDX-License-Identifier: CC0-1.0 +#![allow(unused_imports)] +#![allow(unused)] + //! # Jet initialization //! //! Automatically generated by Haskell code. - #[cfg(feature = "bitcoin")] -#[allow(unused_imports)] #[rustfmt::skip] pub mod bitcoin; #[rustfmt::skip] pub mod core; #[cfg(feature = "elements")] diff --git a/src/jet/mod.rs b/src/jet/mod.rs index 085b0d12..52ffd3fe 100644 --- a/src/jet/mod.rs +++ b/src/jet/mod.rs @@ -14,11 +14,18 @@ #[cfg(feature = "bitcoin")] pub mod bitcoin; +pub mod core; #[cfg(feature = "elements")] pub mod elements; mod init; pub mod type_name; +pub use self::core::CoreEnv; +#[cfg(feature = "bitcoin")] +pub use crate::jet::bitcoin::BitcoinEnv; +#[cfg(feature = "elements")] +pub use elements::ElementsTxEnv; + #[cfg(feature = "bitcoin")] pub use init::bitcoin::Bitcoin; pub use init::core::Core; @@ -48,6 +55,23 @@ impl std::fmt::Display for JetFailed { impl std::error::Error for JetFailed {} +/// An environment for jets to read. +pub trait JetEnvironment { + /// The type of jet that this environment supports. + type Jet: Jet; + + /// CJetEnvironment to interact with C FFI. + type CJetEnvironment; + + /// Obtains a C FFI compatible environment for the jet. + fn c_jet_env(&self) -> &Self::CJetEnvironment; + + /// Obtain the FFI C pointer for the jet. + fn c_jet_ptr( + jet: &Self::Jet, + ) -> &dyn Fn(&mut CFrameItem, CFrameItem, &Self::CJetEnvironment) -> bool; +} + /// Family of jets that share an encoding scheme and execution environment. /// /// Jets are single nodes that read an input, @@ -91,7 +115,7 @@ pub trait Jet: #[cfg(test)] mod tests { - use crate::jet::Core; + use crate::jet::{Core, CoreEnv}; use crate::node::{ConstructNode, CoreConstructible, JetConstructible}; use crate::types; use crate::value::Word; @@ -111,7 +135,7 @@ mod tests { ) .unwrap(); assert_eq!( - BitMachine::test_exec(two_words, &()).expect("executing"), + BitMachine::test_exec(two_words, &CoreEnv::new()).expect("executing"), Value::product( Value::u1(0), // carry bit Value::u32(2 + 16), // result @@ -129,7 +153,7 @@ mod tests { ) .unwrap(); assert_eq!( - BitMachine::test_exec(two_words, &()).expect("executing"), + BitMachine::test_exec(two_words, &CoreEnv::new()).expect("executing"), Value::product(Value::u32(2), Value::u16(16)), ); }); diff --git a/src/node/commit.rs b/src/node/commit.rs index ea6f0ef5..99a6374e 100644 --- a/src/node/commit.rs +++ b/src/node/commit.rs @@ -310,7 +310,7 @@ mod tests { use crate::decode::Error; use crate::human_encoding::Forest; - use crate::jet::Core; + use crate::jet::{Core, CoreEnv}; use crate::node::SimpleFinalizer; use crate::{BitMachine, Value}; @@ -565,7 +565,7 @@ mod tests { // Execute the program to confirm that it worked let mut mac = BitMachine::for_program(&diff1_final).expect("program has reasonable bounds"); - mac.exec(&diff1_final, &()).unwrap(); + mac.exec(&diff1_final, &CoreEnv::new()).unwrap(); } } diff --git a/src/node/construct.rs b/src/node/construct.rs index eda9b366..4e7668ef 100644 --- a/src/node/construct.rs +++ b/src/node/construct.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: CC0-1.0 use crate::dag::{InternalSharing, PostOrderIterItem}; -use crate::jet::Jet; +use crate::jet::{Jet, JetEnvironment}; use crate::types::{self, arrow::Arrow}; use crate::{encode, BitIter, BitWriter, Cmr, FailEntropy, FinalizeError, RedeemNode, Value, Word}; @@ -212,10 +212,10 @@ impl<'brand, J: Jet> ConstructNode<'brand, J> { /// ## See /// /// [`RedeemNode::prune`] - pub fn finalize_pruned( + pub fn finalize_pruned>( &self, - env: &J::Environment, - ) -> Result>, FinalizeError> { + env: &JE, + ) -> Result>, FinalizeError> { let unpruned = self.finalize_unpruned()?; unpruned.prune(env).map_err(FinalizeError::Execution) } diff --git a/src/node/redeem.rs b/src/node/redeem.rs index e12bc360..66415ff6 100644 --- a/src/node/redeem.rs +++ b/src/node/redeem.rs @@ -3,7 +3,7 @@ use crate::analysis::NodeBounds; use crate::bit_machine::{ExecutionError, PruneTracker, SetTracker}; use crate::dag::{DagLike, InternalSharing, MaxSharing, PostOrderIterItem}; -use crate::jet::Jet; +use crate::jet::{Jet, JetEnvironment}; use crate::types::{self, arrow::FinalArrow}; use crate::{encode, BitMachine}; use crate::{Amr, BitIter, BitWriter, Cmr, DecodeError, Ihr, Imr, Value}; @@ -289,7 +289,10 @@ impl RedeemNode { /// Pruning fails if the original, unpruned program fails to run on the Bit Machine (step 1). /// In this case, the witness data needs to be revised. /// The other pruning steps (2 & 3) never fail. - pub fn prune(&self, env: &J::Environment) -> Result>, ExecutionError> { + pub fn prune>( + &self, + env: &JE, + ) -> Result>, ExecutionError> { self.prune_with_tracker(env, &mut SetTracker::default()) } @@ -298,9 +301,9 @@ impl RedeemNode { /// /// See [`crate::bit_machine::StderrTracker`] as an example which outputs the IHR of /// each case combinator that we prune a child of. - pub fn prune_with_tracker>( + pub fn prune_with_tracker, T: PruneTracker>( &self, - env: &J::Environment, + env: &JE, tracker: &mut T, ) -> Result>, ExecutionError> { struct Pruner<'brand, 't, J, T> { @@ -963,15 +966,15 @@ mod tests { } #[cfg(feature = "elements")] - fn assert_correct_pruning( + fn assert_correct_pruning( unpruned_prog: &str, unpruned_wit: &HashMap, Value>, expected_pruned_prog: &str, expected_pruned_wit: &HashMap, Value>, - env: &J::Environment, + env: &JE, ) { let unpruned_program = types::Context::with_context(|ctx| { - Forest::::parse(unpruned_prog) + Forest::::parse(unpruned_prog) .expect("unpruned program should parse") .to_witness_node(&ctx, unpruned_wit) .expect("unpruned program should have main") @@ -979,7 +982,7 @@ mod tests { .expect("unpruned program should finalize") }); let expected_unpruned_program = types::Context::with_context(|ctx| { - Forest::::parse(expected_pruned_prog) + Forest::::parse(expected_pruned_prog) .expect("expected pruned program should parse") .to_witness_node(&ctx, expected_pruned_wit) .expect("expected pruned program should have main") @@ -1016,6 +1019,8 @@ mod tests { #[test] #[cfg(feature = "elements")] fn prune() { + use crate::jet::ElementsTxEnv; + let env = crate::jet::elements::ElementsEnv::dummy(); /* @@ -1047,7 +1052,7 @@ main := comp input comp process jet_verify : 1 -> 1"#; Value::product(Value::u64(0), Value::unit()), ), ]); - assert_correct_pruning::( + assert_correct_pruning::( unpruned_prog, &unpruned_wit, pruned_prog, @@ -1075,7 +1080,7 @@ main := comp input comp process jet_verify : 1 -> 1"#; Value::product(Value::unit(), Value::u64(0)), ), ]); - assert_correct_pruning::( + assert_correct_pruning::( unpruned_prog, &unpruned_wit, pruned_prog, @@ -1100,7 +1105,7 @@ process := assertl (take jet_is_zero_64) #{take jet_is_zero_64} : (2^64 + 1) * 1 main := comp input comp process jet_verify : 1 -> 1"#; let pruned_wit = HashMap::from([(Arc::from("wit1"), Value::left(Value::u64(0), Final::unit()))]); - assert_correct_pruning::( + assert_correct_pruning::( prune_sum, &unpruned_wit, pruned_prog, @@ -1121,7 +1126,7 @@ main := comp input comp process jet_verify : 1 -> 1"#; Arc::from("wit1"), Value::right(Final::unit(), Value::u64(0)), )]); - assert_correct_pruning::( + assert_correct_pruning::( prune_sum, &unpruned_wit, pruned_prog,