Some oracle systems in the Ethereum ecosystem utilize Beacon Chain data accessed through the
BEACON_ROOTS precompile to implement trust-minimized verification mechanisms. The
Relic Protocol, for instance, follows this approach to verify historical consensus data on-chain. While this design successfully eliminates the need for centralized relayers, it raises important considerations about how oracle systems interact with the BeaconState structure.
The Relic Protocol's verification system consists of several modules that process SSZ (SimpleSerialize) data from the Beacon Chain. These modules use specific Merkle tree indices within the BeaconState, such as
STATE_ROOT_INDEX (3),
BLOCK_ROOTS_INDEX (5), and
HISTORICAL_SUMMARIES_INDEX (27). Functions like
verifyHistoricalBlockSummary and
verifyRelativeBlockRoot rely on these fixed indices. When the BeaconState structure changes in a hard fork, these indices shift, breaking existing oracle contracts.
Without EIP-7688, each hard fork requires updating all index constants, revising verification logic, deploying new contracts, and coordinating with clients and relayers. This creates operational overhead and introduces risks. For example, if
HISTORICAL_SUMMARIES_INDEX changes, the entire verification logic for historical data must be rewritten, potentially introducing vulnerabilities.
EIP-7688 introduces the concept of a
StableContainer, which would provide stable Merkle tree indices for oracle systems. This could offer backward compatibility for existing proofs, simplify verification logic, and reduce risks during Beacon Chain updates. The stability of Merkle indices is particularly important for decentralized oracles that must provide reliable access to consensus data without relying on centralized relayers.
The problem extends beyond simply updating index constants. Each hard fork that modifies the BeaconState structure requires a comprehensive update of verification logic, which may involve:
- Updating on-chain verifier contracts that process Merkle proofs
- Modifying off-chain relayers that generate and submit proofs
- Coordinating deployments across multiple components of the system
If EIP-7688 were to be implemented, it would require the following changes to the existing SSZ code:
- Creating StableContainer Types: It would be necessary to define StableContainer types for all BeaconState data structures used in verification, instead of relying on hardcoded indices.
- Defining Profiles for the Current Fork: For each StableContainer type, a corresponding Profile would need to be created for use in the current fork.
- Updating Verification Functions: Verification functions would need to be updated to work with StableContainer types instead of hardcoded indices.
While these changes would require significant effort, they could eliminate the need to update the code during each hard fork and reduce the risk of errors—particularly for protocols that heavily depend on the stability of Merkle tree indices.