{
    "Function": "verifyMerkleProof",
    "File": "packages/protocol/contracts/libs/LibTrieProof.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "SecureMerkleTrie",
        "RLPReader",
        "RLPReader",
        "SecureMerkleTrie",
        "RLPWriter"
    ],
    "Internal Calls": [
        "revert LTP_INVALID_INCLUSION_PROOF()",
        "revert LTP_INVALID_ACCOUNT_PROOF()",
        "abi.encodePacked()",
        "bytes.concat()"
    ],
    "Library Calls": [
        "get",
        "readBytes",
        "verifyInclusionProof",
        "readList",
        "writeUint"
    ],
    "Low-Level Calls": [],
    "Code": "function verifyMerkleProof(\n        bytes32 _rootHash,\n        address _addr,\n        bytes32 _slot,\n        bytes32 _value,\n        bytes[] memory _accountProof,\n        bytes[] memory _storageProof\n    )\n        internal\n        pure\n        returns (bytes32 storageRoot_)\n    {\n        if (_accountProof.length != 0) {\n            bytes memory rlpAccount =\n                SecureMerkleTrie.get(abi.encodePacked(_addr), _accountProof, _rootHash);\n\n            if (rlpAccount.length == 0) revert LTP_INVALID_ACCOUNT_PROOF();\n\n            RLPReader.RLPItem[] memory accountState = RLPReader.readList(rlpAccount);\n\n            storageRoot_ =\n                bytes32(RLPReader.readBytes(accountState[_ACCOUNT_FIELD_INDEX_STORAGE_HASH]));\n        } else {\n            storageRoot_ = _rootHash;\n        }\n\n        bool verified = SecureMerkleTrie.verifyInclusionProof(\n            bytes.concat(_slot), RLPWriter.writeUint(uint256(_value)), _storageProof, storageRoot_\n        );\n\n        if (!verified) revert LTP_INVALID_INCLUSION_PROOF();\n    }"
}