Skip to content

Conversation

@avilagaston9
Copy link
Contributor

@avilagaston9 avilagaston9 commented Jun 19, 2025

Motivation

Aligned verifies proofs in batches, so it's possible to have an array of proofs ready to be verified at once.

Description

  • Modifies l1_proof_verifier to check all already aggregated proofs and build a single verify transaction for them.
  • Updates verifyBatchAligned() in the OnChainProposer contract to accept an array of proofs.

Warning

#3276 was accidentally merged into this PR, so the diff includes changes from both.

Closes #3168

Base automatically changed from l2/refactor/aligned_use_hardcoded_vk to main June 24, 2025 19:17
@lambdaclass lambdaclass deleted a comment from notion-workspace bot Jun 24, 2025
> [!WARNING]
> Merge after #3242 

**Motivation**

In case one RPC or Beacon client fails, we should retry with others to
avoid getting stuck.

**Description**

- Implements a wrapper over `aligned_sdk::estimate_fee()` to retry using
all available RPC urls.
- Implements a wrapper over `aligned_sdk::check_proof_verification()` to
retry using all available RPC and Beacon clients.

Closes #3059
Copy link
Contributor

@ManuelBilbao ManuelBilbao left a comment

Choose a reason for hiding this comment

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

Looks good, just some little comments

Comment on lines 183 to 194
loop {
if !batch_number_has_all_needed_proofs(batch_number, &[ProverType::Aligned])
.is_ok_and(|has_all_proofs| has_all_proofs)
{
return Ok(proofs);
}
proofs.push((
batch_number,
read_proof(batch_number, StateFileType::BatchProof(ProverType::Aligned))?,
));
batch_number += 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit

Suggested change
loop {
if !batch_number_has_all_needed_proofs(batch_number, &[ProverType::Aligned])
.is_ok_and(|has_all_proofs| has_all_proofs)
{
return Ok(proofs);
}
proofs.push((
batch_number,
read_proof(batch_number, StateFileType::BatchProof(ProverType::Aligned))?,
));
batch_number += 1;
}
while !batch_number_has_all_needed_proofs(batch_number, &[ProverType::Aligned])
.is_ok_and(|has_all_proofs| has_all_proofs) {
proofs.push((
batch_number,
read_proof(batch_number, StateFileType::BatchProof(ProverType::Aligned))?,
));
batch_number += 1;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 8c1dfae!

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to update this functions too as in non-based ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Updated here cb11a21

Comment on lines 333 to 336
require(
batchNumber == lastVerifiedBatch + 1,
"OnChainProposer: incorrect batch number"
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be checked just for firstBatchNumber outside the loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right! Done 52d4f58.

@avilagaston9 avilagaston9 enabled auto-merge June 30, 2025 14:53
@avilagaston9 avilagaston9 added this pull request to the merge queue Jun 30, 2025
Merged via the queue into main with commit bc56f47 Jun 30, 2025
34 of 37 checks passed
@avilagaston9 avilagaston9 deleted the feat/l2/aligned_verify_chunk branch June 30, 2025 15:48
@avilagaston9 avilagaston9 mentioned this pull request Jun 30, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jun 30, 2025
**Motivation**

In #3242, `verifyBatchesAligned()` was updated in the based
`OnChainProposer` to be consistent with the non-based one, but the
`onlySequencer` identifier was added by mistake.

**Description**

Removes the `onlySequencer` identifier.

Closes None
avilagaston9 added a commit that referenced this pull request Jun 30, 2025
**Motivation**

In #3242, `verifyBatchesAligned()` was updated in the based
`OnChainProposer` to be consistent with the non-based one, but the
`onlySequencer` identifier was added by mistake.

**Description**

Removes the `onlySequencer` identifier.

Closes None
d-roak pushed a commit to 1sixtech/ethrex that referenced this pull request Jul 17, 2025
**Motivation**

Aligned verifies proofs in batches, so it's possible to have an array of
proofs ready to be verified at once.

**Description**

- Modifies `l1_proof_verifier` to check all already aggregated proofs
and build a single verify transaction for them.
- Updates `verifyBatchAligned()` in the `OnChainProposer` contract to
accept an array of proofs.

> [!WARNING]
> lambdaclass#3276 was accidentally merged into this PR, so the diff includes
changes from both.

Closes lambdaclass#3168

---------

Co-authored-by: Ivan Litteri <[email protected]>
d-roak pushed a commit to 1sixtech/ethrex that referenced this pull request Jul 17, 2025
**Motivation**

In lambdaclass#3242, `verifyBatchesAligned()` was updated in the based
`OnChainProposer` to be consistent with the non-based one, but the
`onlySequencer` identifier was added by mistake.

**Description**

Removes the `onlySequencer` identifier.

Closes None
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
**Motivation**

Aligned verifies proofs in batches, so it's possible to have an array of
proofs ready to be verified at once.

**Description**

- Modifies `l1_proof_verifier` to check all already aggregated proofs
and build a single verify transaction for them.
- Updates `verifyBatchAligned()` in the `OnChainProposer` contract to
accept an array of proofs.

> [!WARNING]
> lambdaclass#3276 was accidentally merged into this PR, so the diff includes
changes from both.

Closes lambdaclass#3168

---------

Co-authored-by: Ivan Litteri <[email protected]>
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
**Motivation**

In lambdaclass#3242, `verifyBatchesAligned()` was updated in the based
`OnChainProposer` to be consistent with the non-based one, but the
`onlySequencer` identifier was added by mistake.

**Description**

Removes the `onlySequencer` identifier.

Closes None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L2 Rollup client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

L2(aligned): Verify an array of batch proofs in a single transaction

4 participants