Skip to content

apollo_propeller: add signature verification module#11053

Merged
sirandreww-starkware merged 1 commit intomain-v0.14.1-committerfrom
12-23-apollo_propeller_add_signature_verification_module
Jan 15, 2026
Merged

apollo_propeller: add signature verification module#11053
sirandreww-starkware merged 1 commit intomain-v0.14.1-committerfrom
12-23-apollo_propeller_add_signature_verification_module

Conversation

@sirandreww-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

sirandreww-starkware commented Dec 24, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

@guy-starkware guy-starkware left a comment

Choose a reason for hiding this comment

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

@guy-starkware reviewed 2 files and all commit messages, and made 2 comments.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @noamsp-starkware, @ShahakShama, and @sirandreww-starkware).


crates/apollo_propeller/src/signature.rs line 21 at r1 (raw file):

        Ok(signature) => Ok(signature),
        Err(e) => Err(ShardPublishError::SigningFailed(e.to_string())),
    }

Maybe map_err with ? at the end is more concise?
Also, I think Shahak mentioned something about transparent errors, may make it possible to just use ?

Code quote:

    match keypair.sign(&msg) {
        Ok(signature) => Ok(signature),
        Err(e) => Err(ShardPublishError::SigningFailed(e.to_string())),
    }

crates/apollo_propeller/src/signature.rs line 82 at r1 (raw file):

#[cfg(test)]
mod tests {

Move tests to different file.

Copy link
Collaborator

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

@ShahakShama reviewed 1 file and all commit messages, and made 7 comments.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @guy-starkware, @noamsp-starkware, and @sirandreww-starkware).


crates/apollo_propeller/src/signature.rs line 21 at r1 (raw file):

Previously, guy-starkware wrote…

Maybe map_err with ? at the end is more concise?
Also, I think Shahak mentioned something about transparent errors, may make it possible to just use ?

+1


crates/apollo_propeller/src/signature.rs line 82 at r1 (raw file):

Previously, guy-starkware wrote…

Move tests to different file.

+1


crates/apollo_propeller/src/signature.rs line 11 at r1 (raw file):

pub const SIGNING_PREFIX: &[u8] = b"<apollo-propeller>";
pub const SIGNING_POSTFIX: &[u8] = b"</apollo-propeller>";

Why do you need a postfix? Also, try to make this shorter
Also, these shouldn't hold apollo because other implementations are going to use the same string. If you really want you can write starknet instead of apollo


crates/apollo_propeller/src/signature.rs line 37 at r1 (raw file):

}

pub fn try_extract_public_key_from_peer_id(peer_id: &PeerId) -> Option<PublicKey> {

Are you sure this functionality doesn't exist in libp2p


crates/apollo_propeller/src/signature.rs line 42 at r1 (raw file):

    // Check if this is an identity multihash (code 0x00)
    if multihash.code() == 0x00 {

Try to find a constant for 0x00 in libp2p. If it doesn't exist, define your own


crates/apollo_propeller/src/signature.rs line 71 at r1 (raw file):

    } else {
        // This is a hashed PeerId (SHA-256), cannot extract the original key
        tracing::trace!(peer=%peer_id, multihash_code=%multihash.code(), "PeerId uses hashed multihash, cannot extract public key");

So what is the plan? Ensure all our peer id schemes uses identity?
If that's the case, return error instead of none


crates/apollo_propeller/src/signature.rs line 92 at r1 (raw file):

        let merkle_root = MessageRoot([
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,

Define this as [1; 32] to reduce space. I guess the value doesn't matter

@sirandreww-starkware sirandreww-starkware changed the base branch from 12-23-apollo_propeller_add_reconstruction_error_type to graphite-base/11053 January 4, 2026 17:17
@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_signature_verification_module branch from 3069acd to e6dbf88 Compare January 4, 2026 17:57
Copy link
Contributor Author

@sirandreww-starkware sirandreww-starkware left a comment

Choose a reason for hiding this comment

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

@sirandreww-starkware made 7 comments.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @guy-starkware, @noamsp-starkware, and @ShahakShama).


crates/apollo_propeller/src/signature.rs line 11 at r1 (raw file):

Previously, ShahakShama wrote…

Why do you need a postfix? Also, try to make this shorter
Also, these shouldn't hold apollo because other implementations are going to use the same string. If you really want you can write starknet instead of apollo

I added both just to be safe (same logic that I used for merkle tree hash calculation).
I see your point on apollo an will make this shorter by removing it


crates/apollo_propeller/src/signature.rs line 21 at r1 (raw file):

Previously, ShahakShama wrote…

+1

I did your first suggestion and added a todo to do the second...


crates/apollo_propeller/src/signature.rs line 37 at r1 (raw file):

Previously, ShahakShama wrote…

Are you sure this functionality doesn't exist in libp2p

You are more than right to question this. From my research I did not find a function that does this, and the gossipsub implementation has a very similar function to this one https://github.com/libp2p/rust-libp2p/blob/e10ce4c1704a529161f62e8538e55a106e4ec2d6/protocols/gossipsub/src/protocol.rs#L227C1-L227C27


crates/apollo_propeller/src/signature.rs line 42 at r1 (raw file):

Previously, ShahakShama wrote…

Try to find a constant for 0x00 in libp2p. If it doesn't exist, define your own

I could not find this constant anywhere


crates/apollo_propeller/src/signature.rs line 71 at r1 (raw file):

Previously, ShahakShama wrote…

So what is the plan? Ensure all our peer id schemes uses identity?
If that's the case, return error instead of none

I'm not sure... eliptic curve public keys are short enough so they are put in PeerIDs, so for now all our peer IDs use code 0 because the public key is in the peer id. I also added a function to add a peer with an explicit public key to get around this in the general case (in that case this function will not be called).

I have a feeling that we shouldn't dwell on this for too long because we might need to change the functionality to use starkIDs in the future (to ensure all nodes agree on routing with no possible attacks)

That's the plan for now...


crates/apollo_propeller/src/signature.rs line 82 at r1 (raw file):

Previously, ShahakShama wrote…

+1

Done


crates/apollo_propeller/src/signature.rs line 92 at r1 (raw file):

Previously, ShahakShama wrote…

Define this as [1; 32] to reduce space. I guess the value doesn't matter

Done

@sirandreww-starkware sirandreww-starkware changed the base branch from graphite-base/11053 to 12-23-apollo_propeller_add_reconstruction_error_type January 4, 2026 17:57
Copy link
Contributor

@guy-starkware guy-starkware left a comment

Choose a reason for hiding this comment

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

@guy-starkware reviewed 5 files and all commit messages, and resolved 1 discussion.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @noamsp-starkware and @ShahakShama).

Copy link
Collaborator

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

@ShahakShama reviewed all commit messages, made 1 comment, and resolved 5 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noamsp-starkware and @sirandreww-starkware).


crates/apollo_propeller/src/signature.rs line 11 at r1 (raw file):

Previously, sirandreww-starkware (Andrew Luka) wrote…

I added both just to be safe (same logic that I used for merkle tree hash calculation).
I see your point on apollo an will make this shorter by removing it

Add a TODO to consider removing these as before

@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_reconstruction_error_type branch from 6cfd5de to b3f3c87 Compare January 12, 2026 14:23
@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_signature_verification_module branch from e6dbf88 to d526a1d Compare January 12, 2026 14:23
@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_reconstruction_error_type branch from b3f3c87 to fc56114 Compare January 13, 2026 11:14
@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_signature_verification_module branch from d526a1d to 1b6e505 Compare January 13, 2026 11:14
Copy link
Contributor Author

@sirandreww-starkware sirandreww-starkware left a comment

Choose a reason for hiding this comment

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

@sirandreww-starkware made 1 comment.
Reviewable status: 1 of 5 files reviewed, 1 unresolved discussion (waiting on @guy-starkware, @noamsp-starkware, and @ShahakShama).


crates/apollo_propeller/src/signature.rs line 11 at r1 (raw file):

Previously, ShahakShama wrote…

Add a TODO to consider removing these as before

Sure, just stating that the prefix is in gossipsub too...

@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_signature_verification_module branch from 1b6e505 to 270ea07 Compare January 13, 2026 11:30
Copy link
Collaborator

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

:lgtm:

@ShahakShama reviewed 4 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware).

@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_signature_verification_module branch from 270ea07 to 81bf74b Compare January 14, 2026 09:16
@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_reconstruction_error_type branch 2 times, most recently from 4033098 to dfd8ae8 Compare January 15, 2026 09:26
@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_signature_verification_module branch from 81bf74b to 2768240 Compare January 15, 2026 09:26
@sirandreww-starkware sirandreww-starkware changed the base branch from 12-23-apollo_propeller_add_reconstruction_error_type to main-v0.14.1-committer January 15, 2026 17:48
@sirandreww-starkware sirandreww-starkware force-pushed the 12-23-apollo_propeller_add_signature_verification_module branch from 2768240 to 5e29cdb Compare January 15, 2026 17:52
Copy link
Contributor Author

@sirandreww-starkware sirandreww-starkware left a comment

Choose a reason for hiding this comment

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

@sirandreww-starkware reviewed 5 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware).

@sirandreww-starkware sirandreww-starkware added this pull request to the merge queue Jan 15, 2026
Merged via the queue into main-v0.14.1-committer with commit eee236a Jan 15, 2026
19 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments