mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +00:00
Merge branch 'deneb-free-blobs' of https://github.com/sigp/lighthouse into some-blob-reprocessing-work
This commit is contained in:
@@ -179,15 +179,15 @@ impl ForkChoiceTest {
|
||||
let slot = self.harness.get_current_slot();
|
||||
let (block, state_) = self.harness.make_block(state, slot).await;
|
||||
state = state_;
|
||||
if !predicate(block.message(), &state) {
|
||||
if !predicate(block.0.message(), &state) {
|
||||
break;
|
||||
}
|
||||
if let Ok(block_hash) = self.harness.process_block_result(block.clone()).await {
|
||||
self.harness.attest_block(
|
||||
&state,
|
||||
block.state_root(),
|
||||
block.0.state_root(),
|
||||
block_hash,
|
||||
&block,
|
||||
&block.0,
|
||||
&validators,
|
||||
);
|
||||
self.harness.advance_slot();
|
||||
@@ -273,8 +273,8 @@ impl ForkChoiceTest {
|
||||
)
|
||||
.unwrap();
|
||||
let slot = self.harness.get_current_slot();
|
||||
let (mut signed_block, mut state) = self.harness.make_block(state, slot).await;
|
||||
func(&mut signed_block, &mut state);
|
||||
let (mut block_tuple, mut state) = self.harness.make_block(state, slot).await;
|
||||
func(&mut block_tuple.0, &mut state);
|
||||
let current_slot = self.harness.get_current_slot();
|
||||
self.harness
|
||||
.chain
|
||||
@@ -282,8 +282,8 @@ impl ForkChoiceTest {
|
||||
.fork_choice_write_lock()
|
||||
.on_block(
|
||||
current_slot,
|
||||
signed_block.message(),
|
||||
signed_block.canonical_root(),
|
||||
block_tuple.0.message(),
|
||||
block_tuple.0.canonical_root(),
|
||||
Duration::from_secs(0),
|
||||
&state,
|
||||
PayloadVerificationStatus::Verified,
|
||||
@@ -315,8 +315,8 @@ impl ForkChoiceTest {
|
||||
)
|
||||
.unwrap();
|
||||
let slot = self.harness.get_current_slot();
|
||||
let (mut signed_block, mut state) = self.harness.make_block(state, slot).await;
|
||||
mutation_func(&mut signed_block, &mut state);
|
||||
let (mut block_tuple, mut state) = self.harness.make_block(state, slot).await;
|
||||
mutation_func(&mut block_tuple.0, &mut state);
|
||||
let current_slot = self.harness.get_current_slot();
|
||||
let err = self
|
||||
.harness
|
||||
@@ -325,8 +325,8 @@ impl ForkChoiceTest {
|
||||
.fork_choice_write_lock()
|
||||
.on_block(
|
||||
current_slot,
|
||||
signed_block.message(),
|
||||
signed_block.canonical_root(),
|
||||
block_tuple.0.message(),
|
||||
block_tuple.0.canonical_root(),
|
||||
Duration::from_secs(0),
|
||||
&state,
|
||||
PayloadVerificationStatus::Verified,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::test_utils::TestRandom;
|
||||
use crate::{Blob, EthSpec, Hash256, SignedRoot, Slot};
|
||||
use crate::{Blob, ChainSpec, Domain, EthSpec, Fork, Hash256, SignedBlobSidecar, SignedRoot, Slot};
|
||||
use bls::SecretKey;
|
||||
use derivative::Derivative;
|
||||
use kzg::{KzgCommitment, KzgProof};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
@@ -76,7 +77,7 @@ impl<T: EthSpec> Ord for BlobSidecar<T> {
|
||||
pub type BlobSidecarList<T> = VariableList<Arc<BlobSidecar<T>>, <T as EthSpec>::MaxBlobsPerBlock>;
|
||||
pub type FixedBlobSidecarList<T> =
|
||||
FixedVector<Option<Arc<BlobSidecar<T>>>, <T as EthSpec>::MaxBlobsPerBlock>;
|
||||
pub type Blobs<T> = VariableList<Blob<T>, <T as EthSpec>::MaxExtraDataBytes>;
|
||||
pub type Blobs<T> = VariableList<Blob<T>, <T as EthSpec>::MaxBlobsPerBlock>;
|
||||
|
||||
impl<T: EthSpec> SignedRoot for BlobSidecar<T> {}
|
||||
|
||||
@@ -97,4 +98,28 @@ impl<T: EthSpec> BlobSidecar<T> {
|
||||
// Fixed part
|
||||
Self::empty().as_ssz_bytes().len()
|
||||
}
|
||||
|
||||
// this is mostly not used except for in testing
|
||||
pub fn sign(
|
||||
self: Arc<Self>,
|
||||
secret_key: &SecretKey,
|
||||
fork: &Fork,
|
||||
genesis_validators_root: Hash256,
|
||||
spec: &ChainSpec,
|
||||
) -> SignedBlobSidecar<T> {
|
||||
let signing_epoch = self.slot.epoch(T::slots_per_epoch());
|
||||
let domain = spec.get_domain(
|
||||
signing_epoch,
|
||||
Domain::BlobSidecar,
|
||||
fork,
|
||||
genesis_validators_root,
|
||||
);
|
||||
let message = self.signing_root(domain);
|
||||
let signature = secret_key.sign(message);
|
||||
|
||||
SignedBlobSidecar {
|
||||
message: self,
|
||||
signature,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ pub type Address = H160;
|
||||
pub type ForkVersion = [u8; 4];
|
||||
pub type BLSFieldElement = Uint256;
|
||||
pub type Blob<T> = FixedVector<u8, <T as EthSpec>::BytesPerBlob>;
|
||||
pub type KzgProofs<T> = VariableList<KzgProof, <T as EthSpec>::MaxBlobsPerBlock>;
|
||||
pub type VersionedHash = Hash256;
|
||||
pub type Hash64 = ethereum_types::H64;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user