Skip to content

Add ability to reject a node delegationΒ #44

@ifavo

Description

@ifavo

On veDelegate.vet there are some nodes that have been delegated to staking wallets using delegateNode(address delegatee).
Some nodes have been burned after the delegation, because their VET balance went below the required threshold for XNodes.

The NodeManagement contract does not automatically update the delegation in these scenarios, keeping the delegation active.

Given that scenario, when the previous owner or staking wallet wants to remove the delegation using removeNodeDelegation, then it will revert with NodeManagementNonNodeHolder because the new node owner is now address(0).

A potential fix would be to use add another function that accepts the nodeId and allows delegatees to remove the delegation.

function rejectNodeDelegation(uint256 nodeId) public virtual {
    NodeManagementStorage storage $ = _getNodeManagementStorage();

    // Check if node is delegated and the sender is the delegatee
    address delegatee = $.nodeIdToDelegatee[nodeId];
    if (delegatee == address(0) || msg.sender != delegatee) {
      revert NodeManagementNodeNotDelegated();
    }

    // Remove delegation
    $.delegateeToNodeIds[delegatee].remove(nodeId);
    delete $.nodeIdToDelegatee[nodeId];

    // Emit event for delegation removal
    emit NodeDelegated(nodeId, delegatee, false);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions