@@ -24,11 +24,12 @@ import { SimpleFallbackJsonRpcBatchProvider } from '@lido-nestjs/execution';
24
24
25
25
@Injectable ( )
26
26
export class SweepService {
27
+ static SERVICE_LOG_NAME = 'sweep' ;
28
+
27
29
constructor (
28
30
@Inject ( LOGGER_PROVIDER ) protected readonly logger : LoggerService ,
29
31
protected readonly consensusClientService : ConsensusClientService ,
30
32
protected readonly provider : SimpleFallbackJsonRpcBatchProvider ,
31
- protected readonly genesisService : GenesisTimeService ,
32
33
protected readonly configService : ConfigService ,
33
34
) { }
34
35
@@ -46,6 +47,12 @@ export class SweepService {
46
47
const isElectraActivate = await this . consensusClientService . isElectraActivated ( currentEpoch ) ;
47
48
const consensusVersion = await this . getConsensusVersion ( ) ;
48
49
50
+ this . logger . log ( 'check electra info' , {
51
+ isElectraActivate,
52
+ consensusVersion,
53
+ service : SweepService . SERVICE_LOG_NAME ,
54
+ } ) ;
55
+
49
56
if ( consensusVersion < 3 || ! isElectraActivate ) {
50
57
return this . getSweepDelayInEpochsPreElectra ( indexedValidators , currentEpoch ) ;
51
58
}
@@ -58,7 +65,10 @@ export class SweepService {
58
65
const totalWithdrawableValidators = this . getWithdrawableValidatorsNumber ( indexedValidators , epoch ) ;
59
66
60
67
const fullSweepInEpochs = totalWithdrawableValidators / MAX_WITHDRAWALS_PER_PAYLOAD / SLOTS_PER_EPOCH ;
61
- return Math . floor ( fullSweepInEpochs * 0.5 ) ;
68
+ const result = Math . floor ( fullSweepInEpochs * 0.5 ) ;
69
+
70
+ this . logger . log ( 'calculated sweep delay in epochs pre electra' , { result, service : SweepService . SERVICE_LOG_NAME } ) ;
71
+ return result ;
62
72
}
63
73
64
74
// pre pectra
@@ -80,7 +90,13 @@ export class SweepService {
80
90
const fullSweepCycleInEpochs = Math . ceil (
81
91
withdrawalsNumberInSweepCycle / MAX_WITHDRAWALS_PER_PAYLOAD / SLOTS_PER_EPOCH ,
82
92
) ;
83
- return Math . floor ( fullSweepCycleInEpochs / 2 ) ;
93
+
94
+ const result = Math . floor ( fullSweepCycleInEpochs * 0.5 ) ;
95
+ this . logger . log ( 'calculated sweep delay in epochs post electra' , {
96
+ result,
97
+ service : SweepService . SERVICE_LOG_NAME ,
98
+ } ) ;
99
+ return result ;
84
100
}
85
101
86
102
private predictWithdrawalsNumberInSweepCycle ( state : BeaconState , indexedValidators : IndexedValidator [ ] ) : number {
0 commit comments