The latest version, Heimdall v.0.2.9, contains a few enhancements such as:
- Restricting data size in state sync txs to:
- 30Kb when represented in bytes
- 60Kb when represented as string.
- Increasing the delay time between the contract events of different validators to ensure that the mempool doesn't get filled very quickly in case of a burst of events which can hamper the progress of the chain.
The following example shows how the data size is restricted:
Data - "abcd1234"
Length in string format - 8
Hex Byte representation - [171 205 18 52]
Length in byte format - 4
Requirements for the users
Things required from dapps/users to work with state-sync are:
- Call the syncState function.
syncStatefunction emits an event called
StateSynced(uint256 indexed id, address indexed contractAddress, bytes data);
- All the validators on the Heimdall chain receive the
StateSyncedevent. Any validator that wishes to get the transaction fee for the state sync sends the transaction to Heimdall.
- Once the
state-synctransaction on Heimdall is included in a block, it is added to the pending state-sync list.
- After every sprint on Bor, the Bor node fetches the pending state-sync events from Heimdall via an API call.
- The receiver contract inherits the
IStateReceiverinterface, and custom logic of decoding the data bytes and performing any action sits inside the onStateReceive function.