Skip to content

Commit

Permalink
Revert "fix: clippy error after using nightly"
Browse files Browse the repository at this point in the history
This reverts commit 1a6f8d1.
  • Loading branch information
qiweiii committed Jan 4, 2024
1 parent 8ae82c0 commit c4b24e2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions ethportal-api/src/types/portal_wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ impl TryFrom<&Value> for CustomPayload {
"Unable to decode hex payload into bytes",
))?,
};
Ok(Self {
payload: ByteList::from(payload),
})
match ByteList::try_from(payload) {
Ok(payload) => Ok(Self { payload }),
Err(_) => Err(ValidationError::new("Invalid custom payload value")),
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions portalnet/src/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,14 @@ pub async fn trace_propagate_gossip_cross_thread<TContentKey: OverlayContentKey>
/// Filter all nodes from overlay routing table where XOR_distance(content_id, nodeId) < node radius
fn calculate_interested_enrs<TContentKey: OverlayContentKey>(
content_key: &TContentKey,
all_nodes: &[&kbucket::Node<NodeId, Node>],
all_nodes: &Vec<&kbucket::Node<NodeId, Node>>,
) -> Vec<Enr> {
// HashMap to temporarily store all interested ENRs and the content.
// Key is base64 string of node's ENR.

// Filter all nodes from overlay routing table where XOR_distance(content_id, nodeId) < node
// radius
let mut interested_enrs: Vec<Enr> = all_nodes
.to_owned()
.clone()
.into_iter()
.filter(|node| {
Expand Down
2 changes: 1 addition & 1 deletion portalnet/src/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ where
}
}

fn validate_find_nodes_distances(distances: &[u16]) -> Result<(), OverlayRequestError> {
fn validate_find_nodes_distances(distances: &Vec<u16>) -> Result<(), OverlayRequestError> {
if distances.is_empty() {
return Err(OverlayRequestError::InvalidRequest(
"Invalid distances: Empty list".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion portalnet/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ impl PortalStorage {
&self,
content_id: &[u8; 32],
content_key: &String,
value: &[u8],
value: &Vec<u8>,
) -> Result<(), ContentStoreError> {
let content_id_as_u32: u32 = Self::byte_vector_to_u32(content_id.to_vec());
let value_size = value.len();
Expand Down
2 changes: 1 addition & 1 deletion trin-validation/src/merkle/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl MerkleTree {
if deposit_count == (0x1 << level) {
return Ok(MerkleTree::Finalized(
*finalized_branch
.first()
.get(0)
.ok_or(MerkleTreeError::PleaseNotifyTheDevs)?,
));
}
Expand Down

0 comments on commit c4b24e2

Please sign in to comment.