Reconcile a partially executed Substrate utility batch

A payout list submitted with utility.batch can stop midway while retaining earlier changes. Retrying every item can pay the successful recipients twice.

Identify the wrapper in the submitted extrinsic

For a runtime exposing the utility pallet, the two builders below wrap the same three prepared calls differently. Inspect the actual extrinsic’s section and method before interpreting its events. The example constructs calls locally.

const calls = [firstCall, secondCall, thirdCall]
const stopOnFailure = api.tx.utility.batch(calls)
const atomic = api.tx.utility.batchAll(calls)
console.log(stopOnFailure.method.toHex(), atomic.method.toHex())

Use the interrupted index to plan a retry

For utility.batch, BatchInterrupted with index 1 means the first call succeeded, the second failed and the third was never attempted. Inspect the second call’s error and recheck the first recipient’s state before building any replacement list. A successful outer dispatch alone cannot identify which recipients were paid.

With batchAll a failed inner call rolls back the batched state changes. forceBatch has another execution model that can continue after failures. Preserve the wrapper name in reconciliation records.

Sources