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

[checkpoint v2] Submit checkpoint signatures to consensus #6021

Merged
merged 1 commit into from
Nov 14, 2022
Merged

Conversation

andll
Copy link
Contributor

@andll andll commented Nov 10, 2022

This PR signs and submit checkpoint to consensus so it can be later aggregated into a certified checkpoint.

#5763

@@ -436,6 +436,12 @@ impl CheckpointProposalContents {
}
}

/// This is a message validators publish to consensus in order to sign checkpoint
#[derive(Clone, Debug, Serialize, Deserialize, Hash)]
pub struct SignedCheckpointData {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand why you need a wrapper of SignedCheckpointSummary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly because I am planning to add more data there, more specifically consensus integrity hash, so that we can have some alerting when it diverges (we wanted this for a while now)

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, wouldn't you need to also sign this data structure? Otherwise anyone could just replace the rest of the fields in this data structure and send it to consensus.

Copy link
Contributor Author

@andll andll Nov 14, 2022

Choose a reason for hiding this comment

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

The plan is to make sure others can't submit checkpoint messages on your behalf.
Next PR has specific TODO for it: https://github.com/MystenLabs/sui/pull/6032/files#diff-ed86b8167f6985d5e9921bba3b99e5d28ba89a2168f5c071b968ee695d93d974R366 (see checkpoints2/mod.rs:366)

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't get it: to verify that you can just compare the checkpoint summary signature with cert author. There is no need for any other data.

@@ -2026,6 +2028,16 @@ impl ConsensusTransaction {
}
}

pub fn new_checkpoint_signature_message(data: SignedCheckpointData) -> Self {
let mut hasher = DefaultHasher::new();
data.hash(&mut hasher);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably not necessary to hash the entire thing. I think you just need to hash the signature since it's a also commit to the hash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, updated

@andll andll force-pushed the andrey-58 branch 4 times, most recently from cf35747 to d7387ce Compare November 10, 2022 21:51
data.verify(&self.committee.load()).map_err(|err|{
warn!(
"Ignoring malformed checkpoint signature (failed to verify) from {}, sequence {}: {:?}",
transaction.consensus_output.certificate.header.author, data.summary.summary.sequence_number, err
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't know how author will be formatted here, but validator names in sui are insanely long so we added a .concise() method to them for concise logs. Up to you if you want to change this, just fyi.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that at least on this particular author field there is no concise method :(

2330 |                         transaction.consensus_output.certificate.header.author.concise(), data.summary.summary.sequence_number, err
     |                                                                                ^^^^^^^ method not found in `fastcrypto::bls12381::min_sig::BLS12381PublicKey`

Copy link
Contributor

@lxfind lxfind left a comment

Choose a reason for hiding this comment

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

Can remove unnecessary Hash derives now

@@ -436,6 +436,12 @@ impl CheckpointProposalContents {
}
}

/// This is a message validators publish to consensus in order to sign checkpoint
#[derive(Clone, Debug, Serialize, Deserialize, Hash)]
pub struct SignedCheckpointData {
Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, wouldn't you need to also sign this data structure? Otherwise anyone could just replace the rest of the fields in this data structure and send it to consensus.

@andll
Copy link
Contributor Author

andll commented Nov 14, 2022

Removed Hash derives

@andll andll requested review from lxfind and mystenmark November 14, 2022 19:32
@andll andll force-pushed the andrey-58 branch 2 times, most recently from 829dbf1 to cc5610f Compare November 14, 2022 21:40
This PR signs and submit checkpoint to consensus so it can be later aggregated into a certified checkpoint.

#5763
@andll andll merged commit 0ae74f3 into main Nov 14, 2022
@andll andll deleted the andrey-58 branch November 14, 2022 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants