Skip to content

Unmet constraint on LiquidityPool.batchApproveRegistration(...) #289

@seongyun-ko

Description

@seongyun-ko

The Problem

EtherFiAdmin's Batching Logic (Naive):

function _enqueueValidatorApprovalTask(bytes32 _reportHash, uint256[] calldata _validators) internal {
    uint256 numBatches = (_validators.length + validatorTaskBatchSize - 1) / validatorTaskBatchSize;
    
    for (uint256 i = 0; i < numBatches; i++) {
        uint256 start = i * validatorTaskBatchSize;
        uint256 end = (i + 1) * validatorTaskBatchSize > _validators.length ? _validators.length : (i + 1) * validatorTaskBatchSize;
        uint256[] memory batchValidators = new uint256[](end - start);
        
        for (uint256 j = start; j < end; j++) {
            batchValidators[j - start] = _validators[j];  // Just takes consecutive validators!
        }
        // Creates task without considering pod assignment
    }
}

LiquidityPool's Same-Pod Constraint (Strict):

function batchApproveRegistration(uint256[] memory _validatorIds, ...) external {
    // all validators provided should belong to same node
    IEtherFiNode etherFiNode = IEtherFiNode(nodesManager.etherfiNodeAddress(_validatorIds[0]));
    
    for (uint256 i = 0; i < _validatorIds.length; i++) {
        // enforce that all validators are part of same node
        if (address(etherFiNode) != address(nodesManager.etherfiNodeAddress(_validatorIds[i]))) revert InvalidEtherFiNode();
    }
}

The Core Issue

  1. EtherFiAdmin batches validators sequentially (every 100 validators) without considering which pod/node they belong to
  2. LiquidityPool expects all validators in a batch to belong to the same pod/node
  3. When Shyam registers validators from different nodes, they get mixed into the same batch, causing InvalidEtherFiNode() reverts

Solutions

Option 1: Remove the Same-Pod Constraint

  • Modify batchApproveRegistration to handle validators from different pods

Option 2: Smart Batching in EtherFiAdmin

  • Modify _enqueueValidatorApprovalTask to group validators by pod before batching
  • More complex logic but maintains current gas efficiency

Option 3: Use confirmAndFundBeaconValidators

  • this function doesn't have the same-pod constraint
  • Would require updating EtherFiAdmin to use this method instead

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