Files
ark/server/internal/core/application/covenantless_event.go
Louis Singer c183f99244 Make the round participants sign the vtxo tree (#271)
* [proto] add APIs to send and receive musig2 signing data

* [common] add serialization functions for nonces and signatures

* [application] implements tree signing

* fix: remove old debug logs

* [proto] cleaning

* [common] fix musig2.go

* [application] fixes and logs

* [interface] fix: stop forwarding 2 times the events

* [client] add musig2 support + sign the tree when joining a round

* [interface] add new APIs into permissions.go

* [application][proto] rework PingResponse (return all events type)

* [common] split SetKeys into 2 distinct methods

* [client] fixes according to musig2.go changes

* [sdk] support tree signing + new PingResponse

* [sdk] fixes

* [application] revert event channel type

* [application] use domain.RoundEvent as lastEvent type

* [application] remove IsCovenantLess

* comments

* [application] revert roundAborted changes

* [interface] remove bitcointree dependencie
2024-08-30 14:32:35 +02:00

44 lines
1.3 KiB
Go

/*
* This package contains intermediary events that are used only by the covenantless version
* they let to sign the congestion tree using musig2 algorithm
* they are not included in domain because they don't mutate the Round state and should not be persisted
*/
package application
import (
"bytes"
"encoding/hex"
"github.com/ark-network/ark/common/bitcointree"
"github.com/ark-network/ark/common/tree"
"github.com/decred/dcrd/dcrec/secp256k1/v4"
)
// signer should react to this event by generating a musig2 nonce for each transaction in the tree
type RoundSigningStarted struct {
Id string
UnsignedVtxoTree tree.CongestionTree
Cosigners []*secp256k1.PublicKey
}
// signer should react to this event by partially signing the vtxo tree transactions
// then, delete its ephemeral key
type RoundSigningNoncesGenerated struct {
Id string
Nonces bitcointree.TreeNonces // aggregated nonces
}
func (e RoundSigningNoncesGenerated) SerializeNonces() (string, error) {
var serialized bytes.Buffer
if err := e.Nonces.Encode(&serialized); err != nil {
return "", err
}
return hex.EncodeToString(serialized.Bytes()), nil
}
// implement domain.RoundEvent interface
func (r RoundSigningStarted) IsEvent() {}
func (r RoundSigningNoncesGenerated) IsEvent() {}