@@ -34,6 +34,7 @@ use solana_client::{
3434use solana_clock:: { Clock , Slot , UnixTimestamp } ;
3535use solana_commitment_config:: { CommitmentConfig , CommitmentLevel } ;
3636use solana_epoch_info:: EpochInfo ;
37+ use solana_epoch_schedule:: EpochSchedule ;
3738use solana_hash:: Hash ;
3839use solana_loader_v3_interface:: { get_program_data_address, state:: UpgradeableLoaderState } ;
3940use solana_message:: {
@@ -215,23 +216,30 @@ impl SurfnetSvmLocker {
215216 do_profile_instructions : bool ,
216217 log_bytes_limit : Option < usize > ,
217218 ) -> SurfpoolResult < EpochInfo > {
218- let mut epoch_info = if let Some ( remote_client) = remote_ctx {
219- remote_client. get_epoch_info ( ) . await ?
219+ let ( mut epoch_info, epoch_schedule) = if let Some ( remote_client) = remote_ctx {
220+ let epoch_info = remote_client. get_epoch_info ( ) . await ?;
221+ let epoch_schedule = remote_client. get_epoch_schedule ( ) . await ?;
222+ ( epoch_info, epoch_schedule)
220223 } else {
221- EpochInfo {
222- epoch : 0 ,
223- slot_index : 0 ,
224- slots_in_epoch : SLOTS_PER_EPOCH ,
225- absolute_slot : FINALIZATION_SLOT_THRESHOLD ,
226- block_height : FINALIZATION_SLOT_THRESHOLD ,
227- transaction_count : None ,
228- }
224+ let epoch_schedule = EpochSchedule :: without_warmup ( ) ;
225+ (
226+ EpochInfo {
227+ epoch : 0 ,
228+ slot_index : 0 ,
229+ slots_in_epoch : epoch_schedule. slots_per_epoch ,
230+ absolute_slot : FINALIZATION_SLOT_THRESHOLD ,
231+ block_height : FINALIZATION_SLOT_THRESHOLD ,
232+ transaction_count : None ,
233+ } ,
234+ epoch_schedule,
235+ )
229236 } ;
230237 epoch_info. transaction_count = None ;
231238
232239 self . with_svm_writer ( |svm_writer| {
233240 svm_writer. initialize (
234241 epoch_info. clone ( ) ,
242+ epoch_schedule. clone ( ) ,
235243 slot_time,
236244 remote_ctx,
237245 do_profile_instructions,
@@ -3776,6 +3784,7 @@ mod tests {
37763784
37773785 use solana_account:: Account ;
37783786 use solana_account_decoder:: UiAccountEncoding ;
3787+ use solana_epoch_schedule:: EpochSchedule ;
37793788 use solana_transaction_status:: TransactionStatusMeta ;
37803789
37813790 use super :: * ;
@@ -4836,4 +4845,28 @@ mod tests {
48364845 assert ! ( sigs. contains( & sig_a. to_string( ) ) ) ;
48374846 assert ! ( sigs. contains( & sig_b. to_string( ) ) ) ;
48384847 }
4848+
4849+ #[ tokio:: test( flavor = "multi_thread" ) ]
4850+ async fn initializes_epoch_schedule_without_warmup_when_offline ( ) {
4851+ let ( surfnet_svm, _simnet_events_rx, _geyser_events_rx) = SurfnetSvm :: default ( ) ;
4852+ let svm_locker = SurfnetSvmLocker :: new ( surfnet_svm) ;
4853+
4854+ svm_locker
4855+ . initialize ( 400 , & None , false , None )
4856+ . await
4857+ . expect ( "initialize should succeed" ) ;
4858+
4859+ let epoch_schedule =
4860+ svm_locker. with_svm_reader ( |svm_reader| svm_reader. inner . get_sysvar :: < EpochSchedule > ( ) ) ;
4861+
4862+ assert ! (
4863+ !epoch_schedule. warmup,
4864+ "offline initialization should disable warmup to match mainnet"
4865+ ) ;
4866+ assert_eq ! (
4867+ epoch_schedule. get_first_slot_in_epoch( 886 ) ,
4868+ 886_u64 * 432_000 ,
4869+ "first slot should align with mainnet epoch boundaries when warmup is disabled"
4870+ ) ;
4871+ }
48394872}
0 commit comments