feat(backend): expose backend capabilities#256
Open
wolf31o2 wants to merge 1 commit into
Open
Conversation
wolf31o2
force-pushed
the
codex-audit-capabilities
branch
from
July 21, 2026 21:45
72f15e4 to
9f50eef
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an optional capability-reporting layer for backend.ChainContext implementations, allowing callers to detect which operations a backend truly supports while preserving source compatibility for existing third-party contexts. It also standardizes “unsupported operation” failures via a typed ErrUnsupported / UnsupportedError, and tightens UTxO RPC evaluation behavior by rejecting unsupported additionalUtxos.
Changes:
- Add
Capability,CapabilitySet,CapabilityReporter, and typedErrUnsupported/UnsupportedErrorto the backend interface layer. - Implement
Capabilities()and returnErrUnsupportedfor unavailable operations across multiple backends (and wrappers). - Add/extend tests to validate capability reporting and unsupported-operation error identity.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/base.go | Introduces capability types/reporting helpers and the typed unsupported error used by backends. |
| backend/capabilities_test.go | Adds unit coverage for CapabilitySet.Has, legacy default behavior, and ErrUnsupported identity. |
| backend/blockfrost/blockfrost.go | Adds capability reporting (not advertising general additional-UTxO evaluation support). |
| backend/blockfrost/blockfrost_test.go | Tests Blockfrost capability reporting expectations. |
| backend/maestro/maestro.go | Adds capability reporting and returns typed unsupported errors for unsupported operations. |
| backend/maestro/maestro_test.go | Verifies Maestro capability reporting and typed unsupported error for GenesisParams. |
| backend/ogmios/ogmios.go | Adds capability reporting that depends on whether Kupo is configured; returns typed unsupported errors when Kupo is missing. |
| backend/ogmios/ogmios_test.go | Verifies capability reporting and typed unsupported errors for Ogmios-without-Kupo. |
| backend/utxorpc/utxorpc.go | Adds capability reporting, converts unsupported operations to typed errors, and rejects non-empty additionalUtxos for EvaluateTx. |
| backend/utxorpc/utxorpc_test.go | Tests UTxO RPC capabilities and typed unsupported errors for unsupported operations. |
| backend/cache/cache.go | Adds Capabilities() passthrough so cached contexts preserve wrapped capability sets. |
| backend/cache/cache_test.go | Tests that cached contexts preserve capability reporting. |
| backend/fixed/fixed.go | Adds capability reporting and converts several operations to typed unsupported errors (including changing some previously-successful stub returns). |
| backend/fixed/fixed_test.go | Tests fixed context capability reporting and typed unsupported errors for unsupported operations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+159
to
+161
| // see on-chain. Check CapabilityEvaluateTxAdditionalUtxos before relying on | ||
| // these UTxOs; backends that do not support them return ErrUnsupported when | ||
| // additionalUtxos is non-empty. |
Comment on lines
117
to
119
| func (f *FixedChainContext) CurrentEpoch() (uint64, error) { | ||
| return 0, nil | ||
| return 0, backend.NewUnsupportedError("fixed chain context", backend.CapabilityCurrentEpoch) | ||
| } |
wolf31o2
force-pushed
the
codex-audit-capabilities
branch
from
July 21, 2026 22:42
9f50eef to
8c76d82
Compare
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.
Summary
Validation