Remove domain constants from block_processable
The information is gather from the `spec` object, not the constants.
This commit is contained in:
parent
7f1e40a8c6
commit
867dce34cd
@ -5,12 +5,7 @@ use log::{debug, trace};
|
|||||||
use ssz::{ssz_encode, TreeHash};
|
use ssz::{ssz_encode, TreeHash};
|
||||||
use types::*;
|
use types::*;
|
||||||
|
|
||||||
// TODO: define elsehwere.
|
|
||||||
const DOMAIN_PROPOSAL: u64 = 2;
|
|
||||||
const DOMAIN_EXIT: u64 = 3;
|
|
||||||
const DOMAIN_RANDAO: u64 = 4;
|
|
||||||
const PHASE_0_CUSTODY_BIT: bool = false;
|
const PHASE_0_CUSTODY_BIT: bool = false;
|
||||||
const DOMAIN_ATTESTATION: u64 = 1;
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
@ -111,7 +106,7 @@ fn per_block_processing_signature_optional(
|
|||||||
&block_proposer.pubkey,
|
&block_proposer.pubkey,
|
||||||
&block.proposal_root(spec)[..],
|
&block.proposal_root(spec)[..],
|
||||||
&block.signature,
|
&block.signature,
|
||||||
get_domain(&state.fork, state.current_epoch(spec), DOMAIN_PROPOSAL)
|
get_domain(&state.fork, state.current_epoch(spec), spec.domain_proposal)
|
||||||
),
|
),
|
||||||
Error::BadBlockSignature
|
Error::BadBlockSignature
|
||||||
);
|
);
|
||||||
@ -125,7 +120,7 @@ fn per_block_processing_signature_optional(
|
|||||||
&block_proposer.pubkey,
|
&block_proposer.pubkey,
|
||||||
&int_to_bytes32(state.current_epoch(spec).as_u64()),
|
&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), spec.domain_randao)
|
||||||
),
|
),
|
||||||
Error::BadRandaoSignature
|
Error::BadRandaoSignature
|
||||||
);
|
);
|
||||||
@ -186,7 +181,7 @@ fn per_block_processing_signature_optional(
|
|||||||
.proposal_data_1
|
.proposal_data_1
|
||||||
.slot
|
.slot
|
||||||
.epoch(spec.epoch_length),
|
.epoch(spec.epoch_length),
|
||||||
DOMAIN_PROPOSAL
|
spec.domain_proposal
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Error::BadProposerSlashing
|
Error::BadProposerSlashing
|
||||||
@ -202,7 +197,7 @@ fn per_block_processing_signature_optional(
|
|||||||
.proposal_data_2
|
.proposal_data_2
|
||||||
.slot
|
.slot
|
||||||
.epoch(spec.epoch_length),
|
.epoch(spec.epoch_length),
|
||||||
DOMAIN_PROPOSAL
|
spec.domain_proposal
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Error::BadProposerSlashing
|
Error::BadProposerSlashing
|
||||||
@ -294,7 +289,7 @@ fn per_block_processing_signature_optional(
|
|||||||
&validator.pubkey,
|
&validator.pubkey,
|
||||||
&exit_message,
|
&exit_message,
|
||||||
&exit.signature,
|
&exit.signature,
|
||||||
get_domain(&state.fork, exit.epoch, DOMAIN_EXIT)
|
get_domain(&state.fork, exit.epoch, spec.domain_exit)
|
||||||
),
|
),
|
||||||
Error::BadProposerSlashing
|
Error::BadProposerSlashing
|
||||||
);
|
);
|
||||||
@ -401,7 +396,7 @@ fn validate_attestation_signature_optional(
|
|||||||
get_domain(
|
get_domain(
|
||||||
&state.fork,
|
&state.fork,
|
||||||
attestation.data.slot.epoch(spec.epoch_length),
|
attestation.data.slot.epoch(spec.epoch_length),
|
||||||
DOMAIN_ATTESTATION,
|
spec.domain_attestation,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
AttestationValidationError::BadSignature
|
AttestationValidationError::BadSignature
|
||||||
|
Loading…
Reference in New Issue
Block a user