#call #chaos #computer #ic-call-chaos

ic-call-chaos

Chaos monkey library for Internet Computer calls

1 unstable release

new 0.1.0 May 7, 2025

#353 in Magic Beans


Used in 2 crates

MIT/Apache

18KB
284 lines

Chaos testing library for Internet Computer inter-canister calls

ic_call_chaos is a small library to enable testing the resilience of Internet Computer canisters to inter-canister call failures. It allows you to simulate various failure scenarios, such as dropped, timed out, or rejected calls, to ensure that your canisters can handle these situations gracefully.

It is designed to be used in conjunction with the ic-cdk library, which provides the necessary tools for building canisters on the Internet Computer.

Usage

  1. Import Call and friends from ic_call_chaos instead of ic_cdk::call. The provided interface is the same as ic_cdk::call, but with additional functionality to simulate failures. The default policy is AllowAll, which means that all calls will be passed to the underlying ic_cdk library. You likely want to make the replacement import conditional on a feature flag, so that you don't inherit the overhead of (or any bugs in) the wrapper in production.
  2. Provide a way to change the failure policy from tests.
  3. In your tests, apply the desired policy.

For examples, look at the source of this library, and in particular canister/src/lib.rs for an example of how to add ic_call_chaos to your canister code, and pocket_ic_test/tests/integration_test.rs for an example of how to use it in your tests.

Dependencies

~4–11MB
~119K SLoC