Skip to content

Commit

Permalink
Fix relayer test
Browse files Browse the repository at this point in the history
  • Loading branch information
soareschen committed Jan 14, 2022
1 parent 2aa53bf commit ea77437
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/src/core/ics02_client/handler/update_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn process(
.ok_or_else(|| {
Error::invalid_consensus_state_timestamp(
latest_consensus_state.timestamp(),
header.timestamp(),
Timestamp::from(now),
)
})?;

Expand Down
8 changes: 7 additions & 1 deletion modules/src/mock/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,13 @@ impl MockContext {
pub fn tick(&mut self) -> Time {
let mut current_time = self.current_time.write().unwrap();
let time = *current_time;
*current_time = (time + Duration::from_millis(100)).unwrap();

// The time increment has to be at least a second, or the "current" time of the
// mock chain will fall behind the relayer's real time clock, causing
// relayer tests to fail.
// Possible fix: Add a `current_time` method in `ChainEndpoint` so that it can
// be mocked
*current_time = (time + Duration::from_millis(1000)).unwrap();
time
}

Expand Down
2 changes: 0 additions & 2 deletions relayer/src/foreign_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,6 @@ mod test {

// Update each client
for _i in 1..num_iterations {
std::thread::sleep(core::time::Duration::from_secs(1));

let res = client_on_a.update();
assert!(res.is_ok(), "Client update for chain a failed {:?}", res);

Expand Down

0 comments on commit ea77437

Please sign in to comment.