Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions contracts/contracts/DdexSequencer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import "./Whitelist/WhitelistConsumer.sol";
import "./interfaces/IStakeVault.sol";
import "./interfaces/IDdexEmitter.sol";
import "./interfaces/IProverPublicOutputs.sol";
import "./interfaces/IDdexSequencer.sol";

pragma solidity ^0.8.24;

contract DdexSequencer is
WhitelistConsumer,
OwnableUpgradeable,
UUPSUpgradeable
UUPSUpgradeable,
IDdexSequencer
{
event NewBlobSubmitted(bytes commitment, bytes32 image_id);
event QueueMoved();
Expand Down Expand Up @@ -107,7 +109,25 @@ contract DdexSequencer is
bytes32 _imageId,
bytes memory _commitment,
bytes32 _blobSha2
) public _isWhitelistedOn(DATA_PROVIDERS_WHITELIST) {
) external {
_submitNewBlob(_imageId, _commitment, _blobSha2, 0);
}

function submitNewBlob(
bytes32 _imageId,
bytes memory _commitment,
bytes32 _blobSha2,
uint256 blobIndex
) external {
_submitNewBlob(_imageId, _commitment, _blobSha2, blobIndex);
}

function _submitNewBlob(
bytes32 _imageId,
bytes memory _commitment,
bytes32 _blobSha2,
uint256 blobIndex
) internal _isWhitelistedOn(DATA_PROVIDERS_WHITELIST) {
require(_imageId != bytes32(0), "DdexSequencer: ImageId cannot be 0");

(bytes32 currentImageId, bytes32 previousImageId) = ddexEmitter
Expand All @@ -120,7 +140,7 @@ contract DdexSequencer is

bytes32 newBlobhash;
assembly {
newBlobhash := blobhash(0)
newBlobhash := blobhash(blobIndex)
}
require(
newBlobhash != bytes32(0),
Expand Down
17 changes: 17 additions & 0 deletions contracts/contracts/interfaces/IDdexSequencer.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

interface IDdexSequencer {
function submitNewBlob(
bytes32 _imageId,
bytes memory _commitment,
bytes32 _blobSha2
) external;

function submitNewBlob(
bytes32 _imageId,
bytes memory _commitment,
bytes32 _blobSha2,
uint256 blobIndex
) external;
}