Skip to content

Commit 7004553

Browse files
RFC 12 Implementation: Reduce heartbeat probability to 6.25% (#3759)
Refs: threshold-network/tbtc-v2#737 The currently used probability of 12.5% means that a completely idle wallet will perform a heartbeat every 4 coordination windows on average (or 8 in the worst case) so, every 3600 blocks (~12 hours assuming a coordination every 900 blocks and 12 seconds per Ethereum block). User acceptance tests executed on our Sepolia testnet (10 live wallets) show that such a value often leads to simultaneous heartbeats for several wallets at the same time. This, in turn, can cause increased resource consumption for individual nodes and harm some signing processes. Although nothing bad happens if those are just heartbeats, this may be problematic for redemptions and deposit sweeps. To lower the risk of signing failures, we are lowering the heartbeat probability to 6.25%. The probability of 6.25% means that a completely idle wallet will perform a heartbeat every 8 coordination windows on average (or 16 in the worst case) so, every 7200 blocks (~24 hours assuming a coordination every 900 blocks and 12 seconds per Ethereum block).
2 parents 98ef3fd + c89a3c0 commit 7004553

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pkg/tbtc/coordination.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const (
4747
// coordinationHeartbeatProbability is the probability of proposing a
4848
// heartbeat action during the coordination procedure, assuming no other
4949
// higher-priority action is proposed.
50-
coordinationHeartbeatProbability = float64(0.125)
50+
coordinationHeartbeatProbability = float64(0.0625)
5151
// coordinationMessageReceiveBuffer is a buffer for messages received from
5252
// the broadcast channel needed when the coordination follower is
5353
// temporarily too slow to handle them. Keep in mind that although we

pkg/tbtc/coordination_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,10 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
568568
},
569569
"block 3600": {
570570
coordinationBlock: 3600,
571-
expectedChecklist: []WalletActionType{ActionRedemption},
571+
expectedChecklist: []WalletActionType{
572+
ActionRedemption,
573+
ActionHeartbeat,
574+
},
572575
},
573576
"block 4500": {
574577
coordinationBlock: 4500,
@@ -579,7 +582,6 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
579582
coordinationBlock: 5400,
580583
expectedChecklist: []WalletActionType{
581584
ActionRedemption,
582-
ActionHeartbeat,
583585
},
584586
},
585587
"block 6300": {
@@ -615,7 +617,6 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
615617
coordinationBlock: 12600,
616618
expectedChecklist: []WalletActionType{
617619
ActionRedemption,
618-
ActionHeartbeat,
619620
},
620621
},
621622
"block 13500": {
@@ -643,7 +644,7 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
643644

644645
// Build an arbitrary seed based on the coordination block number.
645646
seed := sha256.Sum256(
646-
big.NewInt(int64(window.coordinationBlock) + 1).Bytes(),
647+
big.NewInt(int64(window.coordinationBlock) + 2).Bytes(),
647648
)
648649

649650
checklist := executor.getActionsChecklist(window.index(), seed)

0 commit comments

Comments
 (0)