Skip to content

Commit

Permalink
pass correct timestamp to the fvm
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed Mar 2, 2023
1 parent 2c857fa commit fefc49a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions blockchain/state_manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ where
let db = self.blockstore().clone();

let turbo_height = self.chain_config.epoch(Height::Turbo);
let create_vm = |state_root, epoch| {
let create_vm = |state_root, epoch, timestamp| {
VM::new(
state_root,
self.blockstore().clone(),
Expand All @@ -392,15 +392,17 @@ where
&self.engine_v2,
&self.engine_v3,
Arc::clone(self.chain_config()),
tipset.min_timestamp(),
timestamp,
)
};

let mut parent_state = *p_state;
let genesis_timestamp = self.chain_store().genesis().unwrap().timestamp();

for epoch_i in parent_epoch..epoch {
if epoch_i > parent_epoch {
let mut vm = create_vm(parent_state, epoch_i)?;
let timestamp = genesis_timestamp + ((EPOCH_DURATION_SECONDS * epoch_i) as u64);
let mut vm = create_vm(parent_state, epoch_i, timestamp)?;
// run cron for null rounds if any
if let Err(e) = vm.run_cron(epoch_i, callback.as_mut()) {
error!("Beginning of epoch cron failed to run: {}", e);
Expand All @@ -414,7 +416,7 @@ where
}
}

let mut vm = create_vm(parent_state, epoch)?;
let mut vm = create_vm(parent_state, epoch, tipset.min_timestamp())?;

// Apply tipset messages
let receipts = vm.apply_block_messages(messages, epoch, callback)?;
Expand Down

0 comments on commit fefc49a

Please sign in to comment.