Enforce ABI-version compatibility between aggregator and its target shards (#432) - #440
Merged
Inkman007 merged 1 commit intoJul 21, 2026
Conversation
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.
Closes #432
Problem
ledgerlens-aggregatorregisteredledgerlens-scoreshards viaadd_shardwith no check that a candidate shard actually implements the interface version the aggregator expects. A shard whose interface had drifted (older build, changed signature) would be accepted silently, surfacing later as failed or subtly incorrect cross-contract calls instead of a clear error at registration time.Changes
add_shardnow verifies compatibility before accepting a shard. It calls the candidate'ssupports_interfacefor each capability the aggregator invokes on shards —score(get_score),gate(query_risk_gate), andaggr(get_aggregate_score) — and rejects the shard unless all are supported. The call is made defensively viatry_supports_interface, so a shard lacking the function (an older/drifted build) traps gracefully and is treated as incompatible rather than aborting the registration transaction.Error::IncompatibleInterface. Because the#[contracterror]enum is at the hard 50-variant XDR limit, this follows the crate's existing alias pattern.docs/interface-spec.md§3: an additive shard upgrade that keeps the three required capabilities still registers cleanly.docs/interface-spec.mddefines the targeted interface version, the required capabilities, the enforcement behavior, and the rationale.Tests
Added to
contracts/ledgerlens-aggregator/src/test.rs:LedgerLensScoreContractaggrsupports_interfaceentirelyVerification
ledgerlens-score: 879 passed, 6 ignored, 0 failedcargo build --workspaceand clippy clean