diff --git a/README.md b/README.md index 6d6b608..5740ec3 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ let a: u32 = 10; let b = { let c: u32 = 2; let d: u32 = 3; - assert!(jet_eq_32(a, 10)); // Use variables from outer copes + assert!(jet::eq_32(a, 10)); // Use variables from outer copes let a: u32 = 7; // Shadow variables from outer scopes - jet_max_32(jet_max_32(c, d), a) // Missing ; because the block returns a value + jet::max_32(jet::max_32(c, d), a) // Missing ; because the block returns a value }; -assert!(jet_eq_32(b, 7)); +assert!(jet::eq_32(b, 7)); ``` Take a look at the [example programs](https://github.com/BlockstreamResearch/simfony/tree/master/example_progs). diff --git a/doc/context.md b/doc/context.md index ad97fed..3cd81ec 100644 --- a/doc/context.md +++ b/doc/context.md @@ -78,7 +78,7 @@ If `j` is the name of a jet of type B → C If Γ ⊩ `b`: B -Then Γ ⊩ `jet_j b`: C +Then Γ ⊩ `jet::j b`: C ## Chaining diff --git a/doc/translation.md b/doc/translation.md index db5a28f..0a28393 100644 --- a/doc/translation.md +++ b/doc/translation.md @@ -64,7 +64,7 @@ If `j` is the name of a jet of type B → C If Ctx(Ξ) ⊩ `b`: B -Then ⟦`jet_j b`⟧Ξ = comp ⟦`b`⟧Ξ jet_j: A → C +Then ⟦`jet::j b`⟧Ξ = comp ⟦`b`⟧Ξ j: A → C ## Chaining diff --git a/example_progs/add.simf b/example_progs/add.simf index c8c90d5..34f7092 100644 --- a/example_progs/add.simf +++ b/example_progs/add.simf @@ -1,8 +1,8 @@ fn main() { let a: u32 = 2; let b: u32 = 3; - let (carry, res): (bool, u32) = jet_add_32(a, b); - let add_res: (bool, u32) = jet_add_32(10, 20); + let (carry, res): (bool, u32) = jet::add_32(a, b); + let add_res: (bool, u32) = jet::add_32(10, 20); let (carry2, res3): (bool, u32) = add_res; - assert!(jet_eq_32(res3, 30)); + assert!(jet::eq_32(res3, 30)); } diff --git a/example_progs/array.simf b/example_progs/array.simf index dbe9a92..27929bb 100644 --- a/example_progs/array.simf +++ b/example_progs/array.simf @@ -12,7 +12,7 @@ fn main() { let []: [u1; 0] = a; let [d0, d1, d2]: [u8; 3] = d; - assert!(jet_eq_8(d0, 1)); - assert!(jet_eq_8(d1, 2)); - assert!(jet_eq_8(d2, 3)); + assert!(jet::eq_8(d0, 1)); + assert!(jet::eq_8(d1, 2)); + assert!(jet::eq_8(d2, 3)); } diff --git a/example_progs/cat.simf b/example_progs/cat.simf index 86b3e01..f6c5e76 100644 --- a/example_progs/cat.simf +++ b/example_progs/cat.simf @@ -1,8 +1,8 @@ fn main() { let ab: u16 = <(u8, u8)>::into((0x10, 0x01)); let c: u16 = 0x1001; - assert!(jet_eq_16(ab, c)); + assert!(jet::eq_16(ab, c)); let ab: u8 = <(u4, u4)>::into((0b1011, 0b1101)); let c: u8 = 0b10111101; - assert!(jet_eq_8(ab, c)); + assert!(jet::eq_8(ab, c)); } diff --git a/example_progs/checksigfromstackverify.simf b/example_progs/checksigfromstackverify.simf index c4e0081..7d914fe 100644 --- a/example_progs/checksigfromstackverify.simf +++ b/example_progs/checksigfromstackverify.simf @@ -8,5 +8,5 @@ fn main() { let pk: u256 = 0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9; let msg: u256 = witness("msg"); let sig: [u8; 64] = witness("sig"); - jet_bip_0340_verify((pk, msg), sig); + jet::bip_0340_verify((pk, msg), sig); } diff --git a/example_progs/ctv.simf b/example_progs/ctv.simf index 5e65177..3eadb44 100644 --- a/example_progs/ctv.simf +++ b/example_progs/ctv.simf @@ -6,17 +6,17 @@ * that they want to commit. */ fn main() { - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_version()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_lock_time()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_script_sigs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_num_inputs()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_sequences_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_num_outputs()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_outputs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_current_index()); - let ctv_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::version()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::lock_time()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_script_sigs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::num_inputs()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_sequences_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::num_outputs()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::outputs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::current_index()); + let ctv_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); let expected_hash: u256 = 0xae3d019b30529c6044d2b3d7ee2e0ee5db51a7f05ed5db8f089cd5d455f1fc5d; - assert!(jet_eq_256(ctv_hash, expected_hash)); + assert!(jet::eq_256(ctv_hash, expected_hash)); } diff --git a/example_progs/function.simf b/example_progs/function.simf index 1352797..e8f6a8f 100644 --- a/example_progs/function.simf +++ b/example_progs/function.simf @@ -1,6 +1,6 @@ fn checked_add_32(a: u32, b: u32) -> u32 { - let (carry, sum): (bool, u32) = jet_add_32(a, b); - assert!(::into(jet_complement_1(::into(carry)))); + let (carry, sum): (bool, u32) = jet::add_32(a, b); + assert!(::into(jet::complement_1(::into(carry)))); sum } @@ -19,9 +19,9 @@ fn third() -> u32 { fn main() { let sum: u32 = checked_add_32(42, 1); let expected: u32 = 43; - assert!(jet_eq_32(expected, sum)); + assert!(jet::eq_32(expected, sum)); let third: u32 = third(); let expected: u32 = 3; - assert!(jet_eq_32(expected, third)); + assert!(jet::eq_32(expected, third)); } diff --git a/example_progs/match.simf b/example_progs/match.simf index 6826428..5fea448 100644 --- a/example_progs/match.simf +++ b/example_progs/match.simf @@ -1,11 +1,11 @@ fn main() { let bit: bool = match Left(11) { - Left(x: u32) => jet_le_32(10, x), - Right(y: u32) => jet_le_32(y, 10), + Left(x: u32) => jet::le_32(10, x), + Right(y: u32) => jet::le_32(y, 10), }; assert!(bit); let bit: bool = match Some(11) { - Some(x: u32) => jet_le_32(10, x), + Some(x: u32) => jet::le_32(10, x), None => false, }; assert!(bit); diff --git a/example_progs/nesting.simf b/example_progs/nesting.simf index a36ad85..b3852bb 100644 --- a/example_progs/nesting.simf +++ b/example_progs/nesting.simf @@ -3,9 +3,9 @@ fn main() { let v4: u32 = 1; let v5: u32 = 2; let v6: u32 = 3; - let v7: u32 = jet_max_32(v4, jet_max_32(v5, v6)); + let v7: u32 = jet::max_32(v4, jet::max_32(v5, v6)); v4 }; let res: u32 = 1; - assert!(jet_eq_32(res, v1)); + assert!(jet::eq_32(res, v1)); } diff --git a/example_progs/recursive-covenant.simf b/example_progs/recursive-covenant.simf index 9f2849b..ed7d964 100644 --- a/example_progs/recursive-covenant.simf +++ b/example_progs/recursive-covenant.simf @@ -4,7 +4,7 @@ * in the first output of the spending transaction. */ fn main () { - let this_hash: u256 = jet_current_script_hash(); - let spend_hash: u256 = unwrap(jet_output_script_hash(0)); - assert!(jet_eq_256(this_hash, spend_hash)); + let this_hash: u256 = jet::current_script_hash(); + let spend_hash: u256 = unwrap(jet::output_script_hash(0)); + assert!(jet::eq_256(this_hash, spend_hash)); } diff --git a/example_progs/scopes.simf b/example_progs/scopes.simf index 9b41286..01f2307 100644 --- a/example_progs/scopes.simf +++ b/example_progs/scopes.simf @@ -5,14 +5,14 @@ fn main() { let v3: u32 = { let v4: u32 = 2; let v5: u32 = 3; - assert!(jet_eq_32(v7, 10)); /* Can use upper scope variables here.*/ + assert!(jet::eq_32(v7, 10)); /* Can use upper scope variables here.*/ let v7: u32 = 7; /* Can also shadow the upper scope here.*/ - jet_max_32(jet_max_32(v4, v5),v7) /* Rust like, missing ; here is the return type of expression.*/ + jet::max_32(jet::max_32(v4, v5),v7) /* Rust like, missing ; here is the return type of expression.*/ }; - assert!(jet_eq_32(v7, 10)); /* Upper scope is same just like regular Programming languages*/ - jet_min_32(v7, v3) /*Return value of v2 block*/ + assert!(jet::eq_32(v7, 10)); /* Upper scope is same just like regular Programming languages*/ + jet::min_32(v7, v3) /*Return value of v2 block*/ }; v2 }; - assert!(jet_eq_32(7, v1)); + assert!(jet::eq_32(7, v1)); } diff --git a/example_progs/sighash_all.simf b/example_progs/sighash_all.simf index dafbd06..c97d2c8 100644 --- a/example_progs/sighash_all.simf +++ b/example_progs/sighash_all.simf @@ -9,73 +9,73 @@ * the value that was returned from the dedicated jet. */ fn main () { - // jet_sig_all_hash - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_genesis_block_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_genesis_block_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_tx_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_tap_env_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_current_index()); - let sig_all_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); - let expected: u256= jet_sig_all_hash(); - assert!(jet_eq_256(sig_all_hash, expected)); + // jet::sig_all_hash + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::genesis_block_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::genesis_block_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::tx_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::tap_env_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::current_index()); + let sig_all_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); + let expected: u256= jet::sig_all_hash(); + assert!(jet::eq_256(sig_all_hash, expected)); - // jet_tx_hash - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_version()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_lock_time()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_inputs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_outputs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_issuances_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_output_surjection_proofs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_utxos_hash()); - let tx_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); - let expected: u256 = jet_tx_hash(); - assert!(jet_eq_256(tx_hash, expected)); + // jet::tx_hash + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::version()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::lock_time()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::inputs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::outputs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::issuances_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::output_surjection_proofs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_utxos_hash()); + let tx_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); + let expected: u256 = jet::tx_hash(); + assert!(jet::eq_256(tx_hash, expected)); - // jet_inputs_hash - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_outpoints_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_sequences_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_annexes_hash()); - let inputs_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); - let expected: u256 = jet_inputs_hash(); - assert!(jet_eq_256(inputs_hash, expected)); + // jet::inputs_hash + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_outpoints_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_sequences_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_annexes_hash()); + let inputs_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); + let expected: u256 = jet::inputs_hash(); + assert!(jet::eq_256(inputs_hash, expected)); - // jet_outputs_hash - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_output_amounts_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_output_nonces_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_output_scripts_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_output_range_proofs_hash()); - let outputs_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); - let expected: u256 = jet_outputs_hash(); - assert!(jet_eq_256(outputs_hash, expected)); + // jet::outputs_hash + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::output_amounts_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::output_nonces_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::output_scripts_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::output_range_proofs_hash()); + let outputs_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); + let expected: u256 = jet::outputs_hash(); + assert!(jet::eq_256(outputs_hash, expected)); - // jet_issuances_hash - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_issuance_asset_amounts_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_issuance_token_amounts_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_issuance_range_proofs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_issuance_blinding_entropy_hash()); - let issuances_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); - let expected: u256 = jet_issuances_hash(); - assert!(jet_eq_256(issuances_hash, expected)); + // jet::issuances_hash + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::issuance_asset_amounts_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::issuance_token_amounts_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::issuance_range_proofs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::issuance_blinding_entropy_hash()); + let issuances_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); + let expected: u256 = jet::issuances_hash(); + assert!(jet::eq_256(issuances_hash, expected)); - // jet_input_utxos_hash - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_amounts_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_scripts_hash()); - let input_utxos_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); - let expected: u256 = jet_input_utxos_hash(); - assert!(jet_eq_256(input_utxos_hash, expected)); + // jet::input_utxos_hash + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_amounts_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_scripts_hash()); + let input_utxos_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); + let expected: u256 = jet::input_utxos_hash(); + assert!(jet::eq_256(input_utxos_hash, expected)); - // jet_tap_env_hash - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_tapleaf_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_tappath_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_internal_key()); - let tap_env_hash: u256 = jet_sha_256_ctx_8_finalize(ctx); - let expected: u256 = jet_tap_env_hash(); - assert!(jet_eq_256(tap_env_hash, expected)); + // jet::tap_env_hash + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::tapleaf_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::tappath_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::internal_key()); + let tap_env_hash: u256 = jet::sha_256_ctx_8_finalize(ctx); + let expected: u256 = jet::tap_env_hash(); + assert!(jet::eq_256(tap_env_hash, expected)); } diff --git a/example_progs/sighash_all_anyprevoutanyscript.simf b/example_progs/sighash_all_anyprevoutanyscript.simf index 0279fe8..6a0f608 100644 --- a/example_progs/sighash_all_anyprevoutanyscript.simf +++ b/example_progs/sighash_all_anyprevoutanyscript.simf @@ -3,26 +3,26 @@ * SIGHASH_ALL | SIGHASH_ANYPREVOUTANYSCRIPT. */ fn main() { - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); // Blockchain - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_genesis_block_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_genesis_block_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::genesis_block_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::genesis_block_hash()); // Transaction - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_version()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_lock_time()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_tap_env_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::version()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::lock_time()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::tap_env_hash()); // Current input without outpoint, amounts or scriptPubKey - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_current_sequence()); - let ctx: Ctx8 = jet_annex_hash(ctx, jet_current_annex_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::current_sequence()); + let ctx: Ctx8 = jet::annex_hash(ctx, jet::current_annex_hash()); // All outputs - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_outputs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_issuances_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_output_surjection_proofs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::outputs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::issuances_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::output_surjection_proofs_hash()); // No current index // Message - let msg: u256 = jet_sha_256_ctx_8_finalize(ctx); + let msg: u256 = jet::sha_256_ctx_8_finalize(ctx); let pk: u256 = 0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9; let sig: [u8; 64] = witness("sig"); - jet_bip_0340_verify((pk, msg), sig); + jet::bip_0340_verify((pk, msg), sig); } diff --git a/example_progs/sighash_none.simf b/example_progs/sighash_none.simf index 0042205..2661251 100644 --- a/example_progs/sighash_none.simf +++ b/example_progs/sighash_none.simf @@ -3,24 +3,24 @@ * SIGHASH_NONE. */ fn main() { - let ctx: Ctx8 = jet_sha_256_ctx_8_init(); + let ctx: Ctx8 = jet::sha_256_ctx_8_init(); // Blockchain - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_genesis_block_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_genesis_block_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::genesis_block_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::genesis_block_hash()); // Transaction - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_version()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_lock_time()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_tap_env_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::version()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::lock_time()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::tap_env_hash()); // All inputs - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_inputs_hash()); - let ctx: Ctx8 = jet_sha_256_ctx_8_add_32(ctx, jet_input_utxos_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::inputs_hash()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_32(ctx, jet::input_utxos_hash()); // No outputs // Current index - let ctx: Ctx8 = jet_sha_256_ctx_8_add_4(ctx, jet_current_index()); + let ctx: Ctx8 = jet::sha_256_ctx_8_add_4(ctx, jet::current_index()); // Message - let msg: u256 = jet_sha_256_ctx_8_finalize(ctx); + let msg: u256 = jet::sha_256_ctx_8_finalize(ctx); let pk: u256 = 0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9; let sig: [u8; 64] = witness("sig"); - jet_bip_0340_verify((pk, msg), sig); + jet::bip_0340_verify((pk, msg), sig); } diff --git a/example_progs/tuple.simf b/example_progs/tuple.simf index aa22fae..b1c0164 100644 --- a/example_progs/tuple.simf +++ b/example_progs/tuple.simf @@ -7,10 +7,10 @@ fn main() { let (e,): (u32,) = b; let (f,g): (u32,u32) = c; let (h,i,j): (u32,u32,u32) = d; - assert!(jet_eq_32(e,1)); - assert!(jet_eq_32(f,2)); - assert!(jet_eq_32(g,3)); - assert!(jet_eq_32(h,4)); - assert!(jet_eq_32(i,5)); - assert!(jet_eq_32(j,6)); + assert!(jet::eq_32(e,1)); + assert!(jet::eq_32(f,2)); + assert!(jet::eq_32(g,3)); + assert!(jet::eq_32(h,4)); + assert!(jet::eq_32(i,5)); + assert!(jet::eq_32(j,6)); } diff --git a/example_progs/unwrap.simf b/example_progs/unwrap.simf index ec33d32..b80ab6f 100644 --- a/example_progs/unwrap.simf +++ b/example_progs/unwrap.simf @@ -1,8 +1,8 @@ fn main() { - let l_or_r: Either = jet_parse_lock(10); + let l_or_r: Either = jet::parse_lock(10); let l: u32 = unwrap_left::