Skip to content

Commit

Permalink
Merge pull request lightningdevkit#2954 from TheBlueMatt/2024-03-test…
Browse files Browse the repository at this point in the history
…-ci-beta-fail

Fix new warnings causing CI build failures on rustc beta
  • Loading branch information
tnull authored Apr 5, 2024
2 parents 3eb61f7 + 2f734f9 commit 3a9fe20
Show file tree
Hide file tree
Showing 68 changed files with 141 additions and 152 deletions.
2 changes: 0 additions & 2 deletions lightning-block-sync/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ mod tests {
use crate::test_utils::{Blockchain, MockChainListener};
use super::*;

use bitcoin::network::constants::Network;

#[tokio::test]
async fn sync_from_same_chain() {
let chain = Blockchain::default().with_height(4);
Expand Down
1 change: 1 addition & 0 deletions lightning-invoice/src/de.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[cfg(feature = "std")]
use std::error;
#[cfg(not(feature = "std"))]
use core::convert::TryFrom;
use core::fmt;
use core::fmt::{Display, Formatter};
Expand Down
1 change: 1 addition & 0 deletions lightning-invoice/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use secp256k1::PublicKey;
use alloc::collections::{btree_map, BTreeMap};
use core::ops::Deref;
use core::time::Duration;
#[cfg(not(feature = "std"))]
use core::iter::Iterator;

/// Utility to create an invoice that can be paid to one of multiple nodes, or a "phantom invoice."
Expand Down
3 changes: 0 additions & 3 deletions lightning-invoice/tests/ser_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ use bitcoin::address::WitnessVersion;
use bitcoin::{PubkeyHash, ScriptHash};
use bitcoin::hashes::hex::FromHex;
use bitcoin::hashes::{sha256, Hash};
use lightning::ln::PaymentSecret;
use lightning::routing::gossip::RoutingFees;
use lightning::routing::router::{RouteHint, RouteHintHop};
use lightning_invoice::*;
use secp256k1::PublicKey;
use secp256k1::ecdsa::{RecoverableSignature, RecoveryId};
Expand Down
8 changes: 6 additions & 2 deletions lightning-net-tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ impl Connection {
break Disconnect::CloseConnection;
}
},
SelectorOutput::B(_) => {},
SelectorOutput::B(some) => {
// The mpsc Receiver should only return `None` if the write side has been
// dropped, but that shouldn't be possible since its referenced by the Self in
// `us`.
debug_assert!(some.is_some());
},
SelectorOutput::C(res) => {
if res.is_err() { break Disconnect::PeerDisconnected; }
match reader.try_read(&mut buf) {
Expand Down Expand Up @@ -556,7 +561,6 @@ mod tests {
use lightning::ln::features::*;
use lightning::ln::msgs::*;
use lightning::ln::peer_handler::{MessageHandler, PeerManager};
use lightning::ln::features::NodeFeatures;
use lightning::routing::gossip::NodeId;
use lightning::events::*;
use lightning::util::test_utils::TestNodeSigner;
Expand Down
1 change: 0 additions & 1 deletion lightning-persister/src/fs_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ mod tests {
use lightning::ln::functional_test_utils::*;
use lightning::util::test_utils;
use lightning::util::persist::read_channel_monitors;
use std::fs;
use std::str::FromStr;

impl Drop for FilesystemStore {
Expand Down
2 changes: 1 addition & 1 deletion lightning-rapid-gossip-sync/src/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{GraphSyncError, RapidGossipSync};
#[cfg(all(feature = "std", not(test)))]
use std::time::{SystemTime, UNIX_EPOCH};

#[cfg(not(feature = "std"))]
#[cfg(all(not(feature = "std"), not(test)))]
use alloc::{vec::Vec, borrow::ToOwned};

/// The purpose of this prefix is to identify the serialization format, should other rapid gossip
Expand Down
4 changes: 3 additions & 1 deletion lightning/src/blinded_path/message.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey};

#[allow(unused_imports)]
use crate::prelude::*;

use crate::blinded_path::{BlindedHop, BlindedPath};
use crate::blinded_path::utils;
use crate::io;
use crate::io::Cursor;
use crate::ln::onion_utils;
use crate::onion_message::packet::ControlTlvs;
use crate::prelude::*;
use crate::sign::{NodeSigner, Recipient};
use crate::crypto::streams::ChaChaPolyReadAdapter;
use crate::util::ser::{FixedLengthReader, LengthReadableArgs, Writeable, Writer};
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/blinded_path/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use crate::ln::channelmanager::CounterpartyForwardingInfo;
use crate::ln::features::BlindedHopFeatures;
use crate::ln::msgs::DecodeError;
use crate::offers::invoice::BlindedPayInfo;
use crate::prelude::*;
use crate::util::ser::{HighZeroBytesDroppedBigSize, Readable, Writeable, Writer};

use core::convert::TryFrom;
#[allow(unused_imports)]
use crate::prelude::*;

/// An intermediate node, its outbound channel, and relay parameters.
#[derive(Clone, Debug)]
Expand Down
2 changes: 2 additions & 0 deletions lightning/src/blinded_path/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use crate::crypto::streams::ChaChaPolyWriteAdapter;
use crate::util::ser::{Readable, Writeable};

use crate::io;

#[allow(unused_imports)]
use crate::prelude::*;

// TODO: DRY with onion_utils::construct_onion_keys_callback
Expand Down
3 changes: 2 additions & 1 deletion lightning/src/chain/chaininterface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
//! disconnections, transaction broadcasting, and feerate information requests.

use core::{cmp, ops::Deref};
use core::convert::TryInto;

use crate::prelude::*;

use bitcoin::blockdata::transaction::Transaction;

Expand Down
5 changes: 4 additions & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ use crate::util::byte_utils;
use crate::events::{ClosureReason, Event, EventHandler};
use crate::events::bump_transaction::{AnchorDescriptor, BumpTransactionEvent};

#[allow(unused_imports)]
use crate::prelude::*;

use core::{cmp, mem};
use crate::io::{self, Error};
use core::convert::TryInto;
use core::ops::Deref;
use crate::sync::{Mutex, LockTestExt};

Expand Down Expand Up @@ -4765,6 +4766,8 @@ mod tests {
use crate::sync::{Arc, Mutex};
use crate::io;
use crate::ln::features::ChannelTypeFeatures;

#[allow(unused_imports)]
use crate::prelude::*;

use std::str::FromStr;
Expand Down
1 change: 1 addition & 0 deletions lightning/src/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::ln::ChannelId;
use crate::sign::ecdsa::WriteableEcdsaChannelSigner;
use crate::chain::transaction::{OutPoint, TransactionData};

#[allow(unused_imports)]
use crate::prelude::*;

pub mod chaininterface;
Expand Down
5 changes: 3 additions & 2 deletions lightning/src/chain/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ use crate::util::logger::Logger;
use crate::util::ser::{Readable, Writer, Writeable, RequiredWrapper};

use crate::io;
use crate::prelude::*;
use core::cmp;
use core::convert::TryInto;
use core::mem;
use core::ops::Deref;

#[allow(unused_imports)]
use crate::prelude::*;

use super::chaininterface::LowerBoundedFeeEstimator;

const MAX_ALLOC_SIZE: usize = 64*1024;
Expand Down
6 changes: 2 additions & 4 deletions lightning/src/crypto/chacha20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#[cfg(not(fuzzing))]
mod real_chacha {
use core::cmp;
use core::convert::TryInto;

#[derive(Clone, Copy, PartialEq, Eq)]
#[allow(non_camel_case_types)]
Expand Down Expand Up @@ -335,11 +334,10 @@ pub use self::fuzzy_chacha::ChaCha20;

#[cfg(test)]
mod test {
use alloc::vec;
use alloc::vec::{Vec};
use core::convert::TryInto;
use core::iter::repeat;

use crate::prelude::*;

use super::ChaCha20;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/crypto/poly1305.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
// https://github.com/floodyberry/poly1305-donna

use core::cmp::min;
use core::convert::TryInto;

use crate::prelude::*;

#[derive(Clone, Copy)]
pub struct Poly1305 {
Expand Down Expand Up @@ -206,7 +207,6 @@ impl Poly1305 {
#[cfg(test)]
mod test {
use core::iter::repeat;
use alloc::vec::Vec;

use super::Poly1305;

Expand Down
4 changes: 3 additions & 1 deletion lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ use bitcoin::hashes::Hash;
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::secp256k1::PublicKey;
use crate::io;
use crate::prelude::*;
use core::time::Duration;
use core::ops::Deref;
use crate::sync::Arc;

#[allow(unused_imports)]
use crate::prelude::*;

/// Some information provided on receipt of payment depends on whether the payment received is a
/// spontaneous payment or a "conventional" lightning payment that's paying an invoice.
#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
6 changes: 6 additions & 0 deletions lightning/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,17 @@ mod io_extras {
}

mod prelude {
#![allow(unused_imports)]

pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque, boxed::Box};

pub use alloc::borrow::ToOwned;
pub use alloc::string::ToString;

pub use core::convert::{AsMut, AsRef, TryFrom, TryInto};
pub use core::default::Default;
pub use core::marker::Sized;

pub(crate) use crate::util::hash_tables::*;
}

Expand Down
8 changes: 6 additions & 2 deletions lightning/src/ln/chan_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use bitcoin::{secp256k1, Sequence, Witness};
use bitcoin::PublicKey as BitcoinPublicKey;

use crate::io;
use crate::prelude::*;
use core::cmp;
use crate::ln::chan_utils;
use crate::util::transaction_utils::sort_outputs;
Expand All @@ -48,6 +47,9 @@ use crate::ln::features::ChannelTypeFeatures;
use crate::crypto::utils::{sign, sign_with_aux_rand};
use super::channel_keys::{DelayedPaymentBasepoint, DelayedPaymentKey, HtlcKey, HtlcBasepoint, RevocationKey, RevocationBasepoint};

#[allow(unused_imports)]
use crate::prelude::*;

/// Maximum number of one-way in-flight HTLC (protocol-level value).
pub const MAX_HTLCS: u16 = 483;
/// The weight of a BIP141 witnessScript for a BOLT3's "offered HTLC output" on a commitment transaction, non-anchor variant.
Expand Down Expand Up @@ -1812,7 +1814,6 @@ pub fn get_commitment_transaction_number_obscure_factor(
mod tests {
use super::{CounterpartyCommitmentSecrets, ChannelPublicKeys};
use crate::chain;
use crate::prelude::*;
use crate::ln::chan_utils::{get_htlc_redeemscript, get_to_countersignatory_with_anchors_redeemscript, CommitmentTransaction, TxCreationKeys, ChannelTransactionParameters, CounterpartyChannelTransactionParameters, HTLCOutputInCommitment};
use bitcoin::secp256k1::{PublicKey, SecretKey, Secp256k1};
use crate::util::test_utils;
Expand All @@ -1825,6 +1826,9 @@ mod tests {
use bitcoin::PublicKey as BitcoinPublicKey;
use crate::ln::features::ChannelTypeFeatures;

#[allow(unused_imports)]
use crate::prelude::*;

struct TestCommitmentTxBuilder {
commitment_number: u64,
holder_funding_pubkey: PublicKey,
Expand Down
1 change: 0 additions & 1 deletion lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ use crate::util::scid_utils::scid_from_parts;
use crate::io;
use crate::prelude::*;
use core::{cmp,mem,fmt};
use core::convert::TryInto;
use core::ops::Deref;
#[cfg(any(test, fuzzing, debug_assertions))]
use crate::sync::Mutex;
Expand Down
5 changes: 4 additions & 1 deletion lightning/src/ln/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@
//! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md
//! [messages]: crate::ln::msgs

use crate::{io, io_extras};
#[allow(unused_imports)]
use crate::prelude::*;

use crate::{io, io_extras};
use core::{cmp, fmt};
use core::borrow::Borrow;
use core::hash::{Hash, Hasher};
Expand All @@ -91,6 +93,7 @@ use crate::ln::msgs::DecodeError;
use crate::util::ser::{Readable, WithoutLength, Writeable, Writer};

mod sealed {
#[allow(unused_imports)]
use crate::prelude::*;
use crate::ln::features::Features;

Expand Down
3 changes: 0 additions & 3 deletions lightning/src/ln/functional_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ use bitcoin::OutPoint as BitcoinOutPoint;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::secp256k1::{PublicKey,SecretKey};

use regex;

use crate::io;
use crate::prelude::*;
use alloc::collections::BTreeSet;
use core::default::Default;
use core::iter::repeat;
use bitcoin::hashes::Hash;
use crate::sync::{Arc, Mutex, RwLock};
Expand Down
5 changes: 3 additions & 2 deletions lightning/src/ln/inbound_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

//! Utilities to generate inbound payment information in service of invoice creation.

use alloc::string::ToString;
use bitcoin::hashes::{Hash, HashEngine};
use bitcoin::hashes::cmp::fixed_time_eq;
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
Expand All @@ -23,7 +22,9 @@ use crate::crypto::utils::hkdf_extract_expand_5x;
use crate::util::errors::APIError;
use crate::util::logger::Logger;

use core::convert::{TryFrom, TryInto};
#[allow(unused_imports)]
use crate::prelude::*;

use core::ops::Deref;

pub(crate) const IV_LEN: usize = 16;
Expand Down
2 changes: 2 additions & 0 deletions lightning/src/ln/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ impl From<PaymentPreimage> for PaymentHash {
#[derive(Hash, Copy, Clone, PartialEq, Eq, Debug, Ord, PartialOrd)]
pub struct PaymentSecret(pub [u8; 32]);

#[allow(unused_imports)]
use crate::prelude::*;

use bitcoin::bech32;
use bitcoin::bech32::{Base32Len, FromBase32, ToBase32, WriteBase32, u5};

Expand Down
9 changes: 5 additions & 4 deletions lightning/src/ln/msgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ use crate::ln::onion_utils;
use crate::onion_message;
use crate::sign::{NodeSigner, Recipient};

#[allow(unused_imports)]
use crate::prelude::*;
#[cfg(feature = "std")]
use core::convert::TryFrom;

use core::fmt;
use core::fmt::Debug;
use core::ops::Deref;
Expand Down Expand Up @@ -1673,11 +1673,13 @@ pub struct FinalOnionHopData {
mod fuzzy_internal_msgs {
use bitcoin::secp256k1::PublicKey;
use crate::blinded_path::payment::{PaymentConstraints, PaymentRelay};
use crate::prelude::*;
use crate::ln::{PaymentPreimage, PaymentSecret};
use crate::ln::features::BlindedHopFeatures;
use super::{FinalOnionHopData, TrampolineOnionPacket};

#[allow(unused_imports)]
use crate::prelude::*;

// These types aren't intended to be pub, but are exposed for direct fuzzing (as we deserialize
// them from untrusted input):

Expand Down Expand Up @@ -3163,7 +3165,6 @@ impl_writeable_msg!(GossipTimestampFilter, {

#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use bitcoin::{Transaction, TxIn, ScriptBuf, Sequence, Witness, TxOut};
use hex::DisplayHex;
use crate::ln::{PaymentPreimage, PaymentHash, PaymentSecret};
Expand Down
2 changes: 2 additions & 0 deletions lightning/src/ln/onion_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use crate::ln::onion_utils::{HTLCFailReason, INVALID_ONION_BLINDING};
use crate::sign::{NodeSigner, Recipient};
use crate::util::logger::Logger;

#[allow(unused_imports)]
use crate::prelude::*;

use core::ops::Deref;

/// Invalid inbound onion payment.
Expand Down
1 change: 0 additions & 1 deletion lightning/src/ln/onion_route_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};

use crate::io;
use crate::prelude::*;
use core::default::Default;
use bitcoin::hashes::hex::FromHex;

use crate::ln::functional_test_utils::*;
Expand Down
Loading

0 comments on commit 3a9fe20

Please sign in to comment.