question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

eth_getStorageAt with block number parameter doesn't return correct result when using fork feature

See original GitHub issue

JSON RPC method eth_getStorageAt always returns the latest state when using fork feature regardless of the third parameter

Expected Behavior

When changing the storage value in contract c at key k from v1 to v2 in block b, eth_getStorageAt(c, k, b-1) should return v1.

Current Behavior

eth_getStorageAt(c, k, b-1) returns v2 for any b. For storage values that didn’t change after fork, eth_getStorageAt works as expected

Steps to Reproduce (for bugs)

  1. ganache-cli -f mainnet_node --networkId 1
  2. truffle migrate
  3. eth_getStorageAt("[migration_contract]", "0x1", "0x0")

Your Environment

  • Version used: Ganache CLI v6.9.1 (ganache-core: 2.10.2)
  • Operating System and version: macOS Catalina 10.15.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
seesemichaeljcommented, Aug 25, 2020

This was just officially released in ganache-cli@6.10.1-beta.2 / ganache-core@2.11.3-beta.0

5reactions
seesemichaeljcommented, Aug 20, 2020

Hey @nebojsa94, while I was assessing the validity of your solution, I was trying to find a more elegant solution by hacking away. However, I ended up on your proposed solution anyway and opened a PR since it was done. I didn’t intend to steal your thunder and hope you didn’t spend any time with implementation! Nevertheless, I really appreciate the proposal you made as it saved me discovery time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ganache CLI - Nethereum Documentation
Returns the total time adjustment, in seconds. evm_mine, Force a block to be mined. Takes no parameters. Mines a block independent of whether...
Read more >
web3.eth API — Web3.py 5.31.3 documentation - Read the Docs
Returns the number of transactions in the block specified by block_identifier . Delegates to eth_getBlockTransactionCountByNumber if block_identifier is an ...
Read more >
ganache-cli - npm
evm_snapshot : Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the integer id of the snapshot created....
Read more >
How eth_getStorageAt works when block option is not "latest"?
For that it will read the root node from the block header and then it will use the Patricia-Trie that correspond to the...
Read more >
Reference | Ethereum development environment for ... - Hardhat
If no value is provided, the latest block is used. enabled : an optional boolean to switch on or off the fork functionality....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found