Skip to content
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

Sign Gossip Vote Messages #3225

Merged

Conversation

sagar-solana
Copy link
Contributor

@sagar-solana sagar-solana commented Mar 11, 2019

Problem

After a recent change Gossip Vote messages were not being signed and signature verification was relying on the inner Vote Tx being signed correctly.

Summary of Changes

Enabled signing Gossip Vote messages. This time correctly track where the Vote Message was generated so that sig verification works correctly.

This is not mission critical to Beacons.

Fixes #3207

@codecov
Copy link

codecov bot commented Mar 12, 2019

Codecov Report

Merging #3225 into master will increase coverage by <.1%.
The diff coverage is 75.8%.

@@           Coverage Diff            @@
##           master   #3225     +/-   ##
========================================
+ Coverage    79.1%   79.1%   +<.1%     
========================================
  Files         153     153             
  Lines       22246   22258     +12     
========================================
+ Hits        17598   17612     +14     
+ Misses       4648    4646      -2

@sagar-solana sagar-solana added this to the Grandview v0.13.0 milestone Mar 12, 2019
@@ -282,7 +282,7 @@ impl ClusterInfo {

pub fn push_vote(&mut self, vote: Transaction) {
let now = timestamp();
let vote = Vote::new(vote, now);
let vote = Vote::new(&self.id(), vote, now);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the Voter pubkey?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Voter" pubkey here being the vote account_id? Because Fullnode may not own that keypair and it would be sort of wasteful to make another request to sign this CrdsValue::Vote with that keypair.

Instead this falls nicely in line with the way ContactInfo is gossiped. Essentially a node that puts data out into the gossip network must sign that data with a keypair that it owns. All gossiped values are signed by the peer that generated the message and it's easy to verify that.

The Vote itself will be verified by system program. This allows us to easily package wallclock into the crds vote.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sagar-solana Transaction.signatures[0] would be the signature. We just need to translate last_id into a wallclock.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup but @rob-solana and I decided it was best to not try and tie in external state information (like blockhashes -> timestamp) into gossip. It was far more trivial to sign these messages with the node's keypair (used for signing blobs and other gossip messages anyway).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rob-solana any reason besides expendience?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main reason was to try to keep gossip as dumb (i.e. simple) as possible (not needing to know how to unpack a TX, e.g.)
it'd be more expedient to just hack into a vote

core/src/contact_info.rs Show resolved Hide resolved
@sagar-solana
Copy link
Contributor Author

@aeyakovenko @rob-solana, this good to go?

@rob-solana
Copy link
Contributor

good for me

@sagar-solana sagar-solana added the automerge Merge this Pull Request automatically once CI passes label Mar 20, 2019
@solana-grimes solana-grimes merged commit 61f950a into solana-labs:master Mar 20, 2019
@sagar-solana sagar-solana deleted the enable_gossip_vote_sigs branch June 14, 2019 04:57
AshwinSekar pushed a commit to AshwinSekar/solana that referenced this pull request Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants