Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement data columns by network boilerplate #6224

Merged
merged 7 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 4 additions & 11 deletions beacon_node/beacon_processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1123,17 +1123,6 @@ impl<E: EthSpec> BeaconProcessor<E> {
// and BlocksByRoot)
} else if let Some(item) = status_queue.pop() {
self.spawn_worker(item, idle_tx);
// Prioritize by_root requests over by_range as the former are time
// sensitive for recovery
} else if let Some(item) = bbroots_queue.pop() {
self.spawn_worker(item, idle_tx);
} else if let Some(item) = blbroots_queue.pop() {
self.spawn_worker(item, idle_tx);
} else if let Some(item) = dcbroots_queue.pop() {
self.spawn_worker(item, idle_tx);
} else if let Some(item) = dcbrange_queue.pop() {
self.spawn_worker(item, idle_tx);
// by_range sync after sampling
} else if let Some(item) = bbrange_queue.pop() {
self.spawn_worker(item, idle_tx);
} else if let Some(item) = bbroots_queue.pop() {
Expand All @@ -1142,6 +1131,10 @@ impl<E: EthSpec> BeaconProcessor<E> {
self.spawn_worker(item, idle_tx);
} else if let Some(item) = blbroots_queue.pop() {
self.spawn_worker(item, idle_tx);
} else if let Some(item) = dcbroots_queue.pop() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the intent before was to prioritize all by roots requests ahead of all by range requests?

// Prioritize by_root requests over by_range as the former are time sensitive for recovery

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no evidence this is useful, so let's just extend the deneb priorization

self.spawn_worker(item, idle_tx);
} else if let Some(item) = dcbrange_queue.pop() {
self.spawn_worker(item, idle_tx);
// Check slashings after all other consensus messages so we prioritize
// following head.
//
Expand Down
41 changes: 24 additions & 17 deletions beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ fn context_bytes<E: EthSpec>(
| RPCResponse::BlobsByRoot(_)
| RPCResponse::DataColumnsByRoot(_)
| RPCResponse::DataColumnsByRange(_) => {
// TODO(electra)
return fork_context.to_context_bytes(ForkName::Deneb);
jimmygchen marked this conversation as resolved.
Show resolved Hide resolved
}
RPCResponse::LightClientBootstrap(lc_bootstrap) => {
Expand Down Expand Up @@ -625,14 +624,18 @@ fn handle_rpc_response<E: EthSpec>(
)),
},
SupportedProtocol::DataColumnsByRootV1 => match fork_name {
// TODO(das): update fork name
Some(ForkName::Deneb) => Ok(Some(RPCResponse::DataColumnsByRoot(Arc::new(
DataColumnSidecar::from_ssz_bytes(decoded_buffer)?,
)))),
Some(_) => Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
"Invalid fork name for data columns by root".to_string(),
)),
Some(fork_name) => {
if fork_name.deneb_enabled() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want electra_enabled here right? otherwise we'll be incorrectly advertising this protocol as supported immediately on mainnet when we release

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! we can perhaps add a peer_das_enabled function on chain_spec so we can test this on deneb-based devnets.

if self.fork_context.spec.peer_das_enabled()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PeerDAS is currently supported for both deneb and electra. This check does not advertise the topic on deneb, simply allows it to decode it. Advertise logic is in SupportedTopic::currently_supported.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check does not advertise the topic on deneb, simply allows it to decode it. Advertise logic is in SupportedTopic::currently_supported.

Ah right, thanks

Ok(Some(RPCResponse::DataColumnsByRoot(Arc::new(
DataColumnSidecar::from_ssz_bytes(decoded_buffer)?,
))))
} else {
Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
"Invalid fork name for data columns by root".to_string(),
))
}
}
None => Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
format!(
Expand All @@ -642,14 +645,18 @@ fn handle_rpc_response<E: EthSpec>(
)),
},
SupportedProtocol::DataColumnsByRangeV1 => match fork_name {
// TODO(das): update fork name
Some(ForkName::Deneb) => Ok(Some(RPCResponse::DataColumnsByRange(Arc::new(
DataColumnSidecar::from_ssz_bytes(decoded_buffer)?,
)))),
Some(_) => Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
"Invalid fork name for data columns by range".to_string(),
)),
Some(fork_name) => {
if fork_name.deneb_enabled() {
dapplion marked this conversation as resolved.
Show resolved Hide resolved
Ok(Some(RPCResponse::DataColumnsByRange(Arc::new(
DataColumnSidecar::from_ssz_bytes(decoded_buffer)?,
))))
} else {
Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
"Invalid fork name for data columns by range".to_string(),
))
}
}
None => Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
format!(
Expand Down