Skip to content

feat(base_types): Add Wei type #825

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

Merged
merged 4 commits into from
Sep 24, 2024
Merged

feat(base_types): Add Wei type #825

merged 4 commits into from
Sep 24, 2024

Conversation

marioevz
Copy link
Member

🗒️ Description

Adds a type called Wei which allows string parsing different combinations of fund amount strings, such as "1 ether", "100 gwei", "10**9 wei", and others.

Mostly meant to be used in command parameter parsing to allow more human-readable commands.

🔗 Related Issues

None

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • Tests: A PR with removal of converted JSON/YML tests from ethereum/tests have been opened.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

@marioevz marioevz added type:feat type: Feature scope:fw Scope: Framework (evm|tools|forks|pytest) labels Sep 20, 2024
@marioevz marioevz requested a review from spencer-tb September 20, 2024 18:48
Copy link
Contributor

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

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

Nice! Never knew "finney" or "szabo" existed!

Copy link
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

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

Really nice, few suggestions below!

Perhaps you'd prefer to make it explicit and not allow synonyms, I don't have a strong opinion 🙂 but normalizing the input unit and using match in a helper _get_multiplier() method makes sense to me.

Copy link
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

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

Another test case.

@marioevz marioevz merged commit 8fe6a4d into main Sep 24, 2024
7 checks passed
@marioevz marioevz deleted the add-wei-type branch September 24, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:fw Scope: Framework (evm|tools|forks|pytest) type:feat type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants