Skip to content

Commit 4aad890

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feat/update-cargo-versions
2 parents 99e81cd + 2233e5e commit 4aad890

File tree

141 files changed

+1212
-1629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+1212
-1629
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ jobs:
124124
- tests::signer::v0::signing_in_0th_tenure_of_reward_cycle
125125
- tests::signer::v0::continue_after_tenure_extend
126126
- tests::signer::v0::tenure_extend_after_idle_signers
127+
- tests::signer::v0::tenure_extend_with_other_transactions
127128
- tests::signer::v0::tenure_extend_after_idle_miner
128129
- tests::signer::v0::tenure_extend_after_failed_miner
129130
- tests::signer::v0::tenure_extend_succeeds_after_rejected_attempt

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Miner will include other transactions in blocks with tenure extend transactions (#5760)
13+
814
## [3.1.0.0.4]
915

1016
### Added

Cargo.lock

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clarity/src/libclarity.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ pub mod boot_util {
6060
pub fn boot_code_id(name: &str, mainnet: bool) -> QualifiedContractIdentifier {
6161
let addr = boot_code_addr(mainnet);
6262
QualifiedContractIdentifier::new(
63-
addr.try_into()
64-
.expect("FATAL: boot contract addr is not a legal principal"),
63+
addr.into(),
6564
ContractName::try_from(name.to_string())
6665
.expect("FATAL: boot contract name is not a legal ContractName"),
6766
)

clarity/src/vm/contexts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,8 +2140,8 @@ mod test {
21402140
// not simply rollback the tx and squelch the error as includable.
21412141
let e = env
21422142
.stx_transfer(
2143-
&PrincipalData::try_from(u1).unwrap(),
2144-
&PrincipalData::try_from(u2).unwrap(),
2143+
&PrincipalData::from(u1),
2144+
&PrincipalData::from(u2),
21452145
1000,
21462146
&BuffData::empty(),
21472147
)

clarity/src/vm/test_util/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl From<&StacksPrivateKey> for StandardPrincipalData {
108108
&vec![StacksPublicKey::from_private(o)],
109109
)
110110
.unwrap();
111-
StandardPrincipalData::try_from(stacks_addr).unwrap()
111+
StandardPrincipalData::from(stacks_addr)
112112
}
113113
}
114114

clarity/src/vm/tests/simple_apply_eval.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ fn test_secp256k1() {
430430
)
431431
.unwrap();
432432
eprintln!("addr from privk {:?}", &addr);
433-
let principal = addr.try_into().unwrap();
433+
let principal = addr.into();
434434
if let PrincipalData::Standard(data) = principal {
435435
eprintln!("test_secp256k1 principal {:?}", data.to_address());
436436
}
@@ -446,7 +446,7 @@ fn test_secp256k1() {
446446
)
447447
.unwrap();
448448
eprintln!("addr from hex {:?}", addr);
449-
let principal: PrincipalData = addr.try_into().unwrap();
449+
let principal: PrincipalData = addr.into();
450450
if let PrincipalData::Standard(data) = principal.clone() {
451451
eprintln!("test_secp256k1 principal {:?}", data.to_address());
452452
}
@@ -491,8 +491,7 @@ fn test_principal_of_fix() {
491491
.unwrap()],
492492
)
493493
.unwrap()
494-
.try_into()
495-
.unwrap();
494+
.into();
496495
let testnet_principal: PrincipalData = StacksAddress::from_public_keys(
497496
C32_ADDRESS_VERSION_TESTNET_SINGLESIG,
498497
&AddressHashMode::SerializeP2PKH,
@@ -503,8 +502,7 @@ fn test_principal_of_fix() {
503502
.unwrap()],
504503
)
505504
.unwrap()
506-
.try_into()
507-
.unwrap();
505+
.into();
508506

509507
// Clarity2, mainnet, should have a mainnet principal.
510508
assert_eq!(

clarity/src/vm/types/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,9 +1531,8 @@ impl From<StandardPrincipalData> for StacksAddress {
15311531
fn from(o: StandardPrincipalData) -> StacksAddress {
15321532
// should be infallible because it's impossible to construct a StandardPrincipalData with
15331533
// an unsupported version byte
1534-
StacksAddress::new(o.version(), hash::Hash160(o.1)).unwrap_or_else(|_| {
1535-
panic!("FATAL: could not convert a StandardPrincipalData to StacksAddress")
1536-
})
1534+
StacksAddress::new(o.version(), hash::Hash160(o.1))
1535+
.expect("FATAL: could not convert a StandardPrincipalData to StacksAddress")
15371536
}
15381537
}
15391538

libsigner/src/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn test_simple_signer() {
128128
reward_cycle: 1,
129129
};
130130
for i in 0..max_events {
131-
let privk = Secp256k1PrivateKey::new();
131+
let privk = Secp256k1PrivateKey::random();
132132
let message = SignerMessage::BlockProposal(block_proposal.clone());
133133
let message_bytes = message.serialize_to_vec();
134134
let mut chunk = StackerDBChunkData::new(i as u32, 1, message_bytes);

libsigner/src/v0/messages.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ mod test {
11921192
let rejection = BlockRejection::new(
11931193
Sha512Trunc256Sum([0u8; 32]),
11941194
RejectCode::ValidationFailed(ValidateRejectCode::InvalidBlock),
1195-
&StacksPrivateKey::new(),
1195+
&StacksPrivateKey::random(),
11961196
thread_rng().gen_bool(0.5),
11971197
thread_rng().next_u64(),
11981198
);
@@ -1204,7 +1204,7 @@ mod test {
12041204
let rejection = BlockRejection::new(
12051205
Sha512Trunc256Sum([1u8; 32]),
12061206
RejectCode::ConnectivityIssues,
1207-
&StacksPrivateKey::new(),
1207+
&StacksPrivateKey::random(),
12081208
thread_rng().gen_bool(0.5),
12091209
thread_rng().next_u64(),
12101210
);
@@ -1231,7 +1231,7 @@ mod test {
12311231
let response = BlockResponse::Rejected(BlockRejection::new(
12321232
Sha512Trunc256Sum([1u8; 32]),
12331233
RejectCode::ValidationFailed(ValidateRejectCode::InvalidBlock),
1234-
&StacksPrivateKey::new(),
1234+
&StacksPrivateKey::random(),
12351235
thread_rng().gen_bool(0.5),
12361236
thread_rng().next_u64(),
12371237
));
@@ -1318,10 +1318,10 @@ mod test {
13181318

13191319
#[test]
13201320
fn verify_sign_mock_proposal() {
1321-
let private_key = StacksPrivateKey::new();
1321+
let private_key = StacksPrivateKey::random();
13221322
let public_key = StacksPublicKey::from_private(&private_key);
13231323

1324-
let bad_private_key = StacksPrivateKey::new();
1324+
let bad_private_key = StacksPrivateKey::random();
13251325
let bad_public_key = StacksPublicKey::from_private(&bad_private_key);
13261326

13271327
let mut mock_proposal = random_mock_proposal();
@@ -1353,7 +1353,7 @@ mod test {
13531353
#[test]
13541354
fn serde_mock_proposal() {
13551355
let mut mock_signature = random_mock_proposal();
1356-
mock_signature.sign(&StacksPrivateKey::new()).unwrap();
1356+
mock_signature.sign(&StacksPrivateKey::random()).unwrap();
13571357
let serialized_signature = mock_signature.serialize_to_vec();
13581358
let deserialized_signature = read_next::<MockProposal, _>(&mut &serialized_signature[..])
13591359
.expect("Failed to deserialize MockSignature");
@@ -1368,7 +1368,7 @@ mod test {
13681368
metadata: SignerMessageMetadata::default(),
13691369
};
13701370
mock_signature
1371-
.sign(&StacksPrivateKey::new())
1371+
.sign(&StacksPrivateKey::random())
13721372
.expect("Failed to sign MockSignature");
13731373
let serialized_signature = mock_signature.serialize_to_vec();
13741374
let deserialized_signature = read_next::<MockSignature, _>(&mut &serialized_signature[..])
@@ -1379,8 +1379,10 @@ mod test {
13791379
#[test]
13801380
fn serde_mock_block() {
13811381
let mock_proposal = random_mock_proposal();
1382-
let mock_signature_1 = MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::new());
1383-
let mock_signature_2 = MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::new());
1382+
let mock_signature_1 =
1383+
MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::random());
1384+
let mock_signature_2 =
1385+
MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::random());
13841386
let mock_block = MockBlock {
13851387
mock_proposal,
13861388
mock_signatures: vec![mock_signature_1, mock_signature_2],

libstackerdb/src/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::*;
2424

2525
#[test]
2626
fn test_stackerdb_slot_metadata_sign_verify() {
27-
let pk = StacksPrivateKey::new();
27+
let pk = StacksPrivateKey::random();
2828
let addr = StacksAddress::from_public_keys(
2929
C32_ADDRESS_VERSION_MAINNET_SINGLESIG,
3030
&AddressHashMode::SerializeP2PKH,

stacks-common/src/address/b58.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
//! Base58 encoder and decoder
1616
17-
use std::{error, fmt, str};
17+
use std::{fmt, str};
1818

1919
use crate::address::Error;
2020
use crate::util::hash::DoubleSha256;

stacks-common/src/address/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::{error, fmt};
1919
use sha2::{Digest, Sha256};
2020

2121
use crate::deps_common::bitcoin::blockdata::opcodes::All as btc_opcodes;
22-
use crate::deps_common::bitcoin::blockdata::script::{Builder, Instruction, Script};
22+
use crate::deps_common::bitcoin::blockdata::script::Builder;
2323
use crate::types::PublicKey;
2424
use crate::util::hash::Hash160;
2525

@@ -220,7 +220,6 @@ pub fn public_keys_to_address_hash<K: PublicKey>(
220220
mod test {
221221
use super::*;
222222
use crate::util::hash::*;
223-
use crate::util::log;
224223
use crate::util::secp256k1::Secp256k1PublicKey as PubKey;
225224

226225
struct PubkeyFixture {

stacks-common/src/bitvec.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ mod test {
260260

261261
use super::BitVec;
262262
use crate::codec::StacksMessageCodec;
263-
use crate::util::hash::to_hex;
264263

265264
fn check_set_get(mut input: BitVec<{ u16::MAX }>) {
266265
let original_input = input.clone();

stacks-common/src/deps_common/bitcoin/blockdata/block.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use crate::deps_common::bitcoin::blockdata::transaction::Transaction;
2525
use crate::deps_common::bitcoin::network::constants::Network;
2626
use crate::deps_common::bitcoin::network::encodable::VarInt;
2727
use crate::deps_common::bitcoin::network::serialize::BitcoinHash;
28-
use crate::deps_common::bitcoin::util;
2928
use crate::deps_common::bitcoin::util::hash::Sha256dHash;
3029
use crate::deps_common::bitcoin::util::Error;
3130
use crate::deps_common::bitcoin::util::Error::{SpvBadProofOfWork, SpvBadTarget};

stacks-common/src/deps_common/bitcoin/blockdata/script.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use std::mem::size_of;
2828
use std::{error, fmt};
2929

30-
use serde;
3130
use sha2::{Digest, Sha256};
3231

3332
use crate::deps_common::bitcoin::blockdata::opcodes;

stacks-common/src/deps_common/bitcoin/blockdata/transaction.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use crate::deps_common::bitcoin::network::serialize::{
3434
self, serialize, BitcoinHash, SimpleDecoder, SimpleEncoder,
3535
};
3636
use crate::deps_common::bitcoin::util::hash::Sha256dHash;
37-
use crate::util::hash::to_hex;
3837

3938
/// A reference to a transaction output
4039
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
@@ -675,7 +674,7 @@ impl SigHashType {
675674

676675
#[cfg(test)]
677676
mod tests {
678-
use super::{SigHashType, Transaction, TxIn};
677+
use super::{Transaction, TxIn};
679678
use crate::deps_common;
680679
use crate::deps_common::bitcoin::blockdata::script::Script;
681680
use crate::deps_common::bitcoin::network::serialize::{deserialize, BitcoinHash};
@@ -690,7 +689,6 @@ mod tests {
690689

691690
#[test]
692691
fn test_is_coinbase() {
693-
use crate::deps_common::bitcoin::blockdata::constants;
694692
use crate::deps_common::bitcoin::network::constants::Network;
695693

696694
let genesis = deps_common::bitcoin::blockdata::constants::genesis_block(Network::Bitcoin);

stacks-common/src/deps_common/bitcoin/network/message_network.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
//!
2020
2121
use crate::deps_common::bitcoin::network::address::Address;
22-
use crate::deps_common::bitcoin::network::constants;
23-
use crate::util;
2422

2523
// Some simple messages
2624

stacks-common/src/deps_common/bitcoin/util/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use std::char::from_digit;
1919
use std::cmp::min;
2020
use std::io::{Cursor, Write};
21-
use std::{error, fmt, mem};
21+
use std::{fmt, mem};
2222

2323
use ripemd::Ripemd160;
2424
#[cfg(feature = "serde")]

stacks-common/src/deps_common/httparse/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! Originally written by Sean McArthur.
3131
//!
3232
//! Modified by Jude Nelson to remove all unsafe code.
33-
use std::{error, fmt, mem, result, str};
33+
use std::{fmt, mem, result, str};
3434

3535
macro_rules! next {
3636
($bytes:ident) => {{
@@ -1282,8 +1282,6 @@ mod tests {
12821282

12831283
#[test]
12841284
fn test_std_error() {
1285-
use std::error::Error as StdError;
1286-
12871285
use super::Error;
12881286
let err = Error::HeaderName;
12891287
assert_eq!(err.to_string(), err.description_str());

stacks-common/src/libcommon.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#![allow(unused_macros)]
2-
#![allow(unused_imports)]
32
#![allow(dead_code)]
43
#![allow(non_camel_case_types)]
54
#![allow(non_snake_case)]
65
#![allow(non_upper_case_globals)]
76
#![cfg_attr(test, allow(unused_variables, unused_assignments))]
87
#![allow(clippy::assertions_on_constants)]
98

9+
#[allow(unused_imports)]
1010
#[macro_use(o, slog_log, slog_trace, slog_debug, slog_info, slog_warn, slog_error)]
1111
extern crate slog;
1212

@@ -33,8 +33,6 @@ pub mod deps_common;
3333

3434
pub mod bitvec;
3535

36-
use crate::types::chainstate::{BlockHeaderHash, BurnchainHeaderHash, SortitionId, StacksBlockId};
37-
3836
pub mod consts {
3937
use crate::types::chainstate::{BlockHeaderHash, ConsensusHash};
4038
pub use crate::types::MINING_COMMITMENT_WINDOW;

0 commit comments

Comments
 (0)