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

m2-mainnet Contracts Update #158

Merged
merged 41 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ab4cd8f
start
0x0aa0 Nov 22, 2023
c94e852
temp comment scripts
0x0aa0 Nov 28, 2023
0f1a5ca
sm interface
0x0aa0 Jan 5, 2024
e150030
batch confirmer permission
0x0aa0 Jan 5, 2024
69a8ae3
mock rollup reorg
0x0aa0 Jan 8, 2024
3ce4a72
optimistic confirmation
0x0aa0 Jan 10, 2024
6bb3fa7
use ServiceManagerBase
0x0aa0 Jan 10, 2024
c933aa9
update DASM interface
0x0aa0 Jan 10, 2024
f64bf6f
nit
0x0aa0 Jan 10, 2024
e45bb7c
optimistic confirmation
0x0aa0 Jan 10, 2024
6f2788e
Merge branch 'nitro' of https://github.com/Layr-Labs/eigenda into nitro
0x0aa0 Jan 10, 2024
63d0351
nsss calldata
0x0aa0 Jan 12, 2024
5a3c1e8
Merge branch 'master' into m2-mainnet-contracts
0x0aa0 Jan 12, 2024
b105c4a
rm fee
0x0aa0 Jan 12, 2024
41c0064
Updated assignments commitments rebase (#176)
mooselumph Jan 13, 2024
112c739
fix rollup
0x0aa0 Jan 14, 2024
44de9d8
rm op
0x0aa0 Jan 14, 2024
aa8620b
fix scripts
0x0aa0 Jan 14, 2024
7e8d345
fin
0x0aa0 Jan 14, 2024
3c38f51
Update transactor for M2 mainnet contracts (#194)
mooselumph Jan 25, 2024
8ccb524
Update deployment code for M2 mainnet contracts (#193)
mooselumph Jan 25, 2024
ca28ca1
Update indexer M2 mainnet contracts (#195)
mooselumph Jan 25, 2024
aa7b912
Component updates for M2 mainnet contracts (#196)
mooselumph Jan 25, 2024
165e760
Plumb the kickparams for register operator with churn call (#212)
jianoaix Jan 26, 2024
d06dec1
fix(breaking): add storage gap to da service manager storage (#215)
stevennevins Jan 29, 2024
0f83d13
Update subgraphs for m2 contract changes (#192)
mooselumph Jan 29, 2024
5e911e0
Make Churner work on v2 smart contracts (#213)
jianoaix Jan 30, 2024
8bea4a7
Update contract submodules (#224)
0x0aa0 Jan 31, 2024
d104c9d
Update eigenda batch metadata subgraph (#221)
mooselumph Jan 31, 2024
0efdbf0
Merge master into m2 mainnet contracts (#220)
mooselumph Jan 31, 2024
6916ee0
Merge master
mooselumph Jan 31, 2024
48edabb
Update bindings and protoc
mooselumph Jan 31, 2024
f47fbd0
Merge master again
mooselumph Feb 1, 2024
d703d8f
update eigenlayer-contracts submodule (#229)
0x0aa0 Feb 1, 2024
a31bc9e
update eigenlayer-middleware submodule
0x0aa0 Feb 1, 2024
f534540
Add AVS directory (#227)
mooselumph Feb 1, 2024
d950176
Churner fixes for m2 mainnet contracts (#231)
mooselumph Feb 1, 2024
5966e34
Goerli deploy script (#214)
0x0aa0 Feb 2, 2024
c91f47b
Fix unit tests and lint (#234)
mooselumph Feb 2, 2024
8c7be10
fix: integration script (#235)
0x0aa0 Feb 2, 2024
723c9bb
M2 mainnet contracts fix integ tests (#237)
mooselumph Feb 2, 2024
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
9 changes: 0 additions & 9 deletions contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ out = 'out'
libs = ['lib']
fs_permissions = [{ access = "read-write", path = "./"}]

remappings = [
"@eigenlayer-middleware/=lib/eigenlayer-middleware/src/",
"@eigenlayer-core/=lib/eigenlayer-contracts/src/",
"@eigenlayer-scripts/=lib/eigenlayer-contracts/script/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/",
"forge-std/=lib/forge-std/src/"
]

gas_reports = ["*"]

# A list of ignored solc error codes
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/eigenlayer-contracts
2 changes: 1 addition & 1 deletion contracts/lib/eigenlayer-middleware
Submodule eigenlayer-middleware updated 88 files
+34 −0 .github/ISSUE_TEMPLATE/bug_report.md
+30 −0 .github/ISSUE_TEMPLATE/design.md
+24 −0 .github/ISSUE_TEMPLATE/feature_request.md
+26 −0 .github/ISSUE_TEMPLATE/test.md
+1 −0 .github/workflows/tests.yml
+1 −0 .gitmodules
+39 −79 README.md
+0 −21 docs/BLSOperatorStateRetriever.md
+0 −36 docs/BLSPubkeyRegistry.md
+0 −27 docs/BLSPublicKeyCompendium.md
+0 −86 docs/BLSRegistryCoordinatorWithIndices.md
+185 −29 docs/BLSSignatureChecker.md
+0 −48 docs/IndexRegistry.md
+0 −15 docs/Middleware-registration-operator-flow.md
+152 −0 docs/README.md
+334 −0 docs/RegistryCoordinator.md
+68 −0 docs/ServiceManagerBase.md
+0 −56 docs/StakeRegistry.md
+4 −4 docs/experimental/AVS-Guide.md
+161 −0 docs/registries/BLSApkRegistry.md
+166 −0 docs/registries/IndexRegistry.md
+339 −0 docs/registries/StakeRegistry.md
+3 −0 foundry.toml
+1 −1 lib/eigenlayer-contracts
+0 −2 script/AVSContractsDeploy.s.sol
+9 −12 script/DeploySharedContracts.s.sol
+284 −0 src/BLSApkRegistry.sol
+40 −0 src/BLSApkRegistryStorage.sol
+0 −213 src/BLSPubkeyRegistry.sol
+0 −34 src/BLSPubkeyRegistryStorage.sol
+0 −91 src/BLSPublicKeyCompendium.sol
+0 −655 src/BLSRegistryCoordinatorWithIndices.sol
+166 −91 src/BLSSignatureChecker.sol
+198 −146 src/IndexRegistry.sol
+11 −14 src/IndexRegistryStorage.sol
+20 −20 src/OperatorStateRetriever.sol
+874 −0 src/RegistryCoordinator.sol
+122 −68 src/ServiceManagerBase.sol
+515 −335 src/StakeRegistry.sol
+31 −9 src/StakeRegistryStorage.sol
+0 −226 src/VoteWeigherBase.sol
+0 −63 src/VoteWeigherBaseStorage.sol
+140 −0 src/interfaces/IBLSApkRegistry.sol
+0 −85 src/interfaces/IBLSPubkeyRegistry.sol
+0 −43 src/interfaces/IBLSPublicKeyCompendium.sol
+0 −70 src/interfaces/IBLSRegistry.sol
+0 −68 src/interfaces/IBLSRegistryCoordinatorWithIndices.sol
+13 −7 src/interfaces/IBLSSignatureChecker.sol
+11 −13 src/interfaces/IIndexRegistry.sol
+0 −155 src/interfaces/IQuorumRegistry.sol
+1 −3 src/interfaces/IRegistry.sol
+76 −20 src/interfaces/IRegistryCoordinator.sol
+38 −11 src/interfaces/IServiceManager.sol
+113 −25 src/interfaces/IStakeRegistry.sol
+0 −97 src/interfaces/IVoteWeigher.sol
+8 −4 src/libraries/BN254.sol
+67 −3 src/libraries/BitmapUtils.sol
+21 −16 test/ffi/BLSPubKeyCompendiumFFI.t.sol
+7 −7 test/ffi/BLSSignatureCheckerFFI.t.sol
+1 −1 test/ffi/util/G2Operations.sol
+21 −0 test/harnesses/BLSApkRegistryHarness.sol
+0 −33 test/harnesses/BLSRegistryCoordinatorWithIndicesHarness.sol
+3 −3 test/harnesses/BitmapUtilsWrapper.sol
+39 −0 test/harnesses/RegistryCoordinatorHarness.t.sol
+44 −49 test/harnesses/StakeRegistryHarness.sol
+188 −0 test/integration/CoreRegistration.t.sol
+0 −44 test/mocks/BLSPublicKeyCompendiumMock.sol
+185 −0 test/mocks/DelegationMock.sol
+0 −39 test/mocks/MiddlewareRegistryMock.sol
+33 −9 test/mocks/RegistryCoordinatorMock.sol
+0 −31 test/mocks/ServiceManagerMock.sol
+83 −29 test/mocks/StakeRegistryMock.sol
+348 −0 test/unit/BLSApkRegistryUnit.t.sol
+0 −254 test/unit/BLSPubkeyRegistryUnit.t.sol
+0 −80 test/unit/BLSPublicKeyCompendiumUnit.t.sol
+5 −9 test/unit/BLSSignatureCheckerUnit.t.sol
+7 −7 test/unit/BitmapUtils.t.sol
+0 −82 test/unit/DelegationManager.tree
+90 −128 test/unit/IndexRegistryUnit.t.sol
+10 −10 test/unit/OperatorStateRetrieverUnit.t.sol
+214 −159 test/unit/RegistryCoordinatorUnit.t.sol
+138 −188 test/unit/StakeRegistryUnit.t.sol
+440 −451 test/unit/VoteWeigherBaseUnit.t.sol
+6 −6 test/utils/BLSMockAVSDeployer.sol
+110 −97 test/utils/MockAVSDeployer.sol
+8 −8 test/utils/Operators.sol
+2 −2 test/utils/Owners.sol
+14 −14 test/utils/ProofParsing.sol
6 changes: 6 additions & 0 deletions contracts/remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/
@openzeppelin/=lib/openzeppelin-contracts/
eigenlayer-middleware/=lib/eigenlayer-middleware/src/
eigenlayer-core/=lib/eigenlayer-contracts/src/
eigenlayer-scripts/=lib/eigenlayer-contracts/script/
forge-std/=lib/forge-std/src/
30 changes: 14 additions & 16 deletions contracts/script/EigenDADeployer.s.sol
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: UNLICENSED
/*
pragma solidity ^0.8.9;

import "@eigenlayer-scripts/middleware/DeployOpenEigenLayer.s.sol";

import "@eigenlayer-core/contracts/permissions/PauserRegistry.sol";
import "@eigenlayer-core/test/mocks/EmptyContract.sol";

import "@eigenlayer-middleware/BLSPublicKeyCompendium.sol";
import "@eigenlayer-middleware/BLSRegistryCoordinatorWithIndices.sol";
import "@eigenlayer-middleware/BLSPubkeyRegistry.sol";
import "@eigenlayer-middleware/IndexRegistry.sol";
import "@eigenlayer-middleware/StakeRegistry.sol";
import "@eigenlayer-middleware/BLSOperatorStateRetriever.sol";

import "eigenlayer-scripts/middleware/DeployOpenEigenLayer.s.sol";
import {PauserRegistry} from "eigenlayer-core/contracts/permissions/PauserRegistry.sol";
import {EmptyContract} from "eigenlayer-core/test/mocks/EmptyContract.sol";
import {BLSPublicKeyCompendium} from "eigenlayer-middleware/BLSPublicKeyCompendium.sol";
import {BLSRegistryCoordinatorWithIndices, IBLSRegistryCoordinatorWithIndices} from "eigenlayer-middleware/BLSRegistryCoordinatorWithIndices.sol";
import {BLSPubkeyRegistry, IBLSPubkeyRegistry} from "eigenlayer-middleware/BLSPubkeyRegistry.sol";
import {IndexRegistry, IIndexRegistry} from "eigenlayer-middleware/IndexRegistry.sol";
import {StakeRegistry, IStakeRegistry, IServiceManager} from "eigenlayer-middleware/StakeRegistry.sol";
import {BLSOperatorStateRetriever} from "eigenlayer-middleware/BLSOperatorStateRetriever.sol";
import {EigenDAServiceManager} from "../src/core/EigenDAServiceManager.sol";
import "../src/libraries/EigenDAHasher.sol";
import {EigenDAHasher} from "../src/libraries/EigenDAHasher.sol";

import "forge-std/Test.sol";

import "forge-std/Script.sol";
import "forge-std/StdJson.sol";

Expand Down Expand Up @@ -96,7 +93,7 @@ contract EigenDADeployer is DeployOpenEigenLayer {
/**
* First, deploy upgradeable proxy contracts that **will point** to the implementations. Since the implementation contracts are
* not yet deployed, we give these proxies an empty contract as the initial implementation, to act as if they have no code.
*/
*//*
eigenDAServiceManager = EigenDAServiceManager(
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenDAProxyAdmin), ""))
);
Expand Down Expand Up @@ -218,3 +215,4 @@ contract EigenDADeployer is DeployOpenEigenLayer {
blsOperatorStateRetriever = new BLSOperatorStateRetriever();
}
}
*/
2 changes: 1 addition & 1 deletion contracts/script/MockRollupDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.9;

import "forge-std/Script.sol";
import "../test/mocks/MockRollup.sol";
import "../src/rollup/MockRollup.sol";
import {IEigenDAServiceManager} from "../src/interfaces/IEigenDAServiceManager.sol";

contract MockRollupDeployer is Script {
Expand Down
33 changes: 15 additions & 18 deletions contracts/script/SetUpEigenDA.s.sol
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: UNLICENSED
/*
pragma solidity ^0.8.9;

import "@eigenlayer-scripts/middleware/DeployOpenEigenLayer.s.sol";

import "@eigenlayer-core/contracts/permissions/PauserRegistry.sol";
import "@eigenlayer-core/test/mocks/EmptyContract.sol";

import "@eigenlayer-middleware/BLSPublicKeyCompendium.sol";
import "@eigenlayer-middleware/BLSRegistryCoordinatorWithIndices.sol";
import "@eigenlayer-middleware/BLSPubkeyRegistry.sol";
import "@eigenlayer-middleware/IndexRegistry.sol";
import "@eigenlayer-middleware/StakeRegistry.sol";


import "eigenlayer-scripts/middleware/DeployOpenEigenLayer.s.sol";
import {PauserRegistry} from "eigenlayer-core/contracts/permissions/PauserRegistry.sol";
import {EmptyContract} from "eigenlayer-core/test/mocks/EmptyContract.sol";
import {BLSPublicKeyCompendium} from "eigenlayer-middleware/BLSPublicKeyCompendium.sol";
import {BLSRegistryCoordinatorWithIndices} from "eigenlayer-middleware/BLSRegistryCoordinatorWithIndices.sol";
import {BLSPubkeyRegistry} from "eigenlayer-middleware/BLSPubkeyRegistry.sol";
import {IndexRegistry} from "eigenlayer-middleware/IndexRegistry.sol";
import {IIndexRegistry} from "eigenlayer-middleware/interfaces/IIndexRegistry.sol";
import {StakeRegistry} from "eigenlayer-middleware/StakeRegistry.sol";
import {EigenDAServiceManager} from "../src/core/EigenDAServiceManager.sol";
import "../src/libraries/EigenDAHasher.sol";

import "./EigenDADeployer.s.sol";
import "./EigenLayerUtils.s.sol";
import {EigenDAHasher} from "../src/libraries/EigenDAHasher.sol";
import {EigenDADeployer} from "./EigenDADeployer.s.sol";
import {EigenLayerUtils} from "./EigenLayerUtils.s.sol";

import "forge-std/Test.sol";

import "forge-std/Script.sol";
import "forge-std/StdJson.sol";

Expand Down Expand Up @@ -189,3 +185,4 @@ contract SetupEigenDA is EigenDADeployer, EigenLayerUtils {
vm.writeJson(finalJson, "./script/output/eigenda_deploy_output.json");
}
}
*/
21 changes: 11 additions & 10 deletions contracts/script/m2/M2_Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// SPDX-License-Identifier: BUSL-1.1
/*
pragma solidity =0.8.12;

import "@eigenlayer-scripts/utils/ExistingDeploymentParser.sol";
import "eigenlayer-scripts/utils/ExistingDeploymentParser.sol";

import "@eigenlayer-middleware/BLSPublicKeyCompendium.sol";
import "@eigenlayer-middleware/BLSRegistryCoordinatorWithIndices.sol";
import "@eigenlayer-middleware/BLSPubkeyRegistry.sol";
import "@eigenlayer-middleware/IndexRegistry.sol";
import "@eigenlayer-middleware/StakeRegistry.sol";
import "@eigenlayer-middleware/BLSOperatorStateRetriever.sol";
import "eigenlayer-middleware/BLSPublicKeyCompendium.sol";
import "eigenlayer-middleware/BLSRegistryCoordinatorWithIndices.sol";
import "eigenlayer-middleware/BLSPubkeyRegistry.sol";
import "eigenlayer-middleware/IndexRegistry.sol";
import "eigenlayer-middleware/StakeRegistry.sol";
import "eigenlayer-middleware/BLSOperatorStateRetriever.sol";

import "@eigenlayer-core/contracts/permissions/PauserRegistry.sol";
import "eigenlayer-core/contracts/permissions/PauserRegistry.sol";

import {EigenDAServiceManager} from "../../src/core/EigenDAServiceManager.sol";

Expand Down Expand Up @@ -336,5 +337,5 @@ contract Deployer_M2 is ExistingDeploymentParser {
string memory finalJson = vm.serializeString(parent_object, permissions, permissions_output);
vm.writeJson(finalJson, outputPath);
}

}
}
*/
6 changes: 3 additions & 3 deletions contracts/src/Imports.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Imports used for compiling for bindings for clients

import "@eigenlayer-middleware/BLSOperatorStateRetriever.sol";
import "@eigenlayer-middleware/BLSPublicKeyCompendium.sol";
import "@eigenlayer-middleware/BLSRegistryCoordinatorWithIndices.sol";
import "eigenlayer-middleware/OperatorStateRetriever.sol";
import "eigenlayer-middleware/BLSApkRegistry.sol";
import "eigenlayer-middleware/RegistryCoordinator.sol";
146 changes: 71 additions & 75 deletions contracts/src/core/EigenDAServiceManager.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";

import "@eigenlayer-core/contracts/interfaces/IDelegationManager.sol";
import {Pausable} from "eigenlayer-core/contracts/permissions/Pausable.sol";
import {IDelegationManager} from "eigenlayer-core/contracts/interfaces/IDelegationManager.sol";
import {IStrategyManager} from "eigenlayer-core/contracts/interfaces/IStrategyManager.sol";
import {ISlasher} from "eigenlayer-core/contracts/interfaces/ISlasher.sol";
import {IPauserRegistry} from "eigenlayer-core/contracts/interfaces/IPauserRegistry.sol";
import {ISignatureUtils} from "eigenlayer-core/contracts/interfaces/ISignatureUtils.sol";

import "@eigenlayer-core/contracts/libraries/BytesLib.sol";
import "@eigenlayer-core/contracts/libraries/Merkle.sol";
import "@eigenlayer-core/contracts/permissions/Pausable.sol";
import {ServiceManagerBase} from "eigenlayer-middleware/ServiceManagerBase.sol";
import {BLSSignatureChecker} from "eigenlayer-middleware/BLSSignatureChecker.sol";
import {IRegistryCoordinator} from "eigenlayer-middleware/interfaces/IRegistryCoordinator.sol";
import {IStakeRegistry} from "eigenlayer-middleware/interfaces/IStakeRegistry.sol";

import "../libraries/EigenDAHasher.sol";
import {EigenDAServiceManagerStorage} from "./EigenDAServiceManagerStorage.sol";
import {EigenDAHasher} from "../libraries/EigenDAHasher.sol";

import "./EigenDAServiceManagerStorage.sol";

/**
* @title Primary entrypoint for procuring services from EigenDA.
Expand All @@ -23,54 +27,47 @@ import "./EigenDAServiceManagerStorage.sol";
* - confirming the data store by the disperser with inferred aggregated signatures of the quorum
* - freezing operators as the result of various "challenges"
*/
contract EigenDAServiceManager is Initializable, OwnableUpgradeable, EigenDAServiceManagerStorage, BLSSignatureChecker, Pausable {
using BytesLib for bytes;
contract EigenDAServiceManager is EigenDAServiceManagerStorage, ServiceManagerBase, BLSSignatureChecker, Pausable {
using EigenDAHasher for BatchHeader;
using EigenDAHasher for ReducedBatchHeader;

uint8 internal constant PAUSED_CONFIRM_BATCH = 0;

/**
* @notice The EigenLayer delegation contract for this EigenDA which is primarily used by
* delegators to delegate their stake to operators who would serve as EigenDA
* nodes and so on.
* @dev For more details, see DelegationManager.sol.
*/
IDelegationManager public immutable delegationManager;

IStrategyManager public immutable strategyManager;

ISlasher public immutable slasher;
IStrategyManager public immutable _strategyManager;
ISlasher public immutable _slasher;

/// @notice when applied to a function, ensures that the function is only callable by the `registryCoordinator`.
modifier onlyRegistryCoordinator() {
require(msg.sender == address(registryCoordinator), "onlyRegistryCoordinator: not from registry coordinator");
/// @notice when applied to a function, ensures that the function is only callable by the `batchConfirmer`.
modifier onlyBatchConfirmer() {
require(msg.sender == batchConfirmer, "onlyBatchConfirmer: not from batch confirmer");
_;
}

constructor(
IBLSRegistryCoordinatorWithIndices _registryCoordinator,
IStrategyManager _strategyManager,
IDelegationManager _delegationMananger,
ISlasher _slasher
IDelegationManager __delegationMananger,
IRegistryCoordinator __registryCoordinator,
IStrategyManager __strategyManager,
IStakeRegistry __stakeRegistry,
ISlasher __slasher
)
BLSSignatureChecker(_registryCoordinator)
BLSSignatureChecker(__registryCoordinator)
ServiceManagerBase(__delegationMananger, __registryCoordinator, __stakeRegistry)
{
strategyManager = _strategyManager;
delegationManager = _delegationMananger;
slasher = _slasher;
_strategyManager = __strategyManager;
_slasher = __slasher;
_disableInitializers();
}

function initialize(
IPauserRegistry _pauserRegistry,
address initialOwner
address _initialOwner,
address _batchConfirmer
)
public
initializer
{
_initializePauser(_pauserRegistry, UNPAUSE_ALL);
_transferOwnership(initialOwner);
_transferOwnership(_initialOwner);
_setBatchConfirmer(_batchConfirmer);
}

/**
Expand All @@ -82,7 +79,7 @@ contract EigenDAServiceManager is Initializable, OwnableUpgradeable, EigenDAServ
function confirmBatch(
BatchHeader calldata batchHeader,
NonSignerStakesAndSignature memory nonSignerStakesAndSignature
) external onlyWhenNotPaused(PAUSED_CONFIRM_BATCH) {
) external onlyWhenNotPaused(PAUSED_CONFIRM_BATCH) onlyBatchConfirmer() {
// make sure the information needed to derive the non-signers and batch is in calldata to avoid emitting events
require(tx.origin == msg.sender, "EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata");
// make sure the stakes against which the Batch is being confirmed are not stale
Expand Down Expand Up @@ -126,53 +123,56 @@ contract EigenDAServiceManager is Initializable, OwnableUpgradeable, EigenDAServ
bytes32 batchHeaderHash = batchHeader.hashBatchHeader();
batchIdToBatchMetadataHash[batchIdMemory] = EigenDAHasher.hashBatchHashedMetadata(batchHeaderHash, signatoryRecordHash, fee, uint32(block.number));

emit BatchConfirmed(reducedBatchHeaderHash, batchIdMemory, fee);
emit BatchConfirmed(reducedBatchHeaderHash, batchIdMemory, fee, false);

// increment the batchId
batchId = batchIdMemory + 1;
}

/// @notice Called in the event of challenge resolution, in order to forward a call to the Slasher, which 'freezes' the `operator`.
function freezeOperator(address /*operator*/) external {
revert("EigenDAServiceManager.freezeOperator: not implemented");
// require(
// msg.sender == address(eigenDAChallenge)
// || msg.sender == address(eigenDABombVerifier),
// "EigenDAServiceManager.freezeOperator: Only challenge resolvers can slash operators"
// );
// slasher.freezeOperator(operator);
}
/// @notice This function is used for submitting data availabilty certificates optimistically
function confirmBatchOptimistically(
BatchHeader calldata batchHeader
) external onlyWhenNotPaused(PAUSED_CONFIRM_BATCH) onlyBatchConfirmer() {
// make sure the information needed to derive the non-signers and batch is in calldata to avoid emitting events
require(tx.origin == msg.sender, "EigenDAServiceManager.confirmBatch: header and nonsigner data must be in calldata");
// make sure the stakes against which the Batch is being confirmed are not stale
require(
batchHeader.referenceBlockNumber <= block.number, "EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is in future"
);

/**
* @notice Called by the Registry in the event of a new registration, to forward a call to the Slasher
* @param operator The operator whose stake is being updated
* @param serveUntilBlock The block until which the stake accounted for in the first update is slashable by this middleware
*/
function recordFirstStakeUpdate(address operator, uint32 serveUntilBlock) external onlyRegistryCoordinator {
// slasher.recordFirstStakeUpdate(operator, serveUntilBlock);
require(
(batchHeader.referenceBlockNumber + BLOCK_STALE_MEASURE) >= uint32(block.number),
"EigenDAServiceManager.confirmBatch: specified referenceBlockNumber is too far in past"
);

// calculate reducedBatchHeaderHash which nodes signed
bytes32 reducedBatchHeaderHash = batchHeader.hashBatchHeaderToReducedBatchHeader();

// store the metadata hash
uint96 fee = 0;
uint32 batchIdMemory = batchIdOptimistic;
bytes32 batchHeaderHash = batchHeader.hashBatchHeader();
batchIdToBatchMetadataHashOptimistic[batchIdMemory] = EigenDAHasher.hashBatchHashedMetadata(batchHeaderHash, fee, uint32(block.number));
0x0aa0 marked this conversation as resolved.
Show resolved Hide resolved

emit BatchConfirmed(reducedBatchHeaderHash, batchIdMemory, fee, true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might mess up our indexing to add another param, so another event might be preferrable.

@mooselumph wdyt


// increment the batchId
batchIdOptimistic = batchIdMemory + 1;
}

/**
* @notice Called by the registryCoordinator, in order to forward a call to the Slasher, informing it of a stake update
* @param operator The operator whose stake is being updated
* @param updateBlock The block at which the update is being made
* @param serveUntilBlock The block until which the stake withdrawn from the operator in this update is slashable by this middleware
* @param prevElement The value of the previous element in the linked list of stake updates (generated offchain)
*/
function recordStakeUpdate(address operator, uint32 updateBlock, uint32 serveUntilBlock, uint256 prevElement) external onlyRegistryCoordinator {
// slasher.recordStakeUpdate(operator, updateBlock, serveUntilBlock, prevElement);
/// @notice This function is used for changing the batch confirmer
function setBatchConfirmer(address _batchConfirmer) external onlyOwner() {
_setBatchConfirmer(_batchConfirmer);
}

/**
* @notice Called by the registryCoordinator in the event of deregistration, to forward a call to the Slasher
* @param operator The operator being deregistered
* @param serveUntilBlock The block until which the stake delegated to the operator is slashable by this middleware
*/
function recordLastStakeUpdateAndRevokeSlashingAbility(address operator, uint32 serveUntilBlock) external onlyRegistryCoordinator {
// slasher.recordLastStakeUpdateAndRevokeSlashingAbility(operator, serveUntilBlock);
/// @notice changes the batch confirmer
function _setBatchConfirmer(address _batchConfirmer) internal {
address previousBatchConfirmer = batchConfirmer;
batchConfirmer = _batchConfirmer;
emit BatchConfirmerChanged(previousBatchConfirmer, batchConfirmer);
}

// VIEW FUNCTIONS
/// @notice Returns the current batchId
function taskNumber() external view returns (uint32) {
return batchId;
}
Expand All @@ -182,8 +182,4 @@ contract EigenDAServiceManager is Initializable, OwnableUpgradeable, EigenDAServ
return uint32(block.number) + STORE_DURATION_BLOCKS + BLOCK_STALE_MEASURE;
}

/// @dev need to override function here since its defined in both these contracts
function owner() public view override(OwnableUpgradeable, IServiceManager) returns (address) {
return OwnableUpgradeable.owner();
}
}
Loading
Loading