-
Notifications
You must be signed in to change notification settings - Fork 753
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
util: Add ssz roots capability for withdrawals hash tree root #2488
Conversation
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
Basically nits but would like some of the naming conventions a little bit clearer. Code looks great though!
@@ -103,6 +103,15 @@ export class Withdrawal { | |||
return Withdrawal.toBufferArray(this) | |||
} | |||
|
|||
toValue() { |
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 is nice! I wonder if we should add something like this for blob txns?
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.
yes its good 👍 picked idea from ssz code structure
Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
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.
Looks great!
|
||
const withdrawalsValue = withdrawals.map((wt) => wt.toValue()) | ||
st.deepEqual( | ||
withdrawalsValue.map((wt) => `0x${wt.address.toString('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.
0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4
const withdrawalsValue = withdrawals.map((wt) => wt.toValue()) | ||
st.deepEqual( | ||
withdrawalsValue.map((wt) => `0x${wt.address.toString('hex')}`), | ||
withdrawalsJson.map((wt) => wt.address) |
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.
0x990De5Cc9Cc644F0703f6A09e084470a949eC370
st.deepEqual( | ||
withdrawalsValue.map((wt) => `0x${wt.address.toString('hex')}`), | ||
withdrawalsJson.map((wt) => wt.address) | ||
) | ||
st.end() |
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.
0x990De5Cc9Cc644F0703f6A09e084470a949eC370
In preparation for moving the ssz root gen capability for withdrawals, this PR adds ssz types and root gen utility method which can be later easily deployed
will just need to switch all Block.genWithdrawlsTrieRoot to Block.genWithdrawalsSSZRoot method when the spec moves to ssz root