Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace rust-embed with include_str! #77

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions eip7594/src/trusted_setup.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use bls12_381::{G1Point, G2Point};
use kzg_multi_open::{commit_key::CommitKey, opening_key::OpeningKey};
use rust_embed::Embed;
use serde::Deserialize;

use crate::constants::{FIELD_ELEMENTS_PER_BLOB, FIELD_ELEMENTS_PER_CELL};

#[derive(Embed)]
#[folder = "data"]
struct EmbeddedData;
const TRUSTED_SETUP_JSON: &str = include_str!("../data/trusted_setup_4096.json");

#[derive(Deserialize, Debug, PartialEq, Eq)]
pub struct TrustedSetup {
Expand Down Expand Up @@ -109,14 +106,7 @@ impl TrustedSetup {

/// Loads the official trusted setup file being used on mainnet from the embedded data folder.
fn from_embed() -> TrustedSetup {
const TRUSTED_SETUP_FILE_NAME: &str = "trusted_setup_4096.json";

let file = EmbeddedData::get(TRUSTED_SETUP_FILE_NAME)
.expect("expected the trusted setup file to be embedded in the binary");
let json_str = std::str::from_utf8(file.data.as_ref())
.expect("expected the trusted setup file to be valid utf8");

Self::from_json(json_str)
Self::from_json(TRUSTED_SETUP_JSON)
}
}

Expand Down
Loading