taikoxyz / raiko

Multi-proofs for Taiko. SNARKS, STARKS and Trusted Execution Enclave. Our previous ZK-EVM circuits are deprecated.
Apache License 2.0
96 stars 75 forks source link

fix: revm bn254 mul issue + cancun support + misc issues #222

Closed Brechtpd closed 1 month ago

Brechtpd commented 1 month ago

Some fixes:

  1. Our revm incorrectly set the bn 254 mul precompiles in revm which made them not work correctly, it seems this was introduced only sometime last week when switching to the feat/zk-op revm branch. This is now fixed in the v35_taiko_v2 branch: https://github.com/taikoxyz/revm/commit/ec20417a94bd9b6092c6d5c205c1b68f5851b7e8
  2. Cancun support did not always work correctly because the point precompile is only enabled for cancun when the c-kzg feature is enabled, so each block containing a call to this precompile would not work correctly. For cancun support in non-native provers we will also have to make sure that KzgProof::verify_kzg_proof (https://github.com/taikoxyz/revm/blob/a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3/crates/precompile/src/kzg_point_evaluation.rs#L73) works correctly without file IO. I haven't tested it yet, but I think it should be okay because revm also avoids using file io to load in the trusted setup data: https://github.com/taikoxyz/revm/blob/a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3/crates/primitives/src/kzg/env_settings.rs#L51. In any case, Taiko doesn't support cancun yet so we don't really need this to work for all provers yet.
  3. Fixes MPT issue introduced in https://github.com/taikoxyz/raiko/pull/213: https://github.com/taikoxyz/raiko/pull/222/commits/59dc5fdadc18b72b80defd93abb11cddb44b11b5
  4. Added check that the passed in chain spec is correct when a known chain id is used: https://github.com/taikoxyz/raiko/pull/222/commits/c1cbfb88c12a930779ad1252a45de4e4f9bb9885
  5. Switched to a "paid" beacon api RPC node so that the tests can run again

Issues 1/2 can be triggered in ethereum block 19899808 at tx 65, so that block can be used for testing.

CeciliaZ030 commented 1 month ago

Should we start doing PR in revm main instead of using branches?

Brechtpd commented 1 month ago

The difficulties of having different repos. We should do PRs but not sure what mechanism would be best. Maybe we should do PRs to the main branch on revm side and use specific revs on the raiko side, each revm update also requires a PR in raiko to update the revs which I guess is fine.