diff --git a/Makefile b/Makefile index 5b069e7e4f..790258d542 100644 --- a/Makefile +++ b/Makefile @@ -206,9 +206,9 @@ test-unit-with-coverage: -Z unstable-options --report-time test-integration-with-coverage: - $(cargo) +$(nightly) llvm-cov --lib --output-path lcov.info \ + RUST_LOG=info $(cargo) +$(nightly) llvm-cov --lib --output-path lcov.info \ --lcov \ - -- integration \ + -- integration::ledger_tests::pgf_governance_proposal \ --test-threads=1 \ -Z unstable-options --report-time diff --git a/crates/node/src/shell/testing/node.rs b/crates/node/src/shell/testing/node.rs index a6e67d3987..5cae8e4a05 100644 --- a/crates/node/src/shell/testing/node.rs +++ b/crates/node/src/shell/testing/node.rs @@ -363,7 +363,16 @@ impl MockNode { } pub fn next_epoch(&mut self) -> Epoch { - { + println!("next_epoch"); + let before = self + .shell + .lock() + .unwrap() + .state + .in_mem() + .get_current_epoch() + .0; + let is_already_switching = { let mut locked = self.shell.lock().unwrap(); let next_epoch_height = @@ -381,10 +390,20 @@ impl MockNode { { *height = next_epoch_min_start_height; } - } + dbg!(locked.state.in_mem().update_epoch_blocks_delay.is_some()) + }; + println!("1. finalize_and_commit"); self.finalize_and_commit(); + if !is_already_switching { + let locked = self.shell.lock().unwrap(); + assert_eq!( + locked.state.in_mem().update_epoch_blocks_delay, + Some(EPOCH_SWITCH_BLOCKS_DELAY) + ) + }; - for _ in 0..EPOCH_SWITCH_BLOCKS_DELAY { + for i in 0..EPOCH_SWITCH_BLOCKS_DELAY { + println!("{}. finalize_and_commit", i + 2); self.finalize_and_commit(); } self.shell diff --git a/crates/state/src/wl_state.rs b/crates/state/src/wl_state.rs index a252f2bd81..1269865fcf 100644 --- a/crates/state/src/wl_state.rs +++ b/crates/state/src/wl_state.rs @@ -155,7 +155,7 @@ where time: DateTimeUtc, parameters: &Parameters, ) -> Result { - match self.in_mem.update_epoch_blocks_delay.as_mut() { + match dbg!(self.in_mem.update_epoch_blocks_delay.as_mut()) { None => { // Check if the new epoch minimum start height and start time // have been fulfilled. If so, queue the next @@ -163,10 +163,10 @@ where // as to align validator set updates + etc with // tendermint. This is because tendermint has a two block delay // to validator changes. - let current_epoch_duration_satisfied = height - >= self.in_mem.next_epoch_min_start_height - && time >= self.in_mem.next_epoch_min_start_time; - if current_epoch_duration_satisfied { + let current_epoch_duration_satisfied = + dbg!(height >= self.in_mem.next_epoch_min_start_height) + && dbg!(time >= self.in_mem.next_epoch_min_start_time); + if dbg!(current_epoch_duration_satisfied) { self.in_mem.update_epoch_blocks_delay = Some(EPOCH_SWITCH_BLOCKS_DELAY); }