[one-shot implementation for discussion, not for merging]: BLS support#1
[one-shot implementation for discussion, not for merging]: BLS support#1jtcoolen wants to merge 21 commits intoEYBlockchain:mainfrom
Conversation
Align generated verifier source with Solidity 0.8.30 in the EVM codegen template. - Change the emitted contract pragma in SolidityAssemblyCode from 0.8.19 to 0.8.30.
Adjust local EVM execution helpers so oversized verifier contracts can be deployed and profiled in simulation. - Add serde_json dependency used by EVM utility flows. - Silence non-critical solc stderr output during bytecode compilation. - Relax revm code-size and gas-limit constraints in deploy_and_call for high-bytecode verifier benchmarks.
…ally Vendor the halo2-lib workspace under vendor/halo2-lib and route both axiom-crypto and jtcoolen halo2-lib sources to local halo2-base/halo2-ecc paths. This commit keeps the raw upstream snapshot state before applying the halo2-base BLS patches.
Apply upstream halo2-base commit 360a9d3 to the vendored tree so blsFr implements ScalarField in utils::scalar_field_impls.
Apply upstream halo2-base commit f56347d after 360a9d3, including 6-limb blsFq ScalarField support and halo2curves revision pinning in the vendored halo2-lib metadata.
Preserve the local vendored fix by reconstructing from little-endian bytes instead of assuming a [u64;4] representation.
Refresh Cargo.lock so halo2-base/halo2-ecc and halo2curves-axiom resolve to the pinned fork revisions deterministically.
Vendor halo2-base sources from jtcoolen/halo2-lib@f56347d without local modifications for reproducible builds.
Replace the hardcoded [u64;4] conversion with byte-based reconstruction so wider scalar fields are handled safely.
Migrate SDK proving/verifying type aliases and generic bounds from Bn256 to Bls12 across halo2 and EVM entry points.
Generalize EVM loader point encoding for wider base fields and update transcript IO sizing to distinguish proof-byte and EVM-memory representations.
Serialize G2 points as eight 32-byte words and update the EVM pairing call interface to consume the expanded layout.
Switch generated runtime precompile identifiers and calldata/returndata sizing to BLS12-381 G1/G2 operation layouts.
Use Prague EIP-2537 precompile addresses for BLS12-381 add, MSM, and pairing operations.
Remove the temporary legacy c1,c0 env-toggle path and keep a single canonical ordering for EVM pairing inputs.
Adjust limb decomposition parameters for BLS12-381 base-field arithmetic compatibility in halo2-ecc.
Align pinned toolchain with revm/alloy dependency MSRV requirements used by the BLS runtime path.
Update local EVM execution config/error reporting for Prague precompiles and tighten transcript runtime handling for allocated scalar/ec-point memory layout.
Update Cargo.lock to match runtime dependency/resolution changes introduced by the Prague revm hardening and toolchain alignment.
Capture solc stderr and include actionable diagnostics when bytecode generation fails or emits no output.
Keep the original arithmetization gate shape while moving the example flow to BLS12-381 params and EVM artifact generation/verification.
| // SPDX-License-Identifier: MIT | ||
|
|
||
| pragma solidity 0.8.19; | ||
| pragma solidity 0.8.30; |
There was a problem hiding this comment.
TODO we may want to relax the constraint on the solidity version
| impl_scalar_field!(secpFp); | ||
| impl_scalar_field!(secpFq); | ||
| impl_scalar_field!(blsFr); | ||
| //impl_scalar_field!(blsFq); |
There was a problem hiding this comment.
| //impl_scalar_field!(blsFq); |
| @@ -32,14 +32,13 @@ pub trait BigPrimeField: ScalarField { | |||
| #[cfg(feature = "halo2-axiom")] | |||
There was a problem hiding this comment.
TODO: make a PR in https://github.com/EYBlockchain/halo2-lib instead of vendoring the library in the previous commit
|
|
||
| // create halo2loader | ||
| let fp_chip = FpChip::<Fr>::new(range, BITS, LIMBS); | ||
| let fp_chip = FpChip::<Fr, Fq>::new(range, BITS, LIMBS); |
There was a problem hiding this comment.
the import moved from bn254::FpChip, an alias for the generic fields::fp::FpChip specialised to BN254, hence the extra emulated prime field modulus for the base field Fq (besides the scalar field Fr)
| let success := true | ||
| let f_p := {base_modulus} | ||
| let f_q := {scalar_modulus} | ||
| function validate_ec_point(x, y) -> valid {{ |
There was a problem hiding this comment.
TODO: check that we can drop the is on-curve checks. The BLS precompiles https://eips.ethereum.org/EIPS/eip-2537#abi-for-operations check that "An input is neither a point on the G1 (resp. G2) elliptic curve nor the infinity point", so in order to drop the checks we should ensure every EC point is passed to a BLS precompile
| let ptr = self.allocate(BLS_G1_BYTES); | ||
| let mut code = String::new(); | ||
| let x_ptr = ptr; | ||
| code.push_str("let x_lo := 0\n"); |
There was a problem hiding this comment.
Constructs 64-byte BLS coordinate for the BLS precompiles from circuit limbs (BITS=128, LIMBS=3).
EIP-2537 precompile calldata expects each coordinate as a 64-byte big-endian field element (left-padded, 64 bytes = 512 bits).
| let y_ptr = ptr + BLS_ENCODED_FP_BYTES; | ||
| code.push_str("let y_lo := 0\n"); | ||
| code.push_str("let y_hi := 0\n"); | ||
| for (idx, limb) in y_limbs.iter().enumerate() { |
There was a problem hiding this comment.
Same thing for the y-coordinates limb to BLS precompile coordinate encoding
|
|
||
| const BLS_ENCODED_FP_BYTES: usize = 64; | ||
|
|
||
| fn le_component_to_padded_words(component_le: &[u8]) -> [U256; 2] { |
There was a problem hiding this comment.
Each Fp component of the Fp^2 coordinates is now padded to 64 bytes and split into hi + lo 32-byte words
| Bn254Add = 0x6, | ||
| Bn254ScalarMul = 0x7, | ||
| Bn254Pairing = 0x8, | ||
| Bls12_381G1Add = 0x0a, |
There was a problem hiding this comment.
use EIP-2537 addresses (0x0b/0x0c/0x0f)
Do we need G2Add/G2Mul/G2Msm?
| Bls12_381G1Add = 0x0a, | ||
| Bls12_381G1Msm = 0x0b, | ||
| Bls12_381Pairing = 0x0e, | ||
| // EIP-2537 (Prague): BLS12-381 precompile addresses. |
There was a problem hiding this comment.
merge this into the previous commit
| let x_mid = x.len() / 2; | ||
| let y_mid = y.len() / 2; | ||
| [&x[x_mid..], &x[..x_mid], &y[y_mid..], &y[..y_mid]] | ||
| // EIP-2537 expects Fp2 coordinates in (c0, c1) order. |
There was a problem hiding this comment.
move this change to previous commit modifying the g2_to_words function
| pub const BITS: usize = 64; | ||
| // For BLS12-381 base field arithmetic over Fr in halo2-ecc, limb bits must satisfy: | ||
| // BITS + Fr::NUM_BITS - Fq::NUM_BITS - 2 >= 0. With Fr=255 and Fq=381 this means BITS >= 128. | ||
| pub const LIMBS: usize = 3; |
There was a problem hiding this comment.
move this commit earlier in the git commit history
| @@ -1 +1 @@ | |||
| 1.85.1 | |||
| 1.88.0 | |||
There was a problem hiding this comment.
Do we need to bump the rust version to gain access to BLS precompiles with revm?
| // Verify generated constants: https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/bn256/mod.rs#L65 | ||
| // We use the same ones Scroll uses for security: https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/Bls12/fp.rs | ||
| // Verify generated constants: https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/Bls12/mod.rs#L65 | ||
| const T: usize = 3; |
There was a problem hiding this comment.
| const T: usize = 3; | |
| const T: usize = 3; // Poseidon state width |
| const RATE: usize = 2; | ||
| const R_F: usize = 8; // https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/p128pow5t3.rs#L26 | ||
| const R_P: usize = 57; // https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/bn256/mod.rs#L8 | ||
| const R_P: usize = 57; // https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/Bls12/mod.rs#L8 |
There was a problem hiding this comment.
Update Poseidon parameters for BLS see https://github.com/EYBlockchain/midfall/blob/main/circuits/src/hash/poseidon/constants/mod.rs#L16
| const R_P: usize = 57; // https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/Bls12/mod.rs#L8 | |
| const R_P: usize = 60; // <change to valid hyperlink> |
| // Poseidon parameters | ||
| // We use the same ones Scroll uses for security: https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/bn256/fp.rs | ||
| // Verify generated constants: https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/bn256/mod.rs#L65 | ||
| // We use the same ones Scroll uses for security: https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/Bls12/fp.rs |
| const R_F: usize = 8; // https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/p128pow5t3.rs#L26 | ||
| const R_P: usize = 57; // https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/bn256/mod.rs#L8 | ||
| const R_P: usize = 57; // https://github.com/scroll-tech/poseidon-circuit/blob/714f50c7572a4ff6f2b1fa51a9604a99cd7b6c71/src/poseidon/primitives/Bls12/mod.rs#L8 | ||
| const SECURE_MDS: usize = 0; |
There was a problem hiding this comment.
uses the first sampled secure MDS candidate matrix, see https://github.com/jtcoolen/snark-verifier/blob/bls-support/vendor/halo2-base/src/poseidon/hasher/spec.rs#L44
| const SECURE_MDS: usize = 0; | |
| const SECURE_MDS: usize = 0; // uses the first generated secure MDS (Maximum Distance Separable) candidate matrix |
| evm.cfg.limit_contract_initcode_size = Some(usize::MAX); // also set this | ||
|
|
||
| // avoid tx gas-limit > block gas-limit validation | ||
| evm.block.gas_limit = u64::MAX; |
There was a problem hiding this comment.
TODO: support smart contract sharding
| @@ -0,0 +1 @@ | |||
| 0x6080604052348015600e575f5ffd5b506125f68061001c5f395ff3fe608060405234801561000f575f5ffd5b505f36606060405160808114610023575f5ffd5b60017f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff000000016f139b631597bdbd49196d2d62d20197da610220527f11982b3d62098ec59d15d70db4098e242b7ed05e4c09ea953a2ac011d1b72daa610240526f038c336ac9259157371685785e5bdf2d610260527ff54cd5d306c2f08a613302407081d2cec0ceb97c64a769f9cc968c9179381cac610280526f06b2686b6361752794eff6d9f11c86126102a0527faa891fb290d5962c164082ed247caea7504c9c3aa2ac2318046c1e757cd6c6826102c0526f04f3fd07bc9831148c998d9e3b70e0266102e0527f39c70ef9b620b060f0ff724a15a609bf34c25e70df9eaf35a815f7d5950985f8610300526f0b38e07d75fd1740470f505d279cea3e610320527fdf21a9d4c77102c751c226bf2cbaea428bf543639fe7078341df6aca50382572610340526f0bde9c0a9037d7be4141dae01bd71a28610360527f95918cfecfa199843bb40d0ca2286c5ae4ae3d72c0b07176c348aab20075587f610380526f0c466608a4603295f7e63265064dbd0c6103a0527fb6f4fa032bec91c5e4d5a18d26cd7bc718cf16fd721379cfed00a60e88d1c2106103c0526f042962c1ec7417dddb1c0acdc2d5fa216103e0527f0d7009e362b2561d2191a5e19ccd539ba7741cf0ba3575e614d8cb7b6d35ce53610400526f0321ecc8b4cd35eed10899b0853b1f38610420527f220ab5ea4a46fc10db042a5522b175082b858b2d95a8e5d97960156e88a72278610440526f069cd236ee42ef64c16ce18300d62757610460527fed2462e41a2cf08ee6bf04dc0a73d7784870833bdcfdaaa09015f32ce1f1137f610480526f0bf6ee4f45dee3fbaae5650ea30a5c156104a0527f079d01637901bfb2a61af62c5a0ae36e55e577de19551835329629c642c7d2ce6104c0526f061bc0e90ea25657ed5ad20652c614c96104e0527f1deaeb897e49f9760256b5e711b8c8baae1fb635733443efc13947ea86b211c7610500526f0239f14edc813f067dcb36a0a4b7e178610520527fa644918df7bb5a83b0173e30bdc1b8715372bcdbcf340cfde5503d81ed36336b610540526f18df15ae4597a66019d1c17a6ee5fb2e610560527f245b11b8eb125d69da90d7c48a24d23576660f8be440aca249a9bc8597309eeb610580526f0e12c63aec033e3d88a1fb8781cb3e526105a0527f620375c557d06bb4f40b80a112015ac4b7c082cec41c2358c1ae73a219331c476105c0526f01d5a2ce8354d2c862ab62fb2cee74f96105e0527fd8a9a0a5c6b3d4b93035f731c223c058ffa23859b9fc3d93eff6c4dad34604dc61060052805f3506610640527f41f616eef710fa4d8ef599a6a06c60bc8918b5c7ccde5277a5a522cc0bc76755610620525f610660525f610680525f6106a0525f6106c0526030602061067037603060506106b0375f6106e0525f610700525f610720525f61074052603060806106f037603060b0610730375f610760525f610780525f6107a0525f6107c052603060e06107703760306101106107b0376101c0610620206107e0526107e0518181066108005280610820525060016108405360216108202061084052610840518181066108605280610880525060016108a0536021610880206108a0526108a0518181066108c052806108e052505f610900525f610920525f610940525f610960526030610140610910376030610170610950375f610980525f6109a0525f6109c0525f6109e05260306101a06109903760306101d06109d0375f610a00525f610a20525f610a40525f610a60526030610200610a10376030610230610a50376101a06108e020610a8052610a8051818106610aa05280610ac052505f610ae0525f610b00525f610b20525f610b40526030610260610af0376030610290610b30375f610b60525f610b80525f610ba0525f610bc05260306102c0610b703760306102f0610bb0375f610be0525f610c00525f610c20525f610c40526030610320610bf0376030610350610c30376101a0610ac020610c6052610c6051818106610c805280610ca05250806103803506610cc052806103a03506610ce052806103c03506610d0052806103e03506610d2052806104003506610d4052806104203506610d6052806104403506610d8052806104603506610da052806104803506610dc052806104a03506610de052806104c03506610e0052806104e03506610e2052806105003506610e4052806105203506610e6052806105403506610e8052806105603506610ea052806105803506610ec052610240610ca020610ee052610ee051818106610f005280610f2052505f610f40525f610f60525f610f80525f610fa05260306105a0610f503760306105d0610f90375f610fc0525f610fe0525f611000525f611020526030610600610fd0376030610630611010375f611040525f611060525f611080525f6110a0526030610660611050376030610690611090376101a0610f20206110c0526110c0518181066110e05280611100525080610c8051610c80510961112052806111205161112051096111405280611140516111405109611160528061116051611160510961118052806111805161118051096111a052806111a0516111a051096111c052806111c0516111c051096111e052806111e0516111e05109611200528061120051611200510961122052806112205161122051096112405280611240516112405109611260528061126051611260510961128052807f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff0000000061128051086112a052807f73e66878b46ae3705eb6a46a89213de7d3686828bfce5c19400fffff001000016112a051096112c052807f2c6aa58b3a749bc62c8e657fe47ea551f32dcc1406da0f4c6704b9c8bb9bf61e6112c051096112e052807f478301c7ef28e18206ab7288252332b3608fd7eef9244cb298fb4636446409e3610c80510861130052807f482ec10c0dfb6cca3d4067ca08e2b3a4aca02a3a8f443648361e8ea8ae06b1266112c0510961132052807f2bbee6471ba2107df5f9703e00bf2460a71d79c870ba25b6c9e1715651f94edb610c80510861134052807f5164ca4cf7456c9b942c20e45c3ad14d9ce862487904d0ab1b561347c6a477276112c0510961136052807f2288dd06325810ac9f0db723ad6706b7b6d541ba86f98b53e4a9ecb7395b88da610c80510861138052807f2229dd16b97880c226a96b6d8623b90e8a775193a915287b84658d7d1fba41336112c051096113a052807f51c3ca3c7024fc860c906c9a837e1ef6c946526f56e933837b9a7281e045bece610c8051086113c052807f55612c879036d62fae65b5bdd485b39aa954d02ff707ac89dc982deab639eb066112c051096113e052807f1e8c7acb9966a71884d4224a351c246aaa68d3d308f6af752367d21449c614fb610c80510861140052807f391b2856c609b4784ae25ffab9dc59865046d17864183203961a252dd85433626112c0510961142052807f3ad27efc6393c8cfe857780d4fc57e7f0376d28a9be629fb69e5dad127abcc9f610c805108611440528060016112c0510961146052807f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000610c8051086114805261130051818161134051099050806114a052818161138051099050806114c05281816113c051099050806114e05281816114005109905080611500528181611440510990508061152052818161148051099050806115405281816112a05109905080611560525060206115a05260206115c05260206115e05261156051611600527f73eda753299d7d483339d80809a1d80553bda402fffe5bfefffffffeffffffff611620527f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff0000000161164052816001602061158060c06115a060055afa14169150611580515f6112a0519050828261154051096112a0528282820991506114805190508282611520510961148052828282099150611440519050828261150051096114405282828209915061140051905082826114e05109611400528282820991506113c051905082826114c051096113c05282828209915061138051905082826114a051096113805282828209915061134051905082826113005109611340528282820991508161130052505080611300516112e05109611660528061134051611320510961168052806113805161136051096116a052806113c0516113a051096116c05280611400516113e051096116e052806114405161142051096117005280611480516114605109611720528061064051611720510980611740525080610d2051610cc051096117605280610d4051610ce0510961178052806117805161176051086117a05280610d6051610d0051096117c052806117c0516117a051086117e05280610d8051610cc05109611800528061180051610ce051096118205280611820516117e051086118405280610da05161184051086118605280611740516118605108611880528061188051610aa051096118a05280610e405182036001086118c05280611720516118c051096118e052806118e0516118a05108611900528061190051610aa051096119205280610ea051610ea051096119405280610ea05182036119405108611960528061166051611960510961198052806119805161192051086119a052806119a051610aa051096119c05280610e80518203610ea051086119e05280611720516119e05109611a005280611a00516119c05108611a205280611a2051610aa05109611a405280611660518203600108611a6052806116a0516116805108611a8052806116c051611a805108611aa052806116e051611aa05108611ac0528061170051611ac05108611ae05280611ae0518203611a605108611b00528061086051610de05109611b205280611b2051610cc05108611b4052806108c051611b405108611b60528061086051610e005109611b805280611b8051610ce05108611ba052806108c051611ba05108611bc05280611b6051611bc05109611be05280610e6051611be05109611c00528061086051600109611c205280611c2051610c805109611c405280611c4051610cc05108611c6052806108c051611c605108611c805280610860517f08634d0aa021aaf843cab354fabb0062f6502437c6a09c006c083479590189d709611ca05280611ca051610c805109611cc05280611cc051610ce05108611ce052806108c051611ce05108611d005280611c8051611d005109611d205280610e4051611d205109611d405280611d40518203611c005108611d605280611b0051611d605109611d805280611d8051611a405108611da05280611da051610aa05109611dc0528061086051610e205109611de05280611de051610d005108611e0052806108c051611e005108611e205280610ec051611e205109611e405280610860517f40b0afd8c60e6915ded7a734dafad914ccf6d7eb31264187ce8f84340b4e330a09611e605280611e6051610c805109611e805280611e8051610d005108611ea052806108c051611ea05108611ec05280610ea051611ec05109611ee05280611ee0518203611e405108611f005280611b0051611f005109611f205280611f2051611dc05108611f405280611280516112805109611f60528061128051611f605109611f80528061128051600109611fa05280611f6051600109611fc052806112a051611f405109611fe052806110e0516110e0510961200052806110e05161200051096120205280610f0051610f0051096120405280610f005161204051096120605280610f005161206051096120805280610f005161208051096120a05280610f00516120a051096120c05280610f00516120c051096120e05280610f00516120e051096121005280610f005161210051096121205280610f005161212051096121405280610f005161214051096121605280610f005161216051096121805280610f005161218051096121a05280610f00516121a051096121c05280610f00516121c051096121e052806001610cc0518303096122005280610f0051610ce0518303096122205280610f00516001096122405280612220516122005108612260528061204051610d00518303096122805280612040516001096122a052806122805161226051086122c0528061206051610e40518303096122e052806120605160010961230052806122e0516122c05108612320528061208051610ea051830309612340528061208051600109612360528061234051612320510861238052806120a051610d20518303096123a052806120a0516001096123c052806123a05161238051086123e052806120c051610d405183030961240052806120c0516001096124205280612400516123e0510861244052806120e051610d605183030961246052806120e05160010961248052806124605161244051086124a0528061210051610d80518303096124c05280612100516001096124e052806124c0516124a05108612500528061212051610da0518303096125205280612120516001096125405280612520516125005108612560528061214051610de0518303096125805280612140516001096125a052806125805161256051086125c0528061216051610e00518303096125e052806121605160010961260052806125e0516125c05108612620528061218051610e2051830309612640528061218051600109612660528061264051612620510861268052806121a051611fe0518303096126a052806121a0516001096126c052806121a051611fa051096126e052806121a051611fc0510961270052806126a051612680510861272052806121c051610dc05183030961274052806121c05160010961276052806127405161272051086127805280600161278051096127a05280600161224051096127c0528060016122a051096127e0528060016123005109612800528060016123605109612820528060016123c05109612840528060016124205109612860528060016124805109612880528060016124e051096128a05280600161254051096128c0528060016125a051096128e0528060016126005109612900528060016126605109612920528060016126c05109612940528060016126e051096129605280600161270051096129805280600161276051096129a052806001610e60518303096129c05280610f0051610ec0518303096129e052806129e0516129c05108612a0052806110e051612a005109612a2052806110e051600109612a4052806110e0516122405109612a605280612a20516127a05108612a805280612a40516128005108612aa05280612a60516128205108612ac052806001610e8051830309612ae0528061200051612ae05109612b00528061200051600109612b205280612b0051612a805108612b405280612b2051612aa05108612b605280610c8051600109612b805280612b8051600109612ba05280610c80517f564c0a11a0f704f4fc3e8acfe0f8245f0ad1347b378fbf96e206da11a5d3630609612bc05280612bc051612a405109612be05280610c80517f2c6aa58b3a749bc62c8e657fe47ea551f32dcc1406da0f4c6704b9c8bb9bf61e09612c005280612c0051612b205109612c20526f17f1d3a73197d7942695638c4fa9ac0f612c40527fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb612c60526f08b3f481e3aaa0f1a09e30ed741d8ae4612c80527ffcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1612ca052612c4051612cc052612c6051612ce052612c8051612d0052612ca051612d2052612b4051612d40528160016080612cc060a0612cc0600c5afa14169150612cc051612d6052612ce051612d8052612d0051612da052612d2051612dc05261066051612de05261068051612e00526106a051612e20526106c051612e40528160016080612d60610100612d60600b5afa141691506106e051612e605261070051612e805261072051612ea05261074051612ec0526127c051612ee0528160016080612e6060a0612e60600c5afa14169150612d6051612f0052612d8051612f2052612da051612f4052612dc051612f6052612e6051612f8052612e8051612fa052612ea051612fc052612ec051612fe0528160016080612f00610100612f00600b5afa14169150610760516130005261078051613020526107a051613040526107c051613060526127e05161308052816001608061300060a0613000600c5afa14169150612f00516130a052612f20516130c052612f40516130e052612f605161310052613000516131205261302051613140526130405161316052613060516131805281600160806130a06101006130a0600b5afa14169150610900516131a052610920516131c052610940516131e0526109605161320052612b60516132205281600160806131a060a06131a0600c5afa141691506130a051613240526130c051613260526130e05161328052613100516132a0526131a0516132c0526131c0516132e0526131e0516133005261320051613320528160016080613240610100613240600b5afa1416915061098051613340526109a051613360526109c051613380526109e0516133a052612ac0516133c052816001608061334060a0613340600c5afa14169150613240516133e052613260516134005261328051613420526132a0516134405261334051613460526133605161348052613380516134a0526133a0516134c05281600160806133e06101006133e0600b5afa14169150610220516134e052610240516135005261026051613520526102805161354052612840516135605281600160806134e060a06134e0600c5afa141691506133e05161358052613400516135a052613420516135c052613440516135e0526134e051613600526135005161362052613520516136405261354051613660528160016080613580610100613580600b5afa141691506102a051613680526102c0516136a0526102e0516136c052610300516136e0526128605161370052816001608061368060a0613680600c5afa1416915061358051613720526135a051613740526135c051613760526135e05161378052613680516137a0526136a0516137c0526136c0516137e0526136e051613800528160016080613720610100613720600b5afa141691506103205161382052610340516138405261036051613860526103805161388052612880516138a052816001608061382060a0613820600c5afa14169150613720516138c052613740516138e05261376051613900526137805161392052613820516139405261384051613960526138605161398052613880516139a05281600160806138c06101006138c0600b5afa141691506103a0516139c0526103c0516139e0526103e051613a005261040051613a20526128a051613a405281600160806139c060a06139c0600c5afa141691506138c051613a60526138e051613a805261390051613aa05261392051613ac0526139c051613ae0526139e051613b0052613a0051613b2052613a2051613b40528160016080613a60610100613a60600b5afa1416915061042051613b605261044051613b805261046051613ba05261048051613bc0526128c051613be0528160016080613b6060a0613b60600c5afa14169150613a6051613c0052613a8051613c2052613aa051613c4052613ac051613c6052613b6051613c8052613b8051613ca052613ba051613cc052613bc051613ce0528160016080613c00610100613c00600b5afa141691506104a051613d00526104c051613d20526104e051613d405261050051613d60526128e051613d80528160016080613d0060a0613d00600c5afa14169150613c0051613da052613c2051613dc052613c4051613de052613c6051613e0052613d0051613e2052613d2051613e4052613d4051613e6052613d6051613e80528160016080613da0610100613da0600b5afa1416915061052051613ea05261054051613ec05261056051613ee05261058051613f005261290051613f20528160016080613ea060a0613ea0600c5afa14169150613da051613f4052613dc051613f6052613de051613f8052613e0051613fa052613ea051613fc052613ec051613fe052613ee05161400052613f0051614020528160016080613f40610100613f40600b5afa141691506105a051614040526105c051614060526105e05161408052610600516140a052612920516140c052816001608061404060a0614040600c5afa14169150613f40516140e052613f605161410052613f805161412052613fa0516141405261404051614160526140605161418052614080516141a0526140a0516141c05281600160806140e06101006140e0600b5afa14169150610ae0516141e052610b005161420052610b205161422052610b405161424052612940516142605281600160806141e060a06141e0600c5afa141691506140e05161428052614100516142a052614120516142c052614140516142e0526141e051614300526142005161432052614220516143405261424051614360528160016080614280610100614280600b5afa14169150610b605161438052610b80516143a052610ba0516143c052610bc0516143e0526129605161440052816001608061438060a0614380600c5afa1416915061428051614420526142a051614440526142c051614460526142e05161448052614380516144a0526143a0516144c0526143c0516144e0526143e051614500528160016080614420610100614420600b5afa14169150610be05161452052610c005161454052610c205161456052610c405161458052612980516145a052816001608061452060a0614520600c5afa14169150614420516145c052614440516145e05261446051614600526144805161462052614520516146405261454051614660526145605161468052614580516146a05281600160806145c06101006145c0600b5afa14169150610a00516146c052610a20516146e052610a405161470052610a6051614720526129a0516147405281600160806146c060a06146c0600c5afa141691506145c051614760526145e05161478052614600516147a052614620516147c0526146c0516147e0526146e05161480052614700516148205261472051614840528160016080614760610100614760600b5afa14169150610f405161486052610f605161488052610f80516148a052610fa0516148c052612ba0516148e052816001608061486060a0614860600c5afa14169150614760516149005261478051614920526147a051614940526147c051614960526148605161498052614880516149a0526148a0516149c0526148c0516149e0528160016080614900610100614900600b5afa14169150610fc051614a0052610fe051614a205261100051614a405261102051614a6052612be051614a80528160016080614a0060a0614a00600c5afa1416915061490051614aa05261492051614ac05261494051614ae05261496051614b0052614a0051614b2052614a2051614b4052614a4051614b6052614a6051614b80528160016080614aa0610100614aa0600b5afa1416915061104051614ba05261106051614bc05261108051614be0526110a051614c0052612c2051614c20528160016080614ba060a0614ba0600c5afa14169150614aa051614c4052614ac051614c6052614ae051614c8052614b0051614ca052614ba051614cc052614bc051614ce052614be051614d0052614c0051614d20528160016080614c40610100614c40600b5afa141691506f17f1d3a73197d7942695638c4fa9ac0f614d40527fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb614d60526f08b3f481e3aaa0f1a09e30ed741d8ae4614d80527ffcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1614da052610fc051614dc052610fe051614de05261100051614e005261102051614e2052612a4051614e40528160016080614dc060a0614dc0600c5afa14169150610f4051614e6052610f6051614e8052610f8051614ea052610fa051614ec052614dc051614ee052614de051614f0052614e0051614f2052614e2051614f40528160016080614e60610100614e60600b5afa1416915061104051614f605261106051614f805261108051614fa0526110a051614fc052612b2051614fe0528160016080614f6060a0614f60600c5afa14169150614e605161500052614e805161502052614ea05161504052614ec05161506052614f605161508052614f80516150a052614fa0516150c052614fc0516150e0528160016080615000610100615000600b5afa14169150614c405161510052614c605161512052614c805161514052614ca051615160526f024aa2b2f08f0a91260805272dc51051615180527fc6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb86151a0526f13e02b6052719f607dacd3a088274f656151c0527f596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e6151e0526f0ce5d527727d6e118cc9cdc6da2e351a615200527fadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801615220526f0606c4a02ea734cc32acd2b02bc28b99615240527fcb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be615260526150005161528052615020516152a052615040516152c052615060516152e0526f19d5a75bdb11ecd2ce4f350406acfb92615300527ff727d71020f64a9fe5b4d67aeff0eb08d162861d27a14416173836fe4bf1a301615320526f18d7902500b6a77929110dab107d243a615340527fbf0c555515295b8ee76139736671121b44805fa002ed76e452b6898acc085ad4615360526f0dcc2476aa087c1d4128de32f0536adc615380527f68ac56f27cec75c732c17574ba2a7542336371388dee566442004a79b6e37f596153a0526f01739420d824b582399ab9f4fff4a8a06153c0527f0c23c94351e23921416fda8e0022b590d37907f856a878c7a521d4973d684c336153e0528160016020615100610300615100600f5afa141691508160016151005114169150816125bc575f5ffd5b5f5ff3fea2646970667358221220005c79ce137de3e97aac5fb96761f538086a654d312500a0d144ae9d883daa6864736f6c634300081e0033 No newline at end of file | |||
| @@ -0,0 +1 @@ | |||
| 000000000000000000000000000000000000000000000000000000001a4ac9a9192690d574d418cb121cfa9ca9f2fdfbb4142a1648f3b6395cd5f5b0be996b3873bd14faf1ae84a65e4a4e3e129f97ee17e0f750dfba2787855faba337773eb247cb73234f2be77a4e885f6fcdb36b60695e7010af9403db09903c2aaa41d6a20d30775e86cdba867e5a6039c708d23070cde65599fd8a74a308eac836551f0f1b5aedf231475d912ca469bb09eacd67082a56baf8a7696367f27a20ed6ccbd28f5d215e488abcdac2376a580a2c580c36f1331b4966377d0773099ac713be7314ee83b6338c526b39b0911e4c6063571027743d873b1023373f715b23514b0ee979c3a402cc7a737bf452a829131309022690e30cdfb33a17046d1f8e2ed2b70c9575755b221682d5c1566ee9325b1420b1324a1a693bf6847f3af65fc43736138403cbe5ea5f0f1488003596a99fabd5350db74c2a1f72f950bfd5051e01a4b0f79a5f67728afe79ffc43f87b320d4160f1d8abe900fc54ce547427a071bef8662b0b3d97615a6ccca2ff60dff73b4abd06521e78da633ab80819be6e57ceb068ffab311480f16c5a8df597a2f0e49a4d7df9f8b95033bba8b9e0f44e36f031b373e5e45d65147585b951f393e35e403eeb7bd137bb4b4c5a93b64f925cfd9d4362bd5da95447f411b68e4aa0b63fe670d9e2d854a2f64860056a918d3cbbe0fe6205ff58d175346c28ff32459786ea80747c1b698affa4976dfd58afb2402cca7be7abf61a3a21417afaef6aa2b5702cbf7e615830d210526f9ebd17dc660c1b0a887808a5c1d1d6feebe1f5a7031f6223e99003de1bdbda957defe4ddf01043aa801bffcf1218b331d3e2258c6b910fed0573bc3e24f96e06d9a9844f03c566a44e7c3ee70046d4958e2cea3609709528a20a28b466e96ee0f85afc7114adae062d6b2094672b7b2e34d18a8b51737059fedcb47870356bb8d4574bca21310154565e23faa83faafe02e62ae094ece0b41e5fa43a46b9c3b135cca4575ca75273e6f2d7632b7c84d0f4d08b505a20ffa085b95c2fadcc72a9b6da92acd6f95afe926c41d882ddb07294dff2a1db90708b8e802a5223503044177fc8ede920e877374d288ee7b87face2c3656806b98c992ced90b524202185bf25a33909b9b807062db89b28ef105ae5a3aef9d2f05245b225ffd4316162c31b2177b7259429ab7f4d398cef9e8dacb6ee09a42111174ca1cfa28890d54fba7654126f61f0e5f471419e6df3be571b5c7703890da9539814cda1fe2513602424ab56279c5154dedac010e5f68792e37b9ee975ced659964d9027445c4a72e0170c6dcbe8260dddd6063543586a40d89ed663c0a555c1751edc2ef6b0a2971f8168e55b97872221a6f66c5aa9fda1937e8b381c4a1a29a2def1236a4ab68885fce12e63ae0317646de396f04ec626b79cf143d021072e2638aab2266b7ef603e1788a99a15103a96a3c157c8be7a044ab2998a97160274c34e80b46c1467105d23ccfe671f62ec8dbc72de09d8c4d6f39e287a0420e5c4c7155644cd6fdec07c2f1153342a41b0dd81fac6cdaadc6fc481adc79926755726d92bd6d2cc56709b3b55a80134272e3d3dd04d87bb907dae9c426aeb80f62613f981c31c4703151278a26a805144026c9bb39093c833e3ead86493d25b0796f7c89021da6da08b68549d4d67d459ce4d93d020c1885e371e045003f0ef882b3bfe80fcd7fad7a655597bf0b6fc5b795079dc15509b02b4240dc13a7c1aabf60d98be1bc28db96bdcb289eb9aa2717a34de3e3d9fa95be9ab801cad124821e719782482775a9b42583669f112756c8e2e18358db187dbc522fd745131f45b9c758d4f92a248169c67fd84d8dc044d9c5f7fe35b04cd35a6f6dec6bb2667113716052807731d3e0ce217875f6f8e14206af936f7a13cea356c5501de589edb10aa764340cea50aa6dd13f1af0efc0d10b4fb6ae50f6f283f61f7ef3d318fd76936f76e417b44f4ac1760a100616911e9bf8fb1e74aa74e073b177b13b2a63896741bb056a353f2e36ffe1dbe6031a92367ce42ebc5a59efa618eb78c04430ecd3bcf27563553213732b46765abd2c7795782ccd3edcb78c400f707375ecd73022f74ea77c2803edb5f06a726c5a813bf5e01909f1227756c9f44576d9679d2426fa669c03dccdaf6278ec2500b688929f35a860e739e57dc08084b8b401f04127fc0b50dff134d4e8cb38062a061418499e7e58ff635f69ee5447cf43f25d1f2ac4adf72e3b2679d0cd56f40295908b7543185cd395388c2fcb9651351259a079c8124f7f9801fe938e8172ea72ca126c2f9a1277632d340fde872ce494c001ea2d9d553ac3d14ff5ec123bb46dad329397acc31e3f7b672abfff1c6da9da9f92c2a0cd78193990fef885fe2b322 No newline at end of file | |||
| @@ -0,0 +1,1033 @@ | |||
|
|
|||
This is a one-shot implementation of the port of the snark-verifier halo2 Solidity verifier to BLS, meant for discussion on the approach taken.
See a proposed milestone/roadmap:
https://github.com/EYBlockchain/Moonlight/issues?q=is%3Aissue%20state%3Aopen%20milestone%3A%22Solidity%20Halo2%2FMidnight%20verifier%22
Summary
This PR ports the EVM verification path from BN254 to BLS12-381 and updates
standard_plonkto exercise the BLS flow end to end.Changes
Bn256toBls12, and updated base field-limb params toLIMBS=3,BITS=128(381-bit base field for BLS).G1=128 bytes,G2=256 bytes).G1Add,G1MSM,Pairing) in accordance with EIP-2537 addresses.solcerror surfacing and clearer revert decoding in Prague-moderevmsimulation.standard_plonkexample to BLS12-381 GWC (multi-open KZG) and regenerated verifier/calldata artifacts.1.88.0.Testing
Run the vanilla Plonk dummy proof:
What's missing