Skip to content
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

GIP-0083: Substreams On The Network. #63

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

abourget
Copy link

@abourget abourget commented Dec 6, 2024

Addition of GIP-0083, to bring Substreams on the network officially.

@abourget
Copy link
Author

Ok I've revised a few things, based on a few feedback elements I've received.

@tmigone
Copy link
Member

tmigone commented Dec 16, 2024

Another comment, the GIP makes no references to Horizon so I assume it's not a pre-requisite, is that assumption correct?

@p-diogo p-diogo requested a review from fordN December 16, 2024 22:46
@abourget abourget changed the title First draft of Substreams On The Network. 0084 - First draft of Substreams On The Network. Jan 7, 2025
@abourget abourget changed the title 0084 - First draft of Substreams On The Network. GIP-0083: Substreams On The Network. Jan 7, 2025
Copy link

@p-diogo p-diogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is now a lot more detailed, and I believe it covers everything reviewers agreed was missing.

I've added a few comments.

One thing I think is missing, though, is the discussed automated payments mechanism for Indexers to claim payments. We had discussed this as a solution before the more automated and fully trust-minimized approach, right?

Copy link
Member

@pcarranzav pcarranzav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking a lot better. Added a few comments/questions.

Alexandre Bourget added 3 commits February 10, 2025 17:34
…st, and

can be allocated and disputed on.

More clarity on the attestation signature payload, including the module_hash
being covered, which would facilitate pinning down culprits.
Added details about network subgraph, fixed a few typos.
Copy link

@hopeyen hopeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really stoked to see Substreams getting integrated!!


## Economic Security and Disputes

Economic security is achieved through slashing and disputes, similar to subgraphs as of Jan 24th 2025. Indexers providing incorrect data CAN have their stake slashed. Therefore, to be an Indexer recognized by the Payment Gateway, one must staked the Network token, just like for subgraphs.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has there been discussions on setting the minimum staking requirement for substreams or the same as for subgraphs? Any clarifications on the slashing penalties?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be clarified to ensure that the slashing threat is credible. This being pre-Horizon, presumably the same 100k stake and 2.5% slash apply?


#### Methods of analysis

THIS SECTION IS NON-NORMATIVE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to add some basic description of how signed attestations is submitted and general timeline for arbitration

This command allows providers to register their service, specifying their operator wallet, private key file, the service type (`substreams-v1`), the endpoint URL, logo, name, and the supported network. The registration data is signed by the operator's key. An update to an existing registration can be achieved by re-running the command with updated parameters, based on the `service`, `providerId` and `network` tripled. A corresponding `unregister` or `revoke` command would be added to allow providers to take down their service from the front-end.


# Dependencies & Backwards Compatibility
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be the best place, but generally think it would be really nice to add link/doc for the indexers on how to deploy and run Substreams alongside their existing subgraph services

Copy link
Member

@anirudh2 anirudh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing a quick partial review since I need to run out now, but a minor things + a discussion point we can at least start to chat about.


This builds on work done in [GIP-0056 Permissionless Payers](https://github.com/graphprotocol/graph-improvement-proposals/blob/main/gips/0056-permissionless-payers.md), which opened up an opportunity for such new data services to use the network for payment.

> INFORMATIVE: [TAP](https://docs.rs/tap_core/latest/tap_core/index.html) is not required for Substreams to honor the promises of the protocol. However, as TAP brings augmented trust minimization properties, it would be incorporated in future work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've renamed TAP to GraphTally! Could you update the name here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we talk a bit about how you're thinking we would use GraphTally here? Currently, the way things work is that gateways send signed receipts to Indexers. Indexers then send a batch of those signed receipts back to the gateway to get a signed RAV (Aggregate receipt) which Indexers then post onchain to release money from the escrow contract. It sounds to me like with substreams, Indexers and Consumers talk directly, so gateways aren't really generating receipts. Is there an inversion of trust that happens here compared to the subgraph flow? Payment gateways trust Indexers are accurately reporting usage?


Future opportunities would include self-serve APIs for Indexers to claim payment and do the dance automatically. Thus an Indexer would be able to lower the risks of not receiving payments from the Gateway.

Eventually, TAP could be used to send payments alongside blockchain data payloads (BlockScopedData), or some other trust-minimized payment mechanism.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another instance of TAP to rename to GraphTally!


## Economic Security and Disputes

Economic security is achieved through slashing and disputes, similar to subgraphs as of Jan 24th 2025. Indexers providing incorrect data CAN have their stake slashed. Therefore, to be an Indexer recognized by the Payment Gateway, one must staked the Network token, just like for subgraphs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small typo here. "one must staked" -> "one must stake"


Risks associated with data integrity and malicious actors will be mitigated through signed attestations, the arbitration process, and economic security enforced via slashing.

There are some centralization risks in the Payment Gateway until TAP is integrated. For instance, Indexers need to trust the Gateway for payment. In the same vein, there is some counterparty risk for Indexers, as they have to trust that the Payment Gateway _will pay_ - this can be mitigated by requesting payment early and often.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"TAP" -> "GraphTally" please!


## Payments

Payments are handled by the Payment Gateway, which is responsible for collecting payments from consumers and distributing them to indexers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per TG's style guidelines, "indexers" should be capitalized as "Indexers."

Copy link

@madumas madumas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to seeing Substreams becoming a first-class product of the network!

Some GIP out-of-scope comments:

  • I'd like to see a support strategy to ensure Indexer participation. There's been a lot of communication and support to indexers over the years for substream support, but integrating with the network will require additional steps and the indexers will require support from SF and/or Pinax to do so. I hope that existing providers will be ready to support competing newcomers.
  • It is understood that this GIP is an interim solution. In addition to reducing trust assumptions with TAP/GraphTally, I'd like to see future iterations integrating a solution for inter-Indexer redundancy and geodiversity support. This is a strength of the current subgraph support that lacks here. Instead of having the network providing high availability, Consumer must rely on an individual Indexer for SLA and geo-diversity.


## Economic Security and Disputes

Economic security is achieved through slashing and disputes, similar to subgraphs as of Jan 24th 2025. Indexers providing incorrect data CAN have their stake slashed. Therefore, to be an Indexer recognized by the Payment Gateway, one must staked the Network token, just like for subgraphs.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be clarified to ensure that the slashing threat is credible. This being pre-Horizon, presumably the same 100k stake and 2.5% slash apply?


Payments are handled by the Payment Gateway, which is responsible for collecting payments from consumers and distributing them to indexers.

> INFORMATIVE: The Graph Market acts as the first Payments Gateway. Such a gateway DOES NOT route traffic, but does route payments and receive consumption signals from Indexers.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a quick overall description of how consumption signals works, i.e. Indexer<>Gateway exchange. A link to external document would work.


> INFORMATIVE: [TAP](https://docs.rs/tap_core/latest/tap_core/index.html) is not required for Substreams to honor the promises of the protocol. However, as TAP brings augmented trust minimization properties, it would be incorporated in future work.

After collecting consumption signals, the Payment Gateway MUST sum up all what is due to the Indexer, and transfer a payment to the Indexer's wallet, using the `collect` function in the staking contract.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a new trust assumption here. Because the Payment Gateway does not route requests, because there is no round-robin or comparison possible between Indexers, and because Consumption cannot be easily computed independently, we must trust Indexers to report consumption fairly.

What are the Payment Gateway, or Consumer, recourse if Indexers abuse of their position?

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.

8 participants