Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ help: ## 📚 Show help for each of the Makefile recipes
lint: ## 🔍 Run clippy on all workspace crates
cargo clippy --workspace --all-targets -- -D warnings

test: ## 🧪 Run all tests, then forkchoice tests with skip-signature-verification
test: leanSpec/fixtures ## 🧪 Run all tests, then forkchoice tests with skip-signature-verification
# Tests need to be run on release to avoid stack overflows during signature verification/aggregation
cargo test --workspace --release
cargo test -p ethlambda-blockchain --features skip-signature-verification --test forkchoice_spectests
Expand Down
8 changes: 5 additions & 3 deletions crates/net/p2p/src/req_resp/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use super::{
};
use crate::{
BACKOFF_MULTIPLIER, INITIAL_BACKOFF_MS, MAX_FETCH_RETRIES, P2PServer, PendingRequest,
req_resp::RequestedBlockRoots,
RetryMessage,
};

Expand Down Expand Up @@ -99,7 +100,7 @@ async fn handle_blocks_by_root_request(
_channel: request_response::ResponseChannel<Response>,
peer: PeerId,
) {
let num_roots = request.len();
let num_roots = request.roots.len();
info!(%peer, num_roots, "Received BlocksByRoot request");

// TODO: Implement signed block storage and send response chunks
Expand Down Expand Up @@ -166,11 +167,12 @@ pub async fn fetch_block_from_peer(
};

// Create BlocksByRoot request with single root
let mut request = BlocksByRootRequest::empty();
if let Err(err) = request.push(root) {
let mut roots = RequestedBlockRoots::empty();
if let Err(err) = roots.push(root) {
error!(%root, ?err, "Failed to create BlocksByRoot request");
return false;
}
let request = BlocksByRootRequest { roots };

info!(%peer, %root, "Sending BlocksByRoot request for missing block");
let request_id = server
Expand Down
7 changes: 6 additions & 1 deletion crates/net/p2p/src/req_resp/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ pub struct Status {

type MaxRequestBlocks = typenum::U1024;

pub type BlocksByRootRequest = ssz_types::VariableList<H256, MaxRequestBlocks>;
pub type RequestedBlockRoots = ssz_types::VariableList<H256, MaxRequestBlocks>;

#[derive(Debug, Clone, Encode, Decode)]
pub struct BlocksByRootRequest {
pub roots: RequestedBlockRoots,
}
4 changes: 2 additions & 2 deletions crates/net/p2p/src/req_resp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ pub use codec::Codec;
pub use encoding::MAX_COMPRESSED_PAYLOAD_SIZE;
pub use handlers::{build_status, fetch_block_from_peer, handle_req_resp_message};
pub use messages::{
BLOCKS_BY_ROOT_PROTOCOL_V1, BlocksByRootRequest, Request, Response, ResponsePayload,
ResponseResult, STATUS_PROTOCOL_V1, Status,
BLOCKS_BY_ROOT_PROTOCOL_V1, BlocksByRootRequest, Request, RequestedBlockRoots, Response,
ResponsePayload, ResponseResult, STATUS_PROTOCOL_V1, Status,
};
Loading