graphprotocol / graphprotocol/graph-node

contract call do not allow you to specify blocknumber and they execute from the block that trigger the handler

Open
#2,027 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently when in my handler I make a call to a contract, it is executed as the block that triggered the handler

This means that such call can potentially act on data in the future (relative to the trigger) since the tx that triggered the handler could be prior to other transactions in the same block that could modify the data that affect the contract call.

It would be great if we could specify which blockNunber to use for contracts. For example reading from currentBlock -1 would make sure the contract call will not only be affected by the action of further tx. It would have the effect of not considering prior tx effect (in the same block) but depending on use case, it can be preferable.

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 tracing contract calls made from a handler and how the triggering block is supplied as execution context. Determine how a caller could select an earlier block, such as currentBlock - 1, and define the behavior for calls involving transactions in the same block; done means contract reads honor the selected block without changing the default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.