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

[Feature/#270] Support vm.getBlockNumber cheatcode #325

Merged
merged 9 commits into from
Jul 18, 2024

Conversation

pillip
Copy link
Contributor

@pillip pillip commented Jul 16, 2024

Change Type

  • Bug fix (Not Breaking-change. Solve issue.)
  • New feature (Not Breaking-change. Add new feature.)
  • Breaking change (Bug fix or New featrure that cause Breaking change.)
  • Code Convention (Edit Code Convention.)
  • Refactoring (Refactor Code without feature change.)

Description

This PR introduces supporting vm.getBlockNumber() cheat code. Key changes include the getBlockNumber() cheat code function to retrieve the current block number and adding solidity test contract to verify the functionality of getBlockNumber.

Related Issues

This PR resolves #270

Changes

  1. Cheat Code Implementation

    • Added handling for getBlockNumber() in the cheat code logic.
    • Added the solidity test contract
  2. Update submodules

Tests

# at the ~~~~/halmos/example/simple dirctory
halmos -vvvv --contract BlockNumberTest

* Update cheatcode handler to recognize and proceses the
  getBlockNumber()
* Add solidity test code to ensure the getBlockNumber() cheatcode works
  as expected
* Update submodule reference commits for forge-std, multicaller,
  openzeppelin-contracts, solady and solmate
* Modify examples/simple/remappings.txt to include new paths for
  openzeppelin-contract, ds-test and forge-std
Copy link
Collaborator

@daejunpark daejunpark left a comment

Choose a reason for hiding this comment

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

thanks for this!

if it is necessary to update the forge-std submodule, this can be merged only after #323.

also, to make the scope of changes clearer, i'd suggest not updating irrelevant submodules in this pr.

additional comments below.

examples/simple/test/BlockNumber.t.sol Outdated Show resolved Hide resolved
examples/simple/remappings.txt Outdated Show resolved Hide resolved
* Add newline character at the end of the blocknumer.t.sol file
* Remove library dependencies at examples/simple/remappings.txt
@pillip
Copy link
Contributor Author

pillip commented Jul 16, 2024

@daejunpark
I reverted updates of irrelevant submodules at 57bf7d3
Thank you for feedback!

@daejunpark
Copy link
Collaborator

thanks! we will merge this after #323.

@daejunpark daejunpark merged commit 8ae5902 into a16z:main Jul 18, 2024
52 checks passed
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.

vm.getBlockNumber not supported
2 participants