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:
Michael Sproul
2019-11-21 11:47:30 +11:00
committed by GitHub
parent b7a0feb725
commit 24e941d175
105 changed files with 1211 additions and 2940 deletions

View File

@@ -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]);