mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 06:31:09 +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:
@@ -722,7 +722,7 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
KademliaEvent::PendingRoutablePeer { .. } => {
|
||||
// We are not interested in this event at the moment.
|
||||
},
|
||||
KademliaEvent::QueryResult {
|
||||
KademliaEvent::OutboundQueryCompleted {
|
||||
result: QueryResult::GetClosestPeers(res),
|
||||
..
|
||||
} => match res {
|
||||
@@ -741,7 +741,7 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
}
|
||||
},
|
||||
},
|
||||
KademliaEvent::QueryResult {
|
||||
KademliaEvent::OutboundQueryCompleted {
|
||||
result: QueryResult::GetRecord(res),
|
||||
stats,
|
||||
..
|
||||
@@ -778,7 +778,7 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
};
|
||||
return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev))
|
||||
},
|
||||
KademliaEvent::QueryResult {
|
||||
KademliaEvent::OutboundQueryCompleted {
|
||||
result: QueryResult::PutRecord(res),
|
||||
stats,
|
||||
..
|
||||
@@ -799,7 +799,7 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
};
|
||||
return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev))
|
||||
},
|
||||
KademliaEvent::QueryResult {
|
||||
KademliaEvent::OutboundQueryCompleted {
|
||||
result: QueryResult::RepublishRecord(res),
|
||||
..
|
||||
} => match res {
|
||||
@@ -830,6 +830,11 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
address,
|
||||
score,
|
||||
}),
|
||||
NetworkBehaviourAction::CloseConnection { peer_id, connection } =>
|
||||
return Poll::Ready(NetworkBehaviourAction::CloseConnection {
|
||||
peer_id,
|
||||
connection,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -862,6 +867,11 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
address,
|
||||
score,
|
||||
}),
|
||||
NetworkBehaviourAction::CloseConnection { peer_id, connection } =>
|
||||
return Poll::Ready(NetworkBehaviourAction::CloseConnection {
|
||||
peer_id,
|
||||
connection,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,7 +941,7 @@ mod tests {
|
||||
},
|
||||
identity::Keypair,
|
||||
noise,
|
||||
swarm::Swarm,
|
||||
swarm::{Swarm, SwarmEvent},
|
||||
yamux, Multiaddr, PeerId,
|
||||
};
|
||||
use std::{collections::HashSet, task::Poll};
|
||||
@@ -1000,32 +1010,42 @@ mod tests {
|
||||
match swarms[swarm_n].0.poll_next_unpin(cx) {
|
||||
Poll::Ready(Some(e)) => {
|
||||
match e {
|
||||
DiscoveryOut::UnroutablePeer(other) |
|
||||
DiscoveryOut::Discovered(other) => {
|
||||
// Call `add_self_reported_address` to simulate identify
|
||||
// happening.
|
||||
let addr = swarms
|
||||
.iter()
|
||||
.find_map(|(s, a)| {
|
||||
if s.behaviour().local_peer_id == other {
|
||||
Some(a.clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
swarms[swarm_n].0.behaviour_mut().add_self_reported_address(
|
||||
&other,
|
||||
[protocol_name_from_protocol_id(&protocol_id)].iter(),
|
||||
addr,
|
||||
);
|
||||
SwarmEvent::Behaviour(behavior) => {
|
||||
match behavior {
|
||||
DiscoveryOut::UnroutablePeer(other) |
|
||||
DiscoveryOut::Discovered(other) => {
|
||||
// Call `add_self_reported_address` to simulate identify
|
||||
// happening.
|
||||
let addr = swarms
|
||||
.iter()
|
||||
.find_map(|(s, a)| {
|
||||
if s.behaviour().local_peer_id == other {
|
||||
Some(a.clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
swarms[swarm_n]
|
||||
.0
|
||||
.behaviour_mut()
|
||||
.add_self_reported_address(
|
||||
&other,
|
||||
[protocol_name_from_protocol_id(&protocol_id)]
|
||||
.iter(),
|
||||
addr,
|
||||
);
|
||||
|
||||
to_discover[swarm_n].remove(&other);
|
||||
},
|
||||
DiscoveryOut::RandomKademliaStarted(_) => {},
|
||||
e => {
|
||||
panic!("Unexpected event: {:?}", e)
|
||||
to_discover[swarm_n].remove(&other);
|
||||
},
|
||||
DiscoveryOut::RandomKademliaStarted(_) => {},
|
||||
e => {
|
||||
panic!("Unexpected event: {:?}", e)
|
||||
},
|
||||
}
|
||||
},
|
||||
// ignore non Behaviour events
|
||||
_ => {},
|
||||
}
|
||||
continue 'polling
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user