Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ docs = []
base64 = "0.21.2"
serde = { version = "1.0.188", features = ["derive"], optional = true }
serde_json = { version = "1.0.105", optional = true }
simplicity-lang = { version = "0.7.0" }
simplicity-lang = { version = "0.7.1" }
miniscript = "12.3.1"
either = "1.12.0"
itertools = "0.13.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/escrow_with_delay.simf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn timeout_spend(sender_sig: Signature) {
let sender_pk: Pubkey = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798; // 1 * G
checksig(sender_pk, sender_sig);
let timeout: Distance = 1000;
jet::check_lock_distance(timeout);
jet::broken_do_not_use_check_lock_distance(timeout);
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/last_will.simf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn recursive_covenant() {

fn inherit_spend(inheritor_sig: Signature) {
let days_180: Distance = 25920;
jet::check_lock_distance(days_180);
jet::broken_do_not_use_check_lock_distance(days_180);
let inheritor_pk: Pubkey = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798; // 1 * G
checksig(inheritor_pk, inheritor_sig);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/presigned_vault.simf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn checksig(pk: Pubkey, sig: Signature) {

fn complete_spend(hot_sig: Signature) {
let timeout: Distance = 1000;
jet::check_lock_distance(timeout);
jet::broken_do_not_use_check_lock_distance(timeout);
let hot_pk: Pubkey = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798; // 1 * G
checksig(hot_pk, hot_sig);
}
Expand Down
8 changes: 4 additions & 4 deletions src/compile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::value::StructuralValue;
use crate::witness::Arguments;
use crate::Value;

type ProgNode<'brand> = Arc<named::ConstructNode<'brand, Elements>>;
type ProgNode<'brand> = Arc<named::ConstructNode<'brand>>;

/// Each SimplicityHL expression expects an _input value_.
/// A SimplicityHL expression is translated into a Simplicity expression
Expand Down Expand Up @@ -263,7 +263,7 @@ impl Program {
&self,
arguments: Arguments,
include_debug_symbols: bool,
) -> Result<Arc<named::CommitNode<Elements>>, RichError> {
) -> Result<Arc<named::CommitNode>, RichError> {
types::Context::with_context(|ctx| {
let mut scope = Scope::new(
ctx,
Expand Down Expand Up @@ -379,7 +379,7 @@ impl Call {

match self.name() {
CallName::Jet(name) => {
let jet = ProgNode::jet(scope.ctx(), *name);
let jet = ProgNode::jet(scope.ctx(), name);
scope.with_debug_symbol(args, &jet, self)
}
CallName::UnwrapLeft(..) => {
Expand Down Expand Up @@ -410,7 +410,7 @@ impl Call {
args.comp(&body).with_span(self)
}
CallName::Assert => {
let jet = ProgNode::jet(scope.ctx(), Elements::Verify);
let jet = ProgNode::jet(scope.ctx(), &Elements::Verify);
scope.with_debug_symbol(args, &jet, self)
}
CallName::Panic => {
Expand Down
18 changes: 9 additions & 9 deletions src/docs/jet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,11 @@ Using the notation of BIP-0341, it returns the SHA256 hash of c[33: 33 + 32m]."#
- The result of [`output_surjection_proofs_hash`] (32 bytes).
- The result of [`input_utxos_hash`] (32 bytes)."#,
// Time locks
Elements::CheckLockDistance => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_distance`] is greater than or equal to the given value.
Elements::BrokenDoNotUseCheckLockDistance => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_distance`] is greater than or equal to the given value.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: generated jet module docs still link to the old timelock jet names after the rename (i.e. to [tx_lock_distance], and to [tx_lock_duration] below)


## Panics
The assertion fails."#,
Elements::CheckLockDuration => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_duration`] is greater than or equal to the given value.
Elements::BrokenDoNotUseCheckLockDuration => r#"**Deprecated; do not use.** Assert that the value returned by [`tx_lock_duration`] is greater than or equal to the given value.

## Panics
The assertion fails"#,
Expand All @@ -624,8 +624,8 @@ The assertion fails."#,
## Panics
The assertion fails."#,
Elements::TxIsFinal => "Check if the sequence numbers of all transaction inputs are at their maximum value.",
Elements::TxLockDistance => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Distance`] value of any transaction input. Return zeroes otherwise.",
Elements::TxLockDuration => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Duration`] value of any transaction input. Return zeroes otherwise.",
Elements::BrokenDoNotUseTxLockDistance => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Distance`] value of any transaction input. Return zeroes otherwise.",
Elements::BrokenDoNotUseTxLockDuration => "**Deprecated; do not use.** If [`version`] returns 2 or greater, then return the greatest valid [`Duration`] value of any transaction input. Return zeroes otherwise.",
Elements::TxLockHeight => "If [`tx_is_final`] returns false, then try to parse the transaction's lock time as a [`Height`] value. Return zeroes otherwise.",
Elements::TxLockTime => "If [`tx_is_final`] returns false, then try to parse the transaction's lock time as a [`Time`] value. Return zeroes otherwise.",
// Issuance
Expand Down Expand Up @@ -794,10 +794,10 @@ Return zero for any asset without fees."#,
fn is_deprecated(&self) -> bool {
matches!(
self,
Elements::CheckLockDistance
| Elements::CheckLockDuration
| Elements::TxLockDistance
| Elements::TxLockDuration
Elements::BrokenDoNotUseCheckLockDistance
| Elements::BrokenDoNotUseCheckLockDuration
| Elements::BrokenDoNotUseTxLockDistance
| Elements::BrokenDoNotUseTxLockDuration
| Elements::CheckSigVerify
| Elements::Verify
)
Expand Down Expand Up @@ -991,7 +991,7 @@ const SIGNATURE_HASH_MODES: [Elements; 35] = [
];
#[rustfmt::skip]
const TIME_LOCKS: [Elements; 9] = [
Elements::CheckLockDistance, Elements::CheckLockDuration, Elements::CheckLockHeight, Elements::CheckLockTime, Elements::TxIsFinal, Elements::TxLockDistance, Elements::TxLockDuration, Elements::TxLockHeight, Elements::TxLockTime
Elements::BrokenDoNotUseCheckLockDistance, Elements::BrokenDoNotUseCheckLockDuration, Elements::CheckLockHeight, Elements::CheckLockTime, Elements::TxIsFinal, Elements::BrokenDoNotUseTxLockDistance, Elements::BrokenDoNotUseTxLockDuration, Elements::TxLockHeight, Elements::TxLockTime
];
#[rustfmt::skip]
const ISSUANCE: [Elements; 9] = [
Expand Down
16 changes: 8 additions & 8 deletions src/jet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,12 @@ pub fn source_type(jet: Elements) -> Vec<AliasedType> {
* Time locks
*/
Elements::CheckLockTime => vec![Time.into()],
Elements::CheckLockDistance => vec![Distance.into()],
Elements::CheckLockDuration => vec![Duration.into()],
Elements::BrokenDoNotUseCheckLockDistance => vec![Distance.into()],
Elements::BrokenDoNotUseCheckLockDuration => vec![Duration.into()],
Elements::CheckLockHeight => vec![Height.into()],
Elements::TxLockTime
| Elements::TxLockDistance
| Elements::TxLockDuration
| Elements::BrokenDoNotUseTxLockDistance
| Elements::BrokenDoNotUseTxLockDuration
| Elements::TxLockHeight
| Elements::TxIsFinal => vec![],
/*
Expand Down Expand Up @@ -956,13 +956,13 @@ pub fn target_type(jet: Elements) -> AliasedType {
* Time locks
*/
Elements::CheckLockTime
| Elements::CheckLockDistance
| Elements::CheckLockDuration
| Elements::BrokenDoNotUseCheckLockDistance
| Elements::BrokenDoNotUseCheckLockDuration
| Elements::CheckLockHeight => AliasedType::unit(),
Elements::TxIsFinal => bool(),
Elements::TxLockTime => Time.into(),
Elements::TxLockDistance => Distance.into(),
Elements::TxLockDuration => Duration.into(),
Elements::BrokenDoNotUseTxLockDistance => Distance.into(),
Elements::BrokenDoNotUseTxLockDuration => Duration.into(),
Elements::TxLockHeight => Height.into(),
/*
* Issuance
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod witness;
use std::sync::Arc;

use simplicity::jet::elements::ElementsEnv;
use simplicity::{jet::Elements, CommitNode, RedeemNode};
use simplicity::{CommitNode, RedeemNode};

pub extern crate either;
pub extern crate simplicity;
Expand Down Expand Up @@ -174,7 +174,7 @@ impl TemplateProgram {
/// A SimplicityHL program, compiled to Simplicity.
#[derive(Clone, Debug)]
pub struct CompiledProgram {
simplicity: Arc<named::CommitNode<Elements>>,
simplicity: Arc<named::CommitNode>,
witness_types: WitnessTypes,
debug_symbols: DebugSymbols,
parameter_types: Parameters,
Expand Down Expand Up @@ -218,7 +218,7 @@ impl CompiledProgram {
}

/// Access the Simplicity target code, without witness data.
pub fn commit(&self) -> Arc<CommitNode<Elements>> {
pub fn commit(&self) -> Arc<CommitNode> {
named::forget_names(&self.simplicity)
}

Expand Down Expand Up @@ -275,7 +275,7 @@ pub struct AbiMeta {
/// A SimplicityHL program, compiled to Simplicity and satisfied with witness data.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SatisfiedProgram {
simplicity: Arc<RedeemNode<Elements>>,
simplicity: Arc<RedeemNode>,
debug_symbols: DebugSymbols,
}

Expand All @@ -298,7 +298,7 @@ impl SatisfiedProgram {
}

/// Access the Simplicity target code, including witness data.
pub fn redeem(&self) -> &Arc<RedeemNode<Elements>> {
pub fn redeem(&self) -> &Arc<RedeemNode> {
&self.simplicity
}

Expand Down
Loading
Loading