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

Put kernel code in first MemBefore #178

Merged
merged 8 commits into from
Apr 23, 2024
Merged

Conversation

hratoanina
Copy link
Contributor

Add the whole kernel code to the first MemBefore trace of a transaction, so that it doesn't need to be hashed inside the kernel.
This removes around 10k rows of Keccak, at the cost of 60k rows in MemBefore and Memory (the extra rows in Memory will be mitigated in a future PR).
In addition, this solves a critical soundness problem, as the kernel code segment was completely prover-provided up to the hashing in global main, which was allowing completely arbitrary code execution in the kernel.

@github-actions github-actions bot added the crate: evm_arithmetization Anything related to the evm_arithmetization crate. label Apr 22, 2024
Comment on lines 1 to 11
use anyhow::{ensure, Result};
use ethereum_types::{BigEndianHash, U256};
use itertools::Itertools;
use plonky2::field::extension::Extendable;
use plonky2::hash::hash_types::RichField;
use plonky2::plonk::config::GenericConfig;
use plonky2::field::polynomial::PolynomialValues;
use plonky2::fri::oracle::PolynomialBatch;
use plonky2::hash::hash_types::{HashOut, RichField};
use plonky2::hash::merkle_tree::MerkleCap;
use plonky2::plonk::config::{GenericConfig, GenericHashOut};
use plonky2::util::timing::TimingTree;
use plonky2::util::transpose;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs merge with latest feat/continuations

evm_arithmetization/src/verifier.rs Outdated Show resolved Hide resolved
evm_arithmetization/src/verifier.rs Show resolved Hide resolved
Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM overall

evm_arithmetization/src/verifier.rs Outdated Show resolved Hide resolved
evm_arithmetization/src/verifier.rs Outdated Show resolved Hide resolved
evm_arithmetization/src/verifier.rs Outdated Show resolved Hide resolved
evm_arithmetization/src/verifier.rs Outdated Show resolved Hide resolved
evm_arithmetization/src/verifier.rs Outdated Show resolved Hide resolved
evm_arithmetization/src/verifier.rs Outdated Show resolved Hide resolved
@Nashtare Nashtare added this to the zk-continuations - Q2 2024 milestone Apr 23, 2024
@Nashtare Nashtare merged commit ad420f1 into feat/continuations Apr 23, 2024
6 checks passed
@Nashtare Nashtare deleted the kernel_in_membefore branch April 23, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: evm_arithmetization Anything related to the evm_arithmetization crate.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants