Skip to content

Commit

Permalink
fix: merge conflicts with master
Browse files Browse the repository at this point in the history
  • Loading branch information
etherhood committed Oct 24, 2024
1 parent 1d9a97e commit 71175fc
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 53 deletions.
6 changes: 1 addition & 5 deletions ethportal-api/src/types/portal_wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,7 @@ impl From<Accept> for Value {
#[allow(clippy::unwrap_used)]
mod test {
use super::*;
<<<<<<< HEAD
use alloy::primitives::bytes;
=======
use alloy_primitives::{bytes, Bytes};
>>>>>>> 1daad075 (feat: converting Vec<u8> to bytes::Bytes)
use alloy::primitives::{bytes, Bytes};
use ssz_types::Error::OutOfBounds;
use std::str::FromStr;
use test_log::test;
Expand Down
7 changes: 0 additions & 7 deletions portalnet/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,7 @@ const TALKREQ_CHANNEL_BUFFER: usize = 100;
/// ENR key for portal network client version.
pub const ENR_PORTAL_CLIENT_KEY: &str = "c";

<<<<<<< HEAD
pub type ProtocolRequest = Vec<u8>;
=======
/// ENR file name saving enr history to disk.
const ENR_FILE_NAME: &str = "trin.enr";

pub type ProtocolRequest = Bytes;
>>>>>>> 1daad075 (feat: converting Vec<u8> to bytes::Bytes)

/// The contact info for a remote node.
#[derive(Clone, Debug)]
Expand Down
35 changes: 0 additions & 35 deletions portalnet/src/overlay/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,41 +470,6 @@ impl<
})
}

/// Offer is sent in order to store content to k nodes with radii that contain content-id
/// Offer is also sent to nodes after FindContent (POKE)
pub async fn send_wire_offer(
&self,
enr: Enr,
content_keys: Vec<TContentKey>,
) -> Result<Accept, OverlayRequestError> {
let content_items = content_keys
.into_iter()
.map(|key| match self.store.read().get(&key) {
Ok(Some(content)) => Ok((key.to_bytes(), RawContentValue::from(content))),
_ => Err(OverlayRequestError::ContentNotFound {
message: format!("Content key not found in local store: {key:02X?}"),
utp: false,
trace: None,
}),
})
.collect::<Result<Vec<(RawContentKey, RawContentValue)>, OverlayRequestError>>()?;
// Construct the request.
let request = PopulatedOffer { content_items };
let direction = RequestDirection::Outgoing {
destination: enr.clone(),
};

// Send the request and wait on the response.
match self
.send_overlay_request(Request::PopulatedOffer(request), direction)
.await
{
Ok(Response::Accept(accept)) => Ok(accept),
Ok(_) => Err(OverlayRequestError::InvalidResponse),
Err(error) => Err(error),
}
}

/// Send Offer request without storing the content into db
pub async fn send_offer(
&self,
Expand Down
6 changes: 1 addition & 5 deletions portalnet/src/overlay/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2609,11 +2609,7 @@ mod tests {

use std::{net::SocketAddr, time::Instant};

<<<<<<< HEAD
use alloy::primitives::U256;
=======
use alloy_primitives::{Bytes, U256};
>>>>>>> 1daad075 (feat: converting Vec<u8> to bytes::Bytes)
use alloy::primitives::{Bytes, U256};
use discv5::kbucket;
use kbucket::KBucketsTable;
use rstest::*;
Expand Down
2 changes: 1 addition & 1 deletion trin-state/src/jsonrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ async fn offer(
) -> Result<Value, String> {
let content_items = content_items
.into_iter()
.map(|(key, value)| (key.to_bytes(), value.encode().to_vec()))
.map(|(key, value)| (key.to_bytes(), value.encode()))
.collect();

to_json_result(
Expand Down

0 comments on commit 71175fc

Please sign in to comment.