{
    "Function": "slitherConstructorConstantVariables",
    "File": "packages/protocol/contracts/libs/LibTrieProof.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "library LibTrieProof {\n    // The consensus format representing account is RLP encoded in the\n    // following order: nonce, balance, storageHash, codeHash.\n    uint256 private constant _ACCOUNT_FIELD_INDEX_STORAGE_HASH = 2;\n\n    error LTP_INVALID_ACCOUNT_PROOF();\n    error LTP_INVALID_INCLUSION_PROOF();\n\n    /// @notice Verifies that the value of a slot in the storage of an account is value.\n    ///\n    /// @param _rootHash The merkle root of state tree or the account tree. If accountProof's length\n    /// is zero, it is used as the account's storage root, otherwise it will be used as the state\n    /// root.\n    /// @param _addr The address of contract.\n    /// @param _slot The slot in the contract.\n    /// @param _value The value to be verified.\n    /// @param _accountProof The account proof\n    /// @param _storageProof The storage proof\n    /// @return storageRoot_ The account's storage root\n    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    }\n}"
}