diff --git a/CODEOWNERS b/CODEOWNERS index 269fcde7..fcd83a8f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,3 +1,2 @@ # CODEOWNERS: https://help.github.com/articles/about-codeowners/ -* @sept-en * @karim-en diff --git a/cli/index.js b/cli/index.js index 0bca6b41..2be6f803 100755 --- a/cli/index.js +++ b/cli/index.js @@ -37,7 +37,7 @@ const { } = require('rainbow-bridge-testing') const { ETHDump } = require('./commands/eth-dump') const { NearDump } = require('./commands/near-dump') -const { ethToNearFindProof } = require('rainbow-bridge-eth2near-block-relay') +const { ethToNearFindProof, ethToNearFindStorageProof } = require('rainbow-bridge-eth2near-block-relay') const { RainbowConfig } = require('rainbow-bridge-utils') const { UpdateDagMerkleRoots } = require('./commands/update-dag-merkle-roots') const { @@ -649,6 +649,18 @@ RainbowConfig.addOptions( ] ) +RainbowConfig.addOptions( + program + .command('eth-to-near-find-storage-proof ') + .description('Get eth-to-near storage proof for provided storage key.'), + async (contractAddress, storageKey, blockNumber, args) => { + await ethToNearFindStorageProof({ contractAddress, storageKey, blockNumber, ...args }) + }, + [ + 'eth-node-url' + ] +) + // Testing commands const testingCommand = program .command('TESTING') diff --git a/contracts/eth/nearbridge/.catalog-info.yaml b/contracts/eth/nearbridge/.catalog-info.yaml index 5ed91d74..e6b8ef06 100644 --- a/contracts/eth/nearbridge/.catalog-info.yaml +++ b/contracts/eth/nearbridge/.catalog-info.yaml @@ -20,6 +20,7 @@ spec: system: bridge-protocol deployedAt: - contract:ethereum/mainnet/0x88f975d5a1153ea92af66e7c4292576a329c04b6 + - contract:ethereum/goerli/0x6f2C9EbFB1e3Ff065E6725A715B458EF13206097 interactsWith: [] --- apiVersion: backstage.io/v1alpha1 @@ -43,6 +44,7 @@ spec: system: bridge-protocol deployedAt: - contract:ethereum/mainnet/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873 + - contract:ethereum/goerli/0x37c2d89b55bfd95532637554711441017efabfef interactsWith: - relayer:ethereum/mainnet/0x015e634c7c1311a9034220c28d3d12b7f710a3b1 deprecated: diff --git a/contracts/eth/nearprover/.catalog-info.yaml b/contracts/eth/nearprover/.catalog-info.yaml index b0192a9f..3ea84eb5 100644 --- a/contracts/eth/nearprover/.catalog-info.yaml +++ b/contracts/eth/nearprover/.catalog-info.yaml @@ -19,5 +19,6 @@ spec: system: bridge-protocol deployedAt: - contract:ethereum/mainnet/0x051ad3f020274910065dcb421629cd2e6e5b46c4 + - contract:ethereum/goerli/0xf3430be687dc5652e3e96a9a7b291b5d423dfc3b interactsWith: - contract:ethereum/mainnet/0x3be7df8db39996a837041bb8ee0dadf60f767038 diff --git a/contracts/near/Cargo.lock b/contracts/near/Cargo.lock index defde257..d52c6094 100644 --- a/contracts/near/Cargo.lock +++ b/contracts/near/Cargo.lock @@ -1133,6 +1133,7 @@ dependencies = [ "rlp-derive", "serde", "serde-big-array", + "sha3 0.10.8", "tree_hash", "tree_hash_derive", ] @@ -2018,9 +2019,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -2771,7 +2772,7 @@ dependencies = [ "ripemd", "serde", "sha2 0.10.6", - "sha3 0.10.6", + "sha3 0.9.1", "zeropool-bn", ] @@ -3924,9 +3925,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ "digest 0.10.6", "keccak", diff --git a/contracts/near/eth-client/.catalog-info.yaml b/contracts/near/eth-client/.catalog-info.yaml index c718efb1..85b25ff7 100644 --- a/contracts/near/eth-client/.catalog-info.yaml +++ b/contracts/near/eth-client/.catalog-info.yaml @@ -18,5 +18,6 @@ spec: deployedAt: - contract:near/mainnet/client.bridge.near - contract:near/mainnet/client-eth2.bridge.near + - contract:near/testnet/client-eth2.goerli.testnet interactsWith: - relayer:near/mainnet/relayer.bridge.near diff --git a/contracts/near/eth-prover/.catalog-info.yaml b/contracts/near/eth-prover/.catalog-info.yaml index f3128039..76e0bd9e 100644 --- a/contracts/near/eth-prover/.catalog-info.yaml +++ b/contracts/near/eth-prover/.catalog-info.yaml @@ -17,5 +17,7 @@ spec: system: bridge-protocol deployedAt: - contract:near/mainnet/prover.bridge.near + - contract:near/mainnet/prover_v2.bridge.near + - contract:near/testnet/prover.goerli.testnet interactsWith: - contract:near/mainnet/client.bridge.near diff --git a/contracts/near/eth-prover/Cargo.toml b/contracts/near/eth-prover/Cargo.toml index 238887c8..cde31403 100644 --- a/contracts/near/eth-prover/Cargo.toml +++ b/contracts/near/eth-prover/Cargo.toml @@ -18,7 +18,7 @@ rlp = "0.5.2" hex = "0.4.2" [dev-dependencies] -hex = "0.4.2" +hex = { version = "0.4.3", features = ["serde"] } indicatif = "0.14" lazy_static = "*" near-crypto = "0.16.0" diff --git a/contracts/near/eth-prover/README.md b/contracts/near/eth-prover/README.md new file mode 100644 index 00000000..6a3d0f7a --- /dev/null +++ b/contracts/near/eth-prover/README.md @@ -0,0 +1,28 @@ +# Eth-Prover + +Eth-Prover trustless contract to prove the integrity of data (proofs) provided by users and relayer trustlessly. + +## How To Generate Proofs:- + +- Pre-requisites before calling `eth_getProof` : + - DATA, 20 Bytes - address of the account. + - ARRAY, 32 Bytes - array of storage-keys which should be proofed and included. See eth_getStorageAt + - QUANTITY|TAG - integer block number, or the string "latest" or "earliest" + + +- To generate proofs one need to call RPC method `eth_getProof` [check-here](https://eips.ethereum.org/EIPS/eip-1186). + + + +## About Parameters of `verify_storage_proof` method :- + +- `header_data: Vec` : Rlp-Serilized Header data from RPC call to `eth_getBlockByNumber` [check here](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) +- `account_proof: Vec>`: Buffer data of account-proof from `eth_getProof` method call response. +- `contract_address: Vec`: Buffered data of Eth-contract address for which we are prooving. +- `expected_account_state: Vec`: encoded account state made-up of `{nonce, balance, storageHash, codeHash}` +- `storage_key_hash: Vec`: keccak256 of storage-key in `eth_getProof` +- `storage_proof: Vec>`: Buffer data of `storage-proof` for above `storage_key` from `eth_getProof` method call response. +- `expected_storage_value: Vec`: storage_value against which proof is to be verified. +- `min_header_height: Option`: Valid-till block height for unlock. +- `max_header_height: Option`: Currently set to None +- `skip_bridge_call: bool`: whether to make eth-client call or not. Always take false. \ No newline at end of file diff --git a/contracts/near/eth-prover/src/lib.rs b/contracts/near/eth-prover/src/lib.rs index 5b1b14bc..46e98532 100644 --- a/contracts/near/eth-prover/src/lib.rs +++ b/contracts/near/eth-prover/src/lib.rs @@ -138,6 +138,71 @@ impl EthProver { .into() } + /// WARNING: When the value is not found, `eth_getProof` will return "0x0" at + /// the StorageProof `value` field. In order to verify the proof of non + /// existence, you must set `value` to empty vec, *not* the RLP encoding of 0 or null + /// (which would be 0x80). + #[result_serializer(borsh)] + pub fn verify_storage_proof( + &self, + #[serializer(borsh)] header_data: Vec, + #[serializer(borsh)] account_proof: Vec>, // account proof + #[serializer(borsh)] contract_address: Vec, // eth address + #[serializer(borsh)] expected_account_state: Vec, // encoded account state + #[serializer(borsh)] storage_key_hash: Vec, // keccak256 of storage key + #[serializer(borsh)] storage_proof: Vec>, // storage proof + #[serializer(borsh)] expected_storage_value: Vec, // storage value + #[serializer(borsh)] min_header_height: Option, + #[serializer(borsh)] max_header_height: Option, + #[serializer(borsh)] skip_bridge_call: bool, + ) -> PromiseOrValue { + self.check_not_paused(PAUSE_VERIFY); + let header: BlockHeader = rlp::decode(header_data.as_slice()).unwrap(); + + if let Some(min_header_height) = min_header_height { + if header.number < min_header_height { + env::log_str(format!("Block height {} < Minimum header height {}", header.number, min_header_height).as_str()); + return PromiseOrValue::Value(false); + } + } + + if let Some(max_header_height) = max_header_height { + if header.number > max_header_height { + env::log_str(format!("Block height {} > Maximum header height {}", header.number, max_header_height).as_str()); + return PromiseOrValue::Value(false); + } + } + + let account_key = near_keccak256(&contract_address).to_vec(); + let account_state = Self::verify_trie_proof(header.state_root, account_key, account_proof); + if account_state != expected_account_state { + env::log_str("account_state != expected_account_state"); + return PromiseOrValue::Value(false); + } + + let storage_hash: H256 = Rlp::new(&account_state).val_at(2).unwrap(); + let storage_value = Self::verify_trie_proof(storage_hash, storage_key_hash, storage_proof); + if storage_value != expected_storage_value { + env::log_str("storage_value != expected_storage_value"); + return PromiseOrValue::Value(false); + } + + if skip_bridge_call { + return PromiseOrValue::Value(true); + } + + // Verify block header was in the bridge + eth_client::ext(self.bridge_smart_contract.parse().unwrap()) + .with_static_gas(BLOCK_HASH_SAFE_GAS) + .block_hash_safe(header.number) + .then( + remote_self::ext(env::current_account_id()) + .with_static_gas(ON_BLOCK_HASH_GAS) + .on_block_hash(header.hash.unwrap()), + ) + .into() + } + /// Verify the proof recursively traversing through the key. /// Return the value at the end of the key, in case the proof is valid. /// @@ -184,18 +249,23 @@ impl EthProver { if node.iter().count() == 17 { // Branch node - if key_index == key.len() { + if key_index >= key.len() { assert_eq!(proof_index + 1, proof.len()); get_vec(&node, 16) } else { let new_expected_root = get_vec(&node, key[key_index] as usize); - Self::_verify_trie_proof( - new_expected_root, - key, - proof, - key_index + 1, - proof_index + 1, - ) + if !new_expected_root.is_empty() { + Self::_verify_trie_proof( + new_expected_root, + key, + proof, + key_index + 1, + proof_index + 1, + ) + } else { + // not included in proof + vec![] + } } } else { // Leaf or extension node @@ -211,19 +281,23 @@ impl EthProver { if head % 2 == 1 { path.push(path_u8[0] % 16); } - for val in path_u8.into_iter().skip(1) { + for val in path_u8.iter().skip(1) { path.push(val / 16); path.push(val % 16); } - assert_eq!(path.as_slice(), &key[key_index..key_index + path.len()]); if head >= 2 { // Leaf node assert_eq!(proof_index + 1, proof.len()); assert_eq!(key_index + path.len(), key.len()); - get_vec(&node, 1) + if path.as_slice() == &key[key_index..key_index + path.len()] { + get_vec(&node, 1) + } else { + vec![] + } } else { // Extension node + assert_eq!(path.as_slice(), &key[key_index..key_index + path.len()]); let new_expected_root = get_vec(&node, 1); Self::_verify_trie_proof( new_expected_root, @@ -253,3 +327,4 @@ admin_controlled::impl_admin_controlled!(EthProver, paused); #[cfg(test)] mod tests; +mod tests_storage_proof; diff --git a/contracts/near/eth-prover/src/test_data/storageProof.json b/contracts/near/eth-prover/src/test_data/storageProof.json new file mode 100644 index 00000000..3a3f7cf1 --- /dev/null +++ b/contracts/near/eth-prover/src/test_data/storageProof.json @@ -0,0 +1,25 @@ +{ + "header_data": "f90217a02feb03d38518e6941c0852c64a9cc06be8f0caed9357d0c45136395110ef4540a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794388ea662ef2c223ec0b047d41bf3c0f362142ad5a035630b01ab13a7f864f9c86f2a2d7ac497320594f92c5868e17063260beba833a083c4eeccb9dad0f16ca684785dd347c70e3c35573ebb38b6db5550d5e2eb2039a0f7679d652f72b54fd7c579a4738ae4d47c53213f266b5a2c2446a53386d17000b901005f04c0c31260591c81984881b480200041180c10098408d4d8840434c215211800660401002162160128100000c44bf4c0c20080061022544a185e0081242a000030000c4444811c600840285d0480624449060340cc6092080220a6000002050a0012428300a20010281180141408049801084502684280311012320608114002000a60802220aa29004800229100280001208004201140009140144462000502a0881100002810134340008b06402082004040224030080091406a288609021291480200194c49160440b14017660c4440018812086589620a005c0c0068839838ab040040a40754492158c0112414c892141012082040020a4a2102800040308381979a8401c9c38083972d598463ec1de09b4d616e69666f6c643a20636f696e62617365202d20676f65726c69a0fbd610d479f34d78d3c1ee5d525906e119babfa742966dfaabfba6ffc6499c3b8800000000000000000c", + "account_proof": [ + "f90211a08f3ec3607756301ad7628386a694edef062c32c0af69abdd8582733411fa6f4aa0e9ad940b31824dacc65417f2ae3aafe394949948f5805e645f6a5d7e7f0a5f28a078698a03fd4d2d738df437e1d39ac6dbe2b331474483083ecacd9270227adccea0b13728bf8c7541aac2e5f15840030e1a2a1d8546af961d2c5fe3cec61eb52136a041e20da27ab9f63b643aa550bd5494f42eb980e728499362807ca4a3d20bbd71a0544dfa7c44c6f4fc4318e6d42c8baa7db02467e31bdecb39a5b5c35dc9d75627a082e724d82008044c2339c3518899c58fa94397ec9b754a84ee6862ed980c506fa09858c9a0c3770fdcf0a95ee8657db7e5ff2813a5ee2b02bd2d550602ccf92ceca070c39b9018c1099644f6c8302f054b889f0d9c1c43561193af08c60514373a86a05147dd91ed6576bcb99c84b82e21267336fb5e7b6532bbc3bf3f153c44c7dd8ba0996167eb0ec29dcf3dc5564335936c857a16381f6cfc41e898ac427d5096f763a061cc346b3b193043469e1e63078e26bdffdc77fb9b7e03376a5d04a2e6a8bbd7a05ebe3f8899a1c9ae5c6f519c21bab07f380bc24eacd32d4915efa30990373347a0537e35aef2230294fb0150b5100ce1be4929181b2cbe16919ebdaf5455980a6ca0b11e4d342e93978e8ce006c6dafdc11a4626043ad6cd29c3a20fcaf7469e8846a0c2034f69510242f1af24e3cf53bdf8013959107de3863457d1759a0607cb42bd80", + "f90211a0cb604e92bfce9e89c58adb96d031edd6773b5ea79468c361c11bee3834ad38f7a0c3600619870fbddd0d3031662c20d4f07a7e8879715221e1cf2a27bac8252e84a0b42bfa4ca8a0f93155decb6566a0bfe41da0f0805f50bf22e582fbe09dab761da0f01302bc5b806c36dab88cf8fc3e720d2a9ea8b8c615cb2d6a61e516e7d568d5a0eb7a165077f85af7e1529e66bd052e211e3b0e591459a6b917b3a67b96e6c300a099b855be27efd92907fb6671240ad9b5a194aaaba80ec57f780f7f5132679279a076caa859434ddcc7513f2c40bbcdb0d3c92ef7f00f5575e5103683ed3f12d7aaa04b1f24333d5e1ff59bc1f0e68a4bffc09a109b59b281991e1def7d9a4d304683a01d24cc1c910469b1d5daf5c1ed9a0ff4b90467671498592b2b10bedb28594afca0f6c8564af03a1d6fa2203ad17d1c6cbbf608baed014de79c85c560149bac34a2a014a2351fb2913c7eead2607e6e821cb861a0acecce7e8d6b3eee285cd069b0f0a026385df23dbeafd3adff1c5537bc9b47716c3149c4d557cacaa31f67f8eb854fa0d759139f6c612b3ad3a4f1930a20f5bd1bcbd7e5595ccad018f066cde7cef5b7a052a24711316c1bccd8b72b59e1e0da3bd3254258651f42c468dbc06d33a5ece4a047f3cb14ec806f64d4bdeb04a60aef31966f50b2b191c9d5f697e01e5bc47654a0003d585567fb4aea17878d81f6c8e95e38218216e31263d85b01e387dcd12b6f80", + "f90211a07aa1913685063febef9253361de62ae7177722d980431ad433b6b2a2464d3c04a03df3486d470dc33c576fa0442eeac73b28032d892cee651cb5c8a714ba958f66a06482a869a326022a5fc40172cd9bbae5920b85a4138273da18eed05d2d75d97aa02a026697251d16fce297a1ee61d123da79085dc24ec356bff0f48f5708b04975a026cab39115772141ab3560790f604bf798b8d8744574ec842f57acba1bd3529fa0b78a5d4dcc2f37bbc0e8ba50727e7d08b143080aa2f93355f890bb7a615dae92a005b2270294d81e96ee9c7258f82a4541ec7a6a4eccf5de6fe54821d2e297d8f4a0d8d4d961a8e24b1e2886ee56762b1cd7f77e0ac76f9095636e9a008986b2028ba0eb02ba490b14fab24930230234056ed1cfaaf91fa4a57d9b9a7a178abe1cf3d2a0ba993d463bf76b12d4702be9696e0a1236ab7cd38e9fb590496151e4302ac7c1a08cbbd58b931fa2111148bed4e38c68e827b9a155c1eef0e63f43aa263cc10acea02e9bf22e9f981f53ed4856a0020449dc813cf444781b51fa3eabe13e0232f966a0a3622e12dacf5a9d1df00fe7e59326e1e96f1455492d72e39d5b6bf5f00eebb3a0a52a0b202c7059b5621fc10fd2921babe2c27934fae2d0409cbdc5b76d6b41a7a056aaef786ef7c8b3bda6d9ae2780478a1edc82b1f22e606bd3defe34a9cdeab5a0bf81e0ec8e926a748517a28422ff88e4a3f138a6f9175249c207f3178900bd9380", + "f90211a036e911e298a20d166922b7cb0563d3bceb8550b4adfa9fe08d8ca0a3c6d7ae86a0b9b9ac2b7a0a7c4d415787487e231900a10407acd166e92295ada52ea762c472a03a996e1b0ec3e2bddb98e7767e4666bcd40fa2273e0d3f52fa430f9a46938e7da015ea238cec5879fa069d204e93ff3c951f99d63407860df1882a2c59f325052da051fe87082dd2a2ac9e3610f6a85daba6468f7be31bc0301d3bafb579031848a2a01dfdfc623921a2948b00c4e0eab2d054293ca4869e09eaa79cd88ae492728788a036828736fa97fc9f14f0471b2cef6d6de6ed8e85f60581340e32314f55426d83a0e060a030a17644b352fd5d809fbffab09e4854e5cf79e907775571e72efdbe65a0b99a9776ae25aac78712102d448bca2ad2b0855d9485fd3e5aabc755a857ea1ba09774c71fdeb56de7925402760fc787d0f81a7e9373f017cbcdbba81b2c12df33a0af0f67963ad8a449e4ad7b613c58cb40ccf16786659ca716e9083b981138d2efa09bdc7b5850cd1050dddbc864a0d391312343fb542944cf0409f97ff2213b9f5da09792e17ea99e242aec9465df7f1b2b77e4c2ba916465d5b99702f4c6152bd82ea0dd32ae4192e7f1050eecd2573cc2c324fbbf6bf98cc61a6511920e8ab32091e5a00b4230a149ff4dca81cd7682536de8b1be2fa715bcafb967c35156fdc626dc3ba0b722557e1dc96d95b6af1aa5871ff90d300ce8632102e6b23e7e5d94101702ad80", + "f90211a096da0777dbb2f875bd357722a4387a78ae24efe13e04ed75f65b2c991247203fa0c0082d34071d1d65e712999126ac28e277b079d939821eaa755c4ef0fd2e5baaa0d088ecbd4b6bb84c6fa211bc81474c05c12ca2694faf0b1a2ecbde0bfe6fa3a2a00930aa5c1b70190cd2231cc759fec0c863a2e11bc89b1685d17da64f6bdc5e72a010b3d58569454bcfe1e6c9fad76e7034972f2abb6a3081b3c6b057c7d3151e2ca0868e866d17747182e462be130ceb1b0b3b5011db9f10f3fc8a00743c50497eaaa0aff0dd0b6a09d0e5659b96333f74fd56545addb56451693c1daeb2dbd7fe4470a07094c93901a37d76cc1ce99891c7419188b9dcabcd73075525a844084574c697a0cfd98d359eb86b3cf4531a0ddfa5d1ae5e5cdbed5f3a6a39daff489b2c862ed5a00f80e0d59b59c9e9e27aba7ac54d51f35750c45d45fb3d46c2cf31cb32a8e68aa02a5c88410b94694ae8882eda87af1c56616cd475b0b7feb2306da3959b322418a0609c5a3f274c1d31fa9b4d3c4492b4811c374e4d3d08ca5da98da012a489b273a0df38f9ab051dcee8d4f1a00376b01acecb3b7e9dbc40358c3d6d5958193e0329a0a274c42f4ccef6f20a413218137c6ec00ac7e3fa172f61a7c6487497fe427daba0961e5aac1726d9598c446db66425f7360f87fa5feb744adcfaf19e783cbba1a5a0b5c730c7587872bdc05bd0786f6fd897332d7d2642f953fa019ef58d4e5ec25e80", + "f90171a02a6e86561c33eacbb1826e9832a25f9f2841c281c9e6b6c18c95ce713dae6c868080a0807528ab397894421968b62bead3b9dd446bda7dc79a5b6ec5a29bd3f19a10c5a0072bce4e78f01cc370c9d92dd39bfcee6059d2e60a95135867991c59184d219980a0415df007b0977e95ba9b3d86b64bae14c02250b3da81f81bed47973f9e4a55b180a0e45736d96c006965b5cad5ec8008d31eb2c34e00c36f677b288701f76f43d627a055324754b7752c9149df27e03392c0598ec89f408040b15140a679f02e695017a04fc91448749dcab3e66cc8e45eb8d85a416fa3a33f8951128d17ca208bc3bb38a085a91d9af48d4f428da097b31c09b3f6b27d38212678a30ffd100364546a4d1ea0c60b5a89f1f89e97528a8b352ed55e5de2e7b963d73ba7de9e922c0ae964e816a048ff598a81a0114eb4afe71ef547cf6fecbb970310ef84049c9353d01c17103aa02bd17f471f58c435c937e6457a8a8a7ff7163263be197ec547241bc4791536b18080", + "f871808080808080a03f1587ebf71f19f47449b08f0960630ddbd60d045ea68ee7d89fb1c5682d215a8080808080a06e1618ec47442688101bd341cb8627739ecfd6fc1f793b69191dceeed18a19348080a05344081f911ad616b960a8f2841eb55f4936a97ec5dae614e726c8c0d51e0eff80", + "f8669d3e3757038b7fea6585ca2d0a3dacd72d84bf0c7b916f169cea0348681bb846f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75" + ], + "contract_address": "00763f30eEB0eEF506907e18f2a6ceC2DAb30Df8", + "expected_account_state": "f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75", + "storage_key_hash": "7bef74619139dab09d59cafa630682f8f30445738dcfb7147514aa27399ae2ee", + "storage_proof": [ + "f90211a07c66fa00b691dc5c5a66e43831b9922316c8740c3c5235e7aa705cebefbd478ca0bbf8c0df9d3837792180786e217cbcbfb6cb6c1ee790ec0dba83fc05248f2627a036b93382543cd1737ddc32dbc8cd4326da47551be33e3ca75af3ea98583edd93a0c024e6190b7ce41e20f27b5cd512ebf50d6c60a1467f3cad8acd46da3a4d3861a04134b666e4a8e3e28701e33bed36680ae025cc5f89f8d29457975148338017c4a0ad773b24d54d681b3d712d913c0bf515407818845922616360b9b5a381cd6299a076515bac0f65924da357aba2f6c312472a9ef94d1c459f2cd0380b84a91d46aca0a3501be4fecb38f8b48131e0f8f63d6be379248ffb7d6f27c6fab26314fd8396a0324a3b32bf60329775f3383b6c98e99683df56a0933516032147008d544af343a029f967b2d7ed040cda92ab4905f2976636a7bb16ba850679eca942e02d5b3458a024bdf35e1d8fd46cdee76420d508c722d7f47825356620c266094f6c66c67f7ea0426a496a8633ec2771fb15f58f646bf689eda39af535bcb9b316e9e601d1a342a00d9cd9aa39cdd4a91bcd4feb8c73db017dce78ec82ba6f14287775567615f247a02f3d28876d69fd8945b3fdeff87186bcb97c236ccefa3b6182507bc6e504606fa03b4078e843b8927c29753dfc91a44c246cb22ea3673a3bad8dab7c8f6b8ce226a061983eaffadbdc7d6e7a0f9d9f5c1c64f983a4a6724aaa2126a0b6c03c984f3280", + "f90191a015203b1feedefc3d12d0e185733524b4e2e5e8c2bdaf7abff246a1fed7ac95e3a0493a8147104d998868825ea6deb1322aae76680d265471262e1767a23bdd1a7fa09b406baa1899b648205b0dd527c9bbde6ada6e3b4fc531a35bd2537d8db733f7a0426dd1071bf0b88c5742facc7fea20e28e765ab489cfdbdd5153e15ea3e2b32ca03edd49ea3795ac11d96e7290b12c1040c1e483c90462e720c7f1d16f873dc751a0132bf193ced5ce4fdb9c534386d84cb653c802dc21694d7dd78863921fea2acda09c60c4557046c9882148d3470e3fde97e88e5d35bd25e1a3cc94384e66a7af1080a0dea2418bd69d857116931f580a50c80761622d7488224a24b233bd4eaaa3c3b7a0bacb8d28242096ba6306d1c073fdeacd9bb5df804e3426c3c945f37836db68e680a08da1ba6ee52fb112c7f4707b78e039c8b52647ac5ce1122f7191356387dc169380a0f00a423bf08615d7c08955ea29573cd2a20d6d19d483ce4116333353290eae0ea06dd01d697beb2d96a5a41e803708b1d2cafd5992d80f7bf6d796e6aead4989ed8080", + "e2a020ef74619139dab09d59cafa630682f8f30445738dcfb7147514aa27399ae2ee01" + ], + "expected_storage_value": "01", + "min_header_height": "", + "max_header_height": "", + "skip_bridge_call": true +} diff --git a/contracts/near/eth-prover/src/test_data/storageProofWithFalseValue.json b/contracts/near/eth-prover/src/test_data/storageProofWithFalseValue.json new file mode 100644 index 00000000..45b7d58d --- /dev/null +++ b/contracts/near/eth-prover/src/test_data/storageProofWithFalseValue.json @@ -0,0 +1,26 @@ +{ + "contract_address": "00763f30eeb0eef506907e18f2a6cec2dab30df8", + "storage_key": "ec1c15ab7b2411ecf8987e39d32202848ce2e7f3ad10aa6070664c6e9368916e", + "block_number": "8492954", + "header_data": "f90217a02feb03d38518e6941c0852c64a9cc06be8f0caed9357d0c45136395110ef4540a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794388ea662ef2c223ec0b047d41bf3c0f362142ad5a035630b01ab13a7f864f9c86f2a2d7ac497320594f92c5868e17063260beba833a083c4eeccb9dad0f16ca684785dd347c70e3c35573ebb38b6db5550d5e2eb2039a0f7679d652f72b54fd7c579a4738ae4d47c53213f266b5a2c2446a53386d17000b901005f04c0c31260591c81984881b480200041180c10098408d4d8840434c215211800660401002162160128100000c44bf4c0c20080061022544a185e0081242a000030000c4444811c600840285d0480624449060340cc6092080220a6000002050a0012428300a20010281180141408049801084502684280311012320608114002000a60802220aa29004800229100280001208004201140009140144462000502a0881100002810134340008b06402082004040224030080091406a288609021291480200194c49160440b14017660c4440018812086589620a005c0c0068839838ab040040a40754492158c0112414c892141012082040020a4a2102800040808381979a8401c9c38083972d598463ec1de09b4d616e69666f6c643a20636f696e62617365202d20676f65726c69a0fbd610d479f34d78d3c1ee5d525906e119babfa742966dfaabfba6ffc6499c3b8800000000000000000c", + "account_proof": [ + "f90211a08f3ec3607756301ad7628386a694edef062c32c0af69abdd8582733411fa6f4aa0e9ad940b31824dacc65417f2ae3aafe394949948f5805e645f6a5d7e7f0a5f28a078698a03fd4d2d738df437e1d39ac6dbe2b331474483083ecacd9270227adccea0b13728bf8c7541aac2e5f15840030e1a2a1d8546af961d2c5fe3cec61eb52136a041e20da27ab9f63b643aa550bd5494f42eb980e728499362807ca4a3d20bbd71a0544dfa7c44c6f4fc4318e6d42c8baa7db02467e31bdecb39a5b5c35dc9d75627a082e724d82008044c2339c3518899c58fa94397ec9b754a84ee6862ed980c506fa09858c9a0c3770fdcf0a95ee8657db7e5ff2813a5ee2b02bd2d550602ccf92ceca070c39b9018c1099644f6c8302f054b889f0d9c1c43561193af08c60514373a86a05147dd91ed6576bcb99c84b82e21267336fb5e7b6532bbc3bf3f153c44c7dd8ba0996167eb0ec29dcf3dc5564335936c857a16381f6cfc41e898ac427d5096f763a061cc346b3b193043469e1e63078e26bdffdc77fb9b7e03376a5d04a2e6a8bbd7a05ebe3f8899a1c9ae5c6f519c21bab07f380bc24eacd32d4915efa30990373347a0537e35aef2230294fb0150b5100ce1be4929181b2cbe16919ebdaf5455980a6ca0b11e4d342e93978e8ce006c6dafdc11a4626043ad6cd29c3a20fcaf7469e8846a0c2034f69510242f1af24e3cf53bdf8013959107de3863457d1759a0607cb42bd80", + "f90211a0cb604e92bfce9e89c58adb96d031edd6773b5ea79468c361c11bee3834ad38f7a0c3600619870fbddd0d3031662c20d4f07a7e8879715221e1cf2a27bac8252e84a0b42bfa4ca8a0f93155decb6566a0bfe41da0f0805f50bf22e582fbe09dab761da0f01302bc5b806c36dab88cf8fc3e720d2a9ea8b8c615cb2d6a61e516e7d568d5a0eb7a165077f85af7e1529e66bd052e211e3b0e591459a6b917b3a67b96e6c300a099b855be27efd92907fb6671240ad9b5a194aaaba80ec57f780f7f5132679279a076caa859434ddcc7513f2c40bbcdb0d3c92ef7f00f5575e5103683ed3f12d7aaa04b1f24333d5e1ff59bc1f0e68a4bffc09a109b59b281991e1def7d9a4d304683a01d24cc1c910469b1d5daf5c1ed9a0ff4b90467671498592b2b10bedb28594afca0f6c8564af03a1d6fa2203ad17d1c6cbbf608baed014de79c85c560149bac34a2a014a2351fb2913c7eead2607e6e821cb861a0acecce7e8d6b3eee285cd069b0f0a026385df23dbeafd3adff1c5537bc9b47716c3149c4d557cacaa31f67f8eb854fa0d759139f6c612b3ad3a4f1930a20f5bd1bcbd7e5595ccad018f066cde7cef5b7a052a24711316c1bccd8b72b59e1e0da3bd3254258651f42c468dbc06d33a5ece4a047f3cb14ec806f64d4bdeb04a60aef31966f50b2b191c9d5f697e01e5bc47654a0003d585567fb4aea17878d81f6c8e95e38218216e31263d85b01e387dcd12b6f80", + "f90211a07aa1913685063febef9253361de62ae7177722d980431ad433b6b2a2464d3c04a03df3486d470dc33c576fa0442eeac73b28032d892cee651cb5c8a714ba958f66a06482a869a326022a5fc40172cd9bbae5920b85a4138273da18eed05d2d75d97aa02a026697251d16fce297a1ee61d123da79085dc24ec356bff0f48f5708b04975a026cab39115772141ab3560790f604bf798b8d8744574ec842f57acba1bd3529fa0b78a5d4dcc2f37bbc0e8ba50727e7d08b143080aa2f93355f890bb7a615dae92a005b2270294d81e96ee9c7258f82a4541ec7a6a4eccf5de6fe54821d2e297d8f4a0d8d4d961a8e24b1e2886ee56762b1cd7f77e0ac76f9095636e9a008986b2028ba0eb02ba490b14fab24930230234056ed1cfaaf91fa4a57d9b9a7a178abe1cf3d2a0ba993d463bf76b12d4702be9696e0a1236ab7cd38e9fb590496151e4302ac7c1a08cbbd58b931fa2111148bed4e38c68e827b9a155c1eef0e63f43aa263cc10acea02e9bf22e9f981f53ed4856a0020449dc813cf444781b51fa3eabe13e0232f966a0a3622e12dacf5a9d1df00fe7e59326e1e96f1455492d72e39d5b6bf5f00eebb3a0a52a0b202c7059b5621fc10fd2921babe2c27934fae2d0409cbdc5b76d6b41a7a056aaef786ef7c8b3bda6d9ae2780478a1edc82b1f22e606bd3defe34a9cdeab5a0bf81e0ec8e926a748517a28422ff88e4a3f138a6f9175249c207f3178900bd9380", + "f90211a036e911e298a20d166922b7cb0563d3bceb8550b4adfa9fe08d8ca0a3c6d7ae86a0b9b9ac2b7a0a7c4d415787487e231900a10407acd166e92295ada52ea762c472a03a996e1b0ec3e2bddb98e7767e4666bcd40fa2273e0d3f52fa430f9a46938e7da015ea238cec5879fa069d204e93ff3c951f99d63407860df1882a2c59f325052da051fe87082dd2a2ac9e3610f6a85daba6468f7be31bc0301d3bafb579031848a2a01dfdfc623921a2948b00c4e0eab2d054293ca4869e09eaa79cd88ae492728788a036828736fa97fc9f14f0471b2cef6d6de6ed8e85f60581340e32314f55426d83a0e060a030a17644b352fd5d809fbffab09e4854e5cf79e907775571e72efdbe65a0b99a9776ae25aac78712102d448bca2ad2b0855d9485fd3e5aabc755a857ea1ba09774c71fdeb56de7925402760fc787d0f81a7e9373f017cbcdbba81b2c12df33a0af0f67963ad8a449e4ad7b613c58cb40ccf16786659ca716e9083b981138d2efa09bdc7b5850cd1050dddbc864a0d391312343fb542944cf0409f97ff2213b9f5da09792e17ea99e242aec9465df7f1b2b77e4c2ba916465d5b99702f4c6152bd82ea0dd32ae4192e7f1050eecd2573cc2c324fbbf6bf98cc61a6511920e8ab32091e5a00b4230a149ff4dca81cd7682536de8b1be2fa715bcafb967c35156fdc626dc3ba0b722557e1dc96d95b6af1aa5871ff90d300ce8632102e6b23e7e5d94101702ad80", + "f90211a096da0777dbb2f875bd357722a4387a78ae24efe13e04ed75f65b2c991247203fa0c0082d34071d1d65e712999126ac28e277b079d939821eaa755c4ef0fd2e5baaa0d088ecbd4b6bb84c6fa211bc81474c05c12ca2694faf0b1a2ecbde0bfe6fa3a2a00930aa5c1b70190cd2231cc759fec0c863a2e11bc89b1685d17da64f6bdc5e72a010b3d58569454bcfe1e6c9fad76e7034972f2abb6a3081b3c6b057c7d3151e2ca0868e866d17747182e462be130ceb1b0b3b5011db9f10f3fc8a00743c50497eaaa0aff0dd0b6a09d0e5659b96333f74fd56545addb56451693c1daeb2dbd7fe4470a07094c93901a37d76cc1ce99891c7419188b9dcabcd73075525a844084574c697a0cfd98d359eb86b3cf4531a0ddfa5d1ae5e5cdbed5f3a6a39daff489b2c862ed5a00f80e0d59b59c9e9e27aba7ac54d51f35750c45d45fb3d46c2cf31cb32a8e68aa02a5c88410b94694ae8882eda87af1c56616cd475b0b7feb2306da3959b322418a0609c5a3f274c1d31fa9b4d3c4492b4811c374e4d3d08ca5da98da012a489b273a0df38f9ab051dcee8d4f1a00376b01acecb3b7e9dbc40358c3d6d5958193e0329a0a274c42f4ccef6f20a413218137c6ec00ac7e3fa172f61a7c6487497fe427daba0961e5aac1726d9598c446db66425f7360f87fa5feb744adcfaf19e783cbba1a5a0b5c730c7587872bdc05bd0786f6fd897332d7d2642f953fa019ef58d4e5ec25e80", + "f90171a02a6e86561c33eacbb1826e9832a25f9f2841c281c9e6b6c18c95ce713dae6c868080a0807528ab397894421968b62bead3b9dd446bda7dc79a5b6ec5a29bd3f19a10c5a0072bce4e78f01cc370c9d92dd39bfcee6059d2e60a95135867991c59184d219980a0415df007b0977e95ba9b3d86b64bae14c02250b3da81f81bed47973f9e4a55b180a0e45736d96c006965b5cad5ec8008d31eb2c34e00c36f677b288701f76f43d627a055324754b7752c9149df27e03392c0598ec89f408040b15140a679f02e695017a04fc91448749dcab3e66cc8e45eb8d85a416fa3a33f8951128d17ca208bc3bb38a085a91d9af48d4f428da097b31c09b3f6b27d38212678a30ffd100364546a4d1ea0c60b5a89f1f89e97528a8b352ed55e5de2e7b963d73ba7de9e922c0ae964e816a048ff598a81a0114eb4afe71ef547cf6fecbb970310ef84049c9353d01c17103aa02bd17f471f58c435c937e6457a8a8a7ff7163263be197ec547241bc4791536b18080", + "f871808080808080a03f1587ebf71f19f47449b08f0960630ddbd60d045ea68ee7d89fb1c5682d215a8080808080a06e1618ec47442688101bd341cb8627739ecfd6fc1f793b69191dceeed18a19348080a05344081f911ad616b960a8f2841eb55f4936a97ec5dae614e726c8c0d51e0eff80", + "f8669d3e3757038b7fea6585ca2d0a3dacd72d84bf0c7b916f169cea0348681bb846f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75" + ], + "expected_account_state": "f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75", + "storage_key_hash": "15a27ce2832510d333b3cc710b4318654c0a1aae29a95174980029b9efdc451f", + "storage_proof": [ + "f90211a07c66fa00b691dc5c5a66e43831b9922316c8740c3c5235e7aa705cebefbd478ca0bbf8c0df9d3837792180786e217cbcbfb6cb6c1ee790ec0dba83fc05248f2627a036b93382543cd1737ddc32dbc8cd4326da47551be33e3ca75af3ea98583edd93a0c024e6190b7ce41e20f27b5cd512ebf50d6c60a1467f3cad8acd46da3a4d3861a04134b666e4a8e3e28701e33bed36680ae025cc5f89f8d29457975148338017c4a0ad773b24d54d681b3d712d913c0bf515407818845922616360b9b5a381cd6299a076515bac0f65924da357aba2f6c312472a9ef94d1c459f2cd0380b84a91d46aca0a3501be4fecb38f8b48131e0f8f63d6be379248ffb7d6f27c6fab26314fd8396a0324a3b32bf60329775f3383b6c98e99683df56a0933516032147008d544af343a029f967b2d7ed040cda92ab4905f2976636a7bb16ba850679eca942e02d5b3458a024bdf35e1d8fd46cdee76420d508c722d7f47825356620c266094f6c66c67f7ea0426a496a8633ec2771fb15f58f646bf689eda39af535bcb9b316e9e601d1a342a00d9cd9aa39cdd4a91bcd4feb8c73db017dce78ec82ba6f14287775567615f247a02f3d28876d69fd8945b3fdeff87186bcb97c236ccefa3b6182507bc6e504606fa03b4078e843b8927c29753dfc91a44c246cb22ea3673a3bad8dab7c8f6b8ce226a061983eaffadbdc7d6e7a0f9d9f5c1c64f983a4a6724aaa2126a0b6c03c984f3280", + "f901d1a0269a0b881e99b091fd1f85a9e44ee4daf1bfaa127412213b0ec1edacf2fcb4e0a0e7f129286b917093dd713ebf19c11b699dd3b7e2c8dd81b96da000d8929e6bd7a042e1e974e7e7b3829b6fd86c08ec48c92789a4c5b29aaba295ac47eb78da8979a0af69958bb871e61c3dab996738ae596fd6d8b0c6dd126361053ca23c67576aa6a0957f511c654ba45de24daa58d5069b8e854e1af4230f5e00ff80942f32179f9280a002cca7c62c8aaf39f3300a3694c5df5909d2365d68935dead512cec79b859546a0c150cdf6bf843bf02c321ad13d4b680a5ac6816a93b607b68b3d2944645cc573a0d44663526783865e11155d5490966374eaf24421c59522f6350769715d83f5f280a028d3420f6f3cfd2eff10d769032ec92a9ce6a26004a4b5e432577f7d218cb8eea095fcf2b12e8b70bb0c075d41576e00242769a18622ab1d936326fa053aeaa501a0ecf0ef75da3fd6cd5bc5a73049bbbdedd2fb0ccdb86bb07895d012b1b93354d5a02c8f51d330045fd36258abd5dc39dbc9ac14103ca91925bed4f55066f7d51830a024fff2a5c88286da53434ffeafc0962a9c2230a26c303850a04853096882be92a0a0eb992284319d09507645086aaf48f97428294e89aab782574993ed0543caef80" + ], + "expected_storage_value": "", + "min_header_height": "", + "max_header_height": "", + "skip_bridge_call": true +} \ No newline at end of file diff --git a/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectAccountProof.json b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectAccountProof.json new file mode 100644 index 00000000..6ac907c0 --- /dev/null +++ b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectAccountProof.json @@ -0,0 +1,26 @@ +{ + "header_data": "f9021ba0695d799c7fbeda2651dd907991909e4ae68612851ce5398f2efc9506e69247cda01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794b64a30399f7f6b0c154c2e7af0a3ec7b0a5b131aa0eea9136af6ad8b65ad4c2184bbe6ab400f1ae214ed069d56d89639d7329d083ea063bbd1ab5c4e3922601b38d701e091e1ad3bc30a8e6e6a166728a6b5c9a61d31a0108126d36fb961af5e2d8359a6fced486e368965bbcba286205983dd06011aceb901000120011010a05000008a4800841200c0042918c020a44820008210109a02018c028d000000004001009a014c1085c000430019108410580008041204143226407a2001200470804449a0620802440121001124020cc07a040318018480a146110002528216204104220200806080086020c018a02000120020204818800000504604c1200000202100004003a188820624281c212102000901010d6051ec081002001a0000c8041010806460121600222104002188072024090001c60020088d2060c8ca500a1224161090040c82620c014060040608011048a1401010803004ba159d5800002802000300c241100296888004086a0030c015003b0212003004308380ffb58401c9c38083f281638463e31ac89f496c6c756d696e61746520446d6f63726174697a6520447374726962757465a086a600953aa2865ceb8c7a6348f388aaad93ca30c4a7dc718479ab45d98d8ea488000000000000000011", + "account_proof": [ + "f90211a08f3ec3607756301ad7628386a694edef062c32c0af69abdd8582733411fa6f4aa0e9ad940b31824dacc65417f2ae3aafe394949948f5805e645f6a5d7e7f0a5f28a078698a03fd4d2d738df437e1d39ac6dbe2b331474483083ecacd9270227adccea0b13728bf8c7541aac2e5f15840030e1a2a1d8546af961d2c5fe3cec61eb52136a041e20da27ab9f63b643aa550bd5494f42eb980e728499362807ca4a3d20bbd71a0544dfa7c44c6f4fc4318e6d42c8baa7db02467e31bdecb39a5b5c35dc9d75627a082e724d82008044c2339c3518899c58fa94397ec9b754a84ee6862ed980c506fa09858c9a0c3770fdcf0a95ee8657db7e5ff2813a5ee2b02bd2d550602ccf92ceca070c39b9018c1099644f6c8302f054b889f0d9c1c43561193af08c60514373a86a05147dd91ed6576bcb99c84b82e21267336fb5e7b6532bbc3bf3f153c44c7dd8ba0996167eb0ec29dcf3dc5564335936c857a16381f6cfc41e898ac427d5096f763a061cc346b3b193043469e1e63078e26bdffdc77fb9b7e03376a5d04a2e6a8bbd7a05ebe3f8899a1c9ae5c6f519c21bab07f380bc24eacd32d4915efa30990373347a0537e35aef2230294fb0150b5100ce1be4929181b2cbe16919ebdaf5455980a6ca0b11e4d342e93978e8ce006c6dafdc11a4626043ad6cd29c3a20fcaf7469e8846a0c2034f69510242f1af24e3cf53bdf8013959107de3863457d1759a0607cb42bd80", + "f90211a0cb604e92bfce9e89c58adb96d031edd6773b5ea79468c361c11bee3834ad38f7a0c3600619870fbddd0d3031662c20d4f07a7e8879715221e1cf2a27bac8252e84a0b42bfa4ca8a0f93155decb6566a0bfe41da0f0805f50bf22e582fbe09dab761da0f01302bc5b806c36dab88cf8fc3e720d2a9ea8b8c615cb2d6a61e516e7d568d5a0eb7a165077f85af7e1529e66bd052e211e3b0e591459a6b917b3a67b96e6c300a099b855be27efd92907fb6671240ad9b5a194aaaba80ec57f780f7f5132679279a076caa859434ddcc7513f2c40bbcdb0d3c92ef7f00f5575e5103683ed3f12d7aaa04b1f24333d5e1ff59bc1f0e68a4bffc09a109b59b281991e1def7d9a4d304683a01d24cc1c910469b1d5daf5c1ed9a0ff4b90467671498592b2b10bedb28594afca0f6c8564af03a1d6fa2203ad17d1c6cbbf608baed014de79c85c560149bac34a2a014a2351fb2913c7eead2607e6e821cb861a0acecce7e8d6b3eee285cd069b0f0a026385df23dbeafd3adff1c5537bc9b47716c3149c4d557cacaa31f67f8eb854fa0d759139f6c612b3ad3a4f1930a20f5bd1bcbd7e5595ccad018f066cde7cef5b7a052a24711316c1bccd8b72b59e1e0da3bd3254258651f42c468dbc06d33a5ece4a047f3cb14ec806f64d4bdeb04a60aef31966f50b2b191c9d5f697e01e5bc47654a0003d585567fb4aea17878d81f6c8e95e38218216e31263d85b01e387dcd12b6f80", + "f90211a07aa1913685063febef9253361de62ae7177722d980431ad433b6b2a2464d3c04a03df3486d470dc33c576fa0442eeac73b28032d892cee651cb5c8a714ba958f66a06482a869a326022a5fc40172cd9bbae5920b85a4138273da18eed05d2d75d97aa02a026697251d16fce297a1ee61d123da79085dc24ec356bff0f48f5708b04975a026cab39115772141ab3560790f604bf798b8d8744574ec842f57acba1bd3529fa0b78a5d4dcc2f37bbc0e8ba50727e7d08b143080aa2f93355f890bb7a615dae92a005b2270294d81e96ee9c7258f82a4541ec7a6a4eccf5de6fe54821d2e297d8f4a0d8d4d961a8e24b1e2886ee56762b1cd7f77e0ac76f9095636e9a008986b2028ba0eb02ba490b14fab24930230234056ed1cfaaf91fa4a57d9b9a7a178abe1cf3d2a0ba993d463bf76b12d4702be9696e0a1236ab7cd38e9fb590496151e4302ac7c1a08cbbd58b931fa2111148bed4e38c68e827b9a155c1eef0e63f43aa263cc10acea02e9bf22e9f981f53ed4856a0020449dc813cf444781b51fa3eabe13e0232f966a0a3622e12dacf5a9d1df00fe7e59326e1e96f1455492d72e39d5b6bf5f00eebb3a0a52a0b202c7059b5621fc10fd2921babe2c27934fae2d0409cbdc5b76d6b41a7a056aaef786ef7c8b3bda6d9ae2780478a1edc82b1f22e606bd3defe34a9cdeab5a0bf81e0ec8e926a748517a28422ff88e4a3f138a6f9175249c207f3178900bd9380", + "f90211a036e911e298a20d166922b7cb0563d3bceb8550b4adfa9fe08d8ca0a3c6d7ae86a0b9b9ac2b7a0a7c4d415787487e231900a10407acd166e92295ada52ea762c472a03a996e1b0ec3e2bddb98e7767e4666bcd40fa2273e0d3f52fa430f9a46938e7da015ea238cec5879fa069d204e93ff3c951f99d63407860df1882a2c59f325052da051fe87082dd2a2ac9e3610f6a85daba6468f7be31bc0301d3bafb579031848a2a01dfdfc623921a2948b00c4e0eab2d054293ca4869e09eaa79cd88ae492728788a036828736fa97fc9f14f0471b2cef6d6de6ed8e85f60581340e32314f55426d83a0e060a030a17644b352fd5d809fbffab09e4854e5cf79e907775571e72efdbe65a0b99a9776ae25aac78712102d448bca2ad2b0855d9485fd3e5aabc755a857ea1ba09774c71fdeb56de7925402760fc787d0f81a7e9373f017cbcdbba81b2c12df33a0af0f67963ad8a449e4ad7b613c58cb40ccf16786659ca716e9083b981138d2efa09bdc7b5850cd1050dddbc864a0d391312343fb542944cf0409f97ff2213b9f5da09792e17ea99e242aec9465df7f1b2b77e4c2ba916465d5b99702f4c6152bd82ea0dd32ae4192e7f1050eecd2573cc2c324fbbf6bf98cc61a6511920e8ab32091e5a00b4230a149ff4dca81cd7682536de8b1be2fa715bcafb967c35156fdc626dc3ba0b722557e1dc96d95b6af1aa5871ff90d300ce8632102e6b23e7e5d94101702ad80", + "f90211a096da0777dbb2f875bd357722a4387a78ae24efe13e04ed75f65b2c991247203fa0c0082d34071d1d65e712999126ac28e277b079d939821eaa755c4ef0fd2e5baaa0d088ecbd4b6bb84c6fa211bc81474c05c12ca2694faf0b1a2ecbde0bfe6fa3a2a00930aa5c1b70190cd2231cc759fec0c863a2e11bc89b1685d17da64f6bdc5e72a010b3d58569454bcfe1e6c9fad76e7034972f2abb6a3081b3c6b057c7d3151e2ca0868e866d17747182e462be130ceb1b0b3b5011db9f10f3fc8a00743c50497eaaa0aff0dd0b6a09d0e5659b96333f74fd56545addb56451693c1daeb2dbd7fe4470a07094c93901a37d76cc1ce99891c7419188b9dcabcd73075525a844084574c697a0cfd98d359eb86b3cf4531a0ddfa5d1ae5e5cdbed5f3a6a39daff489b2c862ed5a00f80e0d59b59c9e9e27aba7ac54d51f35750c45d45fb3d46c2cf31cb32a8e68aa02a5c88410b94694ae8882eda87af1c56616cd475b0b7feb2306da3959b322418a0609c5a3f274c1d31fa9b4d3c4492b4811c374e4d3d08ca5da98da012a489b273a0df38f9ab051dcee8d4f1a00376b01acecb3b7e9dbc40358c3d6d5958193e0329a0a274c42f4ccef6f20a413218137c6ec00ac7e3fa172f61a7c6487497fe427daba0961e5aac1726d9598c446db66425f7360f87fa5feb744adcfaf19e783cbba1a5a0b5c730c7587872bdc05bd0786f6fd897332d7d2642f953fa019ef58d4e5ec25e80", + "f90171a02a6e86561c33eacbb1826e9832a25f9f2841c281c9e6b6c18c95ce713dae6c868080a0807528ab397894421968b62bead3b9dd446bda7dc79a5b6ec5a29bd3f19a10c5a0072bce4e78f01cc370c9d92dd39bfcee6059d2e60a95135867991c59184d219980a0415df007b0977e95ba9b3d86b64bae14c02250b3da81f81bed47973f9e4a55b180a0e45736d96c006965b5cad5ec8008d31eb2c34e00c36f677b288701f76f43d627a055324754b7752c9149df27e03392c0598ec89f408040b15140a679f02e695017a04fc91448749dcab3e66cc8e45eb8d85a416fa3a33f8951128d17ca208bc3bb38a085a91d9af48d4f428da097b31c09b3f6b27d38212678a30ffd100364546a4d1ea0c60b5a89f1f89e97528a8b352ed55e5de2e7b963d73ba7de9e922c0ae964e816a048ff598a81a0114eb4afe71ef547cf6fecbb970310ef84049c9353d01c17103aa02bd17f471f58c435c937e6457a8a8a7ff7163263be197ec547241bc4791536b18080", + "f871808080808080a03f1587ebf71f19f47449b08f0960630ddbd60d045ea68ee7d89fb1c5682d215a8080808080a06e1618ec47442688101bd341cb8627739ecfd6fc1f793b69191dceeed18a19348080a05344081f911ad616b960a8f2841eb55f4936a97ec5dae614e726c8c0d51e0eff80", + "f8669d3e3757038b7fea6585ca2d0a3dacd72d84bf0c7b916f169cea0348681bb846f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75" + ], + "contract_address": "00763f30eEB0eEF506907e18f2a6ceC2DAb30Df8", + "expected_account_state": "f8440180a09dc8b927bc1f203931c70cc3850246046859c40e0044964753b28ff41285b75da0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75", + "storage_key_hash": "1c8ba9af7041ec3098c4d818db9972f67827520c1db7d022f6c3041b6f40ecc3", + "storage_proof": [ + "f90211a0786e2b7a3a24cfafe31c1cac9b0cc4b57cfb9e27264b9aeb8ba52d48181fd013a0bbf8c0df9d3837792180786e217cbcbfb6cb6c1ee790ec0dba83fc05248f2627a060d5477cb7243063a66f6533e342632aea890e13cf45c0144ad7f8254bb74242a02dd5604620fcf3990474b172d1bb5653bf7bfc9ee1d269e765da3f7a91ac2ec3a04134b666e4a8e3e28701e33bed36680ae025cc5f89f8d29457975148338017c4a07bf7ed874ff02f5938267592e1a3cfca0ca8d7d4b6fccd617b815fad456c2c53a076515bac0f65924da357aba2f6c312472a9ef94d1c459f2cd0380b84a91d46aca0f49dd3a32c4adb7b6f02188b32a7823c79bb5b2ed1f3cdf4da11c36304ae4e25a05ba06e342a112365ced395b4bf830d148ad1e6a787912a9a603293a4e079e3f5a029f967b2d7ed040cda92ab4905f2976636a7bb16ba850679eca942e02d5b3458a024bdf35e1d8fd46cdee76420d508c722d7f47825356620c266094f6c66c67f7ea070a8abf4345f7148bbcbd0f443fe00cfed0a17ab828b7051cb3ede4bee4499b1a00d9cd9aa39cdd4a91bcd4feb8c73db017dce78ec82ba6f14287775567615f247a02f3d28876d69fd8945b3fdeff87186bcb97c236ccefa3b6182507bc6e504606fa03b4078e843b8927c29753dfc91a44c246cb22ea3673a3bad8dab7c8f6b8ce226a061983eaffadbdc7d6e7a0f9d9f5c1c64f983a4a6724aaa2126a0b6c03c984f3280", + "f901d1a0269a0b881e99b091fd1f85a9e44ee4daf1bfaa127412213b0ec1edacf2fcb4e0a0e7f129286b917093dd713ebf19c11b699dd3b7e2c8dd81b96da000d8929e6bd7a042e1e974e7e7b3829b6fd86c08ec48c92789a4c5b29aaba295ac47eb78da8979a0af69958bb871e61c3dab996738ae596fd6d8b0c6dd126361053ca23c67576aa6a0957f511c654ba45de24daa58d5069b8e854e1af4230f5e00ff80942f32179f9280a002cca7c62c8aaf39f3300a3694c5df5909d2365d68935dead512cec79b859546a0c150cdf6bf843bf02c321ad13d4b680a5ac6816a93b607b68b3d2944645cc573a0d44663526783865e11155d5490966374eaf24421c59522f6350769715d83f5f280a028d3420f6f3cfd2eff10d769032ec92a9ce6a26004a4b5e432577f7d218cb8eea095fcf2b12e8b70bb0c075d41576e00242769a18622ab1d936326fa053aeaa501a0ecf0ef75da3fd6cd5bc5a73049bbbdedd2fb0ccdb86bb07895d012b1b93354d5a02c8f51d330045fd36258abd5dc39dbc9ac14103ca91925bed4f55066f7d51830a024fff2a5c88286da53434ffeafc0962a9c2230a26c303850a04853096882be92a0a0eb992284319d09507645086aaf48f97428294e89aab782574993ed0543caef80", + "f851808080808080a05a173679dbc21d5c5b16c40e4d0fdd5ec92f602c2db2adbe71c9d4b2aedb585480a04cd868f531723c2438dce2df71b16e2d4d6f49299867484a662073b40aaac5ca8080808080808080", + "e19f3ba9af7041ec3098c4d818db9972f67827520c1db7d022f6c3041b6f40ecc301" + ], + "expected_storage_value": "01", + "min_header_height": "", + "max_header_height": "", + "skip_bridge_call": true +} diff --git a/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectAccountState.json b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectAccountState.json new file mode 100644 index 00000000..c02a8710 --- /dev/null +++ b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectAccountState.json @@ -0,0 +1,26 @@ +{ + "header_data": "f901ffa0fff0b83c7645333f372718f1c53b7275d83f89ae974940820a39ac43b9e88a11a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794f36f155486299ecaff2d4f5160ed5114c1f66000a0611e6617bd56b23286a317a8cfe78274a76f9624c207ed9f567f12db53026cb5a0f8646c32c2cfb4064bc2fc092a73adf7fa8f05fe62dec656a550d09ec1b8a898a05d94e5c456f59be6084dc832d24de0273ceba6c841308d1908169a043ac6baa4b9010015a42a6355a47214801c1c81ac5150030184014530904810240b0054e81b750a00eea0040008415010180084206402d4410900a0160000f098085c041124a202103041109462923cd7a4210b020630260004831a40c0602409411184000212058820336a2200010000001080c413080009010c40614862983802923088102107268882692a90e80620424822678040210010100860151208240118f3956204050a2c895371808a101203140032034260e0f114027206246000a1c04a2132a922e66088322108090a110810a0000be40086a8101030144dd05003506248146614ba11280ba0201102780011e1814102058801000900502202024304301a39660230838182ac8401c9c3808401052eab8463eadb3080a00a58a400a5f524d8df4b7140cc35bf2b4fe9dfc2a12a1cf52f526d627aac3db3880000000000000000820357", + "account_proof": [ + "f90211a09f2010af3cc9c6d2ff727c81f7524ae503f90284e5cb802f6fd9358c163e198ca08548267c53e930b5a18b2364c5cb3aff3c14870ac2275eb6f8a54388a58b5567a0f71f37002acc0a2eaa7b540cf6d14eec6d1a0c0e05fa47294c17f1b313b5c8cfa03b6953e75441ca9a3a1cf4cfd1143357023b305698259217d69b2fc2ce60858ea07c2d0d986052f90200e3281f14f40dceb8a85547a681525a798829b2ab0818ffa0f185ab5dae7b1d6e7c2aa2bb4dcc03392baa732d9184da8fc33ca551616356faa02ccea0afc5e45712ee6485a78cd2912535198470651a554e94b453aad8cbd60da05be29334f4504f5f47f44ce970827664704d584a526a5683e0f26e5cd5041a25a0d81ab119c255376982d1f8c955bb0841386be0105e1ef6680b601c004ed8d415a07aa76afcca71c9e2230d4bf53bf7f2e31d350ee3c78e96a798174d4f55e584ffa0670b913a9ac9a6dbd871a40279b57953673946e86ccd05d95633ebc5bbe5b188a0f8a4eac59ac78af02c47e6102f7193e2643d3358bbd79ffd2f1a6d0f0f0c165ea0758266147704772c0a26c73c2b15f6fc1333d9f06d61f0a98b11911cdc0e6de4a0dba0b5a5c9cebe4a50b996e436845d0de0f703df346711d836b00e25f6d86bd4a088ca6ad3f65bd25c9c1b3fc1adba9805150dea0469555c2e2005c2e57fcd3003a0644ac23638cfd5d2bf7be1a18245245b9491bbb07b4ad041b7779a7bdb5025e580", + "f90211a0a1f7aac2995a5ed36bebaed5271dc61ac2388ee098dda2dd3bfce1ece0bfa829a0a8ae801f8cb8734df7b4826aab3c0f8daccc64effcf9497872c3bfcf9963c8fca037bd182a4739e2c71e97316b3cbee78173bd35bb8b3f60ef84e20c81cccd6b8ea0d3e5a8fdf0b394b753d56a0a07e60cafeed93ae896e508a2834657f4cfaf4e74a0bf5811b7827b6887a2afe150e9f84f01a9eb35eefbcacbce534e6cb574175632a0493c6adedeb34305ca3c8b0be070789f2b3ad5eb05a4faa3863c4dc335fb4189a09ed60b16f83213a33aeb53a77c14a243888e20238ab51bf364fcc1ffe6966153a0c6b9a7d02f4041391b21c85e9310cab8fa08e0c02ce7ad1bb9545e81d0db7670a0866b77b81c0a64e84035db172b1a479292b2d190228001ae276784fee258c607a0b426825472c8c661b05879c3757b958901b39ed09265724b17361cd0f15f74c3a061170e214ffcb0f8a2a17b8a64d6f4e588b0f9d64b1b78a8f860ccacd3922369a04de8f9edb1ad322a3568ac471831fbf175efd1c9b2b02b5d9d10a184d54b73c1a03a70896331cef4434e0a395595fe548cedb5c71529421a19359e42ca962429a5a09ffb6c4bedd8d72d73d3a0c87f71f2a41e9955df5fb5e483aa6c4a2ee8d45b26a0db4b26c625be8cc1aa9d17456139c8d5143c445ef877769050222b2fac5f929ba0c3afc1c5f13607cf561a073a6f341227a90376e87e48c54164eef19c51c5cd2780", + "f90211a0a728578ddfbd4e3fa913f10f73f4464fc95a3277ac3783078d07534872f60c8ca0bc6c1301ed405c0ce52e31bd667abe0d559b71d5c6ee515b4e977f4c1b7d2de5a042cab541119e6e1b305fc51bc3a9099a7ed323bcaab1b103f4a09c5fd1a5ffa9a0f29d1a4e35bb3cf9f17a3033f26bab8ac56e6abaf2df83d0878e9d45e4dbb262a08373516dca2167359f81c6086d086f9f6b647f0a5323a670271e8fbf4b15cd47a0acdfebaf24830b92a3deb6e44422afeef55efce4d0bbf0913216d9156459e41aa06bf7ec716d7579c4b784db41b0f3549c1aa033956968642836c37e0348a09bbfa010ffffce72a9f81a7a5491087febd53178879cfe59fa7645b9314ce07923f496a0a3a18069f84b16289144769be298aeb15cb78746012ef3c9893113109ea26163a0c872f57c7064d3ecf1e0dce8b7f2d31e151fab8c1048bce5e021fb5cc25e222ca0441bb13319c322f67c4cea9fe9e7ff4c81061b5b80cbe37254deffae3bfb3163a03b2bde0648f7489fea985da3a45c2d7b404d0dcd70eb62097dd0d76860acaf3fa046e54b2e41afe0594e4b32bb68f890eb2be0c522177a0098d9e209cd61fa52f9a079d38c8ffd67624fcee4d1307761bebe7f869d3f4046e99daf27bcf303a5174ca07a2c3cdbc8e4a22aa5ad600411810e4025ef84b79f132a4b75a9406f1cf60926a0529c91b9cc16adf0bcb72bac2ba86dd5e035e3e689ace0d4809ee6552a64119480", + "f90211a0cd42164ae552d0d13db9f9cf38653c224a34d604a9db71748e312248b7a3af38a0184e6eb3ea4728266438c0b7f687f62a96d6daa740711a678e1e0edf33361489a03c764463c2172ab6dbec2c495c2cf13796512cb3f369a10dbc3684bbd5fb4018a015ea238cec5879fa069d204e93ff3c951f99d63407860df1882a2c59f325052da0ab5c18775aa03057f7ade4b6bffd094cb5112bd47e80d576ac2415eb33ae9654a01dfdfc623921a2948b00c4e0eab2d054293ca4869e09eaa79cd88ae492728788a0f4e962298ff3966fd3cfeccc21a74d0b1a8e39d14dfc3a68d1f941e57ad917cba01fabe2077c23f5bc163eee76ff628c03d6d45b94445bd21df4a9b8c647b5a10da0ef92e8b81eea7608968d2272119cb6be77030b85de6cceca3b9d4acde44c1a2ea0d2c9d3bc2a51638936232907f2daa0a23325421ca4efc57248674081889f8832a07e75144a554963f4cb7088c4809cc8d14aab35fcfa4fe2e023ae82e45b65929ba01d11f73ff1b0c64899fde18ad85b08bbb7b3d7a46cda25a9c8668665e8bdb706a0be6a24e94b1689142dda1b4ef3750ff486f990d4610b1878b760404a468e59a7a02690ac779ae564dce3567fab4ca03c7b5f56da23d882b68be067dafb0829fc08a00b4230a149ff4dca81cd7682536de8b1be2fa715bcafb967c35156fdc626dc3ba0d1fea826722117b8482d59658586a2802577a9d9114d5d8791b93364e998732d80", + "f90211a096da0777dbb2f875bd357722a4387a78ae24efe13e04ed75f65b2c991247203fa0c0082d34071d1d65e712999126ac28e277b079d939821eaa755c4ef0fd2e5baaa0d088ecbd4b6bb84c6fa211bc81474c05c12ca2694faf0b1a2ecbde0bfe6fa3a2a00930aa5c1b70190cd2231cc759fec0c863a2e11bc89b1685d17da64f6bdc5e72a010b3d58569454bcfe1e6c9fad76e7034972f2abb6a3081b3c6b057c7d3151e2ca0868e866d17747182e462be130ceb1b0b3b5011db9f10f3fc8a00743c50497eaaa0aff0dd0b6a09d0e5659b96333f74fd56545addb56451693c1daeb2dbd7fe4470a07094c93901a37d76cc1ce99891c7419188b9dcabcd73075525a844084574c697a0cfd98d359eb86b3cf4531a0ddfa5d1ae5e5cdbed5f3a6a39daff489b2c862ed5a00f80e0d59b59c9e9e27aba7ac54d51f35750c45d45fb3d46c2cf31cb32a8e68aa02a5c88410b94694ae8882eda87af1c56616cd475b0b7feb2306da3959b322418a0609c5a3f274c1d31fa9b4d3c4492b4811c374e4d3d08ca5da98da012a489b273a0e57f95cc7d072bdd273c4bf504fbcabe2b356236151e53bd53af301fe794e34ba0a274c42f4ccef6f20a413218137c6ec00ac7e3fa172f61a7c6487497fe427daba0961e5aac1726d9598c446db66425f7360f87fa5feb744adcfaf19e783cbba1a5a0b5c730c7587872bdc05bd0786f6fd897332d7d2642f953fa019ef58d4e5ec25e80", + "f90171a02a6e86561c33eacbb1826e9832a25f9f2841c281c9e6b6c18c95ce713dae6c868080a0807528ab397894421968b62bead3b9dd446bda7dc79a5b6ec5a29bd3f19a10c5a0072bce4e78f01cc370c9d92dd39bfcee6059d2e60a95135867991c59184d219980a0415df007b0977e95ba9b3d86b64bae14c02250b3da81f81bed47973f9e4a55b180a0e45736d96c006965b5cad5ec8008d31eb2c34e00c36f677b288701f76f43d627a055324754b7752c9149df27e03392c0598ec89f408040b15140a679f02e695017a04fc91448749dcab3e66cc8e45eb8d85a416fa3a33f8951128d17ca208bc3bb38a085a91d9af48d4f428da097b31c09b3f6b27d38212678a30ffd100364546a4d1ea0c60b5a89f1f89e97528a8b352ed55e5de2e7b963d73ba7de9e922c0ae964e816a048ff598a81a0114eb4afe71ef547cf6fecbb970310ef84049c9353d01c17103aa08d1d7f774f6570c92fd5d70617266469dade16fd9e5cad87af44c15fa34d075a8080", + "f871808080808080a03f1587ebf71f19f47449b08f0960630ddbd60d045ea68ee7d89fb1c5682d215a8080808080a060abf60878dd69cb6e3a7bd92aeca7514df19f822555e528101da922493f6a758080a05344081f911ad616b960a8f2841eb55f4936a97ec5dae614e726c8c0d51e0eff80", + "f8669d3e3757038b7fea6585ca2d0a3dacd72d84bf0c7b916f169cea0348681bb846f8440180a0e4acc7f2f495a3bd919d8b5c2b2ab1446a293d16b7981141cf6f3594c26554b6a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75" + ], + "contract_address": "00763f30eEB0eEF506907e18f2a6ceC2DAb30Df8", + "expected_account_state": "f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75", + "storage_key_hash": "0f9e5fde3c4a1600408ce3ebbd6a720b7491c663bef3fedcf7835dd6863fd34b", + "storage_proof": [ + "f90211a07c66fa00b691dc5c5a66e43831b9922316c8740c3c5235e7aa705cebefbd478ca0bbf8c0df9d3837792180786e217cbcbfb6cb6c1ee790ec0dba83fc05248f2627a036b93382543cd1737ddc32dbc8cd4326da47551be33e3ca75af3ea98583edd93a0c024e6190b7ce41e20f27b5cd512ebf50d6c60a1467f3cad8acd46da3a4d3861a04134b666e4a8e3e28701e33bed36680ae025cc5f89f8d29457975148338017c4a0ad773b24d54d681b3d712d913c0bf515407818845922616360b9b5a381cd6299a076515bac0f65924da357aba2f6c312472a9ef94d1c459f2cd0380b84a91d46aca0f49dd3a32c4adb7b6f02188b32a7823c79bb5b2ed1f3cdf4da11c36304ae4e25a0324a3b32bf60329775f3383b6c98e99683df56a0933516032147008d544af343a029f967b2d7ed040cda92ab4905f2976636a7bb16ba850679eca942e02d5b3458a024bdf35e1d8fd46cdee76420d508c722d7f47825356620c266094f6c66c67f7ea0426a496a8633ec2771fb15f58f646bf689eda39af535bcb9b316e9e601d1a342a00d9cd9aa39cdd4a91bcd4feb8c73db017dce78ec82ba6f14287775567615f247a02f3d28876d69fd8945b3fdeff87186bcb97c236ccefa3b6182507bc6e504606fa03b4078e843b8927c29753dfc91a44c246cb22ea3673a3bad8dab7c8f6b8ce226a061983eaffadbdc7d6e7a0f9d9f5c1c64f983a4a6724aaa2126a0b6c03c984f3280", + "f9015180a01061b943f8579b3fd877fbb9f5a796b40bad0e3c4cf6543287843cbc393e928da082da424f81780a75ef25a30590a9e5ec85637cb96dd708eab214029bb7324363a0809ffaa235bdd55f80127144f1918251205617992df98a93e871be18a481aaba80a0e30a57c48730f365adf774e3306ae2fd27abc854dc628b29c3b8873818e22adaa0aa6b491b53c837a2d87a4cf0e7995ce65030583199b48597cde9481d64e46deca0dbb86b57d06b8e9098b6db1d33c0ea963bf767f36e0e30559e64df69ab23d80180a0abaa7983dc34ba047258543b43cb5791d9fc73820c5103feaff960c35e2d2b4680a026f6892a3438aac58a8dfb5eeeefc1dc391e520eb1a401cc2a3a16ff617e3a578080a0d77dc10b28e64185d1d0306fb29003c89c300ed9041b476c08074161510b3670a0b36ced44fa006dd920a4f0281d389ecee50f66bd99f964ac50934065c5c873d680", + "f871a003c2a7f927a157d07815fdd586453a7f82223b912344dcb85fdb717b268cddb98080808080808080a0ad44120a824ee96076f8c53f155604f1e778eb0c678303eb680b69e3b72d7b9f8080a0dd6eb7d9c298eea97e0c3779437f0247e76237d430aeee5c9676830ed4e19e7480808080", + "e19f3e5fde3c4a1600408ce3ebbd6a720b7491c663bef3fedcf7835dd6863fd34b01" + ], + "expected_storage_value": "01", + "min_header_height": "", + "max_header_height": "", + "skip_bridge_call": true +} diff --git a/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectHeaderExceptStateRoot.json b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectHeaderExceptStateRoot.json new file mode 100644 index 00000000..1b5a9cd1 --- /dev/null +++ b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectHeaderExceptStateRoot.json @@ -0,0 +1,26 @@ +{ + "header_data": "f90217a02feb03d38518e6941c0852c64a9cc06be8f0caed9357d0c45136395110ef4540a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794388ea662ef2c223ec0b047d41bf3c0f362142ad5a0611e6617bd56b23286a317a8cfe78274a76f9624c207ed9f567f12db53026cb5a083c4eeccb9dad0f16ca684785dd347c70e3c35573ebb38b6db5550d5e2eb2039a0f7679d652f72b54fd7c579a4738ae4d47c53213f266b5a2c2446a53386d17000b901005f04c0c31260591c81984881b480200041180c10098408d4d8840434c215211800660401002162160128100000c44bf4c0c20080061022544a185e0081242a000030000c4444811c600840285d0480624449060340cc6092080220a6000002050a0012428300a20010281180141408049801084502684280311012320608114002000a60802220aa29004800229100280001208004201140009140144462000502a0881100002810134340008b06402082004040224030080091406a288609021291480200194c49160440b14017660c4440018812086589620a005c0c0068839838ab040040a40754492158c0112414c892141012082040020a4a2102800040308381979a8401c9c38083972d598463ec1de09b4d616e69666f6c643a20636f696e62617365202d20676f65726c69a0fbd610d479f34d78d3c1ee5d525906e119babfa742966dfaabfba6ffc6499c3b8800000000000000000c", + "account_proof": [ + "f90211a09f2010af3cc9c6d2ff727c81f7524ae503f90284e5cb802f6fd9358c163e198ca08548267c53e930b5a18b2364c5cb3aff3c14870ac2275eb6f8a54388a58b5567a0f71f37002acc0a2eaa7b540cf6d14eec6d1a0c0e05fa47294c17f1b313b5c8cfa03b6953e75441ca9a3a1cf4cfd1143357023b305698259217d69b2fc2ce60858ea07c2d0d986052f90200e3281f14f40dceb8a85547a681525a798829b2ab0818ffa0f185ab5dae7b1d6e7c2aa2bb4dcc03392baa732d9184da8fc33ca551616356faa02ccea0afc5e45712ee6485a78cd2912535198470651a554e94b453aad8cbd60da05be29334f4504f5f47f44ce970827664704d584a526a5683e0f26e5cd5041a25a0d81ab119c255376982d1f8c955bb0841386be0105e1ef6680b601c004ed8d415a07aa76afcca71c9e2230d4bf53bf7f2e31d350ee3c78e96a798174d4f55e584ffa0670b913a9ac9a6dbd871a40279b57953673946e86ccd05d95633ebc5bbe5b188a0f8a4eac59ac78af02c47e6102f7193e2643d3358bbd79ffd2f1a6d0f0f0c165ea0758266147704772c0a26c73c2b15f6fc1333d9f06d61f0a98b11911cdc0e6de4a0dba0b5a5c9cebe4a50b996e436845d0de0f703df346711d836b00e25f6d86bd4a088ca6ad3f65bd25c9c1b3fc1adba9805150dea0469555c2e2005c2e57fcd3003a0644ac23638cfd5d2bf7be1a18245245b9491bbb07b4ad041b7779a7bdb5025e580", + "f90211a0a1f7aac2995a5ed36bebaed5271dc61ac2388ee098dda2dd3bfce1ece0bfa829a0a8ae801f8cb8734df7b4826aab3c0f8daccc64effcf9497872c3bfcf9963c8fca037bd182a4739e2c71e97316b3cbee78173bd35bb8b3f60ef84e20c81cccd6b8ea0d3e5a8fdf0b394b753d56a0a07e60cafeed93ae896e508a2834657f4cfaf4e74a0bf5811b7827b6887a2afe150e9f84f01a9eb35eefbcacbce534e6cb574175632a0493c6adedeb34305ca3c8b0be070789f2b3ad5eb05a4faa3863c4dc335fb4189a09ed60b16f83213a33aeb53a77c14a243888e20238ab51bf364fcc1ffe6966153a0c6b9a7d02f4041391b21c85e9310cab8fa08e0c02ce7ad1bb9545e81d0db7670a0866b77b81c0a64e84035db172b1a479292b2d190228001ae276784fee258c607a0b426825472c8c661b05879c3757b958901b39ed09265724b17361cd0f15f74c3a061170e214ffcb0f8a2a17b8a64d6f4e588b0f9d64b1b78a8f860ccacd3922369a04de8f9edb1ad322a3568ac471831fbf175efd1c9b2b02b5d9d10a184d54b73c1a03a70896331cef4434e0a395595fe548cedb5c71529421a19359e42ca962429a5a09ffb6c4bedd8d72d73d3a0c87f71f2a41e9955df5fb5e483aa6c4a2ee8d45b26a0db4b26c625be8cc1aa9d17456139c8d5143c445ef877769050222b2fac5f929ba0c3afc1c5f13607cf561a073a6f341227a90376e87e48c54164eef19c51c5cd2780", + "f90211a0a728578ddfbd4e3fa913f10f73f4464fc95a3277ac3783078d07534872f60c8ca0bc6c1301ed405c0ce52e31bd667abe0d559b71d5c6ee515b4e977f4c1b7d2de5a042cab541119e6e1b305fc51bc3a9099a7ed323bcaab1b103f4a09c5fd1a5ffa9a0f29d1a4e35bb3cf9f17a3033f26bab8ac56e6abaf2df83d0878e9d45e4dbb262a08373516dca2167359f81c6086d086f9f6b647f0a5323a670271e8fbf4b15cd47a0acdfebaf24830b92a3deb6e44422afeef55efce4d0bbf0913216d9156459e41aa06bf7ec716d7579c4b784db41b0f3549c1aa033956968642836c37e0348a09bbfa010ffffce72a9f81a7a5491087febd53178879cfe59fa7645b9314ce07923f496a0a3a18069f84b16289144769be298aeb15cb78746012ef3c9893113109ea26163a0c872f57c7064d3ecf1e0dce8b7f2d31e151fab8c1048bce5e021fb5cc25e222ca0441bb13319c322f67c4cea9fe9e7ff4c81061b5b80cbe37254deffae3bfb3163a03b2bde0648f7489fea985da3a45c2d7b404d0dcd70eb62097dd0d76860acaf3fa046e54b2e41afe0594e4b32bb68f890eb2be0c522177a0098d9e209cd61fa52f9a079d38c8ffd67624fcee4d1307761bebe7f869d3f4046e99daf27bcf303a5174ca07a2c3cdbc8e4a22aa5ad600411810e4025ef84b79f132a4b75a9406f1cf60926a0529c91b9cc16adf0bcb72bac2ba86dd5e035e3e689ace0d4809ee6552a64119480", + "f90211a0cd42164ae552d0d13db9f9cf38653c224a34d604a9db71748e312248b7a3af38a0184e6eb3ea4728266438c0b7f687f62a96d6daa740711a678e1e0edf33361489a03c764463c2172ab6dbec2c495c2cf13796512cb3f369a10dbc3684bbd5fb4018a015ea238cec5879fa069d204e93ff3c951f99d63407860df1882a2c59f325052da0ab5c18775aa03057f7ade4b6bffd094cb5112bd47e80d576ac2415eb33ae9654a01dfdfc623921a2948b00c4e0eab2d054293ca4869e09eaa79cd88ae492728788a0f4e962298ff3966fd3cfeccc21a74d0b1a8e39d14dfc3a68d1f941e57ad917cba01fabe2077c23f5bc163eee76ff628c03d6d45b94445bd21df4a9b8c647b5a10da0ef92e8b81eea7608968d2272119cb6be77030b85de6cceca3b9d4acde44c1a2ea0d2c9d3bc2a51638936232907f2daa0a23325421ca4efc57248674081889f8832a07e75144a554963f4cb7088c4809cc8d14aab35fcfa4fe2e023ae82e45b65929ba01d11f73ff1b0c64899fde18ad85b08bbb7b3d7a46cda25a9c8668665e8bdb706a0be6a24e94b1689142dda1b4ef3750ff486f990d4610b1878b760404a468e59a7a02690ac779ae564dce3567fab4ca03c7b5f56da23d882b68be067dafb0829fc08a00b4230a149ff4dca81cd7682536de8b1be2fa715bcafb967c35156fdc626dc3ba0d1fea826722117b8482d59658586a2802577a9d9114d5d8791b93364e998732d80", + "f90211a096da0777dbb2f875bd357722a4387a78ae24efe13e04ed75f65b2c991247203fa0c0082d34071d1d65e712999126ac28e277b079d939821eaa755c4ef0fd2e5baaa0d088ecbd4b6bb84c6fa211bc81474c05c12ca2694faf0b1a2ecbde0bfe6fa3a2a00930aa5c1b70190cd2231cc759fec0c863a2e11bc89b1685d17da64f6bdc5e72a010b3d58569454bcfe1e6c9fad76e7034972f2abb6a3081b3c6b057c7d3151e2ca0868e866d17747182e462be130ceb1b0b3b5011db9f10f3fc8a00743c50497eaaa0aff0dd0b6a09d0e5659b96333f74fd56545addb56451693c1daeb2dbd7fe4470a07094c93901a37d76cc1ce99891c7419188b9dcabcd73075525a844084574c697a0cfd98d359eb86b3cf4531a0ddfa5d1ae5e5cdbed5f3a6a39daff489b2c862ed5a00f80e0d59b59c9e9e27aba7ac54d51f35750c45d45fb3d46c2cf31cb32a8e68aa02a5c88410b94694ae8882eda87af1c56616cd475b0b7feb2306da3959b322418a0609c5a3f274c1d31fa9b4d3c4492b4811c374e4d3d08ca5da98da012a489b273a0e57f95cc7d072bdd273c4bf504fbcabe2b356236151e53bd53af301fe794e34ba0a274c42f4ccef6f20a413218137c6ec00ac7e3fa172f61a7c6487497fe427daba0961e5aac1726d9598c446db66425f7360f87fa5feb744adcfaf19e783cbba1a5a0b5c730c7587872bdc05bd0786f6fd897332d7d2642f953fa019ef58d4e5ec25e80", + "f90171a02a6e86561c33eacbb1826e9832a25f9f2841c281c9e6b6c18c95ce713dae6c868080a0807528ab397894421968b62bead3b9dd446bda7dc79a5b6ec5a29bd3f19a10c5a0072bce4e78f01cc370c9d92dd39bfcee6059d2e60a95135867991c59184d219980a0415df007b0977e95ba9b3d86b64bae14c02250b3da81f81bed47973f9e4a55b180a0e45736d96c006965b5cad5ec8008d31eb2c34e00c36f677b288701f76f43d627a055324754b7752c9149df27e03392c0598ec89f408040b15140a679f02e695017a04fc91448749dcab3e66cc8e45eb8d85a416fa3a33f8951128d17ca208bc3bb38a085a91d9af48d4f428da097b31c09b3f6b27d38212678a30ffd100364546a4d1ea0c60b5a89f1f89e97528a8b352ed55e5de2e7b963d73ba7de9e922c0ae964e816a048ff598a81a0114eb4afe71ef547cf6fecbb970310ef84049c9353d01c17103aa08d1d7f774f6570c92fd5d70617266469dade16fd9e5cad87af44c15fa34d075a8080", + "f871808080808080a03f1587ebf71f19f47449b08f0960630ddbd60d045ea68ee7d89fb1c5682d215a8080808080a060abf60878dd69cb6e3a7bd92aeca7514df19f822555e528101da922493f6a758080a05344081f911ad616b960a8f2841eb55f4936a97ec5dae614e726c8c0d51e0eff80", + "f8669d3e3757038b7fea6585ca2d0a3dacd72d84bf0c7b916f169cea0348681bb846f8440180a0e4acc7f2f495a3bd919d8b5c2b2ab1446a293d16b7981141cf6f3594c26554b6a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75" + ], + "contract_address": "00763f30eEB0eEF506907e18f2a6ceC2DAb30Df8", + "expected_account_state": "f8440180a0e4acc7f2f495a3bd919d8b5c2b2ab1446a293d16b7981141cf6f3594c26554b6a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75", + "storage_key_hash": "0f9e5fde3c4a1600408ce3ebbd6a720b7491c663bef3fedcf7835dd6863fd34b", + "storage_proof": [ + "f90211a07c66fa00b691dc5c5a66e43831b9922316c8740c3c5235e7aa705cebefbd478ca0bbf8c0df9d3837792180786e217cbcbfb6cb6c1ee790ec0dba83fc05248f2627a036b93382543cd1737ddc32dbc8cd4326da47551be33e3ca75af3ea98583edd93a0c024e6190b7ce41e20f27b5cd512ebf50d6c60a1467f3cad8acd46da3a4d3861a04134b666e4a8e3e28701e33bed36680ae025cc5f89f8d29457975148338017c4a0ad773b24d54d681b3d712d913c0bf515407818845922616360b9b5a381cd6299a076515bac0f65924da357aba2f6c312472a9ef94d1c459f2cd0380b84a91d46aca0f49dd3a32c4adb7b6f02188b32a7823c79bb5b2ed1f3cdf4da11c36304ae4e25a0324a3b32bf60329775f3383b6c98e99683df56a0933516032147008d544af343a029f967b2d7ed040cda92ab4905f2976636a7bb16ba850679eca942e02d5b3458a024bdf35e1d8fd46cdee76420d508c722d7f47825356620c266094f6c66c67f7ea0426a496a8633ec2771fb15f58f646bf689eda39af535bcb9b316e9e601d1a342a00d9cd9aa39cdd4a91bcd4feb8c73db017dce78ec82ba6f14287775567615f247a02f3d28876d69fd8945b3fdeff87186bcb97c236ccefa3b6182507bc6e504606fa03b4078e843b8927c29753dfc91a44c246cb22ea3673a3bad8dab7c8f6b8ce226a061983eaffadbdc7d6e7a0f9d9f5c1c64f983a4a6724aaa2126a0b6c03c984f3280", + "f9015180a01061b943f8579b3fd877fbb9f5a796b40bad0e3c4cf6543287843cbc393e928da082da424f81780a75ef25a30590a9e5ec85637cb96dd708eab214029bb7324363a0809ffaa235bdd55f80127144f1918251205617992df98a93e871be18a481aaba80a0e30a57c48730f365adf774e3306ae2fd27abc854dc628b29c3b8873818e22adaa0aa6b491b53c837a2d87a4cf0e7995ce65030583199b48597cde9481d64e46deca0dbb86b57d06b8e9098b6db1d33c0ea963bf767f36e0e30559e64df69ab23d80180a0abaa7983dc34ba047258543b43cb5791d9fc73820c5103feaff960c35e2d2b4680a026f6892a3438aac58a8dfb5eeeefc1dc391e520eb1a401cc2a3a16ff617e3a578080a0d77dc10b28e64185d1d0306fb29003c89c300ed9041b476c08074161510b3670a0b36ced44fa006dd920a4f0281d389ecee50f66bd99f964ac50934065c5c873d680", + "f871a003c2a7f927a157d07815fdd586453a7f82223b912344dcb85fdb717b268cddb98080808080808080a0ad44120a824ee96076f8c53f155604f1e778eb0c678303eb680b69e3b72d7b9f8080a0dd6eb7d9c298eea97e0c3779437f0247e76237d430aeee5c9676830ed4e19e7480808080", + "e19f3e5fde3c4a1600408ce3ebbd6a720b7491c663bef3fedcf7835dd6863fd34b01" + ], + "expected_storage_value": "01", + "min_header_height": "", + "max_header_height": "", + "skip_bridge_call": true +} diff --git a/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectStateProof.json b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectStateProof.json new file mode 100644 index 00000000..a46ee4b5 --- /dev/null +++ b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectStateProof.json @@ -0,0 +1,26 @@ +{ + "header_data": "f90217a02feb03d38518e6941c0852c64a9cc06be8f0caed9357d0c45136395110ef4540a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794388ea662ef2c223ec0b047d41bf3c0f362142ad5a035630b01ab13a7f864f9c86f2a2d7ac497320594f92c5868e17063260beba833a083c4eeccb9dad0f16ca684785dd347c70e3c35573ebb38b6db5550d5e2eb2039a0f7679d652f72b54fd7c579a4738ae4d47c53213f266b5a2c2446a53386d17000b901005f04c0c31260591c81984881b480200041180c10098408d4d8840434c215211800660401002162160128100000c44bf4c0c20080061022544a185e0081242a000030000c4444811c600840285d0480624449060340cc6092080220a6000002050a0012428300a20010281180141408049801084502684280311012320608114002000a60802220aa29004800229100280001208004201140009140144462000502a0881100002810134340008b06402082004040224030080091406a288609021291480200194c49160440b14017660c4440018812086589620a005c0c0068839838ab040040a40754492158c0112414c892141012082040020a4a2102800040308381979a8401c9c38083972d598463ec1de09b4d616e69666f6c643a20636f696e62617365202d20676f65726c69a0fbd610d479f34d78d3c1ee5d525906e119babfa742966dfaabfba6ffc6499c3b8800000000000000000c", + "account_proof": [ + "f90211a08f3ec3607756301ad7628386a694edef062c32c0af69abdd8582733411fa6f4aa0e9ad940b31824dacc65417f2ae3aafe394949948f5805e645f6a5d7e7f0a5f28a078698a03fd4d2d738df437e1d39ac6dbe2b331474483083ecacd9270227adccea0b13728bf8c7541aac2e5f15840030e1a2a1d8546af961d2c5fe3cec61eb52136a041e20da27ab9f63b643aa550bd5494f42eb980e728499362807ca4a3d20bbd71a0544dfa7c44c6f4fc4318e6d42c8baa7db02467e31bdecb39a5b5c35dc9d75627a082e724d82008044c2339c3518899c58fa94397ec9b754a84ee6862ed980c506fa09858c9a0c3770fdcf0a95ee8657db7e5ff2813a5ee2b02bd2d550602ccf92ceca070c39b9018c1099644f6c8302f054b889f0d9c1c43561193af08c60514373a86a05147dd91ed6576bcb99c84b82e21267336fb5e7b6532bbc3bf3f153c44c7dd8ba0996167eb0ec29dcf3dc5564335936c857a16381f6cfc41e898ac427d5096f763a061cc346b3b193043469e1e63078e26bdffdc77fb9b7e03376a5d04a2e6a8bbd7a05ebe3f8899a1c9ae5c6f519c21bab07f380bc24eacd32d4915efa30990373347a0537e35aef2230294fb0150b5100ce1be4929181b2cbe16919ebdaf5455980a6ca0b11e4d342e93978e8ce006c6dafdc11a4626043ad6cd29c3a20fcaf7469e8846a0c2034f69510242f1af24e3cf53bdf8013959107de3863457d1759a0607cb42bd80", + "f90211a0cb604e92bfce9e89c58adb96d031edd6773b5ea79468c361c11bee3834ad38f7a0c3600619870fbddd0d3031662c20d4f07a7e8879715221e1cf2a27bac8252e84a0b42bfa4ca8a0f93155decb6566a0bfe41da0f0805f50bf22e582fbe09dab761da0f01302bc5b806c36dab88cf8fc3e720d2a9ea8b8c615cb2d6a61e516e7d568d5a0eb7a165077f85af7e1529e66bd052e211e3b0e591459a6b917b3a67b96e6c300a099b855be27efd92907fb6671240ad9b5a194aaaba80ec57f780f7f5132679279a076caa859434ddcc7513f2c40bbcdb0d3c92ef7f00f5575e5103683ed3f12d7aaa04b1f24333d5e1ff59bc1f0e68a4bffc09a109b59b281991e1def7d9a4d304683a01d24cc1c910469b1d5daf5c1ed9a0ff4b90467671498592b2b10bedb28594afca0f6c8564af03a1d6fa2203ad17d1c6cbbf608baed014de79c85c560149bac34a2a014a2351fb2913c7eead2607e6e821cb861a0acecce7e8d6b3eee285cd069b0f0a026385df23dbeafd3adff1c5537bc9b47716c3149c4d557cacaa31f67f8eb854fa0d759139f6c612b3ad3a4f1930a20f5bd1bcbd7e5595ccad018f066cde7cef5b7a052a24711316c1bccd8b72b59e1e0da3bd3254258651f42c468dbc06d33a5ece4a047f3cb14ec806f64d4bdeb04a60aef31966f50b2b191c9d5f697e01e5bc47654a0003d585567fb4aea17878d81f6c8e95e38218216e31263d85b01e387dcd12b6f80", + "f90211a07aa1913685063febef9253361de62ae7177722d980431ad433b6b2a2464d3c04a03df3486d470dc33c576fa0442eeac73b28032d892cee651cb5c8a714ba958f66a06482a869a326022a5fc40172cd9bbae5920b85a4138273da18eed05d2d75d97aa02a026697251d16fce297a1ee61d123da79085dc24ec356bff0f48f5708b04975a026cab39115772141ab3560790f604bf798b8d8744574ec842f57acba1bd3529fa0b78a5d4dcc2f37bbc0e8ba50727e7d08b143080aa2f93355f890bb7a615dae92a005b2270294d81e96ee9c7258f82a4541ec7a6a4eccf5de6fe54821d2e297d8f4a0d8d4d961a8e24b1e2886ee56762b1cd7f77e0ac76f9095636e9a008986b2028ba0eb02ba490b14fab24930230234056ed1cfaaf91fa4a57d9b9a7a178abe1cf3d2a0ba993d463bf76b12d4702be9696e0a1236ab7cd38e9fb590496151e4302ac7c1a08cbbd58b931fa2111148bed4e38c68e827b9a155c1eef0e63f43aa263cc10acea02e9bf22e9f981f53ed4856a0020449dc813cf444781b51fa3eabe13e0232f966a0a3622e12dacf5a9d1df00fe7e59326e1e96f1455492d72e39d5b6bf5f00eebb3a0a52a0b202c7059b5621fc10fd2921babe2c27934fae2d0409cbdc5b76d6b41a7a056aaef786ef7c8b3bda6d9ae2780478a1edc82b1f22e606bd3defe34a9cdeab5a0bf81e0ec8e926a748517a28422ff88e4a3f138a6f9175249c207f3178900bd9380", + "f90211a036e911e298a20d166922b7cb0563d3bceb8550b4adfa9fe08d8ca0a3c6d7ae86a0b9b9ac2b7a0a7c4d415787487e231900a10407acd166e92295ada52ea762c472a03a996e1b0ec3e2bddb98e7767e4666bcd40fa2273e0d3f52fa430f9a46938e7da015ea238cec5879fa069d204e93ff3c951f99d63407860df1882a2c59f325052da051fe87082dd2a2ac9e3610f6a85daba6468f7be31bc0301d3bafb579031848a2a01dfdfc623921a2948b00c4e0eab2d054293ca4869e09eaa79cd88ae492728788a036828736fa97fc9f14f0471b2cef6d6de6ed8e85f60581340e32314f55426d83a0e060a030a17644b352fd5d809fbffab09e4854e5cf79e907775571e72efdbe65a0b99a9776ae25aac78712102d448bca2ad2b0855d9485fd3e5aabc755a857ea1ba09774c71fdeb56de7925402760fc787d0f81a7e9373f017cbcdbba81b2c12df33a0af0f67963ad8a449e4ad7b613c58cb40ccf16786659ca716e9083b981138d2efa09bdc7b5850cd1050dddbc864a0d391312343fb542944cf0409f97ff2213b9f5da09792e17ea99e242aec9465df7f1b2b77e4c2ba916465d5b99702f4c6152bd82ea0dd32ae4192e7f1050eecd2573cc2c324fbbf6bf98cc61a6511920e8ab32091e5a00b4230a149ff4dca81cd7682536de8b1be2fa715bcafb967c35156fdc626dc3ba0b722557e1dc96d95b6af1aa5871ff90d300ce8632102e6b23e7e5d94101702ad80", + "f90211a096da0777dbb2f875bd357722a4387a78ae24efe13e04ed75f65b2c991247203fa0c0082d34071d1d65e712999126ac28e277b079d939821eaa755c4ef0fd2e5baaa0d088ecbd4b6bb84c6fa211bc81474c05c12ca2694faf0b1a2ecbde0bfe6fa3a2a00930aa5c1b70190cd2231cc759fec0c863a2e11bc89b1685d17da64f6bdc5e72a010b3d58569454bcfe1e6c9fad76e7034972f2abb6a3081b3c6b057c7d3151e2ca0868e866d17747182e462be130ceb1b0b3b5011db9f10f3fc8a00743c50497eaaa0aff0dd0b6a09d0e5659b96333f74fd56545addb56451693c1daeb2dbd7fe4470a07094c93901a37d76cc1ce99891c7419188b9dcabcd73075525a844084574c697a0cfd98d359eb86b3cf4531a0ddfa5d1ae5e5cdbed5f3a6a39daff489b2c862ed5a00f80e0d59b59c9e9e27aba7ac54d51f35750c45d45fb3d46c2cf31cb32a8e68aa02a5c88410b94694ae8882eda87af1c56616cd475b0b7feb2306da3959b322418a0609c5a3f274c1d31fa9b4d3c4492b4811c374e4d3d08ca5da98da012a489b273a0df38f9ab051dcee8d4f1a00376b01acecb3b7e9dbc40358c3d6d5958193e0329a0a274c42f4ccef6f20a413218137c6ec00ac7e3fa172f61a7c6487497fe427daba0961e5aac1726d9598c446db66425f7360f87fa5feb744adcfaf19e783cbba1a5a0b5c730c7587872bdc05bd0786f6fd897332d7d2642f953fa019ef58d4e5ec25e80", + "f90171a02a6e86561c33eacbb1826e9832a25f9f2841c281c9e6b6c18c95ce713dae6c868080a0807528ab397894421968b62bead3b9dd446bda7dc79a5b6ec5a29bd3f19a10c5a0072bce4e78f01cc370c9d92dd39bfcee6059d2e60a95135867991c59184d219980a0415df007b0977e95ba9b3d86b64bae14c02250b3da81f81bed47973f9e4a55b180a0e45736d96c006965b5cad5ec8008d31eb2c34e00c36f677b288701f76f43d627a055324754b7752c9149df27e03392c0598ec89f408040b15140a679f02e695017a04fc91448749dcab3e66cc8e45eb8d85a416fa3a33f8951128d17ca208bc3bb38a085a91d9af48d4f428da097b31c09b3f6b27d38212678a30ffd100364546a4d1ea0c60b5a89f1f89e97528a8b352ed55e5de2e7b963d73ba7de9e922c0ae964e816a048ff598a81a0114eb4afe71ef547cf6fecbb970310ef84049c9353d01c17103aa02bd17f471f58c435c937e6457a8a8a7ff7163263be197ec547241bc4791536b18080", + "f871808080808080a03f1587ebf71f19f47449b08f0960630ddbd60d045ea68ee7d89fb1c5682d215a8080808080a06e1618ec47442688101bd341cb8627739ecfd6fc1f793b69191dceeed18a19348080a05344081f911ad616b960a8f2841eb55f4936a97ec5dae614e726c8c0d51e0eff80", + "f8669d3e3757038b7fea6585ca2d0a3dacd72d84bf0c7b916f169cea0348681bb846f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75" + ], + "contract_address": "00763f30eEB0eEF506907e18f2a6ceC2DAb30Df8", + "expected_account_state": "f8440180a082bab1eb1ecd4b6dccd6d65b93603e6596205eb39ba1e32084c63dd883b17057a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75", + "storage_key_hash": "7bef74619139dab09d59cafa630682f8f30445738dcfb7147514aa27399ae2ee", + "storage_proof": [ + "f90211a0786e2b7a3a24cfafe31c1cac9b0cc4b57cfb9e27264b9aeb8ba52d48181fd013a0bbf8c0df9d3837792180786e217cbcbfb6cb6c1ee790ec0dba83fc05248f2627a060d5477cb7243063a66f6533e342632aea890e13cf45c0144ad7f8254bb74242a02dd5604620fcf3990474b172d1bb5653bf7bfc9ee1d269e765da3f7a91ac2ec3a04134b666e4a8e3e28701e33bed36680ae025cc5f89f8d29457975148338017c4a07bf7ed874ff02f5938267592e1a3cfca0ca8d7d4b6fccd617b815fad456c2c53a076515bac0f65924da357aba2f6c312472a9ef94d1c459f2cd0380b84a91d46aca0f49dd3a32c4adb7b6f02188b32a7823c79bb5b2ed1f3cdf4da11c36304ae4e25a05ba06e342a112365ced395b4bf830d148ad1e6a787912a9a603293a4e079e3f5a029f967b2d7ed040cda92ab4905f2976636a7bb16ba850679eca942e02d5b3458a024bdf35e1d8fd46cdee76420d508c722d7f47825356620c266094f6c66c67f7ea070a8abf4345f7148bbcbd0f443fe00cfed0a17ab828b7051cb3ede4bee4499b1a00d9cd9aa39cdd4a91bcd4feb8c73db017dce78ec82ba6f14287775567615f247a02f3d28876d69fd8945b3fdeff87186bcb97c236ccefa3b6182507bc6e504606fa03b4078e843b8927c29753dfc91a44c246cb22ea3673a3bad8dab7c8f6b8ce226a061983eaffadbdc7d6e7a0f9d9f5c1c64f983a4a6724aaa2126a0b6c03c984f3280", + "f901d1a0269a0b881e99b091fd1f85a9e44ee4daf1bfaa127412213b0ec1edacf2fcb4e0a0e7f129286b917093dd713ebf19c11b699dd3b7e2c8dd81b96da000d8929e6bd7a042e1e974e7e7b3829b6fd86c08ec48c92789a4c5b29aaba295ac47eb78da8979a0af69958bb871e61c3dab996738ae596fd6d8b0c6dd126361053ca23c67576aa6a0957f511c654ba45de24daa58d5069b8e854e1af4230f5e00ff80942f32179f9280a002cca7c62c8aaf39f3300a3694c5df5909d2365d68935dead512cec79b859546a0c150cdf6bf843bf02c321ad13d4b680a5ac6816a93b607b68b3d2944645cc573a0d44663526783865e11155d5490966374eaf24421c59522f6350769715d83f5f280a028d3420f6f3cfd2eff10d769032ec92a9ce6a26004a4b5e432577f7d218cb8eea095fcf2b12e8b70bb0c075d41576e00242769a18622ab1d936326fa053aeaa501a0ecf0ef75da3fd6cd5bc5a73049bbbdedd2fb0ccdb86bb07895d012b1b93354d5a02c8f51d330045fd36258abd5dc39dbc9ac14103ca91925bed4f55066f7d51830a024fff2a5c88286da53434ffeafc0962a9c2230a26c303850a04853096882be92a0a0eb992284319d09507645086aaf48f97428294e89aab782574993ed0543caef80", + "f851808080808080a05a173679dbc21d5c5b16c40e4d0fdd5ec92f602c2db2adbe71c9d4b2aedb585480a04cd868f531723c2438dce2df71b16e2d4d6f49299867484a662073b40aaac5ca8080808080808080", + "e19f3ba9af7041ec3098c4d818db9972f67827520c1db7d022f6c3041b6f40ecc301" + ], + "expected_storage_value": "01", + "min_header_height": "", + "max_header_height": "", + "skip_bridge_call": true +} diff --git a/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectValue.json b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectValue.json new file mode 100644 index 00000000..adca61e9 --- /dev/null +++ b/contracts/near/eth-prover/src/test_data/storageProofWithIncorrectValue.json @@ -0,0 +1,26 @@ +{ + "header_data": "f901ffa0fff0b83c7645333f372718f1c53b7275d83f89ae974940820a39ac43b9e88a11a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794f36f155486299ecaff2d4f5160ed5114c1f66000a0611e6617bd56b23286a317a8cfe78274a76f9624c207ed9f567f12db53026cb5a0f8646c32c2cfb4064bc2fc092a73adf7fa8f05fe62dec656a550d09ec1b8a898a05d94e5c456f59be6084dc832d24de0273ceba6c841308d1908169a043ac6baa4b9010015a42a6355a47214801c1c81ac5150030184014530904810240b0054e81b750a00eea0040008415010180084206402d4410900a0160000f098085c041124a202103041109462923cd7a4210b020630260004831a40c0602409411184000212058820336a2200010000001080c413080009010c40614862983802923088102107268882692a90e80620424822678040210010100860151208240118f3956204050a2c895371808a101203140032034260e0f114027206246000a1c04a2132a922e66088322108090a110810a0000be40086a8101030144dd05003506248146614ba11280ba0201102780011e1814102058801000900502202024304301a39660230838182ac8401c9c3808401052eab8463eadb3080a00a58a400a5f524d8df4b7140cc35bf2b4fe9dfc2a12a1cf52f526d627aac3db3880000000000000000820357", + "account_proof": [ + "f90211a09f2010af3cc9c6d2ff727c81f7524ae503f90284e5cb802f6fd9358c163e198ca08548267c53e930b5a18b2364c5cb3aff3c14870ac2275eb6f8a54388a58b5567a0f71f37002acc0a2eaa7b540cf6d14eec6d1a0c0e05fa47294c17f1b313b5c8cfa03b6953e75441ca9a3a1cf4cfd1143357023b305698259217d69b2fc2ce60858ea07c2d0d986052f90200e3281f14f40dceb8a85547a681525a798829b2ab0818ffa0f185ab5dae7b1d6e7c2aa2bb4dcc03392baa732d9184da8fc33ca551616356faa02ccea0afc5e45712ee6485a78cd2912535198470651a554e94b453aad8cbd60da05be29334f4504f5f47f44ce970827664704d584a526a5683e0f26e5cd5041a25a0d81ab119c255376982d1f8c955bb0841386be0105e1ef6680b601c004ed8d415a07aa76afcca71c9e2230d4bf53bf7f2e31d350ee3c78e96a798174d4f55e584ffa0670b913a9ac9a6dbd871a40279b57953673946e86ccd05d95633ebc5bbe5b188a0f8a4eac59ac78af02c47e6102f7193e2643d3358bbd79ffd2f1a6d0f0f0c165ea0758266147704772c0a26c73c2b15f6fc1333d9f06d61f0a98b11911cdc0e6de4a0dba0b5a5c9cebe4a50b996e436845d0de0f703df346711d836b00e25f6d86bd4a088ca6ad3f65bd25c9c1b3fc1adba9805150dea0469555c2e2005c2e57fcd3003a0644ac23638cfd5d2bf7be1a18245245b9491bbb07b4ad041b7779a7bdb5025e580", + "f90211a0a1f7aac2995a5ed36bebaed5271dc61ac2388ee098dda2dd3bfce1ece0bfa829a0a8ae801f8cb8734df7b4826aab3c0f8daccc64effcf9497872c3bfcf9963c8fca037bd182a4739e2c71e97316b3cbee78173bd35bb8b3f60ef84e20c81cccd6b8ea0d3e5a8fdf0b394b753d56a0a07e60cafeed93ae896e508a2834657f4cfaf4e74a0bf5811b7827b6887a2afe150e9f84f01a9eb35eefbcacbce534e6cb574175632a0493c6adedeb34305ca3c8b0be070789f2b3ad5eb05a4faa3863c4dc335fb4189a09ed60b16f83213a33aeb53a77c14a243888e20238ab51bf364fcc1ffe6966153a0c6b9a7d02f4041391b21c85e9310cab8fa08e0c02ce7ad1bb9545e81d0db7670a0866b77b81c0a64e84035db172b1a479292b2d190228001ae276784fee258c607a0b426825472c8c661b05879c3757b958901b39ed09265724b17361cd0f15f74c3a061170e214ffcb0f8a2a17b8a64d6f4e588b0f9d64b1b78a8f860ccacd3922369a04de8f9edb1ad322a3568ac471831fbf175efd1c9b2b02b5d9d10a184d54b73c1a03a70896331cef4434e0a395595fe548cedb5c71529421a19359e42ca962429a5a09ffb6c4bedd8d72d73d3a0c87f71f2a41e9955df5fb5e483aa6c4a2ee8d45b26a0db4b26c625be8cc1aa9d17456139c8d5143c445ef877769050222b2fac5f929ba0c3afc1c5f13607cf561a073a6f341227a90376e87e48c54164eef19c51c5cd2780", + "f90211a0a728578ddfbd4e3fa913f10f73f4464fc95a3277ac3783078d07534872f60c8ca0bc6c1301ed405c0ce52e31bd667abe0d559b71d5c6ee515b4e977f4c1b7d2de5a042cab541119e6e1b305fc51bc3a9099a7ed323bcaab1b103f4a09c5fd1a5ffa9a0f29d1a4e35bb3cf9f17a3033f26bab8ac56e6abaf2df83d0878e9d45e4dbb262a08373516dca2167359f81c6086d086f9f6b647f0a5323a670271e8fbf4b15cd47a0acdfebaf24830b92a3deb6e44422afeef55efce4d0bbf0913216d9156459e41aa06bf7ec716d7579c4b784db41b0f3549c1aa033956968642836c37e0348a09bbfa010ffffce72a9f81a7a5491087febd53178879cfe59fa7645b9314ce07923f496a0a3a18069f84b16289144769be298aeb15cb78746012ef3c9893113109ea26163a0c872f57c7064d3ecf1e0dce8b7f2d31e151fab8c1048bce5e021fb5cc25e222ca0441bb13319c322f67c4cea9fe9e7ff4c81061b5b80cbe37254deffae3bfb3163a03b2bde0648f7489fea985da3a45c2d7b404d0dcd70eb62097dd0d76860acaf3fa046e54b2e41afe0594e4b32bb68f890eb2be0c522177a0098d9e209cd61fa52f9a079d38c8ffd67624fcee4d1307761bebe7f869d3f4046e99daf27bcf303a5174ca07a2c3cdbc8e4a22aa5ad600411810e4025ef84b79f132a4b75a9406f1cf60926a0529c91b9cc16adf0bcb72bac2ba86dd5e035e3e689ace0d4809ee6552a64119480", + "f90211a0cd42164ae552d0d13db9f9cf38653c224a34d604a9db71748e312248b7a3af38a0184e6eb3ea4728266438c0b7f687f62a96d6daa740711a678e1e0edf33361489a03c764463c2172ab6dbec2c495c2cf13796512cb3f369a10dbc3684bbd5fb4018a015ea238cec5879fa069d204e93ff3c951f99d63407860df1882a2c59f325052da0ab5c18775aa03057f7ade4b6bffd094cb5112bd47e80d576ac2415eb33ae9654a01dfdfc623921a2948b00c4e0eab2d054293ca4869e09eaa79cd88ae492728788a0f4e962298ff3966fd3cfeccc21a74d0b1a8e39d14dfc3a68d1f941e57ad917cba01fabe2077c23f5bc163eee76ff628c03d6d45b94445bd21df4a9b8c647b5a10da0ef92e8b81eea7608968d2272119cb6be77030b85de6cceca3b9d4acde44c1a2ea0d2c9d3bc2a51638936232907f2daa0a23325421ca4efc57248674081889f8832a07e75144a554963f4cb7088c4809cc8d14aab35fcfa4fe2e023ae82e45b65929ba01d11f73ff1b0c64899fde18ad85b08bbb7b3d7a46cda25a9c8668665e8bdb706a0be6a24e94b1689142dda1b4ef3750ff486f990d4610b1878b760404a468e59a7a02690ac779ae564dce3567fab4ca03c7b5f56da23d882b68be067dafb0829fc08a00b4230a149ff4dca81cd7682536de8b1be2fa715bcafb967c35156fdc626dc3ba0d1fea826722117b8482d59658586a2802577a9d9114d5d8791b93364e998732d80", + "f90211a096da0777dbb2f875bd357722a4387a78ae24efe13e04ed75f65b2c991247203fa0c0082d34071d1d65e712999126ac28e277b079d939821eaa755c4ef0fd2e5baaa0d088ecbd4b6bb84c6fa211bc81474c05c12ca2694faf0b1a2ecbde0bfe6fa3a2a00930aa5c1b70190cd2231cc759fec0c863a2e11bc89b1685d17da64f6bdc5e72a010b3d58569454bcfe1e6c9fad76e7034972f2abb6a3081b3c6b057c7d3151e2ca0868e866d17747182e462be130ceb1b0b3b5011db9f10f3fc8a00743c50497eaaa0aff0dd0b6a09d0e5659b96333f74fd56545addb56451693c1daeb2dbd7fe4470a07094c93901a37d76cc1ce99891c7419188b9dcabcd73075525a844084574c697a0cfd98d359eb86b3cf4531a0ddfa5d1ae5e5cdbed5f3a6a39daff489b2c862ed5a00f80e0d59b59c9e9e27aba7ac54d51f35750c45d45fb3d46c2cf31cb32a8e68aa02a5c88410b94694ae8882eda87af1c56616cd475b0b7feb2306da3959b322418a0609c5a3f274c1d31fa9b4d3c4492b4811c374e4d3d08ca5da98da012a489b273a0e57f95cc7d072bdd273c4bf504fbcabe2b356236151e53bd53af301fe794e34ba0a274c42f4ccef6f20a413218137c6ec00ac7e3fa172f61a7c6487497fe427daba0961e5aac1726d9598c446db66425f7360f87fa5feb744adcfaf19e783cbba1a5a0b5c730c7587872bdc05bd0786f6fd897332d7d2642f953fa019ef58d4e5ec25e80", + "f90171a02a6e86561c33eacbb1826e9832a25f9f2841c281c9e6b6c18c95ce713dae6c868080a0807528ab397894421968b62bead3b9dd446bda7dc79a5b6ec5a29bd3f19a10c5a0072bce4e78f01cc370c9d92dd39bfcee6059d2e60a95135867991c59184d219980a0415df007b0977e95ba9b3d86b64bae14c02250b3da81f81bed47973f9e4a55b180a0e45736d96c006965b5cad5ec8008d31eb2c34e00c36f677b288701f76f43d627a055324754b7752c9149df27e03392c0598ec89f408040b15140a679f02e695017a04fc91448749dcab3e66cc8e45eb8d85a416fa3a33f8951128d17ca208bc3bb38a085a91d9af48d4f428da097b31c09b3f6b27d38212678a30ffd100364546a4d1ea0c60b5a89f1f89e97528a8b352ed55e5de2e7b963d73ba7de9e922c0ae964e816a048ff598a81a0114eb4afe71ef547cf6fecbb970310ef84049c9353d01c17103aa08d1d7f774f6570c92fd5d70617266469dade16fd9e5cad87af44c15fa34d075a8080", + "f871808080808080a03f1587ebf71f19f47449b08f0960630ddbd60d045ea68ee7d89fb1c5682d215a8080808080a060abf60878dd69cb6e3a7bd92aeca7514df19f822555e528101da922493f6a758080a05344081f911ad616b960a8f2841eb55f4936a97ec5dae614e726c8c0d51e0eff80", + "f8669d3e3757038b7fea6585ca2d0a3dacd72d84bf0c7b916f169cea0348681bb846f8440180a0e4acc7f2f495a3bd919d8b5c2b2ab1446a293d16b7981141cf6f3594c26554b6a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75" + ], + "contract_address": "00763f30eEB0eEF506907e18f2a6ceC2DAb30Df8", + "expected_account_state": "f8440180a0e4acc7f2f495a3bd919d8b5c2b2ab1446a293d16b7981141cf6f3594c26554b6a0932cddc50793da935ccf915651ad67f6b746e9936fcc5614f0ff492563782c75", + "storage_key_hash": "0f9e5fde3c4a1600408ce3ebbd6a720b7491c663bef3fedcf7835dd6863fd34b", + "storage_proof": [ + "f90211a07c66fa00b691dc5c5a66e43831b9922316c8740c3c5235e7aa705cebefbd478ca0bbf8c0df9d3837792180786e217cbcbfb6cb6c1ee790ec0dba83fc05248f2627a036b93382543cd1737ddc32dbc8cd4326da47551be33e3ca75af3ea98583edd93a0c024e6190b7ce41e20f27b5cd512ebf50d6c60a1467f3cad8acd46da3a4d3861a04134b666e4a8e3e28701e33bed36680ae025cc5f89f8d29457975148338017c4a0ad773b24d54d681b3d712d913c0bf515407818845922616360b9b5a381cd6299a076515bac0f65924da357aba2f6c312472a9ef94d1c459f2cd0380b84a91d46aca0f49dd3a32c4adb7b6f02188b32a7823c79bb5b2ed1f3cdf4da11c36304ae4e25a0324a3b32bf60329775f3383b6c98e99683df56a0933516032147008d544af343a029f967b2d7ed040cda92ab4905f2976636a7bb16ba850679eca942e02d5b3458a024bdf35e1d8fd46cdee76420d508c722d7f47825356620c266094f6c66c67f7ea0426a496a8633ec2771fb15f58f646bf689eda39af535bcb9b316e9e601d1a342a00d9cd9aa39cdd4a91bcd4feb8c73db017dce78ec82ba6f14287775567615f247a02f3d28876d69fd8945b3fdeff87186bcb97c236ccefa3b6182507bc6e504606fa03b4078e843b8927c29753dfc91a44c246cb22ea3673a3bad8dab7c8f6b8ce226a061983eaffadbdc7d6e7a0f9d9f5c1c64f983a4a6724aaa2126a0b6c03c984f3280", + "f9015180a01061b943f8579b3fd877fbb9f5a796b40bad0e3c4cf6543287843cbc393e928da082da424f81780a75ef25a30590a9e5ec85637cb96dd708eab214029bb7324363a0809ffaa235bdd55f80127144f1918251205617992df98a93e871be18a481aaba80a0e30a57c48730f365adf774e3306ae2fd27abc854dc628b29c3b8873818e22adaa0aa6b491b53c837a2d87a4cf0e7995ce65030583199b48597cde9481d64e46deca0dbb86b57d06b8e9098b6db1d33c0ea963bf767f36e0e30559e64df69ab23d80180a0abaa7983dc34ba047258543b43cb5791d9fc73820c5103feaff960c35e2d2b4680a026f6892a3438aac58a8dfb5eeeefc1dc391e520eb1a401cc2a3a16ff617e3a578080a0d77dc10b28e64185d1d0306fb29003c89c300ed9041b476c08074161510b3670a0b36ced44fa006dd920a4f0281d389ecee50f66bd99f964ac50934065c5c873d680", + "f871a003c2a7f927a157d07815fdd586453a7f82223b912344dcb85fdb717b268cddb98080808080808080a0ad44120a824ee96076f8c53f155604f1e778eb0c678303eb680b69e3b72d7b9f8080a0dd6eb7d9c298eea97e0c3779437f0247e76237d430aeee5c9676830ed4e19e7480808080", + "e19f3e5fde3c4a1600408ce3ebbd6a720b7491c663bef3fedcf7835dd6863fd34b01" + ], + "expected_storage_value": "00", + "min_header_height": "", + "max_header_height": "", + "skip_bridge_call": true +} diff --git a/contracts/near/eth-prover/src/tests_storage_proof.rs b/contracts/near/eth-prover/src/tests_storage_proof.rs new file mode 100644 index 00000000..4de322c8 --- /dev/null +++ b/contracts/near/eth-prover/src/tests_storage_proof.rs @@ -0,0 +1,296 @@ +#[cfg(test)] +mod tests_storage_proof { + use crate::EthProver; + use eth_types::H256; + use near_sdk::serde_json; + use near_sdk::PromiseOrValue; + use rlp::Rlp; + use serde::Deserialize; + + #[derive(Debug, Deserialize)] + #[serde(crate = "near_sdk::serde")] + pub struct JsonProof { + #[serde(with = "hex::serde")] + pub header_data: Vec, + pub account_proof: Vec, // account proof + #[serde(with = "hex::serde")] + pub contract_address: Vec, // eth address + #[serde(with = "hex::serde")] + pub expected_account_state: Vec, // encoded account state + #[serde(with = "hex::serde")] + pub storage_key_hash: Vec, // keccak256 of storage key + pub storage_proof: Vec, // storage proof + #[serde(with = "hex::serde")] + pub expected_storage_value: Vec, // storage value + pub min_header_height: String, + pub max_header_height: String, + pub skip_bridge_call: bool, + } + + #[derive(Debug, Deserialize)] + pub struct StorageProof { + pub header_data: Vec, + pub account_proof: Vec>, // account proof + pub contract_address: Vec, // eth address + pub expected_account_state: Vec, // encoded account state + pub storage_key_hash: Vec, // keccak256 of storage key + pub storage_proof: Vec>, // storage proof + pub expected_storage_value: Vec, // storage value + pub min_header_height: Option, + pub max_header_height: Option, + pub skip_bridge_call: bool, + } + + pub fn get_json_proof(filename: String) -> JsonProof { + let contents = std::fs::read_to_string(&filename).expect("Unable to read file"); + serde_json::from_str(&contents).expect("Unable to deserialize") + } + + pub fn get_storage_proof(file_path: String) -> StorageProof { + let json_proof: JsonProof = get_json_proof(file_path); + + let header_data = json_proof.header_data; + let contract_address = json_proof.contract_address; + let account_proof = json_proof + .account_proof + .into_iter() + .map(|x| hex::decode(x).unwrap()) + .collect(); + let expected_account_state = json_proof.expected_account_state; + let storage_key_hash = json_proof.storage_key_hash; + let storage_proof = json_proof + .storage_proof + .into_iter() + .map(|x| hex::decode(x).unwrap()) + .collect(); + + StorageProof { + header_data, + account_proof, + contract_address, + expected_account_state, + storage_key_hash, + storage_proof, + expected_storage_value: json_proof.expected_storage_value, + min_header_height: None, + max_header_height: None, + skip_bridge_call: json_proof.skip_bridge_call, + } + } + + // TESTS + + use near_sdk::{testing_env, VMContext}; + + fn get_context(input: Vec) -> VMContext { + VMContext { + current_account_id: "alice.near".parse().unwrap(), + signer_account_id: "bob.near".parse().unwrap(), + signer_account_pk: "ed25519:6E8sCci9badyRkXb3JoRpBj5p8C6Tw41ELDZoiihKEtp" + .parse() + .unwrap(), + predecessor_account_id: "carol.near".parse().unwrap(), + input, + block_index: 0, + block_timestamp: 0, + epoch_height: 0, + account_balance: 0, + account_locked_balance: 0, + storage_usage: 0, + attached_deposit: 0, + prepaid_gas: near_sdk::Gas(10u64.pow(18)), + random_seed: vec![1; 32].try_into().unwrap(), + view_config: None, + output_data_receivers: vec![], + } + } + + #[test] + pub fn test_verify_trie_proof() { + testing_env!(get_context(vec![])); + let test_data = get_storage_proof(String::from("./src/test_data/storageProof.json")); + let storage_hash: H256 = Rlp::new(&test_data.expected_account_state) + .val_at(2) + .unwrap(); + assert_eq!( + EthProver::verify_trie_proof( + storage_hash, + test_data.storage_key_hash, + test_data.storage_proof + ), + test_data.expected_storage_value + ); + } + + #[test] + pub fn test_verify_storage_proof() { + testing_env!(get_context(vec![])); + let contract = EthProver::init("ethbridge".to_string()); + let test_data = get_storage_proof(String::from("./src/test_data/storageProof.json")); + if let PromiseOrValue::Value(true) = contract.verify_storage_proof( + test_data.header_data, + test_data.account_proof, + test_data.contract_address, + test_data.expected_account_state, + test_data.storage_key_hash, + test_data.storage_proof, + test_data.expected_storage_value, + test_data.min_header_height, + test_data.max_header_height, + test_data.skip_bridge_call, + ) { + } else { + panic!(); + } + } + + #[test] + #[should_panic(expected = "assertion failed: `(left == right)")] + pub fn test_verify_storage_proof_with_wrong_account_proof() { + testing_env!(get_context(vec![])); + let contract = EthProver::init("ethbridge".to_string()); + let test_data = get_storage_proof(String::from( + "./src/test_data/storageProofWithIncorrectAccountProof.json", + )); + if let PromiseOrValue::Value(true) = contract.verify_storage_proof( + test_data.header_data, + test_data.account_proof, + test_data.contract_address, + test_data.expected_account_state, + test_data.storage_key_hash, + test_data.storage_proof, + test_data.expected_storage_value, + test_data.min_header_height, + test_data.max_header_height, + test_data.skip_bridge_call, + ) { + } else { + panic!(); + } + } + + #[test] + #[should_panic(expected = "assertion failed: `(left == right)")] + pub fn test_verify_storage_proof_with_wrong_state_proof() { + testing_env!(get_context(vec![])); + let contract = EthProver::init("ethbridge".to_string()); + let test_data = get_storage_proof(String::from( + "./src/test_data/storageProofWithIncorrectStateProof.json", + )); + if let PromiseOrValue::Value(true) = contract.verify_storage_proof( + test_data.header_data, + test_data.account_proof, + test_data.contract_address, + test_data.expected_account_state, + test_data.storage_key_hash, + test_data.storage_proof, + test_data.expected_storage_value, + test_data.min_header_height, + test_data.max_header_height, + test_data.skip_bridge_call, + ) { + } else { + panic!(); + } + } + + #[test] + #[should_panic(expected = "explicit panic")] + pub fn test_verify_storage_proof_with_wrong_value() { + testing_env!(get_context(vec![])); + let contract = EthProver::init("ethbridge".to_string()); + let test_data = get_storage_proof(String::from( + "./src/test_data/storageProofWithIncorrectValue.json", + )); + if let PromiseOrValue::Value(true) = contract.verify_storage_proof( + test_data.header_data, + test_data.account_proof, + test_data.contract_address, + test_data.expected_account_state, + test_data.storage_key_hash, + test_data.storage_proof, + test_data.expected_storage_value, + test_data.min_header_height, + test_data.max_header_height, + test_data.skip_bridge_call, + ) { + } else { + panic!(); + } + } + + #[test] + pub fn test_verify_storage_proof_with_false_value() { + testing_env!(get_context(vec![])); + let contract = EthProver::init("ethbridge".to_string()); + let test_data = get_storage_proof(String::from( + "./src/test_data/storageProofWithFalseValue.json", + )); + if let PromiseOrValue::Value(true) = contract.verify_storage_proof( + test_data.header_data, + test_data.account_proof, + test_data.contract_address, + test_data.expected_account_state, + test_data.storage_key_hash, + test_data.storage_proof, + test_data.expected_storage_value, + test_data.min_header_height, + test_data.max_header_height, + test_data.skip_bridge_call, + ) { + } else { + panic!("storage_value != expected_storage_value"); + } + } + + #[test] + #[should_panic(expected = "explicit panic")] + pub fn test_verify_storage_proof_with_wrong_account_data() { + testing_env!(get_context(vec![])); + let contract = EthProver::init("ethbridge".to_string()); + // Below Data for Block: 8487596 other than account data + let test_data = get_storage_proof(String::from( + "./src/test_data/storageProofWithIncorrectAccountState.json", + )); + if let PromiseOrValue::Value(true) = contract.verify_storage_proof( + test_data.header_data, + test_data.account_proof, + test_data.contract_address, + test_data.expected_account_state, + test_data.storage_key_hash, + test_data.storage_proof, + test_data.expected_storage_value, + test_data.min_header_height, + test_data.max_header_height, + test_data.skip_bridge_call, + ) { + } else { + panic!(); + } + } + + #[test] + pub fn test_verify_storage_proof_with_future_header_data() { + testing_env!(get_context(vec![])); + let contract = EthProver::init("ethbridge".to_string()); + // Header-Data[state root-> block: 8487596 || other data in Header-data -> block: 8492954] + let test_data = get_storage_proof(String::from( + "./src/test_data/storageProofWithIncorrectHeaderExceptStateRoot.json", + )); + if let PromiseOrValue::Value(true) = contract.verify_storage_proof( + test_data.header_data, + test_data.account_proof, + test_data.contract_address, + test_data.expected_account_state, + test_data.storage_key_hash, + test_data.storage_proof, + test_data.expected_storage_value, + test_data.min_header_height, + test_data.max_header_height, + test_data.skip_bridge_call, + ) { + } else { + panic!(); + } + } +} diff --git a/contracts/near/eth-types/Cargo.toml b/contracts/near/eth-types/Cargo.toml index 154be7c3..83785559 100644 --- a/contracts/near/eth-types/Cargo.toml +++ b/contracts/near/eth-types/Cargo.toml @@ -24,6 +24,7 @@ hex = "0.4.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] serde-big-array = "0.4.1" +sha3 = "0.10.8" [features] default = ["eth2"] diff --git a/contracts/near/eth-types/src/lib.rs b/contracts/near/eth-types/src/lib.rs index 544dc899..c2fb72f6 100644 --- a/contracts/near/eth-types/src/lib.rs +++ b/contracts/near/eth-types/src/lib.rs @@ -10,6 +10,9 @@ use rlp::{ use rlp_derive::RlpDecodable as RlpDecodableDerive; #[cfg(not(target_arch = "wasm32"))] use serde::{Deserialize, Serialize}; +#[cfg(not(target_arch = "wasm32"))] +use sha3::{Digest, Keccak256, Keccak512}; + use std::io::{Error, Write}; #[cfg(feature = "eth2")] use tree_hash::{PackedEncoding, TreeHash, TreeHashType}; @@ -368,13 +371,23 @@ pub fn near_sha256(data: &[u8]) -> [u8; 32] { } pub fn near_keccak256(data: &[u8]) -> [u8; 32] { - let mut buffer = [0u8; 32]; - buffer.copy_from_slice(near_sdk::env::keccak256(data).as_slice()); - buffer + #[cfg(target_arch = "wasm32")] + { + near_sdk::env::keccak256(data).try_into().unwrap() + } + #[cfg(not(target_arch = "wasm32"))] + { + Keccak256::digest(data).try_into().unwrap() + } } pub fn near_keccak512(data: &[u8]) -> [u8; 64] { - let mut buffer = [0u8; 64]; - buffer.copy_from_slice(near_sdk::env::keccak512(data).as_slice()); - buffer + #[cfg(target_arch = "wasm32")] + { + near_sdk::env::keccak512(data).try_into().unwrap() + } + #[cfg(not(target_arch = "wasm32"))] + { + Keccak512::digest(data).try_into().unwrap() + } } diff --git a/contracts/near/res/eth2_client.wasm b/contracts/near/res/eth2_client.wasm index fe169405..71a36917 100755 Binary files a/contracts/near/res/eth2_client.wasm and b/contracts/near/res/eth2_client.wasm differ diff --git a/contracts/near/res/eth_client.wasm b/contracts/near/res/eth_client.wasm index 0a840f85..3f9fb991 100755 Binary files a/contracts/near/res/eth_client.wasm and b/contracts/near/res/eth_client.wasm differ diff --git a/contracts/near/res/eth_prover.wasm b/contracts/near/res/eth_prover.wasm index f839f476..4872d54d 100755 Binary files a/contracts/near/res/eth_prover.wasm and b/contracts/near/res/eth_prover.wasm differ diff --git a/eth2near/Cargo.lock b/eth2near/Cargo.lock index 7d45d69c..fb9581ef 100644 --- a/eth2near/Cargo.lock +++ b/eth2near/Cargo.lock @@ -552,9 +552,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byte-slice-cast" @@ -1236,6 +1236,7 @@ dependencies = [ "rlp-derive", "serde", "serde-big-array", + "sha3", "tree_hash", "tree_hash_derive", ] @@ -2287,9 +2288,9 @@ checksum = "41ee439ee368ba4a77ac70d04f14015415af8600d6c894dc1f11bd79758c57d5" [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -4450,9 +4451,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ "digest 0.10.6", "keccak", diff --git a/eth2near/contract_wrapper/Cargo.toml b/eth2near/contract_wrapper/Cargo.toml index 261a10ce..1396fa18 100644 --- a/eth2near/contract_wrapper/Cargo.toml +++ b/eth2near/contract_wrapper/Cargo.toml @@ -5,7 +5,6 @@ edition = "2021" [dependencies] borsh = "0.9.3" -futures = "0.3.21" async-std = "1.12.0" near-sdk = "4.1.1" near-jsonrpc-client = "0.5.0" @@ -19,5 +18,11 @@ serde_json = "1.0.74" serde = { version = "1.0", features = ["derive"] } eth-types = { path = "../../contracts/near/eth-types/" } eth2-utility = { path = "../../contracts/near/eth2-utility/" } -workspaces = "0.7" +workspaces = { version = "0.7", optional = true } + +[dev-dependencies] +futures = "0.3.21" anyhow = "1.0" + +[features] +sandbox = ["workspaces"] diff --git a/eth2near/contract_wrapper/rust-toolchain b/eth2near/contract_wrapper/rust-toolchain index 588ffd57..f2415f83 100644 --- a/eth2near/contract_wrapper/rust-toolchain +++ b/eth2near/contract_wrapper/rust-toolchain @@ -1,2 +1,2 @@ [toolchain] -channel = "1.67.1" +channel = "1.69.0" diff --git a/eth2near/contract_wrapper/src/dao_eth_client_contract.rs b/eth2near/contract_wrapper/src/dao_eth_client_contract.rs index c7990a59..5f962111 100644 --- a/eth2near/contract_wrapper/src/dao_eth_client_contract.rs +++ b/eth2near/contract_wrapper/src/dao_eth_client_contract.rs @@ -2,9 +2,9 @@ use crate::dao_contract::DAOContract; use crate::dao_types; use crate::eth_client_contract::EthClientContract; use crate::eth_client_contract_trait::EthClientContractTrait; +use eth2_utility::types::ClientMode; use eth_types::eth2::{LightClientState, LightClientUpdate}; use eth_types::{BlockHeader, H256}; -use eth2_utility::types::ClientMode; use near_primitives::views::FinalExecutionOutcomeView; use std::error::Error; use std::str::FromStr; @@ -100,7 +100,7 @@ impl EthClientContractTrait for DaoEthClientContract { self.eth_client_contract.get_light_client_state() } - fn get_last_block_number(&self) -> Result> { + fn get_last_block_number(&self) -> Result> { self.eth_client_contract.get_last_block_number() } diff --git a/eth2near/contract_wrapper/src/eth_client_contract.rs b/eth2near/contract_wrapper/src/eth_client_contract.rs index 1d2666cc..927e0029 100644 --- a/eth2near/contract_wrapper/src/eth_client_contract.rs +++ b/eth2near/contract_wrapper/src/eth_client_contract.rs @@ -2,11 +2,11 @@ use crate::contract_wrapper_trait::ContractWrapper; use crate::eth_client_contract_trait::EthClientContractTrait; use crate::eth_network::EthNetwork; use borsh::BorshDeserialize; +use eth2_utility::types::ClientMode; use eth_types::eth2::{ ExtendedBeaconBlockHeader, LightClientState, LightClientUpdate, SyncCommittee, }; use eth_types::{BlockHeader, H256}; -use eth2_utility::types::ClientMode; use near_primitives::borsh::BorshSerialize; use near_primitives::types::AccountId; use near_primitives::views::FinalExecutionOutcomeView; @@ -25,9 +25,7 @@ pub struct EthClientContract { impl EthClientContract { /// Constructor for `EthClientContract` pub fn new(contract_wrapper: Box) -> Self { - EthClientContract { - contract_wrapper, - } + EthClientContract { contract_wrapper } } /// Initializes the Ethereum Light Client Contract on NEAR. @@ -137,7 +135,7 @@ impl EthClientContractTrait for EthClientContract { fn get_client_mode(&self) -> Result> { let res = self.contract_wrapper.call_view_function( "get_client_mode".to_string(), - json!({}).to_string().into_bytes() + json!({}).to_string().into_bytes(), )?; let mode: ClientMode = ClientMode::try_from_slice(&res)?; @@ -239,9 +237,10 @@ mod tests { } pub fn submit_block(&mut self, eth_client: &mut EthClientContract) { - eth_client.send_headers( - &vec![self.execution_blocks[self.current_execution_block].clone()], - ) + eth_client + .send_headers(&vec![ + self.execution_blocks[self.current_execution_block].clone() + ]) .unwrap(); self.current_execution_block += 1; @@ -253,7 +252,8 @@ mod tests { } pub fn submit_update(&mut self, eth_client: &mut EthClientContract) { - eth_client.send_light_client_update( + eth_client + .send_light_client_update( self.light_client_updates[self.current_light_client_update].clone(), ) .unwrap(); diff --git a/eth2near/contract_wrapper/src/eth_client_contract_trait.rs b/eth2near/contract_wrapper/src/eth_client_contract_trait.rs index f4ce3d59..96c6f77b 100644 --- a/eth2near/contract_wrapper/src/eth_client_contract_trait.rs +++ b/eth2near/contract_wrapper/src/eth_client_contract_trait.rs @@ -1,6 +1,6 @@ +use eth2_utility::types::ClientMode; use eth_types::eth2::{LightClientState, LightClientUpdate}; use eth_types::{BlockHeader, H256}; -use eth2_utility::types::ClientMode; use near_primitives::views::FinalExecutionOutcomeView; use std::error::Error; @@ -25,7 +25,7 @@ pub trait EthClientContractTrait { /// * `headers` - the list of headers for submission to Eth Client fn send_headers( &mut self, - headers: &[BlockHeader] + headers: &[BlockHeader], ) -> Result>; fn get_client_mode(&self) -> Result>; diff --git a/eth2near/contract_wrapper/src/file_eth_client_contract.rs b/eth2near/contract_wrapper/src/file_eth_client_contract.rs index 0314e453..fbb91257 100644 --- a/eth2near/contract_wrapper/src/file_eth_client_contract.rs +++ b/eth2near/contract_wrapper/src/file_eth_client_contract.rs @@ -1,8 +1,8 @@ use crate::eth_client_contract::EthClientContract; use crate::eth_client_contract_trait::EthClientContractTrait; +use eth2_utility::types::ClientMode; use eth_types::eth2::{LightClientState, LightClientUpdate}; use eth_types::{BlockHeader, H256}; -use eth2_utility::types::ClientMode; use near_primitives::views::FinalExecutionOutcomeView; use std::error::Error; use std::fs::File; @@ -67,7 +67,7 @@ impl EthClientContractTrait for FileEthClientContract { fn send_headers( &mut self, - headers: &[BlockHeader] + headers: &[BlockHeader], ) -> Result> { for header in headers { self.blocks_headers_file diff --git a/eth2near/contract_wrapper/src/lib.rs b/eth2near/contract_wrapper/src/lib.rs index 98e67219..edec0a0a 100644 --- a/eth2near/contract_wrapper/src/lib.rs +++ b/eth2near/contract_wrapper/src/lib.rs @@ -10,5 +10,6 @@ pub mod file_eth_client_contract; pub mod near_contract_wrapper; pub mod near_network; pub mod near_rpc_client; +#[cfg(feature = "sandbox")] pub mod sandbox_contract_wrapper; pub mod utils; diff --git a/eth2near/eth2-contract-init/Cargo.toml b/eth2near/eth2-contract-init/Cargo.toml index 39cb0625..bdbd133f 100644 --- a/eth2near/eth2-contract-init/Cargo.toml +++ b/eth2near/eth2-contract-init/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" [dependencies] tree_hash = { git = "https://github.com/aurora-is-near/lighthouse.git", tag = "v3.5.1-wasm" } merkle_proof = { git = "https://github.com/aurora-is-near/lighthouse.git", tag = "v3.5.1-wasm" } -types = { git = "https://github.com/aurora-is-near/lighthouse.git", tag = "v3.5.1-wasm" } -eth2_to_near_relay = { path = "../eth2near-block-relay-rs"} +types = { git = "https://github.com/aurora-is-near/lighthouse.git", tag = "v3.5.1-wasm" } +eth2_to_near_relay = { path = "../eth2near-block-relay-rs" } eth_rpc_client = { path = "../eth_rpc_client" } eth-types = { path = "../../contracts/near/eth-types/" } -eth2-utility = { path = "../../contracts/near/eth2-utility" } +eth2-utility = { path = "../../contracts/near/eth2-utility" } contract_wrapper = { path = "../contract_wrapper" } log = { version = "0.4", features = ["std", "serde"] } clap = { version = "3.1.6", features = ["derive"] } @@ -26,3 +26,4 @@ dotenv = "0.15.0" [dev-dependencies] workspaces = "0.7" tokio = { version = "1.1", features = ["macros", "rt", "time"] } +contract_wrapper = { path = "../contract_wrapper", features = ["sandbox"] } diff --git a/eth2near/eth2near-block-relay-rs/Cargo.toml b/eth2near/eth2near-block-relay-rs/Cargo.toml index ae70a2a1..c25bde4e 100644 --- a/eth2near/eth2near-block-relay-rs/Cargo.toml +++ b/eth2near/eth2near-block-relay-rs/Cargo.toml @@ -50,3 +50,4 @@ dotenv = "0.15.0" [dev-dependencies] workspaces = "0.7" eth2-contract-init = { path = "../eth2-contract-init" } +contract_wrapper = { path = "../contract_wrapper", features = ["sandbox"] } diff --git a/eth2near/eth2near-block-relay-rs/src/test_utils.rs b/eth2near/eth2near-block-relay-rs/src/test_utils.rs index d6756f3c..b8428d0c 100644 --- a/eth2near/eth2near-block-relay-rs/src/test_utils.rs +++ b/eth2near/eth2near-block-relay-rs/src/test_utils.rs @@ -247,15 +247,9 @@ pub fn get_client_contract( Box::new(eth_client_contract) } -pub fn get_relay( - from_file: bool, - config_for_test: &ConfigForTests, -) -> Eth2NearRelay { +pub fn get_relay(from_file: bool, config_for_test: &ConfigForTests) -> Eth2NearRelay { let config = get_config(config_for_test); - Eth2NearRelay::init( - &config, - get_client_contract(from_file, config_for_test) - ) + Eth2NearRelay::init(&config, get_client_contract(from_file, config_for_test)) } pub fn get_relay_with_update_from_file( @@ -270,16 +264,10 @@ pub fn get_relay_with_update_from_file( config.include_next_sync_committee_to_light_client = true; } - Eth2NearRelay::init( - &config, - get_client_contract(from_file, config_for_test) - ) + Eth2NearRelay::init(&config, get_client_contract(from_file, config_for_test)) } -pub fn get_relay_from_slot( - slot: u64, - config_for_test: &ConfigForTests, -) -> Eth2NearRelay { +pub fn get_relay_from_slot(slot: u64, config_for_test: &ConfigForTests) -> Eth2NearRelay { let config = get_config(config_for_test); let (relay_account, contract) = create_contract(&config_for_test); @@ -289,8 +277,5 @@ pub fn get_relay_from_slot( init_contract_from_specific_slot(&mut eth_client_contract, slot, config_for_test); - Eth2NearRelay::init( - &config, - Box::new(eth_client_contract) - ) + Eth2NearRelay::init(&config, Box::new(eth_client_contract)) } diff --git a/eth2near/eth2near-block-relay/eth-proof-extractor.js b/eth2near/eth2near-block-relay/eth-proof-extractor.js index 77ebe3df..17a84686 100644 --- a/eth2near/eth2near-block-relay/eth-proof-extractor.js +++ b/eth2near/eth2near-block-relay/eth-proof-extractor.js @@ -1,5 +1,5 @@ const Tree = require('merkle-patricia-tree') -const { Header, Proof, Receipt, Log } = require('eth-object') +const { Header, Proof, Receipt, Log, Account } = require('eth-object') const utils = require('ethereumjs-util') const { encode } = require('eth-util-lite') const { promisfy } = require('promisfy') @@ -27,6 +27,22 @@ class EthProofExtractor { return await this.robustWeb3.getBlock(blockNumber) } + async extractStorageProof (contractAddress, slotKey, blockNumber) { + const proofFromWeb3 = await this.web3.eth.getProof(contractAddress, [slotKey], blockNumber) + const blockData = await this.web3.eth.getBlock(blockNumber) + const header = Header.fromWeb3(blockData) + proofFromWeb3.nonce = this.web3.utils.toHex(proofFromWeb3.nonce) + proofFromWeb3.balance = this.web3.utils.toHex(proofFromWeb3.balance) + const account = Account.fromRpc(proofFromWeb3) + return { + header_rlp: header.serialize(), + account_rlp: account.serialize(), + account_proof: proofFromWeb3.accountProof, + storage_proof: proofFromWeb3.storageProof[0].proof, + value: proofFromWeb3.storageProof[0].value + } + } + async buildTrie (block) { const blockReceipts = await Promise.all( block.transactions.map((t) => this.robustWeb3.getTransactionReceipt(t)) @@ -127,6 +143,33 @@ async function ethToNearFindProof ({ lockedEventRaw, ethNodeUrl }) { web3.currentProvider.connection.close() } +async function ethToNearFindStorageProof ({ contractAddress, storageKey, blockNumber, ethNodeUrl }) { + const robustWeb3 = new RobustWeb3(ethNodeUrl) + const web3 = robustWeb3.web3 + try { + const extractor = new EthProofExtractor() + extractor.initialize(ethNodeUrl) + + const extractedProof = await extractor.extractStorageProof(contractAddress, storageKey, blockNumber) + extractor.destroy() + + const proof = { + contract_address: utils.stripHexPrefix(contractAddress.toLowerCase()), + storage_key: utils.stripHexPrefix(storageKey), + block_number: blockNumber, + header_data: extractedProof.header_rlp.toString('hex'), + account_proof: extractedProof.account_proof.map(x => utils.stripHexPrefix(x)), + expected_account_state: extractedProof.account_rlp.toString('hex'), + storage_key_hash: utils.stripHexPrefix(web3.utils.keccak256(storageKey)), + storage_proof: extractedProof.storage_proof.map(x => utils.stripHexPrefix(x)), + value: utils.padToEven(utils.stripHexPrefix(extractedProof.value)) + } + console.log(JSON.stringify(proof, JSONreplacer)) + } catch (error) { + console.log('Failed', error.toString()) + } +} + EthProofExtractor.fromWeb3 = (web3) => { const extractor = new EthProofExtractor() extractor.robustWeb3 = new RobustWeb3(web3.currentProvider.host) @@ -138,3 +181,4 @@ exports.EthProofExtractor = EthProofExtractor exports.receiptFromWeb3 = receiptFromWeb3 exports.logFromWeb3 = logFromWeb3 exports.ethToNearFindProof = ethToNearFindProof +exports.ethToNearFindStorageProof = ethToNearFindStorageProof diff --git a/eth2near/eth2near-block-relay/index.js b/eth2near/eth2near-block-relay/index.js index 2560ed9a..216deb17 100644 --- a/eth2near/eth2near-block-relay/index.js +++ b/eth2near/eth2near-block-relay/index.js @@ -21,7 +21,8 @@ const { EthProofExtractor, logFromWeb3, receiptFromWeb3, - ethToNearFindProof + ethToNearFindProof, + ethToNearFindStorageProof } = require('./eth-proof-extractor') const { @@ -311,4 +312,5 @@ exports.EthOnNearProverContract = EthOnNearProverContract exports.logFromWeb3 = logFromWeb3 exports.receiptFromWeb3 = receiptFromWeb3 exports.ethToNearFindProof = ethToNearFindProof +exports.ethToNearFindStorageProof = ethToNearFindStorageProof exports.dagMerkleRoots = dagMerkleRoots