feat(#738): add criterion benchmark suite for contract hot paths#838
Merged
Haroldwonder merged 1 commit intoJun 29, 2026
Merged
Conversation
…t paths Add a benches/ directory with a criterion-based benchmark suite that establishes performance baselines for the three most performance-sensitive contract entry points so regressions can be caught between releases: - submit_attestation (auth + ed25519 verify + storage write) - get_anchor_health_score (cached-metadata read + weighted scoring) - route_transaction (anchor filtering + quote selection, parameterized by anchor-set size) The benches drive the contract through the Soroban test harness as an external consumer of the crate. To support this: - Re-export AnchorKitContractClient and the routing/metadata types from the crate root (previously only reachable via #[cfg(test)] modules). - Add criterion as a dev-dependency and a [[bench]] target (harness = false). - Add a [profile.bench] override (opt-level = 3) since the release profile is tuned for wasm size, not native execution speed. - Reproduce the SEP-10 registration / payload-signing helpers locally, as their in-crate counterparts are gated behind #[cfg(test)]. Also add a make bench target and document the suite in the README.
|
@theo372001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a criterion benchmark suite that establishes performance baselines for the contract's hot paths, so performance regressions can be tracked between releases (issue #738). The suite covers
submit_attestation,get_anchor_health_score, androute_transaction.Type of Change
Related Issues
Closes #738
Changes Made
benches/hot_paths.rs- a criterion suite benchmarkingsubmit_attestation(auth + ed25519 verify + replay check + storage write),get_anchor_health_score(cached-metadata read + weighted scoring), androute_transaction(anchor filtering + quote selection, parameterized over anchor-set sizes 1 / 5 / 10 / 25).AnchorKitContractClientand the routing/metadata types (RoutingOptions,RoutingRequest,AnchorMetadata) from the crate root so the benches can drive the contract through the Soroban test harness as an external consumer (these were previously reachable only from#[cfg(test)]modules).criterionas a dev-dependency and a[[bench]]target (harness = false).[profile.bench]override (opt-level = 3); thereleaseprofile is tuned for wasm size (opt-level = "z"), not native execution speed.make benchtarget and document the suite in the README.Testing
cargo test)Test Coverage
Documentation
Breaking Changes
Checklist
Additional Notes
The branch does not compile yet because of pre-existing, unrelated build errors in the library, present on
mainas well and untouched by this PR - for example:src/retry.rs(ErrorCode::X as u32used as a pattern),mod sep6;declaration insrc/lib.rs(which haspub use sep6::{...}),revoke_attestationdefinitions insrc/contract.rs.These need to be resolved separately for the suite to execute via
cargo bench(ormake bench).