From 352ed56237920dac25a0add96de474eca2f14960 Mon Sep 17 00:00:00 2001 From: cezary-stroczynski Date: Mon, 8 Sep 2025 11:18:04 +0200 Subject: [PATCH 1/3] Add interface to sequencer for submiting blob with blobIndex --- contracts/contracts/DdexSequencer.sol | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/contracts/contracts/DdexSequencer.sol b/contracts/contracts/DdexSequencer.sol index b1c60c9..f789508 100644 --- a/contracts/contracts/DdexSequencer.sol +++ b/contracts/contracts/DdexSequencer.sol @@ -106,7 +106,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 @@ -119,7 +137,7 @@ contract DdexSequencer is bytes32 newBlobhash; assembly { - newBlobhash := blobhash(0) + newBlobhash := blobhash(blobIndex) } require( newBlobhash != bytes32(0), From 62e0d0f36e08ccab3277351059e63628186fe793 Mon Sep 17 00:00:00 2001 From: cezary-stroczynski Date: Tue, 9 Sep 2025 11:38:40 +0200 Subject: [PATCH 2/3] Initial implementation of SmartAccount --- .../AccountAbstraction/SmartAccount.sol | 57 +++++++++++++++++++ contracts/contracts/DdexSequencer.sol | 4 +- .../contracts/interfaces/IDdexSequencer.sol | 17 ++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 contracts/contracts/AccountAbstraction/SmartAccount.sol create mode 100644 contracts/contracts/interfaces/IDdexSequencer.sol diff --git a/contracts/contracts/AccountAbstraction/SmartAccount.sol b/contracts/contracts/AccountAbstraction/SmartAccount.sol new file mode 100644 index 0000000..5a3758b --- /dev/null +++ b/contracts/contracts/AccountAbstraction/SmartAccount.sol @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; +import "../Whitelist/WhitelistConsumer.sol"; +import "../interfaces/IDdexSequencer.sol"; + +contract SmartAccount is WhitelistConsumer, UUPSUpgradeable { + struct SubmitNewBlobInput { + bytes32 imageId; + bytes commitment; + bytes32 blobSha2; + } + + bytes1 public constant BLOB_SUBMITTERS_WHITELIST = 0x01; + IDdexSequencer ddexSequencer; + uint256[50] __gap; + + /// @custom:oz-upgrades-unsafe-allow constructor + constructor() { + _disableInitializers(); + } + + function initialize( + address smartAccountWhitelist, + address ddexSequencerAddress + ) public initializer { + _setWhitelistAddress(smartAccountWhitelist, BLOB_SUBMITTERS_WHITELIST); + ddexSequencer = IDdexSequencer(ddexSequencerAddress); + } + + function submitNewBlobBatch( + SubmitNewBlobInput[] calldata inputs + ) public isWhitelistedOn(BLOB_SUBMITTERS_WHITELIST) { + require( + msg.sender == address(this) || + IWhitelist(whitelists[BLOB_SUBMITTERS_WHITELIST]).isWhitelisted( + msg.sender + ), + "msg.sender not authorized" + ); + + for (uint i = 0; i < inputs.length; i++) { + ddexSequencer.submitNewBlob( + inputs[i].imageId, + inputs[i].commitment, + inputs[i].blobSha2, + i + ); + } + } + + function _authorizeUpgrade(address) internal view override { + require(msg.sender == address(this)); + } +} diff --git a/contracts/contracts/DdexSequencer.sol b/contracts/contracts/DdexSequencer.sol index f789508..9de2510 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 WhitelistingStatusChanged(bool current_status); diff --git a/contracts/contracts/interfaces/IDdexSequencer.sol b/contracts/contracts/interfaces/IDdexSequencer.sol new file mode 100644 index 0000000..3e5502a --- /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; +} From c9284eb6a633b1f16a9d3fddeb361d9da5b7c7da Mon Sep 17 00:00:00 2001 From: cezary-stroczynski Date: Wed, 22 Oct 2025 14:47:41 +0200 Subject: [PATCH 3/3] Remove SmartAccount implementation (moved to separate repo) --- .../AccountAbstraction/SmartAccount.sol | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 contracts/contracts/AccountAbstraction/SmartAccount.sol diff --git a/contracts/contracts/AccountAbstraction/SmartAccount.sol b/contracts/contracts/AccountAbstraction/SmartAccount.sol deleted file mode 100644 index 5a3758b..0000000 --- a/contracts/contracts/AccountAbstraction/SmartAccount.sol +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; -import "../Whitelist/WhitelistConsumer.sol"; -import "../interfaces/IDdexSequencer.sol"; - -contract SmartAccount is WhitelistConsumer, UUPSUpgradeable { - struct SubmitNewBlobInput { - bytes32 imageId; - bytes commitment; - bytes32 blobSha2; - } - - bytes1 public constant BLOB_SUBMITTERS_WHITELIST = 0x01; - IDdexSequencer ddexSequencer; - uint256[50] __gap; - - /// @custom:oz-upgrades-unsafe-allow constructor - constructor() { - _disableInitializers(); - } - - function initialize( - address smartAccountWhitelist, - address ddexSequencerAddress - ) public initializer { - _setWhitelistAddress(smartAccountWhitelist, BLOB_SUBMITTERS_WHITELIST); - ddexSequencer = IDdexSequencer(ddexSequencerAddress); - } - - function submitNewBlobBatch( - SubmitNewBlobInput[] calldata inputs - ) public isWhitelistedOn(BLOB_SUBMITTERS_WHITELIST) { - require( - msg.sender == address(this) || - IWhitelist(whitelists[BLOB_SUBMITTERS_WHITELIST]).isWhitelisted( - msg.sender - ), - "msg.sender not authorized" - ); - - for (uint i = 0; i < inputs.length; i++) { - ddexSequencer.submitNewBlob( - inputs[i].imageId, - inputs[i].commitment, - inputs[i].blobSha2, - i - ); - } - } - - function _authorizeUpgrade(address) internal view override { - require(msg.sender == address(this)); - } -}