-
Notifications
You must be signed in to change notification settings - Fork 8
feat: support horizon #1109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support horizon #1109
Conversation
3fabe65 to
89f8847
Compare
src/reports.rs
Outdated
| request: Some(indexer_request.request).filter(|r| r.len() <= MAX_PAYLOAD_BYTES), | ||
| response: Some(original_response).filter(|r| r.len() <= MAX_PAYLOAD_BYTES), | ||
| allocation: indexer_request.receipt.allocation().0.0.into(), | ||
| allocation: indexer_request.receipt.collection().as_address().to_vec(), // Collection ID as address for compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldnt this be collection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Thank you!
Signed-off-by: Joseph Livesey <joseph@semiotic.ai>
| request: Some(indexer_request.request).filter(|r| r.len() <= MAX_PAYLOAD_BYTES), | ||
| response: Some(original_response).filter(|r| r.len() <= MAX_PAYLOAD_BYTES), | ||
| allocation: indexer_request.receipt.allocation().0.0.into(), | ||
| allocation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this @tmigone is being consumed by other components I think and so I'm being conservative about changing the interface and that's what I'm trying to get at in the comments.
Signed-off-by: Joseph Livesey <joseph@semiotic.ai>
Signed-off-by: Joseph Livesey <joseph@semiotic.ai>
Signed-off-by: Joseph Livesey <joseph@semiotic.ai>
Signed-off-by: Joseph Livesey <joseph@semiotic.ai>
29cca04 to
b533d22
Compare
Signed-off-by: Joseph Livesey <joseph@semiotic.ai>
Signed-off-by: Joseph Livesey <joseph@semiotic.ai>
|
Closing this PR in favor of: #1119. It contains the same changes with added fixes. |
_Note_: This PR contains changes from Semiotic [PR](#1109) for horizon support with additional fixes. Original PR description below. # Horizon Gateway Upgrade This horizon gateway provides TAP v2 receipt generation. ## Overview This is a horizon-ready gateway that replaces TAP receipt generation with TAP v2 receipts on the existing [edgeandnode/gateway](https://github.com/edgeandnode/gateway). ## Key Changes from Pre-Horizon Gateway ### TAP Protocol Support - **Pre-Horizon**: Only supports TAP v1 receipts - **Horizon**: Generates TAP v2 receipts, can process v1 receipts for redemption ### Receipt Generation - **Upstream**: Uses `create_receipt(allocation, fee)` for v1 receipts - **Horizon**: Uses `create_receipt(allocation, fee, payer, data_service, service_provider)` for v2 receipts ### ID Types - **Pre-Horizon**: Uses `AllocationId` for receipt generation and payment tracking - **Horizon**: Uses `AllocationId` for receipt generation, supports both types for processing ### Receipt Structure **v1 Receipts (Pre-Horizon)**: - `allocation_id`: Address of the allocation - `timestamp_ns`: Timestamp in nanoseconds - `nonce`: Random nonce - `value`: Fee amount in wei **v2 Receipts (Horizon)**: - `collection_id`: Collection identifier (derived from `allocation_id`) - `payer`: Address of the payer - `data_service`: Address of the data service - `service_provider`: Address of the service provider - `timestamp_ns`: Timestamp in nanoseconds - `nonce`: Random nonce - `value`: Fee amount in wei ## Migration from Pre-Horizon ### For Operators 1. **Dependencies**: Updated `tap_graph` to support v2 receipts 2. **Configuration**: No configuration changes needed 3. **Deployment**: Requires horizon contracts to be deployed on the network 4. **Compatibility**: Can still process existing v1 receipts ### For Indexers 1. **Receipt Processing**: Must support v2 receipt processing 2. **Collection IDs**: Should use collection IDs instead of allocation IDs 3. **Backward Compatibility**: Can still redeem any existing v1 receipts --------- Signed-off-by: Joseph Livesey <joseph@semiotic.ai> Signed-off-by: Tomás Migone <tomas@edgeandnode.com> Co-authored-by: Joseph Livesey <joseph@semiotic.ai> Co-authored-by: Miguel de Elias <miguel@edgeandnode.com> Co-authored-by: Theo Butler <theodusbutler@gmail.com> Co-authored-by: Maikol <86025070+Maikol@users.noreply.github.com>
Horizon Gateway Upgrade
This horizon gateway provides TAP v2 receipt generation while maintaining full backward compatibility with existing v1 receipts from the upstream implementation.
Overview
This is a horizon-ready gateway that adds TAP v2 (collection-based) receipt support to the existing edgeandnode/gateway which only supports TAP v1 (allocation-based) receipts. This implementation generates exclusively v2 receipts while maintaining backward compatibility for processing existing v1 receipts.
Key Changes from Pre-Horizon Gateway
TAP Protocol Support
Receipt Generation
create_receipt(allocation, fee)for v1 receiptscreate_receipt(collection, fee, payer, data_service, service_provider)for v2 receiptsID Types
AllocationIdfor receipt generation and payment trackingCollectionIdfor receipt generation, supports both types for processingReceipt Structure
v1 Receipts (Pre-Horizon):
allocation_id: Address of the allocationtimestamp_ns: Timestamp in nanosecondsnonce: Random noncevalue: Fee amount in weiv2 Receipts (Horizon):
collection_id: Collection identifierpayer: Address of the payerdata_service: Address of the data serviceservice_provider: Address of the service providertimestamp_ns: Timestamp in nanosecondsnonce: Random noncevalue: Fee amount in weiMigration from Pre-Horizon
For Operators
tap_graphto support v2 receiptsFor Indexers