Skip to content

Commit

Permalink
Add data columns by root to currently supported protocol list (#5678)
Browse files Browse the repository at this point in the history
* Add data columns by root to currently supported protocol list.

* Add missing data column by roots handling.
  • Loading branch information
jimmygchen authored May 2, 2024
1 parent d5f3562 commit 0644709
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
2 changes: 2 additions & 0 deletions beacon_node/lighthouse_network/src/rpc/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ impl SupportedProtocol {
supported.extend_from_slice(&[
ProtocolId::new(SupportedProtocol::BlobsByRootV1, Encoding::SSZSnappy),
ProtocolId::new(SupportedProtocol::BlobsByRangeV1, Encoding::SSZSnappy),
// TODO(das): add to PeerDAS fork
ProtocolId::new(SupportedProtocol::DataColumnsByRootV1, Encoding::SSZSnappy),
]);
}
supported
Expand Down
32 changes: 28 additions & 4 deletions beacon_node/network/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,35 @@ impl<T: BeaconChainTypes> Router<T> {
/// Handle a `DataColumnsByRoot` response from the peer.
pub fn on_data_columns_by_root_response(
&mut self,
_peer_id: PeerId,
_request_id: RequestId,
_data_column_sidecar: Option<Arc<DataColumnSidecar<T::EthSpec>>>,
peer_id: PeerId,
request_id: RequestId,
data_column: Option<Arc<DataColumnSidecar<T::EthSpec>>>,
) {
// TODO(das) implement `DataColumnsByRoot` response handling
let request_id = match request_id {
RequestId::Sync(sync_id) => match sync_id {
id @ SyncId::DataColumnsByRoot { .. } => id,
other => {
crit!(self.log, "DataColumnsByRoot response on incorrect request"; "request" => ?other);
return;
}
},
RequestId::Router => {
crit!(self.log, "All DataColumnsByRoot requests belong to sync"; "peer_id" => %peer_id);
return;
}
};

trace!(
self.log,
"Received DataColumnsByRoot Response";
"peer" => %peer_id,
);
self.send_to_sync(SyncMessage::RpcDataColumn {
request_id,
peer_id,
data_column,
seen_timestamp: timestamp_now(),
});
}

fn handle_beacon_processor_send_result(
Expand Down

0 comments on commit 0644709

Please sign in to comment.