mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 19:32:55 +00:00
Merge branch 'unstable' of https://github.com/sigp/lighthouse into electra_attestation_changes
This commit is contained in:
@@ -6,10 +6,7 @@ use crate::{
|
||||
use crate::{KzgProofs, SignedBeaconBlock};
|
||||
use bls::Signature;
|
||||
use derivative::Derivative;
|
||||
use kzg::{
|
||||
Blob as KzgBlob, Kzg, KzgCommitment, KzgProof, BYTES_PER_BLOB, BYTES_PER_FIELD_ELEMENT,
|
||||
FIELD_ELEMENTS_PER_BLOB,
|
||||
};
|
||||
use kzg::{Blob as KzgBlob, Kzg, KzgCommitment, KzgProof, BYTES_PER_BLOB, BYTES_PER_FIELD_ELEMENT};
|
||||
use merkle_proof::{merkle_root_from_branch, verify_merkle_proof, MerkleTreeError};
|
||||
use rand::Rng;
|
||||
use safe_arith::ArithError;
|
||||
@@ -221,13 +218,7 @@ impl<E: EthSpec> BlobSidecar<E> {
|
||||
rng.fill_bytes(&mut blob_bytes);
|
||||
// Ensure that the blob is canonical by ensuring that
|
||||
// each field element contained in the blob is < BLS_MODULUS
|
||||
for i in 0..FIELD_ELEMENTS_PER_BLOB {
|
||||
let Some(byte) = blob_bytes.get_mut(
|
||||
i.checked_mul(BYTES_PER_FIELD_ELEMENT)
|
||||
.ok_or("overflow".to_string())?,
|
||||
) else {
|
||||
return Err(format!("blob byte index out of bounds: {:?}", i));
|
||||
};
|
||||
for byte in blob_bytes.iter_mut().step_by(BYTES_PER_FIELD_ELEMENT) {
|
||||
*byte = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ impl From<[u8; GRAFFITI_BYTES_LEN]> for Graffiti {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<[u8; GRAFFITI_BYTES_LEN]> for Graffiti {
|
||||
fn into(self) -> [u8; GRAFFITI_BYTES_LEN] {
|
||||
self.0
|
||||
impl From<Graffiti> for [u8; GRAFFITI_BYTES_LEN] {
|
||||
fn from(from: Graffiti) -> [u8; GRAFFITI_BYTES_LEN] {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +77,9 @@ impl<'de> Deserialize<'de> for GraffitiString {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<Graffiti> for GraffitiString {
|
||||
fn into(self) -> Graffiti {
|
||||
let graffiti_bytes = self.0.as_bytes();
|
||||
impl From<GraffitiString> for Graffiti {
|
||||
fn from(from: GraffitiString) -> Graffiti {
|
||||
let graffiti_bytes = from.0.as_bytes();
|
||||
let mut graffiti = [0; GRAFFITI_BYTES_LEN];
|
||||
|
||||
let graffiti_len = std::cmp::min(graffiti_bytes.len(), GRAFFITI_BYTES_LEN);
|
||||
|
||||
@@ -77,9 +77,9 @@ impl SelectionProof {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<Signature> for SelectionProof {
|
||||
fn into(self) -> Signature {
|
||||
self.0
|
||||
impl From<SelectionProof> for Signature {
|
||||
fn from(from: SelectionProof) -> Signature {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ macro_rules! impl_from_into_u64 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u64> for $main {
|
||||
fn into(self) -> u64 {
|
||||
self.0
|
||||
impl From<$main> for u64 {
|
||||
fn from(from: $main) -> u64 {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ macro_rules! impl_from_into_usize {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<usize> for $main {
|
||||
fn into(self) -> usize {
|
||||
self.0 as usize
|
||||
impl From<$main> for usize {
|
||||
fn from(from: $main) -> usize {
|
||||
from.0 as usize
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,15 +152,15 @@ impl From<u64> for SubnetId {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u64> for SubnetId {
|
||||
fn into(self) -> u64 {
|
||||
self.0
|
||||
impl From<SubnetId> for u64 {
|
||||
fn from(from: SubnetId) -> u64 {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u64> for &SubnetId {
|
||||
fn into(self) -> u64 {
|
||||
self.0
|
||||
impl From<&SubnetId> for u64 {
|
||||
fn from(from: &SubnetId) -> u64 {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,9 +90,9 @@ impl SyncSelectionProof {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<Signature> for SyncSelectionProof {
|
||||
fn into(self) -> Signature {
|
||||
self.0
|
||||
impl From<SyncSelectionProof> for Signature {
|
||||
fn from(from: SyncSelectionProof) -> Signature {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,15 +78,15 @@ impl From<u64> for SyncSubnetId {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u64> for SyncSubnetId {
|
||||
fn into(self) -> u64 {
|
||||
self.0
|
||||
impl From<SyncSubnetId> for u64 {
|
||||
fn from(from: SyncSubnetId) -> u64 {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u64> for &SyncSubnetId {
|
||||
fn into(self) -> u64 {
|
||||
self.0
|
||||
impl From<&SyncSubnetId> for u64 {
|
||||
fn from(from: &SyncSubnetId) -> u64 {
|
||||
from.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user