diff --git a/light-client/src/client.rs b/light-client/src/client.rs index c7fa8a0..721930e 100644 --- a/light-client/src/client.rs +++ b/light-client/src/client.rs @@ -616,30 +616,6 @@ mod test { ) } - #[test] - fn test_success_update_state_non_neighboring_epoch() { - let header = hex!("0a222f6962632e6c69676874636c69656e74732e7061726c69612e76312e48656164657212d15b0adf0a0adc0af90559a01b8c590cd6b9bcf6c24e47e5f6468083f6093d05f9cc6a3f45c0e61a7989914ca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941284214b9b9c85549ab3d2b972df0deef66ac2c9a03508e22b6e7dd679e544f7badb659cd936e1722f9a91136e800681d588b886aca01aa0294d38be68038c13ca83d122e765b2714e3cf5a7c8b382eab64f009be8eaa026033fa1fdf7e559f128b7380b369d908261c092e97040cd938d0c2cc83c8d52b90100000448000000b680400000c0c00010000280440000920200002040210200009000015e2004022110000830000800100000001222041000004000800040ac100004c0003004102013000540080008820021180000100482004041102000001c00100c68200202009509421005288a684028202400000408912000403080000c000040481c000c80141840181c20001004102084e02800200a040000880c18802006028010c000062808040a2022023082410200880080104a40e00011000000021410981200100a8000026900081200002000808004800420811049ea00206000121002c210000002491000941000110000249000809900084006210020000a00028402620fc884042c1d8083303e3c84663394e3b90337d883010406846765746888676f312e32312e39856c696e7578000000821df8b90808265da01e1a65d62b903c7b34c08cb389bf3d9996f763f030b1adcfb369c5a5df4a18e1529baffe7feaec66db3dbd1bc06810f7f6f88b7be6645418a7e2a2a3f40514c21284214b9b9c85549ab3d2b972df0deef66ac2c98e82934ca974fdcd97f3309de967d3c9c43fa711a8d673af5d75465844bf8969c8d1948d903748ac7b8b1720fa64e50c35552c16704d214347f29fa77f77da6d75d7c752b742ad4855bae330426b823e742da31f816cc83bc16d69a9134be0cfb4a1d17ec34f1b5b32d5c20440b8536b1e88f0f240d3256eb0babe89f0ea54edaa398513136612f5a334b49d766ebe3eb9f6bdc163bd2c19aa7e8cee1667851ae0c1651f01c4cf7cf2cfcf8475bff3e99cab25b05631472d76d76ee8823de52a1a431884c2ca930c5e72bff3803af79641cf964cc001671017f0b680f93b7dde085b24bbc67b2a562a216f903ac878c5477641328172a353f1e493cf7f5f2cf1aec83bf0c74df566a41aa7ed65ea84ea99e3849ef31887c0f880a0feb92f356f58fbd023a82f5311fc87a5883a662e9ebbbefc90bf13aa533c2438a4113804bf980a75ecd1309ea12fa2ed87a8744fbfc9b863d589037a9ace3b590165ea1c0c5ac72bf600b7c88c1e435f41932c1132aae1bfa0bb68e46b96ccb12c3415e4d82af717d8f474cf03cceff28abc65c9cbae594f725c80e12d96c9b86c3400e529bfe184056e257c07940bb664636f689e8d2027c834681f8f878b73445261034e946bb2d901b4b878f8b381fbb860851066357eff502b847239dce4def537c09981995b09a20b0332a5931b6a80a0756929d82d67ada1699558c423a5108b0754fc4a8729fd2967822ee274fecd8742703f1e758c0c25aa65667ac33ca73a09dacf4ffeed749d956d6b438a65fe35f84c8402620fc6a055a683a5f4aec18ad180c783416fa6064fd77d12dd9cce6aa4e2d21814a1358b8402620fc7a01b8c590cd6b9bcf6c24e47e5f6468083f6093d05f9cc6a3f45c0e61a7989914c80ac0efe500470240a4e493ae2a67a28f2974da7a8b00ef170fc1d2357732a713d15528f7773b127095705a9d064c155484a7e3e8ccefefbcd1cacc960b3a0fe5f00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a00675a9943e5eee827641ecf76ccdca86c00760201e79454d7d70bf1d1229f4e4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479435552c16704d214347f29fa77f77da6d75d7c752a0f88cae15732bc072d88e3266e79c63ace19f6158d861b5a1527eecea8b3a0c90a0805f0392fd4fe5f40410188ae1823170f330fcbd460029d64100fb762c18db22a068061db6f72b36216ac8a6d4e7ade646d0481a5e58a1d446699f73f0000c65beb901000200000000000008100000400028002100000000101280100000602202000080440850000800001001020001000091010090200a10040008009012000080600042005010001000000010200880020010221000a0000208004a0c88000102140000080061090200800044000000000000080000000008088002090010040200040840000980000008000000000104000000100c200840100000000086001000200400000000008020084009000200204002800000000080008000920c0100000004880a0a0000004001810000000120124000009204080080001040c20000a000000030401000000201004004020001820000c00000000400480008000100a000028402620fc984042c1d80831a1f2484663394e6b90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381fbb86091ba1e6cf213db9c2384a8b80d1a61adeca1222451ad44989a3a4353c926cde613198ca3031c6b7c7988b0302c51f2bc1762f889d44c27476f73339069a6aa0b5fce63de2c6e847ee07c01620e47d27d090277ce3069e61a8e0e5dc75e7b6c02f84c8402620fc7a01b8c590cd6b9bcf6c24e47e5f6468083f6093d05f9cc6a3f45c0e61a7989914c8402620fc8a00675a9943e5eee827641ecf76ccdca86c00760201e79454d7d70bf1d1229f4e480899ca0f597006047cc915ce49e35b70eefe652a4f46d2cf8f9954323b29dc13a07ebbdc07dfa4f17138db9af8611fe9a98d289df90b46aacc8d86e6f39c7528e00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a06f8122b4b7c614859a61d8e12f236efc07d92370c52e9f3f8de48bc4c4c3f76aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479440d3256eb0babe89f0ea54edaa398513136612f5a01d6899d6d2e0f411288f145754d9672ce2881c44d3e9a25a6a33d5f625ec608ca09ef5f809e4322bb7ac0df0c4b4ce82d4fea1e31832734ed2286e1bbf3bcf5967a04f4875ba4450b51981ced70f5cb8ecfcb4f402a2ecca8f038ce9340431ba6677b90100100800080000000008000160000000240000010190000800000040000000008000081421000000100002001101009800001410120000000000001a0000a11200002030300820000200001008002000002010000000000000c000508001101600000800200a02009000010000000148c2080000000004089000080890420000000042000800000000100000011010001001000c200c000200442000801810102f060000000006a02808440000028000040001008800000018000082000000000204414802000089000021400010428000008000840280010100104142000020000010108a08040800118400060000010020208002201000024000100000180000028402620fca840427f164831ba49084663394e9b90116d883010405846765746888676f312e32312e35856c696e7578000000821df8b9f8b381fbb860ae5cfdf126fe914ba373cc010e894bdc02c34c113feaa7bf6e027879725858c3aa8740b6abb90f1dc389003dae1eb30d11aaead3c1df95d86bfe201cf0c5a285dd915f13a712abd523322712c42b8195c6cab1b5b0314375c059f48b8b79c8e4f84c8402620fc8a00675a9943e5eee827641ecf76ccdca86c00760201e79454d7d70bf1d1229f4e48402620fc9a06f8122b4b7c614859a61d8e12f236efc07d92370c52e9f3f8de48bc4c4c3f76a80bf2db108411fe95e684c82f738764633a2d29253d20c1832b7189b7a52f4c7ab75224c2bc89d3d1765b1aea4a347f2526cf24c4518ce3eae863383938cd651a001a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0b8f6e83d72a579037a1747385d006303baecd2f9122ea38d7d7caeae4322fafaa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479476d76ee8823de52a1a431884c2ca930c5e72bff3a090533b33c3cc5cfecbd33918e04cc12957a3cf6a5844e65a0ca4f2ade2994b3ca0e6977483ef89448a9e5565ceff05271fd57f2ba905f9caad339902e605fc8db8a0465d7a4ebdc6f41f40124db3193e5a0565e6a877854715c5811eb143d1d5f392b9010002801044080080006022024040a0002000a840003012002810184001000409924008152008200011040240012c00100120102002000000200100020000a4702006466030020000000001000c00008000a0180000000000804241102800111710100c46a00a02009500060004288008400c000400081808900001045400020c400240001c0000000000000ab000081008001c0ea028028002042040800810202006480080400006380840100002001402010000c00000000002a08311208022021400981220004881000300c002035001000080808ccc0324001040420000600012383086100002080941c204000411810400800000c020004c08080080480209028402620fcb84042c1954832408c484663394ecb90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381fbb860ac51bacb0156bbd71fe9d754817bcd1ef367cd0a6ca2d719fd1f9294164e9ea536937167df9370e7e4271846d099f1c01785e38478fca04f68559d2740447cdfc8f8e1d9bfea1ad6d331b13c63d133504203d7b6197e59837128b91b568c302cf84c8402620fc9a06f8122b4b7c614859a61d8e12f236efc07d92370c52e9f3f8de48bc4c4c3f76a8402620fcaa0b8f6e83d72a579037a1747385d006303baecd2f9122ea38d7d7caeae4322fafa80995177c05ae18a7afb72a5a5b870aa4cec13dd3bec378bd0bdd45c8b32ff9d94379d0649899e58045bd798c90c83f068c6180ac3be527f5264fd1fa40d5f3f7f00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0c1828f9fa73b74d490c01682f5e7851683736d6d38437034b118ecd99aac908ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347947f5f2cf1aec83bf0c74df566a41aa7ed65ea84eaa0909eadb50d8d80fed8719a8008f9a96a65105c9f9adf5f09583df44903455d08a07fa76502e2d2fad4544c010c2cb4719b07845b4ade4c57c05c194dbe35f27990a06c6141cf0821319308c5b281ebb93512f27f384d9d039387d765fa27ce7f5ab1b90100020000000004081820000040000000c400000202800200000008400241000080c0001c0000220050000000000200100000000082080000080000100000b064000000201000000011000010080200000020100000240a0400c000000080041700000804200002208000401000085000000a00000000080890000010140000080000400a0800080000000000040082000100000e2018000000000004c208100260060000040000003108081000020000400000004000000000200000200000030004000802001000004000000040101008020000000c06200000584002000020000018000010000000011100040000110280009000008080084400000004090000028402620fcc84042c1d80831f9f5d84663394efb90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381fbb860965d6d03c0493b4b7a3cf91fdbe7d114ebd38ce476e1bf47f1d1a55a8286408e61d2fedaac5e6c9b577f808ddeca453619c2fa244c4c8d0c521caf5148b532bcc376df1e5195419b11a350b03b596bbda029f1b074c42a3e9ce26d676c708c3ef84c8402620fcaa0b8f6e83d72a579037a1747385d006303baecd2f9122ea38d7d7caeae4322fafa8402620fcba0c1828f9fa73b74d490c01682f5e7851683736d6d38437034b118ecd99aac908b80e1175bb3858b24abde91024c935edf639b17cd3d48a67110b486064b018cc30273e32fc65969bdfaa4f6c72e0ead81230fa220f767d21f0a434ba82d9d5f6fcd01a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a09c7cfa55ae4789be64a696d357083683dcbc0429843811c125087ffd383311b2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794f474cf03cceff28abc65c9cbae594f725c80e12da00e783cf76ba10af8b476c2af6f0099182dc3d8891e6bfe8ccfbd4df4df9e5725a05943a3797fc784ab2a933a7e8cf5502c66932b4d565bf39673d8c84a97e7c163a0887d4fd11bac9b67f2a36358099ecfb8a3777074a31a1b01b0a2ddaa1621e312b9010000010000000080040002824000000024000000001800000000000000002800a0002810400000001004020001084090010094204a010004000000020000a0600002000030000020080800000c8800080020100001000000044200000804405400000802200a02808000040000000008400800000000802000100008100000040001000008000000000000000000a0100000000420080000000008100010100021060000000004842008400800020080040000400840088000000002000000000004102802000088000001200000000020000280040008002000104062004020008010108000000000010040040001010000008000000000004800080008000000018402620fcd84042c1d808310765984663394f2b90116d883010405846765746888676f312e32312e36856c696e7578000000821df8b9f8b381fbb8608ce86edf055073ed3657cb976abaaad5fd17879de455c0261f75a68f1fece6134ccbbad1adb809ce0c8e7b50249422c212357367f0e2feca28deb104d6bbfa1a2dd080a66914b21756e2198cf1c52f50ad6edcc07ec72818f917e9d7111a6574f84c8402620fcba0c1828f9fa73b74d490c01682f5e7851683736d6d38437034b118ecd99aac908b8402620fcca09c7cfa55ae4789be64a696d357083683dcbc0429843811c125087ffd383311b280f18262798880d70059d643979022a2b63e4198d03f7b42b1b2ae3750a00ad54632f0755542d43c630c263fefea44700a9c2f5780aacb850a98fb22816843643701a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0fe3e114a9b8862d981e404b7f83f43330e8a6a1d6f853b450ba8f358d8e594aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794980a75ecd1309ea12fa2ed87a8744fbfc9b863d5a020d51c5c97ddeaa92872cb51e57cf30cebf201e4455a7628909a944a153fdd29a08498edb273bef28ea8bfd2cbe9a99e2c94eac71fd9752a46178549e43b3dbb76a0af8c731b24f09013ae128678c593b89c686e5936789049da0a20a421f883e50bb9010012000008000800880000006000001000000000010002808010006006000800a200005c0000220010001800000000110100100102000000000009182000a06000020030380a0000008110000800000000a01000010002020040000000a4001400000880300286009880441010082008600c000000000838910000009008000800004200081000000c000000001000001011000c200a00000a040040c108100020060000040004006808001840020040c000000100000000010000901200c000080404681200100100000000000010000020400000041c000000104002000020001018084010010009011540064008110220009000001000014000980008080000028402620fce84042c1d80831f23d184663394f5b90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381f7b8608339e352db1dfd13827e415235e7ad9653cd14056bd7b78e93e09c86c36679ae02e13a2ec4aa1d8e2546fb5655f621d6041c1b9aa04ce18b41b7273fbab06eea3aead2ab3c6bdc791bb6268c781267b4ec81143312f419a48422eab7e7d8f1ebf84c8402620fcca09c7cfa55ae4789be64a696d357083683dcbc0429843811c125087ffd383311b28402620fcda0fe3e114a9b8862d981e404b7f83f43330e8a6a1d6f853b450ba8f358d8e594ae80b25e98a9d4d947ccedfd894f38dae23c09a3f30ea5b513470d75eac608d15b233c39278b14601bcd777c2f0c61fba173b2189614ff7ab761ec48e03ae2894eed00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0ad80590a86e436e79aaa961dccc29d85d1304853ded12197ae2dffd42e75fa18a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941284214b9b9c85549ab3d2b972df0deef66ac2c9a007e946b785a9637930533c6df8d79bb93184e47d65d28f7854d8c8ce16c63c42a015de33fa37a8bafb7578c335909aeff2b2b679997e548ee1a8d9f47a892ab1a7a02ced64c3059d0e81f236cdddfe8d034d05a08e1fe845ba32b4234d5ba8a377d6b901000000200400082008c2000a401000002000200a00103200000000502340000080002c142000000010002300818280140080100002400408000010120000a03000040000108400000000011108020012002210000020020408c80a100000171600020800200e02008001e00001200008001a0001000008089000081014000002040040000800000000000000000102000000000460080000000000088108904866060080800004006008400200060000400080008000900000a000820800020102040008020080000001850008400200004200009004800080111040424800a0000018204a5000020041000015000001020000810000202008440000000000c000018402620fcf84042c1d80831bb60084663394f8b90116d883010406846765746888676f312e32312e39856c696e7578000000821df8b9f8b381f7b8608e8cfe0b055b18d322025f0837aba5e1928a13f666255b83cf0529ed987b9b4e449d6248796bf8a351bf21cbeb4d869b14cfe57601beae23fed96172aaf53b42c247caacd125e363c7d4a36497c20523a72100fc4bc1a8f1db3ef66f882b1b84f84c8402620fcda0fe3e114a9b8862d981e404b7f83f43330e8a6a1d6f853b450ba8f358d8e594ae8402620fcea0ad80590a86e436e79aaa961dccc29d85d1304853ded12197ae2dffd42e75fa18805a390422f87c05ce81fad47bcbabb415c9bec71cdf4d6b8878409322a810d8567ef061cec5384ec4e0a754413ce28e6fdd24f54e84706337e863fef60b2489c100a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080120510b89c88131abe1af90d3bf90211a05d54f311542dc86508c3950fe9fd0e42666c4b0d2da357bf0ff5256206c4f499a0de4549196246f89565153fe5c293bd86825c81bebcaf5d863bc20db5b80f39c1a04260cf26a849cc8ae7d9e9490a0f3cae30ddb388a52bbb4381b648c6927f5d02a01043cbea73d2e4dad6a3021744ae80ecceee3fda23997f7e5a56d30721d6a89da0016bc5f3d3af4289603df49b9156999c4b3fab779399bba9dbb8d98a7d5fff36a09f7ae1ed754c036e23f8cee8168086eb854e9a74e50f80fe6eeedc06652d65a4a0aa0c44232305f2d9c73f4198c114a79f935d4f15479dcd8d61ab3fe5821608c3a0b2afddeb92bff5ff52f0d7d432e3b5e2c777988181eef046d4026e23a28a15fba02a6282e9d54cbe11efd2a4a36c899aeaa7cf7604c6c1d496d4ec36b26870d945a0d7c965d118cacf4d7282ee52216d42b231163efbb82fafc36bf6dccc2ace3b53a0e05dadba137f39580b713d54564bb2ccb48a4a4e882ac673aa972f6b4a7e2c84a0e35f8dffad08d4c9df98129ee14a657c0076c7e5ed00fea40d7bf4f9ae07c2c4a04a9dc6bc9c6a276620ccc29879f3e4195951f720322b72f3925c5862c5972487a06a7b7c9de98a1f4d36cf112f45b71e797694ed5b0c8ffcdcea26ed337bcea62ca0904b2f7a0c508f1876c1ffbba7832ef5babe8218fb7ac12d0f9bf4245b356a39a0bc5622b08b6882c64c3fd5ca4feb7cbe7845c911b3518874784719dac87bf31380f90211a0ed46c5f969903bd014b453e23bf036a0807d974ac245d974bea3edbfab8998f7a0fbe185c3ad730c361d61adafbf283c230a9e04a6971a5693a58b95d54a91dc18a01c49f9acbb2ef6407d5d88ad62c7e41c0ae4e1a86453d107f8b88e366e6f1f27a07f263e0e9ae17cbc40f87c3ce1249a552a18c5dc0b7fe42e43454663ac9d4a10a0ef16b26fa26244501acfcc480235d9fd3859b0511b1d840cb3960143eac49e4ea05e19c98be009508b8132d6bc03ce932ae80c584fed6c8b66690f51b6706c6110a02699c04fa558d4cf31a72eccdbd6c9b85921b18e92be8013b16bbbb0e0243d95a0bf06ce588155b0a5b8dd34eeb8b34d1ab6698da02bbd47b8df956f3f8f958f51a0105ad803a3be71de2802142849753f93fe3445762ccdccda5baafb2c350fe8ffa06e725a7130ddbff26e37c27c25830b6c3fac3575371cd00d26e799c30cfc61e5a045a5861fe345d073abd640549c0bc754f98a15f1349dc94ccaf8e366d747e800a01fa1a61b7b9716a711f42192e558ba2fcf059d8b87ad67cb4c73aa65bc918226a0e3b653f8469bce44931ae9a2f88c3ae385b70bae52b43902b618a0e29694dd8ca09f207e2e88901b54fb464545a33764841152a2669f6668610bc3fa10d5cfc2bba00393790748f68bcffb6f9e01a409b9d1e691406b635a1cca73ae061813ac4d5ba0c3f4178174074d467324173d8436674ce6c69fa7c49a4337a000635fb04dbf2380f90211a079c04022f20db8c5fcf561e1956bfe73e94c6e4cb2655ff506c2e298f1ab8f4da0c0c9908e024252617bb968a090881f478cf2cedee6762524d4b2d3521fce7b30a09a502add7d10c7817db9157721c4b03ff3327415d6d3b0307b11efa07a2ca300a0911e146a2367ecc6ea7dd6c2547ac9df60ead03cd1d14ddb3350b3968c7fca53a05cd154e740f91a9fc1b2b780c47cc5f525efab2e7c7c36248a2833a99206f291a03761f080edb655d24c234da08813efc750a093ea75e9603d558dd2889e254363a0035ad7eda8fb804cc3b2779b0f3c40e67f5c7fef6b354878cc659bb76c02871ea089848d6e6e0132be50e1428656da8fadda12cb411681a9cab7d5d9371650f2e3a054ab857606b93e77c264d3ae1c75bb7d8e532a75823fa0646934c6b07587d97da04303a53d5b1cf36d7ca5b3a35ff11b210b7fab8f2bea560fee8e1dc49863af08a083b73ad7bf82dc689745a5bd39837939169c725f44b3bbe5c2b9470c557cb6c1a01eb14803b41ee30b3d9256decc6b02f7b4eac0cba1cf60c7e806aa145dc95c3fa00f46a8879a158446fd5281f67942859516c094afff5c862d7925e28e0255dc1aa0a88775f84e8812564ca66ffdfc617993b642e48863299520f34c9e4f2b394b24a065a8676f56698d3c88c8360411a1b5d89cbdf44cef98a51fe1b761ed82177bdda0e9216b548ea5ad232ccea4285597ba3345a53d39fcd61de9546c24725edac4c980f90211a0fd00080f96539f8eb5a2b403c9594f7bbf1a9a773c9a4430d86ee7f4fc67f041a083d0f27ec441ee36c6b0479c30d213d373edacc372fc3818fc98eac3c53da4d9a09eefca974fe868babfc32bf6e1449d97d14a891e3b10bbe54f64e00a0b5dcca1a0ad7b3367ca39009b957a1825269c78ca3af9a2a87c43894fb8bb9ec165d7a4bea07b68db0a8ff70d3557ae4c04b964de0fb67e3c340f3649c0af4bf79b86e73be1a02af8fdf09ff77e7f4d0e325050a8f293c08d2cb328f8d3da7e083a7d48924224a032a90f4a4456c9a1cefc92ea7026d74d9c1c5117e8b7d405e9d9440a8edfefbba03c40b1884e0810d2d3579d8be5483a651ae4ea3041f484ddef2f0ad5a70efc06a06c34468de46e1c6fd59005d0201b3de36cab1a04daf1b42073e91fe35cac978ea05901b53bc10fe26bfa1936e1ba5a334d168558454429aecd803d3e63304984dda08e3a481bb8b089125b4e820bc9e59c606c47631394830b9b37c06c77110bc512a06411f9d1b96b36d413236b20ecaa77fef4bf17c023b6a0feb143a7dfd529053da0c388a4b630d106f22778df9782863b29cc712d25423c704117a9cd46190d55a6a0c3260e27d68de22e8dd36e2a15055e3f9cc0a1503510f8352be2458ce2849cf8a000d1dc7f94ab884d393c18ad9816d364c001e8ed29b5339d7d673d05d8cf8c18a0cc90581b3014a0af5d5a263a6581f442d75cccfce15f6da447c30aa3eee35adc80f90211a0f4f253a2981255c3c0c2b023a074cf35ee982c4709fe56d3cfbcc0d2d3e9e060a0c97e5c55396e530fb20bab042aabdf2883db66f41abb6c71f8eefdae67334800a006d2ac360ebe8eb14a59e2cccd35c3a23d9c559f183102ebdb3db068fdf6a634a03a78bec1492adf068ece5e9820d72df85d2e0b2b992f0cacb7198fc956473d94a0eecba4d8055f6358c4ed0989fbf575de5f137c4ffc73a53ade1d708c45641131a0eee901dcdf7b3b76f230c684200e990fc2284b3a3cac8156795643a8bf45f543a0c679d68e57dd545e7489f10898128a6a90ad7df29d3380ea3fa2c8d036a714c3a063062d6a6c1cfe1efff0e6965a65446b61982e763eb36652e1423df1fad08643a0d6c8ae23af8ad991e84c43f69bf280c54fc3a731b210bd60f5b8f39043480017a04614a62c039ff880d7c65c891e6fc6c55bf81bddadb42b5171a8d07f7218d7c2a0bfec07e9660db8afc02cd6cc2524246febc098f596a717190d1ef155317ce046a02aec38d6659b1b72f03b7b80e078dbc40650cea494f56606154538491df2598ea0c75fdcc0ec88840ac16c38f4a5902dc1e87d704cfdcec825b0aeee25fac08c32a0e09b0acd86da73ca9edd0ed45f52e970c710860aced6d2e1bb3617d45d1f1cc2a0bd67f755acb481bd586d2adae80b8155e8c887452ff964c8dd0ac888032b7d1ca04f03b5b8ef01c49629b79e51438d92a2dd9a490508152a96787ea1c39e1358e180f901b1a0b253f4d804466eedf2500f7c56b7b5c81937fd8547fbe942756bf1c2974245b9a0dfb6b4a54ee26fb0acc8a98e28efc6a9bef48610921ed4c5ddad4a6770ec413780a0e5b8323277c3cd8b0da5297fc709533d25bc28964698a6f2cbc4ba80c4c474c880a0ad4e25adf77388513a19b6e66f340845f4da575e05cbb41ec3ccacc962beb934a0ec3b2876d5a7b8fb4c959b2e2efd9a3fee75ee4e65da5438010367610ca50ccca0316db872ded9164c79a846190e57eb2c3a4379087798b8e1220b3cc5ff5aea06a05ad6bcb5a22ccc01a7b218c06c217b5c6f6a54cd77dbf3385422f37c3a5bbdc4a039d08aa5ea4684c934cd1911177ebea1f2f3438d891da946a0396ac10b663b1ea0c73d499a0e4709723af701832cc2e07949df500d5a817709746c124757f2a46d80a07967cd6ca41b76eceb64c5373d85399a380af1d1eae78f56a33a149677398df3a0753f05888f5454aba005e67e1061a0bbb982c308cf90a89746abebc76f640d44a01eba4f5159fcb36c5bde7933e2632b0923167fad080618e90b90e98f450e0673a0dc9282be875f1e21a4245c23816f7c36bfaee11d34c472c29ae4576985f2e9e880f8b180a0f53d8c2cc17264e3f43339e6390b3de4123e0d3014e2437d51e9527d32531dbba00cbb4e2b6e1f2b59fb98c96cd2ee4a0a9994e91d18564b8289c5dbf42d653e6a80a0585dc8b79c33d7f248c845ac6c35ea102dc2fd2870e4e96ae7891ea6093b3e6880808080808080a05b8b9aed0df2c69df192889f2a5c791f16590efae13338ab7279ea1bab2fd0b38080a07308e7b9a6597a64d45bafaf4b3a2a4525895d77c7d8c146ef7720f5c693f7b180f86e9d30e1120c458c4c09a9448628f84e81161b308d5c4041a3d3a1ea329d0eb84ef84c588823d85d5096750e00a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470224408265da01e1a65d62b903c7b34c08cb389bf3d9996f763f030b1adcfb369c5a5df4a18e1529baffe7feaec66db3dbd1bc06810f7f6f88b7be6645418a7e2a2a3f40514c222441284214b9b9c85549ab3d2b972df0deef66ac2c98e82934ca974fdcd97f3309de967d3c9c43fa711a8d673af5d75465844bf8969c8d1948d903748ac7b8b1720fa64e50c224440d3256eb0babe89f0ea54edaa398513136612f5a334b49d766ebe3eb9f6bdc163bd2c19aa7e8cee1667851ae0c1651f01c4cf7cf2cfcf8475bff3e99cab25b05631472d224476d76ee8823de52a1a431884c2ca930c5e72bff3803af79641cf964cc001671017f0b680f93b7dde085b24bbc67b2a562a216f903ac878c5477641328172a353f1e493cf22447f5f2cf1aec83bf0c74df566a41aa7ed65ea84ea99e3849ef31887c0f880a0feb92f356f58fbd023a82f5311fc87a5883a662e9ebbbefc90bf13aa533c2438a4113804bf2244980a75ecd1309ea12fa2ed87a8744fbfc9b863d589037a9ace3b590165ea1c0c5ac72bf600b7c88c1e435f41932c1132aae1bfa0bb68e46b96ccb12c3415e4d82af717d82244b71b214cb885500844365e95cd9942c7276e7fd8a2750ec6dded3dcdc2f351782310b0eadc077db59abca0f0cd26776e2e7acb9f3bce40b1fa5221fd1561226c6263cc5f2244f474cf03cceff28abc65c9cbae594f725c80e12d96c9b86c3400e529bfe184056e257c07940bb664636f689e8d2027c834681f8f878b73445261034e946bb2d901b4b8782a441284214b9b9c85549ab3d2b972df0deef66ac2c98e82934ca974fdcd97f3309de967d3c9c43fa711a8d673af5d75465844bf8969c8d1948d903748ac7b8b1720fa64e50c2a4435552c16704d214347f29fa77f77da6d75d7c752b742ad4855bae330426b823e742da31f816cc83bc16d69a9134be0cfb4a1d17ec34f1b5b32d5c20440b8536b1e88f0f22a4440d3256eb0babe89f0ea54edaa398513136612f5a334b49d766ebe3eb9f6bdc163bd2c19aa7e8cee1667851ae0c1651f01c4cf7cf2cfcf8475bff3e99cab25b05631472d2a4476d76ee8823de52a1a431884c2ca930c5e72bff3803af79641cf964cc001671017f0b680f93b7dde085b24bbc67b2a562a216f903ac878c5477641328172a353f1e493cf2a447f5f2cf1aec83bf0c74df566a41aa7ed65ea84ea99e3849ef31887c0f880a0feb92f356f58fbd023a82f5311fc87a5883a662e9ebbbefc90bf13aa533c2438a4113804bf2a44980a75ecd1309ea12fa2ed87a8744fbfc9b863d589037a9ace3b590165ea1c0c5ac72bf600b7c88c1e435f41932c1132aae1bfa0bb68e46b96ccb12c3415e4d82af717d82a44b71b214cb885500844365e95cd9942c7276e7fd8a2750ec6dded3dcdc2f351782310b0eadc077db59abca0f0cd26776e2e7acb9f3bce40b1fa5221fd1561226c6263cc5f2a44f474cf03cceff28abc65c9cbae594f725c80e12d96c9b86c3400e529bfe184056e257c07940bb664636f689e8d2027c834681f8f878b73445261034e946bb2d901b4b878").to_vec(); - let height = 39981000; - let trusted_height = 39980600; - let trusted_current_validator_hash = - hex!("674c4f3d0b24204759cd9b4d9a641bdeed6adff81bafe9965451045916b6b4de"); - let trusted_previous_validator_hash = - hex!("efa11eef8adc20d6f179dff684c16891761d632462147830cb45579589632786"); - let new_current_validator_hash = - hex!("8a4bca6491ec89e201ea0e2776f0ae42f7e5c8d67a305a7aa6284a0e0150f736"); - let new_previous_validator_hash = trusted_previous_validator_hash; - do_test_success_update_state( - header, - height, - trusted_height, - trusted_current_validator_hash, - trusted_previous_validator_hash, - new_current_validator_hash, - new_previous_validator_hash, - 97, - ) - } - #[test] fn test_success_update_state_non_epoch() { let header = hex!("0a222f6962632e6c69676874636c69656e74732e7061726c69612e76312e48656164657212fb460a9d060a9a06f90317a0feb3dca8515ba663608be132579cc4be830849c364fccc90d3e46b5f0c23fc41a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479461dd481a114a2e761c554b641742c973867899d3a023de09bdc6958b6144faa67c37966f2c1a8fb0697fb99b9e6a2340bb5be1dd05a0c834461f3fb915a33c55976be1bea82c54f7ff96ee284554346daa86d89d9806a0c61679f1e18d68a25b8598d05ae895768c0d6017198393f4c07d66b99221d6a4b90100812bae02ce1014d8885402d4ac1c150f9309418024012028ca0e4b3002c21800c01132417004ce41008139a008123203940e301980880004a00204d28d2420c2a42044820fe40060279d9f3cb14022f621d0126107668247210414058f206360b0fce6238a17002445cb199001c04d490a208041e24044aa2a00e710a4085101c51ae300021aa0718288a410e4408ad84c246c0528238048b510c044082940230b9a20008e22cda1260040042a8a0310040042023e88018583a235b068531469e30f045e04ac49c6809404a033105080200160809122403c6913704ea705f0aa2398a101b0c4d12253200ac32a0d099de93ae02da97223c811042a600c3914d0028401eab9cb8408583b00837a7f0d8465168255b90118d88301020a846765746888676f312e32302e36856c696e7578000000b19df4a2f8b5831df7ffb86097df3baf86afba3c26f7f97e49223d62fd9c09d728fe214d2d06ef9f7c3416fdc310be297444b7f4b0ff2835a02858e407d574343436f249ebf617c094c80bbc5d19341fb4ea8c7d9024480f16c4856edb087c3b7a06b10c38920a43c8753fccf84c8401eab9c9a022c32b836e14bb6b733e91900715e7268b23efbe462314fbc500d36b425ba1048401eab9caa0feb3dca8515ba663608be132579cc4be830849c364fccc90d3e46b5f0c23fc4180d25d99399c6b8c0339bcfd6b516fb1f3d2413efd792cf3c87a7c34ae80ca147934267791f4635c5d3840c11b240696e9c889ba0ec411388251026105fa7e5eb201a00000000000000000000000000000000000000000000000000000000000000000880000000000000000800a9d060a9a06f90317a004155d7b8c18f2d69800c8f9444b4a25027c23eb7514ea0d3c646693d4673d99a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479470f657164e5b75689b64b7fd1fa275f334f28e18a0dd5169230dd630e4891f1356f1b96707176e5922adf7d1607d6235eaddd50cb7a001c548e269165c55330607dcaa0a13c7508ff56922757219a9050366b5833115a0224fc94974291205e108fdf540928481aa6ff640ad1ed67db7ea087dbd557bc9b901002a708b2a016850920a010e649218000223074a82c918008039019b851244021ca14931207014d88000404308001e20048a00581b10075420834024022928a2802c5042018540040041489808e0a2583c25182376014e0a4124c74210388301b1466ca5219e121828408108888b03c90308086440a84c04b93200c09c031425074709ca85a248c44e908b160088404898602e840438420868015080410009c460c69000006b66aa80806844440e42900370b2022098820a18100341e0c41286080881944a04480a871c2044418210d22020742940b808ca140d12548a0312a0001030ab0d016c2d2801318ad0080009680c2804f40468280899616f010a010140028401eab9cc8408583b008367bf768465168258b90118d88301020b846765746888676f312e31392e38856c696e7578000000b19df4a2f8b5831df7ffb860abf70f41702762f51619c42bdf6b9c3ba383175632b6db3cc238bc17364bf21562a51f228f68534e7b4aaaff35f8c5ce08fd5e8dfeaa328a76b0e6ebb85b5e99099b660ed69b759f014fafa7eecb3098292d75f82d0c471ef6f9511b4ef3f8d4f84c8401eab9caa0feb3dca8515ba663608be132579cc4be830849c364fccc90d3e46b5f0c23fc418401eab9cba004155d7b8c18f2d69800c8f9444b4a25027c23eb7514ea0d3c646693d4673d99800b315cd2d4e3162f9ccfb0a1c3bfbf57368525086dd5c0b18bad6833e2bfca3e1fbad1657e623968d777fec26778fd846e6664bbf5eac859dd09eae74d96bee200a00000000000000000000000000000000000000000000000000000000000000000880000000000000000800a9d060a9a06f90317a0dc9fb461ecd0a1bf6349e94d61f78c783a511d0e773154f6593f2530dc8c5cc3a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479472b61c6014342d914470ec7ac2975be345796c2ba0b4486492538ac1aba093c1b5f303d47fdfc5be01cd5c67380e5e9760779139d3a037c90501705e0938b684c912c4bc8a2ebbbc46f477abf481e600262c733451d1a09219073211ceb3d89b20b19264464a28229a069c832e751f5452e7fb8b5efb60b9010052a0a28f26cff3f5004e00e4a39a044e8b084a42b48914c87a398316d3482614a6d2125560fbc0015063baf2041e401abd4bd410581be876371c29bb043e0a48864f669223440e39897b28298560542d7218016b437cc3aa28b6519482202e20c96cb4a98edb1d8f6d078b90c32c2b65ae80c41d0ee0c4ae9051de93c508e65082fcba04803651c7d3bc3482590a081c2c3c45c1ab33105930ac83405d02c530aa11d10553c30a14129042e4638214b96609149c6ace47e294644462e18acab0990b165ab81418225420106d0e34d160747963e4b182515451185e87a74be270b331ca0531290e2889276f12b400090a7900008d932867ce1b6fad1118bb520b028401eab9cd84084fe2c683b2b318846516825bb90118d88301020b846765746888676f312e32302e35856c696e7578000000b19df4a2f8b5831df7ffb86099ff0d5d682bbb7d7a82a3e81c09b9fb4c3b3c2cfcc0f1b1d68ae90a678bbba5430aa814fb2102d6893c39de2e86c96f19d8d1e8cd93a5f86dd87c7639adf3f661e3ae238daa85243e03e8dee02e45d64556263c7b9d38a9fd250fc47791dc56f84c8401eab9cba004155d7b8c18f2d69800c8f9444b4a25027c23eb7514ea0d3c646693d4673d998401eab9cca0dc9fb461ecd0a1bf6349e94d61f78c783a511d0e773154f6593f2530dc8c5cc38040c23bea0a66f1eb621da3fd7184780591887e9a85a0b075a1df3e0cd6e14d522f9b3245bac947cfcc959770a65f63115fc2891b2043f675ca4e9e4aa6f2baf501a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080120510caf3aa0f1a951df90e92f90211a0879fbf1597c6a4a5c19795c1962370cc6de1ff693534c7bee22df95842990dcda0b22fc1e58162520af9a6bf4326027e307cec4342c9c3a6a9d6a32564363b0a2ca0f1654bf9e5e926a80711aff2934e073cf4b103765f9df3b069f24aef4d16cdf1a087c5469547200128d2c98237b629189f162e786bde24b500029235ec2ca89281a0e498ce1143f8c074010db7643780a87780f7578a41ec4a0f3bb2251369d68d46a0d3c655057035d5002eedc89b56f66bcf2d1b6fa8be67bc41d3c89be1f7722c4aa0284d823ebb6f34818f14ecc532b770540712f3aa1ca4df74e334bc253e6b32aca0f28ab40b0509b25fe9f3dd65f626f42729f52ccb9685b61b867469a321f21716a00f76ce464832957ad288c150ba1cadb0e590f316076a52a3344a37e70123c51ca0f02904295ad311f10ba192a1049f4816b40f7c81c651c88b110136d02e638f7ea021b037ac53fc4ea00c1da756df5fcd5f73fedb991cb716bfb9f946e07979833ba03144039e8987b82900e059f5780412506b75769f3b68609775a46112091297dda02641eb6e6277e93c4288f92338d04e51b4ef75a709852f73419d9da61c618cd0a01b65d747629e22c321c27bf3a3be57e9ee06e9f51193e8fbebfac66ad0e3abcba01cf92f3196475026a7c231bbf0f12cfc1f08b47fbcedc2a7c57b64e3b3832dc7a018767613ec3bea5597898b1dd2601c931ffcf0115547e23f84c06f320719db6980f90211a07f9d3901b46ee6b732d2aaaf84d40b47ebc831ed47adb8a2c1c43613de4605dba027cb7f21a746a9c6e76b3d4d0cc1da32111ca20b0d3f1cb64afd1d0462e8e211a0052f5245ea659debd6f38fc4789cbeb0fd2235aff77537e808e0e767196e8b7da0af67e75eb2f83ef984dad98b2e2d05a1b9e0d18175e7882e9ceb847c994f89a9a01af6bc0e3ec6cc384dd68218ed53f2799024d57d2c3a53523dfa227128699ceda040971b58d91a4e17e12065b5ee59134aa12173a581716893358ddb80ccd76486a0c68ac43d0dbaa844b812b91c527f70595d1c9fb33e49e373993078a9b6506f4fa0542841b0417994c8e689d15cf3d895a09d1e485ab9b3bf0b782b112792f459dfa09c410eeb054c0cd4bdcebab79f3dcd445ef33994e03b4f8336b1a3842c879261a0317498b85f2e60d0144557a9daa665b04858f6d67afa4692f6e40b518becc5e3a03e15531394d36f2cebabf69de2823a5a17994e85f6d4bc663947157c007edee2a091c0de5ac4131c6e9a625000d994dffb70f87eaa0dddb27544e731e2e04a066fa023ce1490b59b94bd8840af9c1a12f2f98f9537ddddee037209dd7881a114052ea0c7e8afeea81b08c7b07ab41e191b8c054baad1231db7585084ac90907211fc2ba068e094995972c8da18e345180551c04af0696b5b756d3f414dea3b41a15b575da0e22741ba7909396a84d3dbef5aeba6e6614638253a7319ec2fa6409cbde44b5180f90211a0e6d6c23fa1734c2f5d243a3cfb0f39cd02cfbfdb4bc3c8f431aed32fcd2854dda06bcf17926dad58b8c5118d5a6174fd085d03d92a9d4a5ed56efdd36f45975ea4a0f753573922dd3666bd8c5dbd5b4ce6de8a8f0800188c034d383d8916a53ce3efa091e6a46980bb716301891e6d65c420b2c25481f5f1fc0ec3e921fa1ec0b33e65a07ea284e90799149edd33ace9e67e83806405f98028558b45a5dcf6e411ac1d7ba070c2688533f8337332f5c7c11b1bd46704b7f2937d4683e509ca40cfb97502eda04b03a777f36dc9be61cca125223359ebb167562b64715f8aada6ee9f0219df0da093993ee43f49f3e33f6cb6541c6393dca4ac240893f1c0a250490f784d138814a085ae2d7b32dc0f0da002ea5033910b035e01f5ae12ff3105010e13a5a33c0ad4a00c39c1e39b90b4afab7648dd547f77b8f9d4c6d9e0c63e34ebf4c149c948edafa0e56b7c7c4656dd0b9f0919e09d6da771d38c453af4c0f0d6544f390fd2a543f7a081cca9739d3140249d6ae461371ff7b465883352d81bc757ca982f52d524c1dba0d3dbf7dcc484d241e77ee2be684b262f614f871a8c9d6598430a2134973782e0a09917ddd6820b6c66429eba999f5030141508a439dea8393b098035dbd283c287a0690b4d39eff7648da540434688e23bed68fe43f3711a9bc7dac7c15626fe1b7ba0c8af8672c865cd5af89c4a6b9e55b87f1dcf1ee0f76560a7d1f3c04daab60e4e80f90211a043beb9ae278028ab0e6ae1dd97bfc1adc7da5d5b35418cde1372ed15dc60d844a0969897f77040974812fdc243499998d5a2f808b010e3e743fff5bb1cf06701b7a072a62f95c81d3849bc02102bcb66b5be775ad3b68cae7967451e6a13c48b6c43a0488199752a3a18aaaaa52b07d5a306826c4ccb2afe3cb30058de3e361dee74cfa0a63fb5ff17b1ca7f9c095cd9a888f4fd493a3379cdc2a0cfb49353c854923fc7a0ce7a2593ac4b8c89ad4c5fde8940d9695e969cfe6eb6a614954a48bcfd715843a0cb8b4d0264778a2ab04b96777ffe78a5ee62483a87446fceccb37813cda25b60a008fac15554b1c384ad91aa696e7e5e5454dc0c0fa343bb26b48a4f34ec95f785a0f1811154dd01ffd9f43443acd407e0beee53bbd03f40f63b7d993681182f0289a0a620126c5db0919a29b4b27c728dc42d2d63015849527be64acd0062b575c0eea088d3cde1a49a0ac95f076d1e15b3fde9cefd0f7e308f53b3aa466eb0385aec50a07f99a989d621bd1b59fa51d109f6413c9cb7f8ccd704dbf13cfb27bebec8f1b1a04321111d914057fe87d18e8c6f4128c6c7778fa2b73d435f0b2562c5910361a2a07ee88a697a560dc7023a840f16df54c599dc345e787927bf6628963e782a6847a078d58eb776d8d9dd6dbdbdd830b0350bd0427b15678ef457da5d41ec2cca708ca050e0c4585785b9c800e24c4c4e00599d7e5c4e6d8f3363979ab6c49ed514f12680f90211a011ff0a2d404fd7ed97509ebaa806f2a5ba09c5cde5ff596903c4313783487509a014931c578b05f5948939281aa31d2bc8b05b01c6932c45bf7a70972a430575c2a07272592f567daa667135799961e9eef529a6cd754395e39694d9452ae24a8797a092b17ad714173ec4787f0b3b9d2dfa96680861e093b5121441ffcde64183d074a06db41a6efb6f94c7d185f76deb8bb00468715bf6828fb63db31b880a6050c54da07ce695737ab0d4bf9003a06ce83b11e75d81fbeb47c013b41f9c2e00a97cb87aa0dfe63771f833e98a5aeff54d9dd5a8dcfd89ca43c23644b18ec8e29ab8ccc287a0a327c817dc8a8ea3a5d3ca3cb55169777a1bfa30fe9f0df842eb3978dbd6737ba053683114bdaed7819b30ab8baec1fb9a2a96fee4dabc72f319cec9869da3b0b0a04d98297a896312d18da40240ed9a527f4c01c73edd3ea1f7c28338d1d863d97ca070451b5f2a402b497659eb18e648ac46f39c0068cc91436eb0b082b1d06dd63da066e866f800200512b0d3e534c547f4d2012429152cc9693bf1553cc22361627ba003fc4e648aafdadd7a9fa7cb534103f08dc699413ecda22bda46898bfb792429a0b46a167c66b50c74227d03a68971e124fdd011d6c90f5a08f6fe30ae34de603ca0a7ced66271235bc27b154f37bee6d9a1366cd253176c96de707d124fcc593c35a0f4f09b104a86cefc5c282d393b415e6c224eb8a463386448ebebfad9f9f53c9680f90211a05f93540f4317a4c6d8b73556a7ffdab6fcf0aa36af84b8c4bd2a3e7114e2da4ea05dd8c13b1b83485911f5e1185669f7d5559c260193a72e52597a3e80736c248ca03d50a67e8ec93696c35865d9f03814e95406c8d04e5decc320b9a24e5beee1baa0a928e2ea8773ba69dde5344d69069b237667dbaaa69e86133d4e444e432799b1a0ebb2cbf0c3314ddf681f21a29fa17b320094684ba35e725bc36bbc407821cfa3a0762aeb8161d2b1b8a5ee51d1ede36f51cc2dad7e0c4d0ff097b89c831aff8c35a0957a8eaaac924688482d21a95b7a7f01889ab39a7a50d58efaaffa9e486ae071a046c10b0c15aa83973ea4b108f50bad2638941550fce7c9308c8b968abee271f8a08a831384faa68f9caa047a6200464e11cfe5f9f700a5ed9435e5241d9d2a501ca020630d0f41d1f38c61fc8d3fc6170f6f11fc52ade454930a3b5e4f4491b47467a04539a99793f29484fdbd39b606f27265499acb3c24461f48858655f07166f0dfa05fd40548cfae17d12e103db98572f22cdc8dd3ec670be570727a7ff68f6bce9fa032efe866f058f79ef06de75f682e10773576eb9fca3f950fda96ea9926784685a05c170d685d29417781f678b746174c7500e7c228b4bd71bcfe9f5421742a0b67a0c3fb71b77522f06c4a4e4cb7029e7faeb747b8e446460586ea0d5e9abae68cd9a03f2294bf8bea287c7afafde4b39aaa56716230ef425ece688f6a78fcadf5f49e80f9013180a0c2cb770a3d18eb1214a782cc81b79a7fd772716c2d050ef66011095c3774e8f7a08fc7d7da06fba7ffa69b095aae41147e3a55b89644682057cedab705ba7aefd5a05975b434f69398107a4d1729f8f56e75247df09c65b1a750797818607bf118df80a026cea4c13260b2a1dd74bb6fcc7cc36162d2856ce691a36165c633ba68f7b783a0f7b0c667509a4ce937c487b45bc53c0700543daf4f8c127fbe475b4e1084d2328080a0454eca3fcc32afd4c4000ccbb47732bbce342b1a9d374fb5872162f2c873625fa0b3e6c44579a731cc730a5472e83c6098fa2943e5b2c72f4475f0afea76848a87a03b8c951788b8c93366aedbf88f6c1ca6085cd0249025ce542f19294b40bb92f180a0a10cfa51ae290afebd64a5b530db7088fa0b02f22ce9b0838135b422b885dee5808080e482000ea07b2632b8b97e159d88f112a8dd9d44df2f3c4502e0c79a29297ea7f61f41f311f851a030590b16841225b9590cdc95b19176201d442ca0b931c6e4314d20a1c772ea9ba052e8f9f247cd159c65b304863d444087f6a60d7dbec3a0e4fa09f007b5a1c64f808080808080808080808080808080f86c9c20120c458c4c09a9448628f84e81161b308d5c4041a3d3a1ea329d0eb84df84b0487400e8b4f1c9c00a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47022440bac492386862ad3df4b666bc096b0505bb694dab0bec348681af766751cb839576e9c515a09c8bffa30a46296ccc56612490eb480d03bf948e10005bbcc0421f90b3d4e22442465176c461afb316ebc773c61faee85a6515daa8a923564c6ffd37fb2fe9f118ef88092e8762c7addb526ab7eb1e772baef85181f892c731be0c1891a50e6b06262c8162244295e26495cef6f69dfa69911d9d8e4f3bbadb89b977cf58294f7239d515e15b24cfeb82494056cf691eaf729b165f32c9757c429dba5051155903067e56ebe3698678e9122442d4c407bbe49438ed859fe965b140dcf1aab71a993c1f7f6929d1fe2a17b4e14614ef9fc5bdc713d6631d675403fbeefac55611bf612700b1b65f4744861b80b0f7d6ab022443f349bbafec1551819b8be1efea2fc46ca749aa184248a459464eec1a21e7fc7b71a053d9644e9bb8da4853b8f872cd7c1d6b324bf1922829830646ceadfb658d3de009a224461dd481a114a2e761c554b641742c973867899d38a80967d39e406a0a9642d41e9007a27fc1150a267d143a9f786cd2b5eecbdcc4036273705225b956d5e2f8f5eb95d25224469c77a677c40c7fbea129d4b171a39b7a8ddabfab2317f59d86abfaf690850223d90e9e7593d91a29331dfc2f84d5adecc75fc39ecab4632c1b4400a3dd1e1298835bcca224472b61c6014342d914470ec7ac2975be345796c2b81db0422a5fd08e40db1fc2368d2245e4b18b1d0b85c921aaaafd2e341760e29fc613edd39f71254614e2055c3287a5122447ae2f5b9e386cd1b50a4550696d957cb4900f03ab84f83ff2df44193496793b847f64e9d6db1b3953682bb95edd096eb1e69bbd357c200992ca78050d0cbe180cfaa018e22448b6c8fd93d6f4cea42bbb345dbc6f0dfdb5bec73a8a257074e82b881cfa06ef3eb4efeca060c2531359abd0eab8af1e3edfa2025fca464ac9c3fd123f6c24a0d788694852244a6f79b60359f141df90a0c745125b131caaffd12b772e180fbf38a051c97dabc8aaa0126a233a9e828cdafcc7422c4bb1f4030a56ba364c54103f26bad91508b5220b7412244b218c5d6af1f979ac42bc68d98a5a0d796c6ab01b659ad0fbd9f515893fdd740b29ba0772dbde9b4635921dd91bd2963a0fc855e31f6338f45b211c4e9dedb7f2eb09de72244b4dd66d7c2c7e57f628210187192fb89d4b99dd40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002244be807dddb074639cd9fa61b47676c064fc50d62cb1f2c71577def3144fabeb75a8a1c8cb5b51d1d1b4a05eec67988b8685008baa17459ec425dbaebc852f496dc92196cd2244cc8e6d00c17eb431350c6c50d8b8f05176b90b11b3a3d4feb825ae9702711566df5dbf38e82add4dd1b573b95d2466fa6501ccb81e9d26a352b96150ccbf7b697fd0a4192244d1d6bf74282782b0b3eb1413c901d6ecf02e8e28939e8fb41b682372335be8070199ad3e8621d1743bcac4cc9d8f0f6e10f41e56461385c8eb5daac804fe3f2bca6ce7392244e2d3a739effcd3a99387d015e260eefac72ebea1956c470ddff48cb49300200b5f83497f3a3ccb3aeb83c5edd9818569038e61d197184f4aa6939ea5e9911e3e98ac6d212244e9ae3261a475a27bb1028f140bc2a7c843318afd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002244ea0a6e3c511bbd10f4519ece37dc24887e11b55db2d4c6283c44a1c7bd503aaba7666e9f0c830e0ff016c1c750a5e48757a713d0836b1cabfd5c281b1de3b77d1c1921832244ee226379db83cffc681495730c11fdde79ba4c0cae7bc6faa3f0cc3e6093b633fd7ee4f86970926958d0b7ec80437f936acf212b78f0cd095f4565fff144fd458d233a5b2244ef0274e31810c9df02f98fafde0f841f4e66a1cd98cbf822e4bc29f1701ac0350a3d042cd0756e9f74822c6481773ceb000641c51b870a996fe0f6a844510b1061f38cd02a440bac492386862ad3df4b666bc096b0505bb694dab0bec348681af766751cb839576e9c515a09c8bffa30a46296ccc56612490eb480d03bf948e10005bbcc0421f90b3d4e2a4412d810c13e42811e9907c02e02d1fad46cfa18bab679cbab0276ac30ff5f198e5e1dedf6b84959129f70fe7a07fcdf13444ba45b5dbaa7b1f650adf8b0acbecd04e2675b2a442465176c461afb316ebc773c61faee85a6515daa8a923564c6ffd37fb2fe9f118ef88092e8762c7addb526ab7eb1e772baef85181f892c731be0c1891a50e6b06262c8162a442d4c407bbe49438ed859fe965b140dcf1aab71a993c1f7f6929d1fe2a17b4e14614ef9fc5bdc713d6631d675403fbeefac55611bf612700b1b65f4744861b80b0f7d6ab02a443f349bbafec1551819b8be1efea2fc46ca749aa184248a459464eec1a21e7fc7b71a053d9644e9bb8da4853b8f872cd7c1d6b324bf1922829830646ceadfb658d3de009a2a4461dd481a114a2e761c554b641742c973867899d38a80967d39e406a0a9642d41e9007a27fc1150a267d143a9f786cd2b5eecbdcc4036273705225b956d5e2f8f5eb95d252a4470f657164e5b75689b64b7fd1fa275f334f28e1896a26afa1295da81418593bd12814463d9f6e45c36a0e47eb4cd3e5b6af29c41e2a3a5636430155a466e216585af3ba72a4472b61c6014342d914470ec7ac2975be345796c2b81db0422a5fd08e40db1fc2368d2245e4b18b1d0b85c921aaaafd2e341760e29fc613edd39f71254614e2055c3287a512a447ae2f5b9e386cd1b50a4550696d957cb4900f03ab84f83ff2df44193496793b847f64e9d6db1b3953682bb95edd096eb1e69bbd357c200992ca78050d0cbe180cfaa018e2a448b6c8fd93d6f4cea42bbb345dbc6f0dfdb5bec73a8a257074e82b881cfa06ef3eb4efeca060c2531359abd0eab8af1e3edfa2025fca464ac9c3fd123f6c24a0d788694852a44a6f79b60359f141df90a0c745125b131caaffd12b772e180fbf38a051c97dabc8aaa0126a233a9e828cdafcc7422c4bb1f4030a56ba364c54103f26bad91508b5220b7412a44b4dd66d7c2c7e57f628210187192fb89d4b99dd40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a44be807dddb074639cd9fa61b47676c064fc50d62cb1f2c71577def3144fabeb75a8a1c8cb5b51d1d1b4a05eec67988b8685008baa17459ec425dbaebc852f496dc92196cd2a44cc8e6d00c17eb431350c6c50d8b8f05176b90b11b3a3d4feb825ae9702711566df5dbf38e82add4dd1b573b95d2466fa6501ccb81e9d26a352b96150ccbf7b697fd0a4192a44d1d6bf74282782b0b3eb1413c901d6ecf02e8e28939e8fb41b682372335be8070199ad3e8621d1743bcac4cc9d8f0f6e10f41e56461385c8eb5daac804fe3f2bca6ce7392a44d93dbfb27e027f5e9e6da52b9e1c413ce35adc11b313f9cba57c63a84edb4079140e6dbd7829e5023c9532fce57e9fe602400a2953f4bf7dab66cca16e97be95d4de70442a44e2d3a739effcd3a99387d015e260eefac72ebea1956c470ddff48cb49300200b5f83497f3a3ccb3aeb83c5edd9818569038e61d197184f4aa6939ea5e9911e3e98ac6d212a44e9ae3261a475a27bb1028f140bc2a7c843318afd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a44ea0a6e3c511bbd10f4519ece37dc24887e11b55db2d4c6283c44a1c7bd503aaba7666e9f0c830e0ff016c1c750a5e48757a713d0836b1cabfd5c281b1de3b77d1c1921832a44ee226379db83cffc681495730c11fdde79ba4c0cae7bc6faa3f0cc3e6093b633fd7ee4f86970926958d0b7ec80437f936acf212b78f0cd095f4565fff144fd458d233a5b2a44ef0274e31810c9df02f98fafde0f841f4e66a1cd98cbf822e4bc29f1701ac0350a3d042cd0756e9f74822c6481773ceb000641c51b870a996fe0f6a844510b1061f38cd0").to_vec(); @@ -841,6 +817,49 @@ mod test { ); } + #[test] + fn test_error_update_state_non_neighboring_epoch() { + let header = hex!("0a222f6962632e6c69676874636c69656e74732e7061726c69612e76312e48656164657212d15b0adf0a0adc0af90559a01b8c590cd6b9bcf6c24e47e5f6468083f6093d05f9cc6a3f45c0e61a7989914ca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941284214b9b9c85549ab3d2b972df0deef66ac2c9a03508e22b6e7dd679e544f7badb659cd936e1722f9a91136e800681d588b886aca01aa0294d38be68038c13ca83d122e765b2714e3cf5a7c8b382eab64f009be8eaa026033fa1fdf7e559f128b7380b369d908261c092e97040cd938d0c2cc83c8d52b90100000448000000b680400000c0c00010000280440000920200002040210200009000015e2004022110000830000800100000001222041000004000800040ac100004c0003004102013000540080008820021180000100482004041102000001c00100c68200202009509421005288a684028202400000408912000403080000c000040481c000c80141840181c20001004102084e02800200a040000880c18802006028010c000062808040a2022023082410200880080104a40e00011000000021410981200100a8000026900081200002000808004800420811049ea00206000121002c210000002491000941000110000249000809900084006210020000a00028402620fc884042c1d8083303e3c84663394e3b90337d883010406846765746888676f312e32312e39856c696e7578000000821df8b90808265da01e1a65d62b903c7b34c08cb389bf3d9996f763f030b1adcfb369c5a5df4a18e1529baffe7feaec66db3dbd1bc06810f7f6f88b7be6645418a7e2a2a3f40514c21284214b9b9c85549ab3d2b972df0deef66ac2c98e82934ca974fdcd97f3309de967d3c9c43fa711a8d673af5d75465844bf8969c8d1948d903748ac7b8b1720fa64e50c35552c16704d214347f29fa77f77da6d75d7c752b742ad4855bae330426b823e742da31f816cc83bc16d69a9134be0cfb4a1d17ec34f1b5b32d5c20440b8536b1e88f0f240d3256eb0babe89f0ea54edaa398513136612f5a334b49d766ebe3eb9f6bdc163bd2c19aa7e8cee1667851ae0c1651f01c4cf7cf2cfcf8475bff3e99cab25b05631472d76d76ee8823de52a1a431884c2ca930c5e72bff3803af79641cf964cc001671017f0b680f93b7dde085b24bbc67b2a562a216f903ac878c5477641328172a353f1e493cf7f5f2cf1aec83bf0c74df566a41aa7ed65ea84ea99e3849ef31887c0f880a0feb92f356f58fbd023a82f5311fc87a5883a662e9ebbbefc90bf13aa533c2438a4113804bf980a75ecd1309ea12fa2ed87a8744fbfc9b863d589037a9ace3b590165ea1c0c5ac72bf600b7c88c1e435f41932c1132aae1bfa0bb68e46b96ccb12c3415e4d82af717d8f474cf03cceff28abc65c9cbae594f725c80e12d96c9b86c3400e529bfe184056e257c07940bb664636f689e8d2027c834681f8f878b73445261034e946bb2d901b4b878f8b381fbb860851066357eff502b847239dce4def537c09981995b09a20b0332a5931b6a80a0756929d82d67ada1699558c423a5108b0754fc4a8729fd2967822ee274fecd8742703f1e758c0c25aa65667ac33ca73a09dacf4ffeed749d956d6b438a65fe35f84c8402620fc6a055a683a5f4aec18ad180c783416fa6064fd77d12dd9cce6aa4e2d21814a1358b8402620fc7a01b8c590cd6b9bcf6c24e47e5f6468083f6093d05f9cc6a3f45c0e61a7989914c80ac0efe500470240a4e493ae2a67a28f2974da7a8b00ef170fc1d2357732a713d15528f7773b127095705a9d064c155484a7e3e8ccefefbcd1cacc960b3a0fe5f00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a00675a9943e5eee827641ecf76ccdca86c00760201e79454d7d70bf1d1229f4e4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479435552c16704d214347f29fa77f77da6d75d7c752a0f88cae15732bc072d88e3266e79c63ace19f6158d861b5a1527eecea8b3a0c90a0805f0392fd4fe5f40410188ae1823170f330fcbd460029d64100fb762c18db22a068061db6f72b36216ac8a6d4e7ade646d0481a5e58a1d446699f73f0000c65beb901000200000000000008100000400028002100000000101280100000602202000080440850000800001001020001000091010090200a10040008009012000080600042005010001000000010200880020010221000a0000208004a0c88000102140000080061090200800044000000000000080000000008088002090010040200040840000980000008000000000104000000100c200840100000000086001000200400000000008020084009000200204002800000000080008000920c0100000004880a0a0000004001810000000120124000009204080080001040c20000a000000030401000000201004004020001820000c00000000400480008000100a000028402620fc984042c1d80831a1f2484663394e6b90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381fbb86091ba1e6cf213db9c2384a8b80d1a61adeca1222451ad44989a3a4353c926cde613198ca3031c6b7c7988b0302c51f2bc1762f889d44c27476f73339069a6aa0b5fce63de2c6e847ee07c01620e47d27d090277ce3069e61a8e0e5dc75e7b6c02f84c8402620fc7a01b8c590cd6b9bcf6c24e47e5f6468083f6093d05f9cc6a3f45c0e61a7989914c8402620fc8a00675a9943e5eee827641ecf76ccdca86c00760201e79454d7d70bf1d1229f4e480899ca0f597006047cc915ce49e35b70eefe652a4f46d2cf8f9954323b29dc13a07ebbdc07dfa4f17138db9af8611fe9a98d289df90b46aacc8d86e6f39c7528e00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a06f8122b4b7c614859a61d8e12f236efc07d92370c52e9f3f8de48bc4c4c3f76aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479440d3256eb0babe89f0ea54edaa398513136612f5a01d6899d6d2e0f411288f145754d9672ce2881c44d3e9a25a6a33d5f625ec608ca09ef5f809e4322bb7ac0df0c4b4ce82d4fea1e31832734ed2286e1bbf3bcf5967a04f4875ba4450b51981ced70f5cb8ecfcb4f402a2ecca8f038ce9340431ba6677b90100100800080000000008000160000000240000010190000800000040000000008000081421000000100002001101009800001410120000000000001a0000a11200002030300820000200001008002000002010000000000000c000508001101600000800200a02009000010000000148c2080000000004089000080890420000000042000800000000100000011010001001000c200c000200442000801810102f060000000006a02808440000028000040001008800000018000082000000000204414802000089000021400010428000008000840280010100104142000020000010108a08040800118400060000010020208002201000024000100000180000028402620fca840427f164831ba49084663394e9b90116d883010405846765746888676f312e32312e35856c696e7578000000821df8b9f8b381fbb860ae5cfdf126fe914ba373cc010e894bdc02c34c113feaa7bf6e027879725858c3aa8740b6abb90f1dc389003dae1eb30d11aaead3c1df95d86bfe201cf0c5a285dd915f13a712abd523322712c42b8195c6cab1b5b0314375c059f48b8b79c8e4f84c8402620fc8a00675a9943e5eee827641ecf76ccdca86c00760201e79454d7d70bf1d1229f4e48402620fc9a06f8122b4b7c614859a61d8e12f236efc07d92370c52e9f3f8de48bc4c4c3f76a80bf2db108411fe95e684c82f738764633a2d29253d20c1832b7189b7a52f4c7ab75224c2bc89d3d1765b1aea4a347f2526cf24c4518ce3eae863383938cd651a001a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0b8f6e83d72a579037a1747385d006303baecd2f9122ea38d7d7caeae4322fafaa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479476d76ee8823de52a1a431884c2ca930c5e72bff3a090533b33c3cc5cfecbd33918e04cc12957a3cf6a5844e65a0ca4f2ade2994b3ca0e6977483ef89448a9e5565ceff05271fd57f2ba905f9caad339902e605fc8db8a0465d7a4ebdc6f41f40124db3193e5a0565e6a877854715c5811eb143d1d5f392b9010002801044080080006022024040a0002000a840003012002810184001000409924008152008200011040240012c00100120102002000000200100020000a4702006466030020000000001000c00008000a0180000000000804241102800111710100c46a00a02009500060004288008400c000400081808900001045400020c400240001c0000000000000ab000081008001c0ea028028002042040800810202006480080400006380840100002001402010000c00000000002a08311208022021400981220004881000300c002035001000080808ccc0324001040420000600012383086100002080941c204000411810400800000c020004c08080080480209028402620fcb84042c1954832408c484663394ecb90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381fbb860ac51bacb0156bbd71fe9d754817bcd1ef367cd0a6ca2d719fd1f9294164e9ea536937167df9370e7e4271846d099f1c01785e38478fca04f68559d2740447cdfc8f8e1d9bfea1ad6d331b13c63d133504203d7b6197e59837128b91b568c302cf84c8402620fc9a06f8122b4b7c614859a61d8e12f236efc07d92370c52e9f3f8de48bc4c4c3f76a8402620fcaa0b8f6e83d72a579037a1747385d006303baecd2f9122ea38d7d7caeae4322fafa80995177c05ae18a7afb72a5a5b870aa4cec13dd3bec378bd0bdd45c8b32ff9d94379d0649899e58045bd798c90c83f068c6180ac3be527f5264fd1fa40d5f3f7f00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0c1828f9fa73b74d490c01682f5e7851683736d6d38437034b118ecd99aac908ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347947f5f2cf1aec83bf0c74df566a41aa7ed65ea84eaa0909eadb50d8d80fed8719a8008f9a96a65105c9f9adf5f09583df44903455d08a07fa76502e2d2fad4544c010c2cb4719b07845b4ade4c57c05c194dbe35f27990a06c6141cf0821319308c5b281ebb93512f27f384d9d039387d765fa27ce7f5ab1b90100020000000004081820000040000000c400000202800200000008400241000080c0001c0000220050000000000200100000000082080000080000100000b064000000201000000011000010080200000020100000240a0400c000000080041700000804200002208000401000085000000a00000000080890000010140000080000400a0800080000000000040082000100000e2018000000000004c208100260060000040000003108081000020000400000004000000000200000200000030004000802001000004000000040101008020000000c06200000584002000020000018000010000000011100040000110280009000008080084400000004090000028402620fcc84042c1d80831f9f5d84663394efb90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381fbb860965d6d03c0493b4b7a3cf91fdbe7d114ebd38ce476e1bf47f1d1a55a8286408e61d2fedaac5e6c9b577f808ddeca453619c2fa244c4c8d0c521caf5148b532bcc376df1e5195419b11a350b03b596bbda029f1b074c42a3e9ce26d676c708c3ef84c8402620fcaa0b8f6e83d72a579037a1747385d006303baecd2f9122ea38d7d7caeae4322fafa8402620fcba0c1828f9fa73b74d490c01682f5e7851683736d6d38437034b118ecd99aac908b80e1175bb3858b24abde91024c935edf639b17cd3d48a67110b486064b018cc30273e32fc65969bdfaa4f6c72e0ead81230fa220f767d21f0a434ba82d9d5f6fcd01a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a09c7cfa55ae4789be64a696d357083683dcbc0429843811c125087ffd383311b2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794f474cf03cceff28abc65c9cbae594f725c80e12da00e783cf76ba10af8b476c2af6f0099182dc3d8891e6bfe8ccfbd4df4df9e5725a05943a3797fc784ab2a933a7e8cf5502c66932b4d565bf39673d8c84a97e7c163a0887d4fd11bac9b67f2a36358099ecfb8a3777074a31a1b01b0a2ddaa1621e312b9010000010000000080040002824000000024000000001800000000000000002800a0002810400000001004020001084090010094204a010004000000020000a0600002000030000020080800000c8800080020100001000000044200000804405400000802200a02808000040000000008400800000000802000100008100000040001000008000000000000000000a0100000000420080000000008100010100021060000000004842008400800020080040000400840088000000002000000000004102802000088000001200000000020000280040008002000104062004020008010108000000000010040040001010000008000000000004800080008000000018402620fcd84042c1d808310765984663394f2b90116d883010405846765746888676f312e32312e36856c696e7578000000821df8b9f8b381fbb8608ce86edf055073ed3657cb976abaaad5fd17879de455c0261f75a68f1fece6134ccbbad1adb809ce0c8e7b50249422c212357367f0e2feca28deb104d6bbfa1a2dd080a66914b21756e2198cf1c52f50ad6edcc07ec72818f917e9d7111a6574f84c8402620fcba0c1828f9fa73b74d490c01682f5e7851683736d6d38437034b118ecd99aac908b8402620fcca09c7cfa55ae4789be64a696d357083683dcbc0429843811c125087ffd383311b280f18262798880d70059d643979022a2b63e4198d03f7b42b1b2ae3750a00ad54632f0755542d43c630c263fefea44700a9c2f5780aacb850a98fb22816843643701a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0fe3e114a9b8862d981e404b7f83f43330e8a6a1d6f853b450ba8f358d8e594aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794980a75ecd1309ea12fa2ed87a8744fbfc9b863d5a020d51c5c97ddeaa92872cb51e57cf30cebf201e4455a7628909a944a153fdd29a08498edb273bef28ea8bfd2cbe9a99e2c94eac71fd9752a46178549e43b3dbb76a0af8c731b24f09013ae128678c593b89c686e5936789049da0a20a421f883e50bb9010012000008000800880000006000001000000000010002808010006006000800a200005c0000220010001800000000110100100102000000000009182000a06000020030380a0000008110000800000000a01000010002020040000000a4001400000880300286009880441010082008600c000000000838910000009008000800004200081000000c000000001000001011000c200a00000a040040c108100020060000040004006808001840020040c000000100000000010000901200c000080404681200100100000000000010000020400000041c000000104002000020001018084010010009011540064008110220009000001000014000980008080000028402620fce84042c1d80831f23d184663394f5b90116d883010405846765746888676f312e32312e39856c696e7578000000821df8b9f8b381f7b8608339e352db1dfd13827e415235e7ad9653cd14056bd7b78e93e09c86c36679ae02e13a2ec4aa1d8e2546fb5655f621d6041c1b9aa04ce18b41b7273fbab06eea3aead2ab3c6bdc791bb6268c781267b4ec81143312f419a48422eab7e7d8f1ebf84c8402620fcca09c7cfa55ae4789be64a696d357083683dcbc0429843811c125087ffd383311b28402620fcda0fe3e114a9b8862d981e404b7f83f43330e8a6a1d6f853b450ba8f358d8e594ae80b25e98a9d4d947ccedfd894f38dae23c09a3f30ea5b513470d75eac608d15b233c39278b14601bcd777c2f0c61fba173b2189614ff7ab761ec48e03ae2894eed00a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42180800abe060abb06f90338a0ad80590a86e436e79aaa961dccc29d85d1304853ded12197ae2dffd42e75fa18a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941284214b9b9c85549ab3d2b972df0deef66ac2c9a007e946b785a9637930533c6df8d79bb93184e47d65d28f7854d8c8ce16c63c42a015de33fa37a8bafb7578c335909aeff2b2b679997e548ee1a8d9f47a892ab1a7a02ced64c3059d0e81f236cdddfe8d034d05a08e1fe845ba32b4234d5ba8a377d6b901000000200400082008c2000a401000002000200a00103200000000502340000080002c142000000010002300818280140080100002400408000010120000a03000040000108400000000011108020012002210000020020408c80a100000171600020800200e02008001e00001200008001a0001000008089000081014000002040040000800000000000000000102000000000460080000000000088108904866060080800004006008400200060000400080008000900000a000820800020102040008020080000001850008400200004200009004800080111040424800a0000018204a5000020041000015000001020000810000202008440000000000c000018402620fcf84042c1d80831bb60084663394f8b90116d883010406846765746888676f312e32312e39856c696e7578000000821df8b9f8b381f7b8608e8cfe0b055b18d322025f0837aba5e1928a13f666255b83cf0529ed987b9b4e449d6248796bf8a351bf21cbeb4d869b14cfe57601beae23fed96172aaf53b42c247caacd125e363c7d4a36497c20523a72100fc4bc1a8f1db3ef66f882b1b84f84c8402620fcda0fe3e114a9b8862d981e404b7f83f43330e8a6a1d6f853b450ba8f358d8e594ae8402620fcea0ad80590a86e436e79aaa961dccc29d85d1304853ded12197ae2dffd42e75fa18805a390422f87c05ce81fad47bcbabb415c9bec71cdf4d6b8878409322a810d8567ef061cec5384ec4e0a754413ce28e6fdd24f54e84706337e863fef60b2489c100a0000000000000000000000000000000000000000000000000000000000000000088000000000000000080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080120510b89c88131abe1af90d3bf90211a05d54f311542dc86508c3950fe9fd0e42666c4b0d2da357bf0ff5256206c4f499a0de4549196246f89565153fe5c293bd86825c81bebcaf5d863bc20db5b80f39c1a04260cf26a849cc8ae7d9e9490a0f3cae30ddb388a52bbb4381b648c6927f5d02a01043cbea73d2e4dad6a3021744ae80ecceee3fda23997f7e5a56d30721d6a89da0016bc5f3d3af4289603df49b9156999c4b3fab779399bba9dbb8d98a7d5fff36a09f7ae1ed754c036e23f8cee8168086eb854e9a74e50f80fe6eeedc06652d65a4a0aa0c44232305f2d9c73f4198c114a79f935d4f15479dcd8d61ab3fe5821608c3a0b2afddeb92bff5ff52f0d7d432e3b5e2c777988181eef046d4026e23a28a15fba02a6282e9d54cbe11efd2a4a36c899aeaa7cf7604c6c1d496d4ec36b26870d945a0d7c965d118cacf4d7282ee52216d42b231163efbb82fafc36bf6dccc2ace3b53a0e05dadba137f39580b713d54564bb2ccb48a4a4e882ac673aa972f6b4a7e2c84a0e35f8dffad08d4c9df98129ee14a657c0076c7e5ed00fea40d7bf4f9ae07c2c4a04a9dc6bc9c6a276620ccc29879f3e4195951f720322b72f3925c5862c5972487a06a7b7c9de98a1f4d36cf112f45b71e797694ed5b0c8ffcdcea26ed337bcea62ca0904b2f7a0c508f1876c1ffbba7832ef5babe8218fb7ac12d0f9bf4245b356a39a0bc5622b08b6882c64c3fd5ca4feb7cbe7845c911b3518874784719dac87bf31380f90211a0ed46c5f969903bd014b453e23bf036a0807d974ac245d974bea3edbfab8998f7a0fbe185c3ad730c361d61adafbf283c230a9e04a6971a5693a58b95d54a91dc18a01c49f9acbb2ef6407d5d88ad62c7e41c0ae4e1a86453d107f8b88e366e6f1f27a07f263e0e9ae17cbc40f87c3ce1249a552a18c5dc0b7fe42e43454663ac9d4a10a0ef16b26fa26244501acfcc480235d9fd3859b0511b1d840cb3960143eac49e4ea05e19c98be009508b8132d6bc03ce932ae80c584fed6c8b66690f51b6706c6110a02699c04fa558d4cf31a72eccdbd6c9b85921b18e92be8013b16bbbb0e0243d95a0bf06ce588155b0a5b8dd34eeb8b34d1ab6698da02bbd47b8df956f3f8f958f51a0105ad803a3be71de2802142849753f93fe3445762ccdccda5baafb2c350fe8ffa06e725a7130ddbff26e37c27c25830b6c3fac3575371cd00d26e799c30cfc61e5a045a5861fe345d073abd640549c0bc754f98a15f1349dc94ccaf8e366d747e800a01fa1a61b7b9716a711f42192e558ba2fcf059d8b87ad67cb4c73aa65bc918226a0e3b653f8469bce44931ae9a2f88c3ae385b70bae52b43902b618a0e29694dd8ca09f207e2e88901b54fb464545a33764841152a2669f6668610bc3fa10d5cfc2bba00393790748f68bcffb6f9e01a409b9d1e691406b635a1cca73ae061813ac4d5ba0c3f4178174074d467324173d8436674ce6c69fa7c49a4337a000635fb04dbf2380f90211a079c04022f20db8c5fcf561e1956bfe73e94c6e4cb2655ff506c2e298f1ab8f4da0c0c9908e024252617bb968a090881f478cf2cedee6762524d4b2d3521fce7b30a09a502add7d10c7817db9157721c4b03ff3327415d6d3b0307b11efa07a2ca300a0911e146a2367ecc6ea7dd6c2547ac9df60ead03cd1d14ddb3350b3968c7fca53a05cd154e740f91a9fc1b2b780c47cc5f525efab2e7c7c36248a2833a99206f291a03761f080edb655d24c234da08813efc750a093ea75e9603d558dd2889e254363a0035ad7eda8fb804cc3b2779b0f3c40e67f5c7fef6b354878cc659bb76c02871ea089848d6e6e0132be50e1428656da8fadda12cb411681a9cab7d5d9371650f2e3a054ab857606b93e77c264d3ae1c75bb7d8e532a75823fa0646934c6b07587d97da04303a53d5b1cf36d7ca5b3a35ff11b210b7fab8f2bea560fee8e1dc49863af08a083b73ad7bf82dc689745a5bd39837939169c725f44b3bbe5c2b9470c557cb6c1a01eb14803b41ee30b3d9256decc6b02f7b4eac0cba1cf60c7e806aa145dc95c3fa00f46a8879a158446fd5281f67942859516c094afff5c862d7925e28e0255dc1aa0a88775f84e8812564ca66ffdfc617993b642e48863299520f34c9e4f2b394b24a065a8676f56698d3c88c8360411a1b5d89cbdf44cef98a51fe1b761ed82177bdda0e9216b548ea5ad232ccea4285597ba3345a53d39fcd61de9546c24725edac4c980f90211a0fd00080f96539f8eb5a2b403c9594f7bbf1a9a773c9a4430d86ee7f4fc67f041a083d0f27ec441ee36c6b0479c30d213d373edacc372fc3818fc98eac3c53da4d9a09eefca974fe868babfc32bf6e1449d97d14a891e3b10bbe54f64e00a0b5dcca1a0ad7b3367ca39009b957a1825269c78ca3af9a2a87c43894fb8bb9ec165d7a4bea07b68db0a8ff70d3557ae4c04b964de0fb67e3c340f3649c0af4bf79b86e73be1a02af8fdf09ff77e7f4d0e325050a8f293c08d2cb328f8d3da7e083a7d48924224a032a90f4a4456c9a1cefc92ea7026d74d9c1c5117e8b7d405e9d9440a8edfefbba03c40b1884e0810d2d3579d8be5483a651ae4ea3041f484ddef2f0ad5a70efc06a06c34468de46e1c6fd59005d0201b3de36cab1a04daf1b42073e91fe35cac978ea05901b53bc10fe26bfa1936e1ba5a334d168558454429aecd803d3e63304984dda08e3a481bb8b089125b4e820bc9e59c606c47631394830b9b37c06c77110bc512a06411f9d1b96b36d413236b20ecaa77fef4bf17c023b6a0feb143a7dfd529053da0c388a4b630d106f22778df9782863b29cc712d25423c704117a9cd46190d55a6a0c3260e27d68de22e8dd36e2a15055e3f9cc0a1503510f8352be2458ce2849cf8a000d1dc7f94ab884d393c18ad9816d364c001e8ed29b5339d7d673d05d8cf8c18a0cc90581b3014a0af5d5a263a6581f442d75cccfce15f6da447c30aa3eee35adc80f90211a0f4f253a2981255c3c0c2b023a074cf35ee982c4709fe56d3cfbcc0d2d3e9e060a0c97e5c55396e530fb20bab042aabdf2883db66f41abb6c71f8eefdae67334800a006d2ac360ebe8eb14a59e2cccd35c3a23d9c559f183102ebdb3db068fdf6a634a03a78bec1492adf068ece5e9820d72df85d2e0b2b992f0cacb7198fc956473d94a0eecba4d8055f6358c4ed0989fbf575de5f137c4ffc73a53ade1d708c45641131a0eee901dcdf7b3b76f230c684200e990fc2284b3a3cac8156795643a8bf45f543a0c679d68e57dd545e7489f10898128a6a90ad7df29d3380ea3fa2c8d036a714c3a063062d6a6c1cfe1efff0e6965a65446b61982e763eb36652e1423df1fad08643a0d6c8ae23af8ad991e84c43f69bf280c54fc3a731b210bd60f5b8f39043480017a04614a62c039ff880d7c65c891e6fc6c55bf81bddadb42b5171a8d07f7218d7c2a0bfec07e9660db8afc02cd6cc2524246febc098f596a717190d1ef155317ce046a02aec38d6659b1b72f03b7b80e078dbc40650cea494f56606154538491df2598ea0c75fdcc0ec88840ac16c38f4a5902dc1e87d704cfdcec825b0aeee25fac08c32a0e09b0acd86da73ca9edd0ed45f52e970c710860aced6d2e1bb3617d45d1f1cc2a0bd67f755acb481bd586d2adae80b8155e8c887452ff964c8dd0ac888032b7d1ca04f03b5b8ef01c49629b79e51438d92a2dd9a490508152a96787ea1c39e1358e180f901b1a0b253f4d804466eedf2500f7c56b7b5c81937fd8547fbe942756bf1c2974245b9a0dfb6b4a54ee26fb0acc8a98e28efc6a9bef48610921ed4c5ddad4a6770ec413780a0e5b8323277c3cd8b0da5297fc709533d25bc28964698a6f2cbc4ba80c4c474c880a0ad4e25adf77388513a19b6e66f340845f4da575e05cbb41ec3ccacc962beb934a0ec3b2876d5a7b8fb4c959b2e2efd9a3fee75ee4e65da5438010367610ca50ccca0316db872ded9164c79a846190e57eb2c3a4379087798b8e1220b3cc5ff5aea06a05ad6bcb5a22ccc01a7b218c06c217b5c6f6a54cd77dbf3385422f37c3a5bbdc4a039d08aa5ea4684c934cd1911177ebea1f2f3438d891da946a0396ac10b663b1ea0c73d499a0e4709723af701832cc2e07949df500d5a817709746c124757f2a46d80a07967cd6ca41b76eceb64c5373d85399a380af1d1eae78f56a33a149677398df3a0753f05888f5454aba005e67e1061a0bbb982c308cf90a89746abebc76f640d44a01eba4f5159fcb36c5bde7933e2632b0923167fad080618e90b90e98f450e0673a0dc9282be875f1e21a4245c23816f7c36bfaee11d34c472c29ae4576985f2e9e880f8b180a0f53d8c2cc17264e3f43339e6390b3de4123e0d3014e2437d51e9527d32531dbba00cbb4e2b6e1f2b59fb98c96cd2ee4a0a9994e91d18564b8289c5dbf42d653e6a80a0585dc8b79c33d7f248c845ac6c35ea102dc2fd2870e4e96ae7891ea6093b3e6880808080808080a05b8b9aed0df2c69df192889f2a5c791f16590efae13338ab7279ea1bab2fd0b38080a07308e7b9a6597a64d45bafaf4b3a2a4525895d77c7d8c146ef7720f5c693f7b180f86e9d30e1120c458c4c09a9448628f84e81161b308d5c4041a3d3a1ea329d0eb84ef84c588823d85d5096750e00a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470224408265da01e1a65d62b903c7b34c08cb389bf3d9996f763f030b1adcfb369c5a5df4a18e1529baffe7feaec66db3dbd1bc06810f7f6f88b7be6645418a7e2a2a3f40514c222441284214b9b9c85549ab3d2b972df0deef66ac2c98e82934ca974fdcd97f3309de967d3c9c43fa711a8d673af5d75465844bf8969c8d1948d903748ac7b8b1720fa64e50c224440d3256eb0babe89f0ea54edaa398513136612f5a334b49d766ebe3eb9f6bdc163bd2c19aa7e8cee1667851ae0c1651f01c4cf7cf2cfcf8475bff3e99cab25b05631472d224476d76ee8823de52a1a431884c2ca930c5e72bff3803af79641cf964cc001671017f0b680f93b7dde085b24bbc67b2a562a216f903ac878c5477641328172a353f1e493cf22447f5f2cf1aec83bf0c74df566a41aa7ed65ea84ea99e3849ef31887c0f880a0feb92f356f58fbd023a82f5311fc87a5883a662e9ebbbefc90bf13aa533c2438a4113804bf2244980a75ecd1309ea12fa2ed87a8744fbfc9b863d589037a9ace3b590165ea1c0c5ac72bf600b7c88c1e435f41932c1132aae1bfa0bb68e46b96ccb12c3415e4d82af717d82244b71b214cb885500844365e95cd9942c7276e7fd8a2750ec6dded3dcdc2f351782310b0eadc077db59abca0f0cd26776e2e7acb9f3bce40b1fa5221fd1561226c6263cc5f2244f474cf03cceff28abc65c9cbae594f725c80e12d96c9b86c3400e529bfe184056e257c07940bb664636f689e8d2027c834681f8f878b73445261034e946bb2d901b4b8782a441284214b9b9c85549ab3d2b972df0deef66ac2c98e82934ca974fdcd97f3309de967d3c9c43fa711a8d673af5d75465844bf8969c8d1948d903748ac7b8b1720fa64e50c2a4435552c16704d214347f29fa77f77da6d75d7c752b742ad4855bae330426b823e742da31f816cc83bc16d69a9134be0cfb4a1d17ec34f1b5b32d5c20440b8536b1e88f0f22a4440d3256eb0babe89f0ea54edaa398513136612f5a334b49d766ebe3eb9f6bdc163bd2c19aa7e8cee1667851ae0c1651f01c4cf7cf2cfcf8475bff3e99cab25b05631472d2a4476d76ee8823de52a1a431884c2ca930c5e72bff3803af79641cf964cc001671017f0b680f93b7dde085b24bbc67b2a562a216f903ac878c5477641328172a353f1e493cf2a447f5f2cf1aec83bf0c74df566a41aa7ed65ea84ea99e3849ef31887c0f880a0feb92f356f58fbd023a82f5311fc87a5883a662e9ebbbefc90bf13aa533c2438a4113804bf2a44980a75ecd1309ea12fa2ed87a8744fbfc9b863d589037a9ace3b590165ea1c0c5ac72bf600b7c88c1e435f41932c1132aae1bfa0bb68e46b96ccb12c3415e4d82af717d82a44b71b214cb885500844365e95cd9942c7276e7fd8a2750ec6dded3dcdc2f351782310b0eadc077db59abca0f0cd26776e2e7acb9f3bce40b1fa5221fd1561226c6263cc5f2a44f474cf03cceff28abc65c9cbae594f725c80e12d96c9b86c3400e529bfe184056e257c07940bb664636f689e8d2027c834681f8f878b73445261034e946bb2d901b4b878").to_vec(); + let height = 39981000; + let trusted_height = 39980600; + let trusted_current_validator_hash = + hex!("674c4f3d0b24204759cd9b4d9a641bdeed6adff81bafe9965451045916b6b4de"); + let trusted_previous_validator_hash = + hex!("efa11eef8adc20d6f179dff684c16891761d632462147830cb45579589632786"); + let _new_current_validator_hash = + hex!("8a4bca6491ec89e201ea0e2776f0ae42f7e5c8d67a305a7aa6284a0e0150f736"); + let _new_previous_validator_hash = trusted_previous_validator_hash; + + let any: Any = header.try_into().unwrap(); + let _header = Header::try_from(any.clone()).unwrap(); + + let client = ParliaLightClient::default(); + let client_id = ClientId::new(&client.client_type(), 1).unwrap(); + let mut mock_consensus_state = BTreeMap::new(); + let trusted_cs = ConsensusState { + current_validators_hash: trusted_current_validator_hash, + previous_validators_hash: trusted_previous_validator_hash, + ..Default::default() + }; + mock_consensus_state.insert(Height::new(0, trusted_height), trusted_cs); + let cs = ClientState { + chain_id: ChainId::new(56), + ibc_store_address: hex!("151f3951FA218cac426edFe078fA9e5C6dceA500"), + latest_height: Height::new(0, height), + ..Default::default() + }; + let ctx = MockClientReader { + client_state: Some(cs), + consensus_state: mock_consensus_state, + }; + let err = client.update_client(&ctx, client_id, any).unwrap_err(); + assert!( + format!("{:?}", err).contains("UnexpectedTrustedHeight: 39980600 39981000"), + "{}", + err + ); + } + #[test] fn test_success_verify_membership() { let proof_height = new_height(0, 232); @@ -966,10 +985,7 @@ mod test { let misbehavior = Misbehaviour::try_from(any.clone()).unwrap(); let mut mock_consensus_state = BTreeMap::new(); let trusted_cs = ConsensusState { - current_validators_hash: misbehavior - .header_1 - .current_epoch_validators_hash() - .unwrap(), + current_validators_hash: misbehavior.header_1.current_epoch_validators_hash(), previous_validators_hash: misbehavior.header_1.previous_epoch_validators_hash(), ..Default::default() }; diff --git a/light-client/src/client_state.rs b/light-client/src/client_state.rs index 096f010..f3442ad 100644 --- a/light-client/src/client_state.rs +++ b/light-client/src/client_state.rs @@ -77,7 +77,7 @@ impl ClientState { .try_into() .map_err(Error::UnexpectedStorageRoot)?, timestamp: header.timestamp()?, - current_validators_hash: header.current_epoch_validators_hash()?, + current_validators_hash: header.current_epoch_validators_hash(), previous_validators_hash: header.previous_epoch_validators_hash(), }; diff --git a/light-client/src/header/eth_headers.rs b/light-client/src/header/eth_headers.rs index 8dab3de..5fd1e9d 100644 --- a/light-client/src/header/eth_headers.rs +++ b/light-client/src/header/eth_headers.rs @@ -20,46 +20,6 @@ pub struct ETHHeaders { } impl ETHHeaders { - pub fn verify_non_neighboring_epoch( - &self, - chain_id: &ChainId, - checkpoint: u64, - trusted_validators: TrustedValidatorSet, - next_validators: UntrustedValidatorSet, - ) -> Result<(), Error> { - let n_val = next_validators.try_borrow(&trusted_validators)?; - - // Ensure all the headers are successfully chained. - self.verify_cascading_fields()?; - - // Ensure valid seals - let hs: Vec = self - .all - .iter() - .filter(|h| h.number >= checkpoint) - .cloned() - .collect(); - for h in hs.iter() { - h.verify_seal(n_val, chain_id)?; - } - - let hs = ETHHeaders { - target: self.target.clone(), - all: hs, - }; - - // Ensure target is finalized - let (child, grand_child) = hs.verify_finalized()?; - - // Ensure BLS signature is collect - // At the just checkpoint BLS signature uses previous validator set. - for h in &[child, grand_child] { - let vote = h.get_vote_attestation()?; - vote.verify(h.number, n_val)?; - } - Ok(()) - } - pub fn verify( &self, chain_id: &ChainId, @@ -606,142 +566,6 @@ mod test { f(headers, &c_val, &p_val, n_val_header, false); } - #[test] - fn test_success_verify_non_neighboring_epoch() { - let headers: ETHHeaders = vec![ - header_31297200(), - header_31297201(), - header_31297202(), - header_31297203(), - header_31297204(), - header_31297205(), - header_31297206(), - header_31297207(), - header_31297208(), - header_31297209(), - header_31297210(), - header_31297211(), - header_31297212(), - header_31297213(), - ] - .into(); - - let checkpoint = - headers.target.number + ValidatorSet::from(validators_in_31297000()).checkpoint(); - let n_val_raw = header_31297200().get_validator_bytes().unwrap().into(); - let n_val = UntrustedValidatorSet::new(&n_val_raw); - let t_val_raw = validators_in_31297000().into(); - let t_val = TrustedValidatorSet::new(&t_val_raw); - headers - .verify_non_neighboring_epoch(&mainnet(), checkpoint, t_val, n_val) - .unwrap(); - } - - #[test] - fn test_error_verify_non_neighboring_epoch() { - let headers: ETHHeaders = vec![header_31297200()].into(); - - // Insufficient trustedValidators - let checkpoint = - headers.target.number + ValidatorSet::from(validators_in_31297000()).checkpoint(); - let n_val_raw = header_31297200().get_validator_bytes().unwrap().into(); - let n_val = UntrustedValidatorSet::new(&n_val_raw); - let t_val_raw = vec![vec![0], vec![1], vec![2]].into(); - let t_val = TrustedValidatorSet::new(&t_val_raw); - let err = headers - .verify_non_neighboring_epoch(&mainnet(), checkpoint, t_val, n_val) - .unwrap_err(); - match err { - Error::InsufficientTrustedValidatorsInUntrustedValidators(_, found, required) => { - assert_eq!(found, 0); - assert_eq!(required, 1); - } - err => unreachable!("unexpected error type {:?}", err), - } - - // illegal sequence - let headers: ETHHeaders = vec![header_31297200(), header_31297202()].into(); - let n_val_raw = header_31297200().get_validator_bytes().unwrap().into(); - let n_val = UntrustedValidatorSet::new(&n_val_raw); - let t_val_raw = validators_in_31297000().into(); - let t_val = TrustedValidatorSet::new(&t_val_raw); - let err = headers - .verify_non_neighboring_epoch(&mainnet(), checkpoint, t_val, n_val) - .unwrap_err(); - match err { - Error::UnexpectedHeaderRelation(h1, h2, _, _, _, _) => { - assert_eq!(h1, 31297200); - assert_eq!(h2, 31297202); - } - err => unreachable!("unexpected error type {:?}", err), - } - - // illegal sealer after checkpoint - let mut headers: ETHHeaders = vec![ - header_31297200(), - header_31297201(), - header_31297202(), - header_31297203(), - header_31297204(), - header_31297205(), - header_31297206(), - header_31297207(), - header_31297208(), - header_31297209(), - header_31297210(), - header_31297211(), - header_31297212(), - header_31297213(), - ] - .into(); - headers.all.last_mut().unwrap().coinbase = vec![]; - let n_val_raw = header_31297200().get_validator_bytes().unwrap().into(); - let n_val = UntrustedValidatorSet::new(&n_val_raw); - let t_val_raw = validators_in_31297000().into(); - let t_val = TrustedValidatorSet::new(&t_val_raw); - let err = headers - .verify_non_neighboring_epoch(&mainnet(), checkpoint, t_val, n_val) - .unwrap_err(); - match err { - Error::UnexpectedCoinbase(h1) => { - assert_eq!(h1, 31297213); - } - err => unreachable!("unexpected error type {:?}", err), - } - - // invalid header size - let headers: ETHHeaders = vec![ - header_31297200(), - header_31297201(), - header_31297202(), - header_31297203(), - header_31297204(), - header_31297205(), - header_31297206(), - header_31297207(), - header_31297208(), - header_31297209(), - header_31297210(), - header_31297211(), - header_31297212(), - ] - .into(); - let n_val_raw = header_31297200().get_validator_bytes().unwrap().into(); - let n_val = UntrustedValidatorSet::new(&n_val_raw); - let t_val_raw = validators_in_31297000().into(); - let t_val = TrustedValidatorSet::new(&t_val_raw); - let err = headers - .verify_non_neighboring_epoch(&mainnet(), checkpoint, t_val, n_val) - .unwrap_err(); - match err { - Error::InvalidVerifyingHeaderLength(h1, size) => { - assert_eq!(h1, 31297200); - assert_eq!(size, 2); - } - err => unreachable!("unexpected error type {:?}", err), - } - } - fn create_before_checkpoint_headers() -> ETHHeaders { vec![header_31297208(), header_31297209(), header_31297210()].into() } diff --git a/light-client/src/header/mod.rs b/light-client/src/header/mod.rs index 65d9fc0..61b4274 100644 --- a/light-client/src/header/mod.rs +++ b/light-client/src/header/mod.rs @@ -37,7 +37,6 @@ pub struct Header { previous_validators: ValidatorSet, /// validator set /// - not a epoch block: current epoch validators (which must be in trusted cons state) - /// - non neighboring epoch header: validators in trusted cons state /// - neighboring epoch header: validators in extra data current_validators: ValidatorSet, } @@ -70,13 +69,8 @@ impl Header { self.previous_validators.hash } - /// In non-adjacent epochs, current_validators contains the validator set of trusted_height, - /// so you need to use the validator set of extra_data of target. - pub fn current_epoch_validators_hash(&self) -> Result { - if self.headers.target.is_epoch() { - return Ok(self.headers.target.get_validator_set()?.hash); - } - Ok(self.current_validators.hash) + pub fn current_epoch_validators_hash(&self) -> Hash { + self.current_validators.hash } pub fn block_hash(&self) -> &Hash { @@ -88,70 +82,16 @@ impl Header { chain_id: &ChainId, consensus_state: &ConsensusState, ) -> Result<(), Error> { - if self.is_non_neighboring_epoch() { - let n_val = self.headers.target.get_validator_set()?; - // 'current_validators' are trusted validators in non-neighboring epoch verification. - let t_val = &self.current_validators; - let (t_val, n_val) = verify_validator_set_non_neighboring_epoch( - consensus_state, - self.height(), - self.trusted_height(), - t_val, - &n_val, - )?; - - // target height is epoch - let checkpoint = - self.height().revision_height() + self.previous_validators.checkpoint(); - self.headers - .verify_non_neighboring_epoch(chain_id, checkpoint, t_val, n_val) - } else { - let (c_val, p_val) = verify_validator_set( - consensus_state, - &self.headers.target, - self.height(), - self.trusted_height, - &self.previous_validators, - &self.current_validators, - )?; - self.headers.verify(chain_id, &c_val, &p_val) - } - } - - fn is_non_neighboring_epoch(&self) -> bool { - if !self.headers.target.is_epoch() { - return false; - } - let trusted_epoch = self.trusted_height.revision_height() / BLOCKS_PER_EPOCH; - let target_epoch = self.height().revision_height() / BLOCKS_PER_EPOCH; - trusted_epoch + 1 < target_epoch - } -} - -fn verify_validator_set_non_neighboring_epoch<'a>( - consensus_state: &ConsensusState, - height: Height, - trusted_height: Height, - current_validators: &'a ValidatorSet, - next_validators: &'a ValidatorSet, -) -> Result<(TrustedValidatorSet<'a>, UntrustedValidatorSet<'a>), Error> { - if current_validators.validators.is_empty() { - return Err(Error::MissingTrustedCurrentValidators( - height.revision_height(), - )); - } - if consensus_state.current_validators_hash != current_validators.hash { - return Err(Error::UnexpectedCurrentValidatorsHash( - trusted_height, - height, - current_validators.hash, - consensus_state.previous_validators_hash, - )); + let (c_val, p_val) = verify_validator_set( + consensus_state, + &self.headers.target, + self.height(), + self.trusted_height, + &self.previous_validators, + &self.current_validators, + )?; + self.headers.verify(chain_id, &c_val, &p_val) } - Ok(( - TrustedValidatorSet::new(current_validators), - UntrustedValidatorSet::new(next_validators), - )) } fn verify_validator_set<'a>( @@ -256,7 +196,16 @@ impl TryFrom for Header { return Err(Error::MissingPreviousValidators(headers.target.number)); } - if value.current_validators.is_empty() { + // Epoch header contains validator set + let current_validators = if headers.target.is_epoch() { + headers + .target + .get_validator_bytes() + .ok_or_else(|| Error::MissingValidatorInEpochBlock(headers.target.number))? + } else { + value.current_validators + }; + if current_validators.is_empty() { return Err(Error::MissingCurrentValidators(headers.target.number)); } @@ -265,7 +214,7 @@ impl TryFrom for Header { headers, trusted_height, previous_validators: value.previous_validators.into(), - current_validators: value.current_validators.into(), + current_validators: current_validators.into(), }) } } @@ -297,12 +246,11 @@ pub(crate) mod testdata; pub(crate) mod test { use crate::consensus_state::ConsensusState; use crate::errors::Error; - use crate::header::constant::BLOCKS_PER_EPOCH; use crate::header::eth_headers::ETHHeaders; use crate::header::testdata::{header_31297200, header_31297201, validators_in_31297000}; use crate::header::validator_set::{EitherValidatorSet, ValidatorSet}; - use crate::header::{verify_validator_set, verify_validator_set_non_neighboring_epoch, Header}; + use crate::header::{verify_validator_set, Header}; use crate::misc::{new_height, Hash, Validators}; use light_client::types::Time; use parlia_ibc_proto::ibc::core::client::v1::Height; @@ -680,112 +628,4 @@ pub(crate) mod test { _ => unreachable!("err {:?}", err), } } - - #[test] - fn test_success_verify_validator_set_non_neighboring_epoch() { - let cs = ConsensusState { - state_root: [0u8; 32], - timestamp: Time::now(), - current_validators_hash: [1u8; 32], - previous_validators_hash: [2u8; 32], - }; - - let height = new_height(0, 600); - let trusted_height = new_height(0, 201); - - let trusted_validators = &to_validator_set(cs.current_validators_hash); - let next_validators = &to_validator_set([4u8; 32]); - let (_c_val, _n_val) = verify_validator_set_non_neighboring_epoch( - &cs, - height, - trusted_height, - trusted_validators, - next_validators, - ) - .unwrap(); - } - - #[test] - fn test_error_verify_validator_set_non_neighboring_epoch() { - let cs = ConsensusState { - state_root: [0u8; 32], - timestamp: Time::now(), - current_validators_hash: [1u8; 32], - previous_validators_hash: [2u8; 32], - }; - - let height = new_height(0, 600); - let trusted_height = new_height(0, 201); - - // empty trusted validator - let mut trusted_validators = to_validator_set(cs.current_validators_hash); - trusted_validators.validators = Validators::new(); - let next_validators = &to_validator_set([4u8; 32]); - let err = verify_validator_set_non_neighboring_epoch( - &cs, - height, - trusted_height, - &trusted_validators, - next_validators, - ) - .unwrap_err(); - match err { - Error::MissingTrustedCurrentValidators(t) => { - assert_eq!(t, height.revision_height()); - } - _ => unreachable!("err {:?}", err), - } - - // untrusted validator - let trusted_validators = &to_validator_set([5u8; 32]); - let err = verify_validator_set_non_neighboring_epoch( - &cs, - height, - trusted_height, - trusted_validators, - next_validators, - ) - .unwrap_err(); - match err { - Error::UnexpectedCurrentValidatorsHash(t, h, hash, cons_hash) => { - assert_eq!(t, trusted_height); - assert_eq!(h, height); - assert_eq!(hash, trusted_validators.hash); - assert_eq!(cons_hash, cons_hash); - } - _ => unreachable!("err {:?}", err), - } - } - - #[test] - fn test_is_non_neighboring_epoch() { - let mut h = Header { - account_proof: vec![], - headers: ETHHeaders { - target: header_31297201(), - all: vec![], - }, - trusted_height: new_height(0, 0), - previous_validators: vec![].into(), - current_validators: vec![].into(), - }; - - // not epoch - let base = 31297200; - h.trusted_height = new_height(0, base); - assert!(!h.is_non_neighboring_epoch()); - h.trusted_height = new_height(0, base - BLOCKS_PER_EPOCH); - assert!(!h.is_non_neighboring_epoch()); - h.trusted_height = new_height(0, base - BLOCKS_PER_EPOCH - 1); - assert!(!h.is_non_neighboring_epoch()); - - // epoch - h.headers.target.number = 31297200; - h.trusted_height = new_height(0, base); - assert!(!h.is_non_neighboring_epoch()); - h.trusted_height = new_height(0, base - BLOCKS_PER_EPOCH); - assert!(!h.is_non_neighboring_epoch()); - h.trusted_height = new_height(0, base - BLOCKS_PER_EPOCH - 1); - assert!(h.is_non_neighboring_epoch()); - } }