Skip to content

Commit

Permalink
Fixed issues related to launching inactivity submission
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed May 3, 2024
1 parent 4db1804 commit a130a35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/tbtc/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ type InactivityChainClaim struct {
}

type InactivityClaimChain interface {
// AssembleDKGResult assembles the inactivity chain claim according to the
// rules expected by the given chain.
// AssembleInactivityClaim assembles the inactivity chain claim according to
// the rules expected by the given chain.
AssembleInactivityClaim(
walletID [32]byte,
inactiveMembersIndices []group.MemberIndex,
Expand Down
14 changes: 10 additions & 4 deletions pkg/tbtc/inactivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ func (ice *inactivityClaimExecutor) publishClaim(
return fmt.Errorf("cannot marshal wallet public key: [%v]", err)
}

timeoutBlock := startBlock + inactivityClaimMaximumSubmissionBlocks

execLogger := logger.With(
zap.String("wallet", fmt.Sprintf("0x%x", walletPublicKeyBytes)),
zap.Uint64("inactivityClaimStartBlock", startBlock),
zap.Uint64("inactivityClaimTimeoutBlock", timeoutBlock),
)

walletRegistryData, err := ice.chain.GetWallet(walletPublicKeyHash)
Expand Down Expand Up @@ -125,12 +129,15 @@ func (ice *inactivityClaimExecutor) publishClaim(

defer wg.Done()

inactivityClaimTimeoutBlock := startBlock + inactivityClaimMaximumSubmissionBlocks

go func(signer *signer) {
execLogger.Info(
"[member:%v] starting inactivity claim publishing",
signer.signingGroupMemberIndex,
)

ctx, cancelCtx := withCancelOnBlock(
context.Background(),
inactivityClaimTimeoutBlock,
timeoutBlock,
ice.waitForBlockFn,
)
defer cancelCtx()
Expand All @@ -148,7 +155,6 @@ func (ice *inactivityClaimExecutor) publishClaim(
ice.membershipValidator,
claim,
)

if err != nil {
if errors.Is(err, context.Canceled) {
execLogger.Infof(
Expand Down
2 changes: 1 addition & 1 deletion pkg/tbtc/inactivity_submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (ics *inactivityClaimSubmitter) SubmitClaim(
err = ics.waitForBlockFn(ctx, submissionBlock)
if err != nil {
return fmt.Errorf(
"error while waiting for DKG result submission block: [%v]",
"error while waiting for inactivity claim submission block: [%v]",
err,
)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/tbtc/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func newNode(
protocolLatch: latch,
heartbeatFailureCounters: make(map[string]*uint),
signingExecutors: make(map[string]*signingExecutor),
inactivityClaimExecutors: make(map[string]*inactivityClaimExecutor),
coordinationExecutors: make(map[string]*coordinationExecutor),
proposalGenerator: proposalGenerator,
}
Expand Down Expand Up @@ -512,7 +513,7 @@ func (n *node) getInactivityClaimExecutor(
}

executorLogger.Infof(
"signing executor created; controlling [%v] signers",
"inactivity executor created; controlling [%v] signers",
len(signers),
)

Expand Down

0 comments on commit a130a35

Please sign in to comment.