graphprotocol / graphprotocol/graph-node

[Bug] Derived loader doesn't behave as expected

Ouverte
#5,608 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug Stale
Langage dominant
Rust
Étoiles
3.2k
Forks
1.1k
Merge moyen
4 j 1 h
PR mergées (30 j)
1

Description

Bug report

When using a derived loader I get a confusing error. My basic setup is this:

// SCHEMA
type Pool {
  # `Pool-${token0.toHexString()}-${token1.toHexString()}`
  id: ID!
  stakingPool: StakingPool
}
type StakingPool {
  id: Bytes!
  liquidityPool: Pool!
}

// WHEN ADDING THE POOL FIRST
poolEntity.stakingPool = idOfFutureStakingPool;


const stakingPool = StakingPool.load(poolAddress)!;
const lp = stakingPool.liquidityPool.load()[0];

The last line is crashing with the error:
Mapping aborted at ~lib/@graphprotocol/graph-ts/common/value.ts, line 80, column 5, with message: Value is not a string.

What am I doing wrong? I didn't find any documentation for this modifier or any other for the subgraph. Also if I did anything wrong shouldn't the loader return an empty array instead of exploding in my face?

Using the derived field works well (in inspecting the store) but using the loader doesn't.

Relevant log output

No response

IPFS hash

No response

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

Linux

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire l’exemple de derived-loader de l’issue, puis inspectez lib/@graphprotocol/graph-ts/common/value.ts autour de la ligne 80, où l’erreur signalée se produit. Suivez la manière dont stakingPool.liquidityPool.load() gère le schéma et le mapping présentés ; le travail est terminé lorsqu’il est établi si le problème vient de l’utilisation ou du loader, et que le comportement attendu est documenté ou corrigé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Domaine
blockchain
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
20/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.