-
Notifications
You must be signed in to change notification settings - Fork 34
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
Added solidityKeccak256 Function #77
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@dawsbot I added a task to add the |
@arimgibson sounds great, I'll take on the |
…ial-eth into feature/solidityKeccak256
'0xB5503a7db1A9105cd459D99153e69a76a8EF1530', | ||
'0xaa0fc255b079e775f9307e5cfec472a555cebc3a', | ||
], | ||
[[15]], |
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.
@dawsbot this input [[15]]
should be valid in theory but fails in both essential-eth
and ethers
because essential-eth
relies on code I believe to be broken that comes from ethers
. Parsing in an array triggers the _pack
fn to call itself passing the isArray
parameter as true https://github.com/Earnifi/essential-eth/blob/675424d214951ba0dcf3be071cf5c6e641bd2578/src/utils/solidity-keccak256.ts#L85 which triggers _pack
to add zeros stored in the Zeros
const https://github.com/Earnifi/essential-eth/blob/675424d214951ba0dcf3be071cf5c6e641bd2578/src/utils/solidity-keccak256.ts#L11-L12 to the original 15
value passed in https://github.com/Earnifi/essential-eth/blob/675424d214951ba0dcf3be071cf5c6e641bd2578/src/utils/solidity-keccak256.ts#L67 This then triggers arrayify
to throw an error because the number passed in is too large https://github.com/Earnifi/essential-eth/blob/675424d214951ba0dcf3be071cf5c6e641bd2578/src/utils/bytes.ts#L101 Any thoughts on remedying this? We could aim to fix this functionality in essential-eth
, but then it won't match ethers
. From what I can tell, this seems like a bug in ethers
opposed to expected functionality
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.
@arimgibson can you create a GH issue in ethers?
Let's merge it as-is since it matches ethers for now.
…in both ethers and essential-eth)
Closes #66
solidityKeccak256
function based off ethers.jstoTwos
method ontoTinyBig
-- @dawsbotImprovements to be added after MVP functionality
keccak256
function, which thesolidityKeccak256
function relies onbytes5[3]
) after determining if this is a bug in bothethers.js
andessential-eth
Added solidityKeccak256 Function #77 (review)
Polyfill buffer- No longer needed as otheressential-eth
functions aren't polyfilled