Update engine_api to latest version (#4223)

* Update Engine API to Latest

* Get Mock EE Working

* Fix Mock EE

* Update Engine API Again

* Rip out get_blobs_bundle Stuff

* Fix Test Harness

* Fix Clippy Complaints

* Fix Beacon Chain Tests
This commit is contained in:
ethDreamer
2023-04-27 13:18:21 -05:00
committed by GitHub
parent aa34339298
commit c1d47da02d
24 changed files with 449 additions and 159 deletions

View File

@@ -1,18 +1,29 @@
use c_kzg::{Bytes48, BYTES_PER_COMMITMENT};
use derivative::Derivative;
use eth2_hashing::hash_fixed;
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use ssz_derive::{Decode, Encode};
use std::fmt;
use std::fmt::{Debug, Display, Formatter};
use std::str::FromStr;
use tree_hash::{PackedEncoding, TreeHash};
use tree_hash::{Hash256, PackedEncoding, TreeHash};
pub const BLOB_COMMITMENT_VERSION_KZG: u8 = 0x01;
#[derive(Derivative, Clone, Copy, Encode, Decode)]
#[derivative(PartialEq, Eq, Hash)]
#[ssz(struct_behaviour = "transparent")]
pub struct KzgCommitment(pub [u8; BYTES_PER_COMMITMENT]);
impl KzgCommitment {
pub fn calculate_versioned_hash(&self) -> Hash256 {
let mut versioned_hash = hash_fixed(&self.0);
versioned_hash[0] = BLOB_COMMITMENT_VERSION_KZG;
Hash256::from_slice(versioned_hash.as_slice())
}
}
impl From<KzgCommitment> for Bytes48 {
fn from(value: KzgCommitment) -> Self {
value.0.into()

View File

@@ -20,6 +20,7 @@ pub enum Error {
}
/// A wrapper over a kzg library that holds the trusted setup parameters.
#[derive(Debug)]
pub struct Kzg {
trusted_setup: KzgSettings,
}