Skip to content

Commit 45d22e4

Browse files
Tumaspovi
andcommitted
Upgrade consensus-spec-tests to v1.5.0-beta.2
- Update`eth2_libp2p` & move blob count validations of received requests to `eth2_libp2p` - Add `POST /eth/v2/beacon/pool/attestations` endpoint Co-authored-by: Povilas Liubauskas <[email protected]>
1 parent ef2a76a commit 45d22e4

File tree

32 files changed

+905
-617
lines changed

32 files changed

+905
-617
lines changed

Cargo.lock

Lines changed: 429 additions & 234 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ jwt-simple = { version = '0.12', default-features = false, features = ['pure-rus
365365
kzg = { git = 'https://github.com/grandinetech/rust-kzg.git' }
366366
lazy_static = '1'
367367
libmdbx = { git = 'https://github.com/paradigmxyz/reth.git', package = 'reth-libmdbx', rev = 'c228fe15808c3acbf18dc3af1a03ef5cbdcda07a' }
368-
libp2p = { version = '0.54', default-features = false, features = ['metrics', 'dns', 'ecdsa', 'identify', 'macros', 'noise', 'plaintext', 'secp256k1', 'serde', 'tcp', 'tokio', 'yamux', 'quic', 'upnp'] }
369-
libp2p-mplex = '0.42'
368+
libp2p = { version = '0.55', default-features = false, features = ['metrics', 'dns', 'ecdsa', 'identify', 'macros', 'noise', 'plaintext', 'secp256k1', 'serde', 'tcp', 'tokio', 'yamux', 'quic', 'upnp'] }
369+
libp2p-mplex = '0.43'
370370
log = '0.4'
371371
lru = '0.12'
372372
mediatype = '0.19'

block_producer/src/block_producer.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,20 @@ impl<P: Preset, W: Wait> BlockProducer<P, W> {
456456
.controller
457457
.preprocessed_state_at_current_slot()?;
458458

459-
let outcome = match unphased::validate_voluntary_exit(
460-
&self.producer_context.chain_config,
461-
&state,
462-
exit,
463-
) {
459+
let result = match state.as_ref() {
460+
BeaconState::Phase0(_)
461+
| BeaconState::Altair(_)
462+
| BeaconState::Bellatrix(_)
463+
| BeaconState::Capella(_)
464+
| BeaconState::Deneb(_) => {
465+
unphased::validate_voluntary_exit(&self.producer_context.chain_config, &state, exit)
466+
}
467+
BeaconState::Electra(state) => {
468+
electra::validate_voluntary_exit(&self.producer_context.chain_config, state, exit)
469+
}
470+
};
471+
472+
let outcome = match result {
464473
Ok(()) => {
465474
voluntary_exits.push(exit);
466475
PoolAdditionOutcome::Accept

block_producer/src/eth1_storage.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,16 @@ pub trait Eth1Storage {
5656
&self,
5757
config: &Config,
5858
metrics: Option<&Arc<Metrics>>,
59-
state_at_slot: &impl BeaconState<P>,
59+
state_at_slot: &CombinedBeaconState<P>,
6060
) -> Result<Eth1Data> {
6161
let _timer = metrics.map(|metrics| metrics.eth1_vote_times.start_timer());
6262

63+
if let Some(state) = state_at_slot.post_electra() {
64+
if state.eth1_deposit_index() == state.deposit_requests_start_index() {
65+
return Ok(state.eth1_data());
66+
}
67+
}
68+
6369
let eth1_data = state_at_slot.eth1_data();
6470
let period_start = voting_period_start_time(config, state_at_slot);
6571

consensus-spec-tests

eip_7594/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ mod tests {
7878

7979
#[duplicate_item(
8080
glob function_name preset;
81-
["consensus-spec-tests/tests/mainnet/fulu/networking/get_custody_columns/*/*"] [get_custody_groups_mainnet] [Mainnet];
82-
["consensus-spec-tests/tests/minimal/fulu/networking/get_custody_columns/*/*"] [get_custody_groups_minimal] [Minimal];
81+
["consensus-spec-tests/tests/mainnet/fulu/networking/get_custody_groups/*/*"] [get_custody_groups_mainnet] [Mainnet];
82+
["consensus-spec-tests/tests/minimal/fulu/networking/get_custody_groups/*/*"] [get_custody_groups_minimal] [Minimal];
8383
)]
8484
#[test_resources(glob)]
8585
fn function_name(case: Case) {

fork_choice_control/src/helpers.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ impl<P: Preset> Context<P> {
255255
}
256256

257257
pub fn on_blob_sidecar(&mut self, blob_sidecar: BlobSidecar<P>) -> Option<P2pMessage<P>> {
258-
let subnet_id = misc::compute_subnet_for_blob_sidecar(self.config(), &blob_sidecar)
259-
.expect("cannot compute subnet_id for given blob_sidecar");
258+
let subnet_id = misc::compute_subnet_for_blob_sidecar(self.config(), &blob_sidecar);
260259

261260
self.controller().on_gossip_blob_sidecar(
262261
Arc::new(blob_sidecar),

fork_choice_control/src/messages.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ pub enum MutatorMessage<P: Preset, W> {
108108
wait_group: W,
109109
result: Result<BlobSidecarAction<P>>,
110110
origin: BlobSidecarOrigin,
111+
blob_identifier: BlobIdentifier,
111112
block_seen: bool,
112113
submission_time: Instant,
113114
},
@@ -170,7 +171,7 @@ pub enum P2pMessage<P: Preset> {
170171
Accept(GossipId),
171172
Ignore(GossipId),
172173
PublishBlobSidecar(Arc<BlobSidecar<P>>),
173-
Reject(GossipId, MutatorRejectionReason),
174+
Reject(Option<GossipId>, MutatorRejectionReason),
174175
BlockNeeded(H256, Option<PeerId>),
175176
BlobsNeeded(Vec<BlobIdentifier>, Slot, Option<PeerId>),
176177
FinalizedCheckpoint(Checkpoint),

fork_choice_control/src/misc.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use serde::Serialize;
1212
use strum::IntoStaticStr;
1313
use types::{
1414
combined::{SignedAggregateAndProof, SignedBeaconBlock},
15-
deneb::containers::BlobSidecar,
15+
deneb::containers::{BlobIdentifier, BlobSidecar},
1616
phase0::primitives::ValidatorIndex,
1717
preset::Preset,
1818
};
@@ -118,7 +118,10 @@ pub enum MutatorRejectionReason {
118118
InvalidAggregateAndProof,
119119
InvalidAttestation,
120120
InvalidBlock,
121-
InvalidBlobSidecar,
121+
#[strum(serialize = "invalid_blob_sidecar")]
122+
InvalidBlobSidecar {
123+
blob_identifier: BlobIdentifier,
124+
},
122125
}
123126

124127
#[derive(Clone, Copy, Debug)]

0 commit comments

Comments
 (0)