Skip to content

Commit 50181dd

Browse files
committed
feat(tbtc): set activation block to 24559289 (~March 1st 2026)
Set DepositSweepEveryWindowActivationBlock to 24559289, the estimated Ethereum block height for March 1st 00:00 UTC. Before this block, all three actions (DepositSweep, MovedFundsSweep, MovingFunds) remain gated to every 4th coordination window. After this block, DepositSweep and MovedFundsSweep run on every window while MovingFunds stays gated. Update tests to cover both pre-activation (low block numbers) and post-activation (blocks above 24559289) code paths with correct expected checklists for each regime.
1 parent 6ad7484 commit 50181dd

2 files changed

Lines changed: 65 additions & 108 deletions

File tree

pkg/tbtc/coordination.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ const (
6464
// which DepositSweep and MovedFundsSweep actions become available on every
6565
// coordination window instead of every 4th window only. All operators must
6666
// upgrade to a binary containing this constant before the activation block
67-
// is reached. The placeholder value must be replaced with the actual
68-
// activation block height before release.
69-
DepositSweepEveryWindowActivationBlock = uint64(0)
67+
// is reached.
68+
DepositSweepEveryWindowActivationBlock = uint64(24559289)
7069
)
7170

7271
// errCoordinationExecutorBusy is an error returned when the coordination

pkg/tbtc/coordination_test.go

Lines changed: 63 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,11 @@ func TestCoordinationExecutor_GetLeader(t *testing.T) {
560560
}
561561

562562
func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
563-
// All test cases below exercise the post-activation code path because
564-
// DepositSweepEveryWindowActivationBlock is uint64(0), making the
565-
// condition coordinationBlock < 0 always false for unsigned integers.
566-
// As a result, DepositSweep and MovedFundsSweep are checked on every
567-
// valid coordination window, while MovingFunds remains gated to every
568-
// 4th window. When the activation constant is set to a real future
569-
// block, a separate test function should cover pre-activation behavior.
563+
// All test cases below exercise the pre-activation code path because
564+
// their coordination blocks are below
565+
// DepositSweepEveryWindowActivationBlock. In this mode, all three
566+
// actions (DepositSweep, MovedFundsSweep, MovingFunds) are gated to
567+
// every 4th coordination window.
570568
tests := map[string]struct {
571569
coordinationBlock uint64
572570
expectedChecklist []WalletActionType
@@ -576,38 +574,26 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
576574
coordinationBlock: 0,
577575
expectedChecklist: nil,
578576
},
579-
// Non-4th-window: Redemption + DepositSweep + MovedFundsSweep.
577+
// Non-4th-window: only Redemption.
580578
"block 900": {
581579
coordinationBlock: 900,
582-
expectedChecklist: []WalletActionType{
583-
ActionRedemption,
584-
ActionDepositSweep,
585-
ActionMovedFundsSweep,
586-
},
580+
expectedChecklist: []WalletActionType{ActionRedemption},
587581
},
588582
// Incorrect coordination window (windowIndex == 0, returns nil).
589583
"block 901": {
590584
coordinationBlock: 901,
591585
expectedChecklist: nil,
592586
},
593-
// Non-4th-window: Redemption + DepositSweep + MovedFundsSweep.
587+
// Non-4th-window: only Redemption.
594588
"block 1800": {
595589
coordinationBlock: 1800,
596-
expectedChecklist: []WalletActionType{
597-
ActionRedemption,
598-
ActionDepositSweep,
599-
ActionMovedFundsSweep,
600-
},
590+
expectedChecklist: []WalletActionType{ActionRedemption},
601591
},
602592
"block 2700": {
603593
coordinationBlock: 2700,
604-
expectedChecklist: []WalletActionType{
605-
ActionRedemption,
606-
ActionDepositSweep,
607-
ActionMovedFundsSweep,
608-
},
594+
expectedChecklist: []WalletActionType{ActionRedemption},
609595
},
610-
// 4th-window (window 4): adds MovingFunds. Heartbeat randomly
596+
// 4th-window (window 4): all actions present. Heartbeat randomly
611597
// selected for this specific seed.
612598
"block 3600": {
613599
coordinationBlock: 3600,
@@ -621,29 +607,17 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
621607
},
622608
"block 4500": {
623609
coordinationBlock: 4500,
624-
expectedChecklist: []WalletActionType{
625-
ActionRedemption,
626-
ActionDepositSweep,
627-
ActionMovedFundsSweep,
628-
},
610+
expectedChecklist: []WalletActionType{ActionRedemption},
629611
},
630612
"block 5400": {
631613
coordinationBlock: 5400,
632-
expectedChecklist: []WalletActionType{
633-
ActionRedemption,
634-
ActionDepositSweep,
635-
ActionMovedFundsSweep,
636-
},
614+
expectedChecklist: []WalletActionType{ActionRedemption},
637615
},
638616
"block 6300": {
639617
coordinationBlock: 6300,
640-
expectedChecklist: []WalletActionType{
641-
ActionRedemption,
642-
ActionDepositSweep,
643-
ActionMovedFundsSweep,
644-
},
618+
expectedChecklist: []WalletActionType{ActionRedemption},
645619
},
646-
// 4th-window (window 8): adds MovingFunds.
620+
// 4th-window (window 8): all actions present except heartbeat.
647621
"block 7200": {
648622
coordinationBlock: 7200,
649623
expectedChecklist: []WalletActionType{
@@ -655,29 +629,17 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
655629
},
656630
"block 8100": {
657631
coordinationBlock: 8100,
658-
expectedChecklist: []WalletActionType{
659-
ActionRedemption,
660-
ActionDepositSweep,
661-
ActionMovedFundsSweep,
662-
},
632+
expectedChecklist: []WalletActionType{ActionRedemption},
663633
},
664634
"block 9000": {
665635
coordinationBlock: 9000,
666-
expectedChecklist: []WalletActionType{
667-
ActionRedemption,
668-
ActionDepositSweep,
669-
ActionMovedFundsSweep,
670-
},
636+
expectedChecklist: []WalletActionType{ActionRedemption},
671637
},
672638
"block 9900": {
673639
coordinationBlock: 9900,
674-
expectedChecklist: []WalletActionType{
675-
ActionRedemption,
676-
ActionDepositSweep,
677-
ActionMovedFundsSweep,
678-
},
640+
expectedChecklist: []WalletActionType{ActionRedemption},
679641
},
680-
// 4th-window (window 12): adds MovingFunds.
642+
// 4th-window (window 12): all actions present except heartbeat.
681643
"block 10800": {
682644
coordinationBlock: 10800,
683645
expectedChecklist: []WalletActionType{
@@ -689,29 +651,19 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
689651
},
690652
"block 11700": {
691653
coordinationBlock: 11700,
692-
expectedChecklist: []WalletActionType{
693-
ActionRedemption,
694-
ActionDepositSweep,
695-
ActionMovedFundsSweep,
696-
},
654+
expectedChecklist: []WalletActionType{ActionRedemption},
697655
},
698656
"block 12600": {
699657
coordinationBlock: 12600,
700658
expectedChecklist: []WalletActionType{
701659
ActionRedemption,
702-
ActionDepositSweep,
703-
ActionMovedFundsSweep,
704660
},
705661
},
706662
"block 13500": {
707663
coordinationBlock: 13500,
708-
expectedChecklist: []WalletActionType{
709-
ActionRedemption,
710-
ActionDepositSweep,
711-
ActionMovedFundsSweep,
712-
},
664+
expectedChecklist: []WalletActionType{ActionRedemption},
713665
},
714-
// 4th-window (window 16): adds MovingFunds.
666+
// 4th-window (window 16): all actions present except heartbeat.
715667
"block 14400": {
716668
coordinationBlock: 14400,
717669
expectedChecklist: []WalletActionType{
@@ -765,90 +717,96 @@ func TestCoordinationExecutor_GetActionsChecklist(t *testing.T) {
765717
// are explicitly asserted beyond simple checklist comparison to guard
766718
// against regressions that a full-list deep-equal alone might miss.
767719
//
768-
// When DepositSweepEveryWindowActivationBlock is set to a real future
769-
// block height, pre-activation boundary cases should be added to a
770-
// separate test function.
720+
// All coordination blocks used here are above
721+
// DepositSweepEveryWindowActivationBlock to exercise the post-activation
722+
// code path.
771723
func TestCoordinationExecutor_GetActionsChecklist_PostActivation(t *testing.T) {
772724
tests := map[string]struct {
773725
coordinationBlock uint64
774726
expectedChecklist []WalletActionType
775727
is4thWindow bool
776728
}{
777-
// Activation boundary: block 0 equals
778-
// DepositSweepEveryWindowActivationBlock. Window index is 0
779-
// (invalid), so the function returns nil.
780-
"activation block boundary": {
781-
coordinationBlock: 0,
782-
expectedChecklist: nil,
783-
is4thWindow: false,
784-
},
785-
// First valid coordination window after the activation block.
786-
// Non-4th window: DepositSweep and MovedFundsSweep present,
787-
// MovingFunds absent.
788-
"post-activation window 1": {
789-
coordinationBlock: 900,
729+
// Non-4th window (window 27289): DepositSweep and
730+
// MovedFundsSweep present, MovingFunds absent.
731+
"post-activation non-4th window 27289": {
732+
coordinationBlock: 24560100,
790733
expectedChecklist: []WalletActionType{
791734
ActionRedemption,
792735
ActionDepositSweep,
793736
ActionMovedFundsSweep,
794737
},
795738
is4thWindow: false,
796739
},
797-
"post-activation window 2": {
798-
coordinationBlock: 1800,
740+
"post-activation non-4th window 27290": {
741+
coordinationBlock: 24561000,
799742
expectedChecklist: []WalletActionType{
800743
ActionRedemption,
801744
ActionDepositSweep,
802745
ActionMovedFundsSweep,
803746
},
804747
is4thWindow: false,
805748
},
806-
"post-activation window 3": {
807-
coordinationBlock: 2700,
749+
"post-activation non-4th window 27291": {
750+
coordinationBlock: 24561900,
808751
expectedChecklist: []WalletActionType{
809752
ActionRedemption,
810753
ActionDepositSweep,
811754
ActionMovedFundsSweep,
812755
},
813756
is4thWindow: false,
814757
},
815-
// 4th window (window index 4, divisible by 4): MovingFunds
816-
// appears. Heartbeat is included because the seed derived from
817-
// block 3602 triggers the probabilistic selection.
818-
"post-activation window 4 (4th window with heartbeat)": {
819-
coordinationBlock: 3600,
758+
// 4th window (window 27292, divisible by 4): MovingFunds
759+
// appears. Heartbeat is NOT triggered for this seed.
760+
"post-activation 4th window 27292 no heartbeat": {
761+
coordinationBlock: 24562800,
820762
expectedChecklist: []WalletActionType{
821763
ActionRedemption,
822764
ActionDepositSweep,
823765
ActionMovedFundsSweep,
824766
ActionMovingFunds,
825-
ActionHeartbeat,
826767
},
827768
is4thWindow: true,
828769
},
829-
"post-activation window 5": {
830-
coordinationBlock: 4500,
770+
"post-activation non-4th window 27293": {
771+
coordinationBlock: 24563700,
831772
expectedChecklist: []WalletActionType{
832773
ActionRedemption,
833774
ActionDepositSweep,
834775
ActionMovedFundsSweep,
835776
},
836777
is4thWindow: false,
837778
},
838-
"post-activation window 6": {
839-
coordinationBlock: 5400,
779+
// Non-4th window (window 27310) with heartbeat triggered by
780+
// seed, verifying heartbeat works independently of the 4th-
781+
// window gate.
782+
"post-activation non-4th window 27310 with heartbeat": {
783+
coordinationBlock: 24579000,
840784
expectedChecklist: []WalletActionType{
841785
ActionRedemption,
842786
ActionDepositSweep,
843787
ActionMovedFundsSweep,
788+
ActionHeartbeat,
844789
},
845790
is4thWindow: false,
846791
},
847-
// 4th window (window index 8, divisible by 4): MovingFunds
848-
// appears. Heartbeat is NOT triggered for this seed, verifying
849-
// that 4th-window behavior works independently of heartbeat.
850-
"post-activation window 8 (4th window no heartbeat)": {
851-
coordinationBlock: 7200,
792+
// 4th window (window 27320, divisible by 4): MovingFunds
793+
// appears. Heartbeat is also triggered for this seed.
794+
"post-activation 4th window 27320 with heartbeat": {
795+
coordinationBlock: 24588000,
796+
expectedChecklist: []WalletActionType{
797+
ActionRedemption,
798+
ActionDepositSweep,
799+
ActionMovedFundsSweep,
800+
ActionMovingFunds,
801+
ActionHeartbeat,
802+
},
803+
is4thWindow: true,
804+
},
805+
// 4th window (window 27296, divisible by 4): MovingFunds
806+
// appears. Heartbeat is NOT triggered, verifying that
807+
// 4th-window behavior works independently of heartbeat.
808+
"post-activation 4th window 27296 no heartbeat": {
809+
coordinationBlock: 24566400,
852810
expectedChecklist: []WalletActionType{
853811
ActionRedemption,
854812
ActionDepositSweep,

0 commit comments

Comments
 (0)