diff --git a/eth2/block_producer/Cargo.toml b/eth2/block_producer/Cargo.toml index 86dde92f7..15d1343cc 100644 --- a/eth2/block_producer/Cargo.toml +++ b/eth2/block_producer/Cargo.toml @@ -5,6 +5,7 @@ authors = ["Paul Hauner "] edition = "2018" [dependencies] -slot_clock = { path = "../../eth2/utils/slot_clock" } -ssz = { path = "../../eth2/utils/ssz" } -types = { path = "../../eth2/types" } +int_to_bytes = { path = "../utils/int_to_bytes" } +slot_clock = { path = "../utils/slot_clock" } +ssz = { path = "../utils/ssz" } +types = { path = "../types" } diff --git a/eth2/block_producer/src/lib.rs b/eth2/block_producer/src/lib.rs index f6a0fd6df..7b15eb4e9 100644 --- a/eth2/block_producer/src/lib.rs +++ b/eth2/block_producer/src/lib.rs @@ -1,8 +1,8 @@ pub mod test_utils; mod traits; +use int_to_bytes::int_to_bytes32; use slot_clock::SlotClock; -use ssz::ssz_encode; use std::sync::Arc; use types::{BeaconBlock, ChainSpec, Slot}; @@ -132,7 +132,7 @@ impl BlockProducer Result { let randao_reveal = { // TODO: add domain, etc to this message. Also ensure result matches `into_to_bytes32`. - let message = ssz_encode(&slot.epoch(self.spec.epoch_length)); + let message = int_to_bytes32(slot.epoch(self.spec.epoch_length).as_u64()); match self.signer.sign_randao_reveal(&message) { None => return Ok(PollOutcome::SignerRejection(slot)), diff --git a/eth2/state_processing/Cargo.toml b/eth2/state_processing/Cargo.toml index 683475f47..b6b0ea57c 100644 --- a/eth2/state_processing/Cargo.toml +++ b/eth2/state_processing/Cargo.toml @@ -6,6 +6,7 @@ edition = "2018" [dependencies] hashing = { path = "../utils/hashing" } +int_to_bytes = { path = "../utils/int_to_bytes" } integer-sqrt = "0.1" log = "0.4" ssz = { path = "../utils/ssz" } diff --git a/eth2/state_processing/src/block_processable.rs b/eth2/state_processing/src/block_processable.rs index f043a723d..368460116 100644 --- a/eth2/state_processing/src/block_processable.rs +++ b/eth2/state_processing/src/block_processable.rs @@ -1,5 +1,6 @@ use crate::SlotProcessingError; use hashing::hash; +use int_to_bytes::int_to_bytes32; use log::debug; use ssz::{ssz_encode, TreeHash}; use types::{ @@ -110,7 +111,7 @@ fn per_block_processing_signature_optional( ensure!( bls_verify( &block_proposer.pubkey, - &ssz_encode(&state.current_epoch(spec)), + &int_to_bytes32(state.current_epoch(spec).as_u64()), &block.randao_reveal, get_domain(&state.fork, state.current_epoch(spec), DOMAIN_RANDAO) ),