{
    "Function": "verifyValidatorFields",
    "File": "src/contracts/libraries/BeaconChainProofs.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "Merkle",
        "Merkle"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "require(bool,string)",
        "require(bool,string)"
    ],
    "Library Calls": [
        "verifyInclusionSha256",
        "merkleizeSha256"
    ],
    "Low-Level Calls": [],
    "Code": "function verifyValidatorFields(\n        uint40 validatorIndex,\n        bytes32 beaconStateRoot,\n        bytes calldata proof, \n        bytes32[] calldata validatorFields\n    ) internal view {\n        \n        require(validatorFields.length == 2**VALIDATOR_FIELD_TREE_HEIGHT, \"BeaconChainProofs.verifyValidatorFields: Validator fields has incorrect length\");\n\n        /**\n         * Note: the length of the validator merkle proof is BeaconChainProofs.VALIDATOR_TREE_HEIGHT + 1.\n         * There is an additional layer added by hashing the root with the length of the validator list\n         */\n        require(proof.length == 32 * ((VALIDATOR_TREE_HEIGHT + 1) + BEACON_STATE_FIELD_TREE_HEIGHT), \"BeaconChainProofs.verifyValidatorFields: Proof has incorrect length\");\n        uint256 index = (VALIDATOR_TREE_ROOT_INDEX << (VALIDATOR_TREE_HEIGHT + 1)) | uint256(validatorIndex);\n        // merkleize the validatorFields to get the leaf to prove\n        bytes32 validatorRoot = Merkle.merkleizeSha256(validatorFields);\n\n        // verify the proof of the validatorRoot against the beaconStateRoot\n        require(Merkle.verifyInclusionSha256(proof, beaconStateRoot, validatorRoot, index), \"BeaconChainProofs.verifyValidatorFields: Invalid merkle proof\");\n    }"
}