Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…leware into add-certora-rules
  • Loading branch information
ChaoticWalrus committed Oct 20, 2023
2 parents cdcf576 + 8c3fea2 commit eb1136d
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 567 deletions.
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
src = "src"
out = "out"
libs = ["lib"]
fs_permissions = [{ access = "read-write", path = "./" }]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
2 changes: 1 addition & 1 deletion lib/eigenlayer-contracts
Submodule eigenlayer-contracts updated 37 files
+3 −1 .env.example
+5 −13 docs/README.md
+122 −11 docs/core/EigenPodManager.md
+286 −144 package-lock.json
+6 −1 package.json
+539 −0 script/milestone/M2Deploy.s.sol
+0 −119 script/milestone/M2Deploy.sol
+19 −0 script/output/M2_deployment_data_goerli.json
+1 −6 script/testing/M2_Deploy_From_Scratch.s.sol
+23 −0 script/upgrade/README.md
+262 −0 script/upgrade/validateStorage.ts
+75 −0 script/upgrade/validateUpgrade.sh
+4 −8 script/whitelist/Whitelister.sol
+3 −7 script/whitelist/delegationFaucet/DelegationFaucet.sol
+24 −21 src/contracts/core/DelegationManager.sol
+1 −3 src/contracts/interfaces/IDelegationFaucet.sol
+16 −6 src/contracts/interfaces/IDelegationManager.sol
+6 −6 src/contracts/interfaces/IEigenPod.sol
+7 −0 src/contracts/interfaces/IEigenPodManager.sol
+3 −0 src/contracts/interfaces/IStrategyManager.sol
+1 −3 src/contracts/interfaces/IWhitelister.sol
+96 −70 src/contracts/pods/EigenPod.sol
+9 −3 src/test/DelegationFaucet.t.sol
+11 −2 src/test/DepositWithdraw.t.sol
+11 −6 src/test/EigenLayerTestHelper.t.sol
+53 −32 src/test/EigenPod.t.sol
+0 −61 src/test/SigP/BeaconProxy.sol
+0 −46 src/test/SigP/DelegationTerms.sol
+0 −219 src/test/SigP/EigenPodManagerNEW.sol
+5 −5 src/test/mocks/DelegationManagerMock.sol
+4 −0 src/test/mocks/EigenPodManagerMock.sol
+4 −33 src/test/mocks/EigenPodMock.sol
+1 −0 src/test/mocks/StrategyManagerMock.sol
+88 −28 src/test/unit/DelegationUnit.t.sol
+21 −10 src/test/unit/EigenPodUnit.t.sol
+21 −1 src/test/utils/EigenPodHarness.sol
+11 −0 tsconfig.json
50 changes: 50 additions & 0 deletions script/DeploySharedContracts.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.12;

import "../src/BLSPublicKeyCompendium.sol";
import "../src/BLSOperatorStateRetriever.sol";

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

// # To load the variables in the .env file
// source .env

// # To deploy and verify our contract
// forge script script/DeploySharedContracts.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
contract DeploySharedContracts is Script, Test {
Vm cheats = Vm(HEVM_ADDRESS);

BLSPublicKeyCompendium public blsPublicKeyCompendium;
BLSOperatorStateRetriever public blsOperatorStateRetriever;

function run() external {
vm.startBroadcast();
blsPublicKeyCompendium = new BLSPublicKeyCompendium();
blsOperatorStateRetriever = new BLSOperatorStateRetriever();
vm.stopBroadcast();

string memory deployed_addresses = "addresses";
vm.serializeAddress(
deployed_addresses,
"blsOperatorStateRetriever",
address(blsOperatorStateRetriever)
);
string memory finalJson = vm.serializeAddress(
deployed_addresses,
"blsPublicKeyCompendium",
address(blsPublicKeyCompendium)
);
vm.writeJson(finalJson, outputFileName());
}

function outputFileName() internal view returns (string memory) {
return
string.concat(
vm.projectRoot(),
"/script/output/",
vm.toString(block.chainid),
"/shared_contracts_deployment_data.json"
);
}
}
2 changes: 2 additions & 0 deletions script/output/31337/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 1 addition & 1 deletion src/BLSPublicKeyCompendium.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ contract BLSPublicKeyCompendium is IBLSPublicKeyCompendium {
BN254.negGeneratorG2(),
messageHash.plus(BN254.generatorG1().scalar_mul(gamma)),
pubkeyG2
), "BLSPublicKeyCompendium.registerBLSPublicKey: G1 and G2 private key do not match");
), "BLSPublicKeyCompendium.registerBLSPublicKey: either the G1 signature is wrong, or G1 and G2 private key do not match");

operatorToPubkeyHash[msg.sender] = pubkeyHash;
pubkeyHashToOperator[pubkeyHash] = msg.sender;
Expand Down
10 changes: 3 additions & 7 deletions src/StakeRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "src/interfaces/IServiceManager.sol";
import "src/interfaces/IStakeRegistry.sol";
import "src/interfaces/IRegistryCoordinator.sol";
import "src/StakeRegistryStorage.sol";
import {VoteWeigherBase} from "src/VoteWeigherBase.sol";

/**
* @title A `Registry` that keeps track of stakes of operators for up to 256 quorums.
Expand All @@ -17,7 +18,7 @@ import "src/StakeRegistryStorage.sol";
* It allows an additional functionality (in addition to registering and deregistering) to update the stake of an operator.
* @author Layr Labs, Inc.
*/
contract StakeRegistry is StakeRegistryStorage {
contract StakeRegistry is VoteWeigherBase, StakeRegistryStorage {
/// @notice requires that the caller is the RegistryCoordinator
modifier onlyRegistryCoordinator() {
require(
Expand All @@ -31,12 +32,7 @@ contract StakeRegistry is StakeRegistryStorage {
IRegistryCoordinator _registryCoordinator,
IStrategyManager _strategyManager,
IServiceManager _serviceManager
)
StakeRegistryStorage(_registryCoordinator, _strategyManager, _serviceManager)
// solhint-disable-next-line no-empty-blocks
{

}
) VoteWeigherBase(_strategyManager, _serviceManager) StakeRegistryStorage(_registryCoordinator) {}

/**
* @notice Sets the minimum stake for each quorum and adds `_quorumStrategiesConsideredAndMultipliers` for each
Expand Down
11 changes: 2 additions & 9 deletions src/StakeRegistryStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IS
import {IServiceManager} from "src/interfaces/IServiceManager.sol";
import {IStakeRegistry} from "src/interfaces/IStakeRegistry.sol";
import {IRegistryCoordinator} from "src/interfaces/IRegistryCoordinator.sol";
import {VoteWeigherBase} from "src/VoteWeigherBase.sol";

/**
* @title Storage variables for the `StakeRegistry` contract.
* @author Layr Labs, Inc.
* @notice This storage contract is separate from the logic to simplify the upgrade process.
*/
abstract contract StakeRegistryStorage is VoteWeigherBase, IStakeRegistry {
abstract contract StakeRegistryStorage is IStakeRegistry {
/// @notice the coordinator contract that this registry is associated with
IRegistryCoordinator public immutable registryCoordinator;

Expand All @@ -26,13 +25,7 @@ abstract contract StakeRegistryStorage is VoteWeigherBase, IStakeRegistry {
/// @notice mapping from operator's operatorId to the history of their stake updates
mapping(bytes32 => mapping(uint8 => OperatorStakeUpdate[])) internal operatorIdToStakeHistory;

constructor(
IRegistryCoordinator _registryCoordinator,
IStrategyManager _strategyManager,
IServiceManager _serviceManager
) VoteWeigherBase(_strategyManager, _serviceManager)
// solhint-disable-next-line no-empty-blocks
{
constructor(IRegistryCoordinator _registryCoordinator) {
registryCoordinator = _registryCoordinator;
}

Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/IBLSPublicKeyCompendium.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {BN254}from"eigenlayer-contracts/src/contracts/libraries/BN254.sol";
interface IBLSPublicKeyCompendium {

// EVENTS
/// @notice Emitted when `operator` registers with the public key `pk`.
event NewPubkeyRegistration(address operator, BN254.G1Point pubkeyG1, BN254.G2Point pubkeyG2);
/// @notice Emitted when `operator` registers with the public keys `pubkeyG1` and `pubkeyG2`.
event NewPubkeyRegistration(address indexed operator, BN254.G1Point pubkeyG1, BN254.G2Point pubkeyG2);

/**
* @notice mapping from operator address to pubkey hash.
Expand Down
Loading

0 comments on commit eb1136d

Please sign in to comment.