diff --git a/contracts/contracts/DdexSequencer.sol b/contracts/contracts/DdexSequencer.sol index 1a460a20..2a0ad5ff 100644 --- a/contracts/contracts/DdexSequencer.sol +++ b/contracts/contracts/DdexSequencer.sol @@ -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(); @@ -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 @@ -120,7 +140,7 @@ contract DdexSequencer is bytes32 newBlobhash; assembly { - newBlobhash := blobhash(0) + newBlobhash := blobhash(blobIndex) } require( newBlobhash != bytes32(0), diff --git a/contracts/contracts/interfaces/IDdexSequencer.sol b/contracts/contracts/interfaces/IDdexSequencer.sol new file mode 100644 index 00000000..3e5502a9 --- /dev/null +++ b/contracts/contracts/interfaces/IDdexSequencer.sol @@ -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; +}