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
refactor!: don't send public key with signature #4518
base: main
Are you sure you want to change the base?
Conversation
cee8760
to
df420c1
Compare
df420c1
to
120c0df
Compare
120c0df
to
f66a58f
Compare
dc4d7d7
to
3701fc5
Compare
signatures | ||
.into_iter() | ||
.filter(|signature| public_keys.contains(signature.public_key())) | ||
.filter(|signature| filtered.contains(&(signature.0 as usize))) |
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 like check that signature actually match peer's public key should be checked here as well
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.
ugh, good point. This will take me some time to fix
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 be fixed now, but the change propagated
pub fn sign(self, key_pair: &KeyPair, topology: &Topology) -> ValidBlock { | ||
let node_pos = topology | ||
.position(key_pair.public_key()) | ||
.expect("BUG: Node is not in topology"); |
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.
Why you decided to panic here? Maybe allow downstream users to handle error condition?
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.
I was thinking that it indicates a bug in consensus. The node that is signing must be present in the topology. This must never happen, I consider it the same as accessing array out of bounds.
I will reconsider
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.
encountering this panic means that Role::Undefined
is trying to sign a block. This mustn't happen in a correct consensus so panic is appropriate
bdb903e
to
fb852e9
Compare
399deac
to
5fc6223
Compare
Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
Description
Linked issue
Closes #4393
Benefits
Checklist
CONTRIBUTING.md