Prerequisites
- Access to
credible-registry, with its submodules checked out anvil,cast,forge, andjqon yourPATH- A free local port
8545, or another port selected withRPC_PORT
credible-registry, not credible-std. These commands use revision 8804c9e:
Run the Fixture
From the Registry repository root, run:GuardedCounter. The initial marker is required by the guard constructor. This tests the fixture, not your protocol’s upgrade.
To use another port:
FAIL_OPEN_THRESHOLD and --expected-threshold change the runner’s expectation, not the deployed contract. Use a custom target to test a different threshold.
Test Your Contract
The runner cannot reuse a live-network address or another Anvil instance. Supply deployment commands that run after its local chain starts:- Deploy a Registry with
MARKER_ADDRESSauthorized as a builder. Print the Registry address as the command’s final output line. - Deploy or upgrade your target with
REGISTRY_ADDRESS. Set up balances, roles, and approvals, then print the target or proxy address as the final line. - Specify the guarded call, a state-reading call, and the expected state before and after success.
GuardedName contract:
--guarded-call-arg; use --state-read-call-arg for getter arguments. String state values must include the quotes returned by cast call, as above.
Commands receive RPC_URL, REPO_ROOT, REGISTRY_ADDRESS, and EXPECTED_THRESHOLD, plus local test keys and addresses. The runner marks the Registry before invoking the target command. Use these keys only on the local test chain.
The runner checks credibleRegistry()(address) and failOpenBlockThreshold()(uint256) by default. For different getters, use --registry-read-call and --threshold-read-call. For targets without getters, supply --config-assert-command; it must exit successfully only when both settings match.
Verify the Results
The harness disables automining for the ordering test. Sending both transactions with automining enabled would put them in different blocks.
The fixture and example above report the following summary. Require zero failures and a zero exit status; a custom configuration check changes the check count.
Test Simulation Separately
The Registry accepts zero-gas-price calls in nonzero blocks without a marker. The harness uses--gas-price 1gwei for its rejection probe so it tests paid-call behavior. In Foundry tests, set a nonzero vm.txGasPrice when testing guard rejection.
A successful wallet simulation is not proof of production protection. Monitor lastCredibleBlock() or marker events for actual marker activity. See zero-gas-price calls.
The harness does not test the Credible RPC, real builder enforcement, assertion activation, Safe modules, or storage-layout compatibility. Complete those checks in your integration test plan.
