revm_primitives/
kzg.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
cfg_if::cfg_if! {
    if #[cfg(feature = "c-kzg")] {
        pub use c_kzg::KzgSettings;
        /// KZG Settings that allow us to specify a custom trusted setup.
        /// or use hardcoded default settings.
        #[derive(Debug, Clone, Default, PartialEq, Eq )]
        pub enum EnvKzgSettings {
            /// Default mainnet trusted setup
            #[default]
            Default,
            /// Custom trusted setup.
            Custom(std::sync::Arc<c_kzg::KzgSettings>),
        }

        impl EnvKzgSettings {
            /// Return set KZG settings.
            ///
            /// In will initialize the default settings if it is not already loaded.
            pub fn get(&self) -> &c_kzg::KzgSettings {
                match self {
                    Self::Default => {
                        c_kzg::ethereum_kzg_settings()
                    }
                    Self::Custom(settings) => settings,
                }
            }
        }
    } else if #[cfg(feature = "kzg-rs")] {
        pub use kzg_rs::{KzgSettings,EnvKzgSettings};
    }
}