Skip to content

Conversation

neithanmo
Copy link
Collaborator

Summary

This PR implements comprehensive support for Horizon (V2) TAP receipts by adding dual domain separator configuration and proper V2 verifier address handling across all services. This completes the foundation for full Horizon migration support in the indexer-rs ecosystem.

Changes Made

Configuration Updates

  • Added receipts_verifier_address_v2 field to BlockchainConfig for separate V2 contract addresses
  • Updated configuration examples (minimal and maximal) with documentation for the new V2 verifier field
  • Enhanced contrib scripts to extract and use both V1 (TAPVerifier) and V2 (GraphTallyCollector) addresses from horizon.json

Service Updates

  • Updated indexer-service to use correct V2 verifier address for domain separator creation
  • Updated tap-agent to use correct V2 verifier address for global domain separators
  • Added invariant validation: When horizon.enabled = true, receipts_verifier_address_v2 must be explicitly configured (fails fast with clear error)
  • Graceful fallback: When horizon.enabled = false, V2 operations fall back to V1 verifier address if V2 isn't specified

Infrastructure Updates

  • Updated integration test setup to support direct RAV testing workflows

Key Behavioral Changes

Horizon Configuration Invariants

  1. When horizon.enabled = true: Both services require explicit V2 verifier configuration and will fail fast with:

    receipts_verifier_address_v2 is required when Horizon is enabled
    
  2. When horizon.enabled = false: Both services gracefully fall back to V1 addresses for V2 domains

Domain Separator Logic

  • V1 domains: Always use receipts_verifier_address
  • V2 domains:
    • If Horizon enabled: Use receipts_verifier_address_v2 (required)
    • If Horizon disabled: Use receipts_verifier_address_v2 or fallback to receipts_verifier_address

Configuration Example

[blockchain]
chain_id = 1337
# V1 TAP verifier contract address
receipts_verifier_address = "0x1111111111111111111111111111111111111111"
# V2 (Horizon) verifier contract address - required when horizon.enabled = true
receipts_verifier_address_v2 = "0x2222222222222222222222222222222222222222"

[horizon]
# Enable Horizon migration support
enabled = true

Impact

This change resolves the "No sender found for signer" errors that occurred when V2 receipts were validated against incorrect verifier contracts. The dual domain approach ensures:

  • Correct cryptographic validation for both V1 and V2 receipt formats
  • Smooth migration path from legacy V1 to Horizon V2
  • Clear error reporting when configuration is incomplete
  • Backward compatibility for existing V1-only deployments

Testing

  • Configuration validation works correctly
  • Services fail fast when Horizon is enabled without V2 verifier
  • Services fall back gracefully when Horizon is disabled
  • Integration tests pass with dual domain support

Fix the TODO comment about mapping allocation types - now properly
detects Horizon contracts and maps allocations accordingly instead
of always using Legacy type
…able context

Enhance RAV request error messages to indicate which receipt table
(V1/Legacy vs V2/Horizon) was queried, helping with Horizon migration debugging
…acking

Add comprehensive debug and info logging throughout the allocation and escrow
account systems to improve troubleshooting of receipt processing, RAV generation, and
Horizon migration issues.
  - Reduce timestamp buffer from 1000s to 30s for faster RAV generation
  - Add trigger_value_divisor configuration for fine-tuned receipt batching
  - Set max_receipt_value_grt to 0.001 for controlled testing
  - Update tap-aggregator endpoint port configuration
@neithanmo neithanmo marked this pull request as draft August 22, 2025 14:40
  Add dual domain separator support for V1 (TAP) and V2 (GraphTally)
  protocols. This enables simultaneous processing of both legacy and
  Horizon receipt types with version-appropriate EIP712 domains
  Update service components to support both V1 and V2 domain separators
  simultaneously. Includes IndexerTapContext, ServiceRouter, and
  middleware updates for version-aware receipt processing.
  Critical fix for V2 receipt processing failures. Store receipts using
  version-appropriate domain separators to ensure correct signer recovery
  and escrow account lookup. Resolves "signer not found in V2 escrow accounts" errors.
  Implement version-aware receipt authorization that routes V1 and V2
  receipts to appropriate TAP managers. Includes new dual_tap_receipt_authorize
  function for simultaneous protocol support.
  Update sender middleware to use version-appropriate domain separators
  for signer recovery. V1 receipts use legacy domain, V2 receipts use
  Horizon domain for correct escrow account lookups.
  Add V2 domain separator support to sender account management, allocation
  handling, and receipt processing. Maintains single allocation type invariant
  while enabling version-appropriate domain usage.
  Update receipt validation checks and test infrastructure to support
  dual domain separators. Ensures proper EIP712 domain usage for
  both V1 and V2 receipt types in testing scenarios.
  Update integration tests, TAP agent tests, and service router tests
  to support V1/V2 dual domain architecture. Ensures comprehensive
  testing coverage for both protocol versions.
  - Add optional receipts_verifier_address_v2 to BlockchainConfig
  - Update configuration examples with V2 verifier documentation
  - Prepare infrastructure for dual domain separator support
  - Update indexer-service and tap-agent to use correct V2 verifier addresses
  - Add strict validation: V2 address required when horizon.enabled=true
  - Implement graceful fallback when Horizon is disabled
  - Remove static config.toml files from indexer-service and tap-agent
  - Update Dockerfiles to rely on start.sh for dynamic config generation
  - Clean up docker-compose.dev.yml by removing commented static config mounts
  - Ensure consistent contract file mounting across all Docker configurations
Copy link
Contributor

github-actions bot commented Aug 22, 2025

Pull Request Test Coverage Report for Build 17218027720

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 420 of 2143 (19.6%) changed or added relevant lines in 28 files are covered.
  • 13 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-6.5%) to 69.418%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/service/src/middleware/sender.rs 2 3 66.67%
crates/tap-agent/src/agent/sender_account.rs 100 102 98.04%
crates/tap-agent/src/agent/sender_allocation.rs 10 12 83.33%
crates/tap-agent/src/tracker/sender_fee_stats.rs 13 15 86.67%
crates/tap-agent/src/tracker/generic_tracker.rs 31 34 91.18%
integration-tests/src/signature_test.rs 0 4 0.0%
crates/monitor/src/allocations.rs 0 7 0.0%
integration-tests/src/main.rs 0 7 0.0%
crates/service/src/middleware/auth/tap.rs 51 60 85.0%
crates/tap-agent/src/agent.rs 0 13 0.0%
Files with Coverage Reduction New Missed Lines %
crates/monitor/src/allocations.rs 1 0.0%
crates/tap-agent/src/agent/sender_allocation.rs 1 81.68%
integration-tests/src/signature_test.rs 1 0.0%
crates/tap-agent/src/agent.rs 2 0.0%
crates/tap-agent/src/agent/sender_account.rs 2 91.96%
integration-tests/src/utils.rs 2 0.0%
crates/tap-agent/src/agent/sender_accounts_manager.rs 4 87.32%
Totals Coverage Status
Change from base Build 17041594178: -6.5%
Covered Lines: 12832
Relevant Lines: 18485

💛 - Coveralls

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.

1 participant