Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix(inbox): Add stubs and updated addSequencerBatchFromEigenDA function" #23

Closed
wants to merge 1 commit into from
Closed
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
19 changes: 10 additions & 9 deletions deploy/EigenDAServiceManagerStubCreator.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module.exports = async hre => {
const { deployments, getNamedAccounts, ethers } = hre
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

await deploy('EigenDAServiceManagerStub', { from: deployer, args: [] })
}

module.exports.tags = ['EigenDAServiceManagerStub', 'test']
module.exports.dependencies = []
const { deployments, getNamedAccounts, ethers } = hre
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

await deploy('EigenDAServiceManagerStub', { from: deployer, args: [] })
}

module.exports.tags = ['EigenDAServiceManagerStub', 'test']
module.exports.dependencies = []

15 changes: 14 additions & 1 deletion deploy/SequencerInboxStubCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ module.exports = async hre => {
futureSeconds: 10000,
}

const eigenDAServiceManager = await ethers.getContract('EigenDAServiceManagerStub')

// constructor(
// IBridge bridge_,
// address sequencer_,
// ISequencerInbox.MaxTimeVariation memory maxTimeVariation_,
// uint256 maxDataSize_,
// IReader4844 reader4844_,
// IEigenDAServiceManager eigenDAServiceManager_,
// bool isUsingFeeToken_
// )

await deploy('SequencerInboxStub', {
from: deployer,
args: [
Expand All @@ -24,10 +36,11 @@ module.exports = async hre => {
maxTime,
117964,
reader4844.address,
eigenDAServiceManager.address,
false,
],
})
}

module.exports.tags = ['SequencerInboxStub', 'test']
module.exports.dependencies = ['BridgeStub']
module.exports.dependencies = ['BridgeStub', 'EigenDAServiceManagerStub']
24 changes: 6 additions & 18 deletions src/bridge/ISequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,30 +193,13 @@ interface ISequencerInbox is IDelayedMessageProvider {
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof,
IEigenDAServiceManager.BlobHeader calldata blobHeader,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external;

// ---------- onlyRollupOrOwner functions ----------

/**
* @notice Set the eigenda service manager contract
* @param newEigenDAServiceManager the new svc manager contract address
*/
function setEigenDAServiceManager(address newEigenDAServiceManager) external;

/**
* @notice Set the rollup manager contract address
* @param newRollupManager the new rollup manager contract address
*/
function setEigenDARollupManager(address newRollupManager) external;

/**
* @notice Set the new rollup contract address
*/
function setRollupAddress() external;


/**
* @notice Set max delay for sequencer inbox
* @param maxTimeVariation_ the maximum time variation parameters
Expand Down Expand Up @@ -259,6 +242,11 @@ interface ISequencerInbox is IDelayedMessageProvider {
/// @notice Allows the rollup owner to sync the rollup address
function updateRollupAddress() external;

/// @notice Allows the rollup owner to update the eigenDAServiceManager address
function updateEigenDAServiceManager(address newEigenDAServiceManager) external;

/// @notice Allows the rollup owner to update the eigenDARollupManager address
function updateEigenDARollupManager(address newEigenDARollupManager) external;

// ---------- initializer ----------

Expand Down
89 changes: 1 addition & 88 deletions src/bridge/RollupManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,93 +8,8 @@ import {EigenDAHasher} from "@eigenda/eigenda-utils/libraries/EigenDAHasher.sol"
import {IEigenDAServiceManager} from "@eigenda/eigenda-utils/interfaces/IEigenDAServiceManager.sol";
import {BitmapUtils} from "@eigenda/eigenda-utils/libraries/BitmapUtils.sol";
import {EigenDARollupUtils} from "@eigenda/eigenda-utils/libraries/EigenDARollupUtils.sol";
import {IBLSSignatureChecker} from "@eigenda/eigenda-utils/interfaces/IBLSSignatureChecker.sol";
import {IPaymentCoordinator} from "@eigenda/eigenda-utils/interfaces/IPaymentCoordinator.sol";
import {ISignatureUtils} from "@eigenda/eigenda-utils/interfaces/ISignatureUtils.sol";


// DummyServiceManager is a dummy implementation of IEigenDAServiceManager
// and is used in nitro-testnode to avoid the overhead of deploying core EigenDA contracts
// to simplify the testing process.
contract DummyServiceManager is IEigenDAServiceManager {

constructor() {
}

function batchIdToBatchMetadataHash(uint32 batchId) external view override returns (bytes32) {
return bytes32(0);
}

function confirmBatch(
BatchHeader calldata batchHeader,
IBLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature
) external override {
}

function setBatchConfirmer(address _batchConfirmer) external override {
}

function taskNumber() external view override returns (uint32) {
return 0;
}
function latestServeUntilBlock(uint32 referenceBlockNumber) external view override returns (uint32) {
return 0;
}
function BLOCK_STALE_MEASURE() external view override returns (uint32) {
return 0;
}

function quorumAdversaryThresholdPercentages() external view override returns (bytes memory) {
return "";
}

function quorumConfirmationThresholdPercentages() external view override returns (bytes memory) {
return "";
}

function quorumNumbersRequired() external view override returns (bytes memory) {
return "";
}

function payForRange(IPaymentCoordinator.RangePayment[] calldata rangePayments) external override {
return;
}

function updateAVSMetadataURI(string memory _metadataURI) external override {
return;
}

function registerOperatorToAVS(
address operator,
ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature
) external override {
return;
}

function deregisterOperatorFromAVS(address operator) external override {
return;
}

function getOperatorRestakedStrategies(address operator) external view override returns (address[] memory){
address[] memory dummyAddresses = new address[](2);
dummyAddresses[0] = 0x0000000000000000000000000000000000000001;
dummyAddresses[1] = 0x0000000000000000000000000000000000000002;
return dummyAddresses;
}

function getRestakeableStrategies() external view override returns (address[] memory) {
address[] memory dummyAddresses = new address[](2);
dummyAddresses[0] = 0x0000000000000000000000000000000000000001;
dummyAddresses[1] = 0x0000000000000000000000000000000000000002;
return dummyAddresses;
}

function avsDirectory() external view returns (address) {
address x = 0x0000000000000000000000000000000000000001;
return x;
}

}

interface IRollupManager {

Expand All @@ -114,9 +29,7 @@ interface IRollupManager {

}

// EigenDADummyManager is a dummy implementation of IRollupManager
// and is used in nitro-testnode to avoid the overhead of deploying core EigenDA contracts
// to simplify the testing process.

contract EigenDADummyManager {

function verifyBlob(
Expand Down
41 changes: 16 additions & 25 deletions src/bridge/SequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox

IBridge public bridge;

address public eigenDAServiceManager;
address public eigenDARollupManager;
IEigenDAServiceManager public eigenDAServiceManager;
IRollupManager public eigenDARollupManager;

/// @inheritdoc ISequencerInbox
uint256 public constant HEADER_LENGTH = 40;
Expand Down Expand Up @@ -140,6 +140,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
constructor(
uint256 _maxDataSize,
IReader4844 reader4844_,
IEigenDAServiceManager eigenDAServiceManager_,
IRollupManager eigenDARollupManager_,
bool _isUsingFeeToken
) {
maxDataSize = _maxDataSize;
Expand All @@ -149,6 +151,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
if (reader4844_ == IReader4844(address(0))) revert InitParamZero("Reader4844");
}
reader4844 = reader4844_;
eigenDAServiceManager = eigenDAServiceManager_;
eigenDARollupManager = eigenDARollupManager_;
isUsingFeeToken = _isUsingFeeToken;
}

Expand Down Expand Up @@ -409,22 +413,19 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
submitBatchSpendingReport(dataHash, seqMessageIndex, block.basefee, blobGas);
}
}



function addSequencerL2BatchFromEigenDA(
uint256 sequenceNumber,
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof,
IEigenDAServiceManager.BlobHeader calldata blobHeader,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external {
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();

// verify that the blob was actually included before continuing
IRollupManager(eigenDARollupManager).verifyBlob(blobHeader, IEigenDAServiceManager(eigenDAServiceManager), blobVerificationProof);

eigenDARollupManager.verifyBlob(blobHeader, eigenDAServiceManager, blobVerificationProof);

// NOTE: to retrieve need the following
// see: https://github.com/Layr-Labs/eigenda/blob/master/api/docs/retriever.md#blobrequest
Expand Down Expand Up @@ -452,14 +453,13 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
}

emit SequencerBatchDelivered(
seqMessageIndex,
_sequenceNumber,
beforeAcc,
afterAcc,
delayedAcc,
totalDelayedMessagesRead,
timeBounds,
IBridge.BatchDataLocation.EigenDA

);
}

Expand Down Expand Up @@ -785,32 +785,23 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
}

/// @inheritdoc ISequencerInbox
function setRollupAddress() external onlyRollupOwner {
function updateRollupAddress() external onlyRollupOwner {
IOwnable newRollup = bridge.rollup();
if (rollup == newRollup) revert RollupNotChanged();
rollup = newRollup;
emit OwnerFunctionCalled(6);
}

/// @inheritdoc ISequencerInbox
function setEigenDAServiceManager(address newEigenDAServiceManager) external onlyRollupOwner {
eigenDAServiceManager = newEigenDAServiceManager;
emit OwnerFunctionCalled(7);
function updateEigenDAServiceManager(address newEigenDAServiceManager) external onlyRollupOwner {
eigenDAServiceManager = IEigenDAServiceManager(newEigenDAServiceManager);
emit OwnerFunctionCalled(31);
}

/// @inheritdoc ISequencerInbox
function setEigenDARollupManager(address newRollupManager) external onlyRollupOwner {
eigenDARollupManager = newRollupManager;
emit OwnerFunctionCalled(8);
}

/// @notice Allows the rollup owner to sync the rollup address
function updateRollupAddress() external {
if (msg.sender != IOwnable(rollup).owner())
revert NotOwner(msg.sender, IOwnable(rollup).owner());
IOwnable newRollup = bridge.rollup();
if (rollup == newRollup) revert RollupNotChanged();
rollup = newRollup;
function updateEigenDARollupManager(address newEigenDARollupManager) external onlyRollupOwner {
eigenDARollupManager = IRollupManager(newEigenDARollupManager);
emit OwnerFunctionCalled(32);
}

function isValidKeysetHash(bytes32 ksHash) external view returns (bool) {
Expand Down
4 changes: 3 additions & 1 deletion src/mocks/SequencerInboxStub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ contract SequencerInboxStub is SequencerInbox {
ISequencerInbox.MaxTimeVariation memory maxTimeVariation_,
uint256 maxDataSize_,
IReader4844 reader4844_,
IEigenDAServiceManager eigenDAServiceManager_,
IRollupManager eigenDARollupManager_,

bool isUsingFeeToken_
) SequencerInbox(maxDataSize_, reader4844_, isUsingFeeToken_) {
) SequencerInbox(maxDataSize_, reader4844_, eigenDAServiceManager_, eigenDARollupManager_, isUsingFeeToken_) {
bridge = bridge_;
rollup = IOwnable(msg.sender);
delayBlocks = uint64(maxTimeVariation_.delayBlocks);
Expand Down
2 changes: 1 addition & 1 deletion src/osp/OneStepProverHostIo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ contract OneStepProverHostIo is IOneStepProver {
} else if (inst.argumentData == 3) {
// The machine is asking for a EigenDA versioned hash preimage

require(proofType == 0, "UNKNOWN_EIGENDA_PREIMAGE_PROOF");
require(proofType == 1, "UNKNOWN_PREIMAGE_PROOF");

bytes calldata kzgProof = proof[proofOffset:];

Expand Down
6 changes: 0 additions & 6 deletions src/rollup/RollupCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ contract RollupCreator is Ownable {
//// @dev The address of the batch poster, not used when set to zero address
address[] batchPosters;
address batchPosterManager;
address eigenDAServiceManager;
address eigenDARollupManager;
}

BridgeCreator public bridgeCreator;
Expand Down Expand Up @@ -198,10 +196,6 @@ contract RollupCreator is Ownable {
bridgeContracts.sequencerInbox.setBatchPosterManager(deployParams.batchPosterManager);
}

// Setting EigenDAServiceManager and EigenDARollupManager
bridgeContracts.sequencerInbox.setEigenDAServiceManager(deployParams.eigenDAServiceManager);
bridgeContracts.sequencerInbox.setEigenDARollupManager(deployParams.eigenDARollupManager);

// Call setValidator on the newly created rollup contract just if validator set is not empty
if (deployParams.validators.length != 0) {
bool[] memory _vals = new bool[](deployParams.validators.length);
Expand Down
4 changes: 2 additions & 2 deletions test/foundry/BridgeCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ contract BridgeCreatorTest is Test {
BridgeCreator.BridgeContracts ethBasedTemplates =
BridgeCreator.BridgeContracts({
bridge: new Bridge(),
sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false),
sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, false),
inbox: new Inbox(MAX_DATA_SIZE),
rollupEventInbox: new RollupEventInbox(),
outbox: new Outbox()
});
BridgeCreator.BridgeContracts erc20BasedTemplates =
BridgeCreator.BridgeContracts({
bridge: new ERC20Bridge(),
sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true),
sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, true),
inbox: new ERC20Inbox(MAX_DATA_SIZE),
rollupEventInbox: new ERC20RollupEventInbox(),
outbox: new ERC20Outbox()
Expand Down
Loading
Loading