Skip to content

Commit 31fbf27

Browse files
committed
Merge #67: update rust-bitcoin to 0.31
e7a853e ci: remove duplicated and wrong job (Riccardo Casatta) b8ceef7 update rust-bitcoin to 0.31 (Riccardo Casatta) Pull request description: ~~Solves only hard errors for now~~ ACKs for top commit: jamesdorfman: utACK e7a853e. apoelstra: ACK e7a853e Tree-SHA512: 560fb6d929cd15f8d2488b4583801e90833001c94806946e04b617480a306b8733d9d370a55a6d376e349e511324c02aa2ac41744e2744f0660fd929c6900363
2 parents 2f58314 + e7a853e commit 31fbf27

File tree

27 files changed

+143
-145
lines changed

27 files changed

+143
-145
lines changed

.github/workflows/rust.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,3 @@ jobs:
8383
env:
8484
DO_FEATURE_MATRIX: true
8585
run: ./contrib/test.sh
86-
87-
IntTests:
88-
name: Integration tests
89-
runs-on: ubuntu-latest
90-
steps:
91-
- name: Checkout Crate
92-
uses: actions/checkout@v2
93-
- name: Checkout Toolchain
94-
uses: actions-rs/toolchain@v1
95-
with:
96-
profile: minimal
97-
toolchain: stable
98-
override: true
99-
- name: Running cargo
100-
run: ./contrib/test.sh

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ rand = ["bitcoin/rand"]
1919
base64 = ["bitcoin/base64"]
2020

2121
[dependencies]
22-
bitcoin = "0.30.0"
23-
elements = "0.23.0"
24-
bitcoin-miniscript = { package = "miniscript", version = "10.0" }
25-
simplicity = { git = "https://github.com/BlockstreamResearch/rust-simplicity", rev = "d5c0d65320816bfdf36411feed4bdff0708b5b12", optional = true }
22+
bitcoin = "0.31.0"
23+
elements = "0.24.0"
24+
bitcoin-miniscript = { package = "miniscript", version = "11.0" }
25+
simplicity = { git = "https://github.com/BlockstreamResearch/rust-simplicity", rev = "39fe6d7533b06001e9954fa08df34a1052702caf", optional = true }
2626

2727
# Do NOT use this as a feature! Use the `serde` feature instead.
2828
actual-serde = { package = "serde", version = "1.0", optional = true }
@@ -31,8 +31,8 @@ actual-serde = { package = "serde", version = "1.0", optional = true }
3131
serde_json = "1.0"
3232
actual-rand = { package = "rand", version = "0.8.4"}
3333
serde_test = "1.0.147"
34-
bitcoin = { version = "0.30.0", features = ["base64"] }
35-
secp256k1 = {version = "0.27.0", features = ["rand-std"]}
34+
bitcoin = { version = "0.31.0", features = ["base64"] }
35+
secp256k1 = {version = "0.28.0", features = ["rand-std"]}
3636
actual-base64 = { package = "base64", version = "0.13.0" }
3737

3838

bitcoind-tests/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ edition = "2018"
88

99
[dependencies]
1010
elements-miniscript = { path = "../" }
11-
elementsd = { version = "0.8.0" }
11+
elementsd = { version = "0.9.0" }
1212
actual-rand = { package = "rand", version = "0.8.4" }
13-
secp256k1 = { version = "0.27.0", features = ["rand-std"] }
13+
secp256k1 = { version = "0.28.1", features = ["rand-std"] }

bitcoind-tests/tests/setup/test_util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct PubData {
5757
#[derive(Debug, Clone)]
5858
pub struct SecretData {
5959
pub sks: Vec<bitcoin::secp256k1::SecretKey>,
60-
pub x_only_keypairs: Vec<bitcoin::key::KeyPair>,
60+
pub x_only_keypairs: Vec<bitcoin::key::Keypair>,
6161
pub sha256_pre: [u8; 32],
6262
pub hash256_pre: [u8; 32],
6363
pub ripemd160_pre: [u8; 32],
@@ -75,7 +75,7 @@ fn setup_keys(
7575
) -> (
7676
Vec<bitcoin::secp256k1::SecretKey>,
7777
Vec<miniscript::bitcoin::PublicKey>,
78-
Vec<bitcoin::key::KeyPair>,
78+
Vec<bitcoin::key::Keypair>,
7979
Vec<bitcoin::key::XOnlyPublicKey>,
8080
) {
8181
let secp_sign = secp256k1::Secp256k1::signing_only();
@@ -100,7 +100,7 @@ fn setup_keys(
100100
let mut x_only_pks = vec![];
101101

102102
for sk in &sks {
103-
let keypair = bitcoin::key::KeyPair::from_secret_key(&secp_sign, sk);
103+
let keypair = bitcoin::key::Keypair::from_secret_key(&secp_sign, sk);
104104
let (xpk, _parity) = bitcoin::key::XOnlyPublicKey::from_keypair(&keypair);
105105
x_only_keypairs.push(keypair);
106106
x_only_pks.push(xpk);

bitcoind-tests/tests/test_arith.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
105105
let prevouts = [witness_utxo];
106106
let prevouts = sighash::Prevouts::All(&prevouts);
107107
// ------------------ script spend -------------
108-
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
108+
let x_only_keypairs_reqd: Vec<(secp256k1::Keypair, TapLeafHash)> = tr
109109
.iter_scripts()
110110
.flat_map(|(_depth, script)| {
111111
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());

bitcoind-tests/tests/test_cpp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn test_from_cpp_ms(cl: &ElementsD, testdata: &TestData) {
148148

149149
// requires both signing and verification because we check the tx
150150
// after we psbt extract it
151-
let msg = secp256k1_zkp::Message::from_slice(&sighash[..]).unwrap();
151+
let msg = secp256k1_zkp::Message::from_digest_slice(&sighash[..]).unwrap();
152152

153153
// Finally construct the signature and add to psbt
154154
for sk in sks_reqd {

bitcoind-tests/tests/test_csfs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
106106
let prevouts = [witness_utxo];
107107
let prevouts = sighash::Prevouts::All(&prevouts);
108108
// ------------------ script spend -------------
109-
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
109+
let x_only_keypairs_reqd: Vec<(secp256k1::Keypair, TapLeafHash)> = tr
110110
.iter_scripts()
111111
.flat_map(|(_depth, script)| {
112112
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());
@@ -126,7 +126,7 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
126126
testdata.pubdata.genesis_hash,
127127
)
128128
.unwrap();
129-
let msg = secp256k1::Message::from_slice(&sighash_msg[..]).unwrap();
129+
let msg = secp256k1::Message::from_digest_slice(&sighash_msg[..]).unwrap();
130130
let mut aux_rand = [0u8; 32];
131131
rand::thread_rng().fill_bytes(&mut aux_rand);
132132
let sig = secp.sign_schnorr_with_aux_rand(&msg, &keypair, &aux_rand);
@@ -167,7 +167,7 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
167167

168168
// Create a signature
169169
let keypair = &self.0.secretdata.x_only_keypairs[i];
170-
let msg = secp256k1::Message::from_slice(msg.as_inner()).unwrap();
170+
let msg = secp256k1::Message::from_digest_slice(msg.as_inner()).unwrap();
171171
let mut aux_rand = [0u8; 32];
172172
rand::thread_rng().fill_bytes(&mut aux_rand);
173173

bitcoind-tests/tests/test_desc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub fn test_desc_satisfy(
163163
testdata.pubdata.genesis_hash,
164164
)
165165
.unwrap();
166-
let msg = secp256k1::Message::from_slice(&sighash_msg[..]).unwrap();
166+
let msg = secp256k1::Message::from_digest_slice(&sighash_msg[..]).unwrap();
167167
let mut aux_rand = [0u8; 32];
168168
rand::thread_rng().fill_bytes(&mut aux_rand);
169169
let schnorr_sig =
@@ -176,7 +176,7 @@ pub fn test_desc_satisfy(
176176
// No internal key
177177
}
178178
// ------------------ script spend -------------
179-
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
179+
let x_only_keypairs_reqd: Vec<(secp256k1::Keypair, TapLeafHash)> = tr
180180
.iter_scripts()
181181
.flat_map(|(_depth, script)| {
182182
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());
@@ -196,7 +196,7 @@ pub fn test_desc_satisfy(
196196
testdata.pubdata.genesis_hash,
197197
)
198198
.unwrap();
199-
let msg = secp256k1::Message::from_slice(&sighash_msg[..]).unwrap();
199+
let msg = secp256k1::Message::from_digest_slice(&sighash_msg[..]).unwrap();
200200
let mut aux_rand = [0u8; 32];
201201
rand::thread_rng().fill_bytes(&mut aux_rand);
202202
let sig = secp.sign_schnorr_with_aux_rand(&msg, &keypair, &aux_rand);

bitcoind-tests/tests/test_introspect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
105105
let prevouts = [witness_utxo];
106106
let prevouts = sighash::Prevouts::All(&prevouts);
107107
// ------------------ script spend -------------
108-
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
108+
let x_only_keypairs_reqd: Vec<(secp256k1::Keypair, TapLeafHash)> = tr
109109
.iter_scripts()
110110
.flat_map(|(_depth, script)| {
111111
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());
@@ -125,7 +125,7 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
125125
testdata.pubdata.genesis_hash,
126126
)
127127
.unwrap();
128-
let msg = secp256k1::Message::from_slice(&sighash_msg[..]).unwrap();
128+
let msg = secp256k1::Message::from_digest_slice(&sighash_msg[..]).unwrap();
129129
let mut aux_rand = [0u8; 32];
130130
rand::thread_rng().fill_bytes(&mut aux_rand);
131131
let sig = secp.sign_schnorr_with_aux_rand(&msg, &keypair, &aux_rand);

examples/taproot.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ extern crate elements_miniscript as miniscript;
33
use std::collections::HashMap;
44
use std::str::FromStr;
55

6-
use bitcoin::address::WitnessVersion;
6+
use bitcoin::WitnessVersion;
77
use miniscript::descriptor::DescriptorType;
8+
use miniscript::descriptor::TapLeafScript;
89
use miniscript::policy::Concrete;
910
use miniscript::{
1011
translate_hash_fail, Descriptor, Miniscript, NoExt, Tap, TranslatePk, Translator,
1112
};
12-
use miniscript::descriptor::TapLeafScript;
13-
use secp256k1::{rand, KeyPair};
13+
use secp256k1::{rand, Keypair};
1414

1515
// Refer to https://github.com/sanket1729/adv_btc_workshop/blob/master/workshop.md#creating-a-taproot-descriptor
1616
// for a detailed explanation of the policy and it's compilation
@@ -71,14 +71,19 @@ fn main() {
7171
iter.next().unwrap(),
7272
(
7373
1,
74-
TapLeafScript::Miniscript(&Miniscript::<String, Tap, NoExt>::from_str("and_v(vc:pk_k(In),older(9))").unwrap())
74+
TapLeafScript::Miniscript(
75+
&Miniscript::<String, Tap, NoExt>::from_str("and_v(vc:pk_k(In),older(9))")
76+
.unwrap()
77+
)
7578
)
7679
);
7780
assert_eq!(
7881
iter.next().unwrap(),
7982
(
8083
1,
81-
TapLeafScript::Miniscript(&Miniscript::<String, Tap, NoExt>::from_str("multi_a(2,hA,S)").unwrap())
84+
TapLeafScript::Miniscript(
85+
&Miniscript::<String, Tap, NoExt>::from_str("multi_a(2,hA,S)").unwrap()
86+
)
8287
)
8388
);
8489
assert_eq!(iter.next(), None);
@@ -88,7 +93,7 @@ fn main() {
8893

8994
// We require secp for generating a random XOnlyPublicKey
9095
let secp = secp256k1::Secp256k1::new();
91-
let key_pair = KeyPair::new(&secp, &mut rand::thread_rng());
96+
let key_pair = Keypair::new(&secp, &mut rand::thread_rng());
9297
// Random unspendable XOnlyPublicKey provided for compilation to Taproot Descriptor
9398
let (unspendable_pubkey, _parity) = bitcoin::key::XOnlyPublicKey::from_keypair(&key_pair);
9499

0 commit comments

Comments
 (0)