Skip to content

feat(agglayer): add CLAIM note cycle count benchmark#2618

Open
partylikeits1983 wants to merge 4 commits intoagglayerfrom
ajl-claim-cycle-benchmark
Open

feat(agglayer): add CLAIM note cycle count benchmark#2618
partylikeits1983 wants to merge 4 commits intoagglayerfrom
ajl-claim-cycle-benchmark

Conversation

@partylikeits1983
Copy link
Contributor

This PR adds an assertion to the CLAIM note tests which asserts that the cycle count for consuming a CLAIM note should be less than 40k cycles.

Currently the CLAIM note takes ~25662 cycles for L1 to Miden bridging, and ~38547 cycles for L2 to Miden bridging.

Resolves #2590

@partylikeits1983 partylikeits1983 changed the base branch from next to agglayer March 17, 2026 13:51
@partylikeits1983 partylikeits1983 marked this pull request as ready for review March 17, 2026 14:48
@partylikeits1983 partylikeits1983 added no changelog This PR does not require an entry in the `CHANGELOG.md` file agglayer PRs or issues related to AggLayer bridging integration benchmarks Improvements to benchmarks pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority labels Mar 17, 2026
@partylikeits1983 partylikeits1983 requested review from Fumuran and mmagician and removed request for Fumuran March 17, 2026 14:49
@bobbinth
Copy link
Contributor

Currently the CLAIM note takes ~25662 cycles for L1 to Miden bridging, and ~38547 cycles for L2 to Miden bridging.

Nice! So, we should definitely set the max for network note execution above 32K cycles. Maybe 64K cycles? cc @Mirko-von-Leipzig (not sure what it is set at currently).

Also, how difficult is it to add an actual benchmark? (i.e., similar to what we have for P2ID notes)

@Mirko-von-Leipzig
Copy link
Contributor

Mirko-von-Leipzig commented Mar 17, 2026

We don't explicitly configure the executor, so we get the default values for expected and max cycles.

afaict this is set to 536 870 912

    pub const MAX_CYCLES: u32 = 1 << 29;

@partylikeits1983
Copy link
Contributor Author

Also, how difficult is it to add an actual benchmark? (i.e., similar to what we have for P2ID notes)

I think it would be easy, will update to be more of a true benchmark.

@partylikeits1983 partylikeits1983 self-assigned this Mar 17, 2026
@partylikeits1983 partylikeits1983 marked this pull request as draft March 17, 2026 16:10
@bobbinth
Copy link
Contributor

We don't explicitly configure the executor, so we get the default values for expected and max cycles.

afaict this is set to 536 870 912

    pub const MAX_CYCLES: u32 = 1 << 29;

Ah - let's create an issue in the node to add such a cap (unless we have such an issue already).

@partylikeits1983 partylikeits1983 marked this pull request as ready for review March 18, 2026 13:39
Copy link
Collaborator

@mmagician mmagician left a comment

Choose a reason for hiding this comment

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

While on it, could we further add benchmarks for B2AGG note?


/// Bridge asset test vectors JSON — contains test data for an L1 bridgeAsset transaction.
const BRIDGE_ASSET_VECTORS_JSON: &str = include_str!(
"../../../crates/miden-agglayer/solidity-compat/test-vectors/claim_asset_vectors_local_tx.json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this path looks a bit fragile.
The alternative would be to move the test vector generation here (build script?) which I think is even worse 😁

other ideas welcome

Comment on lines +61 to +71
#[derive(Debug, Deserialize)]
struct LeafValueVector {
origin_network: u32,
origin_token_address: String,
#[allow(dead_code)]
destination_network: u32,
destination_address: String,
#[serde(deserialize_with = "deserialize_uint_to_string")]
amount: String,
metadata_hash: String,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we not re-use this from the testing crate? looks like a lot of duplicated code

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

Labels

agglayer PRs or issues related to AggLayer bridging integration benchmarks Improvements to benchmarks no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AggLayer: benchmark CLAIM note processing

4 participants