Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

Commit 73cc0ff

Browse files
Improve docs around signature publication delays
1 parent 58bb77b commit 73cc0ff

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

pkg/node/node.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var logger = log.Logger("keep-ecdsa")
2929

3030
const (
3131
// Determines the delay which should be preserved before retrying
32-
// actions within the signing process.
32+
// actions within the key generation and signing process.
3333
retryDelay = 1 * time.Second
3434

3535
// Number of blocks which should elapse before confirming
@@ -39,7 +39,7 @@ const (
3939
// Used to calculate the publication delay factor for the given signer index
4040
// to avoid all signers publishing the same signature for given keep at the
4141
// same time.
42-
signerPublicationDelayStep = 5 * time.Minute
42+
signaturePublicationDelayStep = 5 * time.Minute
4343
)
4444

4545
// Node holds interfaces to interact with the blockchain and network messages
@@ -320,7 +320,7 @@ func (n *Node) publishSignature(
320320
digest [32]byte,
321321
signature *ecdsa.Signature,
322322
) error {
323-
n.waitSignerPublicationDelay(keepAddress)
323+
n.waitSignaturePublicationDelay(keepAddress)
324324

325325
attemptCounter := 0
326326
for {
@@ -433,14 +433,17 @@ func (n *Node) publishSignature(
433433
}
434434
}
435435

436-
func (n *Node) waitSignerPublicationDelay(
436+
// waitSignaturePublicationDelay waits a certain amount of time appropriately
437+
// for the given signer index to avoid all signers publishing the same signature
438+
// for given keep at the same time.
439+
func (n *Node) waitSignaturePublicationDelay(
437440
keepAddress common.Address,
438441
) {
439442
signerIndex, err := n.getSignerIndex(keepAddress)
440443
if err != nil {
441-
logger.Error(
442-
"could not determine signer publication delay for keep [%s]: "+
443-
"[%v]; signer publication delay will not be preserved",
444+
logger.Errorf(
445+
"could not determine signature publication delay for keep [%s]: "+
446+
"[%v]; the signature publication will not be delayed",
444447
keepAddress.String(),
445448
err,
446449
)
@@ -449,17 +452,16 @@ func (n *Node) waitSignerPublicationDelay(
449452

450453
// just in case this function is not invoked in the right context
451454
if signerIndex < 0 {
452-
logger.Error(
453-
"could not determine signer publication delay for keep [%s]: "+
454-
"[signer index is less than zero]; "+
455-
"signer publication delay will not be preserved",
455+
logger.Errorf(
456+
"could not determine signature publication delay for keep [%s], "+
457+
"signer index is less than zero; the signature publication "+
458+
"will not be delayed",
456459
keepAddress.String(),
457-
err,
458460
)
459461
return
460462
}
461463

462-
delay := time.Duration(signerIndex) * signerPublicationDelayStep
464+
delay := time.Duration(signerIndex) * signaturePublicationDelayStep
463465

464466
logger.Infof(
465467
"waiting [%v] before publishing signature for keep [%s]",

0 commit comments

Comments
 (0)