Skip to content

blanket signed root #7367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions consensus/types/src/aggregate_and_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,3 @@ impl<E: EthSpec> AggregateAndProof<E> {
self.selection_proof().verify(validator_pubkey, message)
}
}

impl<E: EthSpec> SignedRoot for AggregateAndProof<E> {}
impl<E: EthSpec> SignedRoot for AggregateAndProofRef<'_, E> {}
4 changes: 1 addition & 3 deletions consensus/types/src/attestation_data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::test_utils::TestRandom;
use crate::{Checkpoint, Hash256, SignedRoot, Slot};
use crate::{Checkpoint, Hash256, Slot};

use crate::slot_data::SlotData;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -38,8 +38,6 @@ pub struct AttestationData {
pub target: Checkpoint,
}

impl SignedRoot for AttestationData {}

impl SlotData for AttestationData {
fn get_slot(&self) -> Slot {
self.slot
Expand Down
3 changes: 0 additions & 3 deletions consensus/types/src/beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ pub struct BeaconBlock<E: EthSpec, Payload: AbstractExecPayload<E> = FullPayload

pub type BlindedBeaconBlock<E> = BeaconBlock<E, BlindedPayload<E>>;

impl<E: EthSpec, Payload: AbstractExecPayload<E>> SignedRoot for BeaconBlock<E, Payload> {}
impl<E: EthSpec, Payload: AbstractExecPayload<E>> SignedRoot for BeaconBlockRef<'_, E, Payload> {}

/// Empty block trait for each block variant to implement.
pub trait EmptyBlock {
/// Returns an empty block to be used during genesis.
Expand Down
2 changes: 0 additions & 2 deletions consensus/types/src/beacon_block_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub struct BeaconBlockHeader {
pub body_root: Hash256,
}

impl SignedRoot for BeaconBlockHeader {}

impl BeaconBlockHeader {
/// Returns the `tree_hash_root` of the header.
///
Expand Down
2 changes: 0 additions & 2 deletions consensus/types/src/bls_to_execution_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub struct BlsToExecutionChange {
pub to_execution_address: Address,
}

impl SignedRoot for BlsToExecutionChange {}

impl BlsToExecutionChange {
pub fn sign(
self,
Expand Down
2 changes: 0 additions & 2 deletions consensus/types/src/builder_bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ impl<E: EthSpec> ForkVersionDecode for BuilderBid<E> {
}
}

impl<E: EthSpec> SignedRoot for BuilderBid<E> {}

/// Validator registration, for use in interacting with servers implementing the builder API.
#[derive(PartialEq, Debug, Encode, Serialize, Deserialize, Clone)]
#[serde(bound = "E: EthSpec")]
Expand Down
4 changes: 1 addition & 3 deletions consensus/types/src/consolidation_request.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{test_utils::TestRandom, Address, PublicKeyBytes, SignedRoot};
use crate::{test_utils::TestRandom, Address, PublicKeyBytes};
use serde::{Deserialize, Serialize};
use ssz::Encode;
use ssz_derive::{Decode, Encode};
Expand Down Expand Up @@ -37,8 +37,6 @@ impl ConsolidationRequest {
}
}

impl SignedRoot for ConsolidationRequest {}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
4 changes: 1 addition & 3 deletions consensus/types/src/contribution_and_proof.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{
ChainSpec, EthSpec, Fork, Hash256, SecretKey, Signature, SignedRoot, SyncCommitteeContribution,
ChainSpec, EthSpec, Fork, Hash256, SecretKey, Signature, SyncCommitteeContribution,
SyncSelectionProof,
};
use crate::test_utils::TestRandom;
Expand Down Expand Up @@ -68,5 +68,3 @@ impl<E: EthSpec> ContributionAndProof<E> {
}
}
}

impl<E: EthSpec> SignedRoot for ContributionAndProof<E> {}
2 changes: 0 additions & 2 deletions consensus/types/src/deposit_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ pub struct DepositMessage {
pub amount: u64,
}

impl SignedRoot for DepositMessage {}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
4 changes: 1 addition & 3 deletions consensus/types/src/fork_data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::test_utils::TestRandom;
use crate::{Hash256, SignedRoot};
use crate::Hash256;

use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
Expand Down Expand Up @@ -28,8 +28,6 @@ pub struct ForkData {
pub genesis_validators_root: Hash256,
}

impl SignedRoot for ForkData {}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
2 changes: 2 additions & 0 deletions consensus/types/src/signing_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ pub trait SignedRoot: TreeHash {
.tree_hash_root()
}
}

impl<T: TreeHash> SignedRoot for T {}
2 changes: 1 addition & 1 deletion consensus/types/src/slot_epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! may lead to programming errors which are not detected by the compiler.

use crate::test_utils::TestRandom;
use crate::{ChainSpec, SignedRoot};
use crate::ChainSpec;

use rand::RngCore;
use safe_arith::{ArithError, SafeArith};
Expand Down
2 changes: 0 additions & 2 deletions consensus/types/src/slot_epoch_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ macro_rules! impl_ssz {
}
}

impl SignedRoot for $type {}

impl TestRandom for $type {
fn random_for_test(rng: &mut impl RngCore) -> Self {
$type::from(u64::random_for_test(rng))
Expand Down
4 changes: 1 addition & 3 deletions consensus/types/src/sync_aggregator_selection_data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::test_utils::TestRandom;
use crate::{SignedRoot, Slot};
use crate::Slot;

use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
Expand All @@ -25,8 +25,6 @@ pub struct SyncAggregatorSelectionData {
pub subcommittee_index: u64,
}

impl SignedRoot for SyncAggregatorSelectionData {}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
4 changes: 1 addition & 3 deletions consensus/types/src/sync_committee_contribution.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{AggregateSignature, EthSpec, SignedRoot};
use super::{AggregateSignature, EthSpec};
use crate::slot_data::SlotData;
use crate::{test_utils::TestRandom, BitVector, Hash256, Slot, SyncCommitteeMessage};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -75,8 +75,6 @@ impl<E: EthSpec> SyncCommitteeContribution<E> {
}
}

impl SignedRoot for Hash256 {}

/// This is not in the spec, but useful for determining uniqueness of sync committee contributions
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
pub struct SyncContributionData {
Expand Down
2 changes: 0 additions & 2 deletions consensus/types/src/validator_registration_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ pub struct ValidatorRegistrationData {
pub pubkey: PublicKeyBytes,
}

impl SignedRoot for ValidatorRegistrationData {}

impl SignedValidatorRegistrationData {
pub fn verify_signature(&self, spec: &ChainSpec) -> bool {
self.message
Expand Down
2 changes: 0 additions & 2 deletions consensus/types/src/voluntary_exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ pub struct VoluntaryExit {
pub validator_index: u64,
}

impl SignedRoot for VoluntaryExit {}

impl VoluntaryExit {
pub fn sign(
self,
Expand Down