Skip to content

Commit

Permalink
Merge branch 'develop' into chore/signer-coordinator-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
obycode committed Jan 29, 2025
2 parents c03f633 + 2233e5e commit 40f6a74
Show file tree
Hide file tree
Showing 141 changed files with 1,212 additions and 1,629 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
- tests::signer::v0::signing_in_0th_tenure_of_reward_cycle
- tests::signer::v0::continue_after_tenure_extend
- tests::signer::v0::tenure_extend_after_idle_signers
- tests::signer::v0::tenure_extend_with_other_transactions
- tests::signer::v0::tenure_extend_after_idle_miner
- tests::signer::v0::tenure_extend_after_failed_miner
- tests::signer::v0::tenure_extend_succeeds_after_rejected_attempt
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the versioning scheme outlined in the [README.md](README.md).

## [Unreleased]

### Changed

- Miner will include other transactions in blocks with tenure extend transactions (#5760)

## [3.1.0.0.4]

### Added
Expand Down
41 changes: 41 additions & 0 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions clarity/src/libclarity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ pub mod boot_util {
pub fn boot_code_id(name: &str, mainnet: bool) -> QualifiedContractIdentifier {
let addr = boot_code_addr(mainnet);
QualifiedContractIdentifier::new(
addr.try_into()
.expect("FATAL: boot contract addr is not a legal principal"),
addr.into(),
ContractName::try_from(name.to_string())
.expect("FATAL: boot contract name is not a legal ContractName"),
)
Expand Down
4 changes: 2 additions & 2 deletions clarity/src/vm/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2140,8 +2140,8 @@ mod test {
// not simply rollback the tx and squelch the error as includable.
let e = env
.stx_transfer(
&PrincipalData::try_from(u1).unwrap(),
&PrincipalData::try_from(u2).unwrap(),
&PrincipalData::from(u1),
&PrincipalData::from(u2),
1000,
&BuffData::empty(),
)
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/test_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl From<&StacksPrivateKey> for StandardPrincipalData {
&vec![StacksPublicKey::from_private(o)],
)
.unwrap();
StandardPrincipalData::try_from(stacks_addr).unwrap()
StandardPrincipalData::from(stacks_addr)
}
}

Expand Down
10 changes: 4 additions & 6 deletions clarity/src/vm/tests/simple_apply_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ fn test_secp256k1() {
)
.unwrap();
eprintln!("addr from privk {:?}", &addr);
let principal = addr.try_into().unwrap();
let principal = addr.into();
if let PrincipalData::Standard(data) = principal {
eprintln!("test_secp256k1 principal {:?}", data.to_address());
}
Expand All @@ -446,7 +446,7 @@ fn test_secp256k1() {
)
.unwrap();
eprintln!("addr from hex {:?}", addr);
let principal: PrincipalData = addr.try_into().unwrap();
let principal: PrincipalData = addr.into();
if let PrincipalData::Standard(data) = principal.clone() {
eprintln!("test_secp256k1 principal {:?}", data.to_address());
}
Expand Down Expand Up @@ -491,8 +491,7 @@ fn test_principal_of_fix() {
.unwrap()],
)
.unwrap()
.try_into()
.unwrap();
.into();
let testnet_principal: PrincipalData = StacksAddress::from_public_keys(
C32_ADDRESS_VERSION_TESTNET_SINGLESIG,
&AddressHashMode::SerializeP2PKH,
Expand All @@ -503,8 +502,7 @@ fn test_principal_of_fix() {
.unwrap()],
)
.unwrap()
.try_into()
.unwrap();
.into();

// Clarity2, mainnet, should have a mainnet principal.
assert_eq!(
Expand Down
5 changes: 2 additions & 3 deletions clarity/src/vm/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,9 +1531,8 @@ impl From<StandardPrincipalData> for StacksAddress {
fn from(o: StandardPrincipalData) -> StacksAddress {
// should be infallible because it's impossible to construct a StandardPrincipalData with
// an unsupported version byte
StacksAddress::new(o.version(), hash::Hash160(o.1)).unwrap_or_else(|_| {
panic!("FATAL: could not convert a StandardPrincipalData to StacksAddress")
})
StacksAddress::new(o.version(), hash::Hash160(o.1))
.expect("FATAL: could not convert a StandardPrincipalData to StacksAddress")
}
}

Expand Down
2 changes: 1 addition & 1 deletion libsigner/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn test_simple_signer() {
reward_cycle: 1,
};
for i in 0..max_events {
let privk = Secp256k1PrivateKey::new();
let privk = Secp256k1PrivateKey::random();
let message = SignerMessage::BlockProposal(block_proposal.clone());
let message_bytes = message.serialize_to_vec();
let mut chunk = StackerDBChunkData::new(i as u32, 1, message_bytes);
Expand Down
20 changes: 11 additions & 9 deletions libsigner/src/v0/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ mod test {
let rejection = BlockRejection::new(
Sha512Trunc256Sum([0u8; 32]),
RejectCode::ValidationFailed(ValidateRejectCode::InvalidBlock),
&StacksPrivateKey::new(),
&StacksPrivateKey::random(),
thread_rng().gen_bool(0.5),
thread_rng().next_u64(),
);
Expand All @@ -1204,7 +1204,7 @@ mod test {
let rejection = BlockRejection::new(
Sha512Trunc256Sum([1u8; 32]),
RejectCode::ConnectivityIssues,
&StacksPrivateKey::new(),
&StacksPrivateKey::random(),
thread_rng().gen_bool(0.5),
thread_rng().next_u64(),
);
Expand All @@ -1231,7 +1231,7 @@ mod test {
let response = BlockResponse::Rejected(BlockRejection::new(
Sha512Trunc256Sum([1u8; 32]),
RejectCode::ValidationFailed(ValidateRejectCode::InvalidBlock),
&StacksPrivateKey::new(),
&StacksPrivateKey::random(),
thread_rng().gen_bool(0.5),
thread_rng().next_u64(),
));
Expand Down Expand Up @@ -1318,10 +1318,10 @@ mod test {

#[test]
fn verify_sign_mock_proposal() {
let private_key = StacksPrivateKey::new();
let private_key = StacksPrivateKey::random();
let public_key = StacksPublicKey::from_private(&private_key);

let bad_private_key = StacksPrivateKey::new();
let bad_private_key = StacksPrivateKey::random();
let bad_public_key = StacksPublicKey::from_private(&bad_private_key);

let mut mock_proposal = random_mock_proposal();
Expand Down Expand Up @@ -1353,7 +1353,7 @@ mod test {
#[test]
fn serde_mock_proposal() {
let mut mock_signature = random_mock_proposal();
mock_signature.sign(&StacksPrivateKey::new()).unwrap();
mock_signature.sign(&StacksPrivateKey::random()).unwrap();
let serialized_signature = mock_signature.serialize_to_vec();
let deserialized_signature = read_next::<MockProposal, _>(&mut &serialized_signature[..])
.expect("Failed to deserialize MockSignature");
Expand All @@ -1368,7 +1368,7 @@ mod test {
metadata: SignerMessageMetadata::default(),
};
mock_signature
.sign(&StacksPrivateKey::new())
.sign(&StacksPrivateKey::random())
.expect("Failed to sign MockSignature");
let serialized_signature = mock_signature.serialize_to_vec();
let deserialized_signature = read_next::<MockSignature, _>(&mut &serialized_signature[..])
Expand All @@ -1379,8 +1379,10 @@ mod test {
#[test]
fn serde_mock_block() {
let mock_proposal = random_mock_proposal();
let mock_signature_1 = MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::new());
let mock_signature_2 = MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::new());
let mock_signature_1 =
MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::random());
let mock_signature_2 =
MockSignature::new(mock_proposal.clone(), &StacksPrivateKey::random());
let mock_block = MockBlock {
mock_proposal,
mock_signatures: vec![mock_signature_1, mock_signature_2],
Expand Down
2 changes: 1 addition & 1 deletion libstackerdb/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::*;

#[test]
fn test_stackerdb_slot_metadata_sign_verify() {
let pk = StacksPrivateKey::new();
let pk = StacksPrivateKey::random();
let addr = StacksAddress::from_public_keys(
C32_ADDRESS_VERSION_MAINNET_SINGLESIG,
&AddressHashMode::SerializeP2PKH,
Expand Down
2 changes: 1 addition & 1 deletion stacks-common/src/address/b58.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

//! Base58 encoder and decoder
use std::{error, fmt, str};
use std::{fmt, str};

use crate::address::Error;
use crate::util::hash::DoubleSha256;
Expand Down
3 changes: 1 addition & 2 deletions stacks-common/src/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::{error, fmt};
use sha2::{Digest, Sha256};

use crate::deps_common::bitcoin::blockdata::opcodes::All as btc_opcodes;
use crate::deps_common::bitcoin::blockdata::script::{Builder, Instruction, Script};
use crate::deps_common::bitcoin::blockdata::script::Builder;
use crate::types::PublicKey;
use crate::util::hash::Hash160;

Expand Down Expand Up @@ -220,7 +220,6 @@ pub fn public_keys_to_address_hash<K: PublicKey>(
mod test {
use super::*;
use crate::util::hash::*;
use crate::util::log;
use crate::util::secp256k1::Secp256k1PublicKey as PubKey;

struct PubkeyFixture {
Expand Down
1 change: 0 additions & 1 deletion stacks-common/src/bitvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ mod test {

use super::BitVec;
use crate::codec::StacksMessageCodec;
use crate::util::hash::to_hex;

fn check_set_get(mut input: BitVec<{ u16::MAX }>) {
let original_input = input.clone();
Expand Down
1 change: 0 additions & 1 deletion stacks-common/src/deps_common/bitcoin/blockdata/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::deps_common::bitcoin::blockdata::transaction::Transaction;
use crate::deps_common::bitcoin::network::constants::Network;
use crate::deps_common::bitcoin::network::encodable::VarInt;
use crate::deps_common::bitcoin::network::serialize::BitcoinHash;
use crate::deps_common::bitcoin::util;
use crate::deps_common::bitcoin::util::hash::Sha256dHash;
use crate::deps_common::bitcoin::util::Error;
use crate::deps_common::bitcoin::util::Error::{SpvBadProofOfWork, SpvBadTarget};
Expand Down
1 change: 0 additions & 1 deletion stacks-common/src/deps_common/bitcoin/blockdata/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use std::mem::size_of;
use std::{error, fmt};

use serde;
use sha2::{Digest, Sha256};

use crate::deps_common::bitcoin::blockdata::opcodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use crate::deps_common::bitcoin::network::serialize::{
self, serialize, BitcoinHash, SimpleDecoder, SimpleEncoder,
};
use crate::deps_common::bitcoin::util::hash::Sha256dHash;
use crate::util::hash::to_hex;

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

#[cfg(test)]
mod tests {
use super::{SigHashType, Transaction, TxIn};
use super::{Transaction, TxIn};
use crate::deps_common;
use crate::deps_common::bitcoin::blockdata::script::Script;
use crate::deps_common::bitcoin::network::serialize::{deserialize, BitcoinHash};
Expand All @@ -690,7 +689,6 @@ mod tests {

#[test]
fn test_is_coinbase() {
use crate::deps_common::bitcoin::blockdata::constants;
use crate::deps_common::bitcoin::network::constants::Network;

let genesis = deps_common::bitcoin::blockdata::constants::genesis_block(Network::Bitcoin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
//!
use crate::deps_common::bitcoin::network::address::Address;
use crate::deps_common::bitcoin::network::constants;
use crate::util;

// Some simple messages

Expand Down
2 changes: 1 addition & 1 deletion stacks-common/src/deps_common/bitcoin/util/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use std::char::from_digit;
use std::cmp::min;
use std::io::{Cursor, Write};
use std::{error, fmt, mem};
use std::{fmt, mem};

use ripemd::Ripemd160;
#[cfg(feature = "serde")]
Expand Down
4 changes: 1 addition & 3 deletions stacks-common/src/deps_common/httparse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//! Originally written by Sean McArthur.
//!
//! Modified by Jude Nelson to remove all unsafe code.
use std::{error, fmt, mem, result, str};
use std::{fmt, mem, result, str};

macro_rules! next {
($bytes:ident) => {{
Expand Down Expand Up @@ -1282,8 +1282,6 @@ mod tests {

#[test]
fn test_std_error() {
use std::error::Error as StdError;

use super::Error;
let err = Error::HeaderName;
assert_eq!(err.to_string(), err.description_str());
Expand Down
4 changes: 1 addition & 3 deletions stacks-common/src/libcommon.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![allow(unused_macros)]
#![allow(unused_imports)]
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![cfg_attr(test, allow(unused_variables, unused_assignments))]
#![allow(clippy::assertions_on_constants)]

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

Expand All @@ -33,8 +33,6 @@ pub mod deps_common;

pub mod bitvec;

use crate::types::chainstate::{BlockHeaderHash, BurnchainHeaderHash, SortitionId, StacksBlockId};

pub mod consts {
use crate::types::chainstate::{BlockHeaderHash, ConsensusHash};
pub use crate::types::MINING_COMMITMENT_WINDOW;
Expand Down
Loading

0 comments on commit 40f6a74

Please sign in to comment.