Skip to content

Commit 270d0fa

Browse files
committed
IMPORTANT: force reindex in WithdrawalInitiatedLogV2
1 parent dcb58d8 commit 270d0fa

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

core/metrics.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,35 @@ func StartMetrics(ctx context.Context, cfg *Config, l1Client *ethclient.Client,
6363
ScannedBlockNumber.Set(float64(scannedBlock.Number))
6464

6565
var unprovenCnt int64
66-
result = db.Table("withdrawal_initiated_logs").Where("proven_time IS NULL AND failure_reason IS NULL").Count(&unprovenCnt)
66+
result = db.Table("withdrawal_initiated_log_v2").Where("proven_time IS NULL AND failure_reason IS NULL").Count(&unprovenCnt)
6767
if result.Error != nil {
6868
logger.Error("failed to count withdrawals", "error", result.Error)
6969
}
7070
UnprovenWithdrawals.Set(float64(unprovenCnt))
7171

7272
var unfinalizedCnt int64
73-
result = db.Table("withdrawal_initiated_logs").Where("finalized_time IS NULL AND proven_time IS NOT NULL AND failure_reason IS NULL").Count(&unfinalizedCnt)
73+
result = db.Table("withdrawal_initiated_log_v2").Where("finalized_time IS NULL AND proven_time IS NOT NULL AND failure_reason IS NULL").Count(&unfinalizedCnt)
7474
if result.Error != nil {
7575
logger.Error("failed to count withdrawals", "error", result.Error)
7676
}
7777
UnfinalizedWithdrawals.Set(float64(unfinalizedCnt))
7878

7979
var failedCnt int64
80-
result = db.Table("withdrawal_initiated_logs").Where("failure_reason IS NOT NULL").Count(&failedCnt)
80+
result = db.Table("withdrawal_initiated_log_v2").Where("failure_reason IS NOT NULL").Count(&failedCnt)
8181
if result.Error != nil {
8282
logger.Error("failed to count withdrawals", "error", result.Error)
8383
}
8484
FailedWithdrawals.Set(float64(failedCnt))
8585

8686
firstUnproven := WithdrawalInitiatedLogV2{}
87-
result = db.Table("withdrawal_initiated_logs").Order("id asc").Where("proven_time IS NULL AND failure_reason IS NULL").First(&firstUnproven)
87+
result = db.Table("withdrawal_initiated_log_v2").Order("id asc").Where("proven_time IS NULL AND failure_reason IS NULL").First(&firstUnproven)
8888
if result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound) {
8989
logger.Error("failed to query withdrawals", "error", result.Error)
9090
}
9191
EarliestUnProvenWithdrawalBlockNumber.Set(float64(firstUnproven.InitiatedBlockNumber))
9292

9393
firstUnfinalized := WithdrawalInitiatedLogV2{}
94-
result = db.Table("withdrawal_initiated_logs").Order("id asc").Where("finalized_time IS NULL AND proven_time IS NOT NULL AND failure_reason IS NULL").First(&firstUnfinalized)
94+
result = db.Table("withdrawal_initiated_log_v2").Order("id asc").Where("finalized_time IS NULL AND proven_time IS NOT NULL AND failure_reason IS NULL").First(&firstUnfinalized)
9595
if result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound) {
9696
logger.Error("failed to query withdrawals", "error", result.Error)
9797
}

core/types.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ type WithdrawalInitiatedLogV2 struct {
1414
ID uint `gorm:"primarykey"`
1515

1616
// TransactionHash and LogIndex are the L2 transaction hash and log index of the withdrawal event.
17-
TransactionHash string `gorm:"type:varchar(256);not null;uniqueIndex:idx_withdrawal_initiated_logs_transaction_hash_log_index_key,priority:1"`
18-
LogIndex int `gorm:"type:integer;not null;uniqueIndex:idx_withdrawal_initiated_logs_transaction_hash_log_index_key,priority:2"`
17+
TransactionHash string `gorm:"type:varchar(256);not null;uniqueIndex:idx_withdrawal_initiated_log_v2_transaction_hash_log_index_key,priority:1"`
18+
LogIndex int `gorm:"type:integer;not null;uniqueIndex:idx_withdrawal_initiated_log_v2_transaction_hash_log_index_key,priority:2"`
1919

2020
// InitiatedBlockNumber is the l2 block number at which the withdrawal was initiated on L2.
21-
InitiatedBlockNumber int64 `gorm:"type:integer;not null;index:idx_withdrawal_initiated_logs_initiated_block_number"`
21+
InitiatedBlockNumber int64 `gorm:"type:integer;not null;index:idx_withdrawal_initiated_log_v2_initiated_block_number"`
2222

2323
// ProvenTime is the local time at which the withdrawal was proven on L1. NULL if not yet proven.
24-
ProvenTime *time.Time `gorm:"type:datetime;index:idx_withdrawal_initiated_logs_proven_time"`
24+
ProvenTime *time.Time `gorm:"type:datetime;index:idx_withdrawal_initiated_log_v2_proven_time"`
2525

2626
// FinalizedTime is the local time at which the withdrawal was finalized on L1. NULL if not yet finalized.
27-
FinalizedTime *time.Time `gorm:"type:datetime;index:idx_withdrawal_initiated_logs_finalized_time"`
27+
FinalizedTime *time.Time `gorm:"type:datetime;index:idx_withdrawal_initiated_log_v2_finalized_time"`
2828

2929
// FailureReason is the reason for the withdrawal failure, including sending transaction error and off-chain configured filter error. NULL if not yet failed.
3030
FailureReason *string `gorm:"type:text"`

0 commit comments

Comments
 (0)