Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbg pgf test #3749

Closed
wants to merge 11 commits into from
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 22 additions & 3 deletions crates/node/src/shell/testing/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions crates/state/src/wl_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ where
time: DateTimeUtc,
parameters: &Parameters,
) -> Result<bool> {
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
// epoch to start two blocks into the future so
// 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);
}
Expand Down
Loading