mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 03:12:41 +00:00
Update to spec v0.9.1 (#597)
* Update to spec v0.9.0 * Update to v0.9.1 * Bump spec tags for v0.9.1 * Formatting, fix CI failures * Resolve accidental KeyPair merge conflict * Document new BeaconState functions * Fix incorrect cache drops in `advance_caches` * Update fork choice for v0.9.1 * Clean up some FIXMEs * Fix a few docs/logs
This commit is contained in:
@@ -15,7 +15,6 @@ pub struct BlockBuilder<T: EthSpec> {
|
||||
pub num_attestations: usize,
|
||||
pub num_deposits: usize,
|
||||
pub num_exits: usize,
|
||||
pub num_transfers: usize,
|
||||
}
|
||||
|
||||
impl<T: EthSpec> BlockBuilder<T> {
|
||||
@@ -33,7 +32,6 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
num_attestations: 0,
|
||||
num_deposits: 0,
|
||||
num_exits: 0,
|
||||
num_transfers: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +41,6 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
self.num_attestations = T::MaxAttestations::to_usize();
|
||||
self.num_deposits = T::MaxDeposits::to_usize();
|
||||
self.num_exits = T::MaxVoluntaryExits::to_usize();
|
||||
self.num_transfers = T::MaxTransfers::to_usize();
|
||||
}
|
||||
|
||||
pub fn set_slot(&mut self, slot: Slot) {
|
||||
@@ -61,9 +58,7 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
|
||||
builder.set_slot(state.slot);
|
||||
|
||||
let proposer_index = state
|
||||
.get_beacon_proposer_index(state.slot, RelativeEpoch::Current, spec)
|
||||
.unwrap();
|
||||
let proposer_index = state.get_beacon_proposer_index(state.slot, spec).unwrap();
|
||||
|
||||
let proposer_keypair = &keypairs[proposer_index];
|
||||
|
||||
@@ -80,7 +75,7 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
let validator_index = validators_iter.next().expect("Insufficient validators.");
|
||||
|
||||
builder.insert_proposer_slashing(
|
||||
&ProposerSlashingTestTask::Valid,
|
||||
ProposerSlashingTestTask::Valid,
|
||||
validator_index,
|
||||
&keypairs[validator_index as usize].sk,
|
||||
&state.fork,
|
||||
@@ -107,7 +102,7 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
}
|
||||
|
||||
builder.insert_attester_slashing(
|
||||
&AttesterSlashingTestTask::Valid,
|
||||
AttesterSlashingTestTask::Valid,
|
||||
&attesters,
|
||||
&secret_keys,
|
||||
&state.fork,
|
||||
@@ -123,7 +118,7 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
let all_secret_keys: Vec<&SecretKey> = keypairs.iter().map(|keypair| &keypair.sk).collect();
|
||||
builder
|
||||
.insert_attestations(
|
||||
&AttestationTestTask::Valid,
|
||||
AttestationTestTask::Valid,
|
||||
&state,
|
||||
&all_secret_keys,
|
||||
self.num_attestations as usize,
|
||||
@@ -151,7 +146,7 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
let validator_index = validators_iter.next().expect("Insufficient validators.");
|
||||
|
||||
builder.insert_exit(
|
||||
&ExitTestTask::Valid,
|
||||
ExitTestTask::Valid,
|
||||
&mut state,
|
||||
validator_index,
|
||||
&keypairs[validator_index as usize].sk,
|
||||
@@ -163,24 +158,6 @@ impl<T: EthSpec> BlockBuilder<T> {
|
||||
builder.block.body.voluntary_exits.len()
|
||||
);
|
||||
|
||||
// Insert the maximum possible number of `Transfer` objects.
|
||||
for _ in 0..self.num_transfers {
|
||||
let validator_index = validators_iter.next().expect("Insufficient validators.");
|
||||
|
||||
// Manually set the validator to be withdrawn.
|
||||
state.validators[validator_index as usize].withdrawable_epoch = state.previous_epoch();
|
||||
|
||||
builder.insert_transfer(
|
||||
&state,
|
||||
validator_index,
|
||||
validator_index,
|
||||
1,
|
||||
keypairs[validator_index as usize].clone(),
|
||||
spec,
|
||||
);
|
||||
}
|
||||
info!("Inserted {} transfers.", builder.block.body.transfers.len());
|
||||
|
||||
// Set the eth1 data to be different from the state.
|
||||
self.block_builder.block.body.eth1_data.block_hash = Hash256::from_slice(&[42; 32]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user