Broadcast Failure Recovery and Retry Discipline

permalink SUBTC
#broadcast#discipline#failure#recovery#retry

WAproxy must distinguish between three states:

1. Pre-broadcast validation failure
2. Broadcast attempt failure
3. Broadcast success but response loss

Each state requires deterministic handling.

------------------------------------------------------------
STATE 1 — VALIDATION FAILURE
------------------------------------------------------------

If validation fails before broadcast:

- No transaction is created.
- No balance mutation occurs.
- Idempotency key remains unused.

Client may retry after correction.

------------------------------------------------------------
STATE 2 — BROADCAST FAILURE
------------------------------------------------------------

If RPC broadcast fails:

- No txid returned.
- No state committed as "sent".
- Idempotency key must not mark success.

Client may safely retry with same idempotency key.

------------------------------------------------------------
STATE 3 — BROADCAST SUCCESS, RESPONSE LOST
------------------------------------------------------------

If broadcast succeeds but client loses response:

- Idempotency key must map to stored tx result.
- Retrying with same idempotency key
must return the original txid.
- No duplicate broadcast allowed.

------------------------------------------------------------
RETRY DISCIPLINE
------------------------------------------------------------

Clients must:

- Always use idempotency keys.
- Retry safely under network interruption.
- Avoid generating new idempotency IDs
unless intentionally creating new execution.

------------------------------------------------------------
PERSISTENCE REQUIREMENT
------------------------------------------------------------

Idempotency and broadcast results must be:

- Persisted before response return.
- Durable across restart.
- Queryable deterministically.

------------------------------------------------------------
DESIGN PRINCIPLE
------------------------------------------------------------

Execution must be either:

- not executed
OR
- executed exactly once

Never "maybe executed".

------------------------------------------------------------
ARCHITECTURAL STATEMENT
------------------------------------------------------------

Deterministic retry discipline
prevents duplicate broadcasts
and preserves economic integrity.

WAproxy guarantees execution clarity
under unreliable networks.