Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6ce5d48
fix: bump allow and send blobs in transaction with eip 7594
MarcosNicolau Nov 14, 2025
a81b73f
ci: bump rust version to support newer alloy version
MarcosNicolau Nov 14, 2025
c14107e
chore: ignore clippy uninlined_format_args warnings
MarcosNicolau Nov 19, 2025
4898009
chore: address clippy warnings
MarcosNicolau Nov 19, 2025
c88ec93
chore: address more clippy warnings
MarcosNicolau Nov 19, 2025
bb3786d
chore: address clippy warnings
MarcosNicolau Nov 19, 2025
7048c1b
chore: migrate ethereum package to fulu fork (#2173)
MarcosNicolau Nov 20, 2025
aae8c8e
feat: proving system id for proof commitments
MarcosNicolau Nov 12, 2025
38fd3b3
refactor: centralize proving system id constant
MarcosNicolau Nov 13, 2025
e416edf
fix: pass uint8 instead of uint256 in verifyProofInclusion to match t…
MarcosNicolau Nov 13, 2025
d26fb28
chore: redeploy contracts on anvil and eth package + update abi
MarcosNicolau Nov 25, 2025
6f47f54
refactor: proving system id replace constants for enum
MarcosNicolau Nov 25, 2025
4bf8cb3
chore: redeploy contracts with latest risc0 verifier
MarcosNicolau Nov 25, 2025
937d086
Merge branch 'testnet' into feat/proving-system-id-for-leafs-1
maximopalopoli Nov 26, 2025
65c6bfc
chore: address clippy warnings
MarcosNicolau Nov 26, 2025
85db268
chore: address clippy warnings
MarcosNicolau Nov 26, 2025
9878029
fix: u8 for u16 in proving system id
MarcosNicolau Nov 27, 2025
aed974e
chore: redeploy contracts
MarcosNicolau Nov 27, 2025
73b8f60
fix: update proof commitment u16 in programs
MarcosNicolau Nov 27, 2025
d0a11e9
chore: redeploy contracts and compute program ids
MarcosNicolau Nov 27, 2025
4ea4890
Merge branch 'testnet' into feat/proving-system-id-for-leafs-1
MauroToscano Dec 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aggregation_mode/abi/AlignedProofAggregationService.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ risc0_zkvm::guest::entry!(main);

// Generated with `make proof_aggregator_write_program_ids` and copied from program_ids.json
pub const USER_PROOFS_AGGREGATOR_PROGRAM_IMAGE_ID: [u8; 32] = [
246, 152, 137, 29, 200, 71, 68, 14, 148, 211, 69, 210, 38, 88, 167, 181, 85, 190, 249, 99, 59,
170, 43, 133, 188, 222, 95, 79, 87, 222, 76, 175,
253, 36, 51, 43, 163, 223, 190, 136, 60, 123, 233, 240, 170, 213, 170, 76, 117, 219, 15, 0, 47,
81, 218, 228, 232, 218, 86, 42, 145, 190, 144, 161,
];

fn main() {
Expand Down
3 changes: 3 additions & 0 deletions aggregation_mode/aggregation_programs/risc0/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use lambdaworks_crypto::merkle_tree::traits::IsMerkleTreeBackend;
use serde::{Deserialize, Serialize};
use tiny_keccak::{Hasher, Keccak};

const RISC0_PROVING_SYSTEM_ID: u16 = 2;

#[derive(Serialize, Deserialize)]
pub struct Risc0ImageIdAndPubInputs {
pub image_id: [u8; 32],
Expand All @@ -11,6 +13,7 @@ pub struct Risc0ImageIdAndPubInputs {
impl Risc0ImageIdAndPubInputs {
pub fn commitment(&self) -> [u8; 32] {
let mut hasher = Keccak::v256();
hasher.update(&RISC0_PROVING_SYSTEM_ID.to_be_bytes());
for &word in &self.image_id {
hasher.update(&word.to_be_bytes());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use sp1_aggregation_program::{ChunkAggregatorInput, Hash32};

// Generated with `make proof_aggregator_write_program_ids` and copied from program_ids.json
pub const USER_PROOFS_AGGREGATOR_PROGRAM_VK_HASH: [u32; 8] = [
1568672557, 1699162914, 9186125, 1196115399, 1766446440, 1385693297, 1976910968, 278007428,
1783055897, 486133361, 187778113, 1130718359, 781594768, 1430967573, 1107098593, 1119970919,
];

pub fn main() {
Expand Down
3 changes: 3 additions & 0 deletions aggregation_mode/aggregation_programs/sp1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use lambdaworks_crypto::merkle_tree::traits::IsMerkleTreeBackend;
use serde::{Deserialize, Serialize};
use sha3::{Digest, Keccak256};

const SP1_PROVING_SYSTEM_ID: u16 = 1;

#[derive(Serialize, Deserialize)]
pub struct SP1VkAndPubInputs {
pub vk: [u32; 8],
Expand All @@ -11,6 +13,7 @@ pub struct SP1VkAndPubInputs {
impl SP1VkAndPubInputs {
pub fn commitment(&self) -> [u8; 32] {
let mut hasher = Keccak256::new();
hasher.update(&SP1_PROVING_SYSTEM_ID.to_be_bytes());
for &word in &self.vk {
hasher.update(word.to_be_bytes());
}
Expand Down
12 changes: 6 additions & 6 deletions aggregation_mode/programs_ids.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"risc0_chunk_aggregator_image_id": "0x4cc11a4ac146ce4fc71493d694a9707194316cbb609603a195ffbe0c4c099c97",
"risc0_user_proofs_aggregator_image_id": "0xf698891dc847440e94d345d22658a7b555bef9633baa2b85bcde5f4f57de4caf",
"risc0_user_proofs_aggregator_image_id_bytes": "[246, 152, 137, 29, 200, 71, 68, 14, 148, 211, 69, 210, 38, 88, 167, 181, 85, 190, 249, 99, 59, 170, 43, 133, 188, 222, 95, 79, 87, 222, 76, 175]",
"sp1_chunk_aggregator_vk_hash": "0x00a18429d092a8e1f58aea6ff650ad715ad4e6d7056600bb201d38460244507b",
"sp1_user_proofs_aggregator_vk_hash": "0x00bb00165b951cac8804615a6c74b45c7d293aad14a6001c7aeaa23c10920e84",
"sp1_user_proofs_aggregator_vk_hash_words": "[1568672557, 1699162914, 9186125, 1196115399, 1766446440, 1385693297, 1976910968, 278007428]"
"risc0_chunk_aggregator_image_id": "0xd8cfdd5410c70395c0a1af1842a0148428cc46e353355faccfba694dd4862dbf",
"risc0_user_proofs_aggregator_image_id": "0xfd24332ba3dfbe883c7be9f0aad5aa4c75db0f002f51dae4e8da562a91be90a1",
"risc0_user_proofs_aggregator_image_id_bytes": "[253, 36, 51, 43, 163, 223, 190, 136, 60, 123, 233, 240, 170, 213, 170, 76, 117, 219, 15, 0, 47, 81, 218, 228, 232, 218, 86, 42, 145, 190, 144, 161]",
"sp1_chunk_aggregator_vk_hash": "0x00ba19eed0aaeb0151f07b8d3ee7c659bcd29f3021e48fb42766882f55b84509",
"sp1_user_proofs_aggregator_vk_hash": "0x00d48e8c3273e739c4598a220c36564975d2c6121552b54560fe7df0c2c16667",
"sp1_user_proofs_aggregator_vk_hash_words": "[1783055897, 486133361, 187778113, 1130718359, 781594768, 1430967573, 1107098593, 1119970919]"
}
2 changes: 2 additions & 0 deletions aggregation_mode/src/aggregators/risc0_aggregator.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include!(concat!(env!("OUT_DIR"), "/methods.rs"));

use aligned_sdk::aggregation_layer::AggregationModeProvingSystem;
use risc0_zkvm::{default_prover, ExecutorEnv, ProverOpts, Receipt};
use sha3::{Digest, Keccak256};

Expand Down Expand Up @@ -80,6 +81,7 @@ pub const RISC0_CHUNK_AGGREGATOR_PROGRAM_ID_BYTES: [u8; 32] = {
impl Risc0ProofReceiptAndImageId {
pub fn hash_image_id_and_public_inputs(&self) -> [u8; 32] {
let mut hasher = Keccak256::new();
hasher.update(AggregationModeProvingSystem::RISC0.id_bytes());
hasher.update(self.image_id);
hasher.update(self.public_inputs());
hasher.finalize().into()
Expand Down
2 changes: 2 additions & 0 deletions aggregation_mode/src/aggregators/sp1_aggregator.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::LazyLock;

use aligned_sdk::aggregation_layer::AggregationModeProvingSystem;
use alloy::primitives::Keccak256;
use sp1_aggregation_program::SP1VkAndPubInputs;
#[cfg(feature = "prove")]
Expand Down Expand Up @@ -63,6 +64,7 @@ impl SP1ProofWithPubValuesAndElf {

pub fn hash_vk_and_pub_inputs(&self) -> [u8; 32] {
let mut hasher = Keccak256::new();
hasher.update(AggregationModeProvingSystem::SP1.id_bytes());
let vk_bytes = &self.vk.hash_bytes();
hasher.update(vk_bytes);
hasher.update(self.proof_with_pub_values.public_values.as_slice());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"alignedAggregatorAddressPrivateKey": "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6"
},
"programs_id": {
"sp1AggregationProgramVKHash": "0x00a18429d092a8e1f58aea6ff650ad715ad4e6d7056600bb201d38460244507b",
"risc0AggregationProgramImageId": "0x4cc11a4ac146ce4fc71493d694a9707194316cbb609603a195ffbe0c4c099c97"
"sp1AggregationProgramVKHash": "0x00ba19eed0aaeb0151f07b8d3ee7c659bcd29f3021e48fb42766882f55b84509",
"risc0AggregationProgramImageId": "0xd8cfdd5410c70395c0a1af1842a0148428cc46e353355faccfba694dd4862dbf"
},
"permissions": {
"owner": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"alignedAggregatorAddressPrivateKey": "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6"
},
"programs_id": {
"sp1AggregationProgramVKHash": "0x00a18429d092a8e1f58aea6ff650ad715ad4e6d7056600bb201d38460244507b",
"risc0AggregationProgramImageId": "0x4cc11a4ac146ce4fc71493d694a9707194316cbb609603a195ffbe0c4c099c97"
"sp1AggregationProgramVKHash": "0x00ba19eed0aaeb0151f07b8d3ee7c659bcd29f3021e48fb42766882f55b84509",
"risc0AggregationProgramImageId": "0xd8cfdd5410c70395c0a1af1842a0148428cc46e353355faccfba694dd4862dbf"
},
"permissions": {
"owner": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955"
Expand Down

Large diffs are not rendered by default.

4,398 changes: 2,144 additions & 2,254 deletions contracts/scripts/anvil/state/eigenlayer-deployed-anvil-state.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions contracts/src/core/AlignedProofAggregationService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,18 @@ contract AlignedProofAggregationService is
/// - The function returns `true` if this Merkle root is known to correspond to a valid aggregated proof.
///
/// @param merklePath The Merkle proof (sibling hashes) needed to reconstruct the Merkle root.
/// @param provingSystemId The id of the proving system (1 for SP1, 2 for RISC0).
/// @param programId The identifier for the ZK program (image_id in RISC0 or vk hash in SP1).
/// @param publicInputs The public inputs bytes of the proof.
///
/// @return bool Returns true if the computed Merkle root is a recognized valid aggregated proof.
function verifyProofInclusion(bytes32[] calldata merklePath, bytes32 programId, bytes calldata publicInputs)
public
view
returns (bool)
{
bytes32 proofCommitment = keccak256(abi.encodePacked(programId, publicInputs));
function verifyProofInclusion(
bytes32[] calldata merklePath,
uint16 provingSystemId,
bytes32 programId,
bytes calldata publicInputs
) public view returns (bool) {
bytes32 proofCommitment = keccak256(abi.encodePacked(provingSystemId, programId, publicInputs));
bytes32 merkleRoot = MerkleProof.processProofCalldata(merklePath, proofCommitment);
return aggregatedProofs[merkleRoot];
}
Expand Down
17 changes: 9 additions & 8 deletions contracts/src/core/IAlignedProofAggregationService.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
pragma solidity ^0.8.12;

interface IAlignedProofAggregationService {

/// @notice event that gets emitted after a successful aggregated proof verification
event AggregatedProofVerified(bytes32 indexed merkleRoot, bytes32 blobVersionedHash);

/// @notice Event emitted when the Risc0 verifier address is updated
event Risc0VerifierAddressUpdated(address indexed newAddress);

/// @notice Event emitted when the SP1 verifier address is updated
event SP1VerifierAddressUpdated(address indexed newAddress);

/// @notice Event emitted when the Risc0 aggregator program image ID is updated
event Risc0AggregatorProgramImageIdUpdated(bytes32 indexed newImageId);

/// @notice Event emitted when the SP1 aggregator program VK hash is updated
event SP1AggregatorProgramVKHashUpdated(bytes32 indexed newVKHash);

Expand All @@ -29,10 +28,12 @@ interface IAlignedProofAggregationService {
function verifyRisc0(bytes32 blobVersionedHash, bytes calldata risc0ReceiptSeal, bytes calldata risc0JournalBytes)
external;

function verifyProofInclusion(bytes32[] calldata merklePath, bytes32 programId, bytes calldata publicInputs)
external
view
returns (bool);
function verifyProofInclusion(
bytes32[] calldata merklePath,
uint16 provingSystemId,
bytes32 programId,
bytes calldata publicInputs
) external view returns (bool);

/// @notice Sets the address of the Risc0 verifier contract
/// @param _risc0VerifierAddress The new address for the Risc0 verifier contract
Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/abi/AlignedProofAggregationService.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion crates/sdk/src/aggregation_layer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ mod helpers;
mod types;

// Makes only the two types on this use public
pub use types::{AggregationModeVerificationData, ProofVerificationAggModeError};
pub use types::{
AggregationModeProvingSystem, AggregationModeVerificationData, ProofVerificationAggModeError,
};

use crate::{
common::types::Network, eth::aligned_proof_agg_service::aligned_proof_aggregation_service,
Expand Down Expand Up @@ -128,6 +130,7 @@ pub async fn is_proof_verified_on_chain(
let res = contract_provider
.verify_proof_inclusion(
merkle_path,
verification_data.proving_system_id(),
verification_data.program_id(),
Bytes::from(verification_data.public_inputs().clone()),
)
Expand Down
49 changes: 49 additions & 0 deletions crates/sdk/src/aggregation_layer/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@ use sha3::{Digest, Keccak256};

use crate::beacon::BeaconClientError;

#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum AggregationModeProvingSystem {
SP1 = 1,
RISC0 = 2,
}

impl AggregationModeProvingSystem {
pub const fn as_u16(self) -> u16 {
self as u16
}

pub const fn id(self) -> u16 {
self.as_u16()
}

pub const fn id_bytes(self) -> [u8; 2] {
self.as_u16().to_be_bytes()
}
}

impl TryFrom<u8> for AggregationModeProvingSystem {
type Error = ();

fn try_from(v: u8) -> Result<Self, Self::Error> {
match v {
0 => Ok(AggregationModeProvingSystem::SP1),
1 => Ok(AggregationModeProvingSystem::RISC0),
_ => Err(()),
}
}
}

#[derive(Debug)]
pub enum AggregationModeVerificationData {
SP1 {
Expand Down Expand Up @@ -30,10 +63,25 @@ impl AggregationModeVerificationData {
}
}

pub fn proving_system_id(&self) -> u16 {
match self {
Self::SP1 { .. } => AggregationModeProvingSystem::SP1.id(),
Self::Risc0 { .. } => AggregationModeProvingSystem::RISC0.id(),
}
}

pub fn proving_system_id_bytes(&self) -> [u8; 2] {
match self {
Self::SP1 { .. } => AggregationModeProvingSystem::SP1.id_bytes(),
Self::Risc0 { .. } => AggregationModeProvingSystem::RISC0.id_bytes(),
}
}

pub fn commitment(&self) -> [u8; 32] {
match self {
AggregationModeVerificationData::SP1 { vk, public_inputs } => {
let mut hasher = Keccak256::new();
hasher.update(self.proving_system_id_bytes());
hasher.update(vk);
hasher.update(public_inputs);
hasher.finalize().into()
Expand All @@ -43,6 +91,7 @@ impl AggregationModeVerificationData {
public_inputs,
} => {
let mut hasher = Keccak256::new();
hasher.update(self.proving_system_id_bytes());
hasher.update(image_id);
hasher.update(public_inputs);
hasher.finalize().into()
Expand Down
11 changes: 9 additions & 2 deletions examples/l2/contracts/src/StateTransition.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ contract StateTransition {
stateRoot = initialStateRoot;
}

function updateState(bytes calldata publicInputs, bytes32[] calldata merkleProof) public onlyOwner {
function updateState(uint16 provingSystemId, bytes calldata publicInputs, bytes32[] calldata merkleProof)
public
onlyOwner
{
bytes memory callData = abi.encodeWithSignature(
"verifyProofInclusion(bytes32[],bytes32,bytes)", merkleProof, PROGRAM_ID, publicInputs
"verifyProofInclusion(bytes32[],uint16,bytes32,bytes)",
merkleProof,
provingSystemId,
PROGRAM_ID,
publicInputs
);
(bool callResult, bytes memory response) = alignedProofAggregator.staticcall(callData);
if (!callResult) {
Expand Down
Loading
Loading