-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: give up and make blob oracle for simulation
- Loading branch information
1 parent
de14c32
commit b75a6f7
Showing
15 changed files
with
190 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod blob_public_inputs; | ||
mod blob; | ||
mod mock_blob_oracle; | ||
mod unconstrained_config; | ||
// TODO(#9982): Replace unconstrained_config with config and import ROOTS - calculating ROOTS in unconstrained is insecure. |
23 changes: 23 additions & 0 deletions
23
noir-projects/noir-protocol-circuits/crates/blob/src/mock_blob_oracle.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use crate::blob_public_inputs::{BlobCommitment, BlockBlobPublicInputs}; | ||
use types::{ | ||
abis::sponge_blob::SpongeBlob, | ||
constants::{BLOB_PUBLIC_INPUTS, BLOBS_PER_BLOCK, FIELDS_PER_BLOB}, | ||
}; | ||
// TODO(BLOB_ORACLE): this was added to save simulation time (~1min in ACVM, ~3mins in wasm -> 500ms). | ||
// The use of bignum adds a lot of unconstrained code which overloads limits when simulating. | ||
// If/when simulation times of unconstrained are improved, remove this. | ||
pub unconstrained fn evaluate_blobs( | ||
blobs_as_fields: [Field; FIELDS_PER_BLOB * BLOBS_PER_BLOCK], | ||
kzg_commitments: [BlobCommitment; BLOBS_PER_BLOCK], | ||
mut sponge_blob: SpongeBlob, | ||
) -> BlockBlobPublicInputs { | ||
let fields = evaluate_blobs_oracle(blobs_as_fields, kzg_commitments, sponge_blob); | ||
BlockBlobPublicInputs::deserialize(fields) | ||
} | ||
|
||
#[oracle(evaluateBlobs)] | ||
unconstrained fn evaluate_blobs_oracle( | ||
blobs_as_fields: [Field; FIELDS_PER_BLOB * BLOBS_PER_BLOCK], | ||
kzg_commitments: [BlobCommitment; BLOBS_PER_BLOCK], | ||
mut sponge_blob: SpongeBlob, | ||
) -> [Field; BLOB_PUBLIC_INPUTS * BLOBS_PER_BLOCK] {} |
9 changes: 9 additions & 0 deletions
9
noir-projects/noir-protocol-circuits/crates/rollup-block-root-simulated/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "rollup_block_root_simulated" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.18.0" | ||
|
||
[dependencies] | ||
rollup_lib = { path = "../rollup-lib" } | ||
types = { path = "../types" } |
5 changes: 5 additions & 0 deletions
5
noir-projects/noir-protocol-circuits/crates/rollup-block-root-simulated/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use dep::rollup_lib::block_root::{BlockRootOrBlockMergePublicInputs, BlockRootRollupInputs}; | ||
|
||
unconstrained fn main(inputs: BlockRootRollupInputs) -> pub BlockRootOrBlockMergePublicInputs { | ||
inputs.block_root_rollup_circuit() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.