-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat: implements process bls to execution change #251
feat: implements process bls to execution change #251
Conversation
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.
nice work!
there are a few changes to go ahead and make now
after those, we will want to change the use of assert!
to errors but we can handle that after the first round of updates
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.
nice updates! left some comments
ea897d8
to
9567d59
Compare
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.
nice updates! we are getting closer to merge :)
I left some comments and also I think can tighten up our implementation to drop some use of clone
and be a bit less verbose
- keep
signed_address_change
as&mut SignedBlsToExecutionChange
you can then immediately do this
let address_change = &mut signed_address_change.message;
let signature = &signed_address_change.signature;
// ... rest of code
- let's follow the spec and grab a ref to our validator (it looks like this won't collide anywhere else as far as the borrow checker is concerned)
let mut validator = &mut state.validators[address_change.validator_index];
- we can then also bind the withdrawal credentials so we don't have to keep going through the
state
data
let withdrawal_credentials = &validator.withdrawal_credentials;
- let's not
clone
thefrom_bls_public_key
,
let public_key = &address_change.from_bls_public_key;
you will need to clone it when assembling the InvalidBlsToExecutionChange
error, but if you only clone inside the if
body then we will only pay the cost when necessary
- I may have misled you w/ the
verify_signed_data
helper as we will run into some issues w/ the borrow checker
instead lets just inline its implementation:
let signing_root = compute_signing_root(address_change, domain)?;
verify_signature(&address_change.from_bls_public_key, signing_root.as_ref(), signature).map_err(Into::into)
Hey @ralexstokes have made the requested changes in PR #265 |
@ralexstokes I have made changes , but want to clarify the following :
IIUC, we already take a reference , and warning: variable does not need to be mutable
I have mapped this to the actual error enum in error: type annotations needed
label: cannot infer type of the type parameter `T` declared on the trait `Into` |
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.
nice updates! left some nits below
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.
let's just clean up the errors and then this should be ready to merge!
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.
excellent! thanks for staying w/ me on all the back-and-forth
a few minor nits but I think can I merge from here
Took a stab at this and submitting a draft PR for feedback.
This PR closes #249