Validators on the Heimdall layer pickup the StateSynced event and pass it on to the Bor layer (read more about the architecture here: https://hackmd.io/DFYomMhJSrWmHOqE3rj68w#Architecture).
Things required from dapps/users to work with state-sync:
- Call the smart contract function present here: https://github.com/maticnetwork/contracts/blob/19163ddecf91db17333859ae72dd73c91bee6191/contracts/root/stateSyncer/StateSender.sol#L33
- Which emits an event called
StateSynced(uint256 indexed id, address indexed contractAddress, bytes data);
- All the validators on the heimdall chain receive this event and one of them, whoever wishes to get the tx fees for state sync sends this transaction to heimdall
state-synctransaction on heimdall has been included in a block it is added to pending state-sync list.
- After every sprint on
bornode fetches the pending state-sync events from heimdall via an API call.
- The receiver contract inherits
IStateReceiverinterface, and custom logic of decoding the data bytes and performing any action sits inside