Detailed Design of State Synchronization

The Shard-Sharing State revolutionizes how states are managed and synchronized in a sharded blockchain environment, employing two distinct yet complementary mechanisms:

  1. State Synchronization Between Adventure Layer L2 and Shards:

State Cache Module: Positioned atop the state database, this module acts as an intermediary that intercepts storage access commands (SSTORE/SLOAD). When a shard accesses storage, it first queries the state cache module to check if the required state is already cached. This mechanism ensures that the most recent state from L2 is available to the shards in a read-only format to maintain data consistency and prevent direct shard-to-L2 state modifications.

This design allows smart contracts deployed on shards to access and process L2 assets, like reading balances, without risking the consistency of the L2 state. It provides a real-time, consistent view of the L2 state across all shards, enhancing the responsiveness and dynamism of gaming and other applications on The Adventure Layer.

  1. State Synchronization Among Shards:

Shared State Smart Contract: A specialized smart contract on L2 allows developers to create shared addresses. These addresses facilitate a controlled state-sharing mechanism across shards. A shard that "borrows" a shared address gains write access to the associated state, ensuring that only one shard can modify the state at a time. Once the state is released, another shard can borrow and modify it.

This innovative approach maintains state integrity and allows for efficient, dynamic sharing of state information. It empowers developers to design more complex, interactive applications that require state interactions across multiple shards, such as large-scale decentralized games or interconnected financial services.

Last updated