fix blob validation for empty blobs

This commit is contained in:
realbigsean
2022-12-23 12:47:38 -05:00
parent 5db0a88d4f
commit 5e11edc612
13 changed files with 119 additions and 81 deletions

View File

@@ -12,6 +12,14 @@ const KZG_PROOF_BYTES_LEN: usize = 48;
#[ssz(struct_behaviour = "transparent")]
pub struct KzgProof(pub [u8; KZG_PROOF_BYTES_LEN]);
impl KzgProof {
pub fn empty() -> Self {
let mut bytes = [0; KZG_PROOF_BYTES_LEN];
bytes[0] = 192;
Self(bytes)
}
}
impl fmt::Display for KzgProof {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", eth2_serde_utils::hex::encode(self.0))