marcusats / kanan-subgraph

0 stars 0 forks source link

Feedback on aggregations #1

Open alex-pakalniskis opened 5 months ago

alex-pakalniskis commented 5 months ago

Hey @marcusats,

I noticed you're using aggregations in this subgraph (https://github.com/marcusats/kanan-subgraph/blob/main/schema.graphql#L72).

Do you have any feedback (good or bad) on the feature? We'd love to hear about your experience.

Hope you are well, Alex (PM at Edge & Node)

marcusats commented 5 months ago

Hey @alex-pakalniskis ,

The developer experience was good, the documentation is pretty clear on how to implement. However, I faced some issues with timeseries, I was getting this error: Subgraph failed with non-deterministic error: Failed to transact block operations: store error: duplicate key value violates unique constraint "post_stat_hour_id_key", retry_delay_s: 120, attempt: 0 It was a bit hard to debug because the fact that this are derived IDs, I fix it by changing the way I was handling initialization for the timeseries entity

lutter commented 5 months ago

Wild .. that shouldn't happen; the id of timeseries entities (like PostTime) is managed entirely by graph-node, and it shouldn't matter what you pass in as the id, though "auto" is recommended. Did you deploy this in the hosted service/studio? If so, do you remember the IPFS hash that caused this error?

marcusats commented 4 months ago
Screenshot 2024-04-15 at 9 29 40 PM

I deployed the subgraph on Artbitrum. I was just trying to find the ipfs hash of that caused the error and I realized that there was another error. I am cofused about this because it was working just fine.

Failed to start subgraph, code: SubgraphStartFailure, error: resolve error: Validation errors in subgraphQmUg1jA63JEEcLFG7gggV4MQJ3nc2UhgKJ4EMWftw985DP: (1) - Type InteractionThumbsUp has atimestampfield of type Int8, but it must be of type Timestamp (2) - Type InteractionThumbsDown has atimestampfield of type Int8, but it must be of type Timestamp (3) - Type PostTime has atimestampfield of type Int8, but it must be of type Timestamp (4) - Type ThumbsUpStat has atimestampfield of type Int8, but it must be of type Timestamp (5) - Type ThumbsDownStat has atimestampfield of type Int8, but it must be of type Timestamp (6) - Type PostStat has atimestampfield of type Int8, but it must be of type Timestamp: Validation errors in subgraphQmUg1jA63JEEcLFG7gggV4MQJ3nc2UhgKJ4EMWftw985DP: (1) - Type InteractionThumbsUp has atimestampfield of type Int8, but it must be of type Timestamp (2) - Type InteractionThumbsDown has atimestampfield of type Int8, but it must be of type Timestamp (3) - Type PostTime has atimestampfield of type Int8, but it must be of type Timestamp (4) - Type ThumbsUpStat has atimestampfield of type Int8, but it must be of type Timestamp (5) - Type ThumbsDownStat has atimestampfield of type Int8, but it must be of type Timestamp (6) - Type PostStat has a

lutter commented 4 months ago

Hey .. I am very sorry about that, but we rolled out an update that requires a small modification of all subgraphs using aggregations. In your subgraphs schema, for timeseries and aggregations, you need to change timestamp: Int8! to timestamp: Timestamp!. There's no other change needed, but you'll need to redeploy the updated subgraph.

On the brighter side, we don't have any more plans to break backwards compatibility for aggregations (this change was one of the big reasons why aggregations are labeled as experimental, and thanks a ton for trying it out!)