Skip to content

Commit 68a9a2e

Browse files
committed
Merge remote-tracking branch 'origin/unstable' into tree-states
2 parents 8e68926 + 0f345c7 commit 68a9a2e

File tree

20 files changed

+94
-153
lines changed

20 files changed

+94
-153
lines changed

.github/mergify.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ queue_rules:
44
batch_max_wait_time: 60 s
55
checks_timeout: 10800 s
66
merge_method: squash
7+
commit_message_template: |
8+
{{ title }} (#{{ number }})
9+
10+
{% for commit in commits %}
11+
* {{ commit.commit_message }}
12+
{% endfor %}
713
queue_conditions:
814
- "#approved-reviews-by >= 1"
915
- "check-success=license/cla"

.github/workflows/docker.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ jobs:
152152
- name: Dockerhub login
153153
run: |
154154
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
155-
- name: Build lcli dockerfile (with push)
156-
run: |
157-
docker build \
158-
--build-arg PORTABLE=true \
159-
--tag ${LCLI_IMAGE_NAME}:${VERSION}${VERSION_SUFFIX} \
160-
--file ./lcli/Dockerfile .
161-
docker push ${LCLI_IMAGE_NAME}:${VERSION}${VERSION_SUFFIX}
155+
- name: Build lcli and push
156+
uses: docker/build-push-action@v5
157+
with:
158+
build-args: |
159+
FEATURES=portable
160+
context: .
161+
push: true
162+
file: ./lcli/Dockerfile
163+
tags: ${{ env.LCLI_IMAGE_NAME }}:${{ env.VERSION }}${{ env.VERSION_SUFFIX }}

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4023,7 +4023,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
40234023
.task_executor
40244024
.spawn_blocking_handle(
40254025
move || chain.load_state_for_block_production(slot),
4026-
"produce_partial_beacon_block",
4026+
"load_state_for_block_production",
40274027
)
40284028
.ok_or(BlockProductionError::ShuttingDown)?
40294029
.await

beacon_node/beacon_chain/src/data_availability_checker.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,18 @@ pub struct AvailableBlock<E: EthSpec> {
545545
}
546546

547547
impl<E: EthSpec> AvailableBlock<E> {
548+
pub fn __new_for_testing(
549+
block_root: Hash256,
550+
block: Arc<SignedBeaconBlock<E>>,
551+
blobs: Option<BlobSidecarList<E>>,
552+
) -> Self {
553+
Self {
554+
block_root,
555+
block,
556+
blobs,
557+
}
558+
}
559+
548560
pub fn block(&self) -> &SignedBeaconBlock<E> {
549561
&self.block
550562
}

beacon_node/beacon_chain/src/historical_blocks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
141141

142142
prev_block_slot = block.slot();
143143
expected_block_root = block.message().parent_root();
144+
signed_blocks.push(block);
144145

145146
// If we've reached genesis, add the genesis block root to the batch for all slots
146147
// between 0 and the first block slot, and set the anchor slot to 0 to indicate
147148
// completion.
148149
if expected_block_root == self.genesis_block_root {
149150
let genesis_slot = self.spec.genesis_slot;
150-
for slot in genesis_slot.as_u64()..block.slot().as_u64() {
151+
for slot in genesis_slot.as_u64()..prev_block_slot.as_u64() {
151152
cold_batch.push(KeyValueStoreOp::PutKeyValue(
152153
get_key_for_col(DBColumn::BeaconBlockRoots.into(), &slot.to_be_bytes()),
153154
self.genesis_block_root.as_bytes().to_vec(),
@@ -157,7 +158,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
157158
expected_block_root = Hash256::zero();
158159
break;
159160
}
160-
signed_blocks.push(block);
161161
}
162162
// these were pushed in reverse order so we reverse again
163163
signed_blocks.reverse();

beacon_node/beacon_chain/src/observed_aggregates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<T: EthSpec> Consts for Attestation<T> {
4343

4444
/// We need to keep attestations for each slot of the current epoch.
4545
fn max_slot_capacity() -> usize {
46-
T::slots_per_epoch() as usize
46+
2 * T::slots_per_epoch() as usize
4747
}
4848

4949
/// As a DoS protection measure, the maximum number of distinct `Attestations` or

beacon_node/beacon_chain/src/observed_attesters.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ use types::{Epoch, EthSpec, Hash256, Slot, Unsigned};
2424

2525
/// The maximum capacity of the `AutoPruningEpochContainer`.
2626
///
27-
/// Fits the next, current and previous epochs. We require the next epoch due to the
28-
/// `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the previous epoch since the specification
29-
/// declares:
27+
/// If the current epoch is N, this fits epoch N + 1, N, N - 1, and N - 2. We require the next epoch due
28+
/// to the `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the N - 2 epoch since the specification declares:
3029
///
3130
/// ```ignore
32-
/// aggregate.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE
33-
/// >= current_slot >= aggregate.data.slot
31+
/// the epoch of `aggregate.data.slot` is either the current or previous epoch
3432
/// ```
3533
///
36-
/// This means that during the current epoch we will always accept an attestation
37-
/// from at least one slot in the previous epoch.
38-
pub const MAX_CACHED_EPOCHS: u64 = 3;
34+
/// This means that during the current epoch we will always accept an attestation from
35+
/// at least one slot in the epoch prior to the previous epoch.
36+
pub const MAX_CACHED_EPOCHS: u64 = 4;
3937

4038
pub type ObservedAttesters<E> = AutoPruningEpochContainer<EpochBitfield, E>;
4139
pub type ObservedSyncContributors<E> =

beacon_node/beacon_chain/tests/store_tests.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use beacon_chain::attestation_verification::Error as AttnError;
44
use beacon_chain::block_verification_types::RpcBlock;
55
use beacon_chain::builder::BeaconChainBuilder;
6+
use beacon_chain::data_availability_checker::AvailableBlock;
67
use beacon_chain::test_utils::{
78
mock_execution_layer_from_parts, test_spec, AttestationStrategy, BeaconChainHarness,
89
BlockStrategy, DiskHarnessType,
@@ -2305,6 +2306,25 @@ async fn weak_subjectivity_sync_test(slots: Vec<Slot>, checkpoint_slot: Slot) {
23052306
}
23062307
}
23072308

2309+
// Corrupt the signature on the 1st block to ensure that the backfill processor is checking
2310+
// signatures correctly. Regression test for https://github.com/sigp/lighthouse/pull/5120.
2311+
let mut batch_with_invalid_first_block = available_blocks.clone();
2312+
batch_with_invalid_first_block[0] = {
2313+
let (block_root, block, blobs) = available_blocks[0].clone().deconstruct();
2314+
let mut corrupt_block = (*block).clone();
2315+
*corrupt_block.signature_mut() = Signature::empty();
2316+
AvailableBlock::__new_for_testing(block_root, Arc::new(corrupt_block), blobs)
2317+
};
2318+
2319+
// Importing the invalid batch should error.
2320+
assert!(matches!(
2321+
beacon_chain
2322+
.import_historical_block_batch(batch_with_invalid_first_block)
2323+
.unwrap_err(),
2324+
BeaconChainError::HistoricalBlockError(HistoricalBlockError::InvalidSignature)
2325+
));
2326+
2327+
// Importing the batch with valid signatures should succeed.
23082328
beacon_chain
23092329
.import_historical_block_batch(available_blocks.clone())
23102330
.unwrap();

beacon_node/http_api/src/lib.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,36 +4265,6 @@ pub fn serve<T: BeaconChainTypes>(
42654265
},
42664266
);
42674267

4268-
// GET lighthouse/beacon/states/{state_id}/ssz
4269-
let get_lighthouse_beacon_states_ssz = warp::path("lighthouse")
4270-
.and(warp::path("beacon"))
4271-
.and(warp::path("states"))
4272-
.and(warp::path::param::<StateId>())
4273-
.and(warp::path("ssz"))
4274-
.and(warp::path::end())
4275-
.and(task_spawner_filter.clone())
4276-
.and(chain_filter.clone())
4277-
.then(
4278-
|state_id: StateId,
4279-
task_spawner: TaskSpawner<T::EthSpec>,
4280-
chain: Arc<BeaconChain<T>>| {
4281-
task_spawner.blocking_response_task(Priority::P1, move || {
4282-
// This debug endpoint provides no indication of optimistic status.
4283-
let (state, _execution_optimistic, _finalized) = state_id.state(&chain)?;
4284-
Response::builder()
4285-
.status(200)
4286-
.body(state.as_ssz_bytes().into())
4287-
.map(|res: Response<Body>| add_ssz_content_type_header(res))
4288-
.map_err(|e| {
4289-
warp_utils::reject::custom_server_error(format!(
4290-
"failed to create response: {}",
4291-
e
4292-
))
4293-
})
4294-
})
4295-
},
4296-
);
4297-
42984268
// GET lighthouse/staking
42994269
let get_lighthouse_staking = warp::path("lighthouse")
43004270
.and(warp::path("staking"))
@@ -4629,7 +4599,6 @@ pub fn serve<T: BeaconChainTypes>(
46294599
.uor(get_lighthouse_eth1_syncing)
46304600
.uor(get_lighthouse_eth1_block_cache)
46314601
.uor(get_lighthouse_eth1_deposit_cache)
4632-
.uor(get_lighthouse_beacon_states_ssz)
46334602
.uor(get_lighthouse_staking)
46344603
.uor(get_lighthouse_database_info)
46354604
.uor(get_lighthouse_block_rewards)

beacon_node/http_api/tests/tests.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,26 +5057,6 @@ impl ApiTester {
50575057
self
50585058
}
50595059

5060-
pub async fn test_get_lighthouse_beacon_states_ssz(self) -> Self {
5061-
for state_id in self.interesting_state_ids() {
5062-
let result = self
5063-
.client
5064-
.get_lighthouse_beacon_states_ssz(&state_id.0, &self.chain.spec)
5065-
.await
5066-
.unwrap();
5067-
5068-
let mut expected = state_id
5069-
.state(&self.chain)
5070-
.ok()
5071-
.map(|(state, _execution_optimistic, _finalized)| state);
5072-
expected.as_mut().map(|state| state.drop_all_caches());
5073-
5074-
assert_eq!(result, expected, "{:?}", state_id);
5075-
}
5076-
5077-
self
5078-
}
5079-
50805060
pub async fn test_get_lighthouse_staking(self) -> Self {
50815061
let result = self.client.get_lighthouse_staking().await.unwrap();
50825062

@@ -6373,8 +6353,6 @@ async fn lighthouse_endpoints() {
63736353
.await
63746354
.test_get_lighthouse_eth1_deposit_cache()
63756355
.await
6376-
.test_get_lighthouse_beacon_states_ssz()
6377-
.await
63786356
.test_get_lighthouse_staking()
63796357
.await
63806358
.test_get_lighthouse_database_info()

0 commit comments

Comments
 (0)