Skip to content

Commit

Permalink
docs: add discovery on/off-chain tradeoffs
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Jan 31, 2024
1 parent 449b25b commit e2c0153
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,22 @@ graph TD
```

As we keep the diagram simple, it is possible to have indexer serve/host schema files as part of indexer service and become independent of IPFS gateway


## Trade-off

First assume that on-chain allocation does not bring significant economic guarantee to FHS (no rational slashing).

If there are $m$ data producers, $n$ data consumers, and $p$ datasets to discover, then

**Offchain**

The only on-chain cost occurred are indexer registration and/or server url allocation: $O(1)$.

Data consumers looking for 1 file will run a program with runtime complexity of $O(mp)$. Data producers will serve $O(n)$ queries for each consumers looking for a file. The discovery process mostly falls on data consumers.

**Onchain**

Data producers spend on indexer registration and per file allocation: $O(p)$. We expect the network subgraph to index the data and make available for queries (graphcast can acheive similar "oracle" functionality; particularly with challengers).

Data consumers looking for 1 file will run a program with runtime complexity of $O(1)$. Data producers will not need to serve status queries for p2p discovery.

0 comments on commit e2c0153

Please sign in to comment.