Messaging Hub
Overview
The Messaging Hub serves as the central communication layer of the Curvance Protocol, facilitating cross-chain operations between all supported blockchains. It coordinates epoch transitions, distributes protocol fees, manages token emissions, and facilitates the migration of user positions between chains.
State Machine
The Messaging Hub operates in four states:
Inactive (0): Not used (reverts if attempted).
Send Active (1): Can send messages but not receive them.
Fully Active (2): Can send and receive messages.
Emergency Paused (3): All cross-chain messaging functionality is disabled.
State transitions require appropriate permissions:
Standard DAO permissions can pause the system.
Elevated permissions are required to unpause or modify messaging pathways.
Message Payload Types
The Messaging Hub defines a type system for cross-chain messages:
1
Basic fee transfer between chains.
2
Gauge emission configuration.
3
Epoch reward distribution.
Cross-Chain Data Flows
1. Epoch Coordination Flow
The Messaging Hub aggregates points across all chains using Wormhole's Cross-Chain Query (CCQ) system. This data drives protocol-wide reward distribution based on the proportional vote-escrow locking across the entire ecosystem.
2. Fee Distribution Flow
Protocol fees are collected by each chain's FeeManager and transferred via CCTP, with cross-chain coordination handled by Wormhole messaging. This enables a unified reward system where all fees contribute to protocol-wide incentives.
3. Emission Configuration Flow
Token emissions are determined by governance voting and distributed to each chain through the Messaging Hub. This ensures that incentives align with governance decisions across the entire protocol.
4. Native Gas Storage for Cross-Chain Actions
The Messaging Hub manages native gas tokens to pay for cross-chain messaging fees across the entire protocol.
Gas Management Flow
The contract holds native gas tokens to pay for cross-chain message delivery.
Gas cost depends on destination chain, payload size, and gas limit configuration.
Default gas limit (300,000) ensures sufficient resources on destination chains.
Gas fees are calculated through
quoteMessageFee
which includes:Wormhole relayer fees for message delivery.
Additional Wormhole core message publishing fees.
This architecture allows the protocol to operate seamlessly across multiple chains while maintaining security, proper fee distribution, and efficient gas usage for all cross-chain operations.
Integration with External Messaging Systems
The Messaging Hub acts as an abstraction layer over multiple underlying cross-chain communication systems:
Wormhole handles general message passing and validation.
Circle's CCTP manages cross-chain stablecoin transfers.
Message Keys link CCTP transfers with Wormhole messages.
Message Execution Security
The Messaging Hub implements multiple security mechanisms:
Message Deduplication: All message hashes are recorded to prevent replay attacks.
Source Validation: Messages are only processed from known messaging hubs on authorized chains.
Payload Type Validation: Each payload type requires specific validation logic
Chain ID Validation: Messages are validated against registered chain IDs..
Status Controls: The messaging status state machine prevents undesired message processing
Cross-Chain Health Management
The architecture includes specialized handling for cross-chain synchronization issues:
When a RewardManager is offline, rewards are sent to the DAO address.
If epoch progression is out of sync, the system routes funds to maintain protocol health.
Native gas tokens stored in the Messaging Hub ensure cross-chain actions can be funded.
This resilient design ensures the protocol can maintain operations even when individual chains or components experience temporary issues.
Last updated