hermes icon indicating copy to clipboard operation
hermes copied to clipboard

Using `CachingChainHandle` in integration tests can cause test failures

Open ljoss17 opened this issue 1 year ago • 1 comments

Summary of Bug

Hermes integration tests use the CachingChainHandle. There are situations where this could cause errors in the integration tests due to timeout. For example when testing the ChanUpgradeInit the test will first query the channel ends to confirm they are in (OPEN, OPEN) state. After the first handshake step, the test will need to query the channel ends to verify that they are in (INITUPGRADE, OPEN) state. But with caching, for the next 60 seconds (or the configured time to live) the queried channel ends will return the cached value which is in (OPEN, OPEN) state.

Version

Current Hermes, commit 0c423be4c4a3b77a0936a89586891682b7bdbf1b

Proposal

Some solutions could be:

  • Do not use the CachingChainHandle in the integration tests
  • Have a mechanism/flag to allow a forced queries (queries which bypass the cache)

For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate milestone (priority) applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned

ljoss17 avatar Apr 19 '23 07:04 ljoss17

A workaround for the case of the channel upgrade tests is to query the channel with IncludeProof::Yes, this will enforce a new query instead of using the cache: https://github.com/informalsystems/hermes/blob/master/crates/relayer/src/chain/handle/cache.rs#L313

ljoss17 avatar Apr 26 '23 11:04 ljoss17