Skip to content

Commit

Permalink
Merge of #5744
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 15, 2024
2 parents 7b283c5 + 4065ef6 commit e8a7c41
Show file tree
Hide file tree
Showing 10 changed files with 817 additions and 174 deletions.
12 changes: 10 additions & 2 deletions beacon_node/beacon_chain/src/eth1_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,20 @@ impl<E: EthSpec> Eth1ChainBackend<E> for CachingEth1Backend<E> {
state.eth1_data().deposit_count
};

match deposit_index.cmp(&deposit_count) {
// [New in Electra:EIP6110]
let deposit_index_limit =
if let Ok(deposit_receipts_start_index) = state.deposit_requests_start_index() {
std::cmp::min(deposit_count, deposit_receipts_start_index)
} else {
deposit_count
};

match deposit_index.cmp(&deposit_index_limit) {
Ordering::Greater => Err(Error::DepositIndexTooHigh),
Ordering::Equal => Ok(vec![]),
Ordering::Less => {
let next = deposit_index;
let last = std::cmp::min(deposit_count, next + E::MaxDeposits::to_u64());
let last = std::cmp::min(deposit_index_limit, next + E::MaxDeposits::to_u64());

self.core
.deposits()
Expand Down
202 changes: 152 additions & 50 deletions beacon_node/http_api/src/lib.rs

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions beacon_node/http_api/tests/fork_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ async fn attestations_across_fork_with_skip_slots() {
.collect::<Vec<_>>();

assert!(!unaggregated_attestations.is_empty());
let fork_name = harness.spec.fork_name_at_slot::<E>(fork_slot);
client
.post_beacon_pool_attestations(&unaggregated_attestations)
.post_beacon_pool_attestations_v1(&unaggregated_attestations)
.await
.unwrap();
client
.post_beacon_pool_attestations_v2(&unaggregated_attestations, fork_name)
.await
.unwrap();

Expand All @@ -162,7 +167,11 @@ async fn attestations_across_fork_with_skip_slots() {
assert!(!signed_aggregates.is_empty());

client
.post_validator_aggregate_and_proof(&signed_aggregates)
.post_validator_aggregate_and_proof_v1(&signed_aggregates)
.await
.unwrap();
client
.post_validator_aggregate_and_proof_v2(&signed_aggregates, fork_name)
.await
.unwrap();
}
Expand Down
3 changes: 2 additions & 1 deletion beacon_node/http_api/tests/interactive_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,10 @@ async fn queue_attestations_from_http() {
.flat_map(|attestations| attestations.into_iter().map(|(att, _subnet)| att))
.collect::<Vec<_>>();

let fork_name = tester.harness.spec.fork_name_at_slot::<E>(attestation_slot);
let attestation_future = tokio::spawn(async move {
client
.post_beacon_pool_attestations(&attestations)
.post_beacon_pool_attestations_v2(&attestations, fork_name)
.await
.expect("attestations should be processed successfully")
});
Expand Down
Loading

0 comments on commit e8a7c41

Please sign in to comment.