From b29934aed4828448b37b43f8d6c3d2d0b1a153c8 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 24 Jan 2019 12:10:03 +1100 Subject: [PATCH] Update state transition as per spec --- beacon_node/beacon_chain/src/block_production.rs | 8 ++++++-- beacon_node/beacon_chain/src/state_transition.rs | 9 ++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/beacon_node/beacon_chain/src/block_production.rs b/beacon_node/beacon_chain/src/block_production.rs index f6219fc87..50524410f 100644 --- a/beacon_node/beacon_chain/src/block_production.rs +++ b/beacon_node/beacon_chain/src/block_production.rs @@ -4,7 +4,7 @@ use bls::Signature; use slot_clock::TestingSlotClockError; use types::{ readers::{BeaconBlockReader, BeaconStateReader}, - BeaconBlock, BeaconBlockBody, BeaconState, Hash256, + BeaconBlock, BeaconBlockBody, BeaconState, Eth1Data, Hash256, }; #[derive(Debug, PartialEq)] @@ -46,7 +46,11 @@ where parent_root, state_root: Hash256::zero(), // Updated after the state is calculated. randao_reveal: randao_reveal, - candidate_pow_receipt_root: Hash256::zero(), // TODO: replace w/ eth1 data. + eth1_data: Eth1Data { + // TODO: replace with real data + deposit_root: Hash256::zero(), + block_hash: Hash256::zero(), + }, signature: self.spec.empty_signature.clone(), // To be completed by a validator. body: BeaconBlockBody { proposer_slashings: vec![], diff --git a/beacon_node/beacon_chain/src/state_transition.rs b/beacon_node/beacon_chain/src/state_transition.rs index afa805a23..4a41d6f2c 100644 --- a/beacon_node/beacon_chain/src/state_transition.rs +++ b/beacon_node/beacon_chain/src/state_transition.rs @@ -4,9 +4,8 @@ use boolean_bitfield::BooleanBitfield; use slot_clock::{SystemTimeSlotClockError, TestingSlotClockError}; use ssz::ssz_encode; use types::{ - readers::{BeaconBlockReader, BeaconStateReader}, - AttestationData, AttestationDataAndCustodyBit, BeaconBlock, BeaconState, Exit, ForkData, - Hash256, PendingAttestationRecord, ProposalSignedData, + readers::BeaconBlockReader, AttestationData, AttestationDataAndCustodyBit, BeaconBlock, + BeaconState, Exit, Fork, Hash256, PendingAttestation, ProposalSignedData, }; // TODO: define elsehwere. @@ -283,7 +282,7 @@ where attestation.data.shard_block_root == self.spec.zero_hash, Error::BadAttestation ); - let pending_attestation = PendingAttestationRecord { + let pending_attestation = PendingAttestation { data: attestation.data.clone(), aggregation_bitfield: attestation.aggregation_bitfield.clone(), custody_bitfield: attestation.custody_bitfield.clone(), @@ -426,7 +425,7 @@ fn hash(_input: &T) -> Hash256 { Hash256::zero() } -fn get_domain(_fork: &ForkData, _slot: u64, _domain_type: u64) -> u64 { +fn get_domain(_fork: &Fork, _slot: u64, _domain_type: u64) -> u64 { // TODO: stubbed out. 0 }