Repository navigation
fix(keccak): pad bytesN values in solidity_keccak (#3906) - #3911
Open
user-Param wants to merge 1 commit into
Open
user-Param wants to merge 1 commit into
user-Param wants to merge 1 commit into
Conversation
hex_encode_abi_type did not pad fixed-size bytesN values, so solidity_keccak(["bytes2"], [b"a"]) hashed 0x61 instead of 0x6100. Now pads bytesN values to N bytes as Solidity does. fix(types): Wei and Gwei preserve type through arithmetic (ApeWorX#3833) Changed Wei and Gwei from NewType aliases to int subclasses that override arithmetic operators (__iadd__, __isub__, __add__, etc.) to return the same type. This allows augmented assignment (x += Wei(1)) without mypy errors. Fixes ApeWorX#3906 and ApeWorX#3833.
3 tasks done
This file contains hidden or 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
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.
Fixes #3906 and #3833.
solidity_keccak: Pad bytesN values to N bytes as Solidity does.
Previously solidity_keccak(["bytes2"], [b"a"]) hashed 0x61 instead of 0x6100.
Wei/Gwei: Changed from NewType aliases to int subclasses that preserve
type through arithmetic operators (iadd, isub, etc.), allowing
augmented assignment without mypy errors.