onflow / onflow/flow

Executing a Cadence script fails on any block that is not the latest unsealed block

Open
#404 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feedback
Dominant language
Go
Stars
361
Forks
159
PR merge metrics
No merged PRs in 30d

Description

Problem

Hi, I have been trying to execute Cadence scripts at specified block heights, but doing so in any block which is not the latest unsealed block results in this error message:

* rpc error: code = Internal desc = failed to execute the script on the execution node execution-4ab025ab974e7ad7f344fbd16e5fbcb17fb8769fc8849b9d241ae518787695bd@execution-003.mainnet5.nodes.onflow.org:3569=1000: rpc error: code = Internal desc = failed to execute script: failed to execute script (internal error): ledger returns unsuccessful: error getting register (account_address_state) value at ba315e60d57ce02ca75e72509c50a3a7acbb02b5dbf23e36747d18a7fd3d4560: trie with the given rootHash [ba315e60d57ce02ca75e72509c50a3a7acbb02b5dbf23e36747d18a7fd3d4560] not found
Steps to Reproduce

I've been using a generated Rust client from the gRPC protobuf files, but I have also been able to reproduce the bug when following this tutorial:

https://medium.com/@eric.ren_51534/polling-nba-top-shot-p2p-market-purchase-events-from-flow-blockchain-using-flow-go-sdk-3ec80119e75f

Steps to reproduce:

  1. Clone the repo from the article (https://github.com/rrrkren/topshot-sales)
  2. go run main.go

I've tried running on the latest unsealed block, latest sealed block, and current_height - <arbitary_number> block. Only the latest unsealed block works for me.

Acceptance Criteria
  • Being able to run Cadence scripts at arbitrary block heights
Context

Trying to query the network for topshot events.

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 running main.go from the linked topshot-sales reproduction and compare execution at the latest unsealed, latest sealed, and earlier block heights. Then trace the relevant Flow execution path using the reported trie-root error; the issue is done when Cadence scripts execute successfully at arbitrary block heights.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.