Smart Contract Cross-Chain Messages: Celer’s Receiver Checks
A smart contract receives a cross-chain message through MessageBus signature checks, then verifies the source chain and sender before acting on the payload.
The Blockheight Editors··3 min read
A smart contract receives a Celer cross-chain message when the destination MessageBus verifies State Guardian Network signatures and calls its executeMessage function; your contract still has to check which source app sent it.
For asset transfers, cbridge slippage is useful background on cBridge: it adds the question of how much value may differ during a transfer. A message-only call carries app data, so the receiver’s main checks are who sent that data and from which chain.
MessageBus verifies the message, then calls your receiver
In Celer’s message flow, the source MessageBus records the message, the State Guardian Network (SGN) validators attest to the confirmed source event, and an executor submits the signed message to the destination MessageBus. That contract verifies the signatures before calling your receiver.
Take an Ethereum contract sending a counter update to an Arbitrum contract. The Ethereum contract calls sendMessage on its MessageBus with the destination details and encoded update. After the source event is confirmed, SGN validators sign an attestation; an executor relays it, and Arbitrum’s MessageBus checks the signatures before dispatch.
The receiver’s callback is executeMessage(sender, srcChainId, message, executor). The onlyMessageBus modifier should restrict this function to calls from the configured MessageBus. That proves the callback came through the expected local entry point; it does not decide whether the remote app is one your contract trusts.
Your receiver must allow only trusted source pairs
Your executeMessage logic must check both the source chain ID and the sender address against an allowlist. Any contract on any chain may send a message, so accepting every validly signed message would let an unapproved app request your counter update.
For the example, configure the Ethereum chain ID and the address of the specific Ethereum contract allowed to update the Arbitrum counter. In executeMessage, reject calls whose srcChainId and sender do not match an approved pair; only then decode message and apply the update. Keep the pair together in your allowlist, since trusting a sender address without its source chain leaves the origin ambiguous.
Return an ExecutionStatus that matches the outcome: Success after applying the update, Fail for a message that cannot be processed, or Retry when a temporary issue should allow another attempt. The MessageBus handles signature verification; your contract handles source trust and the effect of the payload.
Next, add the approved (srcChainId, sender) pair and test the receiver with both that pair and an unapproved one. This gives your app a clear boundary: legitimate source messages can update state, while other sources are rejected.