ethereum / eth-tester

Tool suite for testing ethereum applications.
MIT License
364 stars 146 forks source link

Implement `eth_getStorageAt` #263

Closed antazoey closed 1 year ago

antazoey commented 1 year ago

What was wrong?

I get a value error for RPC Endpoint has not been implemented: eth_getStorageAt.

How can it be fixed?

here is some Hardhat code but otherwise not sure:

    const key = setLengthLeft(bigIntToBuffer(positionIndex), 32);

    const data = await this._runInBlockContext(blockNumberOrPending, () =>
      this._stateManager.getContractStorage(address, key)
    );

    const EXPECTED_DATA_SIZE = 32;
    if (data.length < EXPECTED_DATA_SIZE) {
      return Buffer.concat(
        [Buffer.alloc(EXPECTED_DATA_SIZE - data.length, 0), data],
        EXPECTED_DATA_SIZE
      );
    }

    return data;
fselmo commented 1 year ago

Hey @antazoey. This is via web3.py + EthereumTesterProvider right? It's not implemented in eth-tester but that message is coming from the web3.py library through that provider. I will work on getting this change in for both libraries 👍🏼

antazoey commented 1 year ago

Yes Im interacting through using web3.py