This extension introduces the Data Commitment Interface, which handles the pre-transaction data commitment. It's designed for platforms like Solana, where dynamic data (ie accounts) needs to be known along with the transaction instruction.
Developers can use the IDataCommitment interface to commit data before processing a cross-chain message with the extended IExtendedCrossChainMessaging interface. This can be useful by allowing the extraData field to be modified to contain the data needed for processing, such as public keys and accounts.
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0;
interface IDataCommitment {
// Event to log the commitment of message data
event MessageDataCommitted(bytes dataCommitmentId, bytes chainId, bytes receiver, bytes messageData, bytes extraData);
// Function to commit message data for a future cross-chain transaction
// Returns a unique identifier for the committed data
function commitMessageData(
bytes chainId,
bytes receiver,
bytes messageData,
bytes extraData
) external returns (bytes dataCommitmentId);
// Optional: Function to retrieve committed data
function getCommittedData(bytes dataCommitmentId)
external
view
returns (bytes chainId, bytes receiver, bytes messageData, bytes extraData);
}
This function commits message data for a future cross-chain transaction and returns a unique identifier (dataCommitmentId) for the committed data. It accepts the following parameters:
chainId: The identifier of the destination blockchain.receiver: The recipient's address on the destination blockchain.messageData: The message data to be committed.extraData: Additional security or metadata related to the commitment.
It emits a MessageDataCommitted event contains all the data committed along with the commitment id.
This function allows retrieval of committed data based on the provided dataCommitmentId.
The extraData or security param can be modified to include the 'accounts' field and the 'dataCommitmentId' to support this extension.