graphprotocol / graphprotocol/graph-node

IPFS File Datasource warning messages

Open
#6,156 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
Dominant language
Rust
Stars
3.2k
Forks
1.1k
Avg merge
4d 1h
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the repeated-CID flow described around IpfsMetadataTemplate.create(cid) and the handleIpfsContent handler. Inspect how repeated IPFS file datasource creation produces the runtime-host warning, then verify whether the warning is benign and whether repeated creation can be avoided without changing the entity relationship behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.