generate_tm_block
is slowing down MockContext
creation in unit tests
#1687
Milestone
generate_tm_block
is slowing down MockContext
creation in unit tests
#1687
Crate
ibc-relayer
Summary
The
generate_tm_block
function sleeps for 1 second before returning. This is called at least 20 times inMockContext::new
, which in turns is called at least twice in each unit test. This result in at least 40 seconds delay for each test to run.Unfortunately the fix is not as straightforward as reducing the sleep time, as it will cause existing tests to fail. To properly fix this, we need to stop calling
Time::now()
everywhere to get the current time, and instead allow the time to be passed explicitly so that it can be mocked.For the temporary fix, we could also try and see if it is possible to use time in the past when calling
generate_tm_block
so that it can be returned immediately.Steps to Reproduce
Running a test like
foreign_client::test::foreign_client_update
takes over 40 seconds before the test start running and producing logs.RUST_LOG=debug cargo test -p ibc-relayer -- --nocapture foreign_client::test::foreign_client_update
Acceptance Criteria
For Admin Use
The text was updated successfully, but these errors were encountered: