mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Upgrade to v1.4.0-beta.3 (#4862)
## Issue Addressed Makes lighthouse compliant with new kzg changes in https://github.com/ethereum/consensus-specs/releases/tag/v1.4.0-beta.3 ## Proposed Changes 1. Adds new official trusted setup 2. Refactors kzg to match upstream changes in https://github.com/ethereum/c-kzg-4844/pull/377 3. Updates pre-generated `BlobBundle` to work with official trusted setup. ~~Using json here instead of ssz to account for different value of `MaxBlobCommitmentsPerBlock` in minimal and mainnet. By using json, we can just use one pre generated bundle for both minimal and mainnet. Size of 2 separate ssz bundles is approximately equal to one json bundle cc @jimmygchen~~ Dunno what I was doing, ssz works without any issues 4. Stores trusted_setup as just bytes in eth2_network_config so that we don't have kzg dependency in that lib and in lcli. Co-authored-by: realbigsean <seananderson33@gmail.com> Co-authored-by: realbigsean <seananderson33@GMAIL.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
TESTS_TAG := v1.4.0-beta.2-hotfix
|
||||
TESTS_TAG := v1.4.0-beta.3
|
||||
TESTS = general minimal mainnet
|
||||
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ impl<E: EthSpec> Case for KZGBlobToKZGCommitment<E> {
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, _fork_name: ForkName) -> Result<(), Error> {
|
||||
let kzg = get_kzg::<E::Kzg>()?;
|
||||
let kzg = get_kzg()?;
|
||||
|
||||
let commitment = parse_blob::<E>(&self.input.blob).and_then(|blob| {
|
||||
blob_to_kzg_commitment::<E>(&kzg, &blob).map_err(|e| {
|
||||
|
||||
@@ -39,7 +39,7 @@ impl<E: EthSpec> Case for KZGComputeBlobKZGProof<E> {
|
||||
Ok((blob, commitment))
|
||||
};
|
||||
|
||||
let kzg = get_kzg::<E::Kzg>()?;
|
||||
let kzg = get_kzg()?;
|
||||
let proof = parse_input(&self.input).and_then(|(blob, commitment)| {
|
||||
compute_blob_kzg_proof::<E>(&kzg, &blob, commitment)
|
||||
.map_err(|e| Error::InternalError(format!("Failed to compute kzg proof: {:?}", e)))
|
||||
|
||||
@@ -46,7 +46,7 @@ impl<E: EthSpec> Case for KZGComputeKZGProof<E> {
|
||||
Ok((blob, z))
|
||||
};
|
||||
|
||||
let kzg = get_kzg::<E::Kzg>()?;
|
||||
let kzg = get_kzg()?;
|
||||
let proof = parse_input(&self.input).and_then(|(blob, z)| {
|
||||
compute_kzg_proof::<E>(&kzg, &blob, z)
|
||||
.map_err(|e| Error::InternalError(format!("Failed to compute kzg proof: {:?}", e)))
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
use super::*;
|
||||
use crate::case_result::compare_result;
|
||||
use beacon_chain::kzg_utils::validate_blob;
|
||||
use eth2_network_config::get_trusted_setup;
|
||||
use kzg::{Kzg, KzgCommitment, KzgPreset, KzgProof, TrustedSetup};
|
||||
use eth2_network_config::TRUSTED_SETUP_BYTES;
|
||||
use kzg::{Kzg, KzgCommitment, KzgProof, TrustedSetup};
|
||||
use serde::Deserialize;
|
||||
use std::convert::TryInto;
|
||||
use std::marker::PhantomData;
|
||||
use types::Blob;
|
||||
|
||||
pub fn get_kzg<P: KzgPreset>() -> Result<Kzg<P>, Error> {
|
||||
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup::<P>())
|
||||
pub fn get_kzg() -> Result<Kzg, Error> {
|
||||
let trusted_setup: TrustedSetup = serde_json::from_reader(TRUSTED_SETUP_BYTES)
|
||||
.map_err(|e| Error::InternalError(format!("Failed to initialize kzg: {:?}", e)))?;
|
||||
Kzg::new_from_trusted_setup(trusted_setup)
|
||||
.map_err(|e| Error::InternalError(format!("Failed to initialize kzg: {:?}", e)))
|
||||
@@ -89,7 +89,7 @@ impl<E: EthSpec> Case for KZGVerifyBlobKZGProof<E> {
|
||||
Ok((blob, commitment, proof))
|
||||
};
|
||||
|
||||
let kzg = get_kzg::<E::Kzg>()?;
|
||||
let kzg = get_kzg()?;
|
||||
let result = parse_input(&self.input).and_then(|(blob, commitment, proof)| {
|
||||
validate_blob::<E>(&kzg, &blob, commitment, proof)
|
||||
.map_err(|e| Error::InternalError(format!("Failed to validate blob: {:?}", e)))
|
||||
|
||||
@@ -52,7 +52,7 @@ impl<E: EthSpec> Case for KZGVerifyBlobKZGProofBatch<E> {
|
||||
Ok((commitments, blobs, proofs))
|
||||
};
|
||||
|
||||
let kzg = get_kzg::<E::Kzg>()?;
|
||||
let kzg = get_kzg()?;
|
||||
let result = parse_input(&self.input).and_then(|(commitments, blobs, proofs)| {
|
||||
validate_blobs::<E>(&kzg, &commitments, blobs.iter().collect(), &proofs)
|
||||
.map_err(|e| Error::InternalError(format!("Failed to validate blobs: {:?}", e)))
|
||||
|
||||
@@ -42,7 +42,7 @@ impl<E: EthSpec> Case for KZGVerifyKZGProof<E> {
|
||||
Ok((commitment, z, y, proof))
|
||||
};
|
||||
|
||||
let kzg = get_kzg::<E::Kzg>()?;
|
||||
let kzg = get_kzg()?;
|
||||
let result = parse_input(&self.input).and_then(|(commitment, z, y, proof)| {
|
||||
verify_kzg_proof::<E>(&kzg, commitment, proof, z, y)
|
||||
.map_err(|e| Error::InternalError(format!("Failed to validate proof: {:?}", e)))
|
||||
|
||||
Reference in New Issue
Block a user