input+signrpc+lnwallet+multi: implement combined nonce support

Add CombinedNonce() and RegisterCombinedNonce() methods with full implementation
stack.

Interface and core implementation:
- input/musig2.go: Added methods to MuSig2Session and MuSig2Signer interfaces
- input/musig2_session_manager.go: MusigSessionManager implementation using
  HaveAllNonces flag for state tracking (simplified, no extra fields)
- internal/musig2v040: Stub implementations returning ErrUnsupportedMethod
- Mock implementations (MockInputSigner, MockSigner, DummySigner)

RPC layer:
- lnrpc/signrpc/signer.proto: RPC method definitions and messages
- lnrpc/signrpc/signer.yaml: REST API endpoint mappings
- Generated protobuf code (all .pb.go files)
- lnwallet/rpcwallet/rpcwallet.go: RPCKeyRing client implementation

The proto types and RPCKeyRing are added together since RPCKeyRing implements
the Signer interface and requires proto types to fulfill the contract.

For v0.4.0, these methods return ErrUnsupportedMethod. Use MuSig2Version100RC2
to access these features.
This commit is contained in:
Elle Mouton committed 2025-12-10 07:15:06 +02:00
1 parent cbcb6a4dcf
commit c945f6749e
15 files changed
+1204 -175

No files matched your search

+14
View File
@@ -8,3 +8,17 @@ This corresponds to the [MuSig2 BIP specification version of
We only keep this code here to allow implementing a backward compatible,
versioned MuSig2 RPC.
## Unsupported Methods
The following methods from the newer MuSig2 specifications are not supported in
this legacy v0.4.0 implementation and will return `ErrUnsupportedMethod` if
called:
- `CombinedNonce()`: Returns error instead of the combined nonce.
- `RegisterCombinedNonce()`: Returns error instead of registering a
pre-aggregated combined nonce.
These methods are only available when using MuSig2 v1.0.0rc2 or later. To use
these features, create sessions with `MuSig2Version100RC2` instead of
`MuSig2Version040`.
+17
View File
@@ -59,6 +59,11 @@ var (
// ErrNotEnoughSigners is returned if a caller attempts to obtain an
// early nonce when it wasn't specified
ErrNoEarlyNonce = fmt.Errorf("no early nonce available")
// ErrUnsupportedMethod is returned when calling methods that are not
// supported in the legacy v0.4.0 implementation.
ErrUnsupportedMethod = fmt.Errorf("method not supported in MuSig2 " +
"v0.4.0")
)
// Context is a managed signing context for musig2. It takes care of things
@@ -668,3 +673,15 @@ func (s *Session) CombineSig(sig *PartialSignature) (bool, error) {
func (s *Session) FinalSig() *schnorr.Signature {
return s.finalSig
}
// CombinedNonce is not supported in the legacy v0.4.0 implementation and will
// always return an error.
func (s *Session) CombinedNonce() ([PubNonceSize]byte, error) {
return [PubNonceSize]byte{}, ErrUnsupportedMethod
}
// RegisterCombinedNonce is not supported in the legacy v0.4.0 implementation
// and will always return an error.
func (s *Session) RegisterCombinedNonce(_ [PubNonceSize]byte) error {
return ErrUnsupportedMethod
}