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

Feat/slashing yn eth #220

Open
wants to merge 17 commits into
base: bn-build-fix
Choose a base branch
from
Open

Conversation

yield-farmer-1
Copy link
Collaborator

No description provided.

@yield-farmer-1
Copy link
Collaborator Author

On Holesky
Encountered a total of 6 failing tests, 330 tests succeeded

Failing tests:
Encountered 1 failing test in test/scenarios/fork/ynETH/Delegation.t.sol:YnETHDelegationScenarioTest
[FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 1 failing test in test/scenarios/fork/ynETH/ProtocolUpgrade-Scenario.spec.sol:ProtocolUpgradeScenario
[FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 1 failing test in test/scenarios/fork/ynETH/Withdrawals.t.sol:M3WithdrawalsTest
[FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 1 failing test in test/scenarios/fork/ynETH/WithdrawalsWithRewards-Scenario.t.sol:M3WithdrawalsWithRewardsTest
[FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 2 failing tests in test/scenarios/ynEIGEN/Delegation.t.sol:YnEigenDelegationScenarioTest
[FAIL: NotActivelyDelegated()] test_undelegate_Scenario_undelegateByDelegator() (gas: 837471)
[FAIL: NotActivelyDelegated()] test_undelegate_Scenario_undelegateByOperator1() (gas: 834301)

src/StakingNode.sol Show resolved Hide resolved
*/
mapping(bytes32 withdrawalRoot => uint256 withdrawableShares) public withdrawableSharesForWithdrawalRoot;

/** @dev Allows only a whitelisted address to configure the contract */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was the comment formatted into a one liner?

*/
function syncQueuedShares() external onlyDelegator {

IDelegationManager delegationManager = IDelegationManager(address(stakingNodesManager.delegationManager()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
IDelegationManager delegationManager = IDelegationManager(address(stakingNodesManager.delegationManager()));
IDelegationManager delegationManager = stakingNodesManager.delegationManager();

Casting seems unnecessary.

src/StakingNode.sol Show resolved Hide resolved
src/StakingNode.sol Show resolved Hide resolved
src/StakingNode.sol Outdated Show resolved Hide resolved
src/StakingNode.sol Show resolved Hide resolved
@fzavalia
Copy link
Collaborator

On Holesky Encountered a total of 6 failing tests, 330 tests succeeded

Failing tests: Encountered 1 failing test in test/scenarios/fork/ynETH/Delegation.t.sol:YnETHDelegationScenarioTest [FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 1 failing test in test/scenarios/fork/ynETH/ProtocolUpgrade-Scenario.spec.sol:ProtocolUpgradeScenario [FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 1 failing test in test/scenarios/fork/ynETH/Withdrawals.t.sol:M3WithdrawalsTest [FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 1 failing test in test/scenarios/fork/ynETH/WithdrawalsWithRewards-Scenario.t.sol:M3WithdrawalsWithRewardsTest [FAIL: EvmError: Revert] setUp() (gas: 0)

Encountered 2 failing tests in test/scenarios/ynEIGEN/Delegation.t.sol:YnEigenDelegationScenarioTest [FAIL: NotActivelyDelegated()] test_undelegate_Scenario_undelegateByDelegator() (gas: 837471) [FAIL: NotActivelyDelegated()] test_undelegate_Scenario_undelegateByOperator1() (gas: 834301)

The test/scenarios/ynEIGEN/Delegation.t.sol tests are fixed at #219

// SPDX-License-Identifier: BSD 3-Clause License
pragma solidity ^0.8.24;

contract MockAVS {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can also use lib/eigenlayer-contracts/src/test/mocks/MockAVSRegistrar.sol which is the one used by eigen to mock an avs

src/StakingNode.sol Show resolved Hide resolved
src/StakingNode.sol Outdated Show resolved Hide resolved
src/StakingNode.sol Outdated Show resolved Hide resolved
src/StakingNode.sol Outdated Show resolved Hide resolved
src/StakingNode.sol Show resolved Hide resolved
src/StakingNode.sol Show resolved Hide resolved
src/StakingNode.sol Outdated Show resolved Hide resolved



uint256 depositAmount = 32 ether;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Format

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

test/integration/StakingNode.t.sol Show resolved Hide resolved
delegatedTo = stakingNodesManager.delegationManager().delegatedTo(address(this));
}

function initializeV4() external onlyStakingNodesManager reinitializer(4) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it is not already initialized in holesky, this could be done in the initializeV3

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot(withdrawal);
uint256 withdrawableSharesForWithdrawalRootValue = withdrawableSharesForWithdrawalRoot[withdrawalRoot];

if (withdrawableSharesForWithdrawalRootValue != 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

withdrawableSharesForWithdrawalRootValue could be 0 after an operator was fully slashed.

I don't know what happens with withdrawals that are fully slashed. (If they revert on Eigen or not).

But if they don't revert and this goes through the else condition. It might have accounting issues as queuedShares is decreased by scaledShares when it should be 0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated code by considering queuedShares and legacyQueuedShares as separate entity and not mixing accounting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants