Skip to content

Conversation

@leonardocustodio
Copy link

@leonardocustodio leonardocustodio commented Dec 8, 2025

Hello @wolfmcnally ,
This PR aims to add sr25119 support. This is the default signature type used by Polkadot and any Substrate-compatible blockchain. More info here

Copilot AI review requested due to automatic review settings December 8, 2025 19:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for the SR25519 (Schnorr-Ristretto) signature scheme, which is commonly used in the Substrate and Polkadot ecosystems. The implementation provides comprehensive support including key generation, signing, verification, and serialization.

Key Changes

  • Implements Sr25519PrivateKey and Sr25519PublicKey types with full signing and verification capabilities
  • Integrates SR25519 into the existing SigningPrivateKey, SigningPublicKey, and Signature enums
  • Adds SR25519 to SignatureScheme enum for consistent key pair generation
  • Updates feature flags, tests, and documentation across the codebase

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/sr25519/sr25519_public_key.rs New file implementing SR25519 public key with verification and serialization
src/sr25519/sr25519_private_key.rs New file implementing SR25519 private key with signing, key derivation, and seed management
src/sr25519/mod.rs Module definition and documentation for SR25519 types
src/signing/signing_public_key.rs Adds Sr25519 variant to SigningPublicKey enum with CBOR encoding support
src/signing/signing_private_key.rs Adds Sr25519 variant to SigningPrivateKey enum with signing and encoding support
src/signing/signature.rs Adds Sr25519 signature variant with CBOR encoding and scheme detection
src/signing/signature_scheme.rs Adds Sr25519 scheme with keypair generation support
src/signing/mod.rs Adds SR25519 signing tests and updates conditional compilation flags
src/lib.rs Exports Sr25519PrivateKey and Sr25519PublicKey types
src/public_keys.rs Updates feature flags to include sr25519
src/private_keys.rs Updates feature flags to include sr25519
src/keypair.rs Updates feature flags to include sr25519
Cargo.toml Adds schnorrkel and blake2 dependencies with sr25519 feature flag, includes in default features
run_tests.sh Adds test configurations for sr25519 feature combinations
README.md Documents new Sr25519PrivateKey and Sr25519PublicKey types
CODING.md Updates documentation checklist to include SR25519 types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +890 to +893
#[cfg(feature = "sr25519")]
SigningPrivateKey::Sr25519(key) => {
vec![(3).into(), CBOR::to_byte_string(key.to_seed())].into()
}
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The conditional compilation in the subsequent not(any(...)) attribute (around line 904-909) is missing feature = "sr25519". This will cause a compilation error when sr25519 is the only feature enabled, since the wildcard pattern will be marked as unreachable but won't actually be unreachable. The encoder documentation should also be updated to mention SR25519 encoding (around line 866-877).

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

This doesn't seem to be true:

cargo build --features=sr25519

Works without any compilation issues.

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.

1 participant