Skip to content

Commit

Permalink
chore: pending 0x02 credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatil12 committed Feb 5, 2025
1 parent f5dbfb8 commit 36bfa8c
Show file tree
Hide file tree
Showing 7 changed files with 1,154 additions and 121 deletions.
1 change: 1 addition & 0 deletions src/contracts/interfaces/IEigenPod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ interface IEigenPod is IEigenPodErrors, IEigenPodEvents {
) external;

/// @notice Called by EigenPodManager when the owner wants to create another ETH validator.
/// @dev This function only supports staking to a 0x01 validator. For compounding validators, please interact directly with the deposit contract.
function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable;

/**
Expand Down
8 changes: 7 additions & 1 deletion src/contracts/pods/EigenPod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ contract EigenPod is Initializable, ReentrancyGuardUpgradeable, EigenPodPausingC
}

/// @notice Called by EigenPodManager when the owner wants to create another ETH validator.
/// @dev This function only supports staking to a 0x01 validator. For compounding validators, please interact directly with the deposit contract.
function stake(
bytes calldata pubkey,
bytes calldata signature,
Expand Down Expand Up @@ -477,7 +478,8 @@ contract EigenPod is Initializable, ReentrancyGuardUpgradeable, EigenPodPausingC

// Ensure the validator's withdrawal credentials are pointed at this pod
require(
validatorFields.getWithdrawalCredentials() == bytes32(_podWithdrawalCredentials()),
validatorFields.getWithdrawalCredentials() == bytes32(_podWithdrawalCredentials()) ||
validatorFields.getWithdrawalCredentials() == bytes32(_podCompoundingWithdrawalCredentials()),
WithdrawalCredentialsNotForEigenPod()
);

Expand Down Expand Up @@ -670,6 +672,10 @@ contract EigenPod is Initializable, ReentrancyGuardUpgradeable, EigenPodPausingC
return abi.encodePacked(bytes1(uint8(1)), bytes11(0), address(this));
}

function _podCompoundingWithdrawalCredentials() internal view returns (bytes memory) {
return abi.encodePacked(bytes1(uint8(2)), bytes11(0), address(this));
}

///@notice Calculates the pubkey hash of a validator's pubkey as per SSZ spec
function _calculateValidatorPubkeyHash(
bytes memory validatorPubkey
Expand Down
2 changes: 1 addition & 1 deletion src/test/integration/mocks/BeaconChainMock.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct StaleBalanceProofs {
BeaconChainProofs.ValidatorProof validatorProof;
}

/// @notice A forward-compatible Beacon Chain Mock that updates containers & proofs for the Pectra upgrade
/// @notice A Pectra Beacon Chain Mock Contract. For testing upgrades, use BeaconChainMock_Upgradeable
contract BeaconChainMock is Logger {
using StdStyle for *;
using print for *;
Expand Down
Loading

0 comments on commit 36bfa8c

Please sign in to comment.