Handling Race Conditions between Exocore and Client Chains
Exocore integrates with multiple blockchains, each of which can simultaneously exchange messages with Exocore. It’s essential to prevent potential race conditions to ensure data consistency across all systems.
The solution to these challenges is twofold: 1) maintaining distinct user accounts between client chains and 2) enforcing sequential message processing for each client chain.
Firstly, user accounts are uniquely identified by the combination of chain_id and user_address. This means there isn’t a multi-chain account; instead, only single-chain accounts exist. Users with accounts across multiple chains are regarded as distinct users within the Exocore system, with each account conducting staking independently.
Moreover, every message exchanged between a client chain and Exocore includes a nonce and the chain ID, which dictates the processing sequence on the recipient’s end and prevents message replay attacks from multiple chains.
Message processing logic is implemented in such a way that all error cases are handled gracefully. Messages are either successfully processed or fail to process. Failed messages are queued for retry, which is guaranteed to succeed eventually, ensuring no disruption in subsequent message processing.
For specific actions, like deposits and delegations from the client chain, a response message from Exocore provides feedback on whether the action was successfully executed. This response also updates the client chain’s state, ensuring that certain accounting details remain consistent between Exocore and the client chain.
Last updated