DeFi architecture
Designing Trust Boundaries for Oracles and Bridges
Oracles and bridges import information or authority from outside a contract’s local state. A safe integration makes the external assumptions explicit and defines what the protocol does when those assumptions fail.
Draw the boundary around imported authority
An oracle can influence valuation, liquidation, settlement, or minting. A bridge can influence message execution, asset release, or remote administration. The important design question is not simply whether the component is reputable, but what damage becomes possible if its output is wrong, delayed, replayed, or unavailable.
Document the full path from external source to state change. This includes data providers, aggregators, relayers, validators, guardians, keepers, administrators, and any contract able to upgrade or reconfigure that path.
Make oracle assumptions explicit
A price consumer should define acceptable freshness, deviation, decimals, market coverage, and behavior around zero or extreme values. The relevance of these checks depends on the asset and mechanism; a single hard-coded heartbeat is not a universal safety rule.
Consider what happens during volatile markets, stale updates, sequencer or network disruption, thin liquidity, and disagreement between sources. A fallback that silently uses an older price may reduce availability risk while increasing valuation risk. That tradeoff should be explicit and bounded.
- Validate the data’s meaning, units, decimals, timestamp, and covered market.
- Define maximum exposure to stale or extreme values.
- Avoid treating a spot price from a manipulable market as neutral truth.
- Monitor deviation and update failures at the protocol level.
Make bridge message assumptions explicit
Bridge review should cover source finality, destination execution, sender authentication, domain identifiers, replay protection, message ordering, retries, upgrades, and emergency powers. A message that is valid on one chain must not become valid in an unintended domain or context.
Canonical and third-party bridges have different trust models. The integration should identify whose confirmation is accepted, what happens before finality, and whether a remote contract can exercise privileged authority locally.
For the evidence needed to connect activity across those boundaries, see Tracing Funds Across Bridges: Evidence and Limitations.
Choose failure modes and containment
Possible responses to failed assumptions include pausing a specific operation, capping exposure, requiring additional confirmation, switching to a reviewed fallback, or allowing users to exit through an independent path. Global pauses can stop some attacks but also trap users or prevent liquidations, so their effects need modeling.
Rate limits, per-asset caps, bounded message value, time delays, and separation of remote privileges can limit damage. These controls should be tested against the exact failure they are intended to contain.
Test the boundary under stress
Integration tests should include stale data, unexpected decimals, duplicate messages, out-of-order messages, unavailable relayers, reorgs, incorrect sender claims, and upgrade authority misuse where feasible. The expected result should be a documented safe state, not merely a transaction revert.
Production monitoring should observe the assumptions themselves: oracle freshness, bridge finality, privileged changes, abnormal volume, and fallback activation. An alert is useful only when an owner and response procedure are defined.
Primary documentation and further reading
These sources describe the underlying protocols and tools. They are provided for technical verification and further study.