mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Adding a #[signed_root(skip_hashing)] macro
Lets the user annotate fields of a struct to skip for signed root hashing. Also added tests in a `eth2/utils/tests` crate, so that we can test whether these derived macros work as intended.
This commit is contained in:
@@ -25,6 +25,7 @@ pub struct Attestation {
|
||||
pub aggregation_bitfield: Bitfield,
|
||||
pub data: AttestationData,
|
||||
pub custody_bitfield: Bitfield,
|
||||
#[signed_root(skip_hashing)]
|
||||
pub aggregate_signature: AggregateSignature,
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ pub struct BeaconBlock {
|
||||
pub previous_block_root: Hash256,
|
||||
pub state_root: Hash256,
|
||||
pub body: BeaconBlockBody,
|
||||
#[signed_root(skip_hashing)]
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ pub struct BeaconBlockHeader {
|
||||
pub previous_block_root: Hash256,
|
||||
pub state_root: Hash256,
|
||||
pub block_body_root: Hash256,
|
||||
#[signed_root(skip_hashing)]
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ use test_random_derive::TestRandom;
|
||||
pub struct DepositInput {
|
||||
pub pubkey: PublicKey,
|
||||
pub withdrawal_credentials: Hash256,
|
||||
#[signed_root(skip_hashing)]
|
||||
pub proof_of_possession: Signature,
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ pub struct SlashableAttestation {
|
||||
pub validator_indices: Vec<u64>,
|
||||
pub data: AttestationData,
|
||||
pub custody_bitfield: Bitfield,
|
||||
#[signed_root(skip_hashing)]
|
||||
pub aggregate_signature: AggregateSignature,
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ pub struct Transfer {
|
||||
pub slot: Slot,
|
||||
pub pubkey: PublicKey,
|
||||
#[derivative(Hash = "ignore")]
|
||||
#[signed_root(skip_hashing)]
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ use test_random_derive::TestRandom;
|
||||
pub struct VoluntaryExit {
|
||||
pub epoch: Epoch,
|
||||
pub validator_index: u64,
|
||||
#[signed_root(skip_hashing)]
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user