Replace ssz_encode
with int_to_bytes32
Only in the relevant places I can think of.. I might have missed some.
This commit is contained in:
parent
fc04286ae6
commit
210ec89b0b
@ -5,6 +5,7 @@ authors = ["Paul Hauner <paul@paulhauner.com>"]
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
slot_clock = { path = "../../eth2/utils/slot_clock" }
|
int_to_bytes = { path = "../utils/int_to_bytes" }
|
||||||
ssz = { path = "../../eth2/utils/ssz" }
|
slot_clock = { path = "../utils/slot_clock" }
|
||||||
types = { path = "../../eth2/types" }
|
ssz = { path = "../utils/ssz" }
|
||||||
|
types = { path = "../types" }
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
pub mod test_utils;
|
pub mod test_utils;
|
||||||
mod traits;
|
mod traits;
|
||||||
|
|
||||||
|
use int_to_bytes::int_to_bytes32;
|
||||||
use slot_clock::SlotClock;
|
use slot_clock::SlotClock;
|
||||||
use ssz::ssz_encode;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::{BeaconBlock, ChainSpec, Slot};
|
use types::{BeaconBlock, ChainSpec, Slot};
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ impl<T: SlotClock, U: BeaconNode, V: DutiesReader, W: Signer> BlockProducer<T, U
|
|||||||
fn produce_block(&mut self, slot: Slot) -> Result<PollOutcome, Error> {
|
fn produce_block(&mut self, slot: Slot) -> Result<PollOutcome, Error> {
|
||||||
let randao_reveal = {
|
let randao_reveal = {
|
||||||
// TODO: add domain, etc to this message. Also ensure result matches `into_to_bytes32`.
|
// 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) {
|
match self.signer.sign_randao_reveal(&message) {
|
||||||
None => return Ok(PollOutcome::SignerRejection(slot)),
|
None => return Ok(PollOutcome::SignerRejection(slot)),
|
||||||
|
@ -6,6 +6,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hashing = { path = "../utils/hashing" }
|
hashing = { path = "../utils/hashing" }
|
||||||
|
int_to_bytes = { path = "../utils/int_to_bytes" }
|
||||||
integer-sqrt = "0.1"
|
integer-sqrt = "0.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
ssz = { path = "../utils/ssz" }
|
ssz = { path = "../utils/ssz" }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use crate::SlotProcessingError;
|
use crate::SlotProcessingError;
|
||||||
use hashing::hash;
|
use hashing::hash;
|
||||||
|
use int_to_bytes::int_to_bytes32;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use ssz::{ssz_encode, TreeHash};
|
use ssz::{ssz_encode, TreeHash};
|
||||||
use types::{
|
use types::{
|
||||||
@ -110,7 +111,7 @@ fn per_block_processing_signature_optional(
|
|||||||
ensure!(
|
ensure!(
|
||||||
bls_verify(
|
bls_verify(
|
||||||
&block_proposer.pubkey,
|
&block_proposer.pubkey,
|
||||||
&ssz_encode(&state.current_epoch(spec)),
|
&int_to_bytes32(state.current_epoch(spec).as_u64()),
|
||||||
&block.randao_reveal,
|
&block.randao_reveal,
|
||||||
get_domain(&state.fork, state.current_epoch(spec), DOMAIN_RANDAO)
|
get_domain(&state.fork, state.current_epoch(spec), DOMAIN_RANDAO)
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user