From e9e0e686c50b93bc93c095e83bcdab6a37b22401 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Tue, 15 Jul 2025 12:05:00 +0200 Subject: [PATCH 1/2] fix: panic for nil pointer dereference runRangeCheck --- pkg/coordinator/tasks/check_consensus_slot_range/task.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/coordinator/tasks/check_consensus_slot_range/task.go b/pkg/coordinator/tasks/check_consensus_slot_range/task.go index a14e619d..7efa7093 100644 --- a/pkg/coordinator/tasks/check_consensus_slot_range/task.go +++ b/pkg/coordinator/tasks/check_consensus_slot_range/task.go @@ -99,7 +99,12 @@ func (t *Task) Execute(ctx context.Context) error { func (t *Task) runRangeCheck() (checkResult, isLower bool) { consensusPool := t.ctx.Scheduler.GetServices().ClientPool().GetConsensusPool() - if consensusPool.GetBlockCache().GetGenesis().GenesisTime.Compare(time.Now()) >= 0 { + genesis := consensusPool.GetBlockCache().GetGenesis() + if genesis == nil { + t.logger.Errorf("genesis data not available") + return false, true + } + if genesis.GenesisTime.Compare(time.Now()) >= 0 { return false, true } @@ -109,7 +114,7 @@ func (t *Task) runRangeCheck() (checkResult, isLower bool) { return false, true } - t.ctx.Outputs.SetVar("genesisTime", consensusPool.GetBlockCache().GetGenesis().GenesisTime.Unix()) + t.ctx.Outputs.SetVar("genesisTime", genesis.GenesisTime.Unix()) t.ctx.Outputs.SetVar("currentSlot", currentSlot.Number()) t.ctx.Outputs.SetVar("currentEpoch", currentEpoch.Number()) From 69a4b7d49b7f95b37ee3ea5d38665d7a7bb6d0ca Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Tue, 5 Aug 2025 17:24:13 +0200 Subject: [PATCH 2/2] fix lint --- pkg/coordinator/tasks/check_consensus_slot_range/task.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/coordinator/tasks/check_consensus_slot_range/task.go b/pkg/coordinator/tasks/check_consensus_slot_range/task.go index 7efa7093..021bf96a 100644 --- a/pkg/coordinator/tasks/check_consensus_slot_range/task.go +++ b/pkg/coordinator/tasks/check_consensus_slot_range/task.go @@ -100,10 +100,12 @@ func (t *Task) Execute(ctx context.Context) error { func (t *Task) runRangeCheck() (checkResult, isLower bool) { consensusPool := t.ctx.Scheduler.GetServices().ClientPool().GetConsensusPool() genesis := consensusPool.GetBlockCache().GetGenesis() + if genesis == nil { t.logger.Errorf("genesis data not available") return false, true } + if genesis.GenesisTime.Compare(time.Now()) >= 0 { return false, true }