Skip to content

Commit

Permalink
fix(gtest): make block duration 3 secs
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilsan committed Nov 21, 2023
1 parent 354d660 commit 501c172
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gtest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ pub mod constants {
pub const EXISTENTIAL_DEPOSIT: Value = 10 * UNITS;
/// Value per gas.
pub const VALUE_PER_GAS: Value = 25;
/// Duration of one block in msecs.
pub const BLOCK_DURATION_IN_MSECS: u64 = 3000;
/// Duration of one epoch.
pub const EPOCH_DURATION_IN_BLOCKS: Block = 600;

Expand Down
6 changes: 5 additions & 1 deletion gtest/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::{
mailbox::Mailbox,
manager::{Actors, Balance, ExtManager},
program::{Program, ProgramIdWrapper},
BLOCK_DURATION_IN_MSECS,
};
use codec::{Decode, DecodeAll};
use colored::Colorize;
Expand Down Expand Up @@ -174,7 +175,10 @@ impl System {

let next_block_number = manager.block_info.height + 1;
manager.block_info.height = next_block_number;
manager.block_info.timestamp += 1000;
manager.block_info.timestamp = manager
.block_info
.timestamp
.saturating_add(BLOCK_DURATION_IN_MSECS);
manager.process_delayed_dispatches(next_block_number)
})
.collect::<Vec<Vec<_>>>()
Expand Down

0 comments on commit 501c172

Please sign in to comment.