-
Notifications
You must be signed in to change notification settings - Fork 72
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
all: Fix Typing and JSON Conversion #207
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marioevz
force-pushed
the
fix-typing-attempt-3
branch
from
July 17, 2023 17:56
3f7758d
to
3b86818
Compare
Merged
So that test ids are defined closely to the test case definitions.
danceratopz
approved these changes
Jul 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few commits after comparing fixture output.
This really adds consistency to our json formatting! Thanks for this!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes Included
common/types.py
, with the goal of making JSON conversion more streamlined:Number
:int
,str
orbytes
that converts into a string when inserted into the JSON outputHexNumber
:int
,str
orbytes
that converts into a hex string when inserted into the JSON outputZeroPaddedHexNumber
:int
,str
orbytes
that converts into a zero padded hex string when inserted into the JSON output, where zeroes are added to make the string of an even length.Bytes
:str
orbytes
that converts into an hex representation of the bytes described by the input (e.g. in txdata
,extraData
in the block header)FixedSizeBytes
: base class that is used to represent bytes of a fixed length (e.g. addresses, hashes, or header nonces)Address
: Fixed size bytes of length 20Hash
: Fixed size bytes of length 32Bloom
: Fixed size bytes of length 256HeaderNonce
: Fixed size bytes of length 8common/json.py
contains all JSON encoder logic.Code
base class and derivatives do no longer containassemble
method, and now implementSupportsBytes
andSized
types.common/conversions.py
have been removed, in favor of the standardized JSON encoder routines.Alloc
type, which is a Mapping subclass that automatically converts all keys to appropriate address strings, while accepting strings, integers or bytes as key inputs, which would allow us to removeto_address
usage across most tests.