-
Notifications
You must be signed in to change notification settings - Fork 272
add generateAddress2 for CREATE2 #146
Conversation
83d335b
to
0070686
Compare
index.js
Outdated
inputCode = exports.toBuffer(inputCode) | ||
|
||
let address = exports.keccak256(Buffer.concat([ | ||
Buffer.from('0xff', 'hex'), |
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.
shouldn't from
be part of the hash?
as mentioned in ethereum/EIPs#1014 (comment)
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.
Yup.. good call.
This needs to be updated and the tests fixed. |
Have updated this according to the latest discussions. Existing tests should now run through, this still needs specific test cases for the new function though. Have asked on the EIP update PR for some examples. |
Update: examples on the EIP update PR page (should be merged soon) are now ready, can be added as test cases here. |
edae3c2
to
b684de4
Compare
*/ | ||
exports.generateAddress2 = function (from, salt, initCode) { | ||
from = exports.toBuffer(from) | ||
salt = exports.toBuffer(salt) |
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.
Should the length of the buffers be checked (as they should be 20 and 32, else the hashes would differ, right?)
Yes, that makes sense |
@jwasinger @holgerd77 Could this be merged? ethereumjs/ethereumjs-monorepo#329 depends on it :) |
Will take a look later the day. Would like to add the latest changes to the example files with the gas cost additions, just to be complete here. |
@rmeissner Ok, updated the example tests file and will merge once CI is through. Won't make it to do a release today, will have to think a bit more thoroughly on how to organize that and what to put inside. Hopefully tomorrow. |
Current idea would be to merge #143 (EIP-155 support), merge this one and then do a |
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.
This looks good now.
Update on a release: forgot about the signature changes to comply with Geth and Parity signature scheme introduced in #131 being breaking and not yet released. To be more on the safe side I will do a |
Precursor to EIP 1014 implementation on EthereumJS VM . Need to add unit tests.
There is currently an open PR #1375 on the EIPs repository which represents the more accurate state of the EIP.