Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

In-circuit blockhash calculation #226

In-circuit blockhash calculation

In-circuit blockhash calculation #226

Triggered via pull request September 8, 2023 13:29
Status Failure
Total duration 22s
Artifacts

openai-review.yml

on: pull_request
OpenAI PR Comment
11s
OpenAI PR Comment
Fit to window
Zoom out
Zoom in

Annotations

2 errors
OpenAI PR Comment
Unable to process file command 'env' successfully.
OpenAI PR Comment
Invalid format 'GIT_PATCH_OUTPUT=From 1a4b55e9d4dc50430ac9a466e930b81f27e4b15b Mon Sep 17 00:00:00 2001 From: Georgios Gkitsas <ggkitsas@yahoo.com> Date: Thu, 10 Aug 2023 22:07:53 +0100 Subject: [PATCH 01/28] saving progress --- Cargo.lock | 5 +- Cargo.toml | 6 +- gadgets/src/less_than.rs | 18 + mock/src/block.rs | 6 +- zkevm-circuits/Cargo.toml | 2 + .../evm_circuit/util/constraint_builder.rs | 47 +- zkevm-circuits/src/pi_circuit.rs | 2214 ++++++++++++++- zkevm-circuits/src/pi_circuit/dev.rs | 15 +- zkevm-circuits/src/pi_circuit/param.rs | 91 +- zkevm-circuits/src/pi_circuit/test.rs | 1040 ++++++- zkevm-circuits/src/super_circuit.rs | 5 +- zkevm-circuits/src/table/block_table.rs | 28 +- zkevm-circuits/src/table/keccak_table.rs | 145 +- zkevm-circuits/src/taiko_pi_circuit.rs | 2386 ++++++++++++++++- zkevm-circuits/src/taiko_super_circuit.rs | 4 +- zkevm-circuits/src/test_util.rs | 51 +- 16 files changed, 5780 insertions(+), 283 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4746e56aa..bacdd56dca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1561,8 +1561,7 @@ dependencies = [ [[package]] name = "ethers-core" version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5925cba515ac18eb5c798ddf6069cc33ae00916cb08ae64194364a1b35c100b" +source = "git+https://github.com/ggkitsas/ethers-rs/?rev=6059806c17fa1a1d7534044bcdbecfef869392e1#6059806c17fa1a1d7534044bcdbecfef869392e1" dependencies = [ "arrayvec", "bytes", @@ -2160,7 +2159,6 @@ dependencies = [ [[package]] name = "halo2_proofs" version = "0.2.0" -source = "git+https://github.com/privacy-scaling-explorations/halo2.git?tag=v2023_04_20#be955686f86eb618f55d2320c0e042485b313d22" dependencies = [ "blake2b_simd", "ff 0.13.0", @@ -5396,6 +5394,7 @@ version = "0.1.0" dependencies = [ "array-init", "bus-mapping", + "bytes", "cli-table", "ctor", "ecc", diff --git a/Cargo.toml b/Cargo.toml index be096fc2fb..f865540c38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,11 @@ members = [ ] [patch.crates-io] -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +# halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +ethers-core = {git = "https://github.com/ggkitsas/ethers-rs/", rev = "6059806c17fa1a1d7534044bcdbecfef869392e1"} + +[patch.'https://github.com/privacy-scaling-explorations/halo2'] +halo2_proofs = { path = "../pse-halo2/halo2_proofs"} # v2023_04_20 # Definition of benchmarks profile to use. [profile.bench] diff --git a/gadgets/src/less_than.rs b/gadgets/src/less_than.rs index 49285951da..4d9fb6e8ca 100644 --- a/gadgets/src/less_than.rs +++ b/gadgets/src/less_than.rs @@ -45,6 +45,24 @@ impl<F: Field, const N_BYTES: usize> LtConfig<F, N_BYTES> { pub fn is_lt(&self, meta: &mut VirtualCells<F>, rotation: Option<Rotation>) -> Expression<F> { meta.query_advice(self.lt, rotation.unwrap_or_else(Rotation::cur)) } + + fn annotations(&self) -> Vec<String> { + [vec![ + String::from("lt"), + String::from("u8"), + ], + (0..N_BYTES).map(|i| String::from(format!("diff byte #{}", i))).collect()].concat() + } + /// Annotates columns of an LtChip embedded within a circuit region. + pub fn annotate_columns_in_region(&self, region: &mut Region<F>) { + let annotations = self.annotations(); + region.name_column(|| &annotations[0], self.lt); + region.name_column(|| &annotations[1], self.u8); + self.diff + .iter() + .zip(self.annotations().iter().skip(2)) + .for_each(|(&col, ann)| region.name_column(|| ann, col)) + } } /// Chip that compares lhs < rhs. diff --git a/mock/src/block.rs b/mock/src/block.rs index 4123312933..8ae3c249c1 100644 --- a/mock/src/block.rs +++ b/mock/src/block.rs @@ -1,7 +1,7 @@ //! Mock Block definition and builder related methods. use crate::{MockTransaction, MOCK_BASEFEE, MOCK_CHAIN_ID, MOCK_DIFFICULTY, MOCK_GASLIMIT}; -use eth_types::{Address, Block, Bytes, Hash, Transaction, Word, H64, U64}; +use eth_types::{Address, Block, Bytes, Hash, Transaction, Word, H256, H64, U64}; use ethers_core::types::{Bloom, OtherFields}; #[