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

feat(Foundry): Honor block.number and cache requests #129

Merged
merged 6 commits into from
Nov 15, 2024

Conversation

acuarica
Copy link
Contributor

@acuarica acuarica commented Nov 14, 2024

Description:

This PR honors block.number when requesting balances to the Mirror Node.

The test data and block.number used for mocking match testnet state up to that block. This means that tests against testnet will work again when using the block number 8535327

$ forge test --fork-url https://testnet.hashio.io/api --fork-block-number 8535327

Warning

Fetching allowances up to a given block is not supported yet #96.

It also caches the requests made to the Mirror Node within the same test. This is specially useful when making repeated requests to fetch block information. Given that we cache both 200s and 404s, the specific cache for accounts/ is not needed anymore 8cbdeb5.

Finally, it changes the accounts/ request so it doesn't fetch transactions given they are not needed e8d552c.

Related issue(s):

Fixes #95.

Notes for reviewer:

Note

The Forge tests w/FFI curl process mock job was updated to include the --fork-block-number CLI option b463fce. Moreover, two options were removed

  • --chain 296. This is not necessary given Foundry uses the same block.chainid as the remote network.
  • --no-storage-caching. This flag was introduced (in other jobs) to ensure the JSON-RPC was called. However, given that we do not insert a JSON-RPC in this test, this flag is not needed.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@acuarica acuarica linked an issue Nov 14, 2024 that may be closed by this pull request
@acuarica acuarica self-assigned this Nov 14, 2024
@acuarica acuarica added the feature Enhancing an existing feature driven by business requirements. Typically backwards compatible. label Nov 14, 2024
Signed-off-by: Luis Mastrangelo <[email protected]>
@acuarica acuarica marked this pull request as ready for review November 14, 2024 21:34
@acuarica acuarica requested review from a team as code owners November 14, 2024 21:34
Copy link

@mishomihov00 mishomihov00 left a comment

Choose a reason for hiding this comment

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

Reviewed and approved only this file:
.github/workflows/test.yml

Copy link
Contributor

@arianejasuwienas arianejasuwienas left a comment

Choose a reason for hiding this comment

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

lgtm

@acuarica acuarica merged commit 245fc68 into main Nov 15, 2024
12 checks passed
@acuarica acuarica deleted the 95-foundry-honor-block-number branch November 15, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Enhancing an existing feature driven by business requirements. Typically backwards compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Foundry] Honor --fork-block-number configuration setting
4 participants