# README

simibc

What is this?

A collection of utilities based on ibc-go/testing which make it easier to write test scenarios involving precise orderings of

  • BeginBlock, EndBlock on each IBC connected chain
  • Packet delivery
  • Updating the client

Why is this useful?

It is very hard to reason about tests written using vanilla ibc-go/testing because the methods included in that library have many side effects. For example, that library has a notion of global time, so calling EndBlock on one chain will influence the future block times of another chain. As another example, sending a packet from chain A to B will automatically progress the block height on chain A. These behaviors make it very hard to understand, especially if your applications have business logic in BeginBlock or EndBlock.

The utilities in simibc do not have any side effects, making it very easy to understand what is happening. It also makes it very easy to write data driven tests (like table tests, model based tests or property based tests).

How do I use this?

Please see the function docstrings to get an idea of how you could use this package. This README is intentionally short because it is easier to maintain code and docstrings instead of markdown.

# Functions

BeginBlock updates the current header and calls the app.BeginBlock method.
EndBlock calls app.EndBlock and executes preCommitCallback BEFORE calling app.Commit The callback is useful for testing purposes to execute arbitrary code before the chain sdk context is cleared in .Commit().
MakeOrderedOutbox creates a new empty OrderedOutbox.
MakeRelayedPath returns an initialized RelayedPath without any packets, acks or headers.
TryRecvAck will try once to DELIVER an ack from sender to receiver.
TryRecvPacket will try once to DELIVER a packet from sender to receiver.
UpdateReceiverClient DELIVERs a header to the receiving endpoint and update the respective client of the receiving chain.

# Structs

Ack represents a (sent) ack committed to block state.
OrderedOutbox is a collection of ORDERED packets and acks that have been sent by different chains, but have not yet been delivered to their target.
Packet represents a (sent) packet committed to block state.
RelayedPath is a wrapper around ibctesting.Path gives fine-grained control over delivery packets and acks, and client updates.