IPFS File Datasource warning messages

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

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

評価

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

調査の方向性

まず、IpfsMetadataTemplate.create(cid) と handleIpfsContent handler の周辺で説明されている、CID が繰り返されるフローを再現します。IPFS ファイル datasource の作成を繰り返すと runtime host 警告が発生する仕組みを調査し、その警告が無害かどうか、またエンティティ関係の動作を変更せずに繰り返しの作成を回避できるかどうかを確認します。

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

説明

Stale

Hi,

I have deployed a subgraph in Subgraph studio.

I'm testing a IPFS File Datasource to gather off-chain metadata info into a chain based handler.

The entity of the off-chain data is defined as:

type IpfsMetadata @entity {
  id: Bytes!
  metaData: String!
}

The event driven entity is linked this way

type AssetTransfer @entity {
  id: Bytes!
  tokenId: BigInt!
  cid: String!
  metaData: IpfsMetadata 
}

In mappings file, the following event handler set the relationship:

export function handleAssetTransfer(event: AssetTransferEvent): void {

  let entity = new AsssetTransfer(idBytes);

  const cid = event.params.cid;

  entity.metaData = Bytes.fromUTF8(cid);

  IpfsMetadataTemplate.create(cid);

               .....

}

I have the following content handler:

export function handleIpfsContent(content: Bytes): void {

  let cid = dataSource.stringParam();
  let ipfs = new IpfsMetadata(Bytes.fromUTF8(cid));
  ipfs.metaData = content.toString();
  ipfs.save();
}

Currently, cid are always the same for every indexed event (it's a normal use case), so the following warning is shown through the dashboard after the first IpfsMetadata entity is created:

"no runtime host created, there is already a runtime host instantiated for this data source, address: xxxxxxx, name: IpfsMetadata, runner_index: 1246"

When I query the index to check the AssetTransfer entities, all of them are successfully linked to the unique IpfsMetadata entity, so everything seems to work fine.

However, I don't like the warning log at every new indexed event when cid parameter is repeated.

As entities associated with File Data Sources cannot be accessed by chain-based handlers, there is no way to check whether the IpfsMetada entity does exist to prevent creating a new file datasource template.

Shoud I be aware of the logged message?
Is there any other thing I can do to prevent the warning log?

Best regards

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

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

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

はじめの一歩

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

graphprotocol/graph-node のほかの issue

graphprotocol/graph-node の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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