Skip to content

Commit 6ab6eae

Browse files
committed
Merge remote-tracking branch 'origin/release-v7.0.0-beta.0' into unstable
2 parents 0055af5 + 1888be5 commit 6ab6eae

File tree

9 files changed

+135
-98
lines changed

9 files changed

+135
-98
lines changed

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

beacon_node/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "beacon_node"
3-
version = "6.0.1"
3+
version = "7.0.0-beta.0"
44
authors = [
55
"Paul Hauner <[email protected]>",
66
"Age Manning <[email protected]",

beacon_node/beacon_processor/src/lib.rs

+43-30
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ pub struct BeaconProcessorQueueLengths {
109109
gossip_voluntary_exit_queue: usize,
110110
gossip_proposer_slashing_queue: usize,
111111
gossip_attester_slashing_queue: usize,
112-
finality_update_queue: usize,
113-
optimistic_update_queue: usize,
114112
unknown_light_client_update_queue: usize,
115113
unknown_block_sampling_request_queue: usize,
116114
rpc_block_queue: usize,
@@ -132,9 +130,11 @@ pub struct BeaconProcessorQueueLengths {
132130
dcbroots_queue: usize,
133131
dcbrange_queue: usize,
134132
gossip_bls_to_execution_change_queue: usize,
133+
lc_gossip_finality_update_queue: usize,
134+
lc_gossip_optimistic_update_queue: usize,
135135
lc_bootstrap_queue: usize,
136-
lc_optimistic_update_queue: usize,
137-
lc_finality_update_queue: usize,
136+
lc_rpc_optimistic_update_queue: usize,
137+
lc_rpc_finality_update_queue: usize,
138138
lc_update_range_queue: usize,
139139
api_request_p0_queue: usize,
140140
api_request_p1_queue: usize,
@@ -175,15 +175,13 @@ impl BeaconProcessorQueueLengths {
175175
gossip_voluntary_exit_queue: 4096,
176176
gossip_proposer_slashing_queue: 4096,
177177
gossip_attester_slashing_queue: 4096,
178-
finality_update_queue: 1024,
179-
optimistic_update_queue: 1024,
180-
unknown_block_sampling_request_queue: 16384,
181178
unknown_light_client_update_queue: 128,
182179
rpc_block_queue: 1024,
183180
rpc_blob_queue: 1024,
184181
// TODO(das): Placeholder values
185182
rpc_custody_column_queue: 1000,
186183
rpc_verify_data_column_queue: 1000,
184+
unknown_block_sampling_request_queue: 16384,
187185
sampling_result_queue: 1000,
188186
chain_segment_queue: 64,
189187
backfill_chain_segment: 64,
@@ -200,9 +198,11 @@ impl BeaconProcessorQueueLengths {
200198
dcbroots_queue: 1024,
201199
dcbrange_queue: 1024,
202200
gossip_bls_to_execution_change_queue: 16384,
201+
lc_gossip_finality_update_queue: 1024,
202+
lc_gossip_optimistic_update_queue: 1024,
203203
lc_bootstrap_queue: 1024,
204-
lc_optimistic_update_queue: 512,
205-
lc_finality_update_queue: 512,
204+
lc_rpc_optimistic_update_queue: 512,
205+
lc_rpc_finality_update_queue: 512,
206206
lc_update_range_queue: 512,
207207
api_request_p0_queue: 1024,
208208
api_request_p1_queue: 1024,
@@ -884,21 +884,16 @@ impl<E: EthSpec> BeaconProcessor<E> {
884884
let mut gossip_attester_slashing_queue =
885885
FifoQueue::new(queue_lengths.gossip_attester_slashing_queue);
886886

887-
// Using a FIFO queue for light client updates to maintain sequence order.
888-
let mut finality_update_queue = FifoQueue::new(queue_lengths.finality_update_queue);
889-
let mut optimistic_update_queue = FifoQueue::new(queue_lengths.optimistic_update_queue);
890-
let mut unknown_light_client_update_queue =
891-
FifoQueue::new(queue_lengths.unknown_light_client_update_queue);
892-
let mut unknown_block_sampling_request_queue =
893-
FifoQueue::new(queue_lengths.unknown_block_sampling_request_queue);
894-
895887
// Using a FIFO queue since blocks need to be imported sequentially.
896888
let mut rpc_block_queue = FifoQueue::new(queue_lengths.rpc_block_queue);
897889
let mut rpc_blob_queue = FifoQueue::new(queue_lengths.rpc_blob_queue);
898890
let mut rpc_custody_column_queue = FifoQueue::new(queue_lengths.rpc_custody_column_queue);
899891
let mut rpc_verify_data_column_queue =
900892
FifoQueue::new(queue_lengths.rpc_verify_data_column_queue);
893+
// TODO(das): the sampling_request_queue is never read
901894
let mut sampling_result_queue = FifoQueue::new(queue_lengths.sampling_result_queue);
895+
let mut unknown_block_sampling_request_queue =
896+
FifoQueue::new(queue_lengths.unknown_block_sampling_request_queue);
902897
let mut chain_segment_queue = FifoQueue::new(queue_lengths.chain_segment_queue);
903898
let mut backfill_chain_segment = FifoQueue::new(queue_lengths.backfill_chain_segment);
904899
let mut gossip_block_queue = FifoQueue::new(queue_lengths.gossip_block_queue);
@@ -917,10 +912,18 @@ impl<E: EthSpec> BeaconProcessor<E> {
917912
let mut gossip_bls_to_execution_change_queue =
918913
FifoQueue::new(queue_lengths.gossip_bls_to_execution_change_queue);
919914

915+
// Using FIFO queues for light client updates to maintain sequence order.
916+
let mut lc_gossip_finality_update_queue =
917+
FifoQueue::new(queue_lengths.lc_gossip_finality_update_queue);
918+
let mut lc_gossip_optimistic_update_queue =
919+
FifoQueue::new(queue_lengths.lc_gossip_optimistic_update_queue);
920+
let mut unknown_light_client_update_queue =
921+
FifoQueue::new(queue_lengths.unknown_light_client_update_queue);
920922
let mut lc_bootstrap_queue = FifoQueue::new(queue_lengths.lc_bootstrap_queue);
921-
let mut lc_optimistic_update_queue =
922-
FifoQueue::new(queue_lengths.lc_optimistic_update_queue);
923-
let mut lc_finality_update_queue = FifoQueue::new(queue_lengths.lc_finality_update_queue);
923+
let mut lc_rpc_optimistic_update_queue =
924+
FifoQueue::new(queue_lengths.lc_rpc_optimistic_update_queue);
925+
let mut lc_rpc_finality_update_queue =
926+
FifoQueue::new(queue_lengths.lc_rpc_finality_update_queue);
924927
let mut lc_update_range_queue = FifoQueue::new(queue_lengths.lc_update_range_queue);
925928

926929
let mut api_request_p0_queue = FifoQueue::new(queue_lengths.api_request_p0_queue);
@@ -1254,11 +1257,19 @@ impl<E: EthSpec> BeaconProcessor<E> {
12541257
} else if let Some(item) = backfill_chain_segment.pop() {
12551258
Some(item)
12561259
// Handle light client requests.
1260+
} else if let Some(item) = lc_gossip_finality_update_queue.pop() {
1261+
Some(item)
1262+
} else if let Some(item) = lc_gossip_optimistic_update_queue.pop() {
1263+
Some(item)
1264+
} else if let Some(item) = unknown_light_client_update_queue.pop() {
1265+
Some(item)
12571266
} else if let Some(item) = lc_bootstrap_queue.pop() {
12581267
Some(item)
1259-
} else if let Some(item) = lc_optimistic_update_queue.pop() {
1268+
} else if let Some(item) = lc_rpc_optimistic_update_queue.pop() {
12601269
Some(item)
1261-
} else if let Some(item) = lc_finality_update_queue.pop() {
1270+
} else if let Some(item) = lc_rpc_finality_update_queue.pop() {
1271+
Some(item)
1272+
} else if let Some(item) = lc_update_range_queue.pop() {
12621273
Some(item)
12631274
// This statement should always be the final else statement.
12641275
} else {
@@ -1362,10 +1373,10 @@ impl<E: EthSpec> BeaconProcessor<E> {
13621373
sync_contribution_queue.push(work)
13631374
}
13641375
Work::GossipLightClientFinalityUpdate { .. } => {
1365-
finality_update_queue.push(work, work_id, &self.log)
1376+
lc_gossip_finality_update_queue.push(work, work_id, &self.log)
13661377
}
13671378
Work::GossipLightClientOptimisticUpdate { .. } => {
1368-
optimistic_update_queue.push(work, work_id, &self.log)
1379+
lc_gossip_optimistic_update_queue.push(work, work_id, &self.log)
13691380
}
13701381
Work::RpcBlock { .. } | Work::IgnoredRpcBlock { .. } => {
13711382
rpc_block_queue.push(work, work_id, &self.log)
@@ -1400,10 +1411,10 @@ impl<E: EthSpec> BeaconProcessor<E> {
14001411
lc_bootstrap_queue.push(work, work_id, &self.log)
14011412
}
14021413
Work::LightClientOptimisticUpdateRequest { .. } => {
1403-
lc_optimistic_update_queue.push(work, work_id, &self.log)
1414+
lc_rpc_optimistic_update_queue.push(work, work_id, &self.log)
14041415
}
14051416
Work::LightClientFinalityUpdateRequest { .. } => {
1406-
lc_finality_update_queue.push(work, work_id, &self.log)
1417+
lc_rpc_finality_update_queue.push(work, work_id, &self.log)
14071418
}
14081419
Work::LightClientUpdatesByRangeRequest { .. } => {
14091420
lc_update_range_queue.push(work, work_id, &self.log)
@@ -1472,9 +1483,11 @@ impl<E: EthSpec> BeaconProcessor<E> {
14721483
WorkType::GossipAttesterSlashing => gossip_attester_slashing_queue.len(),
14731484
WorkType::GossipSyncSignature => sync_message_queue.len(),
14741485
WorkType::GossipSyncContribution => sync_contribution_queue.len(),
1475-
WorkType::GossipLightClientFinalityUpdate => finality_update_queue.len(),
1486+
WorkType::GossipLightClientFinalityUpdate => {
1487+
lc_gossip_finality_update_queue.len()
1488+
}
14761489
WorkType::GossipLightClientOptimisticUpdate => {
1477-
optimistic_update_queue.len()
1490+
lc_gossip_optimistic_update_queue.len()
14781491
}
14791492
WorkType::RpcBlock => rpc_block_queue.len(),
14801493
WorkType::RpcBlobs | WorkType::IgnoredRpcBlock => rpc_blob_queue.len(),
@@ -1495,10 +1508,10 @@ impl<E: EthSpec> BeaconProcessor<E> {
14951508
}
14961509
WorkType::LightClientBootstrapRequest => lc_bootstrap_queue.len(),
14971510
WorkType::LightClientOptimisticUpdateRequest => {
1498-
lc_optimistic_update_queue.len()
1511+
lc_rpc_optimistic_update_queue.len()
14991512
}
15001513
WorkType::LightClientFinalityUpdateRequest => {
1501-
lc_finality_update_queue.len()
1514+
lc_rpc_finality_update_queue.len()
15021515
}
15031516
WorkType::LightClientUpdatesByRangeRequest => lc_update_range_queue.len(),
15041517
WorkType::ApiRequestP0 => api_request_p0_queue.len(),

beacon_node/http_api/src/aggregate_attestation.rs

+20-17
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ pub fn get_aggregate_attestation<T: BeaconChainTypes>(
1818
endpoint_version: EndpointVersion,
1919
chain: Arc<BeaconChain<T>>,
2020
) -> Result<Response<Body>, warp::reject::Rejection> {
21-
if endpoint_version == V2 {
21+
let fork_name = chain.spec.fork_name_at_slot::<T::EthSpec>(slot);
22+
let aggregate_attestation = if fork_name.electra_enabled() {
2223
let Some(committee_index) = committee_index else {
2324
return Err(warp_utils::reject::custom_bad_request(
2425
"missing committee index".to_string(),
2526
));
2627
};
27-
let aggregate_attestation = chain
28+
chain
2829
.get_aggregated_attestation_electra(slot, attestation_data_root, committee_index)
2930
.map_err(|e| {
3031
warp_utils::reject::custom_bad_request(format!(
@@ -34,8 +35,22 @@ pub fn get_aggregate_attestation<T: BeaconChainTypes>(
3435
})?
3536
.ok_or_else(|| {
3637
warp_utils::reject::custom_not_found("no matching aggregate found".to_string())
37-
})?;
38-
let fork_name = chain.spec.fork_name_at_slot::<T::EthSpec>(slot);
38+
})?
39+
} else {
40+
chain
41+
.get_pre_electra_aggregated_attestation_by_slot_and_root(slot, attestation_data_root)
42+
.map_err(|e| {
43+
warp_utils::reject::custom_bad_request(format!(
44+
"unable to fetch aggregate: {:?}",
45+
e
46+
))
47+
})?
48+
.ok_or_else(|| {
49+
warp_utils::reject::custom_not_found("no matching aggregate found".to_string())
50+
})?
51+
};
52+
53+
if endpoint_version == V2 {
3954
let fork_versioned_response = ForkVersionedResponse {
4055
version: Some(fork_name),
4156
metadata: EmptyMetadata {},
@@ -46,19 +61,7 @@ pub fn get_aggregate_attestation<T: BeaconChainTypes>(
4661
fork_name,
4762
))
4863
} else if endpoint_version == V1 {
49-
let aggregate_attestation = chain
50-
.get_pre_electra_aggregated_attestation_by_slot_and_root(slot, attestation_data_root)
51-
.map_err(|e| {
52-
warp_utils::reject::custom_bad_request(format!(
53-
"unable to fetch aggregate: {:?}",
54-
e
55-
))
56-
})?
57-
.map(GenericResponse::from)
58-
.ok_or_else(|| {
59-
warp_utils::reject::custom_not_found("no matching aggregate found".to_string())
60-
})?;
61-
Ok(warp::reply::json(&aggregate_attestation).into_response())
64+
Ok(warp::reply::json(&GenericResponse::from(aggregate_attestation)).into_response())
6265
} else {
6366
return Err(unsupported_version_rejection(endpoint_version));
6467
}

0 commit comments

Comments
 (0)