diff --git a/package.json b/package.json index d1bdd63c..7b085274 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,14 @@ "url": "https://github.com/gnosis" }, "scripts": { - "prepare": "husky install" + "prepare": "husky install", + "postinstall": "patch-package" }, "devDependencies": { "@commitlint/cli": "^17.5.1", "@commitlint/config-conventional": "^17.4.4", "husky": "^8.0.3", + "patch-package": "8.0.0", "prettier": "^2.8.7", "prettier-plugin-solidity": "^1.0.0" }, diff --git a/packages/evm/contracts/interfaces/IHashiProver.sol b/packages/evm/contracts/interfaces/IHashiProver.sol index a77b7e71..723ef8fc 100644 --- a/packages/evm/contracts/interfaces/IHashiProver.sol +++ b/packages/evm/contracts/interfaces/IHashiProver.sol @@ -12,10 +12,21 @@ interface IHashiProver { uint256 ancestralBlockNumber; bytes[] ancestralBlockHeaders; address account; - bytes accountProof; + bytes[] accountProof; bytes32 storageHash; bytes32[] storageKeys; - bytes[] storageProof; + bytes[][] storageProof; + } + + struct ReceiptProof { + uint256 chainId; + uint256 blockNumber; + bytes blockHeader; + uint256 ancestralBlockNumber; + bytes[] ancestralBlockHeaders; + bytes[] receiptProof; + bytes transactionIndex; + uint256 logIndex; } error AncestralBlockHeadersLengthReached(); @@ -24,6 +35,10 @@ interface IHashiProver { error InvalidAccount(); error InvalidBlockHeader(); error InvalidBlockHeaderLength(); + error InvalidLogIndex(); + error InvalidReceipt(); + error InvalidReceiptProof(); error InvalidStorageHash(); error InvalidStorageProofParams(); + error UnsupportedTxType(); } diff --git a/packages/evm/contracts/libraries/MerklePatriciaProofVerifier.sol b/packages/evm/contracts/libraries/MerklePatriciaProofVerifier.sol deleted file mode 100644 index 29641241..00000000 --- a/packages/evm/contracts/libraries/MerklePatriciaProofVerifier.sol +++ /dev/null @@ -1,248 +0,0 @@ -pragma solidity ^0.8.20; -/* solhint-disable */ - -import { RLPReader } from "solidity-rlp/contracts/RLPReader.sol"; - -// Copied from here: https://github.com/defi-wonderland/safe-liveness/blob/dev/solidity/libraries/MerklePatriciaProofVerifier.sol -library MerklePatriciaProofVerifier { - using RLPReader for RLPReader.RLPItem; - using RLPReader for bytes; - - /// @dev Validates a Merkle-Patricia-Trie proof. - /// If the proof proves the inclusion of some key-value pair in the - /// trie, the value is returned. Otherwise, i.e. if the proof proves - /// the exclusion of a key from the trie, an empty byte array is - /// returned. - /// @param rootHash is the Keccak-256 hash of the root node of the MPT. - /// @param path is the key of the node whose inclusion/exclusion we are - /// proving. - /// @param stack is the stack of MPT nodes (starting with the root) that - /// need to be traversed during verification. - /// @return value whose inclusion is proved or an empty byte array for - /// a proof of exclusion - function extractProofValue( - bytes32 rootHash, - bytes memory path, - RLPReader.RLPItem[] memory stack - ) internal pure returns (bytes memory value) { - bytes memory mptKey = _decodeNibbles(path, 0); - uint256 mptKeyOffset = 0; - - bytes32 nodeHashHash; - RLPReader.RLPItem[] memory node; - - RLPReader.RLPItem memory rlpValue; - - if (stack.length == 0) { - // Root hash of empty Merkle-Patricia-Trie - require(rootHash == 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421); - return new bytes(0); - } - - // Traverse stack of nodes starting at root. - for (uint256 i = 0; i < stack.length; i++) { - // We use the fact that an rlp encoded list consists of some - // encoding of its length plus the concatenation of its - // *rlp-encoded* items. - - // The root node is hashed with Keccak-256 ... - if (i == 0 && rootHash != stack[i].rlpBytesKeccak256()) { - revert(); - } - // ... whereas all other nodes are hashed with the MPT - // hash function. - if (i != 0 && nodeHashHash != _mptHashHash(stack[i])) { - revert(); - } - // We verified that stack[i] has the correct hash, so we - // may safely decode it. - node = stack[i].toList(); - - if (node.length == 2) { - // Extension or Leaf node - - bool isLeaf; - bytes memory nodeKey; - (isLeaf, nodeKey) = _merklePatriciaCompactDecode(node[0].toBytes()); - - uint256 prefixLength = _sharedPrefixLength(mptKeyOffset, mptKey, nodeKey); - mptKeyOffset += prefixLength; - - if (prefixLength < nodeKey.length) { - // Proof claims divergent extension or leaf. (Only - // relevant for proofs of exclusion.) - // An Extension/Leaf node is divergent iff it 'skips' over - // the point at which a Branch node should have been had the - // excluded key been included in the trie. - // Example: Imagine a proof of exclusion for path [1, 4], - // where the current node is a Leaf node with - // path [1, 3, 3, 7]. For [1, 4] to be included, there - // should have been a Branch node at [1] with a child - // at 3 and a child at 4. - - // Sanity check - if (i < stack.length - 1) { - // divergent node must come last in proof - revert(); - } - - return new bytes(0); - } - - if (isLeaf) { - // Sanity check - if (i < stack.length - 1) { - // leaf node must come last in proof - revert(); - } - - if (mptKeyOffset < mptKey.length) { - return new bytes(0); - } - - rlpValue = node[1]; - return rlpValue.toBytes(); - } else { - // extension - // Sanity check - if (i == stack.length - 1) { - // shouldn't be at last level - revert(); - } - - if (!node[1].isList()) { - // rlp(child) was at least 32 bytes. node[1] contains - // Keccak256(rlp(child)). - nodeHashHash = node[1].payloadKeccak256(); - } else { - // rlp(child) was less than 32 bytes. node[1] contains - // rlp(child). - nodeHashHash = node[1].rlpBytesKeccak256(); - } - } - } else if (node.length == 17) { - // Branch node - - if (mptKeyOffset != mptKey.length) { - // we haven't consumed the entire path, so we need to look at a child - uint8 nibble = uint8(mptKey[mptKeyOffset]); - mptKeyOffset += 1; - if (nibble >= 16) { - // each element of the path has to be a nibble - revert(); - } - - if (_isEmptyBytesequence(node[nibble])) { - // Sanity - if (i != stack.length - 1) { - // leaf node should be at last level - revert(); - } - - return new bytes(0); - } else if (!node[nibble].isList()) { - nodeHashHash = node[nibble].payloadKeccak256(); - } else { - nodeHashHash = node[nibble].rlpBytesKeccak256(); - } - } else { - // we have consumed the entire mptKey, so we need to look at what's contained in this node. - - // Sanity - if (i != stack.length - 1) { - // should be at last level - revert(); - } - - return node[16].toBytes(); - } - } - } - } - - /// @dev Computes the hash of the Merkle-Patricia-Trie hash of the RLP item. - /// Merkle-Patricia-Tries use a weird 'hash function' that outputs - /// *variable-length* hashes: If the item is shorter than 32 bytes, - /// the MPT hash is the item. Otherwise, the MPT hash is the - /// Keccak-256 hash of the item. - /// The easiest way to compare variable-length byte sequences is - /// to compare their Keccak-256 hashes. - /// @param item The RLP item to be hashed. - /// @return Keccak-256(MPT-hash(item)) - function _mptHashHash(RLPReader.RLPItem memory item) private pure returns (bytes32) { - if (item.len < 32) { - return item.rlpBytesKeccak256(); - } else { - return keccak256(abi.encodePacked(item.rlpBytesKeccak256())); - } - } - - function _isEmptyBytesequence(RLPReader.RLPItem memory item) private pure returns (bool) { - if (item.len != 1) { - return false; - } - uint8 b; - uint256 memPtr = item.memPtr; - assembly { - b := byte(0, mload(memPtr)) - } - return b == 0x80; /* empty byte string */ - } - - function _merklePatriciaCompactDecode( - bytes memory compact - ) private pure returns (bool isLeaf, bytes memory nibbles) { - require(compact.length > 0); - uint256 first_nibble = (uint8(compact[0]) >> 4) & 0xF; - uint256 skipNibbles; - if (first_nibble == 0) { - skipNibbles = 2; - isLeaf = false; - } else if (first_nibble == 1) { - skipNibbles = 1; - isLeaf = false; - } else if (first_nibble == 2) { - skipNibbles = 2; - isLeaf = true; - } else if (first_nibble == 3) { - skipNibbles = 1; - isLeaf = true; - } else { - // Not supposed to happen! - revert(); - } - return (isLeaf, _decodeNibbles(compact, skipNibbles)); - } - - function _decodeNibbles(bytes memory compact, uint256 skipNibbles) private pure returns (bytes memory nibbles) { - require(compact.length > 0); - - uint256 length = compact.length * 2; - require(skipNibbles <= length); - length -= skipNibbles; - - nibbles = new bytes(length); - uint256 nibblesLength = 0; - - for (uint256 i = skipNibbles; i < skipNibbles + length; i += 1) { - if (i % 2 == 0) { - nibbles[nibblesLength] = bytes1((uint8(compact[i / 2]) >> 4) & 0xF); - } else { - nibbles[nibblesLength] = bytes1((uint8(compact[i / 2]) >> 0) & 0xF); - } - nibblesLength += 1; - } - - assert(nibblesLength == nibbles.length); - } - - function _sharedPrefixLength(uint256 xsOffset, bytes memory xs, bytes memory ys) private pure returns (uint256) { - uint256 i; - for (i = 0; i + xsOffset < xs.length && i < ys.length; i++) { - if (xs[i + xsOffset] != ys[i]) { - return i; - } - } - return i; - } -} diff --git a/packages/evm/contracts/prover/HashiProver.sol b/packages/evm/contracts/prover/HashiProver.sol index 85a138ce..c975cbfc 100644 --- a/packages/evm/contracts/prover/HashiProver.sol +++ b/packages/evm/contracts/prover/HashiProver.sol @@ -1,8 +1,9 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.20; +pragma solidity ^0.8.0; +import { SecureMerkleTrie } from "@eth-optimism/contracts-bedrock/src/libraries/trie/SecureMerkleTrie.sol"; +import { MerkleTrie } from "@eth-optimism/contracts-bedrock/src/libraries/trie/MerkleTrie.sol"; import { RLPReader } from "solidity-rlp/contracts/RLPReader.sol"; -import { MerklePatriciaProofVerifier } from "../libraries/MerklePatriciaProofVerifier.sol"; import { IHashiProver } from "../interfaces/IHashiProver.sol"; import { IShoyuBashi } from "../interfaces/IShoyuBashi.sol"; @@ -16,6 +17,58 @@ contract HashiProver is IHashiProver { SHOYU_BASHI = shoyuBashi; } + /** + * @dev Verifies and retrieves a specific event from a transaction receipt in a foreign blockchain. + * + * @param proof A `ReceiptProof` struct containing proof details: + * - chainId: The chain ID of the foreign blockchain. + * - blockNumber: If ancestralBlockNumber is 0, then blockNumber represents the block where the transaction occurred and is available in Hashi. + * - blockHeader: The header of the specified block. + * - ancestralBlockNumber: If provided, this is the block number where the transaction took place. In this case, blockNumber is the block whose header is accessible in Hashi. + * - ancestralBlockHeaders: Array of block headers to prove the ancestry of the specified block. + * - receiptProof: Proof data for locating the receipt in the Merkle Trie. + * - transactionIndex: Index of the transaction within the block. + * - logIndex: The specific log index within the transaction receipt. + * + * @return bytes The RLP-encoded event corresponding to the specified `logIndex`. + */ + function verifyForeignEvent(ReceiptProof calldata proof) internal view returns (bytes memory) { + bytes memory blockHeader = _checkBlockHeaderAgainstHashi( + proof.chainId, + proof.blockNumber, + proof.blockHeader, + proof.ancestralBlockNumber, + proof.ancestralBlockHeaders + ); + RLPReader.RLPItem[] memory blockHeaderFields = blockHeader.toRlpItem().toList(); + bytes32 receiptsRoot = bytes32(blockHeaderFields[5].toUint()); + + bytes memory value = MerkleTrie.get(proof.transactionIndex, proof.receiptProof, receiptsRoot); + RLPReader.RLPItem[] memory receiptFields = _extractReceiptFields(value); + if (receiptFields.length != 4) revert InvalidReceipt(); + + RLPReader.RLPItem[] memory logs = receiptFields[3].toList(); + if (proof.logIndex >= logs.length) revert InvalidLogIndex(); + return logs[proof.logIndex].toRlpBytes(); + } + + /** + * @dev Verifies foreign storage data for a specified account on a foreign blockchain. + * + * @param proof An `AccountAndStorageProof` struct containing proof details: + * - chainId: The chain ID of the foreign blockchain. + * - blockNumber: If ancestralBlockNumber is 0, then blockNumber represents the block where the transaction occurred and is available in Hashi. + * - blockHeader: The header of the specified block. + * - ancestralBlockNumber: If provided, this is the block number where the transaction took place. In this case, blockNumber is the block whose header is accessible in Hashi. + * - ancestralBlockHeaders: Array of block headers proving ancestry of the specified block. + * - account: The account address whose storage is being verified. + * - accountProof: Proof data for locating the account in the state trie. + * - storageHash: Expected hash of the storage root for the account. + * - storageKeys: Array of storage keys for which data is being verified. + * - storageProof: Proof data for locating the storage values in the storage trie. + * + * @return bytes[] An array of storage values corresponding to the specified `storageKeys`. + */ function verifyForeignStorage(AccountAndStorageProof calldata proof) internal view returns (bytes[] memory) { bytes memory blockHeader = _checkBlockHeaderAgainstHashi( proof.chainId, @@ -57,10 +110,8 @@ contract HashiProver is IHashiProver { currentBlockHeaderHash ); - if (ancestralBlockNumber == currentAncestralBlockNumber && i == ancestralBlockHeaders.length - 1) { + if (ancestralBlockNumber == currentAncestralBlockNumber) { return ancestralBlockHeaders[i]; - } else if (i == ancestralBlockHeaders.length - 1) { - revert AncestralBlockHeadersLengthReached(); } else { currentBlockHeaderHash = blockParentHash; } @@ -69,16 +120,31 @@ contract HashiProver is IHashiProver { revert BlockHeaderNotFound(); } + function _extractReceiptFields(bytes memory value) private pure returns (RLPReader.RLPItem[] memory) { + uint256 offset; + if (value[0] == 0x01 || value[0] == 0x02 || value[0] == 0x03 || value[0] == 0x7e) { + offset = 1; + } else if (value[0] >= 0xc0) { + offset = 0; + } else { + revert UnsupportedTxType(); + } + + uint256 memPtr; + assembly { + memPtr := add(value, add(0x20, mul(0x01, offset))) + } + + return RLPReader.RLPItem(value.length - offset, memPtr).toList(); + } + function _verifyAccountProof( address account, bytes32 stateRoot, - bytes memory proof + bytes[] memory proof ) private pure returns (uint256, uint256, bytes32, bytes32) { - bytes memory accountRlp = MerklePatriciaProofVerifier.extractProofValue( - stateRoot, - abi.encodePacked(keccak256(abi.encodePacked(account))), - proof.toRlpItem().toList() - ); + bytes memory accountRlp = SecureMerkleTrie.get(abi.encodePacked(account), proof, stateRoot); + bytes32 accountStorageRoot = bytes32(accountRlp.toRlpItem().toList()[2].toUint()); if (accountStorageRoot.length == 0) revert InvalidStorageHash(); RLPReader.RLPItem[] memory accountFields = accountRlp.toRlpItem().toList(); @@ -95,18 +161,14 @@ contract HashiProver is IHashiProver { function _verifyStorageProof( bytes32 storageHash, bytes32[] memory storageKeys, - bytes[] memory proof + bytes[][] memory proof ) private pure returns (bytes[] memory) { bytes[] memory results = new bytes[](proof.length); if (storageKeys.length == 0 || proof.length == 0 || storageKeys.length != proof.length) revert InvalidStorageProofParams(); for (uint256 i = 0; i < proof.length; ) { RLPReader.RLPItem memory item = RLPReader.toRlpItem( - MerklePatriciaProofVerifier.extractProofValue( - storageHash, - abi.encodePacked(keccak256(abi.encode(storageKeys[i]))), - proof[i].toRlpItem().toList() - ) + SecureMerkleTrie.get(abi.encode(storageKeys[i]), proof[i], storageHash) ); results[i] = item.toBytes(); unchecked { diff --git a/packages/evm/contracts/test/HashiProverTest.sol b/packages/evm/contracts/test/HashiProverTest.sol index 8e4d0892..dc3c4383 100644 --- a/packages/evm/contracts/test/HashiProverTest.sol +++ b/packages/evm/contracts/test/HashiProverTest.sol @@ -6,7 +6,11 @@ import { HashiProver } from "../prover/HashiProver.sol"; contract HashiProverTest is HashiProver { constructor(address shoyuBashi) HashiProver(shoyuBashi) {} - function getValue(HashiProver.AccountAndStorageProof calldata proof) external view returns (bytes[] memory) { + function getStorageValue(HashiProver.AccountAndStorageProof calldata proof) external view returns (bytes[] memory) { return verifyForeignStorage(proof); } + + function getEventValues(HashiProver.ReceiptProof calldata proof) external view returns (bytes memory) { + return verifyForeignEvent(proof); + } } diff --git a/packages/evm/package.json b/packages/evm/package.json index 90dfb08b..9cd6f415 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -82,6 +82,7 @@ "@chainlink/contracts-ccip": "0.7.6", "@connext/interfaces": "2.0.0", "@eth-optimism/contracts": "0.6.0", + "@eth-optimism/contracts-bedrock": "^0.17.3", "@hyperlane-xyz/core": "3.1.10", "@layerzerolabs/lz-evm-messagelib-v2": "^2.3.29", "@layerzerolabs/lz-evm-oapp-v2": "^2.3.29", diff --git a/packages/evm/test/05_HashiProver.spec.ts b/packages/evm/test/05_HashiProver.spec.ts index ebf16b43..575241c9 100644 --- a/packages/evm/test/05_HashiProver.spec.ts +++ b/packages/evm/test/05_HashiProver.spec.ts @@ -3,45 +3,14 @@ import { expect } from "chai" import { Contract } from "ethers" import { ethers } from "hardhat" +import { + ACCOUNT_AND_STORAGE_PROOF, + ACCOUNT_AND_STORAGE_PROOF_WITH_ANCESTRAL_BLOCKS, + RECEIPT_PROOF, + RECEIPT_PROOF_WITH_ANCESTRAL_BLOCKS, +} from "./proofs" + const SOURCE_CHAIN_ID = 10 -const BLOCK_NUMBER = 126086803 -const BLOCK_HEADER_HASH = "0xf72ab984efa166b226dcb589bc445afeb8e666f789173a32de6d04108ac5cb8c" -const VALUE = "0xb56d157e7f5a" - -const PROOF = [ - 10, - 126086803, - "0xf90244a006f019ce5f815a48534f1894e0bf2bc479f3624eb3658a5b8b09683210371cffa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0db07d5c7f51b0fabc0ab6abffb98efcac1cb95f63dcae01ea8e73301558f1c94a05ab78472371830bfed304d360240d57e7bee41309297278fd0dcd5b198979a2ea0a9bcb4d6a8f248c15860a40a38c1d965a5c33173226d35eab3cfbb7112bd3532b9010040703482510e004000001884022000202001880a000450400806000144d2210045081100280910224008001040003110004402640012220006200001402020c1000084188008208a3010880940b82000149414030182049548200000208c0001190000281a5406000010100203040900e0311685481c0150002500124808000840000003088c028200010600104840049080d5c08aa14000111090084a2800001210002815123401000011028040260008840010a000000040810410880004804000002308064400c10028860002800840c480040582c3008020040820102901001028010094000110102801088001119000100401828100840080000021280680840783ee938401c9c38083574af28466fbb6df80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301fa63a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", - 0, - [], - "0x0b2c639c533813f4aa9d7837caf62653d097ff85", - "0xf90df4f90211a0844646418cdc472243623a6adf853cf42930ed027c5f2eceff9a2a274f5e9cc3a0ec7c3704cc16a2ace8fce26d2ad0da2fce10b66df732616516228db1d366cb4ea0c2c588c16144825eb7ea05706f6446d2cbffad3da2174cce3ec3a1effe54c803a01b2297c51766932182e29aafdf7dc4b9bf3c5307f0a38ba23b36f8ecd21fc0e2a063d96d72aa3d8c16be960a74f174e75c4e2db021710a8e461502f5146e30faf5a0012f48dd4b043f6f92c33b2d8deda920eb9865100c29b254f08954f09ecdd2f6a094e26fe5bca0e87b4019c815890e10788a637436fda3896d5505298016270182a0baf314b410c021b42295a806f14ce14700e1699dcf7de35a194229cf94954d1da0a7febdeed6c7dde904228dd454626d9427e0a3383e11398d41ccad56ade292b4a0463943e8401fdd6b0352ae228250096cfa8ddc9dfda3d38d4c33e55e17369a14a0a8b2218d9bb0268f2ed74484331ba4ba428d17b65f4d1a06d7f4ebaf9c514d4aa0f9e9916aaabdbacbf2004783d7403a8891c73c9aa468c72ac7e8b09a0f89142da0ff7d643adb489b721f611c0b981d67dae2b63945a1c7ff908d077746d6c1957fa0176c742cd7ddd01391f0863b472f318e91d3227a3357c306cd86a18d30303641a01e767c4d2bed2343988ea284102b234302b0e1ada620d9b9a0d194077dc7f873a0619ddda96da06f24140ddaafb3d5644b6da53041b39aa7dd5dcc3468d9fa445480f90211a0ecb37076729047293de85c6c4a2b13bb62fa4a402c6b1451e9119bf495aca8a0a0433f3f07bc576292134817472d7166183bc4730e837f964e3011b52bbf9b081aa0e9b2b29d4341d3b168d9bb4f4fe000b876a8f55027cbb69c45160d495141f210a04d482eb4f317e703aab85ad2c6990c98145af5f7cc89a7ccd2161f87b791bc01a0e9357b5192820eea672e3194d2020b131f29abe5671c37601633c485358eb421a00a3f410ab91d016cb1716203d732962685a6fc9436862ab83d9fc5109346a041a096e1687da814500097774352c9f49064dac34fe0de9f1848190b5a56fbedcb17a07006adaa8c1b203eab5ee33ea19de791fc8c9cf5cb15ec90d1ef051c9e2ed78aa0468135eecd2271411b5c039c6dce226ee4b251d3e671fea0238347a522241313a045483167728fabead0fa82c604abcf05e0141b1e82d5e94a427b367839985ed4a04c53cd84dd5c5e90d3e4c6bf7583a2d71a5f440e78d2e550c618a9c326ebce64a0f120f7e462069e2b91d3ce0f1e9be2cef10b699399b76e188a710c74b8968432a05a912ef4d4b331e64a4f5ff4a6268ea3bd66c8b823fcb4c3bf7c6e200d302a1ca07aab0db239e967467ed9b3a155ef0a4e8d03d058d44e9e63c39312ad2a986fc8a0afe49319cf159e2916404743d4ef869043fdeb37c79b20fb355a98e8500491f1a04e7bfee55002c5d87331c6d9a9fb394acf87247fc3e26519224e3851bee4c19380f90211a03b31c916b970491c86305379f7e67c97f98166cbc06fade873c5c7d324a7fa81a0d5ff65d687d30b465e3abc81774a9628de5a67f6f318fbbe0641634af53f0d74a098663d761acb23f77146aa5dc3fd4b487a3fec8d25ab2d5408e38e75489dea43a0a26e34fe93e7455b178fde2f89c1c99cfef61cbcb24bdb7ad8041be83ee67846a008662a0a8da5e79b6f4c601197a57ae00377f2f04a0f5edd17e3aed4c4d3777da0c3113823fec10487cde37f5ee2f39a8c72bd0413a21ba763acb5ebf0d40a49b6a044163b2ab486e7f99d831323ece00eb977db78a6594acb26082c5de00943616fa0dcfad53d7bef9f07e520b4b62d7f71620b244d13d06bb964a619f5536e37fa08a09c630785cd49c1b3aa3457999a1047d980392a18bc1d04f7763416ae01489ed6a07a1d5d86308774a7c26ed21faaa58d45efbb2616961a4bbe10d3fc88d99d0bf5a00c58bf78f9f278a3e75d22b39fda0df112a1cb8e05d79c32e5f31b94d4e99f64a070ed09023a65c88badb25edf59f2cab9708edc992ef461534b0e47ce3982ae90a01b690934defb8655cddc75185dd1612c1165ecfdcc8e7a19fdc57cae0f0065e8a054523f7b5547848216144e68b0ccdb1f819bd54ac210c2e4dd5a380edcce33f0a07dd9da455fb24559012c4903166f73f9c5e661b8c88f0bf7de019d73d4c19c89a04478f70fe968b2da1516a8f6b67a6b28011923c34ebecda2f45355e442cbcbbe80f90211a0d5393c3c06c8d597f6f325789484f12da87d807df33096a0af3161e33c44b8b0a0f27d4b26d1822dc04180fe221b3e7cba86c9fc524791c951b6b71c242099ef3ba011d2b20160240582f75dc941e1785643f7652a43d1d62697808657b0a0b8e186a0e9acd52b94dd294c782ad25e727c17934726d62052deac6cd8ffab7cca3e4176a04dcd91b21b8c73a57023c649f7d27cb9443450ee8301f56d4693e667218fcb3ea0630078c69bd028cb16cfccc05feb9f960484ed470f7bc0d1acf25fea5a68de0ca09ee40510308e721235620dc519619981d81e8997c0e7ab5c91f32f1f9ddffdeca0176656e94e76511030173bc6a39fc6fc11078add4c391a6edceb34cc28b7c83fa01cc9e278e51e81a30d6b18410a7411287b95c03d9ec2fd23396f0ada6410d2a8a019a07cd977b76673046b61debf2ce6e54615f5e69e31e17eb0c4dfb316da1cc1a08b8a356d612925d089be937debbdcbe8a40a941bbd07d7fe168cdbe2bfdc2d7fa0ebad3b72886fc350a5aaa24d20d8a143754c92eabab4ee2cba59697e7771cd50a0c24cf965d70417de74ee02b9cfdde3138d434c2cbc0c21006c04cde27a2d9ab7a0f21f4798a55807d429caadba5da04b2d12fc43569e7bc6c4b965976f21643874a0ec71a00e5b53a2f6043ed744c66b7ae5bc6ea1c7d32066014723a7744ad0e446a08b985961a92fed93614049284d0f08665a7a9f1b5dfbb025682a9551f2660f5380f90211a05510ce326198dee0033e6a2b29957f77687221d6f4b9a082f34922f9f589b003a0a6f336170753299b1adc48077e111e425fdc539ff7160a9babf8afdf5b5bef3ea0ad027c813622b3582247847a8537992e0a3f6a50e10c268d0ac8eacd1fd750bba037babb03742053f969204568854a958947fc93bcb978ebc85c83e35c5dc6fdfda07d3c1a847911e962071639472987bf9f0d112c983b393190af796342557a3ac5a07e243717881703400c60ec2fcc05040759a9646b61adb02412c8b0619e3059bda08acbc6de4a6c92f92dde22536a30bbc7bad7d44394e29312ebc9adfcd84ca300a0c558588e6ae83a42eaf44d7215f853262ad725faef6b3c73830e0903a31fefd6a0921f30e12a3b363b2aed7283870304a503f3613d311bae004eb7a922f6fd50f1a013987bb8a564c1513dd7b42682bb7237f51b94ac28780f41ae45a772e13fa76fa0596b2015a656fd4864bf6789cb5d4e4c67cc05114ae3fd7caa8355bd16cb00a7a0dea6e67052bdc0d975f894dbe6b4d7b7474c7bf6f2d0bb9b5298073a5e95a43ca0f532a3b3466a65f1e6e948bd1a9ac5b36bdb0f824609c37046acefb55f76d0b7a0b92f68142fb15ceac6044f289b074c3333e4826a9f02f1469318f2273026339ea0a5f42aa4c2fd149ba3a73028c450d1d3c0c10536bc1421c6e632bd56d63d7565a0156d9f2ce56dfe6e92fe5779b15821b6bae03882935a167a0d3c10e03523f77480f90211a05d176d139f8def1c9dd83692adad161605fdec658eef8bc28afc4da848d97662a0e3d1f706ca6308d1f5e2d4cb6d641ba574b9ad852d6c878f9cec25ba7c8c8183a0f3647cf8efec130e89c09170b6a82a06cf2b9f4b15aff5d2e93d3c8cb5c294f8a071493e91397ece4c52482e3a20656b6780054a56986544555b07f5b053a4d722a0b60b270ab95f7787f4a40d6f68b667126fcb1272ddc0e9347205ebae3069b7d2a0b00e67c2e390212edde83ad1182fc5f373e9f47f11c8c69a04b87d75d0123b15a02f20f6d8f52b12c28ddba6fdca481dcb5a07363ff08758d83f041b2535666b18a03f573e0937a15fa5167802cb25220547e8b6c2194633ad2d2b4e15fa9b2cc8fda0a27b621d4212470161d3a1786d70b24ba6f0ba013677c11e995feebb3f7be72aa0894ac9ee877ef9fc4ea797c33f994996567a17777a57d22050260b18bb994946a09bf44993469f668dadae80170dfb81156b0decb5f7fbceb62980a2508d3f3702a013fc551024f4961a8e4adedb726962975a60ae0553a65f0dd7e266b0ec34f2dca087561bc3f849b47500f1f503a264466616a31a4e7adf3f2b2753b3f8c60444bda0421bcca422a9f02867ab2b0269bad562e8d35bf35bb332a48d3be29b513e4a78a09fe8fdfd9c06692e93cc2f1b277aadebf462a38a28abfaaba33f4d7e4212ed71a0407f10b8182d07c7f9789d469b68926931e184d7afdc20322387db7dd8dd950b80f9011180a0af3e6c1703878fa0f54ce9ef81044131303255beda112c1750bd46e46c17749780808080a0ee3ef4e754b7044fbaf982f80b8ab4ea00503fe3ec4c50fd7864e81ce1e6c4408080a075fb4f68ac224ec54d38eee3bd972654ca5ee1833530f0ebefd71a9f49cf09f1a05c099f09257a656d98101ccd60d3fbe861cb889f9699b8eed136268028021b70a0b90a5365f3205e9df1129eecaa73667c4d2c567f1ab45f63860c3671b46dc27780a0e38b7963499d1bbde43a95289356e98e19cdc1e21e10e097e1490f15e3662e0ba052b569b11cc62b342b35edfd24e3f8c4f9b3ec16930ac8986eefe14e609d073ba052fe3bf973b9ff06f119a91481e15215c3eccadc584ce8b6e7a05ea68c73054180f8669d3d676334b26bbb561def1bb646db346a0ea5f7c4f069e5ce4083818685b846f8440180a0b8f3308b625ddb7bce9e10a6a13d9988d1b865eb09df34844bf6b86b00904ae6a0aad43333d28e146557f1c682e8a4226743fb231fdd00a577512233bd9e920008", - "0xb8f3308b625ddb7bce9e10a6a13d9988d1b865eb09df34844bf6b86b00904ae6", - ["0x000000000000000000000000000000000000000000000000000000000000000b"], - [ - "0xf909acf90211a01922b5f82f07bee421217744ed6d4e95b98852241f24dffa2f5701b1ddb8e6dca03fec17456b28fe0aea41291618b766813d90061104d8731e6e937b0922cae1f6a0fb94b76b2f2c5d4b40890a18b9f0579966eb56274035a58010db113ccbab922fa085b2e52483d7a1448504098bd8b3a0fc68becfe6fcf5e8f7442d08d1c17d9446a0c8b2aa37759feac9aad765fca7545ab9d02015364261d3f35384154e77ef77e9a0bc48fb8581b0926eb1d707cb1668b5ecdf2b1759fb7ed8d440bf1163103bd810a046fe65e822efc9f1b49e43ed4eb7600e9658c306b70a95999aeb0112c9954f9ca03d66c408b9ced8ee40c6281f15e26bb7db314045d5f65322fc1d5e24544b9192a0b26bf58b679aaf2a0a5f5a7fc9507e856f31e01a7ea47d9c5719957e51d99f92a003555409bff0cbb217e5d9fbd7d9e3b46a451e2b3cc0f27b34a3b553634770f7a05f71f83b940082edb3f0afaedd000ae4789a8b459c0befecf0085308961a38f4a0110aca3b49ff8a7fc3d60295d0c18602e576427a02907986d3fcdec5c8406607a0b197a531e48bf6f203d6f8b4088117caaa55d2318177d00a849c9bb9c0be11b5a021c55c465168ceb84725b61988c7c174880c9bccb99510ebffcf715f01344022a0173421253267ac8dacdd78bb3a49e4e68ce44c987335e7e22e2067f5998ccc8ba0ddb9469be4af0c764ae2984533a34b6ac6ad4535a7bf773d1bdcaba414288d4e80f90211a0134f748fc5e8562c4037bb335c253e159c2d3c7a1dc48b1e006fee1ffcc63874a0dcad9ec65f0b0b3e3d265b468ceda4c2626bea957ba6dd0f25e91d8f43615dcba0b8fdad766b78548db43d60da964d1abdd784ae56bd9ad9dd5ce7911beadab941a01db88587d7758f452204d265122d451f416f29219de91d8f1fd98b4695ad56f8a06464403607b9759cf6cb0e1bdd58d3a231ece185267c59d0113836bbce312007a0a23247953c05226318750e90668afd8b8f4a308f1f3e5573f92c03cd4fa9cc99a0ec186ad6ea36e64969fac78982f9ddd2c78f01fb5f059afc8d9253cafb348272a00e259709d156973caac69a52dbde1569f0ea9fc58cc9333b6fff01bed4ced9c3a01f76d216b1d1f75ebdcece38a62dc6d85cf090cec0b17ea8fe4a2fbadf02e418a0a44e06aa48e8e2b81b82ac7a55d10e0e75fb0016475f40b4b2b199016fefef11a04e31f7d98493c4af332a55a088d75bd53a55d37feee0fb4ea4bb89bd6cf1189da01fe39db746e4eef3572d1863d2edf73ef178986a33929a353e30d5a5459cffb7a0c64a8a52d3dfb4c33e5eac53820c25604e4c8f34062e2f31a00ada4c4e8ac794a02b09776c323c5f8fc6b69732fc17e7ac78fb63c9a42243b5b65bb067b05af034a0c371630f7af67645f11a19b70a01e20284fd2c3afa8ad5e72fa939e775090b94a0a2680edf63d1735ee9ce81c2bb867aa6708db5be648b511b2997cf6a82b7b12a80f90211a046660614c4b352e38c7a40b3fbacf123b88d343407c60aa3df2fc14e5c57667ea0f326e8d140b8c178ef04d4af3f9435159ad3c3cc9029a24daced2a2e5a7edadba04beaf51b9e686b2e9a3cb11906ac2c2b975a1f2b21fae6345baa832716d08904a00d9c648844e04c5a20d669382e429a02691b92a9ed51346e9e6b4c3e11950c51a0116e5123177580be67dfd0beaa66ff0aaad0d390afa05246c44dc8de9736c21ea0c566c23ca1b65aec125de0d781343787ae3f1037793af3d12e976ebc26b25d82a0ecc286af188cbb0d2f91980a6547e9c21d31e436f362565998d38063cb8e4a43a0161332b061fd1ae44a9cc9a7ee560b1f416a75f723df1d4607487149f0a6ef98a0ce4de6144c942d8cb5180aad406ac42934f039bafe6a7b1fba6094b104e3ed01a088da9aca558d0c51ce0fb208ab108b143e0a5122bcd5bd85c35e09b39a67a7ada0b24c5e971bdcc7151c89d69c0046c899379fcb9fd479d2b8a05df7348f08e4bda0bdb15b37b990be1e658ede5ed0e556d73fca185489124cad494721bd0c9dc79da0279294696fab46dcb10b5069d1929b96500342e6609fc85b5c242ebfd6dee280a02b3df2dfda83841f27315d0dcd3025dce8ee53425de4ccea153dd8f9893b65d6a07b3b6cb9b2148a7086adc24501672da8b0fc348a1fa78051ebb603f337f68de8a025f98ef38ab7bbaf176f7284ff1548b7638d013f817fd84979061507c4cb3f8080f90211a0817f0522b611763caedae0abdbf8a7d1fc523cc759bc6dd400d8837d94587832a0ecd37fcea2b496aeb18f74786fc7aeda2ea78bfb55cf27a829b69c4d15e2525ca019a27a34379a6a5dcd5a1cb8fdc5b7351b40eeb3f4e7d09db2daaf688e7a11b8a02339835ad35c836c7c9b1fd17f8ef9aa377a9e458316252ac63efe702fd895bda08e96214ae9077f46f6d2a440af91126a5bf62732edd0dc513efadba4b956fe9ea026370016e564a879e26f01a077e73badcca1551a92a05571e86d07af2a049493a0fab6a8b576dbf710ba642f849c36ab54ed462ac0f8e3593ad6d25af4e6f23677a06ed7fc714f359a29a6bd13c1a804fc6a19938f46c377fc97e787706dc8da0e58a0c0d3305cf25baab40da08bb2c141d0984d60afc353c4d0e708fed92fb2239460a057cdd07f66b3a31f01079d3933ee6a4fd5280ba7abec7c9bc1404ccca5224d9aa0ab9e1abf9a0bfd89d1483448ec555a10d7956b434787ae6c55605ce4c3fbb3e5a0d9d5c4782ba8bceaf3887b440321190898df7ce785679dcc628516de02069a17a05565679c56603a5614f90447648485ba6f3e324df4845af69482209fcc620156a09e4205f6a5c8e633cb7e5048148675d7aef4030de17d81e6d8e5a3e5f5b77a8ba0b995d98c91905fa0e083455afe9d4219e4f040c6e3bdf948b139a8d12b192157a05ed2de5e483fa16f32c9d56979082e36c77c1102e12020136172dfed9c85d28880f90131a0d56f8e12a9254f3fab9b7c5cb9e917dbc2540b1fa8e14f22840257d30c47adbfa0bcf412e2dcc182720eb7a6d3b260488603cefcdc206815beeea0b4700adb9e46808080a0ba844e9671269f0a8ab47cd42fc59e9ff5077adfa3c400e243146fcb708f4e5da0d1e9012aff863e29b5c2b7111ed41b55669bc3bd70aafd9302247c9a71176550a03f9b33fa55d938ae9dd41dfed6b17fc52327d20a2503c8e5d85a2f401a0e6ea380a0d4947649b148740ce5687696c87bb07217543329c73f7bb8900f1140b1563f3ca0c41116acc085e1d1b88f0998eacf59cc10a4646e9ffc4428b221c00ec5b1f4cca08c6b7c02a459200f13e8b385d3dcb998ec8f9c03cc1b7c8b3a5e753d5a65364880a09dc8cbc03d181ee816de24c1baeaa398a7b98e5f33e730011505e8496e74fefd808080e79e37a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db98786b56d157e7f5a", - ], -] - -const PROOF_WITH_ANCESTRAL_BLOCKS = [ - 10, - 126086803, - "0xf90244a006f019ce5f815a48534f1894e0bf2bc479f3624eb3658a5b8b09683210371cffa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0db07d5c7f51b0fabc0ab6abffb98efcac1cb95f63dcae01ea8e73301558f1c94a05ab78472371830bfed304d360240d57e7bee41309297278fd0dcd5b198979a2ea0a9bcb4d6a8f248c15860a40a38c1d965a5c33173226d35eab3cfbb7112bd3532b9010040703482510e004000001884022000202001880a000450400806000144d2210045081100280910224008001040003110004402640012220006200001402020c1000084188008208a3010880940b82000149414030182049548200000208c0001190000281a5406000010100203040900e0311685481c0150002500124808000840000003088c028200010600104840049080d5c08aa14000111090084a2800001210002815123401000011028040260008840010a000000040810410880004804000002308064400c10028860002800840c480040582c3008020040820102901001028010094000110102801088001119000100401828100840080000021280680840783ee938401c9c38083574af28466fbb6df80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301fa63a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", - 126086800, - [ - "0xf90244a006f019ce5f815a48534f1894e0bf2bc479f3624eb3658a5b8b09683210371cffa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0db07d5c7f51b0fabc0ab6abffb98efcac1cb95f63dcae01ea8e73301558f1c94a05ab78472371830bfed304d360240d57e7bee41309297278fd0dcd5b198979a2ea0a9bcb4d6a8f248c15860a40a38c1d965a5c33173226d35eab3cfbb7112bd3532b9010040703482510e004000001884022000202001880a000450400806000144d2210045081100280910224008001040003110004402640012220006200001402020c1000084188008208a3010880940b82000149414030182049548200000208c0001190000281a5406000010100203040900e0311685481c0150002500124808000840000003088c028200010600104840049080d5c08aa14000111090084a2800001210002815123401000011028040260008840010a000000040810410880004804000002308064400c10028860002800840c480040582c3008020040820102901001028010094000110102801088001119000100401828100840080000021280680840783ee938401c9c38083574af28466fbb6df80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301fa63a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", - "0xf90244a0bdb13612402a6004f26314e340d25c864e27cbd26d90464c3a3191195698a038a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a016cd64cf4911d99e5413d5740b90cade7def9698cdabf726e8d931bd5967f878a0c622bc1d9430ec4062302efe23cc8127742f8ca8978a7c3b27743124c4b7430ca093be9a83ad2bf4a046bab6c7a9bf877f261238a9b96058936458d61c2ee4587eb90100907030825b420001a40218a688204060400c00280164a0000844000344c42900250810046000040a80400090006023000150144000032208045046c0406642c12a140080000c308a2100a02952a5302110c45008014b201619000101280200039daa43088b44000010115000020008318003460a4008160000000012a80a55184024002300822500582132023801b0041122168080200268002400582a388019821040923023048002811120890846001a8428862081420980800010200028406000120220420008354800060262301028f12000808803168008001aa801201003100c8d20b3002209904049028801c20800010414809a00800088042013101080840783ee928401c9c38083771a9b8466fbb6dd80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f941a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", - "0xf90244a02abeb2f843b0c7e14af20d88b51580260281529864bac81386715d186b188feca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a07f973efd45c15188ca5b64afe8f2a431fc49da885ce3473aca30f18230bd9567a0070547bf249b370121ae7bfcf64c421a91c25b4a694b1982b1f473138d69bb22a057b9a7532db0ead6850099e396471c6ab4b1c1970850d259abe2e1e8f4003d51b90100c401a002c0040080d10018404420012080006908000402002006880044e0011025081804301200210000a0100010380010c1021000122280a4010140406809c822c00088b0290808200008b948a10401148608004108100414000000902800011485010882042204128012a00110480100210002ea0900400b010110010910080800006508800151002142001a08002050001781a82110008000109a2a0885180200000658028e000001010409089600268470040042008020900052a85800806910100200020800130088060882000042c40010038002008100000840046040583cc00902840010209040a1000055011001342c408089400620a08000142c0080840783ee918401c9c3808371781a8466fbb6db80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f846a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", - "0xf90244a012dfd2e2be4bcdd6b79eac25fb75a3fc4d755aa463acfc7ff80f3bf4ec49353aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0e49a1cb205090a958479f62241d3c812164630f09859538b98f20929700832caa0fb422fe08fca21bf0de2f413bee27c3ff3436ea54e32587238ce182d6dc1fb19a0274c2dbc71d835379c18401e3268e7c4f009b670b9a0ddca04743b7b0b65a111b90100005030021000000300001880204000001200020c000020000840000042c009000d08100030000108004000000000210800100442000022082040004040600000000280008008308a4000002850000000008400a02008000000210000000000000000010006040000000011000000889080004000200a00808000001208480908002000010002300060000202010180200100500080000000020000000a1004018a00001001000080300108208000000000000000000000090080408300000040400001020004240028008006004200000805800002880300000000084800200000300009002000000800001000000100000a011010902a00800010040001000080840783ee908401c9c3808335bb028466fbb6d980a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f8dea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", - ], - "0x0b2c639c533813f4aa9d7837caf62653d097ff85", - "0xf90df4f90211a0ae94776f5c237b1e277aa2206301cfcfd3990fef08b60f1acbb7518bd2c353dda0a6dc453d3af2966ec75db38d8b592099cd823972058a68fdfa217788b8307544a04d85ebfc910e05b7de2b9a780dd871d984c36ab0f2c3f38eea8de6adfd1c444da0b5fea1bad6564cade5a31e978195248b2fd67bb195006827d1d61d0d72593f64a0460766bc32f1ce32df10f604758468b2998250732e91dcc43b3e8b185bda669ca0e21dcda48944f76f3d6508ab3d36035cdd82cf3d649f327e78532a62a40376b4a0dba8c95c72743ae2b7bad789e3038040f06f3afbca090b9da364ae39f0b15963a0bca1300f03dcef17a2f614fea6c34eb6a6f0c52f57e7fa15a75860541c671322a06ce72250e0d542a46b25347cada837c6316695108071861dd4b041f4bc56d0dea0f00addb60c5ee291719dfe5d93383380ce0c3a9cf54d27faa70fb3b30d424810a007fbe090c28df1099bc1768e0eefc350701227b351d4b0d434d81673b4867e0ca04e1032bc06c39c9d9ba823088d8ba3106c5018f4ef60765c72b1402c7a7cc5cea0a848e579a56b4c19e92b4a582288f1cf701ffcecfd439fb88c8f40173cabe43ea0d5839de991945ebd86629e32de1de57140de090842f3809bcf4a737bd75c13bea0287235eea51447d1b9b6686381830195568efc908c27092f561b2c65e4113ccda0d902b9642b74f04cf670d6d216c5f03d0d92f2e77c374e3e41c6c6265d8d429980f90211a0d61d720b302bc422f0ece0f3c0e5172f16e8409b6b8bdd15db021284389b28fba0433f3f07bc576292134817472d7166183bc4730e837f964e3011b52bbf9b081aa02906d2af47eb17db297cac9e29381427fee7ebb53d6a914e402535f68c4c7c21a09de01bfc2a3986ed7a00b997b4cb7b55b837a155baa3bfc171efdf1ac31487c7a0e9357b5192820eea672e3194d2020b131f29abe5671c37601633c485358eb421a00a3f410ab91d016cb1716203d732962685a6fc9436862ab83d9fc5109346a041a096e1687da814500097774352c9f49064dac34fe0de9f1848190b5a56fbedcb17a07006adaa8c1b203eab5ee33ea19de791fc8c9cf5cb15ec90d1ef051c9e2ed78aa0468135eecd2271411b5c039c6dce226ee4b251d3e671fea0238347a522241313a045483167728fabead0fa82c604abcf05e0141b1e82d5e94a427b367839985ed4a04c53cd84dd5c5e90d3e4c6bf7583a2d71a5f440e78d2e550c618a9c326ebce64a0f120f7e462069e2b91d3ce0f1e9be2cef10b699399b76e188a710c74b8968432a05a912ef4d4b331e64a4f5ff4a6268ea3bd66c8b823fcb4c3bf7c6e200d302a1ca07aab0db239e967467ed9b3a155ef0a4e8d03d058d44e9e63c39312ad2a986fc8a0afe49319cf159e2916404743d4ef869043fdeb37c79b20fb355a98e8500491f1a024f8f3ea7890564e7c9b344f5493de5f87cfc5e4512c2396a51040cb64d6aba280f90211a03b31c916b970491c86305379f7e67c97f98166cbc06fade873c5c7d324a7fa81a01b01b15dc4b7c66db50809b4236a98a2f05f156dc70a1e00ff7f009784a88173a098663d761acb23f77146aa5dc3fd4b487a3fec8d25ab2d5408e38e75489dea43a0a26e34fe93e7455b178fde2f89c1c99cfef61cbcb24bdb7ad8041be83ee67846a008662a0a8da5e79b6f4c601197a57ae00377f2f04a0f5edd17e3aed4c4d3777da0c3113823fec10487cde37f5ee2f39a8c72bd0413a21ba763acb5ebf0d40a49b6a044163b2ab486e7f99d831323ece00eb977db78a6594acb26082c5de00943616fa026fa7daf50745e3a6dfff87c28840cbb09ddac372d7759b796ea60b775f69f60a09c630785cd49c1b3aa3457999a1047d980392a18bc1d04f7763416ae01489ed6a07a1d5d86308774a7c26ed21faaa58d45efbb2616961a4bbe10d3fc88d99d0bf5a00c58bf78f9f278a3e75d22b39fda0df112a1cb8e05d79c32e5f31b94d4e99f64a070ed09023a65c88badb25edf59f2cab9708edc992ef461534b0e47ce3982ae90a01b690934defb8655cddc75185dd1612c1165ecfdcc8e7a19fdc57cae0f0065e8a054523f7b5547848216144e68b0ccdb1f819bd54ac210c2e4dd5a380edcce33f0a07dd9da455fb24559012c4903166f73f9c5e661b8c88f0bf7de019d73d4c19c89a04478f70fe968b2da1516a8f6b67a6b28011923c34ebecda2f45355e442cbcbbe80f90211a0d5393c3c06c8d597f6f325789484f12da87d807df33096a0af3161e33c44b8b0a0f27d4b26d1822dc04180fe221b3e7cba86c9fc524791c951b6b71c242099ef3ba011d2b20160240582f75dc941e1785643f7652a43d1d62697808657b0a0b8e186a0e9acd52b94dd294c782ad25e727c17934726d62052deac6cd8ffab7cca3e4176a04dcd91b21b8c73a57023c649f7d27cb9443450ee8301f56d4693e667218fcb3ea0630078c69bd028cb16cfccc05feb9f960484ed470f7bc0d1acf25fea5a68de0ca09ee40510308e721235620dc519619981d81e8997c0e7ab5c91f32f1f9ddffdeca0176656e94e76511030173bc6a39fc6fc11078add4c391a6edceb34cc28b7c83fa01cc9e278e51e81a30d6b18410a7411287b95c03d9ec2fd23396f0ada6410d2a8a04060e9e3881260d3fff6981fdabe0861f12fe992e1a2704ff948339ab1ac694ca08b8a356d612925d089be937debbdcbe8a40a941bbd07d7fe168cdbe2bfdc2d7fa0ebad3b72886fc350a5aaa24d20d8a143754c92eabab4ee2cba59697e7771cd50a0c24cf965d70417de74ee02b9cfdde3138d434c2cbc0c21006c04cde27a2d9ab7a0f21f4798a55807d429caadba5da04b2d12fc43569e7bc6c4b965976f21643874a0ec71a00e5b53a2f6043ed744c66b7ae5bc6ea1c7d32066014723a7744ad0e446a08b985961a92fed93614049284d0f08665a7a9f1b5dfbb025682a9551f2660f5380f90211a05510ce326198dee0033e6a2b29957f77687221d6f4b9a082f34922f9f589b003a0a6f336170753299b1adc48077e111e425fdc539ff7160a9babf8afdf5b5bef3ea0ad027c813622b3582247847a8537992e0a3f6a50e10c268d0ac8eacd1fd750bba037babb03742053f969204568854a958947fc93bcb978ebc85c83e35c5dc6fdfda07d3c1a847911e962071639472987bf9f0d112c983b393190af796342557a3ac5a07e243717881703400c60ec2fcc05040759a9646b61adb02412c8b0619e3059bda08acbc6de4a6c92f92dde22536a30bbc7bad7d44394e29312ebc9adfcd84ca300a0c558588e6ae83a42eaf44d7215f853262ad725faef6b3c73830e0903a31fefd6a0921f30e12a3b363b2aed7283870304a503f3613d311bae004eb7a922f6fd50f1a013987bb8a564c1513dd7b42682bb7237f51b94ac28780f41ae45a772e13fa76fa0596b2015a656fd4864bf6789cb5d4e4c67cc05114ae3fd7caa8355bd16cb00a7a0dea6e67052bdc0d975f894dbe6b4d7b7474c7bf6f2d0bb9b5298073a5e95a43ca0f532a3b3466a65f1e6e948bd1a9ac5b36bdb0f824609c37046acefb55f76d0b7a021462b95a644603890bea60588a71a17aac1e830fe290f6d9627f6a0ee173de7a0a5f42aa4c2fd149ba3a73028c450d1d3c0c10536bc1421c6e632bd56d63d7565a0156d9f2ce56dfe6e92fe5779b15821b6bae03882935a167a0d3c10e03523f77480f90211a05d176d139f8def1c9dd83692adad161605fdec658eef8bc28afc4da848d97662a0e3d1f706ca6308d1f5e2d4cb6d641ba574b9ad852d6c878f9cec25ba7c8c8183a0f3647cf8efec130e89c09170b6a82a06cf2b9f4b15aff5d2e93d3c8cb5c294f8a071493e91397ece4c52482e3a20656b6780054a56986544555b07f5b053a4d722a0b60b270ab95f7787f4a40d6f68b667126fcb1272ddc0e9347205ebae3069b7d2a0b00e67c2e390212edde83ad1182fc5f373e9f47f11c8c69a04b87d75d0123b15a02f20f6d8f52b12c28ddba6fdca481dcb5a07363ff08758d83f041b2535666b18a0def25dabbdbebbdfef848073b51725528ae2680f9dc8b2371b52d97e5bce5645a0a27b621d4212470161d3a1786d70b24ba6f0ba013677c11e995feebb3f7be72aa0894ac9ee877ef9fc4ea797c33f994996567a17777a57d22050260b18bb994946a09bf44993469f668dadae80170dfb81156b0decb5f7fbceb62980a2508d3f3702a013fc551024f4961a8e4adedb726962975a60ae0553a65f0dd7e266b0ec34f2dca087561bc3f849b47500f1f503a264466616a31a4e7adf3f2b2753b3f8c60444bda0421bcca422a9f02867ab2b0269bad562e8d35bf35bb332a48d3be29b513e4a78a09fe8fdfd9c06692e93cc2f1b277aadebf462a38a28abfaaba33f4d7e4212ed71a0407f10b8182d07c7f9789d469b68926931e184d7afdc20322387db7dd8dd950b80f9011180a0af3e6c1703878fa0f54ce9ef81044131303255beda112c1750bd46e46c17749780808080a0ee3ef4e754b7044fbaf982f80b8ab4ea00503fe3ec4c50fd7864e81ce1e6c4408080a075fb4f68ac224ec54d38eee3bd972654ca5ee1833530f0ebefd71a9f49cf09f1a05c099f09257a656d98101ccd60d3fbe861cb889f9699b8eed136268028021b70a0b90a5365f3205e9df1129eecaa73667c4d2c567f1ab45f63860c3671b46dc27780a0e38b7963499d1bbde43a95289356e98e19cdc1e21e10e097e1490f15e3662e0ba0ce536ccc69891fc11f58ebaa1a9f09bd1644af223c17493de3fa30e6e39f6845a052fe3bf973b9ff06f119a91481e15215c3eccadc584ce8b6e7a05ea68c73054180f8669d3d676334b26bbb561def1bb646db346a0ea5f7c4f069e5ce4083818685b846f8440180a011a7fd82551848c90631f70de7f85bbc1fb9cce3618351c58eef7d86c6e6535da0aad43333d28e146557f1c682e8a4226743fb231fdd00a577512233bd9e920008", - "0x11a7fd82551848c90631f70de7f85bbc1fb9cce3618351c58eef7d86c6e6535d", - ["0x000000000000000000000000000000000000000000000000000000000000000b"], - [ - "0xf909acf90211a024523ab4c6860ddc65f3ee25893718ba117b0b64fa1a344b7f05424044422180a0ed987ec06cf1e724fb46f50e02e985eb14aa3de446a026be814cd2c240ab7884a01f37fe3602f2e817c85a42347aeb852d144d5df315f7ea19e5b946ec41e7710ca007818b958a696e024231c8bbc1940ab6f624063ae6536e78d4e751ace5ba3654a08a2d4ae213e6cd7da762e2a310a4b416794015af976c0df934700d67dcb6bb7da09b8c976db3807d89073d4ece4a434f2fb407dd7babc3d60557d7a6413397cd12a018ee334d7d36b3ec14e7fbe17cb2cc8827327961e20474b07b2d755fb60472eba086fd6918693e8bfec3a0b0b8963d88cca3bb1ff3f40058dcf5e0b8e12ebda780a08a57aa735f5e901686d294bb6a9f0af015bfa37a14e47df442043c55b29478afa0c5fdbed2d6f87128f683e845163c29abebd0fccc8720261233cd1739d8999bb8a0c667f820b9056acb0650bbb3da4fb5c829bb9ea3d58d65ab8e87cfaf689eb274a0110aca3b49ff8a7fc3d60295d0c18602e576427a02907986d3fcdec5c8406607a0e0a2958a4e2e8eb16e37ad795e02d8ea636266b4ea3f4e064a4da9ef1ee8f47aa076561dfa2df8680a70d7f949548502001363378d71e9102b2dc5f6bb8b48b328a0173421253267ac8dacdd78bb3a49e4e68ce44c987335e7e22e2067f5998ccc8ba0ddb9469be4af0c764ae2984533a34b6ac6ad4535a7bf773d1bdcaba414288d4e80f90211a0134f748fc5e8562c4037bb335c253e159c2d3c7a1dc48b1e006fee1ffcc63874a0dcad9ec65f0b0b3e3d265b468ceda4c2626bea957ba6dd0f25e91d8f43615dcba0b8fdad766b78548db43d60da964d1abdd784ae56bd9ad9dd5ce7911beadab941a01db88587d7758f452204d265122d451f416f29219de91d8f1fd98b4695ad56f8a06464403607b9759cf6cb0e1bdd58d3a231ece185267c59d0113836bbce312007a0a23247953c05226318750e90668afd8b8f4a308f1f3e5573f92c03cd4fa9cc99a0ec186ad6ea36e64969fac78982f9ddd2c78f01fb5f059afc8d9253cafb348272a00e259709d156973caac69a52dbde1569f0ea9fc58cc9333b6fff01bed4ced9c3a01f76d216b1d1f75ebdcece38a62dc6d85cf090cec0b17ea8fe4a2fbadf02e418a0a44e06aa48e8e2b81b82ac7a55d10e0e75fb0016475f40b4b2b199016fefef11a04e31f7d98493c4af332a55a088d75bd53a55d37feee0fb4ea4bb89bd6cf1189da01fe39db746e4eef3572d1863d2edf73ef178986a33929a353e30d5a5459cffb7a0c64a8a52d3dfb4c33e5eac53820c25604e4c8f34062e2f31a00ada4c4e8ac794a0ffc8acff839a16fefe9f3018b315c00a5d49b051bf7be70f35c452103e78dd6fa0c371630f7af67645f11a19b70a01e20284fd2c3afa8ad5e72fa939e775090b94a026173df7a5906e6d3ff8ee4f6467dfb731e50961f6d65546a4e6cd3efeaa509a80f90211a046660614c4b352e38c7a40b3fbacf123b88d343407c60aa3df2fc14e5c57667ea0f326e8d140b8c178ef04d4af3f9435159ad3c3cc9029a24daced2a2e5a7edadba04beaf51b9e686b2e9a3cb11906ac2c2b975a1f2b21fae6345baa832716d08904a00d9c648844e04c5a20d669382e429a02691b92a9ed51346e9e6b4c3e11950c51a0116e5123177580be67dfd0beaa66ff0aaad0d390afa05246c44dc8de9736c21ea0c566c23ca1b65aec125de0d781343787ae3f1037793af3d12e976ebc26b25d82a0ecc286af188cbb0d2f91980a6547e9c21d31e436f362565998d38063cb8e4a43a0161332b061fd1ae44a9cc9a7ee560b1f416a75f723df1d4607487149f0a6ef98a0ce4de6144c942d8cb5180aad406ac42934f039bafe6a7b1fba6094b104e3ed01a088da9aca558d0c51ce0fb208ab108b143e0a5122bcd5bd85c35e09b39a67a7ada0b24c5e971bdcc7151c89d69c0046c899379fcb9fd479d2b8a05df7348f08e4bda0bdb15b37b990be1e658ede5ed0e556d73fca185489124cad494721bd0c9dc79da0279294696fab46dcb10b5069d1929b96500342e6609fc85b5c242ebfd6dee280a02b3df2dfda83841f27315d0dcd3025dce8ee53425de4ccea153dd8f9893b65d6a07b3b6cb9b2148a7086adc24501672da8b0fc348a1fa78051ebb603f337f68de8a025f98ef38ab7bbaf176f7284ff1548b7638d013f817fd84979061507c4cb3f8080f90211a0817f0522b611763caedae0abdbf8a7d1fc523cc759bc6dd400d8837d94587832a0ecd37fcea2b496aeb18f74786fc7aeda2ea78bfb55cf27a829b69c4d15e2525ca019a27a34379a6a5dcd5a1cb8fdc5b7351b40eeb3f4e7d09db2daaf688e7a11b8a02339835ad35c836c7c9b1fd17f8ef9aa377a9e458316252ac63efe702fd895bda08e96214ae9077f46f6d2a440af91126a5bf62732edd0dc513efadba4b956fe9ea026370016e564a879e26f01a077e73badcca1551a92a05571e86d07af2a049493a0fab6a8b576dbf710ba642f849c36ab54ed462ac0f8e3593ad6d25af4e6f23677a06ed7fc714f359a29a6bd13c1a804fc6a19938f46c377fc97e787706dc8da0e58a0c0d3305cf25baab40da08bb2c141d0984d60afc353c4d0e708fed92fb2239460a057cdd07f66b3a31f01079d3933ee6a4fd5280ba7abec7c9bc1404ccca5224d9aa0ab9e1abf9a0bfd89d1483448ec555a10d7956b434787ae6c55605ce4c3fbb3e5a0d9d5c4782ba8bceaf3887b440321190898df7ce785679dcc628516de02069a17a05565679c56603a5614f90447648485ba6f3e324df4845af69482209fcc620156a09e4205f6a5c8e633cb7e5048148675d7aef4030de17d81e6d8e5a3e5f5b77a8ba0b995d98c91905fa0e083455afe9d4219e4f040c6e3bdf948b139a8d12b192157a05ed2de5e483fa16f32c9d56979082e36c77c1102e12020136172dfed9c85d28880f90131a0d56f8e12a9254f3fab9b7c5cb9e917dbc2540b1fa8e14f22840257d30c47adbfa0bcf412e2dcc182720eb7a6d3b260488603cefcdc206815beeea0b4700adb9e46808080a0ba844e9671269f0a8ab47cd42fc59e9ff5077adfa3c400e243146fcb708f4e5da0d1e9012aff863e29b5c2b7111ed41b55669bc3bd70aafd9302247c9a71176550a03f9b33fa55d938ae9dd41dfed6b17fc52327d20a2503c8e5d85a2f401a0e6ea380a0d4947649b148740ce5687696c87bb07217543329c73f7bb8900f1140b1563f3ca0c41116acc085e1d1b88f0998eacf59cc10a4646e9ffc4428b221c00ec5b1f4cca08c6b7c02a459200f13e8b385d3dcb998ec8f9c03cc1b7c8b3a5e753d5a65364880a09dc8cbc03d181ee816de24c1baeaa398a7b98e5f33e730011505e8496e74fefd808080e79e37a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db98786b56d157e7f5a", - ], -] let hashi: Contract, adapter: Contract, hashiProverTest: Contract, shoyuBashi: Contract, owner: SignerWithAddress @@ -64,43 +33,163 @@ describe("HashiProver", () => { }) it("should't be able to get the value if the block is not available", async () => { - await expect(hashiProverTest.getValue(PROOF)).to.be.revertedWithCustomError(shoyuBashi, "ThresholdNotMet") + await expect(hashiProverTest.getStorageValue(ACCOUNT_AND_STORAGE_PROOF)).to.be.revertedWithCustomError( + shoyuBashi, + "ThresholdNotMet", + ) + }) + + it("should't be able to get the value if the account proof is invalid", async () => { + const sourceChainId = ACCOUNT_AND_STORAGE_PROOF[0] + const blockNumber = ACCOUNT_AND_STORAGE_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0xf72ab984efa166b226dcb589bc445afeb8e666f789173a32de6d04108ac5cb8c"], + ) + const wrongProof = [...ACCOUNT_AND_STORAGE_PROOF] + wrongProof[6] = [ + "0xf90211a0ae94776f5c237b1e277aa2206301cfcfd3990fef08b60f1acbb7518bd2c353dda0a6dc453d3af2966ec75db38d8b592099cd823972058a68fdfa217788b8307544a04d85ebfc910e05b7de2b9a780dd871d984c36ab0f2c3f38eea8de6adfd1c444da0b5fea1bad6564cade5a31e978195248b2fd67bb195006827d1d61d0d72593f64a0460766bc32f1ce32df10f604758468b2998250732e91dcc43b3e8b185bda669ca0e21dcda48944f76f3d6508ab3d36035cdd82cf3d649f327e78532a62a40376b4a0dba8c95c72743ae2b7bad789e3038040f06f3afbca090b9da364ae39f0b15963a0bca1300f03dcef17a2f614fea6c34eb6a6f0c52f57e7fa15a75860541c671322a06ce72250e0d542a46b25347cada837c6316695108071861dd4b041f4bc56d0dea0f00addb60c5ee291719dfe5d93383380ce0c3a9cf54d27faa70fb3b30d424810a007fbe090c28df1099bc1768e0eefc350701227b351d4b0d434d81673b4867e0ca04e1032bc06c39c9d9ba823088d8ba3106c5018f4ef60765c72b1402c7a7cc5cea0a848e579a56b4c19e92b4a582288f1cf701ffcecfd439fb88c8f40173cabe43ea0d5839de991945ebd86629e32de1de57140de090842f3809bcf4a737bd75c13bea0287235eea51447d1b9b6686381830195568efc908c27092f561b2c65e4113ccda0d902b9642b74f04cf670d6d216c5f03d0d92f2e77c374e3e41c6c6265d8d429980", + "0xf90211a0d61d720b302bc422f0ece0f3c0e5172f16e8409b6b8bdd15db021284389b28fba0433f3f07bc576292134817472d7166183bc4730e837f964e3011b52bbf9b081aa02906d2af47eb17db297cac9e29381427fee7ebb53d6a914e402535f68c4c7c21a09de01bfc2a3986ed7a00b997b4cb7b55b837a155baa3bfc171efdf1ac31487c7a0e9357b5192820eea672e3194d2020b131f29abe5671c37601633c485358eb421a00a3f410ab91d016cb1716203d732962685a6fc9436862ab83d9fc5109346a041a096e1687da814500097774352c9f49064dac34fe0de9f1848190b5a56fbedcb17a07006adaa8c1b203eab5ee33ea19de791fc8c9cf5cb15ec90d1ef051c9e2ed78aa0468135eecd2271411b5c039c6dce226ee4b251d3e671fea0238347a522241313a045483167728fabead0fa82c604abcf05e0141b1e82d5e94a427b367839985ed4a04c53cd84dd5c5e90d3e4c6bf7583a2d71a5f440e78d2e550c618a9c326ebce64a0f120f7e462069e2b91d3ce0f1e9be2cef10b699399b76e188a710c74b8968432a05a912ef4d4b331e64a4f5ff4a6268ea3bd66c8b823fcb4c3bf7c6e200d302a1ca07aab0db239e967467ed9b3a155ef0a4e8d03d058d44e9e63c39312ad2a986fc8a0afe49319cf159e2916404743d4ef869043fdeb37c79b20fb355a98e8500491f1a024f8f3ea7890564e7c9b344f5493de5f87cfc5e4512c2396a51040cb64d6aba280", + "0xf90211a03b31c916b970491c86305379f7e67c97f98166cbc06fade873c5c7d324a7fa81a01b01b15dc4b7c66db50809b4236a98a2f05f156dc70a1e00ff7f009784a88173a098663d761acb23f77146aa5dc3fd4b487a3fec8d25ab2d5408e38e75489dea43a0a26e34fe93e7455b178fde2f89c1c99cfef61cbcb24bdb7ad8041be83ee67846a008662a0a8da5e79b6f4c601197a57ae00377f2f04a0f5edd17e3aed4c4d3777da0c3113823fec10487cde37f5ee2f39a8c72bd0413a21ba763acb5ebf0d40a49b6a044163b2ab486e7f99d831323ece00eb977db78a6594acb26082c5de00943616fa026fa7daf50745e3a6dfff87c28840cbb09ddac372d7759b796ea60b775f69f60a09c630785cd49c1b3aa3457999a1047d980392a18bc1d04f7763416ae01489ed6a07a1d5d86308774a7c26ed21faaa58d45efbb2616961a4bbe10d3fc88d99d0bf5a00c58bf78f9f278a3e75d22b39fda0df112a1cb8e05d79c32e5f31b94d4e99f64a070ed09023a65c88badb25edf59f2cab9708edc992ef461534b0e47ce3982ae90a01b690934defb8655cddc75185dd1612c1165ecfdcc8e7a19fdc57cae0f0065e8a054523f7b5547848216144e68b0ccdb1f819bd54ac210c2e4dd5a380edcce33f0a07dd9da455fb24559012c4903166f73f9c5e661b8c88f0bf7de019d73d4c19c89a04478f70fe968b2da1516a8f6b67a6b28011923c34ebecda2f45355e442cbcbbe80", + "0xf90211a0d5393c3c06c8d597f6f325789484f12da87d807df33096a0af3161e33c44b8b0a0f27d4b26d1822dc04180fe221b3e7cba86c9fc524791c951b6b71c242099ef3ba011d2b20160240582f75dc941e1785643f7652a43d1d62697808657b0a0b8e186a0e9acd52b94dd294c782ad25e727c17934726d62052deac6cd8ffab7cca3e4176a04dcd91b21b8c73a57023c649f7d27cb9443450ee8301f56d4693e667218fcb3ea0630078c69bd028cb16cfccc05feb9f960484ed470f7bc0d1acf25fea5a68de0ca09ee40510308e721235620dc519619981d81e8997c0e7ab5c91f32f1f9ddffdeca0176656e94e76511030173bc6a39fc6fc11078add4c391a6edceb34cc28b7c83fa01cc9e278e51e81a30d6b18410a7411287b95c03d9ec2fd23396f0ada6410d2a8a04060e9e3881260d3fff6981fdabe0861f12fe992e1a2704ff948339ab1ac694ca08b8a356d612925d089be937debbdcbe8a40a941bbd07d7fe168cdbe2bfdc2d7fa0ebad3b72886fc350a5aaa24d20d8a143754c92eabab4ee2cba59697e7771cd50a0c24cf965d70417de74ee02b9cfdde3138d434c2cbc0c21006c04cde27a2d9ab7a0f21f4798a55807d429caadba5da04b2d12fc43569e7bc6c4b965976f21643874a0ec71a00e5b53a2f6043ed744c66b7ae5bc6ea1c7d32066014723a7744ad0e446a08b985961a92fed93614049284d0f08665a7a9f1b5dfbb025682a9551f2660f5380", + "0xf90211a05510ce326198dee0033e6a2b29957f77687221d6f4b9a082f34922f9f589b003a0a6f336170753299b1adc48077e111e425fdc539ff7160a9babf8afdf5b5bef3ea0ad027c813622b3582247847a8537992e0a3f6a50e10c268d0ac8eacd1fd750bba037babb03742053f969204568854a958947fc93bcb978ebc85c83e35c5dc6fdfda07d3c1a847911e962071639472987bf9f0d112c983b393190af796342557a3ac5a07e243717881703400c60ec2fcc05040759a9646b61adb02412c8b0619e3059bda08acbc6de4a6c92f92dde22536a30bbc7bad7d44394e29312ebc9adfcd84ca300a0c558588e6ae83a42eaf44d7215f853262ad725faef6b3c73830e0903a31fefd6a0921f30e12a3b363b2aed7283870304a503f3613d311bae004eb7a922f6fd50f1a013987bb8a564c1513dd7b42682bb7237f51b94ac28780f41ae45a772e13fa76fa0596b2015a656fd4864bf6789cb5d4e4c67cc05114ae3fd7caa8355bd16cb00a7a0dea6e67052bdc0d975f894dbe6b4d7b7474c7bf6f2d0bb9b5298073a5e95a43ca0f532a3b3466a65f1e6e948bd1a9ac5b36bdb0f824609c37046acefb55f76d0b7a021462b95a644603890bea60588a71a17aac1e830fe290f6d9627f6a0ee173de7a0a5f42aa4c2fd149ba3a73028c450d1d3c0c10536bc1421c6e632bd56d63d7565a0156d9f2ce56dfe6e92fe5779b15821b6bae03882935a167a0d3c10e03523f77480", + "0xf90211a05d176d139f8def1c9dd83692adad161605fdec658eef8bc28afc4da848d97662a0e3d1f706ca6308d1f5e2d4cb6d641ba574b9ad852d6c878f9cec25ba7c8c8183a0f3647cf8efec130e89c09170b6a82a06cf2b9f4b15aff5d2e93d3c8cb5c294f8a071493e91397ece4c52482e3a20656b6780054a56986544555b07f5b053a4d722a0b60b270ab95f7787f4a40d6f68b667126fcb1272ddc0e9347205ebae3069b7d2a0b00e67c2e390212edde83ad1182fc5f373e9f47f11c8c69a04b87d75d0123b15a02f20f6d8f52b12c28ddba6fdca481dcb5a07363ff08758d83f041b2535666b18a0def25dabbdbebbdfef848073b51725528ae2680f9dc8b2371b52d97e5bce5645a0a27b621d4212470161d3a1786d70b24ba6f0ba013677c11e995feebb3f7be72aa0894ac9ee877ef9fc4ea797c33f994996567a17777a57d22050260b18bb994946a09bf44993469f668dadae80170dfb81156b0decb5f7fbceb62980a2508d3f3702a013fc551024f4961a8e4adedb726962975a60ae0553a65f0dd7e266b0ec34f2dca087561bc3f849b47500f1f503a264466616a31a4e7adf3f2b2753b3f8c60444bda0421bcca422a9f02867ab2b0269bad562e8d35bf35bb332a48d3be29b513e4a78a09fe8fdfd9c06692e93cc2f1b277aadebf462a38a28abfaaba33f4d7e4212ed71a0407f10b8182d07c7f9789d469b68926931e184d7afdc20322387db7dd8dd950b80", + "0xf9011180a0af3e6c1703878fa0f54ce9ef81044131303255beda112c1750bd46e46c17749780808080a0ee3ef4e754b7044fbaf982f80b8ab4ea00503fe3ec4c50fd7864e81ce1e6c4408080a075fb4f68ac224ec54d38eee3bd972654ca5ee1833530f0ebefd71a9f49cf09f1a05c099f09257a656d98101ccd60d3fbe861cb889f9699b8eed136268028021b70a0b90a5365f3205e9df1129eecaa73667c4d2c567f1ab45f63860c3671b46dc27780a0e38b7963499d1bbde43a95289356e98e19cdc1e21e10e097e1490f15e3662e0ba0ce536ccc69891fc11f58ebaa1a9f09bd1644af223c17493de3fa30e6e39f6845a052fe3bf973b9ff06f119a91481e15215c3eccadc584ce8b6e7a05ea68c73054180", + "0xf8669d3d676334b26bbb561def1bb646db346a0ea5f7c4f069e5ce4083818685b846f8440180a011a7fd82551848c90631f70de7f85bbc1fb9cce3618351c58eef7d86c6e6535da0aad43333d28e146557f1c682e8a4226743fb231fdd00a577512233bd9e921111", + ] + await expect(hashiProverTest.getStorageValue(wrongProof)).to.be.revertedWith("MerkleTrie: invalid root hash") + }) + + it("should't be able to get the value if the storage proof is invalid", async () => { + const sourceChainId = ACCOUNT_AND_STORAGE_PROOF[0] + const blockNumber = ACCOUNT_AND_STORAGE_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0xf72ab984efa166b226dcb589bc445afeb8e666f789173a32de6d04108ac5cb8c"], + ) + const wrongProof = [...ACCOUNT_AND_STORAGE_PROOF] + wrongProof[9] = [ + [ + "0xf90211a01922b5f82f07bee421217744ed6d4e95b98852241f24dffa2f5701b1ddb8e6dca03fec17456b28fe0aea41291618b766813d90061104d8731e6e937b0922cae1f6a0fb94b76b2f2c5d4b40890a18b9f0579966eb56274035a58010db113ccbab922fa085b2e52483d7a1448504098bd8b3a0fc68becfe6fcf5e8f7442d08d1c17d9446a0c8b2aa37759feac9aad765fca7545ab9d02015364261d3f35384154e77ef77e9a0bc48fb8581b0926eb1d707cb1668b5ecdf2b1759fb7ed8d440bf1163103bd810a046fe65e822efc9f1b49e43ed4eb7600e9658c306b70a95999aeb0112c9954f9ca03d66c408b9ced8ee40c6281f15e26bb7db314045d5f65322fc1d5e24544b9192a0b26bf58b679aaf2a0a5f5a7fc9507e856f31e01a7ea47d9c5719957e51d99f92a003555409bff0cbb217e5d9fbd7d9e3b46a451e2b3cc0f27b34a3b553634770f7a05f71f83b940082edb3f0afaedd000ae4789a8b459c0befecf0085308961a38f4a0110aca3b49ff8a7fc3d60295d0c18602e576427a02907986d3fcdec5c8406607a0b197a531e48bf6f203d6f8b4088117caaa55d2318177d00a849c9bb9c0be11b5a021c55c465168ceb84725b61988c7c174880c9bccb99510ebffcf715f01344022a0173421253267ac8dacdd78bb3a49e4e68ce44c987335e7e22e2067f5998ccc8ba0ddb9469be4af0c764ae2984533a34b6ac6ad4535a7bf773d1bdcaba414288d4e80", + "0xf90211a0134f748fc5e8562c4037bb335c253e159c2d3c7a1dc48b1e006fee1ffcc63874a0dcad9ec65f0b0b3e3d265b468ceda4c2626bea957ba6dd0f25e91d8f43615dcba0b8fdad766b78548db43d60da964d1abdd784ae56bd9ad9dd5ce7911beadab941a01db88587d7758f452204d265122d451f416f29219de91d8f1fd98b4695ad56f8a06464403607b9759cf6cb0e1bdd58d3a231ece185267c59d0113836bbce312007a0a23247953c05226318750e90668afd8b8f4a308f1f3e5573f92c03cd4fa9cc99a0ec186ad6ea36e64969fac78982f9ddd2c78f01fb5f059afc8d9253cafb348272a00e259709d156973caac69a52dbde1569f0ea9fc58cc9333b6fff01bed4ced9c3a01f76d216b1d1f75ebdcece38a62dc6d85cf090cec0b17ea8fe4a2fbadf02e418a0a44e06aa48e8e2b81b82ac7a55d10e0e75fb0016475f40b4b2b199016fefef11a04e31f7d98493c4af332a55a088d75bd53a55d37feee0fb4ea4bb89bd6cf1189da01fe39db746e4eef3572d1863d2edf73ef178986a33929a353e30d5a5459cffb7a0c64a8a52d3dfb4c33e5eac53820c25604e4c8f34062e2f31a00ada4c4e8ac794a02b09776c323c5f8fc6b69732fc17e7ac78fb63c9a42243b5b65bb067b05af034a0c371630f7af67645f11a19b70a01e20284fd2c3afa8ad5e72fa939e775090b94a0a2680edf63d1735ee9ce81c2bb867aa6708db5be648b511b2997cf6a82b7b12a80", + "0xf90211a046660614c4b352e38c7a40b3fbacf123b88d343407c60aa3df2fc14e5c57667ea0f326e8d140b8c178ef04d4af3f9435159ad3c3cc9029a24daced2a2e5a7edadba04beaf51b9e686b2e9a3cb11906ac2c2b975a1f2b21fae6345baa832716d08904a00d9c648844e04c5a20d669382e429a02691b92a9ed51346e9e6b4c3e11950c51a0116e5123177580be67dfd0beaa66ff0aaad0d390afa05246c44dc8de9736c21ea0c566c23ca1b65aec125de0d781343787ae3f1037793af3d12e976ebc26b25d82a0ecc286af188cbb0d2f91980a6547e9c21d31e436f362565998d38063cb8e4a43a0161332b061fd1ae44a9cc9a7ee560b1f416a75f723df1d4607487149f0a6ef98a0ce4de6144c942d8cb5180aad406ac42934f039bafe6a7b1fba6094b104e3ed01a088da9aca558d0c51ce0fb208ab108b143e0a5122bcd5bd85c35e09b39a67a7ada0b24c5e971bdcc7151c89d69c0046c899379fcb9fd479d2b8a05df7348f08e4bda0bdb15b37b990be1e658ede5ed0e556d73fca185489124cad494721bd0c9dc79da0279294696fab46dcb10b5069d1929b96500342e6609fc85b5c242ebfd6dee280a02b3df2dfda83841f27315d0dcd3025dce8ee53425de4ccea153dd8f9893b65d6a07b3b6cb9b2148a7086adc24501672da8b0fc348a1fa78051ebb603f337f68de8a025f98ef38ab7bbaf176f7284ff1548b7638d013f817fd84979061507c4cb3f8080", + "0xf90211a0817f0522b611763caedae0abdbf8a7d1fc523cc759bc6dd400d8837d94587832a0ecd37fcea2b496aeb18f74786fc7aeda2ea78bfb55cf27a829b69c4d15e2525ca019a27a34379a6a5dcd5a1cb8fdc5b7351b40eeb3f4e7d09db2daaf688e7a11b8a02339835ad35c836c7c9b1fd17f8ef9aa377a9e458316252ac63efe702fd895bda08e96214ae9077f46f6d2a440af91126a5bf62732edd0dc513efadba4b956fe9ea026370016e564a879e26f01a077e73badcca1551a92a05571e86d07af2a049493a0fab6a8b576dbf710ba642f849c36ab54ed462ac0f8e3593ad6d25af4e6f23677a06ed7fc714f359a29a6bd13c1a804fc6a19938f46c377fc97e787706dc8da0e58a0c0d3305cf25baab40da08bb2c141d0984d60afc353c4d0e708fed92fb2239460a057cdd07f66b3a31f01079d3933ee6a4fd5280ba7abec7c9bc1404ccca5224d9aa0ab9e1abf9a0bfd89d1483448ec555a10d7956b434787ae6c55605ce4c3fbb3e5a0d9d5c4782ba8bceaf3887b440321190898df7ce785679dcc628516de02069a17a05565679c56603a5614f90447648485ba6f3e324df4845af69482209fcc620156a09e4205f6a5c8e633cb7e5048148675d7aef4030de17d81e6d8e5a3e5f5b77a8ba0b995d98c91905fa0e083455afe9d4219e4f040c6e3bdf948b139a8d12b192157a05ed2de5e483fa16f32c9d56979082e36c77c1102e12020136172dfed9c85d28880", + "0xf90131a0d56f8e12a9254f3fab9b7c5cb9e917dbc2540b1fa8e14f22840257d30c47adbfa0bcf412e2dcc182720eb7a6d3b260488603cefcdc206815beeea0b4700adb9e46808080a0ba844e9671269f0a8ab47cd42fc59e9ff5077adfa3c400e243146fcb708f4e5da0d1e9012aff863e29b5c2b7111ed41b55669bc3bd70aafd9302247c9a71176550a03f9b33fa55d938ae9dd41dfed6b17fc52327d20a2503c8e5d85a2f401a0e6ea380a0d4947649b148740ce5687696c87bb07217543329c73f7bb8900f1140b1563f3ca0c41116acc085e1d1b88f0998eacf59cc10a4646e9ffc4428b221c00ec5b1f4cca08c6b7c02a459200f13e8b385d3dcb998ec8f9c03cc1b7c8b3a5e753d5a65364880a09dc8cbc03d181ee816de24c1baeaa398a7b98e5f33e730011505e8496e74fefd808080", + "0xe79e37a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db98786b56d157e7f5b", + ], + ] + await expect(hashiProverTest.getStorageValue(wrongProof)).to.be.revertedWith( + "MerkleTrie: invalid large internal hash", + ) }) - it("should be able to get the value", async () => { - await adapter.setHashes(SOURCE_CHAIN_ID, [BLOCK_NUMBER], [BLOCK_HEADER_HASH]) - expect(await hashiProverTest.getValue(PROOF)).to.be.deep.eq(["0xb56d157e7f5a"]) + it("should be able to get the value when account and storage proof is valid", async () => { + const sourceChainId = ACCOUNT_AND_STORAGE_PROOF[0] + const blockNumber = ACCOUNT_AND_STORAGE_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0xf72ab984efa166b226dcb589bc445afeb8e666f789173a32de6d04108ac5cb8c"], + ) + expect(await hashiProverTest.getStorageValue(ACCOUNT_AND_STORAGE_PROOF)).to.be.deep.eq(["0xb56d157e7f5a"]) }) it("should be able to get the value using ancestral blocks", async () => { - await adapter.setHashes(SOURCE_CHAIN_ID, [BLOCK_NUMBER], [BLOCK_HEADER_HASH]) - expect(await hashiProverTest.getValue(PROOF_WITH_ANCESTRAL_BLOCKS)).to.be.deep.eq(["0xb56d157e7f5a"]) + const sourceChainId = ACCOUNT_AND_STORAGE_PROOF[0] + const blockNumber = ACCOUNT_AND_STORAGE_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0xf72ab984efa166b226dcb589bc445afeb8e666f789173a32de6d04108ac5cb8c"], + ) + expect(await hashiProverTest.getStorageValue(ACCOUNT_AND_STORAGE_PROOF_WITH_ANCESTRAL_BLOCKS)).to.be.deep.eq([ + "0xb56d157e7f5a", + ]) }) - it("should not be able to get the value using ancestral blocks because the length is reached without finding the block", async () => { - const wrongProof = [...PROOF_WITH_ANCESTRAL_BLOCKS] - wrongProof[4] = [ - "0xf90256a06f14ee388c6004c9f591c05cc94509906ebcc57e6ce9d7e65c52aa7da6f530e7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479495222290dd7278aa3ddd389cc1e1d165cc4bafe5a07604903f485d83bda3b1333e28dec61ff3191fef0423ffce44abe02033b323d3a09c6967c2262b8e5aaf07f422806fa22eed9bd05898a71ef3435eb27e258ed240a061cf3a1b00a7ea8e1b8e4a921dbd9af3c73e9ec8646e9884b7936b74e011e05ab901005d61447fd94d1ba8d69022f0b7891c8486f9ae204a03b3b61bbbc905e371ecd613dfbe02ad85113252082314a8e78d016af918d9afd27030b5b7e890842a2f8058103e8c1640a87cd82c733d21e13afc3ce5e133ddd7fd3180a816dc8bfeeaa516555f3bf2545536b6605c1ea8276edf7d076e9346d88e37e24372bec69daa45caa8fe68c4c5edccefefbf60abaa9abee6106cf1dd25dc4fff490c7bf4b1f47993d733a25880a8170f165ed3bb283d69644fb677d0fd763a07218f66249961719ff37e762cf33f76036277f9c2d9e3d5a2a0b6b70cbfbd548a717143e29e3ef4a0f9b17f9f37bc546d06e5d23e02b3c64e2e542f026cf1d4391ccdf19400dc6d8084013d48a48401c9c3808401476c588466edbad78f6265617665726275696c642e6f7267a00b4078ca7a27f9b2448fa3f32e04a269353f80273e6dc95153458475a84238b98800000000000000008502d39a9e8ea00a7c969c5cab15361767d22966b8c0e507572acd096d3bc87af306be3ceb52138080a077f861b303ce5dd4bd241707d60a82406df608caa18ec241e33b5d5a2de94bc2", - "0xf90257a034c4cec5ba48eef207f01dace9b74648f75423b99274d285eb51a28ea45a7746a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941f9090aae28b8a3dceadf281b0f12828e676c326a017cb8d562b6da86b898d1579f2c0252ca4fc673ddbece39b0181fe6341dbfbb1a0ae9cf403fc193494aabb363f25427aa1adfe15793abe5765d28b0b1537e0900ba0b950d9ad9c7de4e5bd031c14c6d3afd38f1639e1db56590c6abafacae1e8be9bb9010055b5d41511013102900308208e003834d0c002308b480102a0a90901861621a7664ca1054060d40153aa1b99d74229a5c69380c489626d9027c9635a8d3ba580ed1ddc2810e5ef3f788ac929c12470b06160a08901404f2232ac9d42d9fa0785854040174adb01b6a3dd900ac9098e9d842ee6f52e148f0aba80cab721886001aa28bbd6804c7783a158856d63745f924614c4e1cd398c2a6525247746f4116aeb2021e09a52a018635202c32e2dce22379b9d05caf5986b252e4e0c401a11595d31264220a8210f01132022d6695481a4a02847113ce09583c7220200c6603891f33e680597a840000416a199101be82c29d000738c21d03c3b99150db214078084013d48a38401c9c38083b3f8218466edbacb917273796e632d6275696c6465722e78797aa034169fa758cb3cb5d38e8c22af9b88c525474253da05ca76b683f0c6ef922cee8800000000000000008502e776c769a01c91a492ffa0281242fdcb78078b290d5b055505d1872498d611f8cf295496818080a0686d3a40a3dd6df623831fd87b3c54877f9717001c997f9f9e1758c864df5634", + it("should be able to get the value using even you submit a valid chain of ancestral blocks and and the selected one is in the middle of the chain", async () => { + const correctProof = [...ACCOUNT_AND_STORAGE_PROOF_WITH_ANCESTRAL_BLOCKS] + correctProof[4] = [ + "0xf90244a006f019ce5f815a48534f1894e0bf2bc479f3624eb3658a5b8b09683210371cffa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0db07d5c7f51b0fabc0ab6abffb98efcac1cb95f63dcae01ea8e73301558f1c94a05ab78472371830bfed304d360240d57e7bee41309297278fd0dcd5b198979a2ea0a9bcb4d6a8f248c15860a40a38c1d965a5c33173226d35eab3cfbb7112bd3532b9010040703482510e004000001884022000202001880a000450400806000144d2210045081100280910224008001040003110004402640012220006200001402020c1000084188008208a3010880940b82000149414030182049548200000208c0001190000281a5406000010100203040900e0311685481c0150002500124808000840000003088c028200010600104840049080d5c08aa14000111090084a2800001210002815123401000011028040260008840010a000000040810410880004804000002308064400c10028860002800840c480040582c3008020040820102901001028010094000110102801088001119000100401828100840080000021280680840783ee938401c9c38083574af28466fbb6df80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301fa63a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + "0xf90244a0bdb13612402a6004f26314e340d25c864e27cbd26d90464c3a3191195698a038a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a016cd64cf4911d99e5413d5740b90cade7def9698cdabf726e8d931bd5967f878a0c622bc1d9430ec4062302efe23cc8127742f8ca8978a7c3b27743124c4b7430ca093be9a83ad2bf4a046bab6c7a9bf877f261238a9b96058936458d61c2ee4587eb90100907030825b420001a40218a688204060400c00280164a0000844000344c42900250810046000040a80400090006023000150144000032208045046c0406642c12a140080000c308a2100a02952a5302110c45008014b201619000101280200039daa43088b44000010115000020008318003460a4008160000000012a80a55184024002300822500582132023801b0041122168080200268002400582a388019821040923023048002811120890846001a8428862081420980800010200028406000120220420008354800060262301028f12000808803168008001aa801201003100c8d20b3002209904049028801c20800010414809a00800088042013101080840783ee928401c9c38083771a9b8466fbb6dd80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f941a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + "0xf90244a02abeb2f843b0c7e14af20d88b51580260281529864bac81386715d186b188feca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a07f973efd45c15188ca5b64afe8f2a431fc49da885ce3473aca30f18230bd9567a0070547bf249b370121ae7bfcf64c421a91c25b4a694b1982b1f473138d69bb22a057b9a7532db0ead6850099e396471c6ab4b1c1970850d259abe2e1e8f4003d51b90100c401a002c0040080d10018404420012080006908000402002006880044e0011025081804301200210000a0100010380010c1021000122280a4010140406809c822c00088b0290808200008b948a10401148608004108100414000000902800011485010882042204128012a00110480100210002ea0900400b010110010910080800006508800151002142001a08002050001781a82110008000109a2a0885180200000658028e000001010409089600268470040042008020900052a85800806910100200020800130088060882000042c40010038002008100000840046040583cc00902840010209040a1000055011001342c408089400620a08000142c0080840783ee918401c9c3808371781a8466fbb6db80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f846a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + "0xf90244a012dfd2e2be4bcdd6b79eac25fb75a3fc4d755aa463acfc7ff80f3bf4ec49353aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0e49a1cb205090a958479f62241d3c812164630f09859538b98f20929700832caa0fb422fe08fca21bf0de2f413bee27c3ff3436ea54e32587238ce182d6dc1fb19a0274c2dbc71d835379c18401e3268e7c4f009b670b9a0ddca04743b7b0b65a111b90100005030021000000300001880204000001200020c000020000840000042c009000d08100030000108004000000000210800100442000022082040004040600000000280008008308a4000002850000000008400a02008000000210000000000000000010006040000000011000000889080004000200a00808000001208480908002000010002300060000202010180200100500080000000020000000a1004018a00001001000080300108208000000000000000000000090080408300000040400001020004240028008006004200000805800002880300000000084800200000300009002000000800001000000100000a011010902a00800010040001000080840783ee908401c9c3808335bb028466fbb6d980a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f8dea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + "0xf90244a0186b3f6370955f23ec37702b09582d6425ddfda544cb413ac327ef7f572f5b56a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0a6c0e65d726f0bfd262c65adafef031343d8950aed130b5fcfe27b1bef2212d5a0183a4a9f9dd4440ab81732a15891f6fd598f676df500c46a5dfcc24bb3278fc9a0440271bf3661f283439affb6cc2c3bc7903450f33ef3fa59a0205b3de7c73c65b90100881021024102000000000080002000002880012a000181080004000044c0010005081124212000a0002016900241201000000040810322840400080050600000008c8000000800080100600900a00000008001000308080001402040000044048008010026048248000090000000386204210000006808408010011000882008000000010080002000900a20000120201020148280200040040400004a4020008201c00052020400000021008008040018000000200400000090001080000400c400000200000000210000062042020820400004808022008400004840002010003000412020400009040002022001000000000001800000828008800001000080840783ee8f8401c9c380833f80448466fbb6d780a09996ce9a05bb1040afb647edc64c2c757853aacebbac768bbb021593fb1e501d8800000000000000008301f934a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a061fe46939ae209665c1dd0107123cd3e34c67ae2e0f21ef5adda87929dedc8eb", ] - await adapter.setHashes(SOURCE_CHAIN_ID, [BLOCK_NUMBER], [BLOCK_HEADER_HASH]) - expect(await hashiProverTest.getValue(PROOF_WITH_ANCESTRAL_BLOCKS)).to.be.revertedWithCustomError( - hashiProverTest, - "AncestralBlockHeadersLengthReached", + const sourceChainId = ACCOUNT_AND_STORAGE_PROOF[0] + const blockNumber = ACCOUNT_AND_STORAGE_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0xf72ab984efa166b226dcb589bc445afeb8e666f789173a32de6d04108ac5cb8c"], ) + expect(await hashiProverTest.getStorageValue(correctProof)).to.be.deep.eq(["0xb56d157e7f5a"]) }) it("should not be able to get the value using ancestral blocks because of a conflict", async () => { - const wrongProof = [...PROOF_WITH_ANCESTRAL_BLOCKS] + const wrongProof = [...ACCOUNT_AND_STORAGE_PROOF_WITH_ANCESTRAL_BLOCKS] wrongProof[4] = [ "0xf90256a06f14ee388c6004c9f591c05cc94509906ebcc57e6ce9d7e65c52aa7da6f530e7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479495222290dd7278aa3ddd389cc1e1d165cc4bafe5a07604903f485d83bda3b1333e28dec61ff3191fef0423ffce44abe02033b323d3a09c6967c2262b8e5aaf07f422806fa22eed9bd05898a71ef3435eb27e258ed240a061cf3a1b00a7ea8e1b8e4a921dbd9af3c73e9ec8646e9884b7936b74e011e05ab901005d61447fd94d1ba8d69022f0b7891c8486f9ae204a03b3b61bbbc905e371ecd613dfbe02ad85113252082314a8e78d016af918d9afd27030b5b7e890842a2f8058103e8c1640a87cd82c733d21e13afc3ce5e133ddd7fd3180a816dc8bfeeaa516555f3bf2545536b6605c1ea8276edf7d076e9346d88e37e24372bec69daa45caa8fe68c4c5edccefefbf60abaa9abee6106cf1dd25dc4fff490c7bf4b1f47993d733a25880a8170f165ed3bb283d69644fb677d0fd763a07218f66249961719ff37e762cf33f76036277f9c2d9e3d5a2a0b6b70cbfbd548a717143e29e3ef4a0f9b17f9f37bc546d06e5d23e02b3c64e2e542f026cf1d4391ccdf19400dc6d8084013d48a48401c9c3808401476c588466edbad78f6265617665726275696c642e6f7267a00b4078ca7a27f9b2448fa3f32e04a269353f80273e6dc95153458475a84238b98800000000000000008502d39a9e8ea00a7c969c5cab15361767d22966b8c0e507572acd096d3bc87af306be3ceb52138080a077f861b303ce5dd4bd241707d60a82406df608caa18ec241e33b5d5a2de94bc2", "0xf90257a034c4cec5ba48eef207f01dace9b74648f75423b99274d285eb51a28ea45a7746a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941f9090aae28b8a3dceadf281b0f12828e676c326a017cb8d562b6da86b898d1579f2c0252ca4fc673ddbece39b0181fe6341dbfbb1a0ae9cf403fc193494aabb363f25427aa1adfe15793abe5765d28b0b1537e0900ba0b950d9ad9c7de4e5bd031c14c6d3afd38f1639e1db56590c6abafacae1e8be9bb9010055b5d41511013102900308208e003834d0c002308b480102a0a90901861621a7664ca1054060d40153aa1b99d74229a5c69380c489626d9027c9635a8d3ba580ed1ddc2810e5ef3f788ac929c12470b06160a08901404f2232ac9d42d9fa0785854040174adb01b6a3dd900ac9098e9d842ee6f52e148f0aba80cab721886001aa28bbd6804c7783a158856d63745f924614c4e1cd398c2a6525247746f4116aeb2021e09a52a018635202c32e2dce22379b9d05caf5986b252e4e0c401a11595d31264220a8210f01132022d6695481a4a02847113ce09583c7220200c6603891f33e680597a840000416a199101be82c29d000738c21d03c3b99150db214078084013d48a38401c9c38083b3f8218466edbacb917273796e632d6275696c6465722e78797aa034169fa758cb3cb5d38e8c22af9b88c525474253da05ca76b683f0c6ef922cee8800000000000000008502e776c769a01c91a492ffa0281242fdcb78078b290d5b055505d1872498d611f8cf295496818080a0686d3a40a3dd6df623831fd87b3c54877f9717001c997f9f9e1758c864df5634", "0xf9025ba03f60781072e20bd526b224ff426c9784c24a949e977ad855585fc76c897d509fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479495222290dd7278aa3ddd389cc1e1d165cc4bafe5a021c619739b6e81e67572203fb27f00c390e605a6fef0fe41c59f226853b082aba050885bd6330e2d1e68c236f561bcea587cfde066214e1fd0ca396d5574685a1da00f98eb31cf5b863de6be609e3389a276cdd0f5247ab142bba2210bcb5133d7d7b9010013f1cd759bd4d129b3bc004786899411332acb21690da0fe8cad091d3a35e08220c245663a4a52b01e4cda40d80f2fc1d2ad9988a862ee76672c504a032fc546d78187483ae99a39f89bd13ebde02ab494a3b071ed61dda0ac304eeaf83ac988d55bb445077b71e2a0c8c08d29496a11223b0387e5150c3620059c7c688dd1554a091f5492678d624c6d916063e43956c49dc589cd61013a60a345c7e1f65622bbbc4b9d5419e000ab03b6ef3ce98e82855d2f2748e6820988478101217e81ade1532542a5d11f555011218feb43548f47eb67c742392c7439c70e5be26174b5e5f32cfe83956d41a88413c522f2cfb0febf952d59b816e98a595fa1a18396e58084013d48a28401c9c38083d4d7678466edbabf8f6265617665726275696c642e6f7267a06f3f13b39fc3605558c21368794faf69b5edc4639f5f191fedbb9145f547fd7e8800000000000000008502ee08d0f0a0c3da7cb220020e2b5c78854d4e0822ed99dfeb75ff41a4066cd5c7b27e8943f88302000083040000a0f5decec30ba81918d464d9692fd3e0660f0f0247714899e77787b9b3e2fb2260", ] - await adapter.setHashes(SOURCE_CHAIN_ID, [BLOCK_NUMBER], [BLOCK_HEADER_HASH]) - expect(await hashiProverTest.getValue(PROOF_WITH_ANCESTRAL_BLOCKS)).to.be.revertedWithCustomError( + const sourceChainId = ACCOUNT_AND_STORAGE_PROOF[0] + const blockNumber = ACCOUNT_AND_STORAGE_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0xf72ab984efa166b226dcb589bc445afeb8e666f789173a32de6d04108ac5cb8c"], + ) + await expect(hashiProverTest.getStorageValue(wrongProof)).to.be.revertedWithCustomError( hashiProverTest, "ConflictingBlockHeader", ) }) + + it("should be able to read the event topics and data", async () => { + const sourceChainId = RECEIPT_PROOF[0] + const blockNumber = RECEIPT_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0x4a95d1ff4f70678c282ef4c88aee8627798dc6957726bb27b16bf206875b5b7e"], + ) + expect(await hashiProverTest.getEventValues(RECEIPT_PROOF)).to.be.eq( + "0xf85a94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680", + ) + }) + + it("should not be able to get the event topics and data if the proof is not valid", async () => { + const sourceChainId = RECEIPT_PROOF[0] + const blockNumber = RECEIPT_PROOF[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0x4a95d1ff4f70678c282ef4c88aee8627798dc6957726bb27b16bf206875b5b7e"], + ) + const wrongProof = [...RECEIPT_PROOF] + wrongProof[5] = [ + "0xf851a043d1a97a67ace1b4fcf400c97b64833e363f929339269b5f08316efe15bb744280808080808080a0c6671ab0c8145b7e995558f60b59fc3ab0afd34db7ba64c70268da26e6f652078080808080808080", + "0xf901f180a022532ca66e2a83977e663b41605e7e2df76bc896e12fc53dce0c5b95ed7f4367a0fd882e481b284515091c4eace0556fd4bf36261a282c4dbe14a9813af1a73504a04b64fbdf1b5db465262c0c4a07d8d1a69034fff72db3e02d6661743522b7c7d7a0f3e1c56f139f509c3bd8cc1546737d231ee006b4f760f9d754b1ce80b64ceb31a0095b2d77ffa53c424fe4cdaf377d3bea5129bc21e95046f267b0d429bf112405a0156430f22abbf89c225643a24d9a97a7fe5832d15df48ec934f56a5860431a8aa040c1f34f5f45ff6d5a717795fc90d520d5080994a10fc487af7a60557b367c5ca0dd8bd9a505b52c9249dc171eea453972bc5261f876553296c8a6186c20f4143da075f0a228baf7eea3111db5ca77d9901bd99109fa3c0d8d3c0e53280ea92e8ec7a0676127922e8aa2da69ca3fd4802d559275d6fd4f5f51f86801e0fcdbc65cdc0ea0e1af98a5d5db3b2b9beb67e7fe333e669b8bc7c73cac1b6c3f96d68670d87422a06ac3e127bdadf66bd1352a7666934c3ab258bb4483f2d9c285aeec2012fed133a0e64c4cb299540f0ca821a86fa4d0ffdd17ef4f997ad121ebec941cedaf2c9390a0977a40d5cb87002b9d8dbaf25667b3b0dd1bd089b49e6c5de4edc7fd2b45cf5fa064756251d84bca534b9408b1c3b5ed3b415bb06e52ac01d37b6c205ff54e7f4380", + "0xf90ad720b90ad302f90acf01832fce87b9010000010000000400000000010000020000800000000000400100000000000000000000000000000000000000500000000000000000000000000000000000000000000010002400000000200000000000000000000010010008004000000000000000000200000000800500000000000000000008000100000000000000000000000800010000000200000000000000000008000002000000000000000004000000000080001000080800100000000000000000000000004000000000000000000000100004000000000000000000000000000000000000200000000080020000000010080000010008000000000800100060000000000000000000000000100000f909c4f85a94a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0bf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0bf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000009aa56119ab6bf672e22eea5c4735446101bd46d8f87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0ba000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000009aa56119ab6bf672e22eea5c4735446101bd46d80000000000000000000000000000000000000000000000000000000000000001f85a94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000007388755e0a5b867f30168ea89f2d42db2d5cb918f87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000b981b2c0c3db52c316d30df76cc48fd167ed87eda000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000007388755e0a5b867f30168ea89f2d42db2d5cb9180000000000000000000000000000000000000000000000000000000000000001f85a94ca71fa74c9682518ff2489b902648e6c2745573bf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94ca71fa74c9682518ff2489b902648e6c2745573bf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c2260000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e44a29d8d2197e80085986953d52566d10eaacacf87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000ca71fa74c9682518ff2489b902648e6c2745573ba000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab840000000000000000000000000e44a29d8d2197e80085986953d52566d10eaacac0000000000000000000000000000000000000000000000000000000000000001f85a94de8507bb18616ce211638fb898e452f5486b916ef842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94de8507bb18616ce211638fb898e452f5486b916ef842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000007e1306f8adf9125b3795dfefff35c1a80be5ebeef87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000de8507bb18616ce211638fb898e452f5486b916ea000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000007e1306f8adf9125b3795dfefff35c1a80be5ebee0000000000000000000000000000000000000000000000000000000000000001", + ] + await expect(hashiProverTest.getEventValues(wrongProof)).to.be.revertedWith( + "MerkleTrie: invalid large internal hash", + ) + }) + + it("should be able to read the event topics and data using ancestral blocks", async () => { + const sourceChainId = RECEIPT_PROOF_WITH_ANCESTRAL_BLOCKS[0] + const blockNumber = RECEIPT_PROOF_WITH_ANCESTRAL_BLOCKS[1] + await adapter.setHashes( + sourceChainId, + [blockNumber], + ["0x316e3ae654c0f73f45c71768629c7933f2d444b04e223f1afcb1ebf244b744e3"], + ) + expect(await hashiProverTest.getEventValues(RECEIPT_PROOF_WITH_ANCESTRAL_BLOCKS)).to.be.eq( + "0xf85a94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680", + ) + }) }) diff --git a/packages/evm/test/proofs.ts b/packages/evm/test/proofs.ts new file mode 100644 index 00000000..90481fa2 --- /dev/null +++ b/packages/evm/test/proofs.ts @@ -0,0 +1,100 @@ +export const ACCOUNT_AND_STORAGE_PROOF = [ + 10, + 126086803, + "0xf90244a006f019ce5f815a48534f1894e0bf2bc479f3624eb3658a5b8b09683210371cffa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0db07d5c7f51b0fabc0ab6abffb98efcac1cb95f63dcae01ea8e73301558f1c94a05ab78472371830bfed304d360240d57e7bee41309297278fd0dcd5b198979a2ea0a9bcb4d6a8f248c15860a40a38c1d965a5c33173226d35eab3cfbb7112bd3532b9010040703482510e004000001884022000202001880a000450400806000144d2210045081100280910224008001040003110004402640012220006200001402020c1000084188008208a3010880940b82000149414030182049548200000208c0001190000281a5406000010100203040900e0311685481c0150002500124808000840000003088c028200010600104840049080d5c08aa14000111090084a2800001210002815123401000011028040260008840010a000000040810410880004804000002308064400c10028860002800840c480040582c3008020040820102901001028010094000110102801088001119000100401828100840080000021280680840783ee938401c9c38083574af28466fbb6df80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301fa63a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + 0, + [], + "0x0b2c639c533813f4aa9d7837caf62653d097ff85", + [ + "0xf90211a0844646418cdc472243623a6adf853cf42930ed027c5f2eceff9a2a274f5e9cc3a0ec7c3704cc16a2ace8fce26d2ad0da2fce10b66df732616516228db1d366cb4ea0c2c588c16144825eb7ea05706f6446d2cbffad3da2174cce3ec3a1effe54c803a01b2297c51766932182e29aafdf7dc4b9bf3c5307f0a38ba23b36f8ecd21fc0e2a063d96d72aa3d8c16be960a74f174e75c4e2db021710a8e461502f5146e30faf5a0012f48dd4b043f6f92c33b2d8deda920eb9865100c29b254f08954f09ecdd2f6a094e26fe5bca0e87b4019c815890e10788a637436fda3896d5505298016270182a0baf314b410c021b42295a806f14ce14700e1699dcf7de35a194229cf94954d1da0a7febdeed6c7dde904228dd454626d9427e0a3383e11398d41ccad56ade292b4a0463943e8401fdd6b0352ae228250096cfa8ddc9dfda3d38d4c33e55e17369a14a0a8b2218d9bb0268f2ed74484331ba4ba428d17b65f4d1a06d7f4ebaf9c514d4aa0f9e9916aaabdbacbf2004783d7403a8891c73c9aa468c72ac7e8b09a0f89142da0ff7d643adb489b721f611c0b981d67dae2b63945a1c7ff908d077746d6c1957fa0176c742cd7ddd01391f0863b472f318e91d3227a3357c306cd86a18d30303641a01e767c4d2bed2343988ea284102b234302b0e1ada620d9b9a0d194077dc7f873a0619ddda96da06f24140ddaafb3d5644b6da53041b39aa7dd5dcc3468d9fa445480", + "0xf90211a0ecb37076729047293de85c6c4a2b13bb62fa4a402c6b1451e9119bf495aca8a0a0433f3f07bc576292134817472d7166183bc4730e837f964e3011b52bbf9b081aa0e9b2b29d4341d3b168d9bb4f4fe000b876a8f55027cbb69c45160d495141f210a04d482eb4f317e703aab85ad2c6990c98145af5f7cc89a7ccd2161f87b791bc01a0e9357b5192820eea672e3194d2020b131f29abe5671c37601633c485358eb421a00a3f410ab91d016cb1716203d732962685a6fc9436862ab83d9fc5109346a041a096e1687da814500097774352c9f49064dac34fe0de9f1848190b5a56fbedcb17a07006adaa8c1b203eab5ee33ea19de791fc8c9cf5cb15ec90d1ef051c9e2ed78aa0468135eecd2271411b5c039c6dce226ee4b251d3e671fea0238347a522241313a045483167728fabead0fa82c604abcf05e0141b1e82d5e94a427b367839985ed4a04c53cd84dd5c5e90d3e4c6bf7583a2d71a5f440e78d2e550c618a9c326ebce64a0f120f7e462069e2b91d3ce0f1e9be2cef10b699399b76e188a710c74b8968432a05a912ef4d4b331e64a4f5ff4a6268ea3bd66c8b823fcb4c3bf7c6e200d302a1ca07aab0db239e967467ed9b3a155ef0a4e8d03d058d44e9e63c39312ad2a986fc8a0afe49319cf159e2916404743d4ef869043fdeb37c79b20fb355a98e8500491f1a04e7bfee55002c5d87331c6d9a9fb394acf87247fc3e26519224e3851bee4c19380", + "0xf90211a03b31c916b970491c86305379f7e67c97f98166cbc06fade873c5c7d324a7fa81a0d5ff65d687d30b465e3abc81774a9628de5a67f6f318fbbe0641634af53f0d74a098663d761acb23f77146aa5dc3fd4b487a3fec8d25ab2d5408e38e75489dea43a0a26e34fe93e7455b178fde2f89c1c99cfef61cbcb24bdb7ad8041be83ee67846a008662a0a8da5e79b6f4c601197a57ae00377f2f04a0f5edd17e3aed4c4d3777da0c3113823fec10487cde37f5ee2f39a8c72bd0413a21ba763acb5ebf0d40a49b6a044163b2ab486e7f99d831323ece00eb977db78a6594acb26082c5de00943616fa0dcfad53d7bef9f07e520b4b62d7f71620b244d13d06bb964a619f5536e37fa08a09c630785cd49c1b3aa3457999a1047d980392a18bc1d04f7763416ae01489ed6a07a1d5d86308774a7c26ed21faaa58d45efbb2616961a4bbe10d3fc88d99d0bf5a00c58bf78f9f278a3e75d22b39fda0df112a1cb8e05d79c32e5f31b94d4e99f64a070ed09023a65c88badb25edf59f2cab9708edc992ef461534b0e47ce3982ae90a01b690934defb8655cddc75185dd1612c1165ecfdcc8e7a19fdc57cae0f0065e8a054523f7b5547848216144e68b0ccdb1f819bd54ac210c2e4dd5a380edcce33f0a07dd9da455fb24559012c4903166f73f9c5e661b8c88f0bf7de019d73d4c19c89a04478f70fe968b2da1516a8f6b67a6b28011923c34ebecda2f45355e442cbcbbe80", + "0xf90211a0d5393c3c06c8d597f6f325789484f12da87d807df33096a0af3161e33c44b8b0a0f27d4b26d1822dc04180fe221b3e7cba86c9fc524791c951b6b71c242099ef3ba011d2b20160240582f75dc941e1785643f7652a43d1d62697808657b0a0b8e186a0e9acd52b94dd294c782ad25e727c17934726d62052deac6cd8ffab7cca3e4176a04dcd91b21b8c73a57023c649f7d27cb9443450ee8301f56d4693e667218fcb3ea0630078c69bd028cb16cfccc05feb9f960484ed470f7bc0d1acf25fea5a68de0ca09ee40510308e721235620dc519619981d81e8997c0e7ab5c91f32f1f9ddffdeca0176656e94e76511030173bc6a39fc6fc11078add4c391a6edceb34cc28b7c83fa01cc9e278e51e81a30d6b18410a7411287b95c03d9ec2fd23396f0ada6410d2a8a019a07cd977b76673046b61debf2ce6e54615f5e69e31e17eb0c4dfb316da1cc1a08b8a356d612925d089be937debbdcbe8a40a941bbd07d7fe168cdbe2bfdc2d7fa0ebad3b72886fc350a5aaa24d20d8a143754c92eabab4ee2cba59697e7771cd50a0c24cf965d70417de74ee02b9cfdde3138d434c2cbc0c21006c04cde27a2d9ab7a0f21f4798a55807d429caadba5da04b2d12fc43569e7bc6c4b965976f21643874a0ec71a00e5b53a2f6043ed744c66b7ae5bc6ea1c7d32066014723a7744ad0e446a08b985961a92fed93614049284d0f08665a7a9f1b5dfbb025682a9551f2660f5380", + "0xf90211a05510ce326198dee0033e6a2b29957f77687221d6f4b9a082f34922f9f589b003a0a6f336170753299b1adc48077e111e425fdc539ff7160a9babf8afdf5b5bef3ea0ad027c813622b3582247847a8537992e0a3f6a50e10c268d0ac8eacd1fd750bba037babb03742053f969204568854a958947fc93bcb978ebc85c83e35c5dc6fdfda07d3c1a847911e962071639472987bf9f0d112c983b393190af796342557a3ac5a07e243717881703400c60ec2fcc05040759a9646b61adb02412c8b0619e3059bda08acbc6de4a6c92f92dde22536a30bbc7bad7d44394e29312ebc9adfcd84ca300a0c558588e6ae83a42eaf44d7215f853262ad725faef6b3c73830e0903a31fefd6a0921f30e12a3b363b2aed7283870304a503f3613d311bae004eb7a922f6fd50f1a013987bb8a564c1513dd7b42682bb7237f51b94ac28780f41ae45a772e13fa76fa0596b2015a656fd4864bf6789cb5d4e4c67cc05114ae3fd7caa8355bd16cb00a7a0dea6e67052bdc0d975f894dbe6b4d7b7474c7bf6f2d0bb9b5298073a5e95a43ca0f532a3b3466a65f1e6e948bd1a9ac5b36bdb0f824609c37046acefb55f76d0b7a0b92f68142fb15ceac6044f289b074c3333e4826a9f02f1469318f2273026339ea0a5f42aa4c2fd149ba3a73028c450d1d3c0c10536bc1421c6e632bd56d63d7565a0156d9f2ce56dfe6e92fe5779b15821b6bae03882935a167a0d3c10e03523f77480", + "0xf90211a05d176d139f8def1c9dd83692adad161605fdec658eef8bc28afc4da848d97662a0e3d1f706ca6308d1f5e2d4cb6d641ba574b9ad852d6c878f9cec25ba7c8c8183a0f3647cf8efec130e89c09170b6a82a06cf2b9f4b15aff5d2e93d3c8cb5c294f8a071493e91397ece4c52482e3a20656b6780054a56986544555b07f5b053a4d722a0b60b270ab95f7787f4a40d6f68b667126fcb1272ddc0e9347205ebae3069b7d2a0b00e67c2e390212edde83ad1182fc5f373e9f47f11c8c69a04b87d75d0123b15a02f20f6d8f52b12c28ddba6fdca481dcb5a07363ff08758d83f041b2535666b18a03f573e0937a15fa5167802cb25220547e8b6c2194633ad2d2b4e15fa9b2cc8fda0a27b621d4212470161d3a1786d70b24ba6f0ba013677c11e995feebb3f7be72aa0894ac9ee877ef9fc4ea797c33f994996567a17777a57d22050260b18bb994946a09bf44993469f668dadae80170dfb81156b0decb5f7fbceb62980a2508d3f3702a013fc551024f4961a8e4adedb726962975a60ae0553a65f0dd7e266b0ec34f2dca087561bc3f849b47500f1f503a264466616a31a4e7adf3f2b2753b3f8c60444bda0421bcca422a9f02867ab2b0269bad562e8d35bf35bb332a48d3be29b513e4a78a09fe8fdfd9c06692e93cc2f1b277aadebf462a38a28abfaaba33f4d7e4212ed71a0407f10b8182d07c7f9789d469b68926931e184d7afdc20322387db7dd8dd950b80", + "0xf9011180a0af3e6c1703878fa0f54ce9ef81044131303255beda112c1750bd46e46c17749780808080a0ee3ef4e754b7044fbaf982f80b8ab4ea00503fe3ec4c50fd7864e81ce1e6c4408080a075fb4f68ac224ec54d38eee3bd972654ca5ee1833530f0ebefd71a9f49cf09f1a05c099f09257a656d98101ccd60d3fbe861cb889f9699b8eed136268028021b70a0b90a5365f3205e9df1129eecaa73667c4d2c567f1ab45f63860c3671b46dc27780a0e38b7963499d1bbde43a95289356e98e19cdc1e21e10e097e1490f15e3662e0ba052b569b11cc62b342b35edfd24e3f8c4f9b3ec16930ac8986eefe14e609d073ba052fe3bf973b9ff06f119a91481e15215c3eccadc584ce8b6e7a05ea68c73054180", + "0xf8669d3d676334b26bbb561def1bb646db346a0ea5f7c4f069e5ce4083818685b846f8440180a0b8f3308b625ddb7bce9e10a6a13d9988d1b865eb09df34844bf6b86b00904ae6a0aad43333d28e146557f1c682e8a4226743fb231fdd00a577512233bd9e920008", + ], + "0xb8f3308b625ddb7bce9e10a6a13d9988d1b865eb09df34844bf6b86b00904ae6", + ["0x000000000000000000000000000000000000000000000000000000000000000b"], + [ + [ + "0xf90211a01922b5f82f07bee421217744ed6d4e95b98852241f24dffa2f5701b1ddb8e6dca03fec17456b28fe0aea41291618b766813d90061104d8731e6e937b0922cae1f6a0fb94b76b2f2c5d4b40890a18b9f0579966eb56274035a58010db113ccbab922fa085b2e52483d7a1448504098bd8b3a0fc68becfe6fcf5e8f7442d08d1c17d9446a0c8b2aa37759feac9aad765fca7545ab9d02015364261d3f35384154e77ef77e9a0bc48fb8581b0926eb1d707cb1668b5ecdf2b1759fb7ed8d440bf1163103bd810a046fe65e822efc9f1b49e43ed4eb7600e9658c306b70a95999aeb0112c9954f9ca03d66c408b9ced8ee40c6281f15e26bb7db314045d5f65322fc1d5e24544b9192a0b26bf58b679aaf2a0a5f5a7fc9507e856f31e01a7ea47d9c5719957e51d99f92a003555409bff0cbb217e5d9fbd7d9e3b46a451e2b3cc0f27b34a3b553634770f7a05f71f83b940082edb3f0afaedd000ae4789a8b459c0befecf0085308961a38f4a0110aca3b49ff8a7fc3d60295d0c18602e576427a02907986d3fcdec5c8406607a0b197a531e48bf6f203d6f8b4088117caaa55d2318177d00a849c9bb9c0be11b5a021c55c465168ceb84725b61988c7c174880c9bccb99510ebffcf715f01344022a0173421253267ac8dacdd78bb3a49e4e68ce44c987335e7e22e2067f5998ccc8ba0ddb9469be4af0c764ae2984533a34b6ac6ad4535a7bf773d1bdcaba414288d4e80", + "0xf90211a0134f748fc5e8562c4037bb335c253e159c2d3c7a1dc48b1e006fee1ffcc63874a0dcad9ec65f0b0b3e3d265b468ceda4c2626bea957ba6dd0f25e91d8f43615dcba0b8fdad766b78548db43d60da964d1abdd784ae56bd9ad9dd5ce7911beadab941a01db88587d7758f452204d265122d451f416f29219de91d8f1fd98b4695ad56f8a06464403607b9759cf6cb0e1bdd58d3a231ece185267c59d0113836bbce312007a0a23247953c05226318750e90668afd8b8f4a308f1f3e5573f92c03cd4fa9cc99a0ec186ad6ea36e64969fac78982f9ddd2c78f01fb5f059afc8d9253cafb348272a00e259709d156973caac69a52dbde1569f0ea9fc58cc9333b6fff01bed4ced9c3a01f76d216b1d1f75ebdcece38a62dc6d85cf090cec0b17ea8fe4a2fbadf02e418a0a44e06aa48e8e2b81b82ac7a55d10e0e75fb0016475f40b4b2b199016fefef11a04e31f7d98493c4af332a55a088d75bd53a55d37feee0fb4ea4bb89bd6cf1189da01fe39db746e4eef3572d1863d2edf73ef178986a33929a353e30d5a5459cffb7a0c64a8a52d3dfb4c33e5eac53820c25604e4c8f34062e2f31a00ada4c4e8ac794a02b09776c323c5f8fc6b69732fc17e7ac78fb63c9a42243b5b65bb067b05af034a0c371630f7af67645f11a19b70a01e20284fd2c3afa8ad5e72fa939e775090b94a0a2680edf63d1735ee9ce81c2bb867aa6708db5be648b511b2997cf6a82b7b12a80", + "0xf90211a046660614c4b352e38c7a40b3fbacf123b88d343407c60aa3df2fc14e5c57667ea0f326e8d140b8c178ef04d4af3f9435159ad3c3cc9029a24daced2a2e5a7edadba04beaf51b9e686b2e9a3cb11906ac2c2b975a1f2b21fae6345baa832716d08904a00d9c648844e04c5a20d669382e429a02691b92a9ed51346e9e6b4c3e11950c51a0116e5123177580be67dfd0beaa66ff0aaad0d390afa05246c44dc8de9736c21ea0c566c23ca1b65aec125de0d781343787ae3f1037793af3d12e976ebc26b25d82a0ecc286af188cbb0d2f91980a6547e9c21d31e436f362565998d38063cb8e4a43a0161332b061fd1ae44a9cc9a7ee560b1f416a75f723df1d4607487149f0a6ef98a0ce4de6144c942d8cb5180aad406ac42934f039bafe6a7b1fba6094b104e3ed01a088da9aca558d0c51ce0fb208ab108b143e0a5122bcd5bd85c35e09b39a67a7ada0b24c5e971bdcc7151c89d69c0046c899379fcb9fd479d2b8a05df7348f08e4bda0bdb15b37b990be1e658ede5ed0e556d73fca185489124cad494721bd0c9dc79da0279294696fab46dcb10b5069d1929b96500342e6609fc85b5c242ebfd6dee280a02b3df2dfda83841f27315d0dcd3025dce8ee53425de4ccea153dd8f9893b65d6a07b3b6cb9b2148a7086adc24501672da8b0fc348a1fa78051ebb603f337f68de8a025f98ef38ab7bbaf176f7284ff1548b7638d013f817fd84979061507c4cb3f8080", + "0xf90211a0817f0522b611763caedae0abdbf8a7d1fc523cc759bc6dd400d8837d94587832a0ecd37fcea2b496aeb18f74786fc7aeda2ea78bfb55cf27a829b69c4d15e2525ca019a27a34379a6a5dcd5a1cb8fdc5b7351b40eeb3f4e7d09db2daaf688e7a11b8a02339835ad35c836c7c9b1fd17f8ef9aa377a9e458316252ac63efe702fd895bda08e96214ae9077f46f6d2a440af91126a5bf62732edd0dc513efadba4b956fe9ea026370016e564a879e26f01a077e73badcca1551a92a05571e86d07af2a049493a0fab6a8b576dbf710ba642f849c36ab54ed462ac0f8e3593ad6d25af4e6f23677a06ed7fc714f359a29a6bd13c1a804fc6a19938f46c377fc97e787706dc8da0e58a0c0d3305cf25baab40da08bb2c141d0984d60afc353c4d0e708fed92fb2239460a057cdd07f66b3a31f01079d3933ee6a4fd5280ba7abec7c9bc1404ccca5224d9aa0ab9e1abf9a0bfd89d1483448ec555a10d7956b434787ae6c55605ce4c3fbb3e5a0d9d5c4782ba8bceaf3887b440321190898df7ce785679dcc628516de02069a17a05565679c56603a5614f90447648485ba6f3e324df4845af69482209fcc620156a09e4205f6a5c8e633cb7e5048148675d7aef4030de17d81e6d8e5a3e5f5b77a8ba0b995d98c91905fa0e083455afe9d4219e4f040c6e3bdf948b139a8d12b192157a05ed2de5e483fa16f32c9d56979082e36c77c1102e12020136172dfed9c85d28880", + "0xf90131a0d56f8e12a9254f3fab9b7c5cb9e917dbc2540b1fa8e14f22840257d30c47adbfa0bcf412e2dcc182720eb7a6d3b260488603cefcdc206815beeea0b4700adb9e46808080a0ba844e9671269f0a8ab47cd42fc59e9ff5077adfa3c400e243146fcb708f4e5da0d1e9012aff863e29b5c2b7111ed41b55669bc3bd70aafd9302247c9a71176550a03f9b33fa55d938ae9dd41dfed6b17fc52327d20a2503c8e5d85a2f401a0e6ea380a0d4947649b148740ce5687696c87bb07217543329c73f7bb8900f1140b1563f3ca0c41116acc085e1d1b88f0998eacf59cc10a4646e9ffc4428b221c00ec5b1f4cca08c6b7c02a459200f13e8b385d3dcb998ec8f9c03cc1b7c8b3a5e753d5a65364880a09dc8cbc03d181ee816de24c1baeaa398a7b98e5f33e730011505e8496e74fefd808080", + "0xe79e37a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db98786b56d157e7f5a", + ], + ], +] + +export const ACCOUNT_AND_STORAGE_PROOF_WITH_ANCESTRAL_BLOCKS = [ + 10, + 126086803, + "0xf90244a006f019ce5f815a48534f1894e0bf2bc479f3624eb3658a5b8b09683210371cffa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0db07d5c7f51b0fabc0ab6abffb98efcac1cb95f63dcae01ea8e73301558f1c94a05ab78472371830bfed304d360240d57e7bee41309297278fd0dcd5b198979a2ea0a9bcb4d6a8f248c15860a40a38c1d965a5c33173226d35eab3cfbb7112bd3532b9010040703482510e004000001884022000202001880a000450400806000144d2210045081100280910224008001040003110004402640012220006200001402020c1000084188008208a3010880940b82000149414030182049548200000208c0001190000281a5406000010100203040900e0311685481c0150002500124808000840000003088c028200010600104840049080d5c08aa14000111090084a2800001210002815123401000011028040260008840010a000000040810410880004804000002308064400c10028860002800840c480040582c3008020040820102901001028010094000110102801088001119000100401828100840080000021280680840783ee938401c9c38083574af28466fbb6df80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301fa63a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + 126086800, + [ + "0xf90244a006f019ce5f815a48534f1894e0bf2bc479f3624eb3658a5b8b09683210371cffa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0db07d5c7f51b0fabc0ab6abffb98efcac1cb95f63dcae01ea8e73301558f1c94a05ab78472371830bfed304d360240d57e7bee41309297278fd0dcd5b198979a2ea0a9bcb4d6a8f248c15860a40a38c1d965a5c33173226d35eab3cfbb7112bd3532b9010040703482510e004000001884022000202001880a000450400806000144d2210045081100280910224008001040003110004402640012220006200001402020c1000084188008208a3010880940b82000149414030182049548200000208c0001190000281a5406000010100203040900e0311685481c0150002500124808000840000003088c028200010600104840049080d5c08aa14000111090084a2800001210002815123401000011028040260008840010a000000040810410880004804000002308064400c10028860002800840c480040582c3008020040820102901001028010094000110102801088001119000100401828100840080000021280680840783ee938401c9c38083574af28466fbb6df80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301fa63a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + "0xf90244a0bdb13612402a6004f26314e340d25c864e27cbd26d90464c3a3191195698a038a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a016cd64cf4911d99e5413d5740b90cade7def9698cdabf726e8d931bd5967f878a0c622bc1d9430ec4062302efe23cc8127742f8ca8978a7c3b27743124c4b7430ca093be9a83ad2bf4a046bab6c7a9bf877f261238a9b96058936458d61c2ee4587eb90100907030825b420001a40218a688204060400c00280164a0000844000344c42900250810046000040a80400090006023000150144000032208045046c0406642c12a140080000c308a2100a02952a5302110c45008014b201619000101280200039daa43088b44000010115000020008318003460a4008160000000012a80a55184024002300822500582132023801b0041122168080200268002400582a388019821040923023048002811120890846001a8428862081420980800010200028406000120220420008354800060262301028f12000808803168008001aa801201003100c8d20b3002209904049028801c20800010414809a00800088042013101080840783ee928401c9c38083771a9b8466fbb6dd80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f941a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + "0xf90244a02abeb2f843b0c7e14af20d88b51580260281529864bac81386715d186b188feca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a07f973efd45c15188ca5b64afe8f2a431fc49da885ce3473aca30f18230bd9567a0070547bf249b370121ae7bfcf64c421a91c25b4a694b1982b1f473138d69bb22a057b9a7532db0ead6850099e396471c6ab4b1c1970850d259abe2e1e8f4003d51b90100c401a002c0040080d10018404420012080006908000402002006880044e0011025081804301200210000a0100010380010c1021000122280a4010140406809c822c00088b0290808200008b948a10401148608004108100414000000902800011485010882042204128012a00110480100210002ea0900400b010110010910080800006508800151002142001a08002050001781a82110008000109a2a0885180200000658028e000001010409089600268470040042008020900052a85800806910100200020800130088060882000042c40010038002008100000840046040583cc00902840010209040a1000055011001342c408089400620a08000142c0080840783ee918401c9c3808371781a8466fbb6db80a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f846a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + "0xf90244a012dfd2e2be4bcdd6b79eac25fb75a3fc4d755aa463acfc7ff80f3bf4ec49353aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0e49a1cb205090a958479f62241d3c812164630f09859538b98f20929700832caa0fb422fe08fca21bf0de2f413bee27c3ff3436ea54e32587238ce182d6dc1fb19a0274c2dbc71d835379c18401e3268e7c4f009b670b9a0ddca04743b7b0b65a111b90100005030021000000300001880204000001200020c000020000840000042c009000d08100030000108004000000000210800100442000022082040004040600000000280008008308a4000002850000000008400a02008000000210000000000000000010006040000000011000000889080004000200a00808000001208480908002000010002300060000202010180200100500080000000020000000a1004018a00001001000080300108208000000000000000000000090080408300000040400001020004240028008006004200000805800002880300000000084800200000300009002000000800001000000100000a011010902a00800010040001000080840783ee908401c9c3808335bb028466fbb6d980a0bc24644d93f212885acc3a93836ba214b962f7508721517fde36b89841d126638800000000000000008301f8dea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a080c2a58ed1b8b5bd35567d8dba40773b50e4bbe0b5f0e68b2a8a0d79c6619dae", + ], + "0x0b2c639c533813f4aa9d7837caf62653d097ff85", + [ + "0xf90211a0ae94776f5c237b1e277aa2206301cfcfd3990fef08b60f1acbb7518bd2c353dda0a6dc453d3af2966ec75db38d8b592099cd823972058a68fdfa217788b8307544a04d85ebfc910e05b7de2b9a780dd871d984c36ab0f2c3f38eea8de6adfd1c444da0b5fea1bad6564cade5a31e978195248b2fd67bb195006827d1d61d0d72593f64a0460766bc32f1ce32df10f604758468b2998250732e91dcc43b3e8b185bda669ca0e21dcda48944f76f3d6508ab3d36035cdd82cf3d649f327e78532a62a40376b4a0dba8c95c72743ae2b7bad789e3038040f06f3afbca090b9da364ae39f0b15963a0bca1300f03dcef17a2f614fea6c34eb6a6f0c52f57e7fa15a75860541c671322a06ce72250e0d542a46b25347cada837c6316695108071861dd4b041f4bc56d0dea0f00addb60c5ee291719dfe5d93383380ce0c3a9cf54d27faa70fb3b30d424810a007fbe090c28df1099bc1768e0eefc350701227b351d4b0d434d81673b4867e0ca04e1032bc06c39c9d9ba823088d8ba3106c5018f4ef60765c72b1402c7a7cc5cea0a848e579a56b4c19e92b4a582288f1cf701ffcecfd439fb88c8f40173cabe43ea0d5839de991945ebd86629e32de1de57140de090842f3809bcf4a737bd75c13bea0287235eea51447d1b9b6686381830195568efc908c27092f561b2c65e4113ccda0d902b9642b74f04cf670d6d216c5f03d0d92f2e77c374e3e41c6c6265d8d429980", + "0xf90211a0d61d720b302bc422f0ece0f3c0e5172f16e8409b6b8bdd15db021284389b28fba0433f3f07bc576292134817472d7166183bc4730e837f964e3011b52bbf9b081aa02906d2af47eb17db297cac9e29381427fee7ebb53d6a914e402535f68c4c7c21a09de01bfc2a3986ed7a00b997b4cb7b55b837a155baa3bfc171efdf1ac31487c7a0e9357b5192820eea672e3194d2020b131f29abe5671c37601633c485358eb421a00a3f410ab91d016cb1716203d732962685a6fc9436862ab83d9fc5109346a041a096e1687da814500097774352c9f49064dac34fe0de9f1848190b5a56fbedcb17a07006adaa8c1b203eab5ee33ea19de791fc8c9cf5cb15ec90d1ef051c9e2ed78aa0468135eecd2271411b5c039c6dce226ee4b251d3e671fea0238347a522241313a045483167728fabead0fa82c604abcf05e0141b1e82d5e94a427b367839985ed4a04c53cd84dd5c5e90d3e4c6bf7583a2d71a5f440e78d2e550c618a9c326ebce64a0f120f7e462069e2b91d3ce0f1e9be2cef10b699399b76e188a710c74b8968432a05a912ef4d4b331e64a4f5ff4a6268ea3bd66c8b823fcb4c3bf7c6e200d302a1ca07aab0db239e967467ed9b3a155ef0a4e8d03d058d44e9e63c39312ad2a986fc8a0afe49319cf159e2916404743d4ef869043fdeb37c79b20fb355a98e8500491f1a024f8f3ea7890564e7c9b344f5493de5f87cfc5e4512c2396a51040cb64d6aba280", + "0xf90211a03b31c916b970491c86305379f7e67c97f98166cbc06fade873c5c7d324a7fa81a01b01b15dc4b7c66db50809b4236a98a2f05f156dc70a1e00ff7f009784a88173a098663d761acb23f77146aa5dc3fd4b487a3fec8d25ab2d5408e38e75489dea43a0a26e34fe93e7455b178fde2f89c1c99cfef61cbcb24bdb7ad8041be83ee67846a008662a0a8da5e79b6f4c601197a57ae00377f2f04a0f5edd17e3aed4c4d3777da0c3113823fec10487cde37f5ee2f39a8c72bd0413a21ba763acb5ebf0d40a49b6a044163b2ab486e7f99d831323ece00eb977db78a6594acb26082c5de00943616fa026fa7daf50745e3a6dfff87c28840cbb09ddac372d7759b796ea60b775f69f60a09c630785cd49c1b3aa3457999a1047d980392a18bc1d04f7763416ae01489ed6a07a1d5d86308774a7c26ed21faaa58d45efbb2616961a4bbe10d3fc88d99d0bf5a00c58bf78f9f278a3e75d22b39fda0df112a1cb8e05d79c32e5f31b94d4e99f64a070ed09023a65c88badb25edf59f2cab9708edc992ef461534b0e47ce3982ae90a01b690934defb8655cddc75185dd1612c1165ecfdcc8e7a19fdc57cae0f0065e8a054523f7b5547848216144e68b0ccdb1f819bd54ac210c2e4dd5a380edcce33f0a07dd9da455fb24559012c4903166f73f9c5e661b8c88f0bf7de019d73d4c19c89a04478f70fe968b2da1516a8f6b67a6b28011923c34ebecda2f45355e442cbcbbe80", + "0xf90211a0d5393c3c06c8d597f6f325789484f12da87d807df33096a0af3161e33c44b8b0a0f27d4b26d1822dc04180fe221b3e7cba86c9fc524791c951b6b71c242099ef3ba011d2b20160240582f75dc941e1785643f7652a43d1d62697808657b0a0b8e186a0e9acd52b94dd294c782ad25e727c17934726d62052deac6cd8ffab7cca3e4176a04dcd91b21b8c73a57023c649f7d27cb9443450ee8301f56d4693e667218fcb3ea0630078c69bd028cb16cfccc05feb9f960484ed470f7bc0d1acf25fea5a68de0ca09ee40510308e721235620dc519619981d81e8997c0e7ab5c91f32f1f9ddffdeca0176656e94e76511030173bc6a39fc6fc11078add4c391a6edceb34cc28b7c83fa01cc9e278e51e81a30d6b18410a7411287b95c03d9ec2fd23396f0ada6410d2a8a04060e9e3881260d3fff6981fdabe0861f12fe992e1a2704ff948339ab1ac694ca08b8a356d612925d089be937debbdcbe8a40a941bbd07d7fe168cdbe2bfdc2d7fa0ebad3b72886fc350a5aaa24d20d8a143754c92eabab4ee2cba59697e7771cd50a0c24cf965d70417de74ee02b9cfdde3138d434c2cbc0c21006c04cde27a2d9ab7a0f21f4798a55807d429caadba5da04b2d12fc43569e7bc6c4b965976f21643874a0ec71a00e5b53a2f6043ed744c66b7ae5bc6ea1c7d32066014723a7744ad0e446a08b985961a92fed93614049284d0f08665a7a9f1b5dfbb025682a9551f2660f5380", + "0xf90211a05510ce326198dee0033e6a2b29957f77687221d6f4b9a082f34922f9f589b003a0a6f336170753299b1adc48077e111e425fdc539ff7160a9babf8afdf5b5bef3ea0ad027c813622b3582247847a8537992e0a3f6a50e10c268d0ac8eacd1fd750bba037babb03742053f969204568854a958947fc93bcb978ebc85c83e35c5dc6fdfda07d3c1a847911e962071639472987bf9f0d112c983b393190af796342557a3ac5a07e243717881703400c60ec2fcc05040759a9646b61adb02412c8b0619e3059bda08acbc6de4a6c92f92dde22536a30bbc7bad7d44394e29312ebc9adfcd84ca300a0c558588e6ae83a42eaf44d7215f853262ad725faef6b3c73830e0903a31fefd6a0921f30e12a3b363b2aed7283870304a503f3613d311bae004eb7a922f6fd50f1a013987bb8a564c1513dd7b42682bb7237f51b94ac28780f41ae45a772e13fa76fa0596b2015a656fd4864bf6789cb5d4e4c67cc05114ae3fd7caa8355bd16cb00a7a0dea6e67052bdc0d975f894dbe6b4d7b7474c7bf6f2d0bb9b5298073a5e95a43ca0f532a3b3466a65f1e6e948bd1a9ac5b36bdb0f824609c37046acefb55f76d0b7a021462b95a644603890bea60588a71a17aac1e830fe290f6d9627f6a0ee173de7a0a5f42aa4c2fd149ba3a73028c450d1d3c0c10536bc1421c6e632bd56d63d7565a0156d9f2ce56dfe6e92fe5779b15821b6bae03882935a167a0d3c10e03523f77480", + "0xf90211a05d176d139f8def1c9dd83692adad161605fdec658eef8bc28afc4da848d97662a0e3d1f706ca6308d1f5e2d4cb6d641ba574b9ad852d6c878f9cec25ba7c8c8183a0f3647cf8efec130e89c09170b6a82a06cf2b9f4b15aff5d2e93d3c8cb5c294f8a071493e91397ece4c52482e3a20656b6780054a56986544555b07f5b053a4d722a0b60b270ab95f7787f4a40d6f68b667126fcb1272ddc0e9347205ebae3069b7d2a0b00e67c2e390212edde83ad1182fc5f373e9f47f11c8c69a04b87d75d0123b15a02f20f6d8f52b12c28ddba6fdca481dcb5a07363ff08758d83f041b2535666b18a0def25dabbdbebbdfef848073b51725528ae2680f9dc8b2371b52d97e5bce5645a0a27b621d4212470161d3a1786d70b24ba6f0ba013677c11e995feebb3f7be72aa0894ac9ee877ef9fc4ea797c33f994996567a17777a57d22050260b18bb994946a09bf44993469f668dadae80170dfb81156b0decb5f7fbceb62980a2508d3f3702a013fc551024f4961a8e4adedb726962975a60ae0553a65f0dd7e266b0ec34f2dca087561bc3f849b47500f1f503a264466616a31a4e7adf3f2b2753b3f8c60444bda0421bcca422a9f02867ab2b0269bad562e8d35bf35bb332a48d3be29b513e4a78a09fe8fdfd9c06692e93cc2f1b277aadebf462a38a28abfaaba33f4d7e4212ed71a0407f10b8182d07c7f9789d469b68926931e184d7afdc20322387db7dd8dd950b80", + "0xf9011180a0af3e6c1703878fa0f54ce9ef81044131303255beda112c1750bd46e46c17749780808080a0ee3ef4e754b7044fbaf982f80b8ab4ea00503fe3ec4c50fd7864e81ce1e6c4408080a075fb4f68ac224ec54d38eee3bd972654ca5ee1833530f0ebefd71a9f49cf09f1a05c099f09257a656d98101ccd60d3fbe861cb889f9699b8eed136268028021b70a0b90a5365f3205e9df1129eecaa73667c4d2c567f1ab45f63860c3671b46dc27780a0e38b7963499d1bbde43a95289356e98e19cdc1e21e10e097e1490f15e3662e0ba0ce536ccc69891fc11f58ebaa1a9f09bd1644af223c17493de3fa30e6e39f6845a052fe3bf973b9ff06f119a91481e15215c3eccadc584ce8b6e7a05ea68c73054180", + "0xf8669d3d676334b26bbb561def1bb646db346a0ea5f7c4f069e5ce4083818685b846f8440180a011a7fd82551848c90631f70de7f85bbc1fb9cce3618351c58eef7d86c6e6535da0aad43333d28e146557f1c682e8a4226743fb231fdd00a577512233bd9e920008", + ], + "0x11a7fd82551848c90631f70de7f85bbc1fb9cce3618351c58eef7d86c6e6535d", + ["0x000000000000000000000000000000000000000000000000000000000000000b"], + [ + [ + "0xf90211a024523ab4c6860ddc65f3ee25893718ba117b0b64fa1a344b7f05424044422180a0ed987ec06cf1e724fb46f50e02e985eb14aa3de446a026be814cd2c240ab7884a01f37fe3602f2e817c85a42347aeb852d144d5df315f7ea19e5b946ec41e7710ca007818b958a696e024231c8bbc1940ab6f624063ae6536e78d4e751ace5ba3654a08a2d4ae213e6cd7da762e2a310a4b416794015af976c0df934700d67dcb6bb7da09b8c976db3807d89073d4ece4a434f2fb407dd7babc3d60557d7a6413397cd12a018ee334d7d36b3ec14e7fbe17cb2cc8827327961e20474b07b2d755fb60472eba086fd6918693e8bfec3a0b0b8963d88cca3bb1ff3f40058dcf5e0b8e12ebda780a08a57aa735f5e901686d294bb6a9f0af015bfa37a14e47df442043c55b29478afa0c5fdbed2d6f87128f683e845163c29abebd0fccc8720261233cd1739d8999bb8a0c667f820b9056acb0650bbb3da4fb5c829bb9ea3d58d65ab8e87cfaf689eb274a0110aca3b49ff8a7fc3d60295d0c18602e576427a02907986d3fcdec5c8406607a0e0a2958a4e2e8eb16e37ad795e02d8ea636266b4ea3f4e064a4da9ef1ee8f47aa076561dfa2df8680a70d7f949548502001363378d71e9102b2dc5f6bb8b48b328a0173421253267ac8dacdd78bb3a49e4e68ce44c987335e7e22e2067f5998ccc8ba0ddb9469be4af0c764ae2984533a34b6ac6ad4535a7bf773d1bdcaba414288d4e80", + "0xf90211a0134f748fc5e8562c4037bb335c253e159c2d3c7a1dc48b1e006fee1ffcc63874a0dcad9ec65f0b0b3e3d265b468ceda4c2626bea957ba6dd0f25e91d8f43615dcba0b8fdad766b78548db43d60da964d1abdd784ae56bd9ad9dd5ce7911beadab941a01db88587d7758f452204d265122d451f416f29219de91d8f1fd98b4695ad56f8a06464403607b9759cf6cb0e1bdd58d3a231ece185267c59d0113836bbce312007a0a23247953c05226318750e90668afd8b8f4a308f1f3e5573f92c03cd4fa9cc99a0ec186ad6ea36e64969fac78982f9ddd2c78f01fb5f059afc8d9253cafb348272a00e259709d156973caac69a52dbde1569f0ea9fc58cc9333b6fff01bed4ced9c3a01f76d216b1d1f75ebdcece38a62dc6d85cf090cec0b17ea8fe4a2fbadf02e418a0a44e06aa48e8e2b81b82ac7a55d10e0e75fb0016475f40b4b2b199016fefef11a04e31f7d98493c4af332a55a088d75bd53a55d37feee0fb4ea4bb89bd6cf1189da01fe39db746e4eef3572d1863d2edf73ef178986a33929a353e30d5a5459cffb7a0c64a8a52d3dfb4c33e5eac53820c25604e4c8f34062e2f31a00ada4c4e8ac794a0ffc8acff839a16fefe9f3018b315c00a5d49b051bf7be70f35c452103e78dd6fa0c371630f7af67645f11a19b70a01e20284fd2c3afa8ad5e72fa939e775090b94a026173df7a5906e6d3ff8ee4f6467dfb731e50961f6d65546a4e6cd3efeaa509a80", + "0xf90211a046660614c4b352e38c7a40b3fbacf123b88d343407c60aa3df2fc14e5c57667ea0f326e8d140b8c178ef04d4af3f9435159ad3c3cc9029a24daced2a2e5a7edadba04beaf51b9e686b2e9a3cb11906ac2c2b975a1f2b21fae6345baa832716d08904a00d9c648844e04c5a20d669382e429a02691b92a9ed51346e9e6b4c3e11950c51a0116e5123177580be67dfd0beaa66ff0aaad0d390afa05246c44dc8de9736c21ea0c566c23ca1b65aec125de0d781343787ae3f1037793af3d12e976ebc26b25d82a0ecc286af188cbb0d2f91980a6547e9c21d31e436f362565998d38063cb8e4a43a0161332b061fd1ae44a9cc9a7ee560b1f416a75f723df1d4607487149f0a6ef98a0ce4de6144c942d8cb5180aad406ac42934f039bafe6a7b1fba6094b104e3ed01a088da9aca558d0c51ce0fb208ab108b143e0a5122bcd5bd85c35e09b39a67a7ada0b24c5e971bdcc7151c89d69c0046c899379fcb9fd479d2b8a05df7348f08e4bda0bdb15b37b990be1e658ede5ed0e556d73fca185489124cad494721bd0c9dc79da0279294696fab46dcb10b5069d1929b96500342e6609fc85b5c242ebfd6dee280a02b3df2dfda83841f27315d0dcd3025dce8ee53425de4ccea153dd8f9893b65d6a07b3b6cb9b2148a7086adc24501672da8b0fc348a1fa78051ebb603f337f68de8a025f98ef38ab7bbaf176f7284ff1548b7638d013f817fd84979061507c4cb3f8080", + "0xf90211a0817f0522b611763caedae0abdbf8a7d1fc523cc759bc6dd400d8837d94587832a0ecd37fcea2b496aeb18f74786fc7aeda2ea78bfb55cf27a829b69c4d15e2525ca019a27a34379a6a5dcd5a1cb8fdc5b7351b40eeb3f4e7d09db2daaf688e7a11b8a02339835ad35c836c7c9b1fd17f8ef9aa377a9e458316252ac63efe702fd895bda08e96214ae9077f46f6d2a440af91126a5bf62732edd0dc513efadba4b956fe9ea026370016e564a879e26f01a077e73badcca1551a92a05571e86d07af2a049493a0fab6a8b576dbf710ba642f849c36ab54ed462ac0f8e3593ad6d25af4e6f23677a06ed7fc714f359a29a6bd13c1a804fc6a19938f46c377fc97e787706dc8da0e58a0c0d3305cf25baab40da08bb2c141d0984d60afc353c4d0e708fed92fb2239460a057cdd07f66b3a31f01079d3933ee6a4fd5280ba7abec7c9bc1404ccca5224d9aa0ab9e1abf9a0bfd89d1483448ec555a10d7956b434787ae6c55605ce4c3fbb3e5a0d9d5c4782ba8bceaf3887b440321190898df7ce785679dcc628516de02069a17a05565679c56603a5614f90447648485ba6f3e324df4845af69482209fcc620156a09e4205f6a5c8e633cb7e5048148675d7aef4030de17d81e6d8e5a3e5f5b77a8ba0b995d98c91905fa0e083455afe9d4219e4f040c6e3bdf948b139a8d12b192157a05ed2de5e483fa16f32c9d56979082e36c77c1102e12020136172dfed9c85d28880", + "0xf90131a0d56f8e12a9254f3fab9b7c5cb9e917dbc2540b1fa8e14f22840257d30c47adbfa0bcf412e2dcc182720eb7a6d3b260488603cefcdc206815beeea0b4700adb9e46808080a0ba844e9671269f0a8ab47cd42fc59e9ff5077adfa3c400e243146fcb708f4e5da0d1e9012aff863e29b5c2b7111ed41b55669bc3bd70aafd9302247c9a71176550a03f9b33fa55d938ae9dd41dfed6b17fc52327d20a2503c8e5d85a2f401a0e6ea380a0d4947649b148740ce5687696c87bb07217543329c73f7bb8900f1140b1563f3ca0c41116acc085e1d1b88f0998eacf59cc10a4646e9ffc4428b221c00ec5b1f4cca08c6b7c02a459200f13e8b385d3dcb998ec8f9c03cc1b7c8b3a5e753d5a65364880a09dc8cbc03d181ee816de24c1baeaa398a7b98e5f33e730011505e8496e74fefd808080", + "0xe79e37a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db98786b56d157e7f5a", + ], + ], +] + +export const RECEIPT_PROOF = [ + 10, + 127308333, + "0xf90244a0f9ff0f83514b39d941c5b84e2f4f34b92e766bdc61de08a76dc9b14a71e73222a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0f1b09fb679e6b75e3169883ee999c4e4d3cd4bf95c6572e00ce730a2b732d711a02869278b132da65669ef8dd5a59e1cafb19432e63dd89b53ea61212d97cced4ea03204fb2c7f9acb8cf2af0c7feeff761af2e86b687b42118a458a9810472ab2a7b90100125b78c6f047983080c109c20003600080822088020460090f1ce4046c88533b0d0808083704d04840000072020c3324a15d404152906612503801016a6342cd0c40114c25c820cab225122d4054688a52a884101149061e116482455810080108a9030b62168280154002410082189003201c05237886e405451816294c4018cd24850788000608e011834c88001a281941b606cc3009402834280c0e804c1082108360108598ca8010614a111404202ed102208548408e00d0800018084124c230307608028494aa2903a60443410d90c0719000d4a3090102008e022060a603386ca14471050e298480116802316262182014708880488002b240005501e880840796922d840393870084018c3555846720fe1380a0be75f63a0e2efb12310fb91829a5b2252a882e508a674d7cb8c72eccb62a415688000000000000000082017ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a0f0c257dfdcaf31ff962d00afaf90878fc0d01699b610ae334650a942eb716de0", + 0, + [], + [ + "0xf851a043d1a97a67ace1b4fcf400c97b64833e363f929339269b5f08316efe15bb744280808080808080a0c6671ab0c8145b7e995558f60b59fc3ab0afd34db7ba64c70268da26e6f652078080808080808080", + "0xf901f180a022532ca66e2a83977e663b41605e7e2df76bc896e12fc53dce0c5b95ed7f4367a0fd882e481b284515091c4eace0556fd4bf36261a282c4dbe14a9813af1a73504a04b64fbdf1b5db465262c0c4a07d8d1a69034fff72db3e02d6661743522b7c7d7a0f3e1c56f139f509c3bd8cc1546737d231ee006b4f760f9d754b1ce80b64ceb31a0095b2d77ffa53c424fe4cdaf377d3bea5129bc21e95046f267b0d429bf112405a0156430f22abbf89c225643a24d9a97a7fe5832d15df48ec934f56a5860431a8aa040c1f34f5f45ff6d5a717795fc90d520d5080994a10fc487af7a60557b367c5ca0dd8bd9a505b52c9249dc171eea453972bc5261f876553296c8a6186c20f4143da075f0a228baf7eea3111db5ca77d9901bd99109fa3c0d8d3c0e53280ea92e8ec7a0676127922e8aa2da69ca3fd4802d559275d6fd4f5f51f86801e0fcdbc65cdc0ea0e1af98a5d5db3b2b9beb67e7fe333e669b8bc7c73cac1b6c3f96d68670d87422a06ac3e127bdadf66bd1352a7666934c3ab258bb4483f2d9c285aeec2012fed133a0e64c4cb299540f0ca821a86fa4d0ffdd17ef4f997ad121ebec941cedaf2c9390a0977a40d5cb87002b9d8dbaf25667b3b0dd1bd089b49e6c5de4edc7fd2b45cf5fa064756251d84bca534b9408b1c3b5ed3b415bb06e52ac01d37b6c205ff54e7f4380", + "0xf90ad720b90ad302f90acf01832fce87b9010000010000000400000000010000020000800000000000400100000000000000000000000000000000000000400000000000000000000000000000000000000000000010002400000000200000000000000000000010010008004000000000000000000200000000800500000000000000000008000100000000000000000000000800010000000200000000000000000008000002000000000000000004000000000080001000080800100000000000000000000000004000000000000000000000100004000000000000000000000000000000000000200000000080020000000010080000010008000000000800100060000000000000000000000000100000f909c4f85a94a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0bf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0bf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000009aa56119ab6bf672e22eea5c4735446101bd46d8f87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0ba000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000009aa56119ab6bf672e22eea5c4735446101bd46d80000000000000000000000000000000000000000000000000000000000000001f85a94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000007388755e0a5b867f30168ea89f2d42db2d5cb918f87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000b981b2c0c3db52c316d30df76cc48fd167ed87eda000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000007388755e0a5b867f30168ea89f2d42db2d5cb9180000000000000000000000000000000000000000000000000000000000000001f85a94ca71fa74c9682518ff2489b902648e6c2745573bf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94ca71fa74c9682518ff2489b902648e6c2745573bf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c2260000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e44a29d8d2197e80085986953d52566d10eaacacf87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000ca71fa74c9682518ff2489b902648e6c2745573ba000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab840000000000000000000000000e44a29d8d2197e80085986953d52566d10eaacac0000000000000000000000000000000000000000000000000000000000000001f85a94de8507bb18616ce211638fb898e452f5486b916ef842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94de8507bb18616ce211638fb898e452f5486b916ef842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000007e1306f8adf9125b3795dfefff35c1a80be5ebeef87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000de8507bb18616ce211638fb898e452f5486b916ea000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000007e1306f8adf9125b3795dfefff35c1a80be5ebee0000000000000000000000000000000000000000000000000000000000000001", + ], + "0x0b", + 4, +] + +export const RECEIPT_PROOF_WITH_ANCESTRAL_BLOCKS = [ + 10, + 127308335, + "0xf90244a0f9ff0f83514b39d941c5b84e2f4f34b92e766bdc61de08a76dc9b14a71e73222a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0f1b09fb679e6b75e3169883ee999c4e4d3cd4bf95c6572e00ce730a2b732d711a02869278b132da65669ef8dd5a59e1cafb19432e63dd89b53ea61212d97cced4ea03204fb2c7f9acb8cf2af0c7feeff761af2e86b687b42118a458a9810472ab2a7b90100125b78c6f047983080c109c20003600080822088020460090f1ce4046c88533b0d0808083704d04840000072020c3324a15d404152906612503801016a6342cd0c40114c25c820cab225122d4054688a52a884101149061e116482455810080108a9030b62168280154002410082189003201c05237886e405451816294c4018cd24850788000608e011834c88001a281941b606cc3009402834280c0e804c1082108360108598ca8010614a111404202ed102208548408e00d0800018084124c230307608028494aa2903a60443410d90c0719000d4a3090102008e022060a603386ca14471050e298480116802316262182014708880488002b240005501e880840796922d840393870084018c3555846720fe1380a0be75f63a0e2efb12310fb91829a5b2252a882e508a674d7cb8c72eccb62a415688000000000000000082017ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a0f0c257dfdcaf31ff962d00afaf90878fc0d01699b610ae334650a942eb716de0", + 127308333, + [ + "0xf90243a022ef9f3b6de56c390b6aa60af3a69efa6283013b48ba65f84b842efd81c795cda01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0573e5347ae1934b3d87f0b0abb5fa7ba1e64daa8331dffc42c549a7f86267913a051b95694234d89f8852948e67c48219d98e3486cd24504bf68918a3f27a38db5a08f2e7015a1e594748121c2ce275fe4c1e6a31488de7c984364ab3f1db6944804b9010040103002508400010000108032084000b0010008008400000d44000044800100050800002500000800082014008431802054004000800208964000205060400002001882240828824000201854580141008020011008000c00400010a81000051028010806040000150000000100083080004d00094d0000110400120c0109680820210108022204602102220001ca0209009001802108000000000c1e181010820000200000108c0110002000000c00208000800000002b40870040200000c040000806100200012000080600420080c0010000008843080000c01a080020012f14088100a50400280401010800112060a004051482824a940080440009090080840796922f840393870083511824846720fe1780a0be75f63a0e2efb12310fb91829a5b2252a882e508a674d7cb8c72eccb62a415688000000000000000082017ea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a0f0c257dfdcaf31ff962d00afaf90878fc0d01699b610ae334650a942eb716de0", + "0xf90243a04a95d1ff4f70678c282ef4c88aee8627798dc6957726bb27b16bf206875b5b7ea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0eda007055506b2d0c4e7e3333c05a6cc07d433425606c163bfc8ca33dd2cabeca09236870951e634d20841ad1b82613012729b6d2c99eeeba50a3c390111885c63a09301f89f2be69464c74b68a0cbb2c5d30a72f85a5e0518220a045eb62d83ef38b9010000400002400600c25180009000000201800060000084020024040008040000100100000c01000008c420901000110000044200400420210090000100036040c108421008040000882001150851400005000004049049001c0042000282200005882401080600800015c0108001000802001008000140060002400010000900000800092e0a000200000100000000020048880001a820080400001828248081000200880054000208001000048040148000a0880100400000000000000010000440001807480208028000200200020000828000000000000003080002000420001510888000510000000002410000100070859104040080400c0080404005000880840796922e8403938700833e3034846720fe1580a0be75f63a0e2efb12310fb91829a5b2252a882e508a674d7cb8c72eccb62a415688000000000000000082017ea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a0f0c257dfdcaf31ff962d00afaf90878fc0d01699b610ae334650a942eb716de0", + "0xf90244a0f9ff0f83514b39d941c5b84e2f4f34b92e766bdc61de08a76dc9b14a71e73222a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347944200000000000000000000000000000000000011a0f1b09fb679e6b75e3169883ee999c4e4d3cd4bf95c6572e00ce730a2b732d711a02869278b132da65669ef8dd5a59e1cafb19432e63dd89b53ea61212d97cced4ea03204fb2c7f9acb8cf2af0c7feeff761af2e86b687b42118a458a9810472ab2a7b90100125b78c6f047983080c109c20003600080822088020460090f1ce4046c88533b0d0808083704d04840000072020c3324a15d404152906612503801016a6342cd0c40114c25c820cab225122d4054688a52a884101149061e116482455810080108a9030b62168280154002410082189003201c05237886e405451816294c4018cd24850788000608e011834c88001a281941b606cc3009402834280c0e804c1082108360108598ca8010614a111404202ed102208548408e00d0800018084124c230307608028494aa2903a60443410d90c0719000d4a3090102008e022060a603386ca14471050e298480116802316262182014708880488002b240005501e880840796922d840393870084018c3555846720fe1380a0be75f63a0e2efb12310fb91829a5b2252a882e508a674d7cb8c72eccb62a415688000000000000000082017ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a0f0c257dfdcaf31ff962d00afaf90878fc0d01699b610ae334650a942eb716de0", + ], + [ + "0xf851a043d1a97a67ace1b4fcf400c97b64833e363f929339269b5f08316efe15bb744280808080808080a0c6671ab0c8145b7e995558f60b59fc3ab0afd34db7ba64c70268da26e6f652078080808080808080", + "0xf901f180a022532ca66e2a83977e663b41605e7e2df76bc896e12fc53dce0c5b95ed7f4367a0fd882e481b284515091c4eace0556fd4bf36261a282c4dbe14a9813af1a73504a04b64fbdf1b5db465262c0c4a07d8d1a69034fff72db3e02d6661743522b7c7d7a0f3e1c56f139f509c3bd8cc1546737d231ee006b4f760f9d754b1ce80b64ceb31a0095b2d77ffa53c424fe4cdaf377d3bea5129bc21e95046f267b0d429bf112405a0156430f22abbf89c225643a24d9a97a7fe5832d15df48ec934f56a5860431a8aa040c1f34f5f45ff6d5a717795fc90d520d5080994a10fc487af7a60557b367c5ca0dd8bd9a505b52c9249dc171eea453972bc5261f876553296c8a6186c20f4143da075f0a228baf7eea3111db5ca77d9901bd99109fa3c0d8d3c0e53280ea92e8ec7a0676127922e8aa2da69ca3fd4802d559275d6fd4f5f51f86801e0fcdbc65cdc0ea0e1af98a5d5db3b2b9beb67e7fe333e669b8bc7c73cac1b6c3f96d68670d87422a06ac3e127bdadf66bd1352a7666934c3ab258bb4483f2d9c285aeec2012fed133a0e64c4cb299540f0ca821a86fa4d0ffdd17ef4f997ad121ebec941cedaf2c9390a0977a40d5cb87002b9d8dbaf25667b3b0dd1bd089b49e6c5de4edc7fd2b45cf5fa064756251d84bca534b9408b1c3b5ed3b415bb06e52ac01d37b6c205ff54e7f4380", + "0xf90ad720b90ad302f90acf01832fce87b9010000010000000400000000010000020000800000000000400100000000000000000000000000000000000000400000000000000000000000000000000000000000000010002400000000200000000000000000000010010008004000000000000000000200000000800500000000000000000008000100000000000000000000000800010000000200000000000000000008000002000000000000000004000000000080001000080800100000000000000000000000004000000000000000000000100004000000000000000000000000000000000000200000000080020000000010080000010008000000000800100060000000000000000000000000100000f909c4f85a94a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0bf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0bf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000009aa56119ab6bf672e22eea5c4735446101bd46d8f87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000a8d3c1e744fcc68c893a32a9f19a49d5bc76fd0ba000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000009aa56119ab6bf672e22eea5c4735446101bd46d80000000000000000000000000000000000000000000000000000000000000001f85a94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94b981b2c0c3db52c316d30df76cc48fd167ed87edf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000007388755e0a5b867f30168ea89f2d42db2d5cb918f87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000b981b2c0c3db52c316d30df76cc48fd167ed87eda000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000007388755e0a5b867f30168ea89f2d42db2d5cb9180000000000000000000000000000000000000000000000000000000000000001f85a94ca71fa74c9682518ff2489b902648e6c2745573bf842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94ca71fa74c9682518ff2489b902648e6c2745573bf842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c2260000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e44a29d8d2197e80085986953d52566d10eaacacf87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000ca71fa74c9682518ff2489b902648e6c2745573ba000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab840000000000000000000000000e44a29d8d2197e80085986953d52566d10eaacac0000000000000000000000000000000000000000000000000000000000000001f85a94de8507bb18616ce211638fb898e452f5486b916ef842a0ecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f8440a000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22680f9011b94de8507bb18616ce211638fb898e452f5486b916ef842a0141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8a00000000000000000000000004e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67b8c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b4700000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000000000010000000000000000000000007e1306f8adf9125b3795dfefff35c1a80be5ebeef87a944e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67f842a04f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e235a0000000000000000000000000de8507bb18616ce211638fb898e452f5486b916ea000000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762f8799424f6f36a551fe6008fa80afcff1d6ace182ead2be1a0db3dd2da8ea81566d4f4c29c152977ba57d38e7eed4b61fb95dfaceb177409bab8400000000000000000000000007e1306f8adf9125b3795dfefff35c1a80be5ebee0000000000000000000000000000000000000000000000000000000000000001", + ], + "0x0b", + 4, +] diff --git a/packages/rpc/README.md b/packages/rpc/README.md index 2c82e9ee..d0ebbf0c 100644 --- a/packages/rpc/README.md +++ b/packages/rpc/README.md @@ -65,4 +65,4 @@ To stop the running container: ```sh docker stop [CONTAINER_ID or CONTAINER_NAME] -``` \ No newline at end of file +``` diff --git a/packages/rpc/package.json b/packages/rpc/package.json index 65404eda..162be7fc 100644 --- a/packages/rpc/package.json +++ b/packages/rpc/package.json @@ -15,6 +15,7 @@ "@ethereumjs/block": "^5.3.0", "@ethereumjs/common": "^4.4.0", "@ethereumjs/rlp": "^5.0.2", + "@ethereumjs/trie": "^6.0.1", "@ethereumjs/util": "^9.0.3", "@gnosis/hashi-common": "0.1.0", "body-parser": "^1.20.2", diff --git a/packages/rpc/src/index.ts b/packages/rpc/src/index.ts index be4da8b7..7169dc5a 100644 --- a/packages/rpc/src/index.ts +++ b/packages/rpc/src/index.ts @@ -6,11 +6,13 @@ import { logger } from "@gnosis/hashi-common" import logMiddleware from "./middlewares/log" import getAccountAndStorageProof from "./methods/get-account-and-storage-proof" +import getReceiptProof from "./methods/get-receipt-proof" import { Methods } from "./methods/types" const start = async () => { const server: TypedJSONRPCServer = new JSONRPCServer() server.addMethod("hashi_getAccountAndStorageProof", getAccountAndStorageProof) + server.addMethod("hashi_getReceiptProof", getReceiptProof) server.applyMiddleware(logMiddleware) const app = express() diff --git a/packages/rpc/src/methods/get-account-and-storage-proof.ts b/packages/rpc/src/methods/get-account-and-storage-proof.ts index c539fb8d..186646bb 100644 --- a/packages/rpc/src/methods/get-account-and-storage-proof.ts +++ b/packages/rpc/src/methods/get-account-and-storage-proof.ts @@ -1,66 +1,13 @@ import "dotenv/config" import { ethers } from "ethers" import { logger } from "@gnosis/hashi-common" -import { BlockHeader, JsonRpcBlock } from "@ethereumjs/block" -import { Common, Hardfork } from "@ethereumjs/common" -import { RLP } from "@ethereumjs/rlp" -import { - bigIntToHex, - bytesToHex, - intToHex, -} from "@ethereumjs/util" +import { BlockHeader } from "@ethereumjs/block" +import { bigIntToHex, bytesToHex, intToHex } from "@ethereumjs/util" -import { GetAccountAndStorageProofParams, GetAccountAndStorageProofResponse } from "../types" - -export function blockHeaderFromRpc(_block: JsonRpcBlock) { - const { - parentHash, - sha3Uncles, - miner, - stateRoot, - transactionsRoot, - receiptsRoot, - logsBloom, - difficulty, - number, - gasLimit, - gasUsed, - timestamp, - extraData, - mixHash, - nonce, - baseFeePerGas, - withdrawalsRoot, - blobGasUsed, - excessBlobGas, - parentBeaconBlockRoot, - requestsRoot, - } = _block +import { blockHeaderFromRpc } from "../utils/block" +import getCommon from "../utils/common" - return { - parentHash, - uncleHash: sha3Uncles, - coinbase: miner, - stateRoot, - transactionsTrie: transactionsRoot, - receiptTrie: receiptsRoot, - logsBloom, - difficulty, - number, - gasLimit, - gasUsed, - timestamp, - extraData, - mixHash, - nonce, - baseFeePerGas, - withdrawalsRoot, - blobGasUsed, - excessBlobGas, - parentBeaconBlockRoot, - requestsRoot, - } -} +import { GetAccountAndStorageProofParams, GetAccountAndStorageProofResponse } from "../types" const getAccountAndStorageProof = async ({ address, @@ -72,19 +19,10 @@ const getAccountAndStorageProof = async ({ try { const rpcUrl = process.env[`JSON_RPC_URL_${chainId}`] if (!rpcUrl) throw new Error("Chain not supported") + const provider = new ethers.JsonRpcProvider(rpcUrl) - const common = Common.custom( - { - chainId, - }, - { - hardfork: Hardfork.Cancun, - eips: [1559, 4895, 4844, 4788], - }, - ) + const common = getCommon(chainId) - const provider = new ethers.JsonRpcProvider(rpcUrl) - const [proof, block] = await Promise.all([ provider.send("eth_getProof", [address, storageKeys, bigIntToHex(BigInt(ancestralBlockNumber || blockNumber))]), provider.send("eth_getBlockByNumber", [intToHex(blockNumber), false]), @@ -115,12 +53,10 @@ const getAccountAndStorageProof = async ({ ancestralBlockNumber, ancestralBlockHeaders, address, - bytesToHex(RLP.encode(proof.accountProof.map((_sibling: string) => RLP.decode(_sibling)))), + proof.accountProof, proof.storageHash, proof.storageProof.map(({ key }: any) => key), - proof.storageProof.map(({ proof: storageProof }: any) => - bytesToHex(RLP.encode(storageProof.map((_sibling: string) => RLP.decode(_sibling)))), - ), + proof.storageProof.map(({ proof: storageProof }: any) => storageProof), ], } as GetAccountAndStorageProofResponse } catch (_err) { diff --git a/packages/rpc/src/methods/get-receipt-proof.ts b/packages/rpc/src/methods/get-receipt-proof.ts new file mode 100644 index 00000000..6325fc0a --- /dev/null +++ b/packages/rpc/src/methods/get-receipt-proof.ts @@ -0,0 +1,126 @@ +import "dotenv/config" +import { ethers, Log } from "ethers" +import { logger } from "@gnosis/hashi-common" +import { Trie } from "@ethereumjs/trie" +import { bytesToHex, concatBytes, hexToBigInt, hexToBytes, intToBytes, bytesToInt, intToHex } from "@ethereumjs/util" +import { RLP } from "@ethereumjs/rlp" +import { BlockHeader } from "@ethereumjs/block" + +import { blockHeaderFromRpc } from "../utils/block" +import getCommon from "../utils/common" + +import { GetReceiptProofParams, GetReceiptProofResponse } from "../types" + +const encodeIndex = (_index: `0x${string}`) => + _index === "0x0" ? RLP.encode(Buffer.alloc(0)) : RLP.encode(bytesToInt(hexToBytes(_index ?? "0x0"))) + +const getReceiptProof = async ({ logIndex, blockNumber, chainId, transactionHash }: GetReceiptProofParams) => { + try { + const rpcUrl = process.env[`JSON_RPC_URL_${chainId}`] + if (!rpcUrl) throw new Error("Chain not supported") + const provider = new ethers.JsonRpcProvider(rpcUrl) + + const common = getCommon(chainId) + + const targetTransactionReceipt = await provider.send("eth_getTransactionReceipt", [transactionHash]) + if (!targetTransactionReceipt) throw new Error("Receipt not found") + + const hexLogIndex = intToHex(logIndex) + const log = targetTransactionReceipt.logs.find((_log: any) => _log.logIndex === hexLogIndex) + + if (!log) throw new Error(`Log ${logIndex} not found within the specified transaction`) + const effectiveLogIndex = targetTransactionReceipt.logs.findIndex((_log: any) => _log.logIndex === hexLogIndex) + + const blockContainingLog = await provider.send("eth_getBlockByHash", [targetTransactionReceipt.blockHash, true]) + const blockHeader = BlockHeader.fromHeaderData(blockHeaderFromRpc(blockContainingLog), { common }) + const blockContainingLogNumber = Number(hexToBigInt(blockContainingLog.number)) + if (blockNumber && blockNumber <= blockContainingLogNumber) + throw new Error("blockNumber must be greater than transaction.blockNumber") + + let receipts = [] + for (const transaction of blockContainingLog.transactions) { + receipts.push(await provider.send("eth_getTransactionReceipt", [transaction.hash])) + } + + const encodedReceipts = receipts.map((_receipt, _index) => { + let type = Number(hexToBigInt(_receipt.type)) + if (type === 126) { + // Optimism DepositTxType + const encoded = RLP.encode([ + _receipt.status === "0x1" ? "0x1" : "0x", + _receipt.cumulativeGasUsed, + _receipt.logsBloom, + _receipt.logs.map((_log: Log) => { + return [_log.address, _log.topics, _log.data] + }), + _receipt.depositNonce, + _receipt.depositReceiptVersion, + ]) + return concatBytes(intToBytes(126), encoded) + } + + const encoded = RLP.encode([ + _receipt.status === "0x1" ? hexToBytes("0x01") : Uint8Array.from([]), + hexToBytes(_receipt.cumulativeGasUsed), + hexToBytes(_receipt.logsBloom), + _receipt.logs.map((_log: Log) => { + return [hexToBytes(_log.address), _log.topics.map(hexToBytes), hexToBytes(_log.data)] + }), + ]) + if (type === 0) return encoded + return concatBytes(intToBytes(type), encoded) + }) + + const trie = new Trie() + await Promise.all( + receipts.map((_receipt, _index) => trie.put(encodeIndex(_receipt.transactionIndex), encodedReceipts[_index])), + ) + + // + const root = bytesToHex(trie.root()) + if (root !== blockContainingLog.receiptsRoot) { + throw Error("The trie.root() and blockContainingLog.receiptsRoot do not match") + } + + // If a blockNumber is specified, we need to retrieve the chain from blockNumber to blockContainingLog.number, as this indicates that + // Hashi has the block number, and the block where the transaction occurred is an ancestor of blockNumber. + let ancestralBlockHeaders = [] as `0x${string}`[] + if (blockNumber) { + let ancestralBlockNumber = Number(hexToBigInt(blockContainingLog.number)) + if (ancestralBlockNumber >= blockNumber) throw new Error("Invalid ancestral blockContainingLog number") + + const blockNumbers = [...Array(blockNumber - ancestralBlockNumber + 1).keys()].map( + (num) => num + ancestralBlockNumber, + ) + ancestralBlockHeaders = ( + await Promise.all( + blockNumbers.map((_blockNumber) => provider.send("eth_getBlockByNumber", [intToHex(_blockNumber), false])), + ) + ) + .map((_block) => bytesToHex(BlockHeader.fromHeaderData(blockHeaderFromRpc(_block), { common }).serialize())) + .reverse() + } + + const receiptKey = encodeIndex(targetTransactionReceipt!.transactionIndex) + const proof = await trie.createProof(receiptKey) + + console.log(log) + return { + proof: [ + chainId, + blockNumber ? blockNumber : blockContainingLogNumber, + bytesToHex(blockHeader.serialize()), + blockNumber ? blockContainingLogNumber : 0, + ancestralBlockHeaders, + proof.map(bytesToHex), + bytesToHex(encodeIndex(targetTransactionReceipt.transactionIndex)), + effectiveLogIndex, + ], + } as GetReceiptProofResponse + } catch (_err) { + logger.error(_err) + throw _err + } +} + +export default getReceiptProof diff --git a/packages/rpc/src/methods/types.ts b/packages/rpc/src/methods/types.ts index 20499eee..1643b1c9 100644 --- a/packages/rpc/src/methods/types.ts +++ b/packages/rpc/src/methods/types.ts @@ -1,5 +1,11 @@ -import { GetAccountAndStorageProofParams, GetAccountAndStorageProofResponse } from "../types" +import { + GetAccountAndStorageProofParams, + GetAccountAndStorageProofResponse, + GetReceiptProofParams, + GetReceiptProofResponse, +} from "../types" export type Methods = { hashi_getAccountAndStorageProof(params: GetAccountAndStorageProofParams): GetAccountAndStorageProofResponse + hashi_getReceiptProof(params: GetReceiptProofParams): GetReceiptProofResponse } diff --git a/packages/rpc/src/types/index.ts b/packages/rpc/src/types/index.ts index ec1af0a6..0113e3b6 100644 --- a/packages/rpc/src/types/index.ts +++ b/packages/rpc/src/types/index.ts @@ -11,6 +11,17 @@ export type AccountAndStorageProof = [ `0x${string}`, ] +export type ReceiptProof = [ + number, + number, + `0x${string}`, + number, + `0x${string}`[], + `0x${string}`[], + `0x${string}`, + number, +] + export type GetAccountAndStorageProofParams = { address: `0x${string}` ancestralBlockNumber?: number @@ -22,3 +33,14 @@ export type GetAccountAndStorageProofParams = { export type GetAccountAndStorageProofResponse = { proof: AccountAndStorageProof } + +export type GetReceiptProofParams = { + blockNumber: number + chainId: number + logIndex: number + transactionHash: `0x${string}` +} + +export type GetReceiptProofResponse = { + proof: ReceiptProof +} diff --git a/packages/rpc/src/utils/block.ts b/packages/rpc/src/utils/block.ts new file mode 100644 index 00000000..f825500a --- /dev/null +++ b/packages/rpc/src/utils/block.ts @@ -0,0 +1,51 @@ +import { JsonRpcBlock } from "@ethereumjs/block" + +export const blockHeaderFromRpc = (_block: JsonRpcBlock) => { + const { + parentHash, + sha3Uncles, + miner, + stateRoot, + transactionsRoot, + receiptsRoot, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + extraData, + mixHash, + nonce, + baseFeePerGas, + withdrawalsRoot, + blobGasUsed, + excessBlobGas, + parentBeaconBlockRoot, + requestsRoot, + } = _block + + return { + parentHash, + uncleHash: sha3Uncles, + coinbase: miner, + stateRoot, + transactionsTrie: transactionsRoot, + receiptTrie: receiptsRoot, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + extraData, + mixHash, + nonce, + baseFeePerGas, + withdrawalsRoot, + blobGasUsed, + excessBlobGas, + parentBeaconBlockRoot, + requestsRoot, + } +} diff --git a/packages/rpc/src/utils/common.ts b/packages/rpc/src/utils/common.ts new file mode 100644 index 00000000..96a75ac6 --- /dev/null +++ b/packages/rpc/src/utils/common.ts @@ -0,0 +1,16 @@ +import "dotenv/config" + +import { Common, Hardfork } from "@ethereumjs/common" + +const getCommon = (_chainId: number) => + Common.custom( + { + chainId: _chainId, + }, + { + hardfork: Hardfork.Cancun, + eips: [1559, 4895, 4844, 4788], + }, + ) + +export default getCommon diff --git a/patches/@eth-optimism+contracts-bedrock+0.17.3.patch b/patches/@eth-optimism+contracts-bedrock+0.17.3.patch new file mode 100644 index 00000000..33861219 --- /dev/null +++ b/patches/@eth-optimism+contracts-bedrock+0.17.3.patch @@ -0,0 +1,11 @@ +diff --git a/node_modules/@eth-optimism/contracts-bedrock/src/libraries/rlp/RLPErrors.sol b/node_modules/@eth-optimism/contracts-bedrock/src/libraries/rlp/RLPErrors.sol +index f7a9cdb..c2ce80a 100644 +--- a/node_modules/@eth-optimism/contracts-bedrock/src/libraries/rlp/RLPErrors.sol ++++ b/node_modules/@eth-optimism/contracts-bedrock/src/libraries/rlp/RLPErrors.sol +@@ -1,5 +1,5 @@ + // SPDX-License-Identifier: MIT +-pragma solidity 0.8.15; ++pragma solidity ^0.8.0; + + /// @notice The length of an RLP item must be greater than zero to be decodable + error EmptyItem(); diff --git a/yarn.lock b/yarn.lock index b81afe7c..38ee2126 100644 --- a/yarn.lock +++ b/yarn.lock @@ -321,6 +321,11 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2" integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q== +"@eth-optimism/contracts-bedrock@^0.17.3": + version "0.17.3" + resolved "https://registry.yarnpkg.com/@eth-optimism/contracts-bedrock/-/contracts-bedrock-0.17.3.tgz#ab3085e90d50e66ddbf07512ca1d666b5bab625b" + integrity sha512-cHPO7ntWeOBDLO7ZFFSZGI1D7CDqf4loRbRVJrFIsqLEz+hysWIqA0e3dv2GnrjVeuYePBfI2NTBEG4uwz9bQQ== + "@eth-optimism/contracts@0.6.0", "@eth-optimism/contracts@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@eth-optimism/contracts/-/contracts-0.6.0.tgz#15ae76222a9b4d958a550cafb1960923af613a31" @@ -390,7 +395,7 @@ resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-5.0.2.tgz#c89bd82f2f3bec248ab2d517ae25f5bbc4aac842" integrity sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA== -"@ethereumjs/trie@^6.2.1": +"@ethereumjs/trie@^6.0.1", "@ethereumjs/trie@^6.2.1": version "6.2.1" resolved "https://registry.yarnpkg.com/@ethereumjs/trie/-/trie-6.2.1.tgz#11d3e91ffd7d565f468a62c0e3d7952063991fa9" integrity sha512-MguABMVi/dPtgagK+SuY57rpXFP+Ghr2x+pBDy+e3VmMqUY+WGzFu1QWjBb5/iJ7lINk4CI2Uwsih07Nu9sTSg== @@ -5407,7 +5412,7 @@ parseurl@~1.3.3: resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== -patch-package@^8.0.0: +patch-package@8.0.0, patch-package@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-8.0.0.tgz#d191e2f1b6e06a4624a0116bcb88edd6714ede61" integrity sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==