Skip to content
Closed
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
269 changes: 216 additions & 53 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = ["simplicity", "liquid", "elements", "smart-contracts"]
categories = ["cryptography::cryptocurrencies"]

[dependencies]
smplx-std = { version = "0.0.12" }
smplx-std = { version = "0.1.0" }

[dev-dependencies]
anyhow = { version = "1.0.101" }
Expand Down
11 changes: 8 additions & 3 deletions Simplex.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,28 @@
# out_dir = "./src/artifacts"

# [dependencies]
# some_dep = { git = "<git url>", path = "<or a relative path>" }
# some_dep = { git = "<git url>", path = "<or relative path>", <tag | rev | branch> = "<tag name | commit | branch name>", package = "<dir path>" }

# [regtest]
# mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
# mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
# bitcoins = 10_000_000
# rpc_port = 18443
# esplora_port = 3000
# rpc_user = "user"
# rpc_password = "password"

# [test]
# mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
# mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
# bitcoins = 10_000_000
# verbosity = 0

# [test.esplora]
# url = "<esplora url>"
# network = "<Liquid, LiquidTestnet, ElementsRegtest>"

[test.fuzz]
cases = 10
# seed = 12345
# network = "<Liquid, LiquidTestnet, ElementsRegtest>"

# [test.rpc]
Expand Down
15 changes: 8 additions & 7 deletions tests/stdlib/common/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
#![allow(dead_code)]

use secp256k1_zkp::Secp256k1;
use simplex::program::{Program, WitnessTrait};
use simplex::program::Program;
use simplex::signer::Signer;
use simplex::simplicityhl::WitnessValues;
use simplex::simplicityhl::elements::{AssetId, Script, Txid};
use simplex::transaction::partial_input::IssuanceInput;
use simplex::transaction::{
Expand Down Expand Up @@ -110,7 +111,7 @@ pub fn construct_final_tx<W>(
txids: Vec<Txid>,
) -> anyhow::Result<FinalTransaction>
where
W: WitnessTrait + 'static,
W: Into<WitnessValues> + 'static,
{
let signer = context.get_default_signer();
let script_to_send_to = signer.get_address().script_pubkey();
Expand Down Expand Up @@ -140,7 +141,7 @@ where

ft.add_program_input(
PartialInput::new(program_utxo.clone()),
ProgramInput::new(Box::new(program.as_ref().clone()), Box::new(witness)),
ProgramInput::new(Box::new(program.as_ref().clone()), witness.into()),
RequiredSignature::None,
);

Expand Down Expand Up @@ -232,7 +233,7 @@ pub fn spend<W>(
txids: Vec<Txid>,
) -> anyhow::Result<String>
where
W: WitnessTrait + 'static,
W: Into<WitnessValues> + 'static,
{
let ft = construct_final_tx(context, program, script, witness, data, txids)?;

Expand Down Expand Up @@ -267,7 +268,7 @@ pub fn run<W>(
expect: Expect,
) -> anyhow::Result<()>
where
W: WitnessTrait + 'static,
W: Into<WitnessValues> + 'static,
{
let script = fund(context, &program, DEFAULT_SEND_AMOUNT)?;
let result = spend(context, &program, &script, witness, None, Vec::new());
Expand All @@ -285,7 +286,7 @@ pub fn run_with_op_return<W>(
data: &[u8],
) -> anyhow::Result<()>
where
W: WitnessTrait + 'static,
W: Into<WitnessValues> + 'static,
{
let script = fund(context, &program, DEFAULT_SEND_AMOUNT)?;
let result = spend(context, &program, &script, witness, Some(data), Vec::new());
Expand All @@ -302,7 +303,7 @@ pub fn run_with_inputs_outputs<W>(
txids: Vec<Txid>,
) -> anyhow::Result<()>
where
W: WitnessTrait + 'static,
W: Into<WitnessValues> + 'static,
{
let script = program.as_ref().get_script_pubkey(context.get_network());

Expand Down
6 changes: 3 additions & 3 deletions tests/stdlib/common/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::ops::{Add, Div, Mul, Sub};
use rand::Rng;
use rand::distributions::uniform::SampleUniform;

use simplex::program::{Program, WitnessTrait};

use simplex::program::{Program};
use simplex::simplicityhl::WitnessValues;
use crate::common::u256_wrapper::U256Wrapper;

use super::core::{Expect, run};
Expand Down Expand Up @@ -47,7 +47,7 @@ pub trait TestUint:
+ Div<Output = Self>
{
type Program: AsRef<Program>;
type Witness: WitnessTrait + 'static;
type Witness: Into<WitnessValues> + 'static;

const ZERO: Self;
const ONE: Self;
Expand Down
2 changes: 1 addition & 1 deletion tests/stdlib/common/utxo_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub fn create_utxos_with_new_asset(
}
}

Ok((new_asset.unwrap().into_inner().0, txids))
Ok((new_asset.unwrap().to_byte_array(), txids))
}

fn get_asset_id_amount_from_conf_utxo(conf_utxo: UTXO) -> anyhow::Result<ConfidentialAsset> {
Expand Down
Loading
Loading