dymensionxyz / ibc-go

Interblockchain Communication Protocol (IBC) implementation in Golang.
https://ibc.cosmos.network/
MIT License
5 stars 3 forks source link

TestChain changes #20

Closed liorzilp closed 1 year ago

liorzilp commented 1 year ago

Change1

Add GetLastHeader() to TestChainClientI

Overview

TestChainClientI is an interface for providing different chain consensus. Among clients, BlockHeader structure might be different, but it also might be helpful for testing cases to use the last header. Another reason for getting the last header as an interface is to enable warping the TestChainClientI and intercept client methods. Currently, the implementers of TestChainClientI such as TestChainTendermint use direct casting to the type TestChainTendermint for getting the last header, making it an interface will make the casting redundant and allows the creation of a wrapper.

Change

Add GetLastHeader to TestChainClientI and don't use direct casting

Change2

Fix missing EndBlock()

Overview

In many places in the simulation, there is no call to EndBlock() after the Commit() process. It leads to misbehavior of the chain as EndBlock() is part of the block lifecycle

Change

Add EndBlock() when needed

Note

There are also many calls to BeginBlock() for the same block. It also needs to be watched.