graphprotocol / graphprotocol/graph-node

unknown import: `ethereum::ethereum.call` has not been defined

Open
#4,309 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

This happens when a file data source handler uses contract calls directly or is in the same AssemblyScript file as other handlers which use contract calls. If the contract call is done by a different handler in the same file, this can be fixed by putting the file data source handler in its own file, which is best practice.

Potential Fix

Contract calls in file data source handlers could be enabled by somehow passing the ethereum.call host fn when instantiating an offchain data source, relevant code:
https://github.com/graphprotocol/graph-node/blob/92670f27d93ed08a6e83805ad644d9004d4d77ee/runtime/wasm/src/host.rs#L137-L141

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 at runtime/wasm/src/host.rs around lines 137-141 and trace how offchain data sources are instantiated. Confirm how the missing ethereum.call host function affects file data source handlers, then determine whether it can be passed during instantiation. Done means contract calls no longer produce the unknown import error in the described handler scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
backend-api-design, blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.