From a51d5cef583f814873b4b92d558cf1e25b4e30f4 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 14 Jan 2021 20:57:56 -0500 Subject: [PATCH] Update rust-bitcoin --- background-processor/Cargo.toml | 2 +- fuzz/Cargo.toml | 2 +- lightning-block-sync/Cargo.toml | 2 +- lightning-c-bindings/Cargo.toml | 2 +- lightning-c-bindings/src/c_types/mod.rs | 3 ++- lightning-net-tokio/Cargo.toml | 2 +- lightning-persister/Cargo.toml | 4 ++-- lightning/Cargo.toml | 4 ++-- lightning/src/lib.rs | 2 +- lightning/src/ln/onion_route_tests.rs | 2 +- lightning/src/util/ser.rs | 3 +-- lightning/src/util/test_utils.rs | 16 +++++++++------- 12 files changed, 23 insertions(+), 21 deletions(-) diff --git a/background-processor/Cargo.toml b/background-processor/Cargo.toml index 71fbbbff8..1a4dc4884 100644 --- a/background-processor/Cargo.toml +++ b/background-processor/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bitcoin = "0.24" +bitcoin = "0.26" lightning = { version = "0.0.12", path = "../lightning", features = ["allow_wallclock_use"] } lightning-persister = { version = "0.0.1", path = "../lightning-persister" } diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index cb5d40eaa..99ed288f1 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -19,7 +19,7 @@ stdin_fuzz = [] [dependencies] afl = { version = "0.4", optional = true } lightning = { path = "../lightning", features = ["fuzztarget"] } -bitcoin = { version = "0.24", features = ["fuzztarget"] } +bitcoin = { version = "0.26", features = ["fuzztarget"] } hex = "0.3" honggfuzz = { version = "0.5", optional = true } libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git", optional = true } diff --git a/lightning-block-sync/Cargo.toml b/lightning-block-sync/Cargo.toml index aec6d1404..c454de395 100644 --- a/lightning-block-sync/Cargo.toml +++ b/lightning-block-sync/Cargo.toml @@ -13,7 +13,7 @@ rest-client = [ "serde", "serde_json", "chunked_transfer" ] rpc-client = [ "serde", "serde_json", "chunked_transfer" ] [dependencies] -bitcoin = "0.24" +bitcoin = "0.26" lightning = { version = "0.0.12", path = "../lightning" } tokio = { version = "1.0", features = [ "io-util", "net" ], optional = true } serde = { version = "1.0", features = ["derive"], optional = true } diff --git a/lightning-c-bindings/Cargo.toml b/lightning-c-bindings/Cargo.toml index 6bde30475..7c569abc7 100644 --- a/lightning-c-bindings/Cargo.toml +++ b/lightning-c-bindings/Cargo.toml @@ -15,7 +15,7 @@ crate-type = ["staticlib" ,"cdylib"] [dependencies] -bitcoin = "0.24" +bitcoin = "0.26" lightning = { version = "0.0.12", path = "../lightning" } # We eventually want to join the root workspace, but for now, the bindings generation is diff --git a/lightning-c-bindings/src/c_types/mod.rs b/lightning-c-bindings/src/c_types/mod.rs index 074aef25e..0a96f3e7d 100644 --- a/lightning-c-bindings/src/c_types/mod.rs +++ b/lightning-c-bindings/src/c_types/mod.rs @@ -72,8 +72,8 @@ pub enum Secp256k1Error { InvalidSecretKey, InvalidRecoveryId, InvalidTweak, + TweakCheckFailed, NotEnoughMemory, - CallbackPanicked, } impl Secp256k1Error { pub(crate) fn from_rust(err: SecpError) -> Self { @@ -85,6 +85,7 @@ impl Secp256k1Error { SecpError::InvalidSecretKey => Secp256k1Error::InvalidSecretKey, SecpError::InvalidRecoveryId => Secp256k1Error::InvalidRecoveryId, SecpError::InvalidTweak => Secp256k1Error::InvalidTweak, + SecpError::TweakCheckFailed => Secp256k1Error::TweakCheckFailed, SecpError::NotEnoughMemory => Secp256k1Error::NotEnoughMemory, } } diff --git a/lightning-net-tokio/Cargo.toml b/lightning-net-tokio/Cargo.toml index 916538806..587fe1b12 100644 --- a/lightning-net-tokio/Cargo.toml +++ b/lightning-net-tokio/Cargo.toml @@ -10,7 +10,7 @@ For Rust-Lightning clients which wish to make direct connections to Lightning P2 """ [dependencies] -bitcoin = "0.24" +bitcoin = "0.26" lightning = { version = "0.0.12", path = "../lightning" } tokio = { version = "1.0", features = [ "io-util", "macros", "rt", "sync", "net", "time" ] } diff --git a/lightning-persister/Cargo.toml b/lightning-persister/Cargo.toml index d8be01c92..fa71dc0d4 100644 --- a/lightning-persister/Cargo.toml +++ b/lightning-persister/Cargo.toml @@ -8,7 +8,7 @@ Utilities to manage channel data persistence and retrieval. """ [dependencies] -bitcoin = "0.24" +bitcoin = "0.26" lightning = { version = "0.0.12", path = "../lightning" } libc = "0.2" @@ -16,7 +16,7 @@ libc = "0.2" winapi = { version = "0.3", features = ["winbase"] } [dev-dependencies.bitcoin] -version = "0.24" +version = "0.26" features = ["bitcoinconsensus"] [dev-dependencies] diff --git a/lightning/Cargo.toml b/lightning/Cargo.toml index 0b51a3992..f02813bfd 100644 --- a/lightning/Cargo.toml +++ b/lightning/Cargo.toml @@ -27,13 +27,13 @@ unsafe_revoked_tx_signing = [] unstable = [] [dependencies] -bitcoin = "0.24" +bitcoin = "0.26" hex = { version = "0.3", optional = true } regex = { version = "0.1.80", optional = true } [dev-dependencies.bitcoin] -version = "0.24" +version = "0.26" features = ["bitcoinconsensus"] [dev-dependencies] diff --git a/lightning/src/lib.rs b/lightning/src/lib.rs index 7310a49ae..567a7e186 100644 --- a/lightning/src/lib.rs +++ b/lightning/src/lib.rs @@ -19,7 +19,7 @@ //! instead of having a rather-separate lightning appendage to a wallet. #![cfg_attr(not(any(feature = "fuzztarget", feature = "_test_utils")), deny(missing_docs))] -#![forbid(unsafe_code)] +#![cfg_attr(not(any(test, feature = "fuzztarget", feature = "_test_utils")), forbid(unsafe_code))] // In general, rust is absolutely horrid at supporting users doing things like, // for example, compiling Rust code for real environments. Disable useless lints diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs index bf2709cde..551db24e9 100644 --- a/lightning/src/ln/onion_route_tests.rs +++ b/lightning/src/ln/onion_route_tests.rs @@ -219,7 +219,7 @@ impl msgs::ChannelUpdate { use bitcoin::secp256k1::ffi::Signature as FFISignature; use bitcoin::secp256k1::Signature; msgs::ChannelUpdate { - signature: Signature::from(FFISignature::new()), + signature: Signature::from(unsafe { FFISignature::new() }), contents: msgs::UnsignedChannelUpdate { chain_hash: BlockHash::hash(&vec![0u8][..]), short_channel_id: 0, diff --git a/lightning/src/util/ser.rs b/lightning/src/util/ser.rs index 1d24e2640..b718e228c 100644 --- a/lightning/src/util/ser.rs +++ b/lightning/src/util/ser.rs @@ -707,8 +707,7 @@ macro_rules! impl_consensus_ser { fn write(&self, writer: &mut W) -> Result<(), ::std::io::Error> { match self.consensus_encode(WriterWriteAdaptor(writer)) { Ok(_) => Ok(()), - Err(consensus::encode::Error::Io(e)) => Err(e), - Err(_) => panic!("We shouldn't get a consensus::encode::Error unless our Write generated an std::io::Error"), + Err(e) => Err(e), } } } diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index afc6e598e..fb54299fb 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -253,12 +253,14 @@ fn get_dummy_channel_announcement(short_chan_id: u64) -> msgs::ChannelAnnounceme excess_data: Vec::new(), }; - msgs::ChannelAnnouncement { - node_signature_1: Signature::from(FFISignature::new()), - node_signature_2: Signature::from(FFISignature::new()), - bitcoin_signature_1: Signature::from(FFISignature::new()), - bitcoin_signature_2: Signature::from(FFISignature::new()), - contents: unsigned_ann, + unsafe { + msgs::ChannelAnnouncement { + node_signature_1: Signature::from(FFISignature::new()), + node_signature_2: Signature::from(FFISignature::new()), + bitcoin_signature_1: Signature::from(FFISignature::new()), + bitcoin_signature_2: Signature::from(FFISignature::new()), + contents: unsigned_ann, + } } } @@ -266,7 +268,7 @@ fn get_dummy_channel_update(short_chan_id: u64) -> msgs::ChannelUpdate { use bitcoin::secp256k1::ffi::Signature as FFISignature; let network = Network::Testnet; msgs::ChannelUpdate { - signature: Signature::from(FFISignature::new()), + signature: Signature::from(unsafe { FFISignature::new() }), contents: msgs::UnsignedChannelUpdate { chain_hash: genesis_block(network).header.block_hash(), short_channel_id: short_chan_id, -- 2.39.5