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/#125] Enhance configuration management by using toml configuration file #296

Merged
merged 5 commits into from
May 23, 2024

Conversation

pillip
Copy link
Contributor

@pillip pillip commented May 22, 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 enhancements to the configuration management and parsing functionalities of the Halmos project, improving flexibility, usability, and testing robustness. Key changes include the integration of the TOML configuration logic(loading and parsing), fixing a typo in the Black configuration, and ensuring that new functionalities are thoroughly tested.

Related Issues

This PR resolves #125

Changes

  1. Dependency and configuration fix
  • Added toml as a dependency in pyproject.toml to enable TOML file operations.
  • Corrected a typo from target-versions to target-version in the Black configuration, ensuring proper adherence to formatting standards.
  1. toml Configuration File Loading and Parsing
  • Imported necessary packages (os and toml) to facilitate file operations for TOML configurations.
  • Added -f and --configure command-line arguments to specify the path to the TOML configuration file.
  • Implemented load_configure_file function to verify the existence of the configuration file and load its contents.
  • Developed parse_configure_file function to integrate the loaded configuration into the existing argparse arguments.
  • Included a usage example file (halmos.toml) and added pytest tests to validate the functionality of the new loading and parsing routines.
  1. Application of Configuration Parsing in Main Functionality
  • Integrated parse_configure_file function into the main application flow, ensuring that configurations are correctly parsed and applied at runtime.

Tests

pytest tests/test_parser.py

* Add toml package in dependencies
* Fix typo from target-versions to target-version for black
* Import os and toml package to enable toml file operations
* Add a new command line argument -f and --configure to specify the toml
  configuration file path
* Implement 'load_configure_file' func to check the existence of the
  file and load it
* Implement 'parse_configure_file' func integrates the loaded
  configuration from file into the existing args
* Add usage example (halmos.toml)
* Add pytest testcode to ensure working load_configure_file and
  parse_configure_file functions
@karmacoma-eth
Copy link
Collaborator

thanks @pillip, this has been long requested! I'll take a detailed look tomorrow

Copy link
Collaborator

@karmacoma-eth karmacoma-eth left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for adding the tests!

@karmacoma-eth karmacoma-eth merged commit 4037b2f into a16z:main May 23, 2024
52 checks passed
pcaversaccio added a commit to pcaversaccio/snekmate that referenced this pull request Jun 2, 2024
### 🕓 Changelog

The PRs a16z/halmos#296 and
a16z/halmos#298 have added support for
configuration files in `halmos` (https://github.com/a16z/halmos). This
PR refactors the configurations currently used inline via the CLI and
moves them to the new configuration file `halmos.toml`, which is located
in the `test/` subdirectory. I also rename the configuration file
`echidna-config.yaml` to `echidna.yaml` and move it to the subdirectory
`test/` as well. Eventually, I bump the submodules
`FreshCryptoLib` (https://github.com/rdubois-crypto/FreshCryptoLib) and
`properties` (https://github.com/crytic/properties) to the latest
available commit.

---------

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
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.

Support configuration via halmos.toml
2 participants