Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add insert storage #23

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

replikeit
Copy link

  • Add function that change value in slot by address in database.

@SimonOsipov
Copy link

Upvoted 👍

@WonderBeat
Copy link

Best feature ever! Thanks for PR

@aymantaybi
Copy link

we need this ASAP

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the failing test

@aymantaybi
Copy link

it's just a request rate limitation issue from the rpc provider i guess.

@aymantaybi
Copy link

The problem with this feature is that inserting account storage does not override the existing value

@aymantaybi
Copy link

================================================================================== test session starts ===================================================================================
platform darwin -- Python 3.12.0, pytest-8.3.3, pluggy-1.5.0
rootdir: /Users/aymantaybi/Documents/GitHub/pyrevm
configfile: pyproject.toml
collected 1 item

tests/test_evm.py F [100%]

======================================================================================== FAILURES ========================================================================================
_________________________________________________________________________________ test_set_into_storage __________________________________________________________________________________

def test_set_into_storage():
    weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
    evm = EVM(fork_url=fork_url, fork_block="latest")
    evm.insert_account_storage(weth, 0, 10)
    value = evm.storage(weth, 0)
    assert value == 10
    evm.insert_account_storage(weth, 0, 20)
    value = evm.storage(weth, 0)
  assert value == 20

E assert 10 == 20

tests/test_evm.py:71: AssertionError
================================================================================ short test summary info =================================================================================
FAILED tests/test_evm.py::test_set_into_storage - assert 10 == 20
=================================================================================== 1 failed in 0.58s ====================================================================================

I modified the test "test_set_into_storage" to check for overriding the storage IDK if it's an intended behaviour but it's not stated in the underlying implementation.

@replikeit
Copy link
Author

Hi, @aymantaybi I fixed your issue in that update, also added tests. Locally all tests have passed.

@replikeit
Copy link
Author

replikeit commented Nov 13, 2024

I forgot to update version in python toml, sorry.

@replikeit replikeit reopened this Nov 13, 2024
@aymantaybi
Copy link

@replikeit Thank you for your contribution, highly appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants