graphprotocol / graphprotocol/graph-node

[Bug] Indexing Error because of 2D BigInt Arrays

オープン
#5,761 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug Stale
主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

説明

Bug report
Hello, thanks in advance for the support.

I have an indexing error when i try to sync my subgraph to subgraph studio (look at the picture)
Capture d’écran 2025-01-09 à 15 27 36
This error is somehow related to a problem with graph-ts that can't interpret the 2D Array of BigInts inside of the following event :

- event: Exchange(indexed address,indexed address,address[11],uint256[5][5],address[5],uint256,uint256)
          handler: handleExchange

This event is specific to the following Curve Contract : 0x16c6521dff6bab339122a0fe25a9116693265353
This 2D Array is crucial to decode and analyse the data from this bridge, so i can't delete it from my subgraph or do it another way.
Just below also the typescript code that initialize this entity and the entity itself :

import { Exchange as ExchangeEvent } from "../generated/CurveRouter/CurveRouter"
import { Exchange } from "../generated/schema"
import { Bytes } from "@graphprotocol/graph-ts"

export function handleExchange(event: ExchangeEvent): void {
  let entity = new Exchange(
    event.transaction.hash.concatI32(event.logIndex.toI32())
  )
  entity.sender = event.params.sender
  entity.receiver = event.params.receiver
  entity.swap_params = event.params.swap_params
  entity.route = event.params.route.map<Bytes>((address) => address as Bytes);
  entity.pools = event.params.pools.map<Bytes>((address) => address as Bytes);
  entity.in_amount = event.params.in_amount
  entity.out_amount = event.params.out_amount

  entity.blockNumber = event.block.number
  entity.blockTimestamp = event.block.timestamp
  entity.transactionHash = event.transaction.hash

  entity.save()
}
type Exchange @entity(immutable: true) {
  id: Bytes!
  sender: Bytes! # address
  receiver: Bytes! # address
  route: [Bytes!]! # address[11]
  swap_params: [[BigInt!]!]! # uint256[5][5]
  pools: [Bytes!]! # address[5]
  in_amount: BigInt! # uint256
  out_amount: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}
Relevant log output
Error: failed to process trigger: block #20268517 (0x21c0…fc31), transaction 4035dca11776d0fd55d48120ff116936975f7709a59e9c9843b2a7d2c55b14a0: error while executing at wasm backtrace: 0: 0x3c9e - <unknown>!src/curve-router/handleExchange: Entity Exchange[0x4035dca11776d0fd55d48120ff116936975f7709a59e9c9843b2a7d2c55b14a057000000]: field `swap_params` is of type [[BigInt!]!], but the value `[[0, 2, 1, 30, 3], [1, 0, 1, 10, 2], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]` contains a [BigInt] at index 0: Entity Exchange[0x4035dca11776d0fd55d48120ff116936975f7709a59e9c9843b2a7d2c55b14a057000000]: field `swap_params` is of type [[BigInt!]!], but the value `[[0, 2, 1, 30, 3], [1, 0, 1, 10, 2], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]` contains a [BigInt] at index 0

To view more details about this indexing error, please view the documentation.
IPFS hash

QmSk6FugeKhGvzGCtqXxnG1SWgpc7rna3VQ6U8F3ooPTfe

Subgraph name or link to explorer

No response

Some information to help us out
  • Tick this box if this bug is caused by a regression found in the latest release.
  • Tick this box if this bug is specific to the hosted service.
  • I have searched the issue tracker to make sure this issue is not a duplicate.
OS information

macOS

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

WASM のバックトレースに示されている失敗する handleExchange エントリポイントと、レポートにある graph-ts のイベントおよびエンティティ定義から始めてください。提供されたイベントデータを使って uint256[5][5] の代入を再現し、その後、エンティティへの書き込み時にネストされた BigInt 配列がどのように検証されるかを追跡してください。このイベントのインデックス作成が成功し、Exchange エンティティの swap_params が保持されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
blockchain, rust, typescript
領域
backend, blockchain, data
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。