[Pallets] Evaluate completeness of events #275
Labels
p:high
High priority, prioritize the resolution of this issue
t:maintenance
The issue describes necessary maintenance
To be able to effectively use Subsquid, we have to output the information that should be processed (and is not already part of the call itself) within events.
It is possible to query the state of blocks in the past by sending a RPC to an archival node. However, this is not the desired approach, since it introduces additional problems, such as timeout handling, knowledge of low-level node information outside the node (how did the storage structure look at every point in time), etc.
This must be done before the upcoming launch of the next testnet
Update meeting 1st Sep. 2021
Most of the information can be gathered via events. Whenever a new structure is stored, such as a
Market
or aPool
, an event is emitted that contains the id, the structure itself and the account id. All following events which introduce changes to those data structures must contain the id of the specific instance of the data structure and, if available, the account id that instructed the changes.By using this approach, Subsquid is able to collect the complete data set whenever a new instance of a data structure is created (such as a
Market
) and trace all subsequent changes to it (since the changes can be joined using the corresponding ids). In addition, any additional information such as the timestamp, block number and account id, can be used to execute complex queries over many different datasets to gain additional insights.A corner-case are the spot prices: They are calculated on demand for a pair, therefore we cannot trace every spot price through events. In this case, the SDK will use a RPC to calculate the prices. This allows us to gather data about the price history in addition to the quantity (and therefore implicitly the volume) history. This data in turn can be used in our research to evaluate our market scoring rule and in response the behavior of the users. Querying Subsquid prices in contrast to using a RPC to fetch the price history is by magnitudes faster.
TODOs
Market
that was created to theMarketCreated
event. #284Pool
that was created to thePoolCreate
event and add pool ids to the events wherever possible.OrderData
that was created to theOrderMade
event.The text was updated successfully, but these errors were encountered: