Security Best Practices
HyperNova proves that a message was posted on the source chain. Everything about what the message means, and whether your application should act on it, is your application’s responsibility. Use this checklist for every contract or module that receives messages.
Who checks what
The verifier depends on the destination and, on SupraMVM, on the source chain. On EVM chains, the verifier is Hypernova. On SupraMVM, hypernova_core verifies messages from Ethereum, and supra_hypernova_core verifies messages from SupraEVM.
| Check | On EVM chains | On SupraMVM, from Ethereum | On SupraMVM, from SupraEVM |
|---|---|---|---|
| The source chain’s consensus and the inclusion proofs | The verifier | The verifier | The verifier |
| The message-passing layer emitted the event | The verifier | The verifier | The verifier |
| The message is addressed to this chain | The verifier | Your module | The verifier |
| Your application posted the message | The verifier, against the expectedCaller you pass | Your module | Your module |
| The message has not been processed before | The verifier, per consumer | Your module | The verifier, per consumer |
| The payload is valid | Your application | Your application | Your application |
On SupraMVM, hypernova_core keeps no record of processed messages and does not check who posted a message or which
chain it is addressed to. A module that receives messages from Ethereum must do all three itself, as described below.
Check who posted the message
Anyone can post a message to any registered destination. Accept only messages posted by your own application.
- On EVM chains, pass your SupraMVM module’s address as
expectedCallertoverifyMessagePostedOnSupra. Never take it from the relayer’s input. - On SupraMVM, compare
topics[1]of the verified log with your application’s address on the source chain. Neitherhypernova_corenorsupra_hypernova_corechecks it.
Check the destination
- On EVM chains,
Hypernovarejects messages addressed to another chain. - On SupraMVM, for messages from SupraEVM,
supra_hypernova_corerejects messages addressed to another chain. - On SupraMVM, for messages from Ethereum, check that
topics[3]of the verified log is this chain’s ID.hypernova_coredoes not check it.
Prevent replay
A valid proof stays valid indefinitely, so anyone can submit the same message again.
- On EVM chains,
Hypernovarecords each message per consumer. CallHypernovadirectly from the contract that acts on the message. If you call it through another contract,Hypernovakeeps the record for that contract instead. - On SupraMVM, for messages from SupraEVM,
supra_hypernova_corerecords each message per consumer, the signer that your module passes asconsumer. Pass a signer that your module controls, such as its resource account. If you pass the signer of the account that submits the transaction,supra_hypernova_corekeeps a separate record for each account, and the same message can be processed once per account. - On SupraMVM, for messages from Ethereum,
hypernova_corekeeps no record. Store every processed message, for example by the log hash that verification returns, and reject repeats.
Use only verified fields
For messages from Ethereum to SupraMVM, hypernova_core does not check the message parameters passed to the verification functions, such as msg_id, source_chain_id and destination_chain_id, against the log. Read the sender, message ID and destination from the verified log’s topics instead.
Fix the verification strategy
For messages from Ethereum, set the verification strategy and safety level in your module, not from relayer input. hypernova_core enforces whatever you pass, including a safety level of 0. See Receive a Message.
Validate the payload
HyperNova does not interpret payloads. Decode the payload defensively, check its length and every field that affects execution or authorization, and reject anything you do not expect.
Plan for liveness
- A message waits until it is relayed, and until the destination verifier’s committee keys are current. Design your application so that a delayed message is safe.
- The admin of the message-passing layer can pause it, and the admin of each verifier can pause that verifier. A pause stops new messages in an emergency. See Roles and Permissions.
- Message IDs come from one counter shared by every application on the source chain. Do not rely on your own messages having consecutive IDs.