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

fix(cast): pass blocknum to cast storage rather than always using latest #7009

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

g-01234
Copy link
Contributor

@g-01234 g-01234 commented Feb 4, 2024

Motivation

cast storage currently passes None to provider.get_storage_at() for block, rather than the block number if provided by the user. This causes storage for the latest block to always be pulled, regardless of what the user provides.

Solution

Pass the block (already a flag for storage and parsed as BlockId ) along to provider.get_storage_at().

@Evalir Evalir merged commit 317ca38 into foundry-rs:master Feb 5, 2024
19 checks passed
@g-01234
Copy link
Contributor Author

g-01234 commented Feb 5, 2024

Merge went thru as I was typing this, but @igorline pointed out that the test case I included doesn't actually cover the branch I modified (--block works as expected when querying for a single slot). Happy to remove it if desired, however the other two branches require either: 1) a foundry project, or 2) an etherscan API key (branch1, branch2). Not sure how you guys would handle such a case in cast test. Can confirm it's working as expected locally though (note tokenCounter increasing between blocks)

image

@g-01234 g-01234 deleted the cast_storage_blocknum branch February 6, 2024 02:20
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.

2 participants