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

feat(sidecar): sign messages using the correct signing domain #281

Merged
merged 5 commits into from
Oct 8, 2024

Conversation

merklefruit
Copy link
Collaborator

@merklefruit merklefruit commented Oct 7, 2024

Signing and verifying messages with BLS keys now complies to the consensus-layer signing domains spec.
In particular, two signing domains are provided: APPLICATION_BUILDER and COMMIT_BOOST.

Signers are able to sign() or verify() messages in both domains explicitly to avoid incurring in inconsistencies.

Note: the beacon-chain specs also define signing over SSZ containers via hash_tree_root. We currently don't do that, and have decided to use our own signing digests that are simpler and don't require deriving SSZ. Since this is an out-of-protocol API we are not required to comply to this restriction.

Comment on lines -112 to +116
async fn sign(&self, data: &[u8; 32]) -> eyre::Result<BlsSignature> {
let request = SignConsensusRequest::builder(
*self.pubkeys.read().first().expect("consensus pubkey loaded"),
)
.with_msg(data);
async fn sign_commit_boost_root(&self, data: &[u8; 32]) -> eyre::Result<BlsSignature> {
let request = SignConsensusRequest {
pubkey: *self.pubkeys.read().first().expect("consensus pubkey loaded"),
object_root: *data,
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

with_msg() was calling tree_hash_root() internally. Since we already have a 32 bytes message, we don't need to do this. If a tree hash root is required, it must be hashed by the caller.

Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

lgtm!

@merklefruit merklefruit merged commit 410c1db into unstable Oct 8, 2024
4 checks passed
@merklefruit merklefruit deleted the nico/sidecar/bls-cb-sig branch October 8, 2024 08:52
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.

2 participants