Skip to content

chore!: remove support for legacy v1 receipts#929

Merged
suchapalaver merged 39 commits intomainfrom
chore/remove-support-forlegacy-v1-receipts
Feb 5, 2026
Merged

chore!: remove support for legacy v1 receipts#929
suchapalaver merged 39 commits intomainfrom
chore/remove-support-forlegacy-v1-receipts

Conversation

@suchapalaver
Copy link
Copy Markdown
Collaborator

@suchapalaver suchapalaver commented Feb 4, 2026

PR Summary: Remove Legacy V1 TAP Receipt Support

Overview

This PR removes support for legacy TAP V1 receipts, making Horizon (V2) mode mandatory. This is a breaking change that simplifies the codebase by removing ~3900 lines of legacy code paths.

What Changed

  • TapReceipt: Simplified from an enum (V1/V2 variants) to a newtype wrapping only Horizon v2 receipts
  • Configuration: horizon.enabled = true and receipts_verifier_address_v2 are now required
  • TAP Checks: All V1-specific validation branches removed
  • Receipt Storage: V1 receipt table (scalar_tap_receipts) no longer written to
  • Metrics: Legacy non-versioned counters removed in favor of _by_version variants

Breaking Changes

Configuration

Field Before After
horizon.enabled Optional, default false Required, must be true
blockchain.receipts_verifier_address_v2 Optional Required
blockchain.receipts_verifier_address Required Deprecated, optional
blockchain.subgraph_service_address Optional Required

Metrics Removed

The following metrics have been removed. Use the _by_version equivalents instead:

  • tap_ravs_created_total → use tap_ravs_created_total_by_version
  • tap_ravs_failed_total → use tap_ravs_failed_total_by_version
  • tap_rav_response_time_seconds → use tap_rav_response_time_seconds_by_version

Migration Guide

  1. Update configuration:

    [horizon]
    enabled = true  # Now required
    
    [blockchain]
    chain_id = 1
    receipts_verifier_address_v2 = "0x..."  # Now required
    subgraph_service_address = "0x..."      # Now required
    # receipts_verifier_address is deprecated and can be removed
  2. Update monitoring dashboards: Replace any references to the removed metrics with their _by_version equivalents. The version label will always be "v2".

  3. Ensure Horizon contracts are deployed: The service will fail to start if the Network Subgraph indicates Horizon is not active.

Recommendations for Release

  1. Release Notes: Document the breaking configuration changes prominently. Users on legacy mode must update their configuration before upgrading.

  2. Migration Documentation: Update existing migration guides to note that Horizon mode is now mandatory. Legacy V1 receipts will no longer be accepted or processed.

  3. Monitoring Alerts: Notify users that the non-versioned metrics (tap_ravs_created_total, tap_ravs_failed_total, tap_rav_response_time_seconds) have been removed. Dashboards and alerts referencing these metrics must be updated to use the _by_version variants.

Testing

  • All tests updated to use V2 receipts
  • Legacy V1-specific tests removed

Signed off by Joseph Livesey joseph@semiotic.ai

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 5, 2026

Pull Request Test Coverage Report for Build 21724618860

Details

  • 1083 of 1300 (83.31%) changed or added relevant lines in 33 files are covered.
  • 22 unchanged lines in 10 files lost coverage.
  • Overall coverage increased (+1.6%) to 71.076%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/service/src/tap/checks/allocation_redeemed.rs 2 3 66.67%
crates/service/src/tap/receipt_store.rs 21 22 95.45%
crates/tap-agent/src/lib.rs 0 1 0.0%
crates/attestation/src/lib.rs 3 6 50.0%
crates/service/src/tap/checks/deny_list_check.rs 26 29 89.66%
crates/dips/src/database.rs 19 24 79.17%
crates/indexer-receipt/src/lib.rs 12 18 66.67%
crates/service/src/service/router.rs 7 16 43.75%
crates/tap-agent/src/agent/sender_account.rs 223 233 95.71%
crates/config/src/config.rs 5 17 29.41%
Files with Coverage Reduction New Missed Lines %
crates/dips/src/database.rs 1 94.48%
crates/indexer-receipt/src/lib.rs 1 84.75%
crates/service/src/service.rs 1 0.0%
crates/service/src/tap/checks/deny_list_check.rs 1 95.54%
crates/tap-agent/src/agent/sender_accounts_manager.rs 1 87.25%
crates/tap-agent/src/tap/context/receipt.rs 1 86.52%
crates/config/src/config.rs 2 83.2%
crates/watcher/src/lib.rs 3 82.65%
crates/tap-agent/src/agent/sender_allocation.rs 4 93.52%
crates/tap-agent/src/agent/sender_account.rs 7 92.66%
Totals Coverage Status
Change from base Build 21724496463: 1.6%
Covered Lines: 10402
Relevant Lines: 14635

💛 - Coveralls

BREAKING CHANGE: TAP agent now requires Horizon mode to be enabled.
Legacy V1 receipt handling has been removed in favor of exclusive V2
(Horizon) protocol support. The V1 escrow accounts watcher and hybrid
migration mode are no longer available.
Remove unused escrow sync interval variable and streamline the Horizon
mode validation logic by using early returns instead of nested
conditionals with unreachable branches.
…ng fails

Add contextual information (notification id and signer address) to the
error when collection_id parsing fails, making debugging easier when
receipt notifications contain malformed data.

Also consolidates the SUBGRAPH_SERVICE_ADDRESS test constant to avoid
duplication across test modules.
…mode is required

Remove unreachable legacy fallback branch in sender account initialization.
Since the agent now requires Horizon mode, the denylist check is always
performed against tap_horizon_denylist.
…lpers

- Remove unreachable legacy fallback branch in sender denylist check since
  Horizon mode is now required
- Extract duplicated deny state retry loops into `wait_for_deny_state` helper
  for more robust and readable tests
Clarify that Horizon mode is now required throughout tap-agent:
- Update error messages to remove references to disabling Horizon
- Simplify tap_mode field documentation since legacy mode is removed
- Add context to legacy metric counters explaining backwards compatibility
The startup error message suggested users could disable Horizon via config,
but this option is no longer available since Horizon mode is now required.
Re-export TAP_EIP712_DOMAIN and VERIFIER_ADDRESS from test_assets instead
of duplicating the definitions in tap-agent's test module.
… required

Remove redundant `is_horizon()` conditionals that were always true since
the agent now requires Horizon mode at startup. Also convert denylist
queries to runtime execution to avoid compile-time database dependency.
Use `wait_for_deny_state` helper in pending RAVs test to account for
async message processing. Update snapshot for allocation update test
to reflect actual message ordering.
…ering

Use `wait_for_deny_state` helper in pending RAVs test to account for
async message processing. Remove flaky snapshot assertion that depended
on specific message ordering between async watchers.
…rizon tables

During migration from legacy allocations to Horizon, some receipts and RAVs may
contain 20-byte allocation IDs instead of 32-byte collection IDs. Instead of
panicking on these invalid entries, skip them with a warning to allow the system
to continue processing valid receipts.
Now that Horizon mode is required, the V1 receipts domain is no longer needed.
All TAP receipt handling now uses Horizon V2 receipts exclusively.
Legacy V1 tests and helpers are no longer needed since V1 receipt
support was removed in prior commits.
Remove legacy V1 receipt handling from the service crate, requiring only
V2 escrow accounts. This simplifies the TAP receipt processing pipeline
by eliminating the dual V1/V2 domain separator logic and consolidating
on the Horizon-compatible receipt format.
…pport

Remove the Legacy network version type and all V1-specific code paths
from tap-agent. The AllocationId enum is now a simple wrapper around
CollectionId. This removes ~900 lines of legacy RAV/receipt handling,
V1 escrow subgraph client, and dual-version metrics.
…port

Remove V1 variants and Option wrappers throughout the codebase now that
TAP V2 (Horizon) is required. This eliminates version branching in receipt
handling, RAV aggregation, and database queries.
Remove V1/V2 versioning terminology and migration references now that
legacy V1 receipt support has been dropped. Horizon is now the only
supported production mode.
Rename `derive_key_pair_v1`/`derive_key_pair_v2` to
`derive_key_pair_primary`/`derive_key_pair_fallback` to better describe
their roles rather than suggesting a versioning relationship with the
recently removed TAP V1/V2 receipt types.
Remove legacy fallback logic from EIP-712 domain separator setup since
Horizon mode is now required. Also update config comments to use
consistent "Horizon" terminology instead of "V2".
…d param

Simplify startup validation since Horizon mode is now always required,
making the DIPS-specific horizon check redundant. Also remove unused
allocation_id parameter from tap_allocation_redeemed_watcher.
Horizon is now mandatory—configs with `horizon.enabled = false` are
rejected at validation time. The default value is changed to `true`
to match this requirement.
Config examples and defaults now include the required Horizon addresses
(subgraph_service_address, receipts_verifier_address_v2) that must be
set for operation.
Remove leftover "V1 tests removed" comments and update documentation to
use consistent language for the deprecated verifier address field.
Since Horizon mode is mandatory, the escrow accounts v2 watcher is
always present. Remove Option wrapper to simplify code paths and fail
fast if the watcher is missing.
Since Horizon mode is now mandatory, remove redundant "When
horizon.enabled = true" prefix from error messages. Also add TODO for
eventual removal of 20-byte allocation ID migration fallback.
Add `horizon_receipts_verifier_address()` helper to `BlockchainConfig`
that enforces the validation requirement for `receipts_verifier_address_v2`,
reducing duplication and making the contract clearer.
Mark `receipts_verifier_address` as deprecated with a compiler warning
since Horizon mode now uses `receipts_verifier_address_v2` exclusively.
The subgraph query API returns Result<Data, Error>, not
Result<Result<Data, Error>, Error>. Several match patterns were
incorrectly nested after the V1 removal refactor. Also adds explicit
type annotation for redeemed_ids vec to resolve type inference.
Tests no longer need to mock the escrow subgraph since V1 receipt
handling was removed. Also renames mock variable to reflect its
actual purpose (network subgraph for redeemed allocation checks).
Add comprehensive tests covering RAV requests, allocation closure,
unaggregated fee calculation, invalid receipt handling, and edge cases
for the Horizon-only TAP protocol implementation.
Users can now omit the deprecated receipts_verifier_address field from
their config files entirely. This reduces config clutter as the field
was only kept for backward compatibility and is not used since the
switch to Horizon receipts.
Error messages now explain that Horizon is required, rather than just
stating that fields must be set, making it clearer why configuration
is needed.
Drain startup messages before asserting on periodic reconciliation
and tolerate interleaved messages that may arrive during time
advancement.
Remove unnecessary Option wrapper from subgraph_service_address() since
Horizon mode is now required. Also fix typo in receipts_len variable and
remove obsolete TODO comment.
The receipts_verifier_address_v2 field is now a required Address instead
of Option<Address>, enforced at config load time rather than runtime
validation. This simplifies accessor methods and removes unnecessary
Option handling throughout the codebase.
…eceipts

Replace the TapReceipt enum (which only had a V2 variant) with a newtype
struct, removing the unnecessary match arms and accessor methods across
receipt handling, TAP checks, and agent code.
@suchapalaver suchapalaver force-pushed the chore/remove-support-forlegacy-v1-receipts branch from d11e17a to eb8777d Compare February 5, 2026 19:01
@suchapalaver suchapalaver merged commit 262c908 into main Feb 5, 2026
12 checks passed
@suchapalaver suchapalaver deleted the chore/remove-support-forlegacy-v1-receipts branch February 5, 2026 19:48
This was referenced Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allocation_middleware does not extract allocation from V2 receipts, causing attestation verification failures

3 participants