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
72 changes: 36 additions & 36 deletions Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"

[[package]]
name = "base58ck"
version = "0.1.0"
version = "0.1.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f"
checksum = "365c0acd5b2e8dd0111a46c4faea83fb3cfb6e39a49a7c73a06e090db7b2eff0"
dependencies = [
"bitcoin-internals 0.3.0",
"bitcoin_hashes 0.14.1",
"bitcoin_hashes 0.14.101",
]

[[package]]
Expand Down Expand Up @@ -59,17 +58,17 @@ checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"

[[package]]
name = "bitcoin"
version = "0.32.8"
version = "0.32.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e499f9fc0407f50fe98af744ab44fa67d409f76b6772e1689ec8485eb0c0f66"
checksum = "bb0ce8bd5baaa0d303a19915a6d93afed161f528654e42da2a7a97d05c59499a"
dependencies = [
"base58ck",
"base64 0.21.7",
"bech32",
"bitcoin-internals 0.3.0",
"bitcoin-consensus-encoding",
"bitcoin-io",
"bitcoin-units",
"bitcoin_hashes 0.14.1",
"bitcoin_hashes 0.14.101",
"hex-conservative 0.2.2",
"hex_lit",
"secp256k1",
Expand All @@ -78,19 +77,12 @@ dependencies = [

[[package]]
name = "bitcoin-consensus-encoding"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "207311705279250ba465076a1bac4b1ac982855fff73fc5f67e22158ac58cdc9"
dependencies = [
"bitcoin-internals 0.6.0",
]

[[package]]
name = "bitcoin-internals"
version = "0.3.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2"
checksum = "6712f9c6fd6785b3b270884e57c441c403dc5d7e19ca45368c97c7a1de3000ec"
dependencies = [
"bitcoin-internals",
"hex-conservative 1.2.0",
"serde",
]

Expand All @@ -102,9 +94,12 @@ checksum = "d573f4cf32996a8dce612e4348cece65a241f1882ed594047c9ba348e8869fa5"

[[package]]
name = "bitcoin-io"
version = "0.1.4"
version = "0.1.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dee39a0ee5b4095224a0cfc6bf4cc1baf0f9624b96b367e53b66d974e51d953"
checksum = "bb5de036369d1ac59d3c1819ebc4d850f89466f5401c571a285b6ed564a4cb78"
dependencies = [
"bitcoin-consensus-encoding",
]

[[package]]
name = "bitcoin-private"
Expand All @@ -114,19 +109,19 @@ checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57"

[[package]]
name = "bitcoin-units"
version = "0.1.2"
version = "0.1.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2"
checksum = "9cb95693f371d089a4b5b6fc41c6f3ea6e01ee8c15388335dfac8ea685173b51"
dependencies = [
"bitcoin-internals 0.3.0",
"bitcoin-consensus-encoding",
"serde",
]

[[package]]
name = "bitcoin_hashes"
version = "0.14.1"
version = "0.14.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b"
checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2"
dependencies = [
"bitcoin-io",
"hex-conservative 0.2.2",
Expand All @@ -135,13 +130,14 @@ dependencies = [

[[package]]
name = "bitcoin_hashes"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a67800fcf7f3ca52f7796d4466948a424326b225950c79d1e76d0458760bb25d"
checksum = "5304e53726dbe5f93141535e102ed97b5bf4714fbecefdda8f9fb98d7fdaff0e"
dependencies = [
"bitcoin-consensus-encoding",
"bitcoin-internals 0.6.0",
"bitcoin-internals",
"hex-conservative 1.2.0",
"serde",
]

[[package]]
Expand Down Expand Up @@ -176,12 +172,16 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"

[[package]]
name = "elements"
version = "0.25.3"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83c63a04238f4b7f3564fe9705921452c2900efd00982545e5c634fac9024fe2"
checksum = "34e00f7ddcd826d2f4c9bd72d79a6b6991a0ac4286e7e2b2ff8eecd130549073"
dependencies = [
"bech32",
"bitcoin",
"bitcoin-consensus-encoding",
"bitcoin-internals",
"bitcoin_hashes 1.2.0",
"hex-conservative 1.2.0",
"secp256k1-zkp",
"serde",
]
Expand Down Expand Up @@ -485,7 +485,7 @@ version = "0.29.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113"
dependencies = [
"bitcoin_hashes 0.14.1",
"bitcoin_hashes 0.14.101",
"rand",
"secp256k1-sys",
"serde",
Expand Down Expand Up @@ -601,7 +601,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75c8fb4a18e63fbce4cf16026c36a6c38066e4f4a09ce5e81be817d0e36d8f8"
dependencies = [
"bitcoin_hashes 0.14.1",
"bitcoin_hashes 0.14.101",
"byteorder",
"getrandom 0.2.16",
"hex-conservative 0.1.2",
Expand All @@ -615,7 +615,7 @@ name = "simplicity-lang"
version = "0.8.0"
dependencies = [
"bitcoin",
"bitcoin_hashes 1.1.0",
"bitcoin_hashes 1.2.0",
"byteorder",
"elements",
"getrandom 0.2.16",
Expand All @@ -634,15 +634,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd2cc5d458a8032d328ea85e824f54f61664ab84c3d42b3b7f8804fb9b81572"
dependencies = [
"bitcoin_hashes 0.14.1",
"bitcoin_hashes 0.14.101",
"cc",
]

[[package]]
name = "simplicity-sys"
version = "0.7.0"
dependencies = [
"bitcoin_hashes 1.1.0",
"bitcoin_hashes 1.2.0",
"cc",
]

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ path = "src/lib.rs"
bitcoin = { version = "0.32.0", optional = true }
bitcoin-miniscript = { package = "miniscript", version = "12.0.0" }
byteorder = "1.3"
elements = { version = "0.25.3", optional = true, default-features = false }
elements = { version = "0.27.0", optional = true, default-features = false }
ghost-cell = { version = "0.2.6", default-features = false }
hashes = { package = "bitcoin_hashes", version = "1.1.0" }
hashes = { package = "bitcoin_hashes", version = "1.2.0" }
hex = { package = "hex-conservative", version = "1.2.0" }
logos = { version = "0.15", optional = true }
simplicity-sys = { version = "0.7.0", path = "./simplicity-sys" }
Expand Down
3 changes: 1 addition & 2 deletions fuzz/fuzz_lib/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::sync::Arc;

use super::Extractor;
use simplicity::node::{
CoreConstructible as _, DisconnectConstructible as _, JetConstructible as _,
WitnessConstructible as _,
CoreConstructible as _, DisconnectConstructible as _, WitnessConstructible as _,
};
use simplicity::types;
use simplicity::{jet::Core, Cmr, ConstructNode, FailEntropy};
Expand Down
9 changes: 3 additions & 6 deletions jets-bench/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
use bitcoin::secp256k1;
use elements::Txid;
use rand::{thread_rng, RngCore};
use simplicity::{
bitcoin, elements, elements::hashes::Hash as _, types::Final, BitIter, EarlyEndOfStreamError,
Value,
};
use simplicity::{bitcoin, elements, types::Final, BitIter, EarlyEndOfStreamError, Value};

/// Engine to compute SHA256 hash function.
/// We can't use hashes::sha256::HashEngine because it does not accept
Expand Down Expand Up @@ -182,7 +179,7 @@ impl SimplicityEncode for elements::confidential::Asset {
match self {
elements::confidential::Asset::Explicit(a) => {
let left = Final::product(Final::u1(), Final::u256());
Value::right(left, Value::u256(a.into_inner().to_byte_array()))
Value::right(left, Value::u256(a.to_byte_array()))
}
elements::confidential::Asset::Confidential(gen) => {
let ser = gen.serialize();
Expand Down Expand Up @@ -324,7 +321,7 @@ impl BenchSample for elements::confidential::Asset {
let mut rng = rand::thread_rng();
let mut asset = [0u8; 32];
rng.fill_bytes(&mut asset);
let asset = elements::AssetId::from_slice(&asset).unwrap();
let asset = elements::AssetId::from_byte_array(asset);
elements::confidential::Asset::Explicit(asset)
} else {
let asset_str = "0abb0d5d5843b9378c7f245fd7329d6fcef6926554f0c95f7cf0316239178f743c";
Expand Down
22 changes: 10 additions & 12 deletions jets-bench/src/env.rs

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions jets-bench/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ impl FlatValue {
);

unsafe {
use simplicity::elements::hashes::Hash as _;

let mut dst_inner = [UWORD::from(0u8); MAX_VALUE_BYTES / mem::size_of::<UWORD>()];
let mut src_inner = [UWORD::from(0u8); MAX_VALUE_BYTES / mem::size_of::<UWORD>()];

Expand Down Expand Up @@ -347,7 +345,7 @@ impl FlatValue {
simplicity::Cmr::unit(),
simplicity::elements::taproot::ControlBlock::from_slice(&ctrl_blk).unwrap(),
None,
simplicity::elements::BlockHash::all_zeros(),
simplicity::elements::BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
);

// We can assert this because in our sampling code jets should never
Expand Down
2 changes: 1 addition & 1 deletion simplicity-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ links = "rustsimplicity_0_7"
cc = "1.0.83"

[dependencies]
hashes = { package = "bitcoin_hashes", version = "1.1.0" }
hashes = { package = "bitcoin_hashes", version = "1.2.0" }

[features]
test-utils = []
Expand Down
3 changes: 1 addition & 2 deletions src/bit_encoding/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use crate::dag::{Dag, DagLike, InternalSharing};
use crate::jet::Jet;
use crate::merkle::cmr::Cmr;
use crate::node::{
ConstructNode, CoreConstructible, DisconnectConstructible, JetConstructible,
WitnessConstructible,
ConstructNode, CoreConstructible, DisconnectConstructible, WitnessConstructible,
};
use crate::types;
use crate::value::Word;
Expand Down
2 changes: 1 addition & 1 deletion src/bit_machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ mod tests {

#[test]
fn crash_regression2() {
use crate::node::{CoreConstructible as _, JetConstructible as _};
use crate::node::CoreConstructible as _;

type Node<'brand> = Arc<crate::ConstructNode<'brand>>;

Expand Down
40 changes: 10 additions & 30 deletions src/jet/elements/c_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
//!

use bitcoin::taproot::TAPROOT_ANNEX_PREFIX;
use elements::hashes::Hash as _;
use std::os::raw::c_uchar;

use elements::{
confidential,
encode::serialize,
secp256k1_zkp::{RangeProof, SurjectionProof},
taproot::ControlBlock,
};
use elements::{confidential, encode::serialize, taproot::ControlBlock};
use simplicity_sys::c_jets::c_env::elements as c_elements;

use crate::merkle::cmr::Cmr;
Expand Down Expand Up @@ -81,8 +75,8 @@ fn new_raw_input<'raw>(
pegin: inp_data.genesis_hash.as_ref(),
issuance: if inp.has_issuance() {
c_elements::CRawInputIssuance {
blinding_nonce: Some(inp.asset_issuance.asset_blinding_nonce.as_ref()),
asset_entropy: Some(&inp.asset_issuance.asset_entropy),
blinding_nonce: Some(inp.asset_issuance.asset_blinding_nonce.as_byte_array()),
asset_entropy: Some(inp.asset_issuance.asset_entropy.as_byte_array()),
amount: value_ptr(inp.asset_issuance.amount, &inp_data.issuance_amount),
inflation_keys: value_ptr(
inp.asset_issuance.inflation_keys,
Expand All @@ -108,6 +102,8 @@ fn new_raw_input<'raw>(
}

fn new_tx_data(tx: &elements::Transaction, in_utxos: &[ElementsUtxo]) -> RawTransactionData {
use bitcoin::hashes::Hash as _;

let mut tx_data = RawTransactionData {
inputs: Vec::with_capacity(tx.input.len()),
outputs: Vec::with_capacity(tx.output.len()),
Expand All @@ -120,10 +116,8 @@ fn new_tx_data(tx: &elements::Transaction, in_utxos: &[ElementsUtxo]) -> RawTran
.map(|x| x.genesis_hash.to_raw_hash().to_byte_array()),
issuance_amount: serialize(&inp.asset_issuance.amount),
issuance_inflation_keys: serialize(&inp.asset_issuance.inflation_keys),
amount_range_proof: serialize_rangeproof(&inp.witness.amount_rangeproof),
inflation_keys_range_proof: serialize_rangeproof(
&inp.witness.inflation_keys_rangeproof,
),
amount_range_proof: inp.witness.amount_rangeproof.to_vec(),
inflation_keys_range_proof: inp.witness.inflation_keys_rangeproof.to_vec(),
asset: asset_array(&in_utxo.asset),
value: serialize(&in_utxo.value),
};
Expand All @@ -134,8 +128,8 @@ fn new_tx_data(tx: &elements::Transaction, in_utxos: &[ElementsUtxo]) -> RawTran
asset: asset_array(&out.asset),
value: serialize(&out.value),
nonce: nonce_array(&out.nonce),
surjection_proof: serialize_surjection_proof(&out.witness.surjection_proof),
range_proof: serialize_rangeproof(&out.witness.rangeproof),
surjection_proof: out.witness.surjection_proof.to_vec(),
range_proof: out.witness.rangeproof.to_vec(),
};
tx_data.outputs.push(out_data);
}
Expand Down Expand Up @@ -177,7 +171,7 @@ pub(super) fn new_tx(
}

let c_raw_tx = c_elements::CRawTransaction {
txid: txid.as_raw_hash().as_byte_array(),
txid: txid.as_byte_array(),
inputs: raw_inputs.as_ptr(),
outputs: raw_outputs.as_ptr(),
n_inputs: raw_inputs.len().try_into().expect("sane length"),
Expand Down Expand Up @@ -262,20 +256,6 @@ fn value_ptr(value: confidential::Value, data: &[u8]) -> *const c_uchar {
}
}

fn serialize_rangeproof(rangeproof: &Option<Box<RangeProof>>) -> Vec<c_uchar> {
rangeproof
.as_ref()
.map(|x| x.serialize())
.unwrap_or_default()
}

fn serialize_surjection_proof(surjection_proof: &Option<Box<SurjectionProof>>) -> Vec<c_uchar> {
surjection_proof
.as_ref()
.map(|x| x.serialize())
.unwrap_or_default()
}

/// If the last item in the witness stack is an annex, return the data following the 0x50 byte.
fn get_annex(in_witness: &elements::TxInWitness) -> Option<&[u8]> {
let last_item = in_witness.script_witness.last()?;
Expand Down
3 changes: 1 addition & 2 deletions src/jet/elements/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ impl ElementsEnv<std::sync::Arc<elements::Transaction>> {

/// Return a dummy Elements environment with given locktime
pub fn dummy_with(lock_time: elements::LockTime, sequence: elements::Sequence) -> Self {
use elements::hashes::Hash as _;
use elements::AssetIssuance;

let ctrl_blk: [u8; 33] = [
Expand Down Expand Up @@ -151,7 +150,7 @@ impl ElementsEnv<std::sync::Arc<elements::Transaction>> {
Cmr::from_byte_array([0; 32]),
ControlBlock::from_slice(&ctrl_blk).unwrap(),
None,
elements::BlockHash::all_zeros(),
elements::BlockHash::GENESIS_PREVIOUS_BLOCK_HASH,
)
}
}
Loading
Loading