Skip to content

Commit

Permalink
Modified the required number of signatures during inactivity claim
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed May 3, 2024
1 parent 9b1786a commit 6c9fad6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
5 changes: 2 additions & 3 deletions pkg/protocol/inactivity/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ func newSigningMember(
sessionID string,
) *signingMember {
return &signingMember{
logger: logger,
memberIndex: memberIndex,
// TODO: Check is this is a correct way to create the group.
logger: logger,
memberIndex: memberIndex,
group: group.NewGroup(dishonestThreshold, groupSize),
membershipValidator: membershipValidator,
sessionID: sessionID,
Expand Down
21 changes: 8 additions & 13 deletions pkg/protocol/inactivity/states.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,14 @@ func (css *claimSigningState) Receive(netMessage net.Message) error {
}

func (css *claimSigningState) CanTransition() bool {
// Although there is no hard requirement to expect signature messages
// from all participants, it makes sense to do so because this is an
// additional participant availability check that allows to maximize
// the final count of active participants. Moreover, this check does not
// bound the signing state to a fixed duration and one can move to the
// next state as soon as possible.
messagingDone := len(receivedMessages[*claimSignatureMessage](css.BaseAsyncState)) ==
len(css.member.group.OperatingMemberIndexes())-1

// TODO: Modify the above code so that only 51 members are needed. Since it
// is executed after a failed heartbeat, we cannot expect all the
// members to sign the claim. In the future consider taking the number
// of active signers from the heartbeat procedure.
// Require the number of received signatures to be at least the honest
// threshold. Unlike in the case of DKG, we cannot expect all the members to
// participate in signing as we know we are dealing with some problem
// arising from operator inactivity.
// TODO: Consider passing the number of required signatures from the code
// that launched the inactivity operator execution.
messagingDone := len(receivedMessages[*claimSignatureMessage](css.BaseAsyncState)) >=
css.member.group.HonestThreshold()

return messagingDone
}
Expand Down
20 changes: 19 additions & 1 deletion pkg/tbtc/inactivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tbtc

import (
"context"
"errors"
"fmt"
"math/big"
"sync"
Expand Down Expand Up @@ -134,7 +135,7 @@ func (ice *inactivityClaimExecutor) publishClaim(
)
defer cancelCtx()

ice.publish(
err := ice.publish(
ctx,
execLogger,
message,
Expand All @@ -148,6 +149,23 @@ func (ice *inactivityClaimExecutor) publishClaim(
claim,
)

if err != nil {
if errors.Is(err, context.Canceled) {
execLogger.Infof(
"[member:%v] inactivity claim is no longer awaiting "+
"publishing; aborting inactivity claim publishing",
signer.signingGroupMemberIndex,
)
return
}

execLogger.Errorf(
"[member:%v] inactivity claim publishing failed [%v]",
signer.signingGroupMemberIndex,
err,
)
return
}
}(currentSigner)
}

Expand Down

0 comments on commit 6c9fad6

Please sign in to comment.