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

Evm can run with SpecId::Cancun hardfork without KZG point evaluation precompile #1283

Open
Wodann opened this issue Apr 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Wodann
Copy link
Contributor

Wodann commented Apr 9, 2024

The addition of the KZG point evaluation precompile to the list of precompiles is hidden behind the c-kzg feature flag:

    /// Returns precompiles for Cancun spec.
    ///
    /// If the `c-kzg` feature is not enabled KZG Point Evaluation precompile will not be included,
    /// effectively making this the same as Berlin.
    pub fn cancun() -> &'static Self {
        static INSTANCE: OnceBox<Precompiles> = OnceBox::new();
        INSTANCE.get_or_init(|| {
            let precompiles = Self::berlin().clone();

            // Don't include KZG point evaluation precompile in no_std builds.
            #[cfg(feature = "c-kzg")]
            let precompiles = {
                let mut precompiles = precompiles;
                precompiles.extend([
                    // EIP-4844: Shard Blob Transactions
                    kzg_point_evaluation::POINT_EVALUATION,
                ]);
                precompiles
            };

            Box::new(precompiles)
        })
    }

This resulted in silent failures when running EIP-4844 transactions on an Evm with SpecId::CANCUN. Instead, I would have expected it to be forbidden to run revm with SpecId::CANCUN if the c-kzg feature flag was missing.

@rakita
Copy link
Member

rakita commented Apr 10, 2024

This would mean no wasm support for revm Cancun, even if not all TX are using this precompile.

I didn't success in compaling c-kzg for no std platforms, and there is no alternative (afaik) in rust that we can switch to (similar what we have done with k256 and secp256k1 libs)

@rakita
Copy link
Member

rakita commented Apr 29, 2024

It seems there is an alternative in rust: https://github.com/grandinetech/rust-kzg/tree/main/kzg

worth investigating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants