22from typing import List , NamedTuple , NewType , Tuple , Optional , NoReturn
33
44from secp256k1proto .bip340 import schnorr_sign , schnorr_verify
5- from secp256k1proto .secp256k1 import GE , Scalar
5+ from secp256k1proto .secp256k1 import G , GE , Scalar
66from .util import (
77 BIP_TAG ,
88 SecretKeyError ,
@@ -112,6 +112,7 @@ class ParticipantBlameState(NamedTuple):
112112 n : int
113113 idx : int
114114 secshare : Scalar
115+ secshare_tweak : Scalar
115116 pubshare : GE
116117
117118
@@ -204,16 +205,20 @@ def participant_step2(
204205 i , "Participant sent invalid proof-of-knowledge"
205206 )
206207 sum_coms = assemble_sum_coms (coms_to_secrets , sum_coms_to_nonconst_terms )
207- threshold_pubkey = sum_coms .commitment_to_secret ()
208- pubshare = sum_coms .pubshare (idx )
208+ sum_coms_tweaked , secshare_tweak = sum_coms .invalid_taproot_commit ()
209+ secshare += secshare_tweak
210+ threshold_pubkey = sum_coms_tweaked .commitment_to_secret ()
211+ pubshare = sum_coms_tweaked .pubshare (idx )
209212
210213 if not VSSCommitment .verify_secshare (secshare , pubshare ):
211214 raise UnknownFaultyParticipantOrCoordinatorError (
212- ParticipantBlameState (n , idx , secshare , pubshare ),
215+ ParticipantBlameState (n , idx , secshare , secshare_tweak , pubshare ),
213216 "Received invalid secshare, consider blaming to determine faulty party" ,
214217 )
215218
216- pubshares = [sum_coms .pubshare (i ) if i != idx else pubshare for i in range (n )]
219+ pubshares = [
220+ sum_coms_tweaked .pubshare (i ) if i != idx else pubshare for i in range (n )
221+ ]
217222 dkg_output = DKGOutput (
218223 secshare .to_bytes (),
219224 threshold_pubkey .to_bytes_compressed (),
@@ -228,13 +233,13 @@ def participant_blame(
228233 cblame : CoordinatorBlameMsg ,
229234 partial_secshares : List [Scalar ],
230235) -> NoReturn :
231- n , idx , secshare , pubshare = blame_state
236+ n , idx , secshare , secshare_tweak , pubshare = blame_state
232237 partial_pubshares = cblame .partial_pubshares
233238
234- if GE .sum (* partial_pubshares ) != pubshare :
239+ if GE .sum (* partial_pubshares ) + secshare_tweak * G != pubshare :
235240 raise FaultyCoordinatorError ("Sum of partial pubshares not equal to pubshare" )
236241
237- if Scalar .sum (* partial_secshares ) != secshare :
242+ if Scalar .sum (* partial_secshares ) + secshare_tweak != secshare :
238243 raise SecshareSumError ("Sum of partial secshares not equal to secshare" )
239244
240245 for i in range (n ):
@@ -286,8 +291,9 @@ def coordinator_step(
286291 cmsg = CoordinatorMsg (coms_to_secrets , sum_coms_to_nonconst_terms , pops )
287292
288293 sum_coms = assemble_sum_coms (coms_to_secrets , sum_coms_to_nonconst_terms )
289- threshold_pubkey = sum_coms .commitment_to_secret ()
290- pubshares = [sum_coms .pubshare (i ) for i in range (n )]
294+ sum_coms_tweaked , secshare_tweak = sum_coms .invalid_taproot_commit ()
295+ threshold_pubkey = sum_coms_tweaked .commitment_to_secret ()
296+ pubshares = [sum_coms_tweaked .pubshare (i ) for i in range (n )]
291297
292298 dkg_output = DKGOutput (
293299 None ,
0 commit comments