mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
RUSTSEC-2021-0076 bump libsecp256k1 (#9391)
* RUSTSEC-2021-0076 bump libsecp256k1 libsecp256k1 allows overflowing signatures https://rustsec.org/advisories/RUSTSEC-2021-0076 Changes were made to conform to libsecp256k1 version differences. Closes #9356 * parse_standard_slice() -> parse_overflowing_slice() * Added v2 host function for ecdsa_verify * Add feature tag over helpers * Added ecdsa_verify v2 to test runner * PR feedback - Spaces -> tabs - renamed two helper functions * Fixed imports after rebasing * Bump rest of libsecp256k1 (and libp2p) libp2p also uses libsecp256k1 so it is required to be bumped too, along with all the version difference changes. * Add version2 for ecdsa pubkey recovery * libp2p rebase master fixes * Fix test panic when non Behaviour event is returned * Update bin/node/browser-testing/Cargo.toml * Update primitives/core/src/ecdsa.rs * Update primitives/core/src/ecdsa.rs * Update Cargo.lock Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -30,7 +30,7 @@ use libp2p::{
|
||||
identity, noise,
|
||||
swarm::{
|
||||
IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters,
|
||||
ProtocolsHandler, Swarm,
|
||||
ProtocolsHandler, Swarm, SwarmEvent,
|
||||
},
|
||||
yamux, Multiaddr, PeerId, Transport,
|
||||
};
|
||||
@@ -262,8 +262,8 @@ fn reconnect_after_disconnect() {
|
||||
loop {
|
||||
// Grab next event from services.
|
||||
let event = {
|
||||
let s1 = service1.next();
|
||||
let s2 = service2.next();
|
||||
let s1 = service1.select_next_some();
|
||||
let s2 = service2.select_next_some();
|
||||
futures::pin_mut!(s1, s2);
|
||||
match future::select(s1, s2).await {
|
||||
future::Either::Left((ev, _)) => future::Either::Left(ev),
|
||||
@@ -272,48 +272,52 @@ fn reconnect_after_disconnect() {
|
||||
};
|
||||
|
||||
match event {
|
||||
future::Either::Left(NotificationsOut::CustomProtocolOpen { .. }) =>
|
||||
match service1_state {
|
||||
ServiceState::NotConnected => {
|
||||
service1_state = ServiceState::FirstConnec;
|
||||
if service2_state == ServiceState::FirstConnec {
|
||||
service1.behaviour_mut().disconnect_peer(
|
||||
Swarm::local_peer_id(&service2),
|
||||
sc_peerset::SetId::from(0),
|
||||
);
|
||||
}
|
||||
},
|
||||
ServiceState::Disconnected => service1_state = ServiceState::ConnectedAgain,
|
||||
ServiceState::FirstConnec | ServiceState::ConnectedAgain => panic!(),
|
||||
future::Either::Left(SwarmEvent::Behaviour(
|
||||
NotificationsOut::CustomProtocolOpen { .. },
|
||||
)) => match service1_state {
|
||||
ServiceState::NotConnected => {
|
||||
service1_state = ServiceState::FirstConnec;
|
||||
if service2_state == ServiceState::FirstConnec {
|
||||
service1.behaviour_mut().disconnect_peer(
|
||||
Swarm::local_peer_id(&service2),
|
||||
sc_peerset::SetId::from(0),
|
||||
);
|
||||
}
|
||||
},
|
||||
future::Either::Left(NotificationsOut::CustomProtocolClosed { .. }) =>
|
||||
match service1_state {
|
||||
ServiceState::FirstConnec => service1_state = ServiceState::Disconnected,
|
||||
ServiceState::ConnectedAgain |
|
||||
ServiceState::NotConnected |
|
||||
ServiceState::Disconnected => panic!(),
|
||||
},
|
||||
future::Either::Right(NotificationsOut::CustomProtocolOpen { .. }) =>
|
||||
match service2_state {
|
||||
ServiceState::NotConnected => {
|
||||
service2_state = ServiceState::FirstConnec;
|
||||
if service1_state == ServiceState::FirstConnec {
|
||||
service1.behaviour_mut().disconnect_peer(
|
||||
Swarm::local_peer_id(&service2),
|
||||
sc_peerset::SetId::from(0),
|
||||
);
|
||||
}
|
||||
},
|
||||
ServiceState::Disconnected => service2_state = ServiceState::ConnectedAgain,
|
||||
ServiceState::FirstConnec | ServiceState::ConnectedAgain => panic!(),
|
||||
},
|
||||
future::Either::Right(NotificationsOut::CustomProtocolClosed { .. }) =>
|
||||
match service2_state {
|
||||
ServiceState::FirstConnec => service2_state = ServiceState::Disconnected,
|
||||
ServiceState::ConnectedAgain |
|
||||
ServiceState::NotConnected |
|
||||
ServiceState::Disconnected => panic!(),
|
||||
ServiceState::Disconnected => service1_state = ServiceState::ConnectedAgain,
|
||||
ServiceState::FirstConnec | ServiceState::ConnectedAgain => panic!(),
|
||||
},
|
||||
future::Either::Left(SwarmEvent::Behaviour(
|
||||
NotificationsOut::CustomProtocolClosed { .. },
|
||||
)) => match service1_state {
|
||||
ServiceState::FirstConnec => service1_state = ServiceState::Disconnected,
|
||||
ServiceState::ConnectedAgain |
|
||||
ServiceState::NotConnected |
|
||||
ServiceState::Disconnected => panic!(),
|
||||
},
|
||||
future::Either::Right(SwarmEvent::Behaviour(
|
||||
NotificationsOut::CustomProtocolOpen { .. },
|
||||
)) => match service2_state {
|
||||
ServiceState::NotConnected => {
|
||||
service2_state = ServiceState::FirstConnec;
|
||||
if service1_state == ServiceState::FirstConnec {
|
||||
service1.behaviour_mut().disconnect_peer(
|
||||
Swarm::local_peer_id(&service2),
|
||||
sc_peerset::SetId::from(0),
|
||||
);
|
||||
}
|
||||
},
|
||||
ServiceState::Disconnected => service2_state = ServiceState::ConnectedAgain,
|
||||
ServiceState::FirstConnec | ServiceState::ConnectedAgain => panic!(),
|
||||
},
|
||||
future::Either::Right(SwarmEvent::Behaviour(
|
||||
NotificationsOut::CustomProtocolClosed { .. },
|
||||
)) => match service2_state {
|
||||
ServiceState::FirstConnec => service2_state = ServiceState::Disconnected,
|
||||
ServiceState::ConnectedAgain |
|
||||
ServiceState::NotConnected |
|
||||
ServiceState::Disconnected => panic!(),
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
@@ -331,8 +335,8 @@ fn reconnect_after_disconnect() {
|
||||
loop {
|
||||
// Grab next event from services.
|
||||
let event = {
|
||||
let s1 = service1.next();
|
||||
let s2 = service2.next();
|
||||
let s1 = service1.select_next_some();
|
||||
let s2 = service2.select_next_some();
|
||||
futures::pin_mut!(s1, s2);
|
||||
match future::select(future::select(s1, s2), &mut delay).await {
|
||||
future::Either::Right(_) => break, // success
|
||||
@@ -342,8 +346,8 @@ fn reconnect_after_disconnect() {
|
||||
};
|
||||
|
||||
match event {
|
||||
NotificationsOut::CustomProtocolOpen { .. } |
|
||||
NotificationsOut::CustomProtocolClosed { .. } => panic!(),
|
||||
SwarmEvent::Behaviour(NotificationsOut::CustomProtocolOpen { .. }) |
|
||||
SwarmEvent::Behaviour(NotificationsOut::CustomProtocolClosed { .. }) => panic!(),
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ where
|
||||
|
||||
fn upgrade_outbound(self, mut socket: TSubstream, negotiated_name: Self::Info) -> Self::Future {
|
||||
Box::pin(async move {
|
||||
upgrade::write_with_len_prefix(&mut socket, &self.initial_message).await?;
|
||||
upgrade::write_length_prefixed(&mut socket, &self.initial_message).await?;
|
||||
|
||||
// Reading handshake.
|
||||
let handshake_len = unsigned_varint::aio::read_usize(&mut socket).await?;
|
||||
|
||||
Reference in New Issue
Block a user