mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-02 20:34:27 +00:00
Merge remote-tracking branch 'origin/deneb-free-blobs' into tree-states-deneb
This commit is contained in:
@@ -388,7 +388,7 @@ pub struct KzgVerifiedBlob<T: EthSpec> {
|
|||||||
|
|
||||||
impl<T: EthSpec> PartialOrd for KzgVerifiedBlob<T> {
|
impl<T: EthSpec> PartialOrd for KzgVerifiedBlob<T> {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
self.blob.partial_cmp(&other.blob)
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ impl CheckpointMap {
|
|||||||
pub fn insert(&mut self, checkpoint: Checkpoint, eth1_finalization_data: Eth1FinalizationData) {
|
pub fn insert(&mut self, checkpoint: Checkpoint, eth1_finalization_data: Eth1FinalizationData) {
|
||||||
self.store
|
self.store
|
||||||
.entry(checkpoint.epoch)
|
.entry(checkpoint.epoch)
|
||||||
.or_insert_with(Vec::new)
|
.or_default()
|
||||||
.push((checkpoint.root, eth1_finalization_data));
|
.push((checkpoint.root, eth1_finalization_data));
|
||||||
|
|
||||||
// faster to reduce size after the fact than do pre-checking to see
|
// faster to reduce size after the fact than do pre-checking to see
|
||||||
|
|||||||
@@ -178,20 +178,17 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
let signature_set = signed_blocks
|
let signature_set = signed_blocks
|
||||||
.iter()
|
.iter()
|
||||||
.zip_eq(block_roots)
|
.zip_eq(block_roots)
|
||||||
.filter_map(|(block, block_root)| {
|
.filter(|&(_block, block_root)| (block_root != self.genesis_block_root))
|
||||||
(block_root != self.genesis_block_root).then(|| {
|
.map(|(block, block_root)| {
|
||||||
block_proposal_signature_set_from_parts(
|
block_proposal_signature_set_from_parts(
|
||||||
block,
|
block,
|
||||||
Some(block_root),
|
Some(block_root),
|
||||||
block.message().proposer_index(),
|
block.message().proposer_index(),
|
||||||
&self.spec.fork_at_epoch(block.message().epoch()),
|
&self.spec.fork_at_epoch(block.message().epoch()),
|
||||||
self.genesis_validators_root,
|
self.genesis_validators_root,
|
||||||
|validator_index| {
|
|validator_index| pubkey_cache.get(validator_index).cloned().map(Cow::Owned),
|
||||||
pubkey_cache.get(validator_index).cloned().map(Cow::Owned)
|
&self.spec,
|
||||||
},
|
)
|
||||||
&self.spec,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.collect::<Result<Vec<_>, _>>()
|
.collect::<Result<Vec<_>, _>>()
|
||||||
.map_err(HistoricalBlockError::SignatureSet)
|
.map_err(HistoricalBlockError::SignatureSet)
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
|
|||||||
let block_hash = block.block_hash();
|
let block_hash = block.block_hash();
|
||||||
self.block_hashes
|
self.block_hashes
|
||||||
.entry(block.block_number())
|
.entry(block.block_number())
|
||||||
.or_insert_with(Vec::new)
|
.or_default()
|
||||||
.push(block_hash);
|
.push(block_hash);
|
||||||
self.blocks.insert(block_hash, block);
|
self.blocks.insert(block_hash, block);
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ use beacon_chain::{BeaconChain, BeaconChainTypes};
|
|||||||
use eth2::lighthouse::StandardBlockReward;
|
use eth2::lighthouse::StandardBlockReward;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use warp_utils::reject::beacon_chain_error;
|
use warp_utils::reject::beacon_chain_error;
|
||||||
//// The difference between block_rewards and beacon_block_rewards is the later returns block
|
/// The difference between block_rewards and beacon_block_rewards is the later returns block
|
||||||
//// reward format that satisfies beacon-api specs
|
/// reward format that satisfies beacon-api specs
|
||||||
pub fn compute_beacon_block_rewards<T: BeaconChainTypes>(
|
pub fn compute_beacon_block_rewards<T: BeaconChainTypes>(
|
||||||
chain: Arc<BeaconChain<T>>,
|
chain: Arc<BeaconChain<T>>,
|
||||||
block_id: BlockId,
|
block_id: BlockId,
|
||||||
|
|||||||
@@ -1055,7 +1055,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
|||||||
Subnet::Attestation(_) => {
|
Subnet::Attestation(_) => {
|
||||||
subnet_to_peer
|
subnet_to_peer
|
||||||
.entry(subnet)
|
.entry(subnet)
|
||||||
.or_insert_with(Vec::new)
|
.or_default()
|
||||||
.push((*peer_id, info.clone()));
|
.push((*peer_id, info.clone()));
|
||||||
}
|
}
|
||||||
Subnet::SyncCommittee(id) => {
|
Subnet::SyncCommittee(id) => {
|
||||||
|
|||||||
@@ -330,13 +330,15 @@ impl Eq for Score {}
|
|||||||
|
|
||||||
impl PartialOrd for Score {
|
impl PartialOrd for Score {
|
||||||
fn partial_cmp(&self, other: &Score) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Score) -> Option<std::cmp::Ordering> {
|
||||||
self.score().partial_cmp(&other.score())
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ord for Score {
|
impl Ord for Score {
|
||||||
fn cmp(&self, other: &Score) -> std::cmp::Ordering {
|
fn cmp(&self, other: &Score) -> std::cmp::Ordering {
|
||||||
self.partial_cmp(other).unwrap_or(std::cmp::Ordering::Equal)
|
self.score()
|
||||||
|
.partial_cmp(&other.score())
|
||||||
|
.unwrap_or(std::cmp::Ordering::Equal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,14 +151,8 @@ impl<T: EthSpec> AttestationMap<T> {
|
|||||||
indexed,
|
indexed,
|
||||||
} = SplitAttestation::new(attestation, attesting_indices);
|
} = SplitAttestation::new(attestation, attesting_indices);
|
||||||
|
|
||||||
let attestation_map = self
|
let attestation_map = self.checkpoint_map.entry(checkpoint).or_default();
|
||||||
.checkpoint_map
|
let attestations = attestation_map.attestations.entry(data).or_default();
|
||||||
.entry(checkpoint)
|
|
||||||
.or_insert_with(AttestationDataMap::default);
|
|
||||||
let attestations = attestation_map
|
|
||||||
.attestations
|
|
||||||
.entry(data)
|
|
||||||
.or_insert_with(Vec::new);
|
|
||||||
|
|
||||||
// Greedily aggregate the attestation with all existing attestations.
|
// Greedily aggregate the attestation with all existing attestations.
|
||||||
// NOTE: this is sub-optimal and in future we will remove this in favour of max-clique
|
// NOTE: this is sub-optimal and in future we will remove this in favour of max-clique
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ impl BlobIdentifier {
|
|||||||
|
|
||||||
impl PartialOrd for BlobIdentifier {
|
impl PartialOrd for BlobIdentifier {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
self.index.partial_cmp(&other.index)
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ impl<E: EthSpec> From<BlobSidecar<E>> for BlindedBlobSidecar {
|
|||||||
|
|
||||||
impl<T: EthSpec> PartialOrd for BlobSidecar<T> {
|
impl<T: EthSpec> PartialOrd for BlobSidecar<T> {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
self.index.partial_cmp(&other.index)
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.fold(HashMap::new(), |mut map, duty_and_proof| {
|
.fold(HashMap::new(), |mut map, duty_and_proof| {
|
||||||
map.entry(duty_and_proof.duty.committee_index)
|
map.entry(duty_and_proof.duty.committee_index)
|
||||||
.or_insert_with(Vec::new)
|
.or_default()
|
||||||
.push(duty_and_proof);
|
.push(duty_and_proof);
|
||||||
map
|
map
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ impl SyncDutiesMap {
|
|||||||
|
|
||||||
committees_writer
|
committees_writer
|
||||||
.entry(committee_period)
|
.entry(committee_period)
|
||||||
.or_insert_with(CommitteeDuties::default)
|
.or_default()
|
||||||
.init(validator_indices);
|
.init(validator_indices);
|
||||||
|
|
||||||
// Return shared reference
|
// Return shared reference
|
||||||
|
|||||||
Reference in New Issue
Block a user