diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b621b98a..23676e2f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -124,7 +124,7 @@ jobs: - name: Install just uses: extractions/setup-just@v2 - name: Build optimized wasm binary - run: just build-optimized-wasm + run: just build-cw-ics08-wasm-eth # checks that the wasm binary is a proper cosmwasm smart contract # it checks for things like memories, exports, imports, available capabilities, and non-determinism - name: Check cosmwasm file diff --git a/Cargo.lock b/Cargo.lock index 78ad4b5c..4824765a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,9 +79,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "689e271a72a5c0b05bfdf41c9d0424f11e9df721385dc5bd9045a51f9ea3313b" +checksum = "e7e1758e5d759c0114140152ae72032eafcfdd7b599e995ebbc8eeafa2b4c977" dependencies = [ "alloy-consensus", "alloy-contract", @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ba14856660f31807ebb26ce8f667e814c72694e1077e97ef102e326ad580f3f" +checksum = "a205d0cbb7bfdf9f4fd4b0ec842bc4c5f926e8c14ec3072d3fd75dd363baf1e0" dependencies = [ "alloy-eips", "alloy-primitives 0.8.15", @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28666307e76441e7af37a2b90cde7391c28112121bea59f4e0d804df8b20057e" +checksum = "993c34090a3f281cb746fd1604520cf21f8407ffbeb006aaa34c0556bffa718e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -146,9 +146,9 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3510769905590b8991a8e63a5e0ab4aa72cf07a13ab5fbe23f12f4454d161da" +checksum = "aec7945dff98ba68489aa6da455bf66f6c0fee8157df06747fbae7cb03c368e2" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -162,7 +162,7 @@ dependencies = [ "alloy-transport", "futures", "futures-util", - "thiserror 2.0.6", + "thiserror 2.0.8", ] [[package]] @@ -220,9 +220,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e922d558006ba371681d484d12aa73fe673d84884f83747730af7433c0e86d" +checksum = "d1d9907c29ce622946759bf4fd3418166bfeae76c1c544b8081c7be3acd9b4be" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -238,9 +238,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dca170827a7ca156b43588faebf9e9d27c27d0fb07cab82cfd830345e2b24f5" +checksum = "68f13f7405a8eb8021258994ed1beab490c3e509ebbe2c18e1c24ae10749d56b" dependencies = [ "alloy-primitives 0.8.15", "alloy-serde", @@ -262,23 +262,23 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9335278f50b0273e0a187680ee742bb6b154a948adf036f448575bacc5ccb315" +checksum = "39a786ce6bc7539dc30cabac6b7875644247c9e7d780e71a9f254d42ebdc013c" dependencies = [ "alloy-primitives 0.8.15", "alloy-sol-types 0.8.15", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.8", "tracing", ] [[package]] name = "alloy-network" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4e6ad4230df8c4a254c20f8d6a84ab9df151bfca13f463177dbc96571cc1f8" +checksum = "99051f82f77159d5bee06108f33cffee02849e2861fc500bf74213aa2ae8a26e" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -296,14 +296,14 @@ dependencies = [ "futures-utils-wasm", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.8", ] [[package]] name = "alloy-network-primitives" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4df88a2f8020801e0fefce79471d3946d39ca3311802dbbd0ecfdeee5e972e3" +checksum = "d2aff127863f8279921397be8af0ac3f05a8757d5c4c972b491c278518fa07c7" dependencies = [ "alloy-consensus", "alloy-eips", @@ -314,9 +314,9 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db5cefbc736b2b26a960dcf82279c70a03695dd11a0032a6dc27601eeb29182" +checksum = "fb130be1b7cfca7355710808392a793768bd055e5a28e1fed9d03ec7fe8fde2c" dependencies = [ "alloy-genesis", "alloy-primitives 0.8.15", @@ -324,7 +324,7 @@ dependencies = [ "rand", "serde_json", "tempfile", - "thiserror 2.0.6", + "thiserror 2.0.8", "tracing", "url", ] @@ -384,9 +384,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5115c74c037714e1b02a86f742289113afa5d494b5ea58308ba8aa378e739101" +checksum = "0280a4f68e0cefde9449ee989a248230efbe3f95255299d2a7a92009e154629d" dependencies = [ "alloy-chains", "alloy-consensus", @@ -419,7 +419,7 @@ dependencies = [ "schnellru", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.8", "tokio", "tracing", "url", @@ -428,9 +428,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b073afa409698d1b9a30522565815f3bf7010e5b47b997cf399209e6110df097" +checksum = "9475dc1a835bd8bb77275b6bccf8e177e7e669ba81277ce6bea0016ce994fafe" dependencies = [ "alloy-json-rpc", "alloy-primitives 0.8.15", @@ -469,9 +469,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6a0bd0ce5660ac48e4f3bb0c7c5c3a94db287a0be94971599d83928476cbcd" +checksum = "b6fc8b0f68619cfab3a2e15dca7b80ab266f78430bb4353dec546528e04b7449" dependencies = [ "alloy-json-rpc", "alloy-primitives 0.8.15", @@ -495,9 +495,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374ac12e35bb90ebccd86e7c943ddba9590149a6e35cc4d9cd860d6635fd1018" +checksum = "986f23fe42ac95832901a24b93c20f7ed2b9644394c02b86222801230da60041" dependencies = [ "alloy-primitives 0.8.15", "alloy-rpc-types-engine", @@ -508,9 +508,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b85a5f5f5d99047544f4ec31330ee15121dcb8ef5af3e791a5207e6b92b05b" +checksum = "83ac5e71dd1a25029ec565ea34aaf95515f4168192c2843efe198fa490d58dd7" dependencies = [ "alloy-primitives 0.8.15", "alloy-rpc-types-eth", @@ -520,35 +520,20 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea98f81bcd759dbfa3601565f9d7a02220d8ef1d294ec955948b90aaafbfd857" +checksum = "57e3aa433d3657b42e98e257ee6fa201f5c853245648a33da8fbb7497a5008bf" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", "alloy-serde", ] -[[package]] -name = "alloy-rpc-types-beacon" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e13e94be8f6f5cb735e604f9db436430bf3773fdd41db7221edaa58c07c4c8a" -dependencies = [ - "alloy-eips", - "alloy-primitives 0.8.15", - "alloy-rpc-types-engine", - "alloy-serde", - "serde", - "serde_with", - "thiserror 2.0.6", -] - [[package]] name = "alloy-rpc-types-engine" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca5898f753ff0d15a0dc955c169523d8fee57e05bb5a38a398b3451b0b988be" +checksum = "30814f8b9ac10219fb77fe42c277a0ffa1c369fbc3961f14d159f51fb221966e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -562,9 +547,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e518b0a7771e00728f18be0708f828b18a1cfc542a7153bef630966a26388e0" +checksum = "0643cc497a71941f526454fe4fecb47e9307d3a7b6c05f70718a0341643bcc79" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -582,9 +567,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3dc8d4a08ffc90c1381d39a4afa2227668259a42c97ab6eecf51cbd82a8761" +checksum = "ea61b049d7ecc66a29f107970dae493d0908e366048f7484a1ca9b02c85f9b2b" dependencies = [ "alloy-primitives 0.8.15", "serde", @@ -593,23 +578,23 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16188684100f6e0f2a2b949968fe3007749c5be431549064a1bce4e7b3a196a9" +checksum = "93461b0e79c2ddd791fec5f369ab5c2686a33bbb03530144972edf5248f8a2c7" dependencies = [ "alloy-primitives 0.8.15", "async-trait", "auto_impl", "elliptic-curve", "k256", - "thiserror 2.0.6", + "thiserror 2.0.8", ] [[package]] name = "alloy-signer-local" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2184dab8c9493ab3e1c9f6bd3bdb563ed322b79023d81531935e84a4fdf7cf1" +checksum = "6f08ec1bfa433f9e9f7c5af05af07e5cf86d27d93170de76b760e63b925f1c9c" dependencies = [ "alloy-consensus", "alloy-network", @@ -618,7 +603,7 @@ dependencies = [ "async-trait", "k256", "rand", - "thiserror 2.0.6", + "thiserror 2.0.8", ] [[package]] @@ -755,9 +740,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628be5b9b75e4f4c4f2a71d985bbaca4f23de356dc83f1625454c505f5eef4df" +checksum = "baf656f983e14812df65b5aee37e7b37535f68a848295e6ed736b2054a405cb7" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -765,7 +750,7 @@ dependencies = [ "futures-utils-wasm", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.8", "tokio", "tower 0.5.2", "tracing", @@ -775,9 +760,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e24412cf72f79c95cd9b1d9482e3a31f9d94c24b43c4b3b710cc8d4341eaab0" +checksum = "ec938d51a47b7953b1c0fd8ddeb89a29eb113cd4908dfc4e01c7893b252d669f" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -790,9 +775,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0577a1f67ce70ece3f2b27cf1011da7222ef0a5701f7dcb558e5356278eeb531" +checksum = "9df0d2e1b24dd029641bd21ef783491c42af87b162968be94f0443c1eb72c8e0" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -809,9 +794,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca46272d17f9647fdb56080ed26c72b3ea5078416831130f5ed46f3b4be0ed6" +checksum = "9fabdf2d18c0c87b6cfcf6a067f1d5a7db378f103faeb16130d6d174c73d006b" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -1207,7 +1192,7 @@ dependencies = [ "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "itoa", "matchit", @@ -1555,9 +1540,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ "jobserver", "libc", @@ -1719,15 +1704,15 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "console" -version = "0.15.8" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ "encode_unicode", - "lazy_static", "libc", - "unicode-width 0.1.14", - "windows-sys 0.52.0", + "once_cell", + "unicode-width", + "windows-sys 0.59.0", ] [[package]] @@ -1791,21 +1776,22 @@ dependencies = [ [[package]] name = "cosmwasm-core" -version = "2.1.5" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cabbba3cbcf1ebdf61c782509916657a3b4e079ed68cb3ec38866f9ecb492ba4" +checksum = "c34c440d4d8e3ecec783d0f9c89d25565168b0f4cdb80a1f6a387cf2168c0740" [[package]] name = "cosmwasm-crypto" -version = "2.1.5" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58587c713490d96f92c36584dcb29f324df58907d9185f762b71ac2b08ac07eb" +checksum = "134e765161d60228cc27635032d2a466542ca83fd6c87f3c87f4963c0bd51008" dependencies = [ "ark-bls12-381", "ark-ec", "ark-ff 0.4.2", "ark-serialize 0.4.2", "cosmwasm-core", + "curve25519-dalek", "digest 0.10.7", "ecdsa", "ed25519-zebra", @@ -1820,9 +1806,9 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "2.1.5" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae47fa8399bfe9a5b92a6312a1144912231fa1665759562dddb0497c1c917712" +checksum = "3c94a4b93e722c91d2e58471cfe69480f4a656cfccacd8bfda5638f2a5d4512b" dependencies = [ "proc-macro2", "quote", @@ -1831,9 +1817,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema" -version = "2.1.5" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a7f53fb0011af2ce8d79379ff21a34cd90622e387ebaa00920bac1099ea71d1" +checksum = "3e9a7b56d154870ec4b57b224509854f706c9744449548d8a3bf91ac75c59192" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -1844,9 +1830,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "2.1.5" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae75370266380e777f075be5a0e092792af69469ed1231825505f9c4bd17e54" +checksum = "edd3d80310cd7b86b09dbe886f4f2ca235a5ddb8d478493c6e50e720a3b38a42" dependencies = [ "proc-macro2", "quote", @@ -1855,9 +1841,9 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "2.1.5" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5165aa666dfa923b480babec2ddba16ab91617179d9fb404dfb600c3f0733cef" +checksum = "4434e556b0aebff34bf082e75d175b5d7edbcf1d90d4cedb59623a1249fff567" dependencies = [ "base64 0.22.1", "bech32 0.11.0", @@ -1868,6 +1854,7 @@ dependencies = [ "derive_more 1.0.0", "hex", "rand_core", + "rmp-serde", "schemars", "serde", "serde-json-wasm", @@ -1887,9 +1874,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -1906,9 +1893,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" @@ -1996,61 +1983,15 @@ dependencies = [ "alloy-primitives 0.8.15", "cosmwasm-schema", "cosmwasm-std", - "cw-multi-test", - "cw-storage-plus", "ethereum-light-client", - "ethereum-test-utils", + "ethereum-types 0.1.0", "ethereum-utils", + "hex", "ibc-proto 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)", "prost", "serde", "serde_json", - "serde_with", - "thiserror 2.0.6", -] - -[[package]] -name = "cw-multi-test" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1149fe104344cc4f4ca0fc784b7411042fd1626813fe85fd412b05252a0ae9d8" -dependencies = [ - "anyhow", - "bech32 0.11.0", - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus", - "cw-utils", - "itertools 0.13.0", - "prost", - "schemars", - "serde", - "sha2 0.10.8", - "thiserror 2.0.6", -] - -[[package]] -name = "cw-storage-plus" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", -] - -[[package]] -name = "cw-utils" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07dfee7f12f802431a856984a32bce1cb7da1e6c006b5409e3981035ce562dec" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "schemars", - "serde", - "thiserror 1.0.69", + "thiserror 2.0.8", ] [[package]] @@ -2431,9 +2372,9 @@ dependencies = [ [[package]] name = "encode_unicode" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "encoding_rs" @@ -2527,7 +2468,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ - "ethereum-types", + "ethereum-types 0.14.1", "hex", "once_cell", "regex", @@ -2559,39 +2500,18 @@ version = "0.1.0" dependencies = [ "alloy-primitives 0.8.15", "alloy-rlp", - "alloy-rpc-types-beacon", - "alloy-rpc-types-engine", - "alloy-rpc-types-eth", - "alloy-serde", "alloy-trie", - "base64 0.22.1", - "ethereum-test-utils", "ethereum-trie-db", + "ethereum-types 0.1.0", "ethereum-utils", - "ethereum_ssz", - "ethereum_ssz_derive", + "hex", "milagro_bls", + "schemars", "serde", "serde_json", - "serde_with", "sha2 0.10.8", - "thiserror 2.0.6", + "thiserror 2.0.8", "tree_hash", - "tree_hash_derive", - "typenum", -] - -[[package]] -name = "ethereum-test-utils" -version = "0.1.0" -dependencies = [ - "alloy-primitives 0.8.15", - "ethereum-light-client", - "ethereum-utils", - "milagro_bls", - "serde", - "serde_json", - "thiserror 2.0.6", ] [[package]] @@ -2602,16 +2522,29 @@ dependencies = [ "ethereum-utils", "hash-db", "hash256-std-hasher", + "hex", "memory-db", "primitive-types 0.13.1", "rlp 0.6.1", "rlp-derive 0.2.0", - "serde", "sha3", - "thiserror 2.0.6", + "thiserror 2.0.8", "trie-db", ] +[[package]] +name = "ethereum-types" +version = "0.1.0" +dependencies = [ + "alloy-primitives 0.8.15", + "schemars", + "serde", + "serde_json", + "serde_with", + "tree_hash", + "tree_hash_derive", +] + [[package]] name = "ethereum-types" version = "0.14.1" @@ -2631,12 +2564,6 @@ dependencies = [ [[package]] name = "ethereum-utils" version = "0.1.0" -dependencies = [ - "alloy-primitives 0.8.15", - "base64 0.22.1", - "serde", - "thiserror 2.0.6", -] [[package]] name = "ethereum_serde_utils" @@ -2899,6 +2826,17 @@ dependencies = [ "bytes", ] +[[package]] +name = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.12.1" @@ -3473,9 +3411,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.31" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -3497,9 +3435,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", @@ -3524,7 +3462,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -3532,13 +3470,13 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "f6884a48c6826ec44f524c7456b163cebe9e55a18d7b5e307cb4f100371cc767" dependencies = [ "futures-util", "http 1.2.0", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "rustls 0.23.20", "rustls-pki-types", @@ -3554,7 +3492,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "pin-project-lite", "tokio", @@ -3568,7 +3506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.31", + "hyper 0.14.32", "native-tls", "tokio", "tokio-native-tls", @@ -3582,7 +3520,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "native-tls", "tokio", @@ -3601,7 +3539,7 @@ dependencies = [ "futures-util", "http 1.2.0", "http-body 1.0.1", - "hyper 1.5.1", + "hyper 1.5.2", "pin-project-lite", "socket2", "tokio", @@ -3845,7 +3783,6 @@ name = "ibc-eureka-relayer-lib" version = "0.1.0" dependencies = [ "alloy", - "alloy-contract", "anyhow", "async-trait", "futures", @@ -4175,7 +4112,7 @@ dependencies = [ "console", "number_prefix", "portable-atomic", - "unicode-width 0.2.0", + "unicode-width", "web-time", ] @@ -4481,9 +4418,9 @@ dependencies = [ [[package]] name = "memuse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2145869435ace5ea6ea3d35f59be559317ec9a0d04e1812d5f185a87b6d36f1a" +checksum = "3d97bbf43eb4f088f8ca469930cde17fa036207c9a5e02ccc5107c4e8b17c964" [[package]] name = "milagro_bls" @@ -4509,9 +4446,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ "adler2", ] @@ -4799,7 +4736,7 @@ dependencies = [ "arrayvec", "auto_impl", "bytes", - "ethereum-types", + "ethereum-types 0.14.1", "open-fastrlp-derive", ] @@ -5304,7 +5241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.6", + "thiserror 2.0.8", "ucd-trie", ] @@ -5537,9 +5474,9 @@ dependencies = [ [[package]] name = "proptest-derive" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff7ff745a347b87471d859a377a9a404361e7efc2a971d73424a6d183c0fc77" +checksum = "4ee1c9ac207483d5e7db4940700de86a9aae46ef90c48b57f99fe7edb8345e49" dependencies = [ "proc-macro2", "quote", @@ -5617,7 +5554,7 @@ dependencies = [ "rustc-hash 2.1.0", "rustls 0.23.20", "socket2", - "thiserror 2.0.6", + "thiserror 2.0.8", "tokio", "tracing", ] @@ -5636,7 +5573,7 @@ dependencies = [ "rustls 0.23.20", "rustls-pki-types", "slab", - "thiserror 2.0.6", + "thiserror 2.0.8", "tinyvec", "tracing", "web-time", @@ -5644,9 +5581,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" +checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" dependencies = [ "cfg_aliases", "libc", @@ -5824,7 +5761,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-rustls 0.24.2", "hyper-tls 0.5.0", "ipnet", @@ -5869,8 +5806,8 @@ dependencies = [ "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", - "hyper-rustls 0.27.3", + "hyper 1.5.2", + "hyper-rustls 0.27.4", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -6010,6 +5947,28 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "rmp" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + [[package]] name = "rrs-succinct" version = "0.1.0" @@ -6023,17 +5982,19 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.3" +version = "1.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +checksum = "f5ef8fb1dd8de3870cb8400d51b4c2023854bbafd5431a3ac7e7317243e22d2f" dependencies = [ "alloy-rlp", "arbitrary", "ark-ff 0.3.0", "ark-ff 0.4.2", "bytes", - "fastrlp", + "fastrlp 0.3.1", + "fastrlp 0.4.0", "num-bigint 0.4.6", + "num-integer", "num-traits", "parity-scale-codec", "primitive-types 0.12.2", @@ -6165,9 +6126,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" dependencies = [ "web-time", ] @@ -6261,9 +6222,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" +checksum = "94b13f8ea6177672c49d12ed964cca44836f59621981b04a3e26b87e675181de" dependencies = [ "sdd", ] @@ -6342,9 +6303,9 @@ dependencies = [ [[package]] name = "sdd" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" +checksum = "478f121bb72bbf63c52c93011ea1791dca40140dfe13f8336c4c5ac952c33aa9" [[package]] name = "sec1" @@ -6375,9 +6336,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" dependencies = [ "core-foundation-sys", "libc", @@ -6907,7 +6868,6 @@ dependencies = [ "bincode", "ibc-client-tendermint", "ibc-core-client", - "ibc-core-handler-types", "ibc-core-host-types", "ibc-eureka-solidity-types", "ibc-primitives", @@ -6922,16 +6882,12 @@ name = "sp1-ics07-tendermint-operator" version = "0.1.0" dependencies = [ "alloy", - "alloy-primitives 0.8.15", "alloy-sol-types 0.8.15", "anyhow", "clap", - "cosmos-sdk-proto", "dotenv", "futures", - "hex", "ibc-client-tendermint-types", - "ibc-core-client-types", "ibc-core-commitment-types", "ibc-eureka-solidity-types", "ibc-proto 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6942,7 +6898,6 @@ dependencies = [ "sp1-ics07-tendermint-utils", "sp1-sdk", "subtle-encoding", - "tendermint", "tendermint-light-client-verifier", "tendermint-rpc", "tokio", @@ -6988,7 +6943,6 @@ dependencies = [ "bincode", "ibc-client-tendermint", "ibc-core-client", - "ibc-core-handler-types", "ibc-core-host-types", "ibc-eureka-solidity-types", "ibc-primitives", @@ -7012,7 +6966,6 @@ dependencies = [ "ibc-core-host-types", "ibc-eureka-solidity-types", "prost", - "serde", "tendermint", "tendermint-light-client-verifier", "tendermint-rpc", @@ -7653,11 +7606,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.6" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +checksum = "08f5383f3e0071702bf93ab5ee99b52d26936be9dedd9413067cbdcddcb6141a" dependencies = [ - "thiserror-impl 2.0.6", + "thiserror-impl 2.0.8", ] [[package]] @@ -7673,9 +7626,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.6" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +checksum = "f2f357fcec90b3caef6623a099691be676d033b40a058ac95d2a6ade6fa0c943" dependencies = [ "proc-macro2", "quote", @@ -7928,7 +7881,7 @@ dependencies = [ "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-timeout", "hyper-util", "percent-encoding", @@ -8164,7 +8117,7 @@ dependencies = [ "futures", "http 1.2.0", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "prost", "reqwest 0.12.9", "serde", @@ -8223,12 +8176,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index fc59d10f..60860c12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ sp1-ics07-tendermint-utils = { path = "packages/sp1-ics07-tendermint-uti sp1-ics07-tendermint-update-client = { path = "programs/sp1-programs/update-client", default-features = false } sp1-ics07-tendermint-membership = { path = "programs/sp1-programs/membership", default-features = false } ethereum-trie-db = { path = "packages/ethereum-trie-db", default-features = false } -ethereum-utils = { path = "packages/ethereum-utils", default-features = false } ethereum-light-client = { path = "packages/ethereum-light-client", default-features = false } -ethereum-test-utils = { path = "packages/ethereum-test-utils", default-features = false } +ethereum-types = { path = "packages/ethereum-types", default-features = false } +ethereum-utils = { path = "packages/ethereum-utils", default-features = false } tree_hash = { path = "packages/tree_hash", default-features = false } serde = { version = "1.0", default-features = false } @@ -38,6 +38,7 @@ base64 = { version = "0.22", default-features = false } prost = { version = "0.13", default-features = false } bincode = { version = "1.3", default-features = false } subtle-encoding = { version = "0.5", default-features = false } +schemars = { version = "0.8", default-features = false } sha2 = { version = "0.10", default-features = false } sha3 = { version = "0.10", default-features = false } @@ -82,9 +83,6 @@ alloy-primitives = { version = "0.8", default-features = false } alloy-trie = { version = "0.7", default-features = false } alloy-serde = { version = "0.8", default-features = false } alloy-rlp = { version = "0.3", default-features = false } -alloy-rpc-types-eth = { version = "0.8", default-features = false } -alloy-rpc-types-beacon = { version = "0.8", default-features = false } -alloy-rpc-types-engine = { version = "0.8", default-features = false } sp1-sdk = { version = "3.3", default-features = false } sp1-zkvm = { version = "3.3", default-features = false } @@ -92,7 +90,6 @@ sp1-helper = { version = "3.3", default-features = false } cosmwasm-schema = { version = "2.1", default-features = false } cosmwasm-std = { version = "2.1", default-features = false } -cw-storage-plus = { version = "2.0", default-features = false } # The dependencies below are maintained by Sigma Prime (for use in Lighthouse (and the broader Ethereum ecosystem)) ethereum_ssz = { version = "0.8", default-features = false } @@ -108,11 +105,7 @@ rlp = { version = "0.6", default-features = false } rlp-derive = { version = "0.2", default-features = false } primitive-types = { version = "0.13", default-features = false } -# TODO: From union (might be removed if they are replaced by something more standard). #147 -typenum = { version = "1.17.0", default-features = false } - -# dev-dependencies -cw-multi-test = { version = "2.2.0", default-features = false } +# test/dev-dependencies milagro_bls = { git = "https://github.com/Snowfork/milagro_bls", rev = "bc2b5b5e8d48b7e2e1bfaa56dc2d93e13cb32095", default-features = false } # Only used for testing, not to be used in production! smallvec = { version = "1.6.1", default-features = false } diff --git a/e2e/interchaintestv8/e2esuite/light_clients.go b/e2e/interchaintestv8/e2esuite/light_clients.go index 644a3aad..8a5e77ff 100644 --- a/e2e/interchaintestv8/e2esuite/light_clients.go +++ b/e2e/interchaintestv8/e2esuite/light_clients.go @@ -3,6 +3,7 @@ package e2esuite import ( "context" "encoding/hex" + "encoding/json" "fmt" "os" "strconv" @@ -20,7 +21,7 @@ import ( "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/ethereum" "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/testvalues" "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types" - ethereumligthclient "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereumlightclient" + ethereumtypes "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereum" ) func (s *TestSuite) CreateEthereumLightClient(ctx context.Context, simdRelayerUser ibc.Wallet, ibcContractAddress string, rustFixtureGenerator *types.RustFixtureGenerator) { @@ -28,13 +29,13 @@ func (s *TestSuite) CreateEthereumLightClient(ctx context.Context, simdRelayerUs case testvalues.EthTestnetTypePoW: s.createDummyLightClient(ctx, simdRelayerUser) case testvalues.EthTestnetTypePoS: - s.createUnionLightClient(ctx, simdRelayerUser, ibcContractAddress, rustFixtureGenerator) + s.createEthereumLightClient(ctx, simdRelayerUser, ibcContractAddress, rustFixtureGenerator) default: panic(fmt.Sprintf("Unrecognized Ethereum testnet type: %v", s.ethTestnetType)) } } -func (s *TestSuite) UpdateEthClient(ctx context.Context, ibcContractAddress string, minimumUpdateTo int64, simdRelayerUser ibc.Wallet, rustFixtureGenerator *types.RustFixtureGenerator) { +func (s *TestSuite) UpdateEthClient(ctx context.Context, ibcContractAddress string, minimumUpdateTo uint64, simdRelayerUser ibc.Wallet, rustFixtureGenerator *types.RustFixtureGenerator) { if s.ethTestnetType != testvalues.EthTestnetTypePoS { return } @@ -42,7 +43,7 @@ func (s *TestSuite) UpdateEthClient(ctx context.Context, ibcContractAddress stri eth, simd := s.EthChain, s.CosmosChains[0] // Wait until we have a block number greater than the minimum update to - var updateTo int64 + var updateTo uint64 var err error err = testutil.WaitForCondition(5*time.Minute, 5*time.Second, func() (bool, error) { _, updateTo, err = eth.EthAPI.GetBlockNumber() @@ -53,14 +54,14 @@ func (s *TestSuite) UpdateEthClient(ctx context.Context, ibcContractAddress stri s.Require().NoError(err) fmt.Printf("Updating eth light client to at least block number %d (with minimum requested: %d)\n", updateTo, minimumUpdateTo) - _, unionConsensusState := s.GetUnionConsensusState(ctx, simd, s.EthereumLightClientID, clienttypes.Height{ + _, ethereumConsensusState := s.GetEthereumConsensusState(ctx, simd, s.EthereumLightClientID, clienttypes.Height{ RevisionNumber: 0, RevisionHeight: s.LastEtheruemLightClientUpdate, }) spec, err := eth.BeaconAPIClient.GetSpec() s.Require().NoError(err) - trustedPeriod := unionConsensusState.Slot / spec.Period() + trustedPeriod := ethereumConsensusState.Slot / spec.Period() var finalityUpdate ethereum.FinalityUpdateJSONResponse var targetPeriod uint64 @@ -69,35 +70,35 @@ func (s *TestSuite) UpdateEthClient(ctx context.Context, ibcContractAddress stri finalityUpdate, err = eth.BeaconAPIClient.GetFinalityUpdate() s.Require().NoError(err) - targetPeriod = finalityUpdate.Data.AttestedHeader.Beacon.Slot / spec.Period() + targetPeriod = finalityUpdate.Data.AttestedHeader.Beacon.GetSlot() / spec.Period() lightClientUpdates, err := eth.BeaconAPIClient.GetLightClientUpdates(trustedPeriod+1, targetPeriod-trustedPeriod) s.Require().NoError(err) var highestUpdateSlot uint64 for _, update := range lightClientUpdates { - if update.Data.AttestedHeader.Beacon.Slot > highestUpdateSlot { - highestUpdateSlot = update.Data.AttestedHeader.Beacon.Slot + if update.Data.AttestedHeader.Beacon.GetSlot() > highestUpdateSlot { + highestUpdateSlot = update.Data.AttestedHeader.Beacon.GetSlot() } } - return finalityUpdate.Data.FinalizedHeader.Beacon.Slot > uint64(updateTo) && + return finalityUpdate.Data.FinalizedHeader.Beacon.GetSlot() > updateTo && targetPeriod > trustedPeriod && - highestUpdateSlot > uint64(updateTo), + highestUpdateSlot > updateTo, nil }) s.Require().NoError(err) - _, unionClientState := s.GetUnionClientState(ctx, simd, s.EthereumLightClientID) + _, ethereumClientState := s.GetEthereumClientState(ctx, simd, s.EthereumLightClientID) // Wait until computed slot is greater than all of the updates signature slots err = testutil.WaitForCondition(8*time.Minute, 5*time.Second, func() (bool, error) { lightClientUpdates, err := eth.BeaconAPIClient.GetLightClientUpdates(trustedPeriod+1, targetPeriod-trustedPeriod) s.Require().NoError(err) - computedSlot := (uint64(time.Now().Unix())-unionClientState.GenesisTime)/ - unionClientState.SecondsPerSlot + spec.GenesisSlot + computedSlot := (uint64(time.Now().Unix())-ethereumClientState.GenesisTime)/ + ethereumClientState.SecondsPerSlot + spec.GenesisSlot for _, update := range lightClientUpdates { - if computedSlot < update.Data.SignatureSlot { + if computedSlot < update.Data.GetSignatureSlot() { return false, nil } } @@ -111,32 +112,28 @@ func (s *TestSuite) UpdateEthClient(ctx context.Context, ibcContractAddress stri lightClientUpdates, err := eth.BeaconAPIClient.GetLightClientUpdates(trustedPeriod+1, targetPeriod-trustedPeriod) s.Require().NoError(err) - headers := []ethereumligthclient.Header{} - trustedSlot := unionConsensusState.Slot + headers := []ethereumtypes.Header{} + trustedSlot := ethereumConsensusState.Slot var prevPubAggKey string for _, update := range lightClientUpdates { previousPeriod := uint64(1) - if update.Data.AttestedHeader.Beacon.Slot/spec.Period() > 1 { - previousPeriod = update.Data.AttestedHeader.Beacon.Slot / spec.Period() + if update.Data.AttestedHeader.Beacon.GetSlot()/spec.Period() > 1 { + previousPeriod = update.Data.AttestedHeader.Beacon.GetSlot() / spec.Period() } previousPeriod -= 1 - executionHeight, err := eth.BeaconAPIClient.GetExecutionHeight(strconv.Itoa(int(update.Data.AttestedHeader.Beacon.Slot))) + executionHeight, err := eth.BeaconAPIClient.GetExecutionHeight(strconv.Itoa(int(update.Data.AttestedHeader.Beacon.GetSlot()))) s.Require().NoError(err) executionHeightHex := fmt.Sprintf("0x%x", executionHeight) proofResp, err := eth.EthAPI.GetProof(ibcContractAddress, []string{}, executionHeightHex) s.Require().NoError(err) s.Require().NotEmpty(proofResp.AccountProof) - var proofBz [][]byte - for _, proofStr := range proofResp.AccountProof { - proofBz = append(proofBz, ethcommon.FromHex(proofStr)) - } - accountUpdate := ethereumligthclient.AccountUpdate{ - AccountProof: ðereumligthclient.AccountProof{ - StorageRoot: ethereum.HexToBeBytes(proofResp.StorageHash), - Proof: proofBz, + accountUpdate := ethereumtypes.AccountUpdate{ + AccountProof: ethereumtypes.AccountProof{ + StorageRoot: proofResp.StorageHash, + Proof: proofResp.AccountProof, }, } @@ -149,86 +146,84 @@ func (s *TestSuite) UpdateEthClient(ctx context.Context, ibcContractAddress stri continue } - var nextSyncCommitteePubkeys [][]byte - for _, pubkey := range previousLightClientUpdate.Data.NextSyncCommittee.Pubkeys { - nextSyncCommitteePubkeys = append(nextSyncCommitteePubkeys, ethcommon.FromHex(pubkey)) - } - - consensusUpdate := update.ToLightClientUpdate() - header := ethereumligthclient.Header{ - ConsensusUpdate: &consensusUpdate, - TrustedSyncCommittee: ðereumligthclient.TrustedSyncCommittee{ - TrustedHeight: &clienttypes.Height{ - RevisionNumber: 0, - RevisionHeight: trustedSlot, - }, - NextSyncCommittee: ðereumligthclient.SyncCommittee{ - Pubkeys: nextSyncCommitteePubkeys, - AggregatePubkey: ethcommon.FromHex(previousLightClientUpdate.Data.NextSyncCommittee.AggregatePubkey), + header := ethereumtypes.Header{ + ConsensusUpdate: update.Data, + TrustedSyncCommittee: ethereumtypes.TrustedSyncCommittee{ + TrustedSlot: trustedSlot, + SyncCommittee: ethereumtypes.ActiveSyncCommittee{ + Next: ðereumtypes.SyncCommittee{ + Pubkeys: previousLightClientUpdate.Data.NextSyncCommittee.Pubkeys, + AggregatePubkey: previousLightClientUpdate.Data.NextSyncCommittee.AggregatePubkey, + }, }, }, - AccountUpdate: &accountUpdate, + AccountUpdate: accountUpdate, } headers = append(headers, header) - logHeader("Adding new header", header) - trustedSlot = update.Data.AttestedHeader.Beacon.Slot + trustedSlot = update.Data.AttestedHeader.Beacon.GetSlot() prevPubAggKey = previousLightClientUpdate.Data.NextSyncCommittee.AggregatePubkey } if trustedPeriod >= targetPeriod { - headers = []ethereumligthclient.Header{} + headers = []ethereumtypes.Header{} } - wasmClientState, unionClientState := s.GetUnionClientState(ctx, simd, s.EthereumLightClientID) - _, unionConsensusState = s.GetUnionConsensusState(ctx, simd, s.EthereumLightClientID, wasmClientState.LatestHeight) + wasmClientState, ethereumClientState := s.GetEthereumClientState(ctx, simd, s.EthereumLightClientID) + _, ethereumConsensusState = s.GetEthereumConsensusState(ctx, simd, s.EthereumLightClientID, wasmClientState.LatestHeight) - var updatedHeaders []ethereumligthclient.Header + var updatedHeaders []ethereumtypes.Header for _, header := range headers { - logHeader("Updating eth light client", header) - headerBz := simd.Config().EncodingConfig.Codec.MustMarshal(&header) + headerBz, err := json.Marshal(header) + s.Require().NoError(err) + wasmHeader := ibcwasmtypes.ClientMessage{ Data: headerBz, } wasmHeaderAny, err := clienttypes.PackClientMessage(&wasmHeader) s.Require().NoError(err) - _, err = s.BroadcastMessages(ctx, simd, simdRelayerUser, 200_000, &clienttypes.MsgUpdateClient{ + _, err = s.BroadcastMessages(ctx, simd, simdRelayerUser, 500_000, &clienttypes.MsgUpdateClient{ ClientId: s.EthereumLightClientID, ClientMessage: wasmHeaderAny, Signer: simdRelayerUser.FormattedAddress(), }) s.Require().NoError(err) - s.LastEtheruemLightClientUpdate = header.ConsensusUpdate.AttestedHeader.Beacon.Slot + s.LastEtheruemLightClientUpdate = header.ConsensusUpdate.AttestedHeader.Beacon.GetSlot() fmt.Println("Updated eth light client to block number", s.LastEtheruemLightClientUpdate) updatedHeaders = append(updatedHeaders, header) time.Sleep(10 * time.Second) - if s.LastEtheruemLightClientUpdate > uint64(updateTo) { + if s.LastEtheruemLightClientUpdate > updateTo { fmt.Println("Updated past target block number, skipping any further updates") break } } - rustFixtureGenerator.AddFixtureStep("updated_light_client", types.UpdateClientFixture{ - ClientState: unionClientState, - ConsensusState: unionConsensusState, + rustFixtureGenerator.AddFixtureStep("updated_light_client", ethereumtypes.UpdateClient{ + ClientState: ethereumClientState, + ConsensusState: ethereumConsensusState, Updates: updatedHeaders, }) - s.Require().Greater(s.LastEtheruemLightClientUpdate, uint64(minimumUpdateTo)) + s.Require().Greater(s.LastEtheruemLightClientUpdate, minimumUpdateTo) } -func (s *TestSuite) createUnionLightClient(ctx context.Context, simdRelayerUser ibc.Wallet, ibcContractAddress string, rustFixtureGenerator *types.RustFixtureGenerator) { +func (s *TestSuite) createEthereumLightClient( + ctx context.Context, + simdRelayerUser ibc.Wallet, + ibcContractAddress string, + rustFixtureGenerator *types.RustFixtureGenerator, +) { eth, simd := s.EthChain, s.CosmosChains[0] - file, err := os.Open("e2e/interchaintestv8/wasm/ethereum_light_client_minimal.wasm.gz") + file, err := os.Open("e2e/interchaintestv8/wasm/cw_ics08_wasm_eth.wasm.gz") s.Require().NoError(err) - unionClientChecksum := s.PushNewWasmClientProposal(ctx, simd, simdRelayerUser, file) - s.Require().NotEmpty(unionClientChecksum, "checksum was empty but should not have been") + etheruemClientChecksum := s.PushNewWasmClientProposal(ctx, simd, simdRelayerUser, file) + s.Require().NotEmpty(etheruemClientChecksum, "checksum was empty but should not have been") genesis, err := eth.BeaconAPIClient.GetGenesis() s.Require().NoError(err) @@ -239,28 +234,24 @@ func (s *TestSuite) createUnionLightClient(ctx context.Context, simdRelayerUser s.Require().NoError(err) executionNumberHex := fmt.Sprintf("0x%x", executionHeight) - ibcCommitmentSlot := ethereum.HexToBeBytes(testvalues.IbcCommitmentSlotHex) - - ethClientState := ethereumligthclient.ClientState{ - ChainId: eth.ChainID.String(), - GenesisValidatorsRoot: genesis.GenesisValidatorsRoot[:], - MinSyncCommitteeParticipants: 0, + ethClientState := ethereumtypes.ClientState{ + ChainID: eth.ChainID.Uint64(), + GenesisValidatorsRoot: ethcommon.Bytes2Hex(genesis.GenesisValidatorsRoot[:]), + MinSyncCommitteeParticipants: 32, GenesisTime: uint64(genesis.GenesisTime.Unix()), ForkParameters: spec.ToForkParameters(), SecondsPerSlot: uint64(spec.SecondsPerSlot.Seconds()), SlotsPerEpoch: spec.SlotsPerEpoch, EpochsPerSyncCommitteePeriod: spec.EpochsPerSyncCommitteePeriod, LatestSlot: executionHeight, - FrozenHeight: &clienttypes.Height{ - RevisionNumber: 0, - RevisionHeight: 0, - }, - IbcCommitmentSlot: ibcCommitmentSlot, - IbcContractAddress: ethcommon.FromHex(ibcContractAddress), + FrozenSlot: 0, + IbcCommitmentSlot: testvalues.IbcCommitmentSlotHex, + IbcContractAddress: ibcContractAddress, } - ethClientStateBz := simd.Config().EncodingConfig.Codec.MustMarshal(ðClientState) - wasmClientChecksum, err := hex.DecodeString(unionClientChecksum) + ethClientStateBz, err := json.Marshal(ðClientState) + s.Require().NoError(err) + wasmClientChecksum, err := hex.DecodeString(etheruemClientChecksum) s.Require().NoError(err) latestHeightSlot := clienttypes.Height{ RevisionNumber: 0, @@ -287,7 +278,6 @@ func (s *TestSuite) createUnionLightClient(ctx context.Context, simdRelayerUser } timestamp := bootstrap.Data.Header.Execution.Timestamp * 1_000_000_000 - stateRoot := ethereum.HexToBeBytes(bootstrap.Data.Header.Execution.StateRoot) currentPeriod := executionHeight / spec.Period() clientUpdates, err := eth.BeaconAPIClient.GetLightClientUpdates(currentPeriod, 1) @@ -295,16 +285,17 @@ func (s *TestSuite) createUnionLightClient(ctx context.Context, simdRelayerUser s.Require().NotEmpty(clientUpdates) s.LastEtheruemLightClientUpdate = bootstrap.Data.Header.Beacon.Slot - ethConsensusState := ethereumligthclient.ConsensusState{ + ethConsensusState := ethereumtypes.ConsensusState{ Slot: bootstrap.Data.Header.Beacon.Slot, - StateRoot: stateRoot, - StorageRoot: ethereum.HexToBeBytes(proofOfIBCContract.StorageHash), + StateRoot: bootstrap.Data.Header.Execution.StateRoot, + StorageRoot: proofOfIBCContract.StorageHash, Timestamp: timestamp, - CurrentSyncCommittee: ethcommon.FromHex(bootstrap.Data.CurrentSyncCommittee.AggregatePubkey), - NextSyncCommittee: ethcommon.FromHex(clientUpdates[0].Data.NextSyncCommittee.AggregatePubkey), + CurrentSyncCommittee: bootstrap.Data.CurrentSyncCommittee.AggregatePubkey, + NextSyncCommittee: clientUpdates[0].Data.NextSyncCommittee.AggregatePubkey, } - ethConsensusStateBz := simd.Config().EncodingConfig.Codec.MustMarshal(ðConsensusState) + ethConsensusStateBz, err := json.Marshal(ðConsensusState) + s.Require().NoError(err) consensusState := ibcwasmtypes.ConsensusState{ Data: ethConsensusStateBz, } @@ -322,7 +313,7 @@ func (s *TestSuite) createUnionLightClient(ctx context.Context, simdRelayerUser s.Require().NoError(err) s.Require().Equal("08-wasm-0", s.EthereumLightClientID) - rustFixtureGenerator.AddFixtureStep("initial_state", types.InitialStateFixture{ + rustFixtureGenerator.AddFixtureStep("initial_state", ethereumtypes.InitialState{ ClientState: ethClientState, ConsensusState: ethConsensusState, }) @@ -344,7 +335,7 @@ func (s *TestSuite) createDummyLightClient(ctx context.Context, simdRelayerUser s.Require().NoError(err) latestHeight := clienttypes.Height{ RevisionNumber: 0, - RevisionHeight: uint64(ethHeight), + RevisionHeight: ethHeight, } s.Require().NoError(err) clientState := ibcwasmtypes.ClientState{ @@ -372,13 +363,3 @@ func (s *TestSuite) createDummyLightClient(ctx context.Context, simdRelayerUser s.Require().NoError(err) s.Require().Equal("08-wasm-0", s.EthereumLightClientID) } - -func logHeader(prefix string, header ethereumligthclient.Header) { - fmt.Printf("%s: header height: %d, trusted height: %d, signature slot: %d, finalized slot: %d, finalized execution block: %d\n", - prefix, - header.ConsensusUpdate.AttestedHeader.Beacon.Slot, - header.TrustedSyncCommittee.TrustedHeight.RevisionHeight, - header.ConsensusUpdate.SignatureSlot, - header.ConsensusUpdate.FinalizedHeader.Beacon.Slot, - header.ConsensusUpdate.FinalizedHeader.Execution.BlockNumber) -} diff --git a/e2e/interchaintestv8/e2esuite/utils.go b/e2e/interchaintestv8/e2esuite/utils.go index 26276927..1a3d2e11 100644 --- a/e2e/interchaintestv8/e2esuite/utils.go +++ b/e2e/interchaintestv8/e2esuite/utils.go @@ -51,7 +51,7 @@ import ( "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/ethereum" "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/testvalues" - ethereumligthclient "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereumlightclient" + ethereumtypes "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereum" ) // BroadcastMessages broadcasts the provided messages to the given chain and signs them on behalf of the provided user. @@ -256,7 +256,7 @@ func IsLowercase(s string) bool { return true } -func (s *TestSuite) GetUnionClientState(ctx context.Context, cosmosChain *cosmos.CosmosChain, clientID string) (*ibcwasmtypes.ClientState, ethereumligthclient.ClientState) { +func (s *TestSuite) GetEthereumClientState(ctx context.Context, cosmosChain *cosmos.CosmosChain, clientID string) (*ibcwasmtypes.ClientState, ethereumtypes.ClientState) { clientStateResp, err := GRPCQuery[clienttypes.QueryClientStateResponse](ctx, cosmosChain, &clienttypes.QueryClientStateRequest{ ClientId: clientID, }) @@ -270,14 +270,14 @@ func (s *TestSuite) GetUnionClientState(ctx context.Context, cosmosChain *cosmos s.Require().True(ok) s.Require().NotEmpty(wasmClientState.Data) - var ethClientState ethereumligthclient.ClientState - err = cosmosChain.Config().EncodingConfig.Codec.Unmarshal(wasmClientState.Data, ðClientState) + var ethClientState ethereumtypes.ClientState + err = json.Unmarshal(wasmClientState.Data, ðClientState) s.Require().NoError(err) return wasmClientState, ethClientState } -func (s *TestSuite) GetUnionConsensusState(ctx context.Context, cosmosChain *cosmos.CosmosChain, clientID string, height clienttypes.Height) (*ibcwasmtypes.ConsensusState, ethereumligthclient.ConsensusState) { +func (s *TestSuite) GetEthereumConsensusState(ctx context.Context, cosmosChain *cosmos.CosmosChain, clientID string, height clienttypes.Height) (*ibcwasmtypes.ConsensusState, ethereumtypes.ConsensusState) { consensusStateResp, err := GRPCQuery[clienttypes.QueryConsensusStateResponse](ctx, cosmosChain, &clienttypes.QueryConsensusStateRequest{ ClientId: clientID, RevisionNumber: height.RevisionNumber, @@ -293,8 +293,8 @@ func (s *TestSuite) GetUnionConsensusState(ctx context.Context, cosmosChain *cos wasmConsenusState, ok := consensusState.(*ibcwasmtypes.ConsensusState) s.Require().True(ok) - var ethConsensusState ethereumligthclient.ConsensusState - err = cosmosChain.Config().EncodingConfig.Codec.Unmarshal(wasmConsenusState.Data, ðConsensusState) + var ethConsensusState ethereumtypes.ConsensusState + err = json.Unmarshal(wasmConsenusState.Data, ðConsensusState) s.Require().NoError(err) return wasmConsenusState, ethConsensusState diff --git a/e2e/interchaintestv8/ethereum/beaconapi.go b/e2e/interchaintestv8/ethereum/beaconapi.go index e3c67eb1..f1f1d320 100644 --- a/e2e/interchaintestv8/ethereum/beaconapi.go +++ b/e2e/interchaintestv8/ethereum/beaconapi.go @@ -15,7 +15,9 @@ import ( "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/rs/zerolog" - ethereumlightclient "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereumlightclient" + ethcommon "github.com/ethereum/go-ethereum/common" + + ethereumtypes "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereum" ) type BeaconAPIClient struct { @@ -29,24 +31,24 @@ type BeaconAPIClient struct { RetryWait time.Duration } -func (s Spec) ToForkParameters() *ethereumlightclient.ForkParameters { - return ðereumlightclient.ForkParameters{ - GenesisForkVersion: s.GenesisForkVersion[:], +func (s Spec) ToForkParameters() ethereumtypes.ForkParameters { + return ethereumtypes.ForkParameters{ + GenesisForkVersion: ethcommon.Bytes2Hex(s.GenesisForkVersion[:]), GenesisSlot: s.GenesisSlot, - Altair: ðereumlightclient.Fork{ - Version: s.AltairForkVersion[:], + Altair: ethereumtypes.Fork{ + Version: ethcommon.Bytes2Hex(s.AltairForkVersion[:]), Epoch: s.AltairForkEpoch, }, - Bellatrix: ðereumlightclient.Fork{ - Version: s.BellatrixForkVersion[:], + Bellatrix: ethereumtypes.Fork{ + Version: ethcommon.Bytes2Hex(s.BellatrixForkVersion[:]), Epoch: s.BellatrixForkEpoch, }, - Capella: ðereumlightclient.Fork{ - Version: s.CapellaForkVersion[:], + Capella: ethereumtypes.Fork{ + Version: ethcommon.Bytes2Hex(s.CapellaForkVersion[:]), Epoch: s.CapellaForkEpoch, }, - Deneb: ðereumlightclient.Fork{ - Version: s.DenebForkVersion[:], + Deneb: ethereumtypes.Fork{ + Version: ethcommon.Bytes2Hex(s.DenebForkVersion[:]), Epoch: s.DenebForkEpoch, }, } @@ -178,6 +180,7 @@ func (b BeaconAPIClient) GetGenesis() (*apiv1.Genesis, error) { if err != nil { return nil, err } + return genesisResponse.Data, nil }) } diff --git a/e2e/interchaintestv8/ethereum/ethapi.go b/e2e/interchaintestv8/ethereum/ethapi.go index 9d96ed58..eb8cb69c 100644 --- a/e2e/interchaintestv8/ethereum/ethapi.go +++ b/e2e/interchaintestv8/ethereum/ethapi.go @@ -5,6 +5,8 @@ import ( "time" "github.com/ethereum/go-ethereum/ethclient" + + ethereumtypes "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereum" ) type EthAPI struct { @@ -15,13 +17,9 @@ type EthAPI struct { } type EthGetProofResponse struct { - StorageHash string `json:"storageHash"` - StorageProof []struct { - Key string `json:"key"` - Proof []string `json:"proof"` - Value string `json:"value"` - } `json:"storageProof"` - AccountProof []string `json:"accountProof"` + StorageHash string `json:"storageHash"` + StorageProof []ethereumtypes.StorageProof `json:"storageProof"` + AccountProof []string `json:"accountProof"` } func NewEthAPI(rpc string) (EthAPI, error) { @@ -48,7 +46,7 @@ func (e EthAPI) GetProof(address string, storageKeys []string, blockHex string) }) } -func (e EthAPI) GetBlockNumber() (string, int64, error) { +func (e EthAPI) GetBlockNumber() (string, uint64, error) { var blockNumberHex string if err := e.client.Client().Call(&blockNumberHex, "eth_blockNumber"); err != nil { return "", 0, err @@ -59,5 +57,5 @@ func (e EthAPI) GetBlockNumber() (string, int64, error) { return "", 0, err } - return blockNumberHex, blockNumber, nil + return blockNumberHex, uint64(blockNumber), nil } diff --git a/e2e/interchaintestv8/ethereum/types.go b/e2e/interchaintestv8/ethereum/types.go index 5ed943ad..75c3b330 100644 --- a/e2e/interchaintestv8/ethereum/types.go +++ b/e2e/interchaintestv8/ethereum/types.go @@ -1,14 +1,11 @@ package ethereum import ( - "math/big" "time" "github.com/attestantio/go-eth2-client/spec/phase0" - ethcommon "github.com/ethereum/go-ethereum/common" - - ethereumlightclient "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereumlightclient" + ethereumtypes "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereum" ) type Spec struct { @@ -77,25 +74,8 @@ type ExecutionJSON struct { } type FinalityUpdateJSONResponse struct { - Version string `json:"version"` - Data struct { - AttestedHeader struct { - Beacon BeaconJSON `json:"beacon"` - Execution ExecutionJSON `json:"execution"` - ExecutionBranch []string `json:"execution_branch"` - } `json:"attested_header"` - FinalizedHeader struct { - Beacon BeaconJSON `json:"beacon"` - Execution ExecutionJSON `json:"execution"` - ExecutionBranch []string `json:"execution_branch"` - } `json:"finalized_header"` - FinalityBranch []string `json:"finality_branch"` - SyncAggregate struct { - SyncCommitteeBits string `json:"sync_committee_bits"` - SyncCommitteeSignature string `json:"sync_committee_signature"` - } `json:"sync_aggregate"` - SignatureSlot uint64 `json:"signature_slot,string"` - } `json:"data"` + Version string `json:"version"` + Data ethereumtypes.LightClientUpdate `json:"data"` } type BeaconBlocksResponseJSON struct { @@ -152,155 +132,5 @@ type BeaconBlocksResponseJSON struct { } type LightClientUpdateJSON struct { - Data struct { - AttestedHeader struct { - Beacon BeaconJSON `json:"beacon"` - Execution ExecutionJSON `json:"execution"` - ExecutionBranch []string `json:"execution_branch"` - } `json:"attested_header"` - NextSyncCommittee SyncCommittee `json:"next_sync_committee"` - NextSyncCommitteeBranch []string `json:"next_sync_committee_branch"` - FinalizedHeader struct { - Beacon BeaconJSON `json:"beacon"` - Execution ExecutionJSON `json:"execution"` - ExecutionBranch []string `json:"execution_branch"` - } `json:"finalized_header"` - FinalityBranch []string `json:"finality_branch"` - SyncAggregate struct { - SyncCommitteeBits string `json:"sync_committee_bits"` - SyncCommitteeSignature string `json:"sync_committee_signature"` - } `json:"sync_aggregate"` - SignatureSlot uint64 `json:"signature_slot,string"` - } `json:"data"` -} - -func (l LightClientUpdateJSON) ToLightClientUpdate() ethereumlightclient.LightClientUpdate { - attestedHeaderBeacon := l.Data.AttestedHeader.Beacon.ToBeaconBlockHeader() - attestedHeaderExecution := l.Data.AttestedHeader.Execution.ToExecutionPayloadHeader() - var attestedheaderExecutionBranch [][]byte - for _, branch := range l.Data.AttestedHeader.ExecutionBranch { - attestedheaderExecutionBranch = append(attestedheaderExecutionBranch, ethcommon.FromHex(branch)) - } - - var nextSyncCommitteePubkeys [][]byte - for _, pubkey := range l.Data.NextSyncCommittee.Pubkeys { - nextSyncCommitteePubkeys = append(nextSyncCommitteePubkeys, ethcommon.FromHex(pubkey)) - } - nextSyncCommitteeAggregatePubkey := ethcommon.FromHex(l.Data.NextSyncCommittee.AggregatePubkey) - - finalizedHeaderBeacon := l.Data.FinalizedHeader.Beacon.ToBeaconBlockHeader() - finalizedHeaderExecution := l.Data.FinalizedHeader.Execution.ToExecutionPayloadHeader() - - var nextSyncCommitteeBranch [][]byte - for _, branch := range l.Data.NextSyncCommitteeBranch { - nextSyncCommitteeBranch = append(nextSyncCommitteeBranch, ethcommon.FromHex(branch)) - } - - var finalityBranch [][]byte - for _, branch := range l.Data.FinalityBranch { - finalityBranch = append(finalityBranch, ethcommon.FromHex(branch)) - } - - var finalizedHeaderExecutionBranch [][]byte - for _, branch := range l.Data.FinalizedHeader.ExecutionBranch { - finalizedHeaderExecutionBranch = append(finalizedHeaderExecutionBranch, ethcommon.FromHex(branch)) - } - - return ethereumlightclient.LightClientUpdate{ - AttestedHeader: ðereumlightclient.LightClientHeader{ - Beacon: &attestedHeaderBeacon, - Execution: &attestedHeaderExecution, - ExecutionBranch: attestedheaderExecutionBranch, - }, - NextSyncCommittee: ðereumlightclient.SyncCommittee{ - Pubkeys: nextSyncCommitteePubkeys, - AggregatePubkey: nextSyncCommitteeAggregatePubkey, - }, - NextSyncCommitteeBranch: nextSyncCommitteeBranch, - FinalizedHeader: ðereumlightclient.LightClientHeader{ - Beacon: &finalizedHeaderBeacon, - Execution: &finalizedHeaderExecution, - ExecutionBranch: finalizedHeaderExecutionBranch, - }, - FinalityBranch: finalityBranch, - SyncAggregate: ðereumlightclient.SyncAggregate{ - SyncCommitteeBits: ethcommon.FromHex(l.Data.SyncAggregate.SyncCommitteeBits), - SyncCommitteeSignature: ethcommon.FromHex(l.Data.SyncAggregate.SyncCommitteeSignature), - }, - SignatureSlot: l.Data.SignatureSlot, - } -} - -func (b BeaconJSON) ToBeaconBlockHeader() ethereumlightclient.BeaconBlockHeader { - return ethereumlightclient.BeaconBlockHeader{ - Slot: b.Slot, - ProposerIndex: b.ProposerIndex, - ParentRoot: HexToBeBytes(b.ParentRoot), - StateRoot: HexToBeBytes(b.StateRoot), - BodyRoot: HexToBeBytes(b.BodyRoot), - } -} - -func (e ExecutionJSON) ToExecutionPayloadHeader() ethereumlightclient.ExecutionPayloadHeader { - baseFeePerGasBE := BigIntToBeBytes(big.NewInt(int64(e.BaseFeePerGas))) - - return ethereumlightclient.ExecutionPayloadHeader{ - ParentHash: ethcommon.FromHex(e.ParentHash), - FeeRecipient: ethcommon.FromHex(e.FeeRecipient), - StateRoot: HexToBeBytes(e.StateRoot), - ReceiptsRoot: ethcommon.FromHex(e.ReceiptsRoot), - LogsBloom: ethcommon.FromHex(e.LogsBloom), - PrevRandao: ethcommon.FromHex(e.PrevRandao), - BlockNumber: e.BlockNumber, - GasLimit: e.GasLimit, - GasUsed: e.GasUsed, - Timestamp: e.Timestamp, - ExtraData: ethcommon.FromHex(e.ExtraData), - BaseFeePerGas: baseFeePerGasBE[:], - BlockHash: ethcommon.FromHex(e.BlockHash), - TransactionsRoot: ethcommon.FromHex(e.TransactionsRoot), - WithdrawalsRoot: ethcommon.FromHex(e.WithdrawalsRoot), - BlobGasUsed: e.BlobGasUsed, - ExcessBlobGas: e.ExcessBlobGas, - } -} - -func (f *FinalityUpdateJSONResponse) ToLightClientUpdate() ethereumlightclient.LightClientUpdate { - attestedHeaderBeacon := f.Data.AttestedHeader.Beacon.ToBeaconBlockHeader() - attestedHeaderExecution := f.Data.AttestedHeader.Execution.ToExecutionPayloadHeader() - var attestedheaderExecutionBranch [][]byte - for _, branch := range f.Data.AttestedHeader.ExecutionBranch { - attestedheaderExecutionBranch = append(attestedheaderExecutionBranch, ethcommon.FromHex(branch)) - } - - finalizedHeaderBeacon := f.Data.FinalizedHeader.Beacon.ToBeaconBlockHeader() - finalizedHeaderExecution := f.Data.FinalizedHeader.Execution.ToExecutionPayloadHeader() - var finalizedheaderExecutionBranch [][]byte - for _, branch := range f.Data.FinalizedHeader.ExecutionBranch { - finalizedheaderExecutionBranch = append(finalizedheaderExecutionBranch, ethcommon.FromHex(branch)) - } - - var finalityBranch [][]byte - for _, branch := range f.Data.FinalityBranch { - finalityBranch = append(finalityBranch, ethcommon.FromHex(branch)) - } - - return ethereumlightclient.LightClientUpdate{ - AttestedHeader: ðereumlightclient.LightClientHeader{ - Beacon: &attestedHeaderBeacon, - Execution: &attestedHeaderExecution, - ExecutionBranch: attestedheaderExecutionBranch, - }, - FinalizedHeader: ðereumlightclient.LightClientHeader{ - Beacon: &finalizedHeaderBeacon, - Execution: &finalizedHeaderExecution, - ExecutionBranch: finalizedheaderExecutionBranch, - }, - FinalityBranch: finalityBranch, - SyncAggregate: ðereumlightclient.SyncAggregate{ - SyncCommitteeBits: ethcommon.FromHex(f.Data.SyncAggregate.SyncCommitteeBits), - SyncCommitteeSignature: ethcommon.FromHex(f.Data.SyncAggregate.SyncCommitteeSignature), - }, - SignatureSlot: f.Data.SignatureSlot, - } + Data ethereumtypes.LightClientUpdate `json:"data"` } diff --git a/e2e/interchaintestv8/ethereum/utils.go b/e2e/interchaintestv8/ethereum/utils.go index 3034061c..19aa0c7a 100644 --- a/e2e/interchaintestv8/ethereum/utils.go +++ b/e2e/interchaintestv8/ethereum/utils.go @@ -10,10 +10,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" - "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/testvalues" - ethereumligthclient "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereumlightclient" ) type ForgeScriptReturnValues struct { @@ -94,108 +91,6 @@ func GetCommitmentsStorageKey(path []byte) ethcommon.Hash { return crypto.Keccak256Hash(pathHash, paddedSlot) } -// Utility method to get JSON in a format that can be used in the Union unit tests: https://github.com/unionlabs/union/tree/main/light-clients/ethereum-light-client/src/test -func GetUnionClientStateUnitTestJSON( - ethClientState ethereumligthclient.ClientState, - spec Spec, - ics26RouterAddress string, - clientChecksum string, - latestHeight clienttypes.Height, -) string { - return fmt.Sprintf(`{ - "data": { - "chain_id": "%s", - "genesis_validators_root": "0x%s", - "min_sync_committee_participants": 0, - "genesis_time": %d, - "fork_parameters": { - "genesis_fork_version": "%s", - "genesis_slot": %d, - "altair": { - "version": "0x%s", - "epoch": %d - }, - "bellatrix": { - "version": "0x%s", - "epoch": %d - }, - "capella": { - "version": "0x%s", - "epoch": %d - }, - "deneb": { - "version": "0x%s", - "epoch": %d - } - }, - "seconds_per_slot": %d, - "slots_per_epoch": %d, - "epochs_per_sync_committee_period": %d, - "latest_slot": %d, - "frozen_height": { - "revision_number": 0, - "revision_height": 0 - }, - "ibc_commitment_slot": "0", - "ibc_contract_address": "%s" - }, - "checksum": "%s", - "latest_height": { - "revision_number": %d, - "revision_height": %d - } -}\n`, - ethClientState.ChainId, - ethcommon.Bytes2Hex(ethClientState.GenesisValidatorsRoot), - ethClientState.GenesisTime, - ethcommon.Bytes2Hex(spec.GenesisForkVersion[:]), - spec.GenesisSlot, - ethcommon.Bytes2Hex(spec.AltairForkVersion[:]), - spec.AltairForkEpoch, - ethcommon.Bytes2Hex(spec.BellatrixForkVersion[:]), - spec.BellatrixForkEpoch, - ethcommon.Bytes2Hex(spec.CapellaForkVersion[:]), - spec.CapellaForkEpoch, - ethcommon.Bytes2Hex(spec.DenebForkVersion[:]), - spec.DenebForkEpoch, - ethClientState.SecondsPerSlot, - ethClientState.SlotsPerEpoch, - ethClientState.EpochsPerSyncCommitteePeriod, - ethClientState.LatestSlot, - ics26RouterAddress, - clientChecksum, - latestHeight.RevisionNumber, - latestHeight.RevisionHeight, - ) -} - -// Utility method to get JSON in a format that can be used in the Union unit tests: https://github.com/unionlabs/union/tree/main/light-clients/ethereum-light-client/src/test -func GetUnionConsensusStateUnitTestJSON( - ethConsensusState ethereumligthclient.ConsensusState, - bootstrap Bootstrap, - proofResp EthGetProofResponse, - timestamp uint64, - clientUpdate LightClientUpdateJSON, -) string { - return fmt.Sprintf(`{ - "data": { - "slot": %d, - "state_root": "%s", - "storage_root": "%s", - "timestamp": %d, - "current_sync_committee": "%s", - "next_sync_committee": "%s" - } -}\n`, - ethConsensusState.Slot, - bootstrap.Data.Header.Execution.StateRoot, - proofResp.StorageHash, - timestamp, - bootstrap.Data.CurrentSyncCommittee.AggregatePubkey, - clientUpdate.Data.NextSyncCommittee.AggregatePubkey, - ) -} - func HexToBeBytes(hex string) []byte { bz := ethcommon.FromHex(hex) if len(bz) == 32 { diff --git a/e2e/interchaintestv8/go.mod b/e2e/interchaintestv8/go.mod index 8f65cbf5..1e58f7f0 100644 --- a/e2e/interchaintestv8/go.mod +++ b/e2e/interchaintestv8/go.mod @@ -20,7 +20,7 @@ require ( github.com/cosmos/solidity-ibc-eureka/abigen v0.0.0 github.com/docker/docker v24.0.9+incompatible github.com/ethereum/go-ethereum v1.14.12 - github.com/kurtosis-tech/kurtosis/api/golang v1.4.2 + github.com/kurtosis-tech/kurtosis/api/golang v1.4.3 github.com/rs/zerolog v1.33.0 github.com/strangelove-ventures/interchaintest/v8 v8.3.0 github.com/stretchr/testify v1.10.0 diff --git a/e2e/interchaintestv8/go.sum b/e2e/interchaintestv8/go.sum index e0fcdd6c..87c879b7 100644 --- a/e2e/interchaintestv8/go.sum +++ b/e2e/interchaintestv8/go.sum @@ -855,8 +855,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230818182330-1a86869414d2 h1:izciXrFyFR+ihJ7nLTOkoIX5GzBPIp8gVKlw94gIc98= github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230818182330-1a86869414d2/go.mod h1:bWSMQK3WHVTGHX9CjxPAb/LtzcmfOxID2wdzakSWQxo= -github.com/kurtosis-tech/kurtosis/api/golang v1.4.2 h1:x9jpXBGuLTWuILVUZWZtgDYY9amhyhzRVHxDFlYEJB4= -github.com/kurtosis-tech/kurtosis/api/golang v1.4.2/go.mod h1:9T22P7Vv3j5g6sbm78DxHQ4s9C4Cj3s9JjFQ7DFyYpM= +github.com/kurtosis-tech/kurtosis/api/golang v1.4.3 h1:CkrfwpBAOQ9TOCUrVWSv5C7d3hLBNjU4kAYSbL6EHf0= +github.com/kurtosis-tech/kurtosis/api/golang v1.4.3/go.mod h1:9T22P7Vv3j5g6sbm78DxHQ4s9C4Cj3s9JjFQ7DFyYpM= github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20230818184218-f4e3e773463b h1:hMoIM99QKcYQqsnK4AF7Lovi9ZD9ac6lZLZ5D/jx2x8= github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20230818184218-f4e3e773463b/go.mod h1:4pFdrRwDz5R+Fov2ZuTaPhAVgjA2jhGh1Izf832sX7A= github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230803130419-099ee7a4e3dc h1:7IlEpSehmWcNXOFpNP24Cu5HQI3af7GCBQw//m+LnvQ= diff --git a/e2e/interchaintestv8/ibc_eureka_test.go b/e2e/interchaintestv8/ibc_eureka_test.go index cef6c3e6..cd7d64e8 100644 --- a/e2e/interchaintestv8/ibc_eureka_test.go +++ b/e2e/interchaintestv8/ibc_eureka_test.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ecdsa" "encoding/hex" + "encoding/json" "fmt" "math/big" "os" @@ -48,7 +49,7 @@ import ( "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/testvalues" "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types" "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/erc20" - ethereumlightclient "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereumlightclient" + ethereumtypes "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereum" ) // IbcEurekaTestSuite is a suite of tests that wraps TestSuite @@ -361,7 +362,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferERC20TokenfromEthereumToCosmosAndBackT })) var sendPacket ics26router.IICS26RouterMsgsPacket - var sendBlockNumber int64 + var sendBlockNumber uint64 s.Require().True(s.Run(fmt.Sprintf("Send %d transfers on Ethereum", numOfTransfers), func() { timeout := uint64(time.Now().Add(30 * time.Minute).Unix()) transferMulticall := make([][]byte, numOfTransfers) @@ -387,7 +388,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferERC20TokenfromEthereumToCosmosAndBackT receipt := s.GetTxReciept(ctx, eth, tx.Hash()) s.Require().Equal(ethtypes.ReceiptStatusSuccessful, receipt.Status) s.T().Logf("Multicall send %d transfers gas used: %d", numOfTransfers, receipt.GasUsed) - sendBlockNumber = receipt.BlockNumber.Int64() + sendBlockNumber = receipt.BlockNumber.Uint64() sendPacketEvent, err := e2esuite.GetEvmEvent(receipt, s.ics26Contract.ParseSendPacket) s.Require().NoError(err) @@ -609,7 +610,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferERC20TokenfromEthereumToCosmosAndBackT })) })) - var recvBlockNumber int64 + var recvBlockNumber uint64 var returnWriteAckEvent *ics26router.ContractWriteAcknowledgement s.Require().True(s.Run(fmt.Sprintf("Receive %d packets on Ethereum", numOfTransfers), func() { proofPaths := make([][]byte, numOfTransfers) @@ -657,7 +658,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferERC20TokenfromEthereumToCosmosAndBackT s.Require().Equal(ethtypes.ReceiptStatusSuccessful, receipt.Status) s.T().Logf("Multicall receive %d packets gas used: %d", numOfTransfers, receipt.GasUsed) - recvBlockNumber = receipt.BlockNumber.Int64() + recvBlockNumber = receipt.BlockNumber.Uint64() if s.generateSolidityFixtures { s.Require().NoError(types.GenerateAndSaveSolidityFixture( @@ -816,7 +817,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferNativeCosmosCoinsToEthereumAndBackTest var ibcERC20 *ibcerc20.Contract var ibcERC20Address string - var recvBlockNumber int64 + var recvBlockNumber uint64 s.Require().True(s.Run("Receive packet on Ethereum", func() { packetCommitmentPath := ibchostv2.PacketCommitmentKey(sendPacket.SourceChannel, sendPacket.Sequence) proofHeight, ucAndMemProof := s.updateClientAndMembershipProof(ctx, simd, pt, [][]byte{packetCommitmentPath}) @@ -845,7 +846,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferNativeCosmosCoinsToEthereumAndBackTest s.Require().NoError(err) receipt := s.GetTxReciept(ctx, eth, tx.Hash()) s.Require().Equal(ethtypes.ReceiptStatusSuccessful, receipt.Status) - recvBlockNumber = receipt.BlockNumber.Int64() + recvBlockNumber = receipt.BlockNumber.Uint64() if s.generateSolidityFixtures { s.Require().NoError(types.GenerateAndSaveSolidityFixture(fmt.Sprintf("receiveNativePacket-%s.json", pt.String()), s.contractAddresses.Erc20, "recvPacket", msg, packet)) @@ -926,7 +927,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferNativeCosmosCoinsToEthereumAndBackTest var returnPacket ics26router.IICS26RouterMsgsPacket returnMemo := "testreturnmemo" - var sendBlockNumber int64 + var sendBlockNumber uint64 s.Require().True(s.Run("Transfer tokens back from Ethereum", func() { timeout := uint64(time.Now().Add(30 * time.Minute).Unix()) msgSendPacket := s.createICS20MsgSendPacket( @@ -944,7 +945,7 @@ func (s *IbcEurekaTestSuite) ICS20TransferNativeCosmosCoinsToEthereumAndBackTest receipt := s.GetTxReciept(ctx, eth, tx.Hash()) s.Require().Equal(ethtypes.ReceiptStatusSuccessful, receipt.Status) - sendBlockNumber = receipt.BlockNumber.Int64() + sendBlockNumber = receipt.BlockNumber.Uint64() sendPacketEvent, err := e2esuite.GetEvmEvent(receipt, s.ics26Contract.ParseSendPacket) s.Require().NoError(err) @@ -1199,37 +1200,28 @@ func (s *IbcEurekaTestSuite) getCommitmentProof(ctx context.Context, path []byte blockNumberHex := fmt.Sprintf("0x%x", s.LastEtheruemLightClientUpdate) proofResp, err := eth.EthAPI.GetProof(s.contractAddresses.IbcStore, storageKeys, blockNumberHex) s.Require().NoError(err) - - var proofBz [][]byte - for _, proofStr := range proofResp.StorageProof[0].Proof { - proofBz = append(proofBz, ethcommon.FromHex(proofStr)) - } - storageProof := ethereumlightclient.StorageProof{ - Key: ethereum.HexToBeBytes(proofResp.StorageProof[0].Key), - Value: ethereum.HexToBeBytes(proofResp.StorageProof[0].Value), - Proof: proofBz, - } + storageProof := proofResp.StorageProof[0] if s.rustFixtureGenerator.ShouldGenerateFixture() { - _, unionClientState := s.GetUnionClientState(ctx, simd, s.EthereumLightClientID) - _, unionConsensusState := s.GetUnionConsensusState(ctx, simd, s.EthereumLightClientID, clienttypes.Height{ + _, ethereumClientState := s.GetEthereumClientState(ctx, simd, s.EthereumLightClientID) + _, ethereumConsensusState := s.GetEthereumConsensusState(ctx, simd, s.EthereumLightClientID, clienttypes.Height{ RevisionNumber: 0, RevisionHeight: s.LastEtheruemLightClientUpdate, }) - s.rustFixtureGenerator.AddFixtureStep("commitment_proof", &types.CommitmentProofFixture{ - Path: path, - StorageProof: storageProof, - ProofHeight: clienttypes.Height{ - RevisionNumber: 0, - RevisionHeight: s.LastEtheruemLightClientUpdate, - }, - ClientState: unionClientState, - ConsensusState: unionConsensusState, + s.rustFixtureGenerator.AddFixtureStep("commitment_proof", ðereumtypes.CommitmentProof{ + Path: fmt.Sprintf("0x%x", path), + StorageProof: storageProof, + ProofSlot: s.LastEtheruemLightClientUpdate, + ClientState: ethereumClientState, + ConsensusState: ethereumConsensusState, }) } - return simd.Config().EncodingConfig.Codec.MustMarshal(&storageProof) + bz, err := json.Marshal(&storageProof) + s.Require().NoError(err) + + return bz } func (s *IbcEurekaTestSuite) updateClientAndMembershipProof( diff --git a/e2e/interchaintestv8/proto/buf.gen.gogo.yaml b/e2e/interchaintestv8/proto/buf.gen.gogo.yaml deleted file mode 100644 index 2492a31d..000000000 --- a/e2e/interchaintestv8/proto/buf.gen.gogo.yaml +++ /dev/null @@ -1,4 +0,0 @@ -version: v1 -plugins: - - name: gocosmos - out: .. \ No newline at end of file diff --git a/e2e/interchaintestv8/proto/buf.lock b/e2e/interchaintestv8/proto/buf.lock deleted file mode 100644 index eeef8fd4..000000000 --- a/e2e/interchaintestv8/proto/buf.lock +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: buf.build - owner: cosmos - repository: cosmos-proto - commit: 1935555c206d4afb9e94615dfd0fad31 - digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 - - remote: buf.build - owner: cosmos - repository: cosmos-sdk - commit: aa25660f4ff746388669ce36b3778442 - digest: shake256:a20eb29eb7284d9d0b76e94324a6e24e3665d13682bed0d5beac647d7109b7b2f22080301276779a91f394c97dab334da36dfc01d4252d9f869b090bfc8248aa - - remote: buf.build - owner: cosmos - repository: gogo-proto - commit: 88ef6483f90f478fb938c37dde52ece3 - digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba - - remote: buf.build - owner: cosmos - repository: ibc - commit: 41fbc441e4d645119d275150719c5441 - digest: shake256:a61d3e152909abddc91dcc1aec8ac997007bebd48a7921bc243681c708e6c9068f6484aa7ed4e6ff60101d3422c98744a4a5294bbda6aacdba07f1dfa4291020 - - remote: buf.build - owner: cosmos - repository: ics23 - commit: 55085f7c710a45f58fa09947208eb70b - digest: shake256:9bf0bc495b5a11c88d163d39ef521bc4b00bc1374a05758c91d82821bdc61f09e8c2c51dda8452529bf80137f34d852561eacbe9550a59015d51cecb0dacb628 - - remote: buf.build - owner: googleapis - repository: googleapis - commit: 8d7204855ec14631a499bd7393ce1970 - digest: shake256:40bf4112960cad01281930beed85829910768e32e80e986791596853eccd42c0cbd9d96690b918f658020d2d427e16f8b6514e2ac7f4a10306fd32e77be44329 diff --git a/e2e/interchaintestv8/proto/buf.yaml b/e2e/interchaintestv8/proto/buf.yaml deleted file mode 100644 index 652c2250..000000000 --- a/e2e/interchaintestv8/proto/buf.yaml +++ /dev/null @@ -1,18 +0,0 @@ -version: v1 -deps: - - buf.build/cosmos/gogo-proto - - buf.build/cosmos/ibc -breaking: - use: - - FILE -lint: - use: - - DEFAULT - - COMMENTS - - FILE_LOWER_SNAKE_CASE - except: - - UNARY_RPC - - COMMENT_FIELD - - SERVICE_SUFFIX - - PACKAGE_VERSION_SUFFIX - - RPC_REQUEST_STANDARD_NAME \ No newline at end of file diff --git a/e2e/interchaintestv8/proto/protocgen.sh b/e2e/interchaintestv8/proto/protocgen.sh deleted file mode 100755 index d6a196c9..000000000 --- a/e2e/interchaintestv8/proto/protocgen.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -echo "Formatting protobuf files" -find ./ -name "*.proto" -exec clang-format -i {} \; - -set -eo pipefail - -echo "Generating gogo proto code" -pwd -cd e2e/interchaintestv8/proto -proto_dirs=$(find ./union -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) -for dir in $proto_dirs; do - for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do - # this regex checks if a proto file has its go_package set to cosmossdk.io/api/... - # gogo proto files SHOULD ONLY be generated if this is false - # we don't want gogo proto to run for proto files which are natively built for google.golang.org/protobuf - if grep -q "option go_package" "$file"; then - buf generate --template buf.gen.gogo.yaml $file - fi - done -done - -cd .. - -# move proto files to the right places -# -# Note: Proto files are suffixed with the current binary version. -cp -r union/ibc/lightclients/ethereum/* ./types/ethereumlightclient -rm -rf union \ No newline at end of file diff --git a/e2e/interchaintestv8/proto/union/ibc/lightclients/ethereum/v1/ethereum.proto b/e2e/interchaintestv8/proto/union/ibc/lightclients/ethereum/v1/ethereum.proto deleted file mode 100644 index d32985ae..000000000 --- a/e2e/interchaintestv8/proto/union/ibc/lightclients/ethereum/v1/ethereum.proto +++ /dev/null @@ -1,161 +0,0 @@ -syntax = "proto3"; -package union.ibc.lightclients.ethereum.v1; - -option go_package = "union/ibc/lightclients/ethereum"; -import "ibc/core/client/v1/client.proto"; -import "ibc/lightclients/tendermint/v1/tendermint.proto"; - -// Value returned by eth_getProof -message StorageProof { - // NOTE: U256 - bytes key = 1; - // NOTE: U256 - bytes value = 2; - repeated bytes proof = 3; -} - -message AccountProof { - // NOTE: H256 - // NOTE: eth_getProof.storageHash - bytes storage_root = 1; - // NOTE: eth_getProof.accountProof - repeated bytes proof = 2; -} - -message ClientState { - string chain_id = 1; - bytes genesis_validators_root = 2; - uint64 min_sync_committee_participants = 3; - uint64 genesis_time = 4; - ForkParameters fork_parameters = 5; - uint64 seconds_per_slot = 6; - uint64 slots_per_epoch = 7; - uint64 epochs_per_sync_committee_period = 8; - uint64 latest_slot = 9; - .ibc.core.client.v1.Height frozen_height = 10; - bytes ibc_commitment_slot = 11; - bytes ibc_contract_address = 12; -} - -message ConsensusState { - uint64 slot = 1; - bytes state_root = 2; - bytes storage_root = 3; - // FIXME: isn't it already defined in ibc.lightclients.wasm.v1? - uint64 timestamp = 4; - bytes current_sync_committee = 5; - bytes next_sync_committee = 6; -} - -// TODO: This should be an enum containing either sync committee update or -// finality update. -message Header { - TrustedSyncCommittee trusted_sync_committee = 1; - LightClientUpdate consensus_update = 2; - AccountUpdate account_update = 3; -} - -message Misbehaviour { - TrustedSyncCommittee trusted_sync_committee = 1; - LightClientUpdate update_1 = 2; - LightClientUpdate update_2 = 3; -} - -message TrustedSyncCommittee { - .ibc.core.client.v1.Height trusted_height = 1; - SyncCommittee current_sync_committee = 2; - SyncCommittee next_sync_committee = 3; -} - -message ForkParameters { - bytes genesis_fork_version = 1; - uint64 genesis_slot = 2; - - Fork altair = 3; - Fork bellatrix = 4; - Fork capella = 5; - Fork deneb = 6; -} - -message Fork { - bytes version = 1; - uint64 epoch = 2; -} - -message LightClientUpdate { - LightClientHeader attested_header = 1; - SyncCommittee next_sync_committee = 2; - repeated bytes next_sync_committee_branch = 3; - LightClientHeader finalized_header = 4; - repeated bytes finality_branch = 5; - SyncAggregate sync_aggregate = 8; - uint64 signature_slot = 9; -} - -message SyncCommittee { - repeated bytes pubkeys = 1; - bytes aggregate_pubkey = 2; -} - -message SyncAggregate { - bytes sync_committee_bits = 1; - bytes sync_committee_signature = 2; -} - -message ExecutionUpdate { - bytes state_root = 1; - repeated bytes state_root_branch = 2; - uint64 block_number = 3; - repeated bytes block_number_branch = 4; -} - -message AccountUpdate { AccountProof account_proof = 1; } - -message LightClientHeader { - BeaconBlockHeader beacon = 1; - ExecutionPayloadHeader execution = 2; - repeated bytes execution_branch = 3; -} - -message ExecutionPayloadHeader { - bytes parent_hash = 1; - bytes fee_recipient = 2; - bytes state_root = 3; - bytes receipts_root = 4; - bytes logs_bloom = 5; - bytes prev_randao = 6; - uint64 block_number = 7; - uint64 gas_limit = 8; - uint64 gas_used = 9; - uint64 timestamp = 10; - bytes extra_data = 11; - // TODO(aeryz): U256 - bytes base_fee_per_gas = 12; - bytes block_hash = 13; - bytes transactions_root = 14; - bytes withdrawals_root = 15; - uint64 blob_gas_used = 16; - uint64 excess_blob_gas = 17; -} - -message BeaconBlockHeader { - uint64 slot = 1; - uint64 proposer_index = 2; - bytes parent_root = 3; - bytes state_root = 4; - bytes body_root = 5; -} - -message FinalizedHeaderMisbehaviour { - string client_id = 1; - TrustedSyncCommittee trusted_sync_committee = 2; - LightClientUpdate consensus_update_1 = 3; - LightClientUpdate consensus_update_2 = 4; -} - -message NextSyncCommitteeMisbehaviour { - string client_id = 1; - TrustedSyncCommittee trusted_sync_committee = 2; - LightClientUpdate consensus_update_1 = 3; - LightClientUpdate consensus_update_2 = 4; -} diff --git a/e2e/interchaintestv8/relayer_test.go b/e2e/interchaintestv8/relayer_test.go index 5af7142a..e4914dce 100644 --- a/e2e/interchaintestv8/relayer_test.go +++ b/e2e/interchaintestv8/relayer_test.go @@ -330,7 +330,7 @@ func (s *RelayerTestSuite) ICS20TransferERC20TokenBatchedAckTest( })) var sendPacket ics26router.IICS26RouterMsgsPacket - var sendBlockNumber int64 + var sendBlockNumber uint64 s.Require().True(s.Run(fmt.Sprintf("Send %d transfers on Ethereum", numOfTransfers), func() { timeout := uint64(time.Now().Add(30 * time.Minute).Unix()) transferMulticall := make([][]byte, numOfTransfers) @@ -356,7 +356,7 @@ func (s *RelayerTestSuite) ICS20TransferERC20TokenBatchedAckTest( receipt := s.GetTxReciept(ctx, eth, tx.Hash()) s.Require().Equal(ethtypes.ReceiptStatusSuccessful, receipt.Status) s.T().Logf("Multicall send %d transfers gas used: %d", numOfTransfers, receipt.GasUsed) - sendBlockNumber = receipt.BlockNumber.Int64() + sendBlockNumber = receipt.BlockNumber.Uint64() sendPacketEvent, err := e2esuite.GetEvmEvent(receipt, s.ics26Contract.ParseSendPacket) s.Require().NoError(err) sendPacket = sendPacketEvent.Packet diff --git a/e2e/interchaintestv8/testvalues/values.go b/e2e/interchaintestv8/testvalues/values.go index aa050c33..a544aef0 100644 --- a/e2e/interchaintestv8/testvalues/values.go +++ b/e2e/interchaintestv8/testvalues/values.go @@ -64,7 +64,7 @@ const ( // SP1ICS07FixturesDir is the directory where the SP1ICS07 fixtures are stored. SP1ICS07FixturesDir = "test/sp1-ics07/fixtures" // RustFixturesDir is the directory where the Rust fixtures are stored. - RustFixturesDir = "packages/ethereum-test-utils/src/fixtures" + RustFixturesDir = "packages/ethereum-light-client/src/test_utils/fixtures" // RelayerConfigFilePath is the path to generate the relayer config file. RelayerConfigFilePath = "programs/relayer/config.json" // E2EDeployScriptPath is the path to the E2E deploy script. diff --git a/e2e/interchaintestv8/types/ethereum/types.gen.go b/e2e/interchaintestv8/types/ethereum/types.gen.go new file mode 100644 index 000000000..67a825fe --- /dev/null +++ b/e2e/interchaintestv8/types/ethereum/types.gen.go @@ -0,0 +1,316 @@ +package ethereum + +// The Ethereum types to export to JSON Schema and used to generate types in other languages +// The structure itself is not used for anything else than being able to generate a single +// schema +type GeneratedTypes struct { + ClientState ClientState `json:"client_state"` + ConsensusState ConsensusState `json:"consensus_state"` + Header Header `json:"header"` + StorageProof StorageProof `json:"storage_proof"` + TestFixtures TestFixtures `json:"test_fixtures"` +} + +// The ethereum client state +// +// # The client state at the time of the proof +// +// # The client state at the initial state +// +// The client state after the update +type ClientState struct { + // The chain ID + ChainID uint64 `json:"chain_id"` + // The number of epochs per sync committee period + EpochsPerSyncCommitteePeriod uint64 `json:"epochs_per_sync_committee_period"` + // The fork parameters + ForkParameters ForkParameters `json:"fork_parameters"` + // The slot at which the client was frozen + FrozenSlot uint64 `json:"frozen_slot"` + // The time of genesis (unix timestamp) + GenesisTime uint64 `json:"genesis_time"` + // The genesis validators root + GenesisValidatorsRoot string `json:"genesis_validators_root"` + // The storage slot of the IBC commitment in the Ethereum contract + IbcCommitmentSlot string `json:"ibc_commitment_slot"` + // The address of the IBC contract being tracked on Ethereum + IbcContractAddress string `json:"ibc_contract_address"` + // The latest slot of this client + LatestSlot uint64 `json:"latest_slot"` + // The minimum number of participants in the sync committee + MinSyncCommitteeParticipants uint64 `json:"min_sync_committee_participants"` + // The slot duration in seconds + SecondsPerSlot uint64 `json:"seconds_per_slot"` + // The number of slots per epoch + SlotsPerEpoch uint64 `json:"slots_per_epoch"` +} + +// The fork parameters +type ForkParameters struct { + // The altair fork + Altair Fork `json:"altair"` + // The bellatrix fork + Bellatrix Fork `json:"bellatrix"` + // The capella fork + Capella Fork `json:"capella"` + // The deneb fork + Deneb Fork `json:"deneb"` + // The genesis fork version + GenesisForkVersion string `json:"genesis_fork_version"` + // The genesis slot + GenesisSlot uint64 `json:"genesis_slot"` +} + +// The altair fork +// +// # The fork data +// +// # The bellatrix fork +// +// # The capella fork +// +// The deneb fork +type Fork struct { + // The epoch at which this fork is activated + Epoch uint64 `json:"epoch"` + // The version of the fork + Version string `json:"version"` +} + +// The consensus state of the Ethereum light client +// +// # The consensus state at the time of the proof +// +// # The consensus state at the initial state +// +// The consensus state after the update +type ConsensusState struct { + // aggregate public key of current sync committee + CurrentSyncCommittee string `json:"current_sync_committee"` + // aggregate public key of next sync committee + NextSyncCommittee string `json:"next_sync_committee"` + // The slot number + Slot uint64 `json:"slot"` + // The state merkle root + StateRoot string `json:"state_root"` + // The storage merkle root + StorageRoot string `json:"storage_root"` + // The unix timestamp at the time of the slot. It is calculated from the genesis time and + // slots per. + Timestamp uint64 `json:"timestamp"` +} + +// The header of a light client update +type Header struct { + // The account update + AccountUpdate AccountUpdate `json:"account_update"` + // The consensus update + ConsensusUpdate LightClientUpdate `json:"consensus_update"` + // The trusted sync committee + TrustedSyncCommittee TrustedSyncCommittee `json:"trusted_sync_committee"` +} + +// The account update +type AccountUpdate struct { + // The account proof + AccountProof AccountProof `json:"account_proof"` +} + +// The account proof +type AccountProof struct { + // The account proof + Proof []string `json:"proof"` + // The account storage root + StorageRoot string `json:"storage_root"` +} + +// The consensus update +// +// A light client update +type LightClientUpdate struct { + // Header attested to by the sync committee + AttestedHeader LightClientHeader `json:"attested_header"` + // Branch of the finalized header + FinalityBranch []string `json:"finality_branch"` + // Finalized header corresponding to `attested_header.state_root` + FinalizedHeader LightClientHeader `json:"finalized_header"` + // Next sync committee corresponding to `attested_header.state_root` + NextSyncCommittee *SyncCommittee `json:"next_sync_committee"` + // The branch of the next sync committee + NextSyncCommitteeBranch []string `json:"next_sync_committee_branch"` + // Slot at which the aggregate signature was created (untrusted) + SignatureSlot string `json:"signature_slot"` + // Sync committee aggregate signature + SyncAggregate SyncAggregate `json:"sync_aggregate"` +} + +// Header attested to by the sync committee +// +// # The header of a light client +// +// Finalized header corresponding to `attested_header.state_root` +type LightClientHeader struct { + // The beacon block header + Beacon BeaconBlockHeader `json:"beacon"` + // The execution payload header + Execution ExecutionPayloadHeader `json:"execution"` + // The execution branch + ExecutionBranch []string `json:"execution_branch"` +} + +// The beacon block header +type BeaconBlockHeader struct { + // The tree hash merkle root of the `BeaconBlockBody` for the `BeaconBlock` + BodyRoot string `json:"body_root"` + // The signing merkle root of the parent `BeaconBlock` + ParentRoot string `json:"parent_root"` + // The index of validator in validator registry + ProposerIndex string `json:"proposer_index"` + // The slot to which this block corresponds + Slot string `json:"slot"` + // The tree hash merkle root of the `BeaconState` for the `BeaconBlock` + StateRoot string `json:"state_root"` +} + +// The execution payload header +// +// Header to track the execution block +type ExecutionPayloadHeader struct { + // Block base fee per gas + BaseFeePerGas string `json:"base_fee_per_gas"` + // Blob gas used (new in Deneb) + BlobGasUsed string `json:"blob_gas_used"` + // The block hash + BlockHash string `json:"block_hash"` + // The block number of the execution payload + BlockNumber string `json:"block_number"` + // Excess blob gas (new in Deneb) + ExcessBlobGas string `json:"excess_blob_gas"` + // The extra data of the execution payload + ExtraData string `json:"extra_data"` + // Block fee recipient + FeeRecipient string `json:"fee_recipient"` + // Execution block gas limit + GasLimit string `json:"gas_limit"` + // Execution block gas used + GasUsed string `json:"gas_used"` + // The logs bloom filter + LogsBloom string `json:"logs_bloom"` + // The parent hash of the execution payload header + ParentHash string `json:"parent_hash"` + // The previous Randao value, used to compute the randomness on the execution layer. + PrevRandao string `json:"prev_randao"` + // The root of the receipts trie + ReceiptsRoot string `json:"receipts_root"` + // The state root + StateRoot string `json:"state_root"` + // The timestamp of the execution payload + Timestamp string `json:"timestamp"` + // SSZ hash tree root of the transaction list + TransactionsRoot string `json:"transactions_root"` + // Tree root of the withdrawals list + WithdrawalsRoot string `json:"withdrawals_root"` +} + +// The sync committee data +type SyncCommittee struct { + // The aggregate public key of the sync committee + AggregatePubkey string `json:"aggregate_pubkey"` + // The public keys of the sync committee + Pubkeys []string `json:"pubkeys"` +} + +// Sync committee aggregate signature +// +// The sync committee aggregate +type SyncAggregate struct { + // The bits representing the sync committee's participation. + SyncCommitteeBits string `json:"sync_committee_bits"` + // The aggregated signature of the sync committee. + SyncCommitteeSignature string `json:"sync_committee_signature"` +} + +// The trusted sync committee +type TrustedSyncCommittee struct { + // The current sync committee + SyncCommittee ActiveSyncCommittee `json:"sync_committee"` + // The trusted slot + TrustedSlot uint64 `json:"trusted_slot"` +} + +// The current sync committee +// +// # The active sync committee +// +// The next sync committee +type ActiveSyncCommittee struct { + Current *SyncCommittee `json:"Current,omitempty"` + Next *SyncCommittee `json:"Next,omitempty"` +} + +// The key-value storage proof for a smart contract account +// +// The storage proof used to verify membership +type StorageProof struct { + // The key of the storage + Key string `json:"key"` + // The proof of the storage + Proof []string `json:"proof"` + // The value of the storage + Value string `json:"value"` +} + +type TestFixtures struct { + CommitmentProof CommitmentProof `json:"commitment_proof"` + InitialState InitialState `json:"initial_state"` + Step Step `json:"step"` + StepsFixture StepsFixture `json:"steps_fixture"` + UpdateClient UpdateClient `json:"update_client"` +} + +// The proof used to verify membership +type CommitmentProof struct { + // The client state at the time of the proof + ClientState ClientState `json:"client_state"` + // The consensus state at the time of the proof + ConsensusState ConsensusState `json:"consensus_state"` + // The IBC path sent to verify membership + Path string `json:"path"` + // The slot of the proof (ibc height) + ProofSlot uint64 `json:"proof_slot"` + // The storage proof used to verify membership + StorageProof StorageProof `json:"storage_proof"` +} + +// The initial state of the light client in the e2e tests +type InitialState struct { + // The client state at the initial state + ClientState ClientState `json:"client_state"` + // The consensus state at the initial state + ConsensusState ConsensusState `json:"consensus_state"` +} + +// Step is a light client operation such as an initial state, commitment proof, or update +// client +type Step struct { + // data is the operation data as a JSON object to be deserialized into the appropriate type + Data interface{} `json:"data"` + // name is the name of the operation, only used for documentation and easy of reading + Name string `json:"name"` +} + +// A test fixture with an ordered list of light client operations from the e2e test +type StepsFixture struct { + // steps is a list of light client operations + Steps []Step `json:"steps"` +} + +// Operation to update the light client +type UpdateClient struct { + // The client state after the update + ClientState ClientState `json:"client_state"` + // The consensus state after the update + ConsensusState ConsensusState `json:"consensus_state"` + // The headers used to update the light client, in order + Updates []Header `json:"updates"` +} diff --git a/e2e/interchaintestv8/types/ethereum/types.go b/e2e/interchaintestv8/types/ethereum/types.go new file mode 100644 index 000000000..050039a9 --- /dev/null +++ b/e2e/interchaintestv8/types/ethereum/types.go @@ -0,0 +1,21 @@ +package ethereum + +import "strconv" + +func (h BeaconBlockHeader) GetSlot() uint64 { + slot, err := strconv.ParseUint(h.Slot, 0, 0) + if err != nil { + panic(err) + } + + return slot +} + +func (u LightClientUpdate) GetSignatureSlot() uint64 { + slot, err := strconv.ParseUint(u.SignatureSlot, 0, 0) + if err != nil { + panic(err) + } + + return slot +} diff --git a/e2e/interchaintestv8/types/ethereumlightclient/ethereum.pb.go b/e2e/interchaintestv8/types/ethereumlightclient/ethereum.pb.go deleted file mode 100644 index 7f014180..000000000 --- a/e2e/interchaintestv8/types/ethereumlightclient/ethereum.pb.go +++ /dev/null @@ -1,7085 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: union/ibc/lightclients/ethereum/v1/ethereum.proto - -package ethereum - -import ( - fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" - _ "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Value returned by eth_getProof -type StorageProof struct { - // NOTE: U256 - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // NOTE: U256 - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Proof [][]byte `protobuf:"bytes,3,rep,name=proof,proto3" json:"proof,omitempty"` -} - -func (m *StorageProof) Reset() { *m = StorageProof{} } -func (m *StorageProof) String() string { return proto.CompactTextString(m) } -func (*StorageProof) ProtoMessage() {} -func (*StorageProof) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{0} -} -func (m *StorageProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StorageProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StorageProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *StorageProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageProof.Merge(m, src) -} -func (m *StorageProof) XXX_Size() int { - return m.Size() -} -func (m *StorageProof) XXX_DiscardUnknown() { - xxx_messageInfo_StorageProof.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageProof proto.InternalMessageInfo - -func (m *StorageProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *StorageProof) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *StorageProof) GetProof() [][]byte { - if m != nil { - return m.Proof - } - return nil -} - -type AccountProof struct { - // NOTE: H256 - // NOTE: eth_getProof.storageHash - StorageRoot []byte `protobuf:"bytes,1,opt,name=storage_root,json=storageRoot,proto3" json:"storage_root,omitempty"` - // NOTE: eth_getProof.accountProof - Proof [][]byte `protobuf:"bytes,2,rep,name=proof,proto3" json:"proof,omitempty"` -} - -func (m *AccountProof) Reset() { *m = AccountProof{} } -func (m *AccountProof) String() string { return proto.CompactTextString(m) } -func (*AccountProof) ProtoMessage() {} -func (*AccountProof) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{1} -} -func (m *AccountProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AccountProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AccountProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AccountProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccountProof.Merge(m, src) -} -func (m *AccountProof) XXX_Size() int { - return m.Size() -} -func (m *AccountProof) XXX_DiscardUnknown() { - xxx_messageInfo_AccountProof.DiscardUnknown(m) -} - -var xxx_messageInfo_AccountProof proto.InternalMessageInfo - -func (m *AccountProof) GetStorageRoot() []byte { - if m != nil { - return m.StorageRoot - } - return nil -} - -func (m *AccountProof) GetProof() [][]byte { - if m != nil { - return m.Proof - } - return nil -} - -type ClientState struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - GenesisValidatorsRoot []byte `protobuf:"bytes,2,opt,name=genesis_validators_root,json=genesisValidatorsRoot,proto3" json:"genesis_validators_root,omitempty"` - MinSyncCommitteeParticipants uint64 `protobuf:"varint,3,opt,name=min_sync_committee_participants,json=minSyncCommitteeParticipants,proto3" json:"min_sync_committee_participants,omitempty"` - GenesisTime uint64 `protobuf:"varint,4,opt,name=genesis_time,json=genesisTime,proto3" json:"genesis_time,omitempty"` - ForkParameters *ForkParameters `protobuf:"bytes,5,opt,name=fork_parameters,json=forkParameters,proto3" json:"fork_parameters,omitempty"` - SecondsPerSlot uint64 `protobuf:"varint,6,opt,name=seconds_per_slot,json=secondsPerSlot,proto3" json:"seconds_per_slot,omitempty"` - SlotsPerEpoch uint64 `protobuf:"varint,7,opt,name=slots_per_epoch,json=slotsPerEpoch,proto3" json:"slots_per_epoch,omitempty"` - EpochsPerSyncCommitteePeriod uint64 `protobuf:"varint,8,opt,name=epochs_per_sync_committee_period,json=epochsPerSyncCommitteePeriod,proto3" json:"epochs_per_sync_committee_period,omitempty"` - LatestSlot uint64 `protobuf:"varint,9,opt,name=latest_slot,json=latestSlot,proto3" json:"latest_slot,omitempty"` - FrozenHeight *types.Height `protobuf:"bytes,10,opt,name=frozen_height,json=frozenHeight,proto3" json:"frozen_height,omitempty"` - IbcCommitmentSlot []byte `protobuf:"bytes,11,opt,name=ibc_commitment_slot,json=ibcCommitmentSlot,proto3" json:"ibc_commitment_slot,omitempty"` - IbcContractAddress []byte `protobuf:"bytes,12,opt,name=ibc_contract_address,json=ibcContractAddress,proto3" json:"ibc_contract_address,omitempty"` -} - -func (m *ClientState) Reset() { *m = ClientState{} } -func (m *ClientState) String() string { return proto.CompactTextString(m) } -func (*ClientState) ProtoMessage() {} -func (*ClientState) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{2} -} -func (m *ClientState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClientState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ClientState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientState.Merge(m, src) -} -func (m *ClientState) XXX_Size() int { - return m.Size() -} -func (m *ClientState) XXX_DiscardUnknown() { - xxx_messageInfo_ClientState.DiscardUnknown(m) -} - -var xxx_messageInfo_ClientState proto.InternalMessageInfo - -func (m *ClientState) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ClientState) GetGenesisValidatorsRoot() []byte { - if m != nil { - return m.GenesisValidatorsRoot - } - return nil -} - -func (m *ClientState) GetMinSyncCommitteeParticipants() uint64 { - if m != nil { - return m.MinSyncCommitteeParticipants - } - return 0 -} - -func (m *ClientState) GetGenesisTime() uint64 { - if m != nil { - return m.GenesisTime - } - return 0 -} - -func (m *ClientState) GetForkParameters() *ForkParameters { - if m != nil { - return m.ForkParameters - } - return nil -} - -func (m *ClientState) GetSecondsPerSlot() uint64 { - if m != nil { - return m.SecondsPerSlot - } - return 0 -} - -func (m *ClientState) GetSlotsPerEpoch() uint64 { - if m != nil { - return m.SlotsPerEpoch - } - return 0 -} - -func (m *ClientState) GetEpochsPerSyncCommitteePeriod() uint64 { - if m != nil { - return m.EpochsPerSyncCommitteePeriod - } - return 0 -} - -func (m *ClientState) GetLatestSlot() uint64 { - if m != nil { - return m.LatestSlot - } - return 0 -} - -func (m *ClientState) GetFrozenHeight() *types.Height { - if m != nil { - return m.FrozenHeight - } - return nil -} - -func (m *ClientState) GetIbcCommitmentSlot() []byte { - if m != nil { - return m.IbcCommitmentSlot - } - return nil -} - -func (m *ClientState) GetIbcContractAddress() []byte { - if m != nil { - return m.IbcContractAddress - } - return nil -} - -type ConsensusState struct { - Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` - StateRoot []byte `protobuf:"bytes,2,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` - StorageRoot []byte `protobuf:"bytes,3,opt,name=storage_root,json=storageRoot,proto3" json:"storage_root,omitempty"` - // FIXME: isn't it already defined in ibc.lightclients.wasm.v1? - Timestamp uint64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - CurrentSyncCommittee []byte `protobuf:"bytes,5,opt,name=current_sync_committee,json=currentSyncCommittee,proto3" json:"current_sync_committee,omitempty"` - NextSyncCommittee []byte `protobuf:"bytes,6,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"` -} - -func (m *ConsensusState) Reset() { *m = ConsensusState{} } -func (m *ConsensusState) String() string { return proto.CompactTextString(m) } -func (*ConsensusState) ProtoMessage() {} -func (*ConsensusState) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{3} -} -func (m *ConsensusState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConsensusState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ConsensusState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsensusState.Merge(m, src) -} -func (m *ConsensusState) XXX_Size() int { - return m.Size() -} -func (m *ConsensusState) XXX_DiscardUnknown() { - xxx_messageInfo_ConsensusState.DiscardUnknown(m) -} - -var xxx_messageInfo_ConsensusState proto.InternalMessageInfo - -func (m *ConsensusState) GetSlot() uint64 { - if m != nil { - return m.Slot - } - return 0 -} - -func (m *ConsensusState) GetStateRoot() []byte { - if m != nil { - return m.StateRoot - } - return nil -} - -func (m *ConsensusState) GetStorageRoot() []byte { - if m != nil { - return m.StorageRoot - } - return nil -} - -func (m *ConsensusState) GetTimestamp() uint64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -func (m *ConsensusState) GetCurrentSyncCommittee() []byte { - if m != nil { - return m.CurrentSyncCommittee - } - return nil -} - -func (m *ConsensusState) GetNextSyncCommittee() []byte { - if m != nil { - return m.NextSyncCommittee - } - return nil -} - -// TODO: This should be an enum containing either sync committee update or -// finality update. -type Header struct { - TrustedSyncCommittee *TrustedSyncCommittee `protobuf:"bytes,1,opt,name=trusted_sync_committee,json=trustedSyncCommittee,proto3" json:"trusted_sync_committee,omitempty"` - ConsensusUpdate *LightClientUpdate `protobuf:"bytes,2,opt,name=consensus_update,json=consensusUpdate,proto3" json:"consensus_update,omitempty"` - AccountUpdate *AccountUpdate `protobuf:"bytes,3,opt,name=account_update,json=accountUpdate,proto3" json:"account_update,omitempty"` -} - -func (m *Header) Reset() { *m = Header{} } -func (m *Header) String() string { return proto.CompactTextString(m) } -func (*Header) ProtoMessage() {} -func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{4} -} -func (m *Header) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Header.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(m, src) -} -func (m *Header) XXX_Size() int { - return m.Size() -} -func (m *Header) XXX_DiscardUnknown() { - xxx_messageInfo_Header.DiscardUnknown(m) -} - -var xxx_messageInfo_Header proto.InternalMessageInfo - -func (m *Header) GetTrustedSyncCommittee() *TrustedSyncCommittee { - if m != nil { - return m.TrustedSyncCommittee - } - return nil -} - -func (m *Header) GetConsensusUpdate() *LightClientUpdate { - if m != nil { - return m.ConsensusUpdate - } - return nil -} - -func (m *Header) GetAccountUpdate() *AccountUpdate { - if m != nil { - return m.AccountUpdate - } - return nil -} - -type Misbehaviour struct { - TrustedSyncCommittee *TrustedSyncCommittee `protobuf:"bytes,1,opt,name=trusted_sync_committee,json=trustedSyncCommittee,proto3" json:"trusted_sync_committee,omitempty"` - Update_1 *LightClientUpdate `protobuf:"bytes,2,opt,name=update_1,json=update1,proto3" json:"update_1,omitempty"` - Update_2 *LightClientUpdate `protobuf:"bytes,3,opt,name=update_2,json=update2,proto3" json:"update_2,omitempty"` -} - -func (m *Misbehaviour) Reset() { *m = Misbehaviour{} } -func (m *Misbehaviour) String() string { return proto.CompactTextString(m) } -func (*Misbehaviour) ProtoMessage() {} -func (*Misbehaviour) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{5} -} -func (m *Misbehaviour) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Misbehaviour.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Misbehaviour) XXX_Merge(src proto.Message) { - xxx_messageInfo_Misbehaviour.Merge(m, src) -} -func (m *Misbehaviour) XXX_Size() int { - return m.Size() -} -func (m *Misbehaviour) XXX_DiscardUnknown() { - xxx_messageInfo_Misbehaviour.DiscardUnknown(m) -} - -var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo - -func (m *Misbehaviour) GetTrustedSyncCommittee() *TrustedSyncCommittee { - if m != nil { - return m.TrustedSyncCommittee - } - return nil -} - -func (m *Misbehaviour) GetUpdate_1() *LightClientUpdate { - if m != nil { - return m.Update_1 - } - return nil -} - -func (m *Misbehaviour) GetUpdate_2() *LightClientUpdate { - if m != nil { - return m.Update_2 - } - return nil -} - -type TrustedSyncCommittee struct { - TrustedHeight *types.Height `protobuf:"bytes,1,opt,name=trusted_height,json=trustedHeight,proto3" json:"trusted_height,omitempty"` - CurrentSyncCommittee *SyncCommittee `protobuf:"bytes,2,opt,name=current_sync_committee,json=currentSyncCommittee,proto3" json:"current_sync_committee,omitempty"` - NextSyncCommittee *SyncCommittee `protobuf:"bytes,3,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"` -} - -func (m *TrustedSyncCommittee) Reset() { *m = TrustedSyncCommittee{} } -func (m *TrustedSyncCommittee) String() string { return proto.CompactTextString(m) } -func (*TrustedSyncCommittee) ProtoMessage() {} -func (*TrustedSyncCommittee) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{6} -} -func (m *TrustedSyncCommittee) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TrustedSyncCommittee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TrustedSyncCommittee.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TrustedSyncCommittee) XXX_Merge(src proto.Message) { - xxx_messageInfo_TrustedSyncCommittee.Merge(m, src) -} -func (m *TrustedSyncCommittee) XXX_Size() int { - return m.Size() -} -func (m *TrustedSyncCommittee) XXX_DiscardUnknown() { - xxx_messageInfo_TrustedSyncCommittee.DiscardUnknown(m) -} - -var xxx_messageInfo_TrustedSyncCommittee proto.InternalMessageInfo - -func (m *TrustedSyncCommittee) GetTrustedHeight() *types.Height { - if m != nil { - return m.TrustedHeight - } - return nil -} - -func (m *TrustedSyncCommittee) GetCurrentSyncCommittee() *SyncCommittee { - if m != nil { - return m.CurrentSyncCommittee - } - return nil -} - -func (m *TrustedSyncCommittee) GetNextSyncCommittee() *SyncCommittee { - if m != nil { - return m.NextSyncCommittee - } - return nil -} - -type ForkParameters struct { - GenesisForkVersion []byte `protobuf:"bytes,1,opt,name=genesis_fork_version,json=genesisForkVersion,proto3" json:"genesis_fork_version,omitempty"` - GenesisSlot uint64 `protobuf:"varint,2,opt,name=genesis_slot,json=genesisSlot,proto3" json:"genesis_slot,omitempty"` - Altair *Fork `protobuf:"bytes,3,opt,name=altair,proto3" json:"altair,omitempty"` - Bellatrix *Fork `protobuf:"bytes,4,opt,name=bellatrix,proto3" json:"bellatrix,omitempty"` - Capella *Fork `protobuf:"bytes,5,opt,name=capella,proto3" json:"capella,omitempty"` - Deneb *Fork `protobuf:"bytes,6,opt,name=deneb,proto3" json:"deneb,omitempty"` -} - -func (m *ForkParameters) Reset() { *m = ForkParameters{} } -func (m *ForkParameters) String() string { return proto.CompactTextString(m) } -func (*ForkParameters) ProtoMessage() {} -func (*ForkParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{7} -} -func (m *ForkParameters) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ForkParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ForkParameters.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ForkParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_ForkParameters.Merge(m, src) -} -func (m *ForkParameters) XXX_Size() int { - return m.Size() -} -func (m *ForkParameters) XXX_DiscardUnknown() { - xxx_messageInfo_ForkParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_ForkParameters proto.InternalMessageInfo - -func (m *ForkParameters) GetGenesisForkVersion() []byte { - if m != nil { - return m.GenesisForkVersion - } - return nil -} - -func (m *ForkParameters) GetGenesisSlot() uint64 { - if m != nil { - return m.GenesisSlot - } - return 0 -} - -func (m *ForkParameters) GetAltair() *Fork { - if m != nil { - return m.Altair - } - return nil -} - -func (m *ForkParameters) GetBellatrix() *Fork { - if m != nil { - return m.Bellatrix - } - return nil -} - -func (m *ForkParameters) GetCapella() *Fork { - if m != nil { - return m.Capella - } - return nil -} - -func (m *ForkParameters) GetDeneb() *Fork { - if m != nil { - return m.Deneb - } - return nil -} - -type Fork struct { - Version []byte `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` -} - -func (m *Fork) Reset() { *m = Fork{} } -func (m *Fork) String() string { return proto.CompactTextString(m) } -func (*Fork) ProtoMessage() {} -func (*Fork) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{8} -} -func (m *Fork) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Fork) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Fork.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Fork) XXX_Merge(src proto.Message) { - xxx_messageInfo_Fork.Merge(m, src) -} -func (m *Fork) XXX_Size() int { - return m.Size() -} -func (m *Fork) XXX_DiscardUnknown() { - xxx_messageInfo_Fork.DiscardUnknown(m) -} - -var xxx_messageInfo_Fork proto.InternalMessageInfo - -func (m *Fork) GetVersion() []byte { - if m != nil { - return m.Version - } - return nil -} - -func (m *Fork) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -type LightClientUpdate struct { - AttestedHeader *LightClientHeader `protobuf:"bytes,1,opt,name=attested_header,json=attestedHeader,proto3" json:"attested_header,omitempty"` - NextSyncCommittee *SyncCommittee `protobuf:"bytes,2,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"` - NextSyncCommitteeBranch [][]byte `protobuf:"bytes,3,rep,name=next_sync_committee_branch,json=nextSyncCommitteeBranch,proto3" json:"next_sync_committee_branch,omitempty"` - FinalizedHeader *LightClientHeader `protobuf:"bytes,4,opt,name=finalized_header,json=finalizedHeader,proto3" json:"finalized_header,omitempty"` - FinalityBranch [][]byte `protobuf:"bytes,5,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty"` - SyncAggregate *SyncAggregate `protobuf:"bytes,8,opt,name=sync_aggregate,json=syncAggregate,proto3" json:"sync_aggregate,omitempty"` - SignatureSlot uint64 `protobuf:"varint,9,opt,name=signature_slot,json=signatureSlot,proto3" json:"signature_slot,omitempty"` -} - -func (m *LightClientUpdate) Reset() { *m = LightClientUpdate{} } -func (m *LightClientUpdate) String() string { return proto.CompactTextString(m) } -func (*LightClientUpdate) ProtoMessage() {} -func (*LightClientUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{9} -} -func (m *LightClientUpdate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LightClientUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LightClientUpdate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LightClientUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_LightClientUpdate.Merge(m, src) -} -func (m *LightClientUpdate) XXX_Size() int { - return m.Size() -} -func (m *LightClientUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_LightClientUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_LightClientUpdate proto.InternalMessageInfo - -func (m *LightClientUpdate) GetAttestedHeader() *LightClientHeader { - if m != nil { - return m.AttestedHeader - } - return nil -} - -func (m *LightClientUpdate) GetNextSyncCommittee() *SyncCommittee { - if m != nil { - return m.NextSyncCommittee - } - return nil -} - -func (m *LightClientUpdate) GetNextSyncCommitteeBranch() [][]byte { - if m != nil { - return m.NextSyncCommitteeBranch - } - return nil -} - -func (m *LightClientUpdate) GetFinalizedHeader() *LightClientHeader { - if m != nil { - return m.FinalizedHeader - } - return nil -} - -func (m *LightClientUpdate) GetFinalityBranch() [][]byte { - if m != nil { - return m.FinalityBranch - } - return nil -} - -func (m *LightClientUpdate) GetSyncAggregate() *SyncAggregate { - if m != nil { - return m.SyncAggregate - } - return nil -} - -func (m *LightClientUpdate) GetSignatureSlot() uint64 { - if m != nil { - return m.SignatureSlot - } - return 0 -} - -type SyncCommittee struct { - Pubkeys [][]byte `protobuf:"bytes,1,rep,name=pubkeys,proto3" json:"pubkeys,omitempty"` - AggregatePubkey []byte `protobuf:"bytes,2,opt,name=aggregate_pubkey,json=aggregatePubkey,proto3" json:"aggregate_pubkey,omitempty"` -} - -func (m *SyncCommittee) Reset() { *m = SyncCommittee{} } -func (m *SyncCommittee) String() string { return proto.CompactTextString(m) } -func (*SyncCommittee) ProtoMessage() {} -func (*SyncCommittee) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{10} -} -func (m *SyncCommittee) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncCommittee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncCommittee.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SyncCommittee) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncCommittee.Merge(m, src) -} -func (m *SyncCommittee) XXX_Size() int { - return m.Size() -} -func (m *SyncCommittee) XXX_DiscardUnknown() { - xxx_messageInfo_SyncCommittee.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncCommittee proto.InternalMessageInfo - -func (m *SyncCommittee) GetPubkeys() [][]byte { - if m != nil { - return m.Pubkeys - } - return nil -} - -func (m *SyncCommittee) GetAggregatePubkey() []byte { - if m != nil { - return m.AggregatePubkey - } - return nil -} - -type SyncAggregate struct { - SyncCommitteeBits []byte `protobuf:"bytes,1,opt,name=sync_committee_bits,json=syncCommitteeBits,proto3" json:"sync_committee_bits,omitempty"` - SyncCommitteeSignature []byte `protobuf:"bytes,2,opt,name=sync_committee_signature,json=syncCommitteeSignature,proto3" json:"sync_committee_signature,omitempty"` -} - -func (m *SyncAggregate) Reset() { *m = SyncAggregate{} } -func (m *SyncAggregate) String() string { return proto.CompactTextString(m) } -func (*SyncAggregate) ProtoMessage() {} -func (*SyncAggregate) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{11} -} -func (m *SyncAggregate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncAggregate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncAggregate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SyncAggregate) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncAggregate.Merge(m, src) -} -func (m *SyncAggregate) XXX_Size() int { - return m.Size() -} -func (m *SyncAggregate) XXX_DiscardUnknown() { - xxx_messageInfo_SyncAggregate.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncAggregate proto.InternalMessageInfo - -func (m *SyncAggregate) GetSyncCommitteeBits() []byte { - if m != nil { - return m.SyncCommitteeBits - } - return nil -} - -func (m *SyncAggregate) GetSyncCommitteeSignature() []byte { - if m != nil { - return m.SyncCommitteeSignature - } - return nil -} - -type ExecutionUpdate struct { - StateRoot []byte `protobuf:"bytes,1,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` - StateRootBranch [][]byte `protobuf:"bytes,2,rep,name=state_root_branch,json=stateRootBranch,proto3" json:"state_root_branch,omitempty"` - BlockNumber uint64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - BlockNumberBranch [][]byte `protobuf:"bytes,4,rep,name=block_number_branch,json=blockNumberBranch,proto3" json:"block_number_branch,omitempty"` -} - -func (m *ExecutionUpdate) Reset() { *m = ExecutionUpdate{} } -func (m *ExecutionUpdate) String() string { return proto.CompactTextString(m) } -func (*ExecutionUpdate) ProtoMessage() {} -func (*ExecutionUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{12} -} -func (m *ExecutionUpdate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExecutionUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExecutionUpdate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ExecutionUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExecutionUpdate.Merge(m, src) -} -func (m *ExecutionUpdate) XXX_Size() int { - return m.Size() -} -func (m *ExecutionUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_ExecutionUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_ExecutionUpdate proto.InternalMessageInfo - -func (m *ExecutionUpdate) GetStateRoot() []byte { - if m != nil { - return m.StateRoot - } - return nil -} - -func (m *ExecutionUpdate) GetStateRootBranch() [][]byte { - if m != nil { - return m.StateRootBranch - } - return nil -} - -func (m *ExecutionUpdate) GetBlockNumber() uint64 { - if m != nil { - return m.BlockNumber - } - return 0 -} - -func (m *ExecutionUpdate) GetBlockNumberBranch() [][]byte { - if m != nil { - return m.BlockNumberBranch - } - return nil -} - -type AccountUpdate struct { - AccountProof *AccountProof `protobuf:"bytes,1,opt,name=account_proof,json=accountProof,proto3" json:"account_proof,omitempty"` -} - -func (m *AccountUpdate) Reset() { *m = AccountUpdate{} } -func (m *AccountUpdate) String() string { return proto.CompactTextString(m) } -func (*AccountUpdate) ProtoMessage() {} -func (*AccountUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{13} -} -func (m *AccountUpdate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AccountUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AccountUpdate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AccountUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccountUpdate.Merge(m, src) -} -func (m *AccountUpdate) XXX_Size() int { - return m.Size() -} -func (m *AccountUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_AccountUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_AccountUpdate proto.InternalMessageInfo - -func (m *AccountUpdate) GetAccountProof() *AccountProof { - if m != nil { - return m.AccountProof - } - return nil -} - -type LightClientHeader struct { - Beacon *BeaconBlockHeader `protobuf:"bytes,1,opt,name=beacon,proto3" json:"beacon,omitempty"` - Execution *ExecutionPayloadHeader `protobuf:"bytes,2,opt,name=execution,proto3" json:"execution,omitempty"` - ExecutionBranch [][]byte `protobuf:"bytes,3,rep,name=execution_branch,json=executionBranch,proto3" json:"execution_branch,omitempty"` -} - -func (m *LightClientHeader) Reset() { *m = LightClientHeader{} } -func (m *LightClientHeader) String() string { return proto.CompactTextString(m) } -func (*LightClientHeader) ProtoMessage() {} -func (*LightClientHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{14} -} -func (m *LightClientHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LightClientHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LightClientHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *LightClientHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_LightClientHeader.Merge(m, src) -} -func (m *LightClientHeader) XXX_Size() int { - return m.Size() -} -func (m *LightClientHeader) XXX_DiscardUnknown() { - xxx_messageInfo_LightClientHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_LightClientHeader proto.InternalMessageInfo - -func (m *LightClientHeader) GetBeacon() *BeaconBlockHeader { - if m != nil { - return m.Beacon - } - return nil -} - -func (m *LightClientHeader) GetExecution() *ExecutionPayloadHeader { - if m != nil { - return m.Execution - } - return nil -} - -func (m *LightClientHeader) GetExecutionBranch() [][]byte { - if m != nil { - return m.ExecutionBranch - } - return nil -} - -type ExecutionPayloadHeader struct { - ParentHash []byte `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` - FeeRecipient []byte `protobuf:"bytes,2,opt,name=fee_recipient,json=feeRecipient,proto3" json:"fee_recipient,omitempty"` - StateRoot []byte `protobuf:"bytes,3,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` - ReceiptsRoot []byte `protobuf:"bytes,4,opt,name=receipts_root,json=receiptsRoot,proto3" json:"receipts_root,omitempty"` - LogsBloom []byte `protobuf:"bytes,5,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom,omitempty"` - PrevRandao []byte `protobuf:"bytes,6,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty"` - BlockNumber uint64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - GasLimit uint64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` - GasUsed uint64 `protobuf:"varint,9,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - Timestamp uint64 `protobuf:"varint,10,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - ExtraData []byte `protobuf:"bytes,11,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` - // TODO(aeryz): U256 - BaseFeePerGas []byte `protobuf:"bytes,12,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3" json:"base_fee_per_gas,omitempty"` - BlockHash []byte `protobuf:"bytes,13,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - TransactionsRoot []byte `protobuf:"bytes,14,opt,name=transactions_root,json=transactionsRoot,proto3" json:"transactions_root,omitempty"` - WithdrawalsRoot []byte `protobuf:"bytes,15,opt,name=withdrawals_root,json=withdrawalsRoot,proto3" json:"withdrawals_root,omitempty"` - BlobGasUsed uint64 `protobuf:"varint,16,opt,name=blob_gas_used,json=blobGasUsed,proto3" json:"blob_gas_used,omitempty"` - ExcessBlobGas uint64 `protobuf:"varint,17,opt,name=excess_blob_gas,json=excessBlobGas,proto3" json:"excess_blob_gas,omitempty"` -} - -func (m *ExecutionPayloadHeader) Reset() { *m = ExecutionPayloadHeader{} } -func (m *ExecutionPayloadHeader) String() string { return proto.CompactTextString(m) } -func (*ExecutionPayloadHeader) ProtoMessage() {} -func (*ExecutionPayloadHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{15} -} -func (m *ExecutionPayloadHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExecutionPayloadHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExecutionPayloadHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ExecutionPayloadHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExecutionPayloadHeader.Merge(m, src) -} -func (m *ExecutionPayloadHeader) XXX_Size() int { - return m.Size() -} -func (m *ExecutionPayloadHeader) XXX_DiscardUnknown() { - xxx_messageInfo_ExecutionPayloadHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_ExecutionPayloadHeader proto.InternalMessageInfo - -func (m *ExecutionPayloadHeader) GetParentHash() []byte { - if m != nil { - return m.ParentHash - } - return nil -} - -func (m *ExecutionPayloadHeader) GetFeeRecipient() []byte { - if m != nil { - return m.FeeRecipient - } - return nil -} - -func (m *ExecutionPayloadHeader) GetStateRoot() []byte { - if m != nil { - return m.StateRoot - } - return nil -} - -func (m *ExecutionPayloadHeader) GetReceiptsRoot() []byte { - if m != nil { - return m.ReceiptsRoot - } - return nil -} - -func (m *ExecutionPayloadHeader) GetLogsBloom() []byte { - if m != nil { - return m.LogsBloom - } - return nil -} - -func (m *ExecutionPayloadHeader) GetPrevRandao() []byte { - if m != nil { - return m.PrevRandao - } - return nil -} - -func (m *ExecutionPayloadHeader) GetBlockNumber() uint64 { - if m != nil { - return m.BlockNumber - } - return 0 -} - -func (m *ExecutionPayloadHeader) GetGasLimit() uint64 { - if m != nil { - return m.GasLimit - } - return 0 -} - -func (m *ExecutionPayloadHeader) GetGasUsed() uint64 { - if m != nil { - return m.GasUsed - } - return 0 -} - -func (m *ExecutionPayloadHeader) GetTimestamp() uint64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -func (m *ExecutionPayloadHeader) GetExtraData() []byte { - if m != nil { - return m.ExtraData - } - return nil -} - -func (m *ExecutionPayloadHeader) GetBaseFeePerGas() []byte { - if m != nil { - return m.BaseFeePerGas - } - return nil -} - -func (m *ExecutionPayloadHeader) GetBlockHash() []byte { - if m != nil { - return m.BlockHash - } - return nil -} - -func (m *ExecutionPayloadHeader) GetTransactionsRoot() []byte { - if m != nil { - return m.TransactionsRoot - } - return nil -} - -func (m *ExecutionPayloadHeader) GetWithdrawalsRoot() []byte { - if m != nil { - return m.WithdrawalsRoot - } - return nil -} - -func (m *ExecutionPayloadHeader) GetBlobGasUsed() uint64 { - if m != nil { - return m.BlobGasUsed - } - return 0 -} - -func (m *ExecutionPayloadHeader) GetExcessBlobGas() uint64 { - if m != nil { - return m.ExcessBlobGas - } - return 0 -} - -type BeaconBlockHeader struct { - Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` - ProposerIndex uint64 `protobuf:"varint,2,opt,name=proposer_index,json=proposerIndex,proto3" json:"proposer_index,omitempty"` - ParentRoot []byte `protobuf:"bytes,3,opt,name=parent_root,json=parentRoot,proto3" json:"parent_root,omitempty"` - StateRoot []byte `protobuf:"bytes,4,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` - BodyRoot []byte `protobuf:"bytes,5,opt,name=body_root,json=bodyRoot,proto3" json:"body_root,omitempty"` -} - -func (m *BeaconBlockHeader) Reset() { *m = BeaconBlockHeader{} } -func (m *BeaconBlockHeader) String() string { return proto.CompactTextString(m) } -func (*BeaconBlockHeader) ProtoMessage() {} -func (*BeaconBlockHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{16} -} -func (m *BeaconBlockHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BeaconBlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BeaconBlockHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BeaconBlockHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_BeaconBlockHeader.Merge(m, src) -} -func (m *BeaconBlockHeader) XXX_Size() int { - return m.Size() -} -func (m *BeaconBlockHeader) XXX_DiscardUnknown() { - xxx_messageInfo_BeaconBlockHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_BeaconBlockHeader proto.InternalMessageInfo - -func (m *BeaconBlockHeader) GetSlot() uint64 { - if m != nil { - return m.Slot - } - return 0 -} - -func (m *BeaconBlockHeader) GetProposerIndex() uint64 { - if m != nil { - return m.ProposerIndex - } - return 0 -} - -func (m *BeaconBlockHeader) GetParentRoot() []byte { - if m != nil { - return m.ParentRoot - } - return nil -} - -func (m *BeaconBlockHeader) GetStateRoot() []byte { - if m != nil { - return m.StateRoot - } - return nil -} - -func (m *BeaconBlockHeader) GetBodyRoot() []byte { - if m != nil { - return m.BodyRoot - } - return nil -} - -type FinalizedHeaderMisbehaviour struct { - ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - TrustedSyncCommittee *TrustedSyncCommittee `protobuf:"bytes,2,opt,name=trusted_sync_committee,json=trustedSyncCommittee,proto3" json:"trusted_sync_committee,omitempty"` - ConsensusUpdate_1 *LightClientUpdate `protobuf:"bytes,3,opt,name=consensus_update_1,json=consensusUpdate1,proto3" json:"consensus_update_1,omitempty"` - ConsensusUpdate_2 *LightClientUpdate `protobuf:"bytes,4,opt,name=consensus_update_2,json=consensusUpdate2,proto3" json:"consensus_update_2,omitempty"` -} - -func (m *FinalizedHeaderMisbehaviour) Reset() { *m = FinalizedHeaderMisbehaviour{} } -func (m *FinalizedHeaderMisbehaviour) String() string { return proto.CompactTextString(m) } -func (*FinalizedHeaderMisbehaviour) ProtoMessage() {} -func (*FinalizedHeaderMisbehaviour) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{17} -} -func (m *FinalizedHeaderMisbehaviour) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FinalizedHeaderMisbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FinalizedHeaderMisbehaviour.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *FinalizedHeaderMisbehaviour) XXX_Merge(src proto.Message) { - xxx_messageInfo_FinalizedHeaderMisbehaviour.Merge(m, src) -} -func (m *FinalizedHeaderMisbehaviour) XXX_Size() int { - return m.Size() -} -func (m *FinalizedHeaderMisbehaviour) XXX_DiscardUnknown() { - xxx_messageInfo_FinalizedHeaderMisbehaviour.DiscardUnknown(m) -} - -var xxx_messageInfo_FinalizedHeaderMisbehaviour proto.InternalMessageInfo - -func (m *FinalizedHeaderMisbehaviour) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *FinalizedHeaderMisbehaviour) GetTrustedSyncCommittee() *TrustedSyncCommittee { - if m != nil { - return m.TrustedSyncCommittee - } - return nil -} - -func (m *FinalizedHeaderMisbehaviour) GetConsensusUpdate_1() *LightClientUpdate { - if m != nil { - return m.ConsensusUpdate_1 - } - return nil -} - -func (m *FinalizedHeaderMisbehaviour) GetConsensusUpdate_2() *LightClientUpdate { - if m != nil { - return m.ConsensusUpdate_2 - } - return nil -} - -type NextSyncCommitteeMisbehaviour struct { - ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - TrustedSyncCommittee *TrustedSyncCommittee `protobuf:"bytes,2,opt,name=trusted_sync_committee,json=trustedSyncCommittee,proto3" json:"trusted_sync_committee,omitempty"` - ConsensusUpdate_1 *LightClientUpdate `protobuf:"bytes,3,opt,name=consensus_update_1,json=consensusUpdate1,proto3" json:"consensus_update_1,omitempty"` - ConsensusUpdate_2 *LightClientUpdate `protobuf:"bytes,4,opt,name=consensus_update_2,json=consensusUpdate2,proto3" json:"consensus_update_2,omitempty"` -} - -func (m *NextSyncCommitteeMisbehaviour) Reset() { *m = NextSyncCommitteeMisbehaviour{} } -func (m *NextSyncCommitteeMisbehaviour) String() string { return proto.CompactTextString(m) } -func (*NextSyncCommitteeMisbehaviour) ProtoMessage() {} -func (*NextSyncCommitteeMisbehaviour) Descriptor() ([]byte, []int) { - return fileDescriptor_3d5f6a181a17c968, []int{18} -} -func (m *NextSyncCommitteeMisbehaviour) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NextSyncCommitteeMisbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NextSyncCommitteeMisbehaviour.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NextSyncCommitteeMisbehaviour) XXX_Merge(src proto.Message) { - xxx_messageInfo_NextSyncCommitteeMisbehaviour.Merge(m, src) -} -func (m *NextSyncCommitteeMisbehaviour) XXX_Size() int { - return m.Size() -} -func (m *NextSyncCommitteeMisbehaviour) XXX_DiscardUnknown() { - xxx_messageInfo_NextSyncCommitteeMisbehaviour.DiscardUnknown(m) -} - -var xxx_messageInfo_NextSyncCommitteeMisbehaviour proto.InternalMessageInfo - -func (m *NextSyncCommitteeMisbehaviour) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *NextSyncCommitteeMisbehaviour) GetTrustedSyncCommittee() *TrustedSyncCommittee { - if m != nil { - return m.TrustedSyncCommittee - } - return nil -} - -func (m *NextSyncCommitteeMisbehaviour) GetConsensusUpdate_1() *LightClientUpdate { - if m != nil { - return m.ConsensusUpdate_1 - } - return nil -} - -func (m *NextSyncCommitteeMisbehaviour) GetConsensusUpdate_2() *LightClientUpdate { - if m != nil { - return m.ConsensusUpdate_2 - } - return nil -} - -func init() { - proto.RegisterType((*StorageProof)(nil), "union.ibc.lightclients.ethereum.v1.StorageProof") - proto.RegisterType((*AccountProof)(nil), "union.ibc.lightclients.ethereum.v1.AccountProof") - proto.RegisterType((*ClientState)(nil), "union.ibc.lightclients.ethereum.v1.ClientState") - proto.RegisterType((*ConsensusState)(nil), "union.ibc.lightclients.ethereum.v1.ConsensusState") - proto.RegisterType((*Header)(nil), "union.ibc.lightclients.ethereum.v1.Header") - proto.RegisterType((*Misbehaviour)(nil), "union.ibc.lightclients.ethereum.v1.Misbehaviour") - proto.RegisterType((*TrustedSyncCommittee)(nil), "union.ibc.lightclients.ethereum.v1.TrustedSyncCommittee") - proto.RegisterType((*ForkParameters)(nil), "union.ibc.lightclients.ethereum.v1.ForkParameters") - proto.RegisterType((*Fork)(nil), "union.ibc.lightclients.ethereum.v1.Fork") - proto.RegisterType((*LightClientUpdate)(nil), "union.ibc.lightclients.ethereum.v1.LightClientUpdate") - proto.RegisterType((*SyncCommittee)(nil), "union.ibc.lightclients.ethereum.v1.SyncCommittee") - proto.RegisterType((*SyncAggregate)(nil), "union.ibc.lightclients.ethereum.v1.SyncAggregate") - proto.RegisterType((*ExecutionUpdate)(nil), "union.ibc.lightclients.ethereum.v1.ExecutionUpdate") - proto.RegisterType((*AccountUpdate)(nil), "union.ibc.lightclients.ethereum.v1.AccountUpdate") - proto.RegisterType((*LightClientHeader)(nil), "union.ibc.lightclients.ethereum.v1.LightClientHeader") - proto.RegisterType((*ExecutionPayloadHeader)(nil), "union.ibc.lightclients.ethereum.v1.ExecutionPayloadHeader") - proto.RegisterType((*BeaconBlockHeader)(nil), "union.ibc.lightclients.ethereum.v1.BeaconBlockHeader") - proto.RegisterType((*FinalizedHeaderMisbehaviour)(nil), "union.ibc.lightclients.ethereum.v1.FinalizedHeaderMisbehaviour") - proto.RegisterType((*NextSyncCommitteeMisbehaviour)(nil), "union.ibc.lightclients.ethereum.v1.NextSyncCommitteeMisbehaviour") -} - -func init() { - proto.RegisterFile("union/ibc/lightclients/ethereum/v1/ethereum.proto", fileDescriptor_3d5f6a181a17c968) -} - -var fileDescriptor_3d5f6a181a17c968 = []byte{ - // 1732 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x8f, 0x1c, 0x47, - 0x15, 0x77, 0xcf, 0xce, 0x7e, 0xcc, 0xdb, 0xf9, 0xda, 0xca, 0xe2, 0x34, 0x76, 0xbc, 0xde, 0x74, - 0x94, 0x64, 0x03, 0xd2, 0x6c, 0x66, 0x81, 0x28, 0x80, 0x04, 0x78, 0x8d, 0xd7, 0xb6, 0xe4, 0x44, - 0xa3, 0x5e, 0x3b, 0xb2, 0x40, 0xa2, 0xa9, 0xee, 0xae, 0x99, 0x29, 0x6d, 0x4f, 0xd7, 0xa8, 0xaa, - 0x66, 0xb2, 0x93, 0x3b, 0x77, 0xfe, 0x03, 0x24, 0x24, 0x4e, 0x1c, 0xb8, 0xf0, 0x47, 0x70, 0xcc, - 0x91, 0x23, 0xb2, 0x25, 0x90, 0xb8, 0x82, 0x38, 0xa3, 0xfa, 0xe8, 0x9e, 0xee, 0x99, 0x31, 0x9e, - 0xcd, 0x12, 0x4e, 0xdc, 0xba, 0x7e, 0xef, 0xbd, 0x5f, 0x55, 0xbd, 0x7a, 0xef, 0xd5, 0xab, 0x86, - 0xee, 0x24, 0xa5, 0x2c, 0x3d, 0xa6, 0x61, 0x74, 0x9c, 0xd0, 0xc1, 0x50, 0x46, 0x09, 0x25, 0xa9, - 0x14, 0xc7, 0x44, 0x0e, 0x09, 0x27, 0x93, 0xd1, 0xf1, 0xb4, 0x9b, 0x7f, 0x77, 0xc6, 0x9c, 0x49, - 0x86, 0x3c, 0x6d, 0xd2, 0xa1, 0x61, 0xd4, 0x29, 0x9a, 0x74, 0x72, 0xb5, 0x69, 0xf7, 0xd6, 0x5d, - 0x45, 0x18, 0x31, 0x4e, 0x8e, 0x8d, 0x54, 0xd1, 0x98, 0x2f, 0x43, 0x72, 0x6b, 0x79, 0x46, 0x49, - 0xd2, 0x98, 0xf0, 0x11, 0x35, 0xca, 0xf3, 0x91, 0x31, 0xf0, 0x9e, 0x40, 0xfd, 0x5c, 0x32, 0x8e, - 0x07, 0xa4, 0xc7, 0x19, 0xeb, 0xa3, 0x36, 0x6c, 0x5c, 0x90, 0x99, 0xeb, 0x1c, 0x3a, 0x47, 0x75, - 0x5f, 0x7d, 0xa2, 0x7d, 0xd8, 0x9c, 0xe2, 0x64, 0x42, 0xdc, 0x8a, 0xc6, 0xcc, 0x40, 0xa1, 0x63, - 0x65, 0xe0, 0x6e, 0x1c, 0x6e, 0x28, 0x54, 0x0f, 0xbc, 0x87, 0x50, 0xbf, 0x17, 0x45, 0x6c, 0x92, - 0x4a, 0xc3, 0xf6, 0x36, 0xd4, 0x85, 0x61, 0x0f, 0x38, 0x63, 0xd2, 0xd2, 0xee, 0x5a, 0xcc, 0x67, - 0x4c, 0xce, 0x89, 0x2a, 0x45, 0xa2, 0x5f, 0x6d, 0xc2, 0xee, 0x7d, 0xbd, 0x83, 0x73, 0x89, 0x25, - 0x41, 0xdf, 0x84, 0x9d, 0x68, 0x88, 0x69, 0x1a, 0xd0, 0x58, 0x93, 0xd4, 0xfc, 0x6d, 0x3d, 0x7e, - 0x1c, 0xa3, 0x8f, 0xe0, 0xcd, 0x01, 0x49, 0x89, 0xa0, 0x22, 0x98, 0xe2, 0x84, 0xc6, 0x58, 0x32, - 0x2e, 0xcc, 0x74, 0x66, 0xc5, 0xdf, 0xb0, 0xe2, 0xcf, 0x72, 0xa9, 0x9e, 0xf8, 0x01, 0xdc, 0x1d, - 0xd1, 0x34, 0x10, 0xb3, 0x34, 0x0a, 0x22, 0x36, 0x1a, 0x51, 0x29, 0x09, 0x09, 0xc6, 0x98, 0x4b, - 0x1a, 0xd1, 0x31, 0x4e, 0xa5, 0x70, 0x37, 0x0e, 0x9d, 0xa3, 0xaa, 0xff, 0xd6, 0x88, 0xa6, 0xe7, - 0xb3, 0x34, 0xba, 0x9f, 0x29, 0xf5, 0x0a, 0x3a, 0x6a, 0x8b, 0xd9, 0xf4, 0x92, 0x8e, 0x88, 0x5b, - 0xd5, 0x36, 0xbb, 0x16, 0x7b, 0x4a, 0x47, 0x04, 0xfd, 0x1c, 0x5a, 0x7d, 0xc6, 0x2f, 0x14, 0x37, - 0x1e, 0x11, 0x49, 0xb8, 0x70, 0x37, 0x0f, 0x9d, 0xa3, 0xdd, 0x93, 0x93, 0xce, 0xeb, 0xcf, 0xbc, - 0x73, 0xc6, 0xf8, 0x45, 0x2f, 0xb7, 0xf4, 0x9b, 0xfd, 0xd2, 0x18, 0x1d, 0x41, 0x5b, 0x90, 0x88, - 0xa5, 0xb1, 0x08, 0xc6, 0x84, 0x07, 0x22, 0x61, 0xd2, 0xdd, 0xd2, 0x6b, 0x68, 0x5a, 0xbc, 0x47, - 0xf8, 0x79, 0xc2, 0x24, 0x7a, 0x0f, 0x5a, 0x4a, 0x6a, 0xf4, 0xc8, 0x98, 0x45, 0x43, 0x77, 0x5b, - 0x2b, 0x36, 0x34, 0xdc, 0x23, 0xfc, 0x81, 0x02, 0xd1, 0x19, 0x1c, 0x6a, 0xa9, 0x25, 0x5c, 0xf0, - 0x0f, 0xe1, 0x94, 0xc5, 0xee, 0x8e, 0xf1, 0x8c, 0xd1, 0x53, 0x13, 0x94, 0xfc, 0xa3, 0x75, 0xd0, - 0x5d, 0xd8, 0x4d, 0xb0, 0x24, 0x42, 0x9a, 0x45, 0xd5, 0xb4, 0x09, 0x18, 0x48, 0x2f, 0xe8, 0xc7, - 0xd0, 0xe8, 0x73, 0xf6, 0x05, 0x49, 0x83, 0x21, 0x51, 0xbb, 0x77, 0x41, 0x7b, 0xe5, 0x96, 0xf6, - 0x87, 0x8a, 0xf2, 0x8e, 0x8d, 0xed, 0x69, 0xb7, 0xf3, 0x48, 0x6b, 0xf8, 0x75, 0x63, 0x60, 0x46, - 0xa8, 0x03, 0x6f, 0xd0, 0x30, 0x5b, 0xdd, 0x88, 0xa4, 0x76, 0xa6, 0x5d, 0x7d, 0xec, 0x7b, 0x34, - 0xb4, 0x4b, 0x52, 0x12, 0x3d, 0xe1, 0x87, 0xb0, 0x6f, 0xf4, 0x53, 0xc9, 0x71, 0x24, 0x03, 0x1c, - 0xc7, 0x9c, 0x08, 0xe1, 0xd6, 0xb5, 0x01, 0xd2, 0x06, 0x46, 0x74, 0xcf, 0x48, 0xbc, 0xbf, 0x3b, - 0xd0, 0xbc, 0xcf, 0x52, 0x41, 0x52, 0x31, 0x11, 0x26, 0x14, 0x11, 0x54, 0xf5, 0x2c, 0x8e, 0xde, - 0x8f, 0xfe, 0x46, 0x77, 0x00, 0x84, 0x12, 0x16, 0xc3, 0xae, 0xa6, 0x11, 0x1d, 0x6a, 0x8b, 0x69, - 0xb0, 0xb1, 0x9c, 0x06, 0x6f, 0x41, 0x4d, 0x85, 0x8f, 0x90, 0x78, 0x34, 0xb6, 0x31, 0x34, 0x07, - 0xd0, 0x77, 0xe1, 0x66, 0x34, 0xe1, 0x5c, 0xef, 0xb0, 0x74, 0x1e, 0x3a, 0x90, 0xea, 0xfe, 0xbe, - 0x95, 0x96, 0x8e, 0x41, 0xb9, 0x27, 0x25, 0x97, 0x4b, 0x26, 0x5b, 0xc6, 0x3d, 0x4a, 0x54, 0xd2, - 0xf7, 0xfe, 0x58, 0x81, 0xad, 0x47, 0x04, 0xc7, 0x84, 0xa3, 0x14, 0x6e, 0x4a, 0x3e, 0x11, 0x92, - 0xc4, 0x8b, 0xd6, 0x8e, 0x3e, 0xa3, 0x8f, 0xd7, 0x89, 0xdc, 0xa7, 0x86, 0xa1, 0x34, 0x89, 0xbf, - 0x2f, 0x57, 0xa0, 0xe8, 0x97, 0xd0, 0x8e, 0x32, 0x37, 0x07, 0x93, 0x71, 0x8c, 0xa5, 0xa9, 0x37, - 0xbb, 0x27, 0xdf, 0x5b, 0x67, 0xa6, 0x27, 0x4a, 0x60, 0xea, 0xc5, 0x33, 0x6d, 0xec, 0xb7, 0x72, - 0x3a, 0x03, 0xa0, 0xe7, 0xd0, 0xc4, 0xa6, 0x34, 0x65, 0xfc, 0x1b, 0x9a, 0xbf, 0xbb, 0x0e, 0xbf, - 0x2d, 0x6a, 0x96, 0xbb, 0x81, 0x8b, 0x43, 0xef, 0xb7, 0x15, 0xa8, 0x7f, 0x42, 0x45, 0x48, 0x86, - 0x78, 0x4a, 0xd9, 0xe4, 0x7f, 0xef, 0xbc, 0x1e, 0xec, 0x98, 0x2d, 0x05, 0xdd, 0xeb, 0x39, 0x6d, - 0xdb, 0xd0, 0x74, 0x0b, 0x8c, 0x27, 0xd6, 0x4d, 0xd7, 0x63, 0x3c, 0xf1, 0x7e, 0x57, 0x81, 0xfd, - 0x55, 0x5b, 0x42, 0xf7, 0xa0, 0x99, 0x39, 0xcb, 0x56, 0x01, 0xe7, 0xb5, 0x55, 0xa0, 0x61, 0x2d, - 0x6c, 0x19, 0x18, 0xbc, 0x32, 0x3b, 0x2a, 0xeb, 0x1f, 0xf1, 0x82, 0xa3, 0x57, 0x26, 0x14, 0x5e, - 0x9d, 0x50, 0x1b, 0x5f, 0x75, 0x96, 0x15, 0x39, 0xf8, 0x8f, 0x0a, 0x34, 0xcb, 0x15, 0x5f, 0x55, - 0xad, 0xec, 0x86, 0xd1, 0xd7, 0xc8, 0x94, 0x70, 0x41, 0x59, 0x6a, 0x2f, 0x53, 0x64, 0x65, 0xca, - 0xe8, 0x33, 0x23, 0x29, 0xde, 0x49, 0xba, 0x54, 0x55, 0x4a, 0x77, 0x92, 0x2e, 0x85, 0x3f, 0x81, - 0x2d, 0x9c, 0x48, 0x4c, 0xb9, 0x5d, 0xfd, 0xd1, 0xba, 0x57, 0x91, 0x6f, 0xed, 0xd0, 0x19, 0xd4, - 0x42, 0x92, 0x24, 0x58, 0x72, 0x7a, 0xa9, 0x2b, 0xd6, 0x55, 0x48, 0xe6, 0xa6, 0xe8, 0x14, 0xb6, - 0x23, 0x3c, 0x56, 0x43, 0x7b, 0x2b, 0xae, 0xcf, 0x92, 0x19, 0xa2, 0x1f, 0xc1, 0x66, 0x4c, 0x52, - 0x12, 0xea, 0xda, 0x76, 0x15, 0x06, 0x63, 0xe6, 0x7d, 0x04, 0x55, 0x35, 0x44, 0x2e, 0x6c, 0x97, - 0xbd, 0x9b, 0x0d, 0x55, 0x9b, 0x62, 0xae, 0x4c, 0xe3, 0x4b, 0x33, 0xf0, 0x7e, 0x53, 0x85, 0xbd, - 0xa5, 0xa0, 0x47, 0xbf, 0x80, 0x16, 0x96, 0xea, 0x96, 0xd3, 0x31, 0xad, 0xea, 0xa9, 0x8d, 0xe9, - 0xab, 0x26, 0x91, 0x29, 0xc6, 0x7e, 0x33, 0x63, 0xb3, 0xc5, 0xf9, 0x15, 0x61, 0x58, 0xf9, 0xef, - 0x85, 0x21, 0xfa, 0x21, 0xdc, 0x5a, 0x31, 0x45, 0x10, 0x72, 0x9c, 0x46, 0x43, 0xdb, 0xf3, 0xbd, - 0xb9, 0x64, 0x76, 0xaa, 0xc5, 0xaa, 0x98, 0xf7, 0x69, 0x8a, 0x13, 0xfa, 0xc5, 0xdc, 0x01, 0xd5, - 0xeb, 0x38, 0xa0, 0x95, 0xd3, 0x59, 0x0f, 0xbc, 0x0f, 0x16, 0x92, 0xb3, 0x6c, 0x4d, 0x9b, 0x7a, - 0x4d, 0xcd, 0x0c, 0xb6, 0x4b, 0x79, 0x0e, 0x4d, 0xbd, 0x05, 0x3c, 0x18, 0x70, 0x32, 0x50, 0x55, - 0x7f, 0xe7, 0x6a, 0x5e, 0xba, 0x97, 0x19, 0xfa, 0x0d, 0x51, 0x1c, 0xa2, 0x77, 0xa1, 0x29, 0xe8, - 0x20, 0xc5, 0x72, 0xc2, 0x49, 0xb1, 0xc1, 0x69, 0xe4, 0xa8, 0xca, 0x33, 0xef, 0x29, 0x34, 0xca, - 0x9e, 0x75, 0x61, 0x7b, 0x3c, 0x09, 0x2f, 0xc8, 0x4c, 0xb8, 0x8e, 0x5e, 0x72, 0x36, 0x44, 0x1f, - 0x40, 0x3b, 0x5f, 0x66, 0x60, 0x40, 0xdb, 0x4a, 0xb4, 0x72, 0xbc, 0xa7, 0x61, 0x6f, 0x66, 0x58, - 0xe7, 0xab, 0xe9, 0xc0, 0x1b, 0x8b, 0x47, 0x45, 0xa5, 0xb0, 0x41, 0xbc, 0x27, 0x4a, 0x87, 0x44, - 0xa5, 0x40, 0x1f, 0x83, 0xbb, 0xa0, 0x9f, 0x2f, 0xdb, 0xce, 0x79, 0xb3, 0x64, 0x74, 0x9e, 0x49, - 0xbd, 0x3f, 0x38, 0xd0, 0x7a, 0x70, 0x49, 0xa2, 0x89, 0xa4, 0x2c, 0xb5, 0x01, 0x5f, 0x6e, 0x7f, - 0x9c, 0xc5, 0xf6, 0xe7, 0x5b, 0xb0, 0x37, 0x17, 0x67, 0xe7, 0x65, 0xda, 0xfd, 0x56, 0xae, 0x65, - 0x0f, 0xec, 0x6d, 0xa8, 0x87, 0x09, 0x8b, 0x2e, 0x82, 0x74, 0x32, 0x0a, 0x09, 0xb7, 0x2d, 0xf8, - 0xae, 0xc6, 0x3e, 0xd5, 0x90, 0xda, 0x6b, 0x51, 0x25, 0x23, 0xac, 0x6a, 0xc2, 0xbd, 0x82, 0xa6, - 0xa1, 0xf4, 0xfa, 0xd0, 0x28, 0xdd, 0xdf, 0xe8, 0x19, 0x64, 0x37, 0x78, 0x60, 0x9e, 0x1e, 0x26, - 0x3b, 0x3f, 0xbc, 0x42, 0x27, 0xa0, 0x9f, 0x37, 0x7e, 0x1d, 0x17, 0x46, 0xde, 0xdf, 0x9c, 0x52, - 0x31, 0xb0, 0xa1, 0xfa, 0x09, 0x6c, 0x85, 0x04, 0x47, 0xb6, 0xa2, 0xac, 0x99, 0x02, 0xa7, 0xda, - 0xe2, 0x54, 0x6d, 0xc5, 0xa6, 0x80, 0x25, 0x41, 0xcf, 0xa1, 0x46, 0x32, 0xef, 0xdb, 0x8c, 0xff, - 0xc1, 0x3a, 0x8c, 0xf9, 0x91, 0xf5, 0xf0, 0x2c, 0x61, 0xd8, 0x26, 0x92, 0x3f, 0x27, 0x53, 0xe1, - 0x97, 0x0f, 0xca, 0x89, 0xde, 0xca, 0x71, 0xeb, 0xd1, 0xbf, 0x56, 0xe1, 0xe6, 0x6a, 0x42, 0xd5, - 0xf4, 0x8f, 0xb1, 0xbe, 0x8a, 0x87, 0x58, 0x0c, 0x6d, 0x2c, 0x80, 0x81, 0x1e, 0x61, 0x31, 0x44, - 0xef, 0x40, 0xa3, 0x4f, 0x48, 0xc0, 0x49, 0x44, 0xc7, 0x6a, 0x99, 0x36, 0xdc, 0xea, 0x7d, 0x42, - 0xfc, 0x0c, 0x5b, 0x08, 0xa8, 0x8d, 0xc5, 0x80, 0x7a, 0x07, 0x1a, 0x9c, 0x44, 0x84, 0x8e, 0xa5, - 0x7d, 0xe8, 0x55, 0x0d, 0x47, 0x06, 0x6a, 0xa5, 0x3b, 0x00, 0x09, 0x1b, 0x88, 0x20, 0x4c, 0x18, - 0x1b, 0xd9, 0x3e, 0xb9, 0xa6, 0x90, 0x53, 0x05, 0xe8, 0x85, 0x72, 0x32, 0x0d, 0x38, 0x4e, 0x63, - 0xcc, 0x6c, 0x53, 0x0c, 0x0a, 0xf2, 0x35, 0xb2, 0x14, 0x89, 0xdb, 0xcb, 0x91, 0x78, 0x1b, 0x6a, - 0x03, 0x2c, 0x82, 0x84, 0x8e, 0xa8, 0xb4, 0x4f, 0xa2, 0x9d, 0x01, 0x16, 0x4f, 0xd4, 0x58, 0x3d, - 0x59, 0x95, 0x70, 0x22, 0x48, 0x6c, 0x4b, 0xc3, 0xf6, 0x00, 0x8b, 0x67, 0x82, 0xc4, 0xe5, 0x66, - 0x1f, 0x16, 0x9b, 0xfd, 0x3b, 0x00, 0xe4, 0x52, 0x72, 0x1c, 0xc4, 0x58, 0x62, 0xfb, 0x98, 0xa9, - 0x69, 0xe4, 0xa7, 0x58, 0x62, 0xf4, 0x3e, 0xb4, 0x43, 0x2c, 0x48, 0xd0, 0x37, 0xaf, 0xb1, 0x60, - 0x80, 0xb3, 0x07, 0x4c, 0x43, 0xe1, 0x67, 0xfa, 0xfd, 0xf5, 0x10, 0x0b, 0xc5, 0x63, 0x36, 0xa0, - 0x4f, 0xa2, 0x61, 0x78, 0x34, 0xa2, 0x0f, 0xe2, 0xdb, 0xb0, 0x27, 0x39, 0x4e, 0x05, 0x8e, 0xd4, - 0x29, 0x5a, 0x47, 0x36, 0xb5, 0x56, 0xbb, 0x28, 0xd0, 0xce, 0xfc, 0x00, 0xda, 0x9f, 0x53, 0x39, - 0x8c, 0x39, 0xfe, 0x1c, 0x27, 0x56, 0xb7, 0x65, 0x6a, 0x53, 0x01, 0xd7, 0xaa, 0x1e, 0x34, 0xc2, - 0x84, 0x85, 0x41, 0xbe, 0xf9, 0x76, 0xee, 0xb8, 0xf0, 0xa1, 0x75, 0xc0, 0x7b, 0xd0, 0x22, 0x97, - 0x11, 0x11, 0xfa, 0x74, 0xb4, 0xaa, 0xbb, 0x67, 0xaa, 0xa7, 0x81, 0x4f, 0x8d, 0xae, 0xf7, 0x7b, - 0x07, 0xf6, 0x96, 0x72, 0x61, 0xe5, 0x0b, 0xec, 0x5d, 0x68, 0x8e, 0x39, 0x1b, 0x33, 0x41, 0x78, - 0x40, 0xd3, 0x98, 0x5c, 0xda, 0x8b, 0xba, 0x91, 0xa1, 0x8f, 0x15, 0x58, 0x08, 0xcf, 0x42, 0x64, - 0xd9, 0xf0, 0xcc, 0xa2, 0xa6, 0x10, 0x79, 0xd5, 0xc5, 0xc8, 0xbb, 0x0d, 0xb5, 0x90, 0xc5, 0x33, - 0x23, 0x35, 0x31, 0xb5, 0xa3, 0x00, 0x25, 0xf4, 0xfe, 0x59, 0x81, 0xdb, 0x67, 0xe5, 0x9b, 0xaa, - 0xf4, 0x2e, 0xb8, 0x0d, 0x35, 0x93, 0x9a, 0xf3, 0xbf, 0x18, 0x3b, 0x06, 0x78, 0x1c, 0xff, 0x87, - 0x47, 0x43, 0xe5, 0x6b, 0x79, 0x34, 0x44, 0x80, 0x16, 0x5f, 0x5c, 0x41, 0xf7, 0x7a, 0xcd, 0x7e, - 0x7b, 0xe1, 0xcd, 0xd5, 0x5d, 0x39, 0xc9, 0xc9, 0x57, 0xec, 0x05, 0x5e, 0x31, 0xc9, 0x89, 0xf7, - 0xaf, 0x0a, 0xdc, 0xf9, 0x74, 0xb1, 0x15, 0xf9, 0xbf, 0xe3, 0xbf, 0x76, 0xc7, 0x9f, 0x7e, 0xff, - 0x4f, 0x2f, 0x0e, 0x9c, 0x2f, 0x5f, 0x1c, 0x38, 0x7f, 0x79, 0x71, 0xe0, 0xfc, 0xfa, 0xe5, 0xc1, - 0x8d, 0x2f, 0x5f, 0x1e, 0xdc, 0xf8, 0xf3, 0xcb, 0x83, 0x1b, 0x3f, 0xbb, 0xfb, 0x9a, 0xdf, 0x9f, - 0xe1, 0x96, 0xfe, 0xfb, 0xf8, 0x9d, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x71, 0x3e, 0xd4, 0x2a, - 0x28, 0x15, 0x00, 0x00, -} - -func (m *StorageProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StorageProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StorageProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Proof) > 0 { - for iNdEx := len(m.Proof) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Proof[iNdEx]) - copy(dAtA[i:], m.Proof[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.Proof[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AccountProof) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AccountProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AccountProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Proof) > 0 { - for iNdEx := len(m.Proof) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Proof[iNdEx]) - copy(dAtA[i:], m.Proof[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.Proof[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.StorageRoot) > 0 { - i -= len(m.StorageRoot) - copy(dAtA[i:], m.StorageRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.StorageRoot))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ClientState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClientState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.IbcContractAddress) > 0 { - i -= len(m.IbcContractAddress) - copy(dAtA[i:], m.IbcContractAddress) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.IbcContractAddress))) - i-- - dAtA[i] = 0x62 - } - if len(m.IbcCommitmentSlot) > 0 { - i -= len(m.IbcCommitmentSlot) - copy(dAtA[i:], m.IbcCommitmentSlot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.IbcCommitmentSlot))) - i-- - dAtA[i] = 0x5a - } - if m.FrozenHeight != nil { - { - size, err := m.FrozenHeight.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - if m.LatestSlot != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.LatestSlot)) - i-- - dAtA[i] = 0x48 - } - if m.EpochsPerSyncCommitteePeriod != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.EpochsPerSyncCommitteePeriod)) - i-- - dAtA[i] = 0x40 - } - if m.SlotsPerEpoch != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.SlotsPerEpoch)) - i-- - dAtA[i] = 0x38 - } - if m.SecondsPerSlot != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.SecondsPerSlot)) - i-- - dAtA[i] = 0x30 - } - if m.ForkParameters != nil { - { - size, err := m.ForkParameters.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.GenesisTime != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.GenesisTime)) - i-- - dAtA[i] = 0x20 - } - if m.MinSyncCommitteeParticipants != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.MinSyncCommitteeParticipants)) - i-- - dAtA[i] = 0x18 - } - if len(m.GenesisValidatorsRoot) > 0 { - i -= len(m.GenesisValidatorsRoot) - copy(dAtA[i:], m.GenesisValidatorsRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.GenesisValidatorsRoot))) - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ConsensusState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConsensusState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NextSyncCommittee) > 0 { - i -= len(m.NextSyncCommittee) - copy(dAtA[i:], m.NextSyncCommittee) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.NextSyncCommittee))) - i-- - dAtA[i] = 0x32 - } - if len(m.CurrentSyncCommittee) > 0 { - i -= len(m.CurrentSyncCommittee) - copy(dAtA[i:], m.CurrentSyncCommittee) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.CurrentSyncCommittee))) - i-- - dAtA[i] = 0x2a - } - if m.Timestamp != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x20 - } - if len(m.StorageRoot) > 0 { - i -= len(m.StorageRoot) - copy(dAtA[i:], m.StorageRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.StorageRoot))) - i-- - dAtA[i] = 0x1a - } - if len(m.StateRoot) > 0 { - i -= len(m.StateRoot) - copy(dAtA[i:], m.StateRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.StateRoot))) - i-- - dAtA[i] = 0x12 - } - if m.Slot != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.Slot)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Header) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Header) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AccountUpdate != nil { - { - size, err := m.AccountUpdate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.ConsensusUpdate != nil { - { - size, err := m.ConsensusUpdate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.TrustedSyncCommittee != nil { - { - size, err := m.TrustedSyncCommittee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Misbehaviour) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Misbehaviour) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Update_2 != nil { - { - size, err := m.Update_2.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Update_1 != nil { - { - size, err := m.Update_1.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.TrustedSyncCommittee != nil { - { - size, err := m.TrustedSyncCommittee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TrustedSyncCommittee) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TrustedSyncCommittee) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TrustedSyncCommittee) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NextSyncCommittee != nil { - { - size, err := m.NextSyncCommittee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.CurrentSyncCommittee != nil { - { - size, err := m.CurrentSyncCommittee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.TrustedHeight != nil { - { - size, err := m.TrustedHeight.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ForkParameters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ForkParameters) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ForkParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Deneb != nil { - { - size, err := m.Deneb.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.Capella != nil { - { - size, err := m.Capella.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Bellatrix != nil { - { - size, err := m.Bellatrix.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Altair != nil { - { - size, err := m.Altair.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.GenesisSlot != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.GenesisSlot)) - i-- - dAtA[i] = 0x10 - } - if len(m.GenesisForkVersion) > 0 { - i -= len(m.GenesisForkVersion) - copy(dAtA[i:], m.GenesisForkVersion) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.GenesisForkVersion))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Fork) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Fork) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Fork) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Epoch != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x10 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LightClientUpdate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LightClientUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LightClientUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.SignatureSlot != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.SignatureSlot)) - i-- - dAtA[i] = 0x48 - } - if m.SyncAggregate != nil { - { - size, err := m.SyncAggregate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - if len(m.FinalityBranch) > 0 { - for iNdEx := len(m.FinalityBranch) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.FinalityBranch[iNdEx]) - copy(dAtA[i:], m.FinalityBranch[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.FinalityBranch[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - if m.FinalizedHeader != nil { - { - size, err := m.FinalizedHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.NextSyncCommitteeBranch) > 0 { - for iNdEx := len(m.NextSyncCommitteeBranch) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.NextSyncCommitteeBranch[iNdEx]) - copy(dAtA[i:], m.NextSyncCommitteeBranch[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.NextSyncCommitteeBranch[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.NextSyncCommittee != nil { - { - size, err := m.NextSyncCommittee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.AttestedHeader != nil { - { - size, err := m.AttestedHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SyncCommittee) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SyncCommittee) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncCommittee) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AggregatePubkey) > 0 { - i -= len(m.AggregatePubkey) - copy(dAtA[i:], m.AggregatePubkey) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.AggregatePubkey))) - i-- - dAtA[i] = 0x12 - } - if len(m.Pubkeys) > 0 { - for iNdEx := len(m.Pubkeys) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Pubkeys[iNdEx]) - copy(dAtA[i:], m.Pubkeys[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.Pubkeys[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SyncAggregate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SyncAggregate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncAggregate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SyncCommitteeSignature) > 0 { - i -= len(m.SyncCommitteeSignature) - copy(dAtA[i:], m.SyncCommitteeSignature) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.SyncCommitteeSignature))) - i-- - dAtA[i] = 0x12 - } - if len(m.SyncCommitteeBits) > 0 { - i -= len(m.SyncCommitteeBits) - copy(dAtA[i:], m.SyncCommitteeBits) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.SyncCommitteeBits))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExecutionUpdate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExecutionUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExecutionUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BlockNumberBranch) > 0 { - for iNdEx := len(m.BlockNumberBranch) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.BlockNumberBranch[iNdEx]) - copy(dAtA[i:], m.BlockNumberBranch[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.BlockNumberBranch[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if m.BlockNumber != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.BlockNumber)) - i-- - dAtA[i] = 0x18 - } - if len(m.StateRootBranch) > 0 { - for iNdEx := len(m.StateRootBranch) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.StateRootBranch[iNdEx]) - copy(dAtA[i:], m.StateRootBranch[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.StateRootBranch[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.StateRoot) > 0 { - i -= len(m.StateRoot) - copy(dAtA[i:], m.StateRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.StateRoot))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AccountUpdate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AccountUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AccountProof != nil { - { - size, err := m.AccountProof.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LightClientHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LightClientHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LightClientHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ExecutionBranch) > 0 { - for iNdEx := len(m.ExecutionBranch) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ExecutionBranch[iNdEx]) - copy(dAtA[i:], m.ExecutionBranch[iNdEx]) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ExecutionBranch[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.Execution != nil { - { - size, err := m.Execution.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Beacon != nil { - { - size, err := m.Beacon.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExecutionPayloadHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExecutionPayloadHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExecutionPayloadHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExcessBlobGas != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.ExcessBlobGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.BlobGasUsed != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.BlobGasUsed)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.WithdrawalsRoot) > 0 { - i -= len(m.WithdrawalsRoot) - copy(dAtA[i:], m.WithdrawalsRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.WithdrawalsRoot))) - i-- - dAtA[i] = 0x7a - } - if len(m.TransactionsRoot) > 0 { - i -= len(m.TransactionsRoot) - copy(dAtA[i:], m.TransactionsRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.TransactionsRoot))) - i-- - dAtA[i] = 0x72 - } - if len(m.BlockHash) > 0 { - i -= len(m.BlockHash) - copy(dAtA[i:], m.BlockHash) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.BlockHash))) - i-- - dAtA[i] = 0x6a - } - if len(m.BaseFeePerGas) > 0 { - i -= len(m.BaseFeePerGas) - copy(dAtA[i:], m.BaseFeePerGas) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.BaseFeePerGas))) - i-- - dAtA[i] = 0x62 - } - if len(m.ExtraData) > 0 { - i -= len(m.ExtraData) - copy(dAtA[i:], m.ExtraData) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ExtraData))) - i-- - dAtA[i] = 0x5a - } - if m.Timestamp != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x50 - } - if m.GasUsed != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.GasUsed)) - i-- - dAtA[i] = 0x48 - } - if m.GasLimit != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.GasLimit)) - i-- - dAtA[i] = 0x40 - } - if m.BlockNumber != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.BlockNumber)) - i-- - dAtA[i] = 0x38 - } - if len(m.PrevRandao) > 0 { - i -= len(m.PrevRandao) - copy(dAtA[i:], m.PrevRandao) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.PrevRandao))) - i-- - dAtA[i] = 0x32 - } - if len(m.LogsBloom) > 0 { - i -= len(m.LogsBloom) - copy(dAtA[i:], m.LogsBloom) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.LogsBloom))) - i-- - dAtA[i] = 0x2a - } - if len(m.ReceiptsRoot) > 0 { - i -= len(m.ReceiptsRoot) - copy(dAtA[i:], m.ReceiptsRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ReceiptsRoot))) - i-- - dAtA[i] = 0x22 - } - if len(m.StateRoot) > 0 { - i -= len(m.StateRoot) - copy(dAtA[i:], m.StateRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.StateRoot))) - i-- - dAtA[i] = 0x1a - } - if len(m.FeeRecipient) > 0 { - i -= len(m.FeeRecipient) - copy(dAtA[i:], m.FeeRecipient) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.FeeRecipient))) - i-- - dAtA[i] = 0x12 - } - if len(m.ParentHash) > 0 { - i -= len(m.ParentHash) - copy(dAtA[i:], m.ParentHash) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ParentHash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BeaconBlockHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BeaconBlockHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BeaconBlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BodyRoot) > 0 { - i -= len(m.BodyRoot) - copy(dAtA[i:], m.BodyRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.BodyRoot))) - i-- - dAtA[i] = 0x2a - } - if len(m.StateRoot) > 0 { - i -= len(m.StateRoot) - copy(dAtA[i:], m.StateRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.StateRoot))) - i-- - dAtA[i] = 0x22 - } - if len(m.ParentRoot) > 0 { - i -= len(m.ParentRoot) - copy(dAtA[i:], m.ParentRoot) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ParentRoot))) - i-- - dAtA[i] = 0x1a - } - if m.ProposerIndex != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.ProposerIndex)) - i-- - dAtA[i] = 0x10 - } - if m.Slot != 0 { - i = encodeVarintEthereum(dAtA, i, uint64(m.Slot)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *FinalizedHeaderMisbehaviour) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FinalizedHeaderMisbehaviour) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FinalizedHeaderMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsensusUpdate_2 != nil { - { - size, err := m.ConsensusUpdate_2.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.ConsensusUpdate_1 != nil { - { - size, err := m.ConsensusUpdate_1.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.TrustedSyncCommittee != nil { - { - size, err := m.TrustedSyncCommittee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ClientId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NextSyncCommitteeMisbehaviour) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NextSyncCommitteeMisbehaviour) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NextSyncCommitteeMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsensusUpdate_2 != nil { - { - size, err := m.ConsensusUpdate_2.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.ConsensusUpdate_1 != nil { - { - size, err := m.ConsensusUpdate_1.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.TrustedSyncCommittee != nil { - { - size, err := m.TrustedSyncCommittee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEthereum(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = encodeVarintEthereum(dAtA, i, uint64(len(m.ClientId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintEthereum(dAtA []byte, offset int, v uint64) int { - offset -= sovEthereum(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *StorageProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if len(m.Proof) > 0 { - for _, b := range m.Proof { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - return n -} - -func (m *AccountProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.StorageRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if len(m.Proof) > 0 { - for _, b := range m.Proof { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - return n -} - -func (m *ClientState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.GenesisValidatorsRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.MinSyncCommitteeParticipants != 0 { - n += 1 + sovEthereum(uint64(m.MinSyncCommitteeParticipants)) - } - if m.GenesisTime != 0 { - n += 1 + sovEthereum(uint64(m.GenesisTime)) - } - if m.ForkParameters != nil { - l = m.ForkParameters.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.SecondsPerSlot != 0 { - n += 1 + sovEthereum(uint64(m.SecondsPerSlot)) - } - if m.SlotsPerEpoch != 0 { - n += 1 + sovEthereum(uint64(m.SlotsPerEpoch)) - } - if m.EpochsPerSyncCommitteePeriod != 0 { - n += 1 + sovEthereum(uint64(m.EpochsPerSyncCommitteePeriod)) - } - if m.LatestSlot != 0 { - n += 1 + sovEthereum(uint64(m.LatestSlot)) - } - if m.FrozenHeight != nil { - l = m.FrozenHeight.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.IbcCommitmentSlot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.IbcContractAddress) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *ConsensusState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Slot != 0 { - n += 1 + sovEthereum(uint64(m.Slot)) - } - l = len(m.StateRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.StorageRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Timestamp != 0 { - n += 1 + sovEthereum(uint64(m.Timestamp)) - } - l = len(m.CurrentSyncCommittee) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.NextSyncCommittee) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *Header) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TrustedSyncCommittee != nil { - l = m.TrustedSyncCommittee.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.ConsensusUpdate != nil { - l = m.ConsensusUpdate.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.AccountUpdate != nil { - l = m.AccountUpdate.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *Misbehaviour) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TrustedSyncCommittee != nil { - l = m.TrustedSyncCommittee.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Update_1 != nil { - l = m.Update_1.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Update_2 != nil { - l = m.Update_2.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *TrustedSyncCommittee) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TrustedHeight != nil { - l = m.TrustedHeight.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.CurrentSyncCommittee != nil { - l = m.CurrentSyncCommittee.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.NextSyncCommittee != nil { - l = m.NextSyncCommittee.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *ForkParameters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.GenesisForkVersion) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.GenesisSlot != 0 { - n += 1 + sovEthereum(uint64(m.GenesisSlot)) - } - if m.Altair != nil { - l = m.Altair.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Bellatrix != nil { - l = m.Bellatrix.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Capella != nil { - l = m.Capella.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Deneb != nil { - l = m.Deneb.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *Fork) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Version) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Epoch != 0 { - n += 1 + sovEthereum(uint64(m.Epoch)) - } - return n -} - -func (m *LightClientUpdate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AttestedHeader != nil { - l = m.AttestedHeader.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.NextSyncCommittee != nil { - l = m.NextSyncCommittee.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if len(m.NextSyncCommitteeBranch) > 0 { - for _, b := range m.NextSyncCommitteeBranch { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - if m.FinalizedHeader != nil { - l = m.FinalizedHeader.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if len(m.FinalityBranch) > 0 { - for _, b := range m.FinalityBranch { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - if m.SyncAggregate != nil { - l = m.SyncAggregate.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.SignatureSlot != 0 { - n += 1 + sovEthereum(uint64(m.SignatureSlot)) - } - return n -} - -func (m *SyncCommittee) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Pubkeys) > 0 { - for _, b := range m.Pubkeys { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - l = len(m.AggregatePubkey) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *SyncAggregate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SyncCommitteeBits) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.SyncCommitteeSignature) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *ExecutionUpdate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.StateRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if len(m.StateRootBranch) > 0 { - for _, b := range m.StateRootBranch { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - if m.BlockNumber != 0 { - n += 1 + sovEthereum(uint64(m.BlockNumber)) - } - if len(m.BlockNumberBranch) > 0 { - for _, b := range m.BlockNumberBranch { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - return n -} - -func (m *AccountUpdate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AccountProof != nil { - l = m.AccountProof.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *LightClientHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Beacon != nil { - l = m.Beacon.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.Execution != nil { - l = m.Execution.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if len(m.ExecutionBranch) > 0 { - for _, b := range m.ExecutionBranch { - l = len(b) - n += 1 + l + sovEthereum(uint64(l)) - } - } - return n -} - -func (m *ExecutionPayloadHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ParentHash) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.FeeRecipient) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.StateRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.ReceiptsRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.LogsBloom) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.PrevRandao) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.BlockNumber != 0 { - n += 1 + sovEthereum(uint64(m.BlockNumber)) - } - if m.GasLimit != 0 { - n += 1 + sovEthereum(uint64(m.GasLimit)) - } - if m.GasUsed != 0 { - n += 1 + sovEthereum(uint64(m.GasUsed)) - } - if m.Timestamp != 0 { - n += 1 + sovEthereum(uint64(m.Timestamp)) - } - l = len(m.ExtraData) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.BaseFeePerGas) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.TransactionsRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.WithdrawalsRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.BlobGasUsed != 0 { - n += 2 + sovEthereum(uint64(m.BlobGasUsed)) - } - if m.ExcessBlobGas != 0 { - n += 2 + sovEthereum(uint64(m.ExcessBlobGas)) - } - return n -} - -func (m *BeaconBlockHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Slot != 0 { - n += 1 + sovEthereum(uint64(m.Slot)) - } - if m.ProposerIndex != 0 { - n += 1 + sovEthereum(uint64(m.ProposerIndex)) - } - l = len(m.ParentRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.StateRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - l = len(m.BodyRoot) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *FinalizedHeaderMisbehaviour) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.TrustedSyncCommittee != nil { - l = m.TrustedSyncCommittee.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.ConsensusUpdate_1 != nil { - l = m.ConsensusUpdate_1.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.ConsensusUpdate_2 != nil { - l = m.ConsensusUpdate_2.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func (m *NextSyncCommitteeMisbehaviour) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovEthereum(uint64(l)) - } - if m.TrustedSyncCommittee != nil { - l = m.TrustedSyncCommittee.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.ConsensusUpdate_1 != nil { - l = m.ConsensusUpdate_1.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - if m.ConsensusUpdate_2 != nil { - l = m.ConsensusUpdate_2.Size() - n += 1 + l + sovEthereum(uint64(l)) - } - return n -} - -func sovEthereum(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEthereum(x uint64) (n int) { - return sovEthereum(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *StorageProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StorageProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StorageProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proof = append(m.Proof, make([]byte, postIndex-iNdEx)) - copy(m.Proof[len(m.Proof)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AccountProof) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AccountProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AccountProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StorageRoot = append(m.StorageRoot[:0], dAtA[iNdEx:postIndex]...) - if m.StorageRoot == nil { - m.StorageRoot = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proof = append(m.Proof, make([]byte, postIndex-iNdEx)) - copy(m.Proof[len(m.Proof)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClientState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClientState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GenesisValidatorsRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GenesisValidatorsRoot = append(m.GenesisValidatorsRoot[:0], dAtA[iNdEx:postIndex]...) - if m.GenesisValidatorsRoot == nil { - m.GenesisValidatorsRoot = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSyncCommitteeParticipants", wireType) - } - m.MinSyncCommitteeParticipants = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinSyncCommitteeParticipants |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GenesisTime", wireType) - } - m.GenesisTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GenesisTime |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ForkParameters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ForkParameters == nil { - m.ForkParameters = &ForkParameters{} - } - if err := m.ForkParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SecondsPerSlot", wireType) - } - m.SecondsPerSlot = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SecondsPerSlot |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SlotsPerEpoch", wireType) - } - m.SlotsPerEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SlotsPerEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochsPerSyncCommitteePeriod", wireType) - } - m.EpochsPerSyncCommitteePeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EpochsPerSyncCommitteePeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestSlot", wireType) - } - m.LatestSlot = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LatestSlot |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FrozenHeight", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.FrozenHeight == nil { - m.FrozenHeight = &types.Height{} - } - if err := m.FrozenHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IbcCommitmentSlot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IbcCommitmentSlot = append(m.IbcCommitmentSlot[:0], dAtA[iNdEx:postIndex]...) - if m.IbcCommitmentSlot == nil { - m.IbcCommitmentSlot = []byte{} - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IbcContractAddress", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IbcContractAddress = append(m.IbcContractAddress[:0], dAtA[iNdEx:postIndex]...) - if m.IbcContractAddress == nil { - m.IbcContractAddress = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ConsensusState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConsensusState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsensusState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) - } - m.Slot = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Slot |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) - if m.StateRoot == nil { - m.StateRoot = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StorageRoot = append(m.StorageRoot[:0], dAtA[iNdEx:postIndex]...) - if m.StorageRoot == nil { - m.StorageRoot = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentSyncCommittee", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CurrentSyncCommittee = append(m.CurrentSyncCommittee[:0], dAtA[iNdEx:postIndex]...) - if m.CurrentSyncCommittee == nil { - m.CurrentSyncCommittee = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextSyncCommittee", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NextSyncCommittee = append(m.NextSyncCommittee[:0], dAtA[iNdEx:postIndex]...) - if m.NextSyncCommittee == nil { - m.NextSyncCommittee = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Header: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrustedSyncCommittee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TrustedSyncCommittee == nil { - m.TrustedSyncCommittee = &TrustedSyncCommittee{} - } - if err := m.TrustedSyncCommittee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusUpdate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusUpdate == nil { - m.ConsensusUpdate = &LightClientUpdate{} - } - if err := m.ConsensusUpdate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountUpdate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AccountUpdate == nil { - m.AccountUpdate = &AccountUpdate{} - } - if err := m.AccountUpdate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Misbehaviour) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Misbehaviour: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Misbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrustedSyncCommittee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TrustedSyncCommittee == nil { - m.TrustedSyncCommittee = &TrustedSyncCommittee{} - } - if err := m.TrustedSyncCommittee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Update_1", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Update_1 == nil { - m.Update_1 = &LightClientUpdate{} - } - if err := m.Update_1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Update_2", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Update_2 == nil { - m.Update_2 = &LightClientUpdate{} - } - if err := m.Update_2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TrustedSyncCommittee) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TrustedSyncCommittee: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TrustedSyncCommittee: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrustedHeight", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TrustedHeight == nil { - m.TrustedHeight = &types.Height{} - } - if err := m.TrustedHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentSyncCommittee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CurrentSyncCommittee == nil { - m.CurrentSyncCommittee = &SyncCommittee{} - } - if err := m.CurrentSyncCommittee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextSyncCommittee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NextSyncCommittee == nil { - m.NextSyncCommittee = &SyncCommittee{} - } - if err := m.NextSyncCommittee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ForkParameters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ForkParameters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForkParameters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GenesisForkVersion", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GenesisForkVersion = append(m.GenesisForkVersion[:0], dAtA[iNdEx:postIndex]...) - if m.GenesisForkVersion == nil { - m.GenesisForkVersion = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GenesisSlot", wireType) - } - m.GenesisSlot = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GenesisSlot |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Altair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Altair == nil { - m.Altair = &Fork{} - } - if err := m.Altair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bellatrix", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Bellatrix == nil { - m.Bellatrix = &Fork{} - } - if err := m.Bellatrix.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Capella", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Capella == nil { - m.Capella = &Fork{} - } - if err := m.Capella.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deneb", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Deneb == nil { - m.Deneb = &Fork{} - } - if err := m.Deneb.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Fork) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Fork: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Fork: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = append(m.Version[:0], dAtA[iNdEx:postIndex]...) - if m.Version == nil { - m.Version = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LightClientUpdate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LightClientUpdate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LightClientUpdate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AttestedHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AttestedHeader == nil { - m.AttestedHeader = &LightClientHeader{} - } - if err := m.AttestedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextSyncCommittee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NextSyncCommittee == nil { - m.NextSyncCommittee = &SyncCommittee{} - } - if err := m.NextSyncCommittee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextSyncCommitteeBranch", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NextSyncCommitteeBranch = append(m.NextSyncCommitteeBranch, make([]byte, postIndex-iNdEx)) - copy(m.NextSyncCommitteeBranch[len(m.NextSyncCommitteeBranch)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalizedHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.FinalizedHeader == nil { - m.FinalizedHeader = &LightClientHeader{} - } - if err := m.FinalizedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalityBranch", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FinalityBranch = append(m.FinalityBranch, make([]byte, postIndex-iNdEx)) - copy(m.FinalityBranch[len(m.FinalityBranch)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SyncAggregate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SyncAggregate == nil { - m.SyncAggregate = &SyncAggregate{} - } - if err := m.SyncAggregate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SignatureSlot", wireType) - } - m.SignatureSlot = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SignatureSlot |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncCommittee) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SyncCommittee: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SyncCommittee: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pubkeys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pubkeys = append(m.Pubkeys, make([]byte, postIndex-iNdEx)) - copy(m.Pubkeys[len(m.Pubkeys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregatePubkey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AggregatePubkey = append(m.AggregatePubkey[:0], dAtA[iNdEx:postIndex]...) - if m.AggregatePubkey == nil { - m.AggregatePubkey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncAggregate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SyncAggregate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SyncAggregate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SyncCommitteeBits", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SyncCommitteeBits = append(m.SyncCommitteeBits[:0], dAtA[iNdEx:postIndex]...) - if m.SyncCommitteeBits == nil { - m.SyncCommitteeBits = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SyncCommitteeSignature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SyncCommitteeSignature = append(m.SyncCommitteeSignature[:0], dAtA[iNdEx:postIndex]...) - if m.SyncCommitteeSignature == nil { - m.SyncCommitteeSignature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExecutionUpdate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExecutionUpdate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExecutionUpdate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) - if m.StateRoot == nil { - m.StateRoot = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateRootBranch", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StateRootBranch = append(m.StateRootBranch, make([]byte, postIndex-iNdEx)) - copy(m.StateRootBranch[len(m.StateRootBranch)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) - } - m.BlockNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumberBranch", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockNumberBranch = append(m.BlockNumberBranch, make([]byte, postIndex-iNdEx)) - copy(m.BlockNumberBranch[len(m.BlockNumberBranch)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AccountUpdate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AccountUpdate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AccountUpdate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountProof", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AccountProof == nil { - m.AccountProof = &AccountProof{} - } - if err := m.AccountProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LightClientHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LightClientHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LightClientHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Beacon", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Beacon == nil { - m.Beacon = &BeaconBlockHeader{} - } - if err := m.Beacon.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Execution", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Execution == nil { - m.Execution = &ExecutionPayloadHeader{} - } - if err := m.Execution.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecutionBranch", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExecutionBranch = append(m.ExecutionBranch, make([]byte, postIndex-iNdEx)) - copy(m.ExecutionBranch[len(m.ExecutionBranch)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExecutionPayloadHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExecutionPayloadHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExecutionPayloadHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParentHash = append(m.ParentHash[:0], dAtA[iNdEx:postIndex]...) - if m.ParentHash == nil { - m.ParentHash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeRecipient", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FeeRecipient = append(m.FeeRecipient[:0], dAtA[iNdEx:postIndex]...) - if m.FeeRecipient == nil { - m.FeeRecipient = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) - if m.StateRoot == nil { - m.StateRoot = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiptsRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ReceiptsRoot = append(m.ReceiptsRoot[:0], dAtA[iNdEx:postIndex]...) - if m.ReceiptsRoot == nil { - m.ReceiptsRoot = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LogsBloom", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LogsBloom = append(m.LogsBloom[:0], dAtA[iNdEx:postIndex]...) - if m.LogsBloom == nil { - m.LogsBloom = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevRandao", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevRandao = append(m.PrevRandao[:0], dAtA[iNdEx:postIndex]...) - if m.PrevRandao == nil { - m.PrevRandao = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) - } - m.BlockNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) - } - m.GasLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) - } - m.GasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasUsed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtraData", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExtraData = append(m.ExtraData[:0], dAtA[iNdEx:postIndex]...) - if m.ExtraData == nil { - m.ExtraData = []byte{} - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseFeePerGas", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseFeePerGas = append(m.BaseFeePerGas[:0], dAtA[iNdEx:postIndex]...) - if m.BaseFeePerGas == nil { - m.BaseFeePerGas = []byte{} - } - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionsRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransactionsRoot = append(m.TransactionsRoot[:0], dAtA[iNdEx:postIndex]...) - if m.TransactionsRoot == nil { - m.TransactionsRoot = []byte{} - } - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawalsRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WithdrawalsRoot = append(m.WithdrawalsRoot[:0], dAtA[iNdEx:postIndex]...) - if m.WithdrawalsRoot == nil { - m.WithdrawalsRoot = []byte{} - } - iNdEx = postIndex - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlobGasUsed", wireType) - } - m.BlobGasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlobGasUsed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExcessBlobGas", wireType) - } - m.ExcessBlobGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExcessBlobGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BeaconBlockHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BeaconBlockHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BeaconBlockHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) - } - m.Slot = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Slot |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposerIndex", wireType) - } - m.ProposerIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposerIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParentRoot = append(m.ParentRoot[:0], dAtA[iNdEx:postIndex]...) - if m.ParentRoot == nil { - m.ParentRoot = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) - if m.StateRoot == nil { - m.StateRoot = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodyRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BodyRoot = append(m.BodyRoot[:0], dAtA[iNdEx:postIndex]...) - if m.BodyRoot == nil { - m.BodyRoot = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FinalizedHeaderMisbehaviour) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FinalizedHeaderMisbehaviour: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FinalizedHeaderMisbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrustedSyncCommittee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TrustedSyncCommittee == nil { - m.TrustedSyncCommittee = &TrustedSyncCommittee{} - } - if err := m.TrustedSyncCommittee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusUpdate_1", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusUpdate_1 == nil { - m.ConsensusUpdate_1 = &LightClientUpdate{} - } - if err := m.ConsensusUpdate_1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusUpdate_2", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusUpdate_2 == nil { - m.ConsensusUpdate_2 = &LightClientUpdate{} - } - if err := m.ConsensusUpdate_2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NextSyncCommitteeMisbehaviour) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NextSyncCommitteeMisbehaviour: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NextSyncCommitteeMisbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrustedSyncCommittee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TrustedSyncCommittee == nil { - m.TrustedSyncCommittee = &TrustedSyncCommittee{} - } - if err := m.TrustedSyncCommittee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusUpdate_1", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusUpdate_1 == nil { - m.ConsensusUpdate_1 = &LightClientUpdate{} - } - if err := m.ConsensusUpdate_1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusUpdate_2", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEthereum - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEthereum - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEthereum - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusUpdate_2 == nil { - m.ConsensusUpdate_2 = &LightClientUpdate{} - } - if err := m.ConsensusUpdate_2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEthereum(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEthereum - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipEthereum(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEthereum - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEthereum - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEthereum - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthEthereum - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupEthereum - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthEthereum - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthEthereum = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEthereum = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupEthereum = fmt.Errorf("proto: unexpected end of group") -) diff --git a/e2e/interchaintestv8/types/rust_fixtures.go b/e2e/interchaintestv8/types/rust_fixtures.go index 45e0d0b9..592861e3 100644 --- a/e2e/interchaintestv8/types/rust_fixtures.go +++ b/e2e/interchaintestv8/types/rust_fixtures.go @@ -8,44 +8,14 @@ import ( "github.com/stretchr/testify/suite" - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" - "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/testvalues" - ethereumlightclient "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereumlightclient" + ethereumtypes "github.com/srdtrk/solidity-ibc-eureka/e2e/v8/types/ethereum" ) -type InitialStateFixture struct { - ClientState ethereumlightclient.ClientState `json:"client_state"` - ConsensusState ethereumlightclient.ConsensusState `json:"consensus_state"` -} - -type CommitmentProofFixture struct { - Path []byte `json:"path"` - StorageProof ethereumlightclient.StorageProof `json:"storage_proof"` - ProofHeight clienttypes.Height `json:"proof_height"` - ClientState ethereumlightclient.ClientState `json:"client_state"` - ConsensusState ethereumlightclient.ConsensusState `json:"consensus_state"` -} - -type UpdateClientFixture struct { - ClientState ethereumlightclient.ClientState `json:"client_state"` - ConsensusState ethereumlightclient.ConsensusState `json:"consensus_state"` - Updates []ethereumlightclient.Header `json:"updates"` -} - -type Step struct { - Name string `json:"name"` - Data interface{} `json:"data"` -} - -type RustFixture struct { - Steps []Step `json:"steps"` -} - type RustFixtureGenerator struct { shouldGenerateFixture bool - fixture RustFixture + fixture ethereumtypes.StepsFixture } // NewRustFixtureGenerator creates a new RustFixtureGenerator @@ -75,7 +45,7 @@ func (g *RustFixtureGenerator) AddFixtureStep(stepName string, jsonMarshalble in return } - g.fixture.Steps = append(g.fixture.Steps, Step{ + g.fixture.Steps = append(g.fixture.Steps, ethereumtypes.Step{ Name: stepName, Data: jsonMarshalble, }) diff --git a/e2e/interchaintestv8/wasm/cw_ics08_wasm_eth.wasm.gz b/e2e/interchaintestv8/wasm/cw_ics08_wasm_eth.wasm.gz new file mode 100644 index 000000000..4340ae84 Binary files /dev/null and b/e2e/interchaintestv8/wasm/cw_ics08_wasm_eth.wasm.gz differ diff --git a/e2e/interchaintestv8/wasm/ethereum_light_client_minimal.wasm.gz b/e2e/interchaintestv8/wasm/ethereum_light_client_minimal.wasm.gz deleted file mode 100755 index 2acfe646..000000000 Binary files a/e2e/interchaintestv8/wasm/ethereum_light_client_minimal.wasm.gz and /dev/null differ diff --git a/justfile b/justfile index 7cbe576d..40b89379 100644 --- a/justfile +++ b/justfile @@ -23,8 +23,11 @@ build-sp1-programs: cd programs/sp1-programs/misbehaviour && ~/.sp1/bin/cargo-prove prove build --elf-name misbehaviour-riscv32im-succinct-zkvm-elf @echo "ELF created at 'elf/misbehaviour-riscv32im-succinct-zkvm-elf'" -build-optimized-wasm: +# Build and optimize the eth wasm light client using `cosmwasm/optimizer`. Requires `docker` and `gzip` +build-cw-ics08-wasm-eth: docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/optimizer:0.16.1 ./programs/cw-ics08-wasm-eth + cp artifacts/cw_ics08_wasm_eth.wasm e2e/interchaintestv8/wasm + gzip e2e/interchaintestv8/wasm/cw_ics08_wasm_eth.wasm -f # Clean up the cache and out directories clean: @@ -80,6 +83,16 @@ generate-abi: build-contracts abigen --abi abi/IBCERC20.json --pkg ibcerc20 --type Contract --out abigen/ibcerc20/contract.go abigen --abi abi/ICS20Lib.json --pkg ics20lib --type Lib --out abigen/ics20lib/lib.go +# Generate go types for the e2e tests from the etheruem light client code +generate-ethereum-types: + cargo run --bin generate_json_schema --features test-utils + quicktype --src-lang schema --lang go --just-types-and-package --package ethereum --src ethereum_types_schema.json --out e2e/interchaintestv8/types/ethereum/types.gen.go --top-level GeneratedTypes + rm ethereum_types_schema.json + sed -i.bak 's/int64/uint64/g' e2e/interchaintestv8/types/ethereum/types.gen.go # quicktype generates int64 instead of uint64 :( + rm -f e2e/interchaintestv8/types/ethereum/types.gen.go.bak # this is to be linux and mac compatible (coming from the sed command) + cd e2e/interchaintestv8 && golangci-lint run --fix types/ethereum/types.gen.go + +# Run the e2e tests # Run any e2e test in the interchaintestv8 test suite using the test's full name # For example, `just test-e2e TestWithIbcEurekaTestSuite/TestDeploy_Groth16` test-e2e testname: clean @@ -176,13 +189,15 @@ generate-fixtures-sp1-ics07: build-operator cd e2e/interchaintestv8 && RUST_LOG=info SP1_PROVER=network GENERATE_SOLIDITY_FIXTURES=true go test -v -run '^TestWithSP1ICS07TendermintTestSuite/Test25Membership_Plonk' -timeout 40m @echo "Fixtures generated at 'test/sp1-ics07/fixtures'" -protoImageName := "ghcr.io/cosmos/proto-builder:0.14.0" -DOCKER := `which docker` - -# Generate the union proto files -union-proto-gen: - @echo "Generating Protobuf files" - {{DOCKER}} run --rm -v {{`pwd`}}:/workspace --workdir /workspace {{protoImageName}} ./e2e/interchaintestv8/proto/protocgen.sh +# Generate the fixtures for the Rust tests using the e2e tests +generate-fixtures-rust: clean + @echo "Generating fixtures... This may take a while." + @echo "Generating recvPacket and acknowledgePacket groth16 fixtures..." + cd e2e/interchaintestv8 && GENERATE_RUST_FIXTURES=true SP1_PROVER=network go test -v -run '^TestWithIbcEurekaTestSuite/TestICS20TransferERC20TokenfromEthereumToCosmosAndBack_Groth16$' -timeout 40m + @echo "Generating native SdkCoin recvPacket groth16 fixtures..." + cd e2e/interchaintestv8 && GENERATE_RUST_FIXTURES=true SP1_PROVER=network go test -v -run '^TestWithIbcEurekaTestSuite/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16$' -timeout 40m + @echo "Generating timeoutPacket groth16 fixtures..." + cd e2e/interchaintestv8 && GENERATE_RUST_FIXTURES=true SP1_PROVER=network go test -v -run '^TestWithIbcEurekaTestSuite/TestICS20TransferTimeoutFromEthereumToCosmosChain_Groth16$' -timeout 40m # Generate the relayer proto files relayer-proto-gen: diff --git a/packages/ethereum-light-client/Cargo.toml b/packages/ethereum-light-client/Cargo.toml index 1fd97b9b..980b91ee 100644 --- a/packages/ethereum-light-client/Cargo.toml +++ b/packages/ethereum-light-client/Cargo.toml @@ -4,31 +4,30 @@ version = { workspace = true } edition = { workspace = true } repository = { workspace = true } +[features] +test-utils = ["dep:milagro_bls"] + +[[bin]] +name = "generate_json_schema" +path = "src/bin/generate_json_schema.rs" + [dependencies] ethereum-trie-db = { workspace = true } ethereum-utils = { workspace = true } +ethereum-types = { workspace = true } -alloy-primitives = { workspace = true } -alloy-rpc-types-eth = { workspace = true } -alloy-rpc-types-beacon = { workspace = true } -alloy-rpc-types-engine = { workspace = true } +alloy-primitives = { workspace = true, features = ["serde", "hex-compat"] } alloy-trie = { workspace = true } -alloy-serde = { workspace = true } -alloy-rlp = { workspace = true } -ethereum_ssz = { workspace = true } -ethereum_ssz_derive = { workspace = true } +alloy-rlp = { workspace = true, features = ["arrayvec"] } tree_hash = { workspace = true } -tree_hash_derive = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } thiserror = { workspace = true } sha2 = { workspace = true } -serde_with = { workspace = true, features = ["base64"] } +schemars = { workspace = true } +hex = { workspace = true } + +# Only used for test-utils feature +milagro_bls = { workspace = true, optional = true } -# TODO: From union (might be removed if they are replaced by something more standard). #147 -typenum = { workspace = true, features = ["const-generics"] } -[dev-dependencies] -milagro_bls = { workspace = true } -base64 = { workspace = true } -ethereum-test-utils = { workspace = true } diff --git a/packages/ethereum-light-client/src/bin/generate_json_schema.rs b/packages/ethereum-light-client/src/bin/generate_json_schema.rs new file mode 100644 index 000000000..fb8d835a --- /dev/null +++ b/packages/ethereum-light-client/src/bin/generate_json_schema.rs @@ -0,0 +1,45 @@ +#![allow(unused_crate_dependencies)] + +use ethereum_light_client::{ + client_state::ClientState, consensus_state::ConsensusState, header::Header, +}; + +#[cfg(feature = "test-utils")] +use ethereum_light_client::test_utils::fixtures::{ + CommitmentProof, InitialState, Step, StepsFixture, UpdateClient, +}; + +use ethereum_types::execution::storage_proof::StorageProof; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +/// The Ethereum types to export to JSON Schema and used to generate types in other languages +/// The structure itself is not used for anything else than being able to generate a single schema +#[derive(Serialize, Deserialize, JsonSchema)] +struct EthereumExportTypes { + client_state: ClientState, + consensus_state: ConsensusState, + header: Header, + storage_proof: StorageProof, + #[cfg(feature = "test-utils")] + test_fixtures: TestFixtures, +} + +#[cfg(feature = "test-utils")] +#[derive(Serialize, Deserialize, JsonSchema)] +struct TestFixtures { + steps_fixture: StepsFixture, + step: Step, + initial_state: InitialState, + commitment_proof: CommitmentProof, + update_client: UpdateClient, +} + +fn main() { + let schema = schemars::schema_for!(EthereumExportTypes); + std::fs::write( + "ethereum_types_schema.json", + serde_json::to_string_pretty(&schema).expect("Failed to serialize schema"), + ) + .expect("Failed to write schema to file"); +} diff --git a/packages/ethereum-light-client/src/client_state.rs b/packages/ethereum-light-client/src/client_state.rs index 49fce0dd..c5b9d36b 100644 --- a/packages/ethereum-light-client/src/client_state.rs +++ b/packages/ethereum-light-client/src/client_state.rs @@ -1,24 +1,21 @@ //! This module defines [`ClientState`]. use alloy_primitives::{Address, B256, U256}; +use ethereum_types::consensus::fork::ForkParameters; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; - -use crate::types::{fork_parameters::ForkParameters, height::Height}; /// The ethereum client state -#[serde_as] -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] pub struct ClientState { /// The chain ID - #[serde_as(as = "DisplayFromStr")] pub chain_id: u64, /// The genesis validators root - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub genesis_validators_root: B256, /// The minimum number of participants in the sync committee - pub min_sync_committee_participants: u64, // TODO: Needs be added to e2e tests #143 - /// The time of genesis + pub min_sync_committee_participants: u64, + /// The time of genesis (unix timestamp) pub genesis_time: u64, /// The fork parameters pub fork_parameters: ForkParameters, @@ -30,13 +27,12 @@ pub struct ClientState { pub epochs_per_sync_committee_period: u64, /// The latest slot of this client pub latest_slot: u64, - /// The height at which the client was frozen - // TODO: Should this be frozen_slot? Consider this in #143 - pub frozen_height: Height, + /// The slot at which the client was frozen + pub frozen_slot: u64, /// The address of the IBC contract being tracked on Ethereum - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub ibc_contract_address: Address, /// The storage slot of the IBC commitment in the Ethereum contract - #[serde(with = "ethereum_utils::base64::uint256")] + #[schemars(with = "String")] pub ibc_commitment_slot: U256, } diff --git a/packages/ethereum-light-client/src/config.rs b/packages/ethereum-light-client/src/config.rs deleted file mode 100644 index 715762eb..000000000 --- a/packages/ethereum-light-client/src/config.rs +++ /dev/null @@ -1,427 +0,0 @@ -//! The configuration module contains the configurations and presets for the beacon chains. - -use core::{ - fmt::{self, Debug}, - str::FromStr, -}; - -use serde::{Deserialize, Serialize}; -use typenum::{NonZero, Unsigned}; - -use alloy_primitives::FixedBytes; - -/// Minimal config. -#[derive(Debug, Clone, PartialEq, Eq, Default)] -pub struct Minimal; - -/// Mainnet config. -#[derive(Debug, Clone, PartialEq, Eq, Default)] -pub struct Mainnet; - -/// The base kind of the preset. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum PresetBaseKind { - /// Minimal preset - Minimal, - /// Mainnet preset - Mainnet, -} - -impl fmt::Display for PresetBaseKind { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str(match self { - Self::Minimal => "minimal", - Self::Mainnet => "mainnet", - }) - } -} - -impl FromStr for PresetBaseKind { - type Err = String; - - fn from_str(s: &str) -> Result { - match s { - "minimal" => Ok(Self::Minimal), - "mainnet" => Ok(Self::Mainnet), - _ => Err(s.to_string()), - } - } -} - -// https://github.com/rust-lang/rust/issues/35853#issuecomment-415993963 -macro_rules! with_dollar_sign { - ($($body:tt)*) => { - macro_rules! __with_dollar_sign { $($body)* } - __with_dollar_sign!($); - } -} - -macro_rules! consts_traits { - ($($CONST:ident $(,)?),+) => { - $( - #[allow(non_camel_case_types, missing_docs)] - pub trait $CONST: Send + Sync + Unpin + 'static { - // Extra traits are required because the builtin derives bound all generic - // types unconditionally - type $CONST: Unsigned + NonZero + Debug + Clone + PartialEq + Eq + Send + Sync + Unpin + Default; - } - )+ - - #[allow(missing_docs, clippy::trait_duplication_in_bounds)] - pub trait ChainSpec: 'static + Debug + Clone + PartialEq + Eq + Default + Send + Sync + Unpin + Default + $($CONST+)+ { - const PRESET: preset::Preset; - // const PRESET_BASE_KIND: PresetBaseKind; - - type PERIOD: 'static + Unsigned; - } - - with_dollar_sign! { - ($d:tt) => { - // TODO: Keep an eye on this issue https://github.com/rust-lang/rust/issues/98291, as it might resolve an issue with macro_export-ing this macro (currently it is only available in this crate) - macro_rules! mk_chain_spec { - ($d T:ident is $d preset:path) => { - $( - impl $d crate::config:: $CONST for $d T { - #[allow(non_camel_case_types)] - type $CONST = $d crate::typenum::U<{ $d preset.$CONST }>; - } - )* - - impl $d crate::config::ChainSpec for $d T { - const PRESET: $d crate::config::preset::Preset = $d preset; - // const PRESET_BASE_KIND: PresetBaseKind = PresetBaseKind::Mainnet; - - type PERIOD = $d crate::typenum::Prod< - ::EPOCHS_PER_SYNC_COMMITTEE_PERIOD, - ::SLOTS_PER_EPOCH, - >; - } - }; - } - } - } - }; -} - -consts_traits![ - // Misc - DEPOSIT_CONTRACT_TREE_DEPTH, - MAX_VALIDATORS_PER_COMMITTEE, - // Time parameters - SECONDS_PER_SLOT, - SLOTS_PER_EPOCH, - // Max operations per block - MAX_PROPOSER_SLASHINGS, - MAX_ATTESTER_SLASHINGS, - MAX_ATTESTATIONS, - MAX_DEPOSITS, - MAX_VOLUNTARY_EXITS, - MAX_BLS_TO_EXECUTION_CHANGES, - MAX_BLOB_COMMITMENTS_PER_BLOCK, - // Execution - MAX_BYTES_PER_TRANSACTION, - MAX_TRANSACTIONS_PER_PAYLOAD, - BYTES_PER_LOGS_BLOOM, - MAX_EXTRA_DATA_BYTES, - MAX_WITHDRAWALS_PER_PAYLOAD, - // Sync committee - SYNC_COMMITTEE_SIZE, - EPOCHS_PER_SYNC_COMMITTEE_PERIOD, - // Sync protocol - MIN_SYNC_COMMITTEE_PARTICIPANTS, - UPDATE_TIMEOUT, -]; - -self::mk_chain_spec!(Minimal is preset::MINIMAL); -self::mk_chain_spec!(Mainnet is preset::MAINNET); - -pub(crate) use mk_chain_spec; - -use crate::types::{fork::Fork, fork_parameters::ForkParameters, wrappers::WrappedVersion}; - -/// Values that are constant across all configurations. -pub mod consts { - /// - #[must_use] - pub const fn get_subtree_index(idx: u64) -> u64 { - idx % 2_u64.pow(idx.ilog2()) - } - - /// Convenience function safely to call [`u64::ilog2`] and convert the result into a usize. - #[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] - #[must_use] - pub const fn floorlog2(n: u64) -> usize { - // conversion is safe since usize is either 32 or 64 bits as per cfg above - n.ilog2() as usize - } - - // https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md#constants - // REVIEW: Is it possible to implement get_generalized_index in const rust? - - // https://github.com/ethereum/consensus-specs/blob/dev/ssz/merkle-proofs.md - /// `get_generalized_index(BeaconState, "finalized_checkpoint", "root")` - pub const FINALIZED_ROOT_INDEX: u64 = 105; - /// `get_generalized_index(BeaconState, "current_sync_committee")` - pub const CURRENT_SYNC_COMMITTEE_INDEX: u64 = 54; - /// `get_generalized_index(BeaconState, "next_sync_committee")` - pub const NEXT_SYNC_COMMITTEE_INDEX: u64 = 55; - /// `get_generalized_index(BeaconBlockBody, "execution_payload")` - pub const EXECUTION_PAYLOAD_INDEX: u64 = 25; - - // Branch depths for different merkle trees related to ethereum consensus - - /// The depth of the merkle tree for execution payloads. - pub const EXECUTION_BRANCH_DEPTH: usize = floorlog2(EXECUTION_PAYLOAD_INDEX); - /// The depth of the merkle tree for the next sync committee. - pub const NEXT_SYNC_COMMITTEE_BRANCH_DEPTH: usize = floorlog2(NEXT_SYNC_COMMITTEE_INDEX); - /// The depth of the merkle tree for the finalized root. - pub const FINALITY_BRANCH_DEPTH: usize = floorlog2(FINALIZED_ROOT_INDEX); -} - -/// This module contains the preset values for the different configurations. -pub mod preset { - /// The preset - #[allow(non_snake_case)] - #[derive(Debug, Default, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] - pub struct Preset { - // Misc - // --------------------------------------------------------------- - /// The depth of the deposit contract tree. - pub DEPOSIT_CONTRACT_TREE_DEPTH: usize, - /// The max number of validators per committee. - pub MAX_VALIDATORS_PER_COMMITTEE: usize, - - // Time parameters - // --------------------------------------------------------------- - /// The number of seconds per slot. - pub SECONDS_PER_SLOT: usize, - /// The number of slots per epoch. - pub SLOTS_PER_EPOCH: usize, - - // Max operations per block - // --------------------------------------------------------------- - /// The max number of proposer slashings per block. - pub MAX_PROPOSER_SLASHINGS: usize, - /// The max number of attester slashings per block. - pub MAX_ATTESTER_SLASHINGS: usize, - /// The max number of attestations per block. - pub MAX_ATTESTATIONS: usize, - /// The max number of deposits per block. - pub MAX_DEPOSITS: usize, - /// The max number of voluntary exits per block. - pub MAX_VOLUNTARY_EXITS: usize, - /// The max number of BLS to execution changes per block. - pub MAX_BLS_TO_EXECUTION_CHANGES: usize, - /// The max number of blob commitments per block. - pub MAX_BLOB_COMMITMENTS_PER_BLOCK: usize, - - // Execution - // --------------------------------------------------------------- - /// The max number of bytes per transaction. - pub MAX_BYTES_PER_TRANSACTION: usize, - /// The max number of transactions per payload. - pub MAX_TRANSACTIONS_PER_PAYLOAD: usize, - /// The number of bytes per logs bloom. - pub BYTES_PER_LOGS_BLOOM: usize, - /// The max number of extra data bytes. - pub MAX_EXTRA_DATA_BYTES: usize, - /// The max number of withdrawals per payload. - pub MAX_WITHDRAWALS_PER_PAYLOAD: usize, - - // Sync committee - // --------------------------------------------------------------- - /// The size of the sync committee. - pub SYNC_COMMITTEE_SIZE: usize, - /// The number of epochs per sync committee period. - pub EPOCHS_PER_SYNC_COMMITTEE_PERIOD: usize, - - // Sync protocol - // --------------------------------------------------------------- - /// The min number of sync committee participants. - pub MIN_SYNC_COMMITTEE_PARTICIPANTS: usize, - /// The update timeout. - pub UPDATE_TIMEOUT: usize, - } - - /// - pub const MAINNET: Preset = Preset { - DEPOSIT_CONTRACT_TREE_DEPTH: 32, - MAX_VALIDATORS_PER_COMMITTEE: 2048, - - SECONDS_PER_SLOT: 12, - SLOTS_PER_EPOCH: 32, - - MAX_PROPOSER_SLASHINGS: 16, - MAX_ATTESTER_SLASHINGS: 2, - MAX_ATTESTATIONS: 128, - MAX_DEPOSITS: 16, - MAX_VOLUNTARY_EXITS: 16, - MAX_BLS_TO_EXECUTION_CHANGES: 16, - MAX_BLOB_COMMITMENTS_PER_BLOCK: 4096, - SYNC_COMMITTEE_SIZE: 512, - EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 256, - MIN_SYNC_COMMITTEE_PARTICIPANTS: 1, - UPDATE_TIMEOUT: 8192, - - MAX_BYTES_PER_TRANSACTION: 1_073_741_824, - MAX_TRANSACTIONS_PER_PAYLOAD: 1_048_576, - BYTES_PER_LOGS_BLOOM: 256, - MAX_EXTRA_DATA_BYTES: 32, - MAX_WITHDRAWALS_PER_PAYLOAD: 16, - }; - - /// - pub const MINIMAL: Preset = Preset { - DEPOSIT_CONTRACT_TREE_DEPTH: 32, - MAX_VALIDATORS_PER_COMMITTEE: 2048, - - SECONDS_PER_SLOT: 6, - SLOTS_PER_EPOCH: 8, - - MAX_PROPOSER_SLASHINGS: 16, - MAX_ATTESTER_SLASHINGS: 2, - MAX_ATTESTATIONS: 128, - MAX_DEPOSITS: 16, - MAX_VOLUNTARY_EXITS: 16, - MAX_BLS_TO_EXECUTION_CHANGES: 16, - MAX_BLOB_COMMITMENTS_PER_BLOCK: 16, - - SYNC_COMMITTEE_SIZE: 32, - EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 8, - MIN_SYNC_COMMITTEE_PARTICIPANTS: 1, - UPDATE_TIMEOUT: 64, - - MAX_BYTES_PER_TRANSACTION: 1_073_741_824, - MAX_TRANSACTIONS_PER_PAYLOAD: 1_048_576, - BYTES_PER_LOGS_BLOOM: 256, - MAX_EXTRA_DATA_BYTES: 32, - MAX_WITHDRAWALS_PER_PAYLOAD: 4, - }; -} - -/// The configuration for the beacon chain. -#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct Config { - /// The preset - pub preset: preset::Preset, - /// The fork parameters - pub fork_parameters: ForkParameters, - /// The minimum genesis time - pub min_genesis_time: u64, -} - -/// The Goerli testnet configuration. -pub const GOERLI: Config = Config { - preset: preset::MAINNET, - fork_parameters: ForkParameters { - genesis_fork_version: WrappedVersion(FixedBytes([0, 0, 16, 32])), - genesis_slot: (0), - altair: Fork { - version: WrappedVersion(FixedBytes([1, 0, 16, 32])), - epoch: (36660), - }, - bellatrix: Fork { - version: WrappedVersion(FixedBytes([2, 0, 16, 32])), - epoch: 112_260, - }, - capella: Fork { - version: WrappedVersion(FixedBytes([3, 0, 16, 32])), - epoch: 162_304, - }, - deneb: Fork { - version: WrappedVersion(FixedBytes([4, 0, 16, 32])), - epoch: 231_680, - }, - }, - min_genesis_time: 1_614_588_812, -}; - -/// The mainnet configuration. -pub const MAINNET: Config = Config { - preset: preset::MAINNET, - fork_parameters: ForkParameters { - genesis_fork_version: WrappedVersion(FixedBytes([0, 0, 0, 0])), - genesis_slot: 0, - - altair: Fork { - version: WrappedVersion(FixedBytes([1, 0, 0, 0])), - epoch: 74_240, - }, - bellatrix: Fork { - version: WrappedVersion(FixedBytes([2, 0, 0, 0])), - epoch: 144_896, - }, - capella: Fork { - version: WrappedVersion(FixedBytes([3, 0, 0, 0])), - epoch: 194_048, - }, - // TODO: enabled march 13th 2024 - deneb: Fork { - version: WrappedVersion(FixedBytes([4, 0, 0, 0])), - epoch: u64::MAX, - }, - }, - min_genesis_time: 1_606_824_000, -}; - -/// The minimal configuration. -pub const MINIMAL: Config = Config { - preset: preset::MINIMAL, - fork_parameters: ForkParameters { - genesis_fork_version: WrappedVersion(FixedBytes([0, 0, 0, 1])), - genesis_slot: 0, - - altair: Fork { - version: WrappedVersion(FixedBytes([1, 0, 0, 1])), - epoch: 0, - }, - - bellatrix: Fork { - version: WrappedVersion(FixedBytes([2, 0, 0, 1])), - epoch: 0, - }, - - capella: Fork { - version: WrappedVersion(FixedBytes([3, 0, 0, 1])), - epoch: 0, - }, - - // NOTE: dummy data - deneb: Fork { - version: WrappedVersion(FixedBytes([4, 0, 0, 1])), - epoch: 0, - }, - }, - min_genesis_time: 1_578_009_600, -}; - -/// The sepolia testnet configuration. -pub const SEPOLIA: Config = Config { - preset: preset::MAINNET, - fork_parameters: ForkParameters { - genesis_fork_version: WrappedVersion(FixedBytes([144, 0, 0, 105])), - genesis_slot: 0, - - altair: Fork { - version: WrappedVersion(FixedBytes([144, 0, 0, 112])), - epoch: 50, - }, - - bellatrix: Fork { - version: WrappedVersion(FixedBytes([144, 0, 0, 113])), - epoch: 100, - }, - - capella: Fork { - version: WrappedVersion(FixedBytes([144, 0, 0, 114])), - epoch: 56_832, - }, - - deneb: Fork { - version: WrappedVersion(FixedBytes([144, 0, 0, 115])), - epoch: 132_608, - }, - }, - min_genesis_time: 1_655_647_200, -}; diff --git a/packages/ethereum-light-client/src/consensus_state.rs b/packages/ethereum-light-client/src/consensus_state.rs index b4dc2d23..b63c0f1e 100644 --- a/packages/ethereum-light-client/src/consensus_state.rs +++ b/packages/ethereum-light-client/src/consensus_state.rs @@ -1,34 +1,37 @@ //! This module defines [`ConsensusState`] and [`TrustedConsensusState`]. use alloy_primitives::{FixedBytes, B256}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use crate::types::sync_committee::{ActiveSyncCommittee, SyncCommittee}; +use ethereum_types::consensus::sync_committee::SyncCommittee; + +use crate::header::ActiveSyncCommittee; /// The consensus state of the Ethereum light client -#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone, Default)] +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Debug, Clone)] pub struct ConsensusState { /// The slot number pub slot: u64, /// The state merkle root - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub state_root: B256, /// The storage merkle root - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub storage_root: B256, - /// The timestamp of the consensus state - // TODO: document the timestamp format (seconds since epoch?) + /// The unix timestamp at the time of the slot. + /// It is calculated from the genesis time and slots per. pub timestamp: u64, /// aggregate public key of current sync committee - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub current_sync_committee: FixedBytes<48>, /// aggregate public key of next sync committee - #[serde(with = "ethereum_utils::base64::option_with_default")] + #[schemars(with = "String")] pub next_sync_committee: Option>, } /// The trusted consensus state of the Ethereum light client -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] #[allow(clippy::module_name_repetitions)] pub struct TrustedConsensusState { /// The consensus state @@ -38,7 +41,7 @@ pub struct TrustedConsensusState { /// /// This sync committee can either be the current sync committee or the next sync /// committee. That's because the verifier uses next or current sync committee's - /// public keys to verify the signature against. It is based on + /// public keys to verify the signature against. pub sync_committee: ActiveSyncCommittee, } diff --git a/packages/ethereum-light-client/src/error.rs b/packages/ethereum-light-client/src/error.rs index 1b8c9492..6b3b1c46 100644 --- a/packages/ethereum-light-client/src/error.rs +++ b/packages/ethereum-light-client/src/error.rs @@ -1,14 +1,11 @@ //! This module defines [`EthereumIBCError`]. use alloy_primitives::B256; -use alloy_rpc_types_beacon::BlsPublicKey; +use ethereum_types::consensus::bls::BlsPublicKey; #[derive(thiserror::Error, Debug, Clone, PartialEq)] #[allow(missing_docs, clippy::module_name_repetitions)] pub enum EthereumIBCError { - #[error(transparent)] - EthereumUtilsError(#[from] ethereum_utils::error::EthereumUtilsError), - #[error("IBC path is empty")] EmptyPath, @@ -18,8 +15,11 @@ pub enum EthereumIBCError { #[error("invalid commitment key, expected ({0}) but found ({1})")] InvalidCommitmentKey(String, String), - #[error("expected value ({0}) and stored value ({1}) don't match")] - StoredValueMistmatch(String, String), + #[error("expected value ({expected}) and stored value ({actual}) don't match", + expected = hex::encode(expected), + actual = hex::encode(actual) + )] + StoredValueMistmatch { expected: Vec, actual: Vec }, #[error("verify storage proof error: {0}")] VerifyStorageProof(String), @@ -120,6 +120,19 @@ pub enum EthereumIBCError { #[error("failed to verify next sync committee against attested header: {0}")] ValidateNextSyncCommitteeFailed(#[source] Box), + + #[error("client's store period must be equal to update's finalized period")] + StorePeriodMustBeEqualToFinalizedPeriod, + + #[error("failed to compute slot at timestamp with \ + (timestamp ({timestamp}) - genesis ({genesis})) / seconds_per_slot ({seconds_per_slot}) + genesis_slot ({genesis_slot})" + )] + FailedToComputeSlotAtTimestamp { + timestamp: u64, + genesis: u64, + seconds_per_slot: u64, + genesis_slot: u64, + }, } #[derive(Debug, PartialEq, Eq, Clone, thiserror::Error)] diff --git a/packages/ethereum-light-client/src/header.rs b/packages/ethereum-light-client/src/header.rs new file mode 100644 index 000000000..293dde65 --- /dev/null +++ b/packages/ethereum-light-client/src/header.rs @@ -0,0 +1,45 @@ +//! This module defines types related to the Header we use for the Ethereum light client + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use ethereum_types::{ + consensus::{light_client_header::LightClientUpdate, sync_committee::SyncCommittee}, + execution::account_proof::AccountProof, +}; + +/// The header of a light client update +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub struct Header { + /// The trusted sync committee + pub trusted_sync_committee: TrustedSyncCommittee, + /// The consensus update + pub consensus_update: LightClientUpdate, + /// The account update + pub account_update: AccountUpdate, +} + +/// The account update +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] +pub struct AccountUpdate { + /// The account proof + pub account_proof: AccountProof, +} + +/// The trusted sync committee +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub struct TrustedSyncCommittee { + /// The trusted slot + pub trusted_slot: u64, + /// The current sync committee + pub sync_committee: ActiveSyncCommittee, +} + +/// The active sync committee +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub enum ActiveSyncCommittee { + /// The current sync committee + Current(SyncCommittee), + /// The next sync committee + Next(SyncCommittee), +} diff --git a/packages/ethereum-light-client/src/lib.rs b/packages/ethereum-light-client/src/lib.rs index df6e6138..02149316 100644 --- a/packages/ethereum-light-client/src/lib.rs +++ b/packages/ethereum-light-client/src/lib.rs @@ -1,17 +1,20 @@ #![doc = include_str!("../README.md")] -#![deny(clippy::nursery, clippy::pedantic, warnings, missing_docs)] +#![deny( + clippy::nursery, + clippy::pedantic, + warnings, + missing_docs, + unused_crate_dependencies +)] pub mod client_state; -pub mod config; pub mod consensus_state; pub mod error; +pub mod header; pub mod membership; pub mod trie; +pub mod update; pub mod verify; -pub mod types; - -pub use typenum; // re-export (for some weird macro stuff in config.rs) - -#[cfg(test)] -mod test; +#[cfg(any(test, feature = "test-utils"))] +pub mod test_utils; diff --git a/packages/ethereum-light-client/src/membership.rs b/packages/ethereum-light-client/src/membership.rs index 4fc867be..0a3f1698 100644 --- a/packages/ethereum-light-client/src/membership.rs +++ b/packages/ethereum-light-client/src/membership.rs @@ -4,12 +4,9 @@ use alloy_primitives::{keccak256, Bytes, Keccak256, U256}; use alloy_rlp::encode_fixed_size; use alloy_trie::{proof::verify_proof, Nibbles}; -use ethereum_utils::hex::to_hex; +use ethereum_types::execution::storage_proof::StorageProof; -use crate::{ - client_state::ClientState, consensus_state::ConsensusState, error::EthereumIBCError, - types::storage_proof::StorageProof, -}; +use crate::{client_state::ClientState, consensus_state::ConsensusState, error::EthereumIBCError}; /// Verifies the membership of a key in the storage trie. /// # Errors @@ -33,21 +30,21 @@ pub fn verify_membership( storage_proof.key.into(), )?; - let mut value = raw_value.clone(); - if let Some(raw_value) = raw_value { - // membership proof (otherwise non-membership proof) - let proof_value = storage_proof.value.to_be_bytes_vec(); - if proof_value != raw_value { - return Err(EthereumIBCError::StoredValueMistmatch( - to_hex(raw_value), - to_hex(proof_value), - )); + let value = match raw_value { + Some(unwrapped_raw_value) => { + let proof_value = storage_proof.value.to_be_bytes_vec(); + if proof_value != unwrapped_raw_value { + return Err(EthereumIBCError::StoredValueMistmatch { + expected: unwrapped_raw_value, + actual: proof_value, + }); + } + Some(encode_fixed_size(&storage_proof.value).to_vec()) } + None => None, + }; - value = Some(encode_fixed_size(&U256::from_be_slice(&proof_value)).to_vec()); - } - - let proof: Vec<&Bytes> = storage_proof.proof.iter().map(|b| &b.0).collect(); + let proof: Vec<&Bytes> = storage_proof.proof.iter().collect(); verify_proof::>( trusted_consensus_state.storage_root, @@ -93,22 +90,20 @@ mod test { use crate::{ client_state::ClientState, consensus_state::ConsensusState, - test::fixture_types::CommitmentProof, - types::{storage_proof::StorageProof, wrappers::WrappedBytes}, + test_utils::fixtures::{self, CommitmentProof}, }; use alloy_primitives::{ hex::{self, FromHex}, - Bytes, B256, U256, + Bytes, FixedBytes, B256, U256, }; - use ethereum_test_utils::fixtures; - use ethereum_utils::hex::FromBeHex; + use ethereum_types::execution::storage_proof::StorageProof; use super::verify_membership; #[test] fn test_with_fixture() { - let fixture: fixtures::StepFixture = + let fixture: fixtures::StepsFixture = fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); let commitment_proof_fixture: CommitmentProof = fixture.get_data_at_step(2); @@ -123,7 +118,7 @@ mod test { trusted_consensus_state, client_state, serde_json::to_vec(&storage_proof).unwrap(), - vec![path], + vec![path.to_vec()], Some(value), ) .unwrap(); @@ -132,7 +127,7 @@ mod test { #[test] fn test_verify_membership() { let client_state: ClientState = ClientState { - ibc_commitment_slot: U256::from_be_hex( + ibc_commitment_slot: from_be_hex( "0x0000000000000000000000000000000000000000000000000000000000000001", ), ..Default::default() @@ -143,18 +138,22 @@ mod test { "0xe488caae2c0464e311e4a2df82bc74885fa81778d04131db6af3a451110a5eb5", ) .unwrap(), - ..Default::default() + slot: 0, + state_root: FixedBytes::default(), + timestamp: 0, + current_sync_committee: FixedBytes::default(), + next_sync_committee: None, }; let key = B256::from_hex("0x75d7411cb01daad167713b5a9b7219670f0e500653cbbcd45cfe1bfe04222459") .unwrap(); let value = - U256::from_be_hex("0xb2ae8ab0be3bda2f81dc166497902a1832fea11b886bc7a0980dec7a219582db"); + from_be_hex("0xb2ae8ab0be3bda2f81dc166497902a1832fea11b886bc7a0980dec7a219582db"); let proof = vec![ - WrappedBytes(Bytes::from_hex("0xf8718080a0911797c4b8cdbd1d8fa643b31ff0a469fae0f9b2ecbb0fa45a5ebe497f5e7130a065ea7eb6ae4e9747a131961beda4e9fd3040521e58845f4a286fb472eb0415168080a057b16d9a3bbb2d106b4d1b12dca3504f61899c7c660b036848511426ed342dd680808080808080808080").unwrap()), - WrappedBytes(Bytes::from_hex("0xf843a03d3c3bcf030006afea2a677a6ff5bf3f7f111e87461c8848cf062a5756d1a888a1a0b2ae8ab0be3bda2f81dc166497902a1832fea11b886bc7a0980dec7a219582db").unwrap()), + Bytes::from_hex("0xf8718080a0911797c4b8cdbd1d8fa643b31ff0a469fae0f9b2ecbb0fa45a5ebe497f5e7130a065ea7eb6ae4e9747a131961beda4e9fd3040521e58845f4a286fb472eb0415168080a057b16d9a3bbb2d106b4d1b12dca3504f61899c7c660b036848511426ed342dd680808080808080808080").unwrap(), + Bytes::from_hex("0xf843a03d3c3bcf030006afea2a677a6ff5bf3f7f111e87461c8848cf062a5756d1a888a1a0b2ae8ab0be3bda2f81dc166497902a1832fea11b886bc7a0980dec7a219582db").unwrap(), ]; let path = vec![hex::decode("0x30372d74656e6465726d696e742d30010000000000000001").unwrap()]; @@ -186,7 +185,7 @@ mod test { #[test] fn test_verify_non_membership() { let client_state: ClientState = ClientState { - ibc_commitment_slot: U256::from_be_hex( + ibc_commitment_slot: from_be_hex( "0x0000000000000000000000000000000000000000000000000000000000000001", ), ..Default::default() @@ -197,7 +196,11 @@ mod test { "0x8fce1302ff9ebea6343badec86e9814151872067d2dd47de08ec83e9bc7d22b3", ) .unwrap(), - ..Default::default() + slot: 0, + state_root: FixedBytes::default(), + timestamp: 0, + current_sync_committee: FixedBytes::default(), + next_sync_committee: None, }; let key = @@ -205,7 +208,7 @@ mod test { .unwrap(); let proof = vec![ - WrappedBytes(Bytes::from_hex("0xf838a120290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5639594eb9407e2a087056b69d43d21df69b82e31533c8a").unwrap()), + Bytes::from_hex("0xf838a120290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5639594eb9407e2a087056b69d43d21df69b82e31533c8a").unwrap(), ]; let path = vec![hex::decode("0x30372d74656e6465726d696e742d30020000000000000001").unwrap()]; @@ -233,4 +236,9 @@ mod test { ) .unwrap_err(); } + + fn from_be_hex(hex_str: &str) -> U256 { + let data = hex::decode(hex_str).unwrap(); + U256::from_be_slice(data.as_slice()) + } } diff --git a/packages/ethereum-light-client/src/test/fixture_types.rs b/packages/ethereum-light-client/src/test/fixture_types.rs deleted file mode 100644 index 84c6df75..000000000 --- a/packages/ethereum-light-client/src/test/fixture_types.rs +++ /dev/null @@ -1,41 +0,0 @@ -use serde::{Deserialize, Serialize}; -use serde_with::{base64::Base64, serde_as}; - -use crate::{ - client_state::ClientState, - consensus_state::ConsensusState, - types::{height::Height, light_client::Header, storage_proof::StorageProof}, -}; - -// TODO: Remove this file once these types are in a separate package #143 - -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub enum DataType { - InitialState(Box), - CommitmentProof(Box), - UpdateClient(Box), -} - -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct InitialState { - pub client_state: ClientState, - pub consensus_state: ConsensusState, -} - -#[serde_as] -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct CommitmentProof { - #[serde_as(as = "Base64")] - pub path: Vec, - pub storage_proof: StorageProof, - pub proof_height: Height, - pub client_state: ClientState, - pub consensus_state: ConsensusState, -} - -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct UpdateClient { - pub client_state: ClientState, - pub consensus_state: ConsensusState, - pub updates: Vec
, -} diff --git a/packages/ethereum-light-client/src/test/mod.rs b/packages/ethereum-light-client/src/test/mod.rs deleted file mode 100644 index 11036963..000000000 --- a/packages/ethereum-light-client/src/test/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod fixture_types; diff --git a/packages/ethereum-test-utils/src/bls_verifier.rs b/packages/ethereum-light-client/src/test_utils/bls_verifier.rs similarity index 75% rename from packages/ethereum-test-utils/src/bls_verifier.rs rename to packages/ethereum-light-client/src/test_utils/bls_verifier.rs index eb91f282..bddc704f 100644 --- a/packages/ethereum-test-utils/src/bls_verifier.rs +++ b/packages/ethereum-light-client/src/test_utils/bls_verifier.rs @@ -1,23 +1,29 @@ -use thiserror::Error; +//! This module defines a test implementation of the BLS verifier -use ethereum_light_client::types::bls::{BlsPublicKey, BlsSignature}; +use ethereum_types::consensus::bls::{BlsPublicKey, BlsSignature}; +use thiserror::Error; +/// Test implementation of the BLS verifier +#[allow(clippy::module_name_repetitions)] pub struct TestBlsVerifier; #[derive(Error, Debug)] +#[allow(missing_docs)] pub enum BlsError { #[error("bls error: {0}")] Bls(String), } +/// Test implementation of the BLS verifier +/// # Errors +/// Returns an error if the signature is invalid pub fn fast_aggregate_verify( - public_keys: Vec<&BlsPublicKey>, + public_keys: &[BlsPublicKey], msg: alloy_primitives::B256, signature: BlsSignature, ) -> Result<(), BlsError> { let public_keys = public_keys .iter() - .cloned() .map(|pk| milagro_bls::PublicKey::from_bytes(pk.as_ref())) .collect::, _>>() .map_err(|_| BlsError::Bls("failed to convert to milagro_bls public keys".to_string()))?; @@ -40,10 +46,14 @@ pub fn fast_aggregate_verify( } } -pub fn aggreagate(public_keys: Vec<&BlsPublicKey>) -> Result { +/// Test implementation of the BLS verifier +/// # Errors +/// Returns an error if the signature is invalid +/// # Returns +/// Returns the aggregated public key +pub fn aggreagate(public_keys: &[&BlsPublicKey]) -> Result { let public_keys = public_keys .iter() - .cloned() .map(|pk| milagro_bls::PublicKey::from_bytes(pk.as_ref())) .collect::, _>>() .map_err(|_| BlsError::Bls("failed to convert to milagro_bls public keys".to_string()))?; diff --git a/packages/ethereum-light-client/src/test_utils/fixtures.rs b/packages/ethereum-light-client/src/test_utils/fixtures.rs new file mode 100644 index 000000000..d4d8ff16 --- /dev/null +++ b/packages/ethereum-light-client/src/test_utils/fixtures.rs @@ -0,0 +1,94 @@ +//! Test fixtures types and ulitiies for the Ethereum light client + +use std::path::PathBuf; + +use alloy_primitives::Bytes; +use ethereum_types::execution::storage_proof::StorageProof; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use serde_json::Value; + +use crate::{client_state::ClientState, consensus_state::ConsensusState, header::Header}; + +/// A test fixture with an ordered list of light client operations from the e2e test +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub struct StepsFixture { + /// steps is a list of light client operations + pub steps: Vec, +} + +/// Step is a light client operation such as an initial state, commitment proof, or update client +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub struct Step { + /// name is the name of the operation, only used for documentation and easy of reading + pub name: String, + /// data is the operation data as a JSON object to be deserialized into the appropriate type + pub data: Value, +} + +/// The initial state of the light client in the e2e tests +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub struct InitialState { + /// The client state at the initial state + pub client_state: ClientState, + /// The consensus state at the initial state + pub consensus_state: ConsensusState, +} + +/// The proof used to verify membership +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub struct CommitmentProof { + /// The IBC path sent to verify membership + #[schemars(with = "String")] + pub path: Bytes, + /// The storage proof used to verify membership + pub storage_proof: StorageProof, + /// The slot of the proof (ibc height) + pub proof_slot: u64, + /// The client state at the time of the proof + pub client_state: ClientState, + /// The consensus state at the time of the proof + pub consensus_state: ConsensusState, +} + +/// Operation to update the light client +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)] +pub struct UpdateClient { + /// The client state after the update + pub client_state: ClientState, + /// The consensus state after the update + pub consensus_state: ConsensusState, + /// The headers used to update the light client, in order + pub updates: Vec
, +} + +impl StepsFixture { + /// Deserializes the data at the given step into the given type + /// # Panics + /// Panics if the data cannot be deserialized into the given type + #[must_use] + pub fn get_data_at_step(&self, step: usize) -> T + where + T: serde::de::DeserializeOwned, + { + serde_json::from_value(self.steps[step].data.clone()).unwrap() + } +} + +/// load loads a test fixture from a JSON file +/// # Panics +/// Panics if the file cannot be opened or the contents cannot be deserialized +#[must_use] +pub fn load(name: &str) -> T +where + T: serde::de::DeserializeOwned, +{ + // Construct the path relative to the Cargo manifest directory + let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + path.push("src/test_utils/fixtures"); + path.push(format!("{name}.json")); + + // Open the file and deserialize its contents + let file = std::fs::File::open(path).unwrap(); + serde_json::from_reader(file).unwrap() +} diff --git a/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferERC20TokenfromEthereumToCosmosAndBack_Groth16.json b/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferERC20TokenfromEthereumToCosmosAndBack_Groth16.json new file mode 100644 index 000000000..76ec9627 --- /dev/null +++ b/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferERC20TokenfromEthereumToCosmosAndBack_Groth16.json @@ -0,0 +1,620 @@ +{ + "steps": [ + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "30000038" + }, + "capella": { + "epoch": 0, + "version": "40000038" + }, + "deneb": { + "epoch": 0, + "version": "50000038" + }, + "genesis_fork_version": "10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734449555, + "genesis_validators_root": "d61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0xbb24f202d3b5847326207894777cd09e06db2955", + "latest_slot": 32, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0xaf6a6ebbea11649796e23a5523ef665bc7f9a726a1a6277c1da140a9211d9f3c0e9b2d06a7fafa2043f7a480296a533f", + "next_sync_committee": "0xaf6a6ebbea11649796e23a5523ef665bc7f9a726a1a6277c1da140a9211d9f3c0e9b2d06a7fafa2043f7a480296a533f", + "slot": 32, + "state_root": "0x6bd765373baf8c96a7c4dee7a3fdb33385263ee0b87a36cbf5bc9c2f3e97072f", + "storage_root": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": 1734449747000000000 + } + }, + "name": "initial_state" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "30000038" + }, + "capella": { + "epoch": 0, + "version": "40000038" + }, + "deneb": { + "epoch": 0, + "version": "50000038" + }, + "genesis_fork_version": "10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734449555, + "genesis_validators_root": "d61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0xbb24f202d3b5847326207894777cd09e06db2955", + "latest_slot": 32, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0xaf6a6ebbea11649796e23a5523ef665bc7f9a726a1a6277c1da140a9211d9f3c0e9b2d06a7fafa2043f7a480296a533f", + "next_sync_committee": "0xaf6a6ebbea11649796e23a5523ef665bc7f9a726a1a6277c1da140a9211d9f3c0e9b2d06a7fafa2043f7a480296a533f", + "slot": 32, + "state_root": "0x6bd765373baf8c96a7c4dee7a3fdb33385263ee0b87a36cbf5bc9c2f3e97072f", + "storage_root": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": 1734449747000000000 + }, + "updates": [ + { + "account_update": { + "account_proof": { + "proof": [ + "0xf90211a036fba8359b41a0e0638ba44d33ce6255b43aae706dec848ed8c2cccfab96e12ea006d47616df479b46b302f2a8b7ed03cb537f6cf7c551c15421c65db4e00fa97fa0325928aeac0aede6abdf61669d0d3ae7f93322e95b9c259016846c328a653d07a0b1c06c89ca1d0893f5115e2a98ff734dfd72dfd2e990021a8b45b50aeed2e01fa0451928b41382485e82292c1cd2a4f0097825803fa52e24ddec55fb614d9247b8a0a5aceb70b6c6a207f2fb2e491b6f5cb1654f4df251e0a48682eb6a164811e115a04127c983a02192e96a64a06f8a967c625ad6bb91f8bbf1bc47b19ab220bb5857a0e493f9932288e2eb97a7c5d4fda172f0ffe871eb34cedf14b5a365e74f63c876a0cbcdc1d226a540c50cb1e615e7af99f171d4365b45734940e22d47ec4aa23a14a0be88e4724326382a8b56e2328eeef0ad51f18d5bae0e84296afe14c4028c4af9a018e0f191e57d4186717e0f3c9379d2438cec0babd12d3903a4ad560f017331bfa0b3007984e908658e73f7f64897986f9d8418bf424fe6b944087812d0c9d17c4ba0a6797c23c87852503b75d97cf7e2dfb01e49d8ceb05bce0128dd02a176b2f9eba037e4876a6afbae2c19579430dd9908d5bc4b443b1c41e1a6a4ba4e5049d94a15a0962f0f7ccb43c78ba23f99be63d7fbefc9acafbb3be87270eb8d850e50906cffa02d131cfcdae3f27339fbf50b7d07c8375a480d4459ac948d2a5a0e0ecb911a7e80", + "0xf90191a046a9f1217c365990825b7d161fc23cae5688cfb6b2307efe4b732c723e037958a0c58b3b8c10a478d0e81fc11fdc9ff8532f415bcdd35cc2bd20df0c0937fec919a0c0e0b54cb105bad41b4b925883507463ddfae71c619ba2e41d6d57da2a28effea0793c9db0e252f8f5c79a9d872efc5385ab632a9dc31217637b3509fcf6f0b010a00a8671fcc6009726b8b97c22e392555047e12794033e0dd90b0925921458cc3380a0386a1e942dbe86342b17e2e8b28a259d6db65df8e05f944951a089bb9f3d989fa0315b6e4145b520b88ff5fb638b922671ee1ecbcb65b57b9a4be650ab1fce1d39a066e01acc8a9826bc3d5f5286819fc5883dfa30943331f1e7ff2968bfc57ea2d0a08d63d018d6d5cdd70ba49d041c51fc5c899291b291a5c17e72b6488949f4a53b8080a012794aea34d39f220863a2977506ebe5555c2b6488a9469fed918b744f67d6d9a0e5fdd2cd23dcc8b76c98c662674a47ab574fa93f23724caac875af223670d4eca0e20d629ffd2bee3848106f86b98c50a9de755283203bb778c19fa269c8ddb2e38080", + "0xf869a020cb88b75e0664d3178826643be40d57e7be39d93e87687582107d7b3f631e8db846f8440180a0adc179658a97d844b4989a5639733e7a5b3b932fd26438763d4b14929536e9c4a0b5501c2a9888592ebf43ad390bf13907b83d7834834d35a1ff1cf1a739745c69" + ], + "storage_root": "0xadc179658a97d844b4989a5639733e7a5b3b932fd26438763d4b14929536e9c4" + } + }, + "consensus_update": { + "attested_header": { + "beacon": { + "body_root": "0xd22bf18003bd9ffbb158e6303d75d85660208960cb44901ad053c4f8c7a76177", + "parent_root": "0xabb05866d5b70477b6dbca69185da4b875e8c82c1527daf27875ebd615874f8b", + "proposer_index": "45", + "slot": "80", + "state_root": "0xd25cbe876493f2a3fed12955403deaaf6d8e56a0d3134be1ee2fe531f92c4d47" + }, + "execution": { + "base_fee_per_gas": "26258", + "blob_gas_used": "0", + "block_hash": "0xc774c9fd863f74571523e04936c31426fc748aaaf33cb12c6dfd14aff592e8cb", + "block_number": "80", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0xd54a7243803ace9c86203ec29a4f5233e93d2a14976f6f7dd7214770e0b4dc10", + "prev_randao": "0x7c5f9269b182bfd0de4b2bba0c758d00b01d00ecc678384559a4187d68dde0d3", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0x5d53c367597dbc43c39ef193c63fc815eb10d7d431e9faff3493605a85e7af24", + "timestamp": "1734450035", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0x9efcb0c671de56205a5296f5bbcac74b495d92519e7786eab1f5218df87526e4", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x242c4101897b83abbfbdde84bcd3afaf628fe2e45b6998544aad92e04f527054" + ] + }, + "finality_branch": [ + "0x0800000000000000000000000000000000000000000000000000000000000000", + "0x5f6f02af29218292d21a69b64a794a7c0873b3e0f54611972863706e8cbdf371", + "0x752e4b129e7e72e18a2f793c2e01fbdb1e96ed169395c3fe560de43701f851d5", + "0xb4cebacccbf5efa5f16715f9a9513fd0b22c4d8815859e3f137170209876e61f", + "0x9d58a1fd2f6637594e7ebe49393dd145df914ee0792e07169d926ee1bbeb73af", + "0xe5e5e5325ee4aee9930b1d0b367b625b02bf26aa3a009e766911b4547b48afa3" + ], + "finalized_header": { + "beacon": { + "body_root": "0x4486405400875932ec13eb72a65ae4c2368b7af5442d3f047e5346cf69a0f963", + "parent_root": "0x841f686f3e8af98804020688e8177bf19e7417b67131e0aa6e5db95170d8ea4c", + "proposer_index": "30", + "slot": "64", + "state_root": "0x995ce6659a64dffd30b1599928f02edc0eb7fe552a3064bfe40302749bd6702e" + }, + "execution": { + "base_fee_per_gas": "222370", + "blob_gas_used": "0", + "block_hash": "0xfdc2865479b55292695a480c5741c4b219138479c638abeb01de8f3abb18dc22", + "block_number": "64", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0x6e31c05b589a468bb6b195e1a6e179e530daba4cb609328300c8cb68c6901a0e", + "prev_randao": "0x46f96f4f1bb5148eded54de02a7c1f7e90de0ff5a29f41d19d45fe38b7e54c4f", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0x3bcde95837452f7df002b1708879eed36521f69af3bcd14f45d6290450ac6409", + "timestamp": "1734449939", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0xc62c354c140b416a40cd2510dff590c69a23aad59a76864cd7259b2fadb31bc5", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x2080ddbd3e73afd50887f94740e93775d5f789e0d30f0ccd25b89b53624f0f28" + ] + }, + "next_sync_committee": { + "aggregate_pubkey": "0x8cede9fc2550b89bbfe0f14b34fce3871e383d08b01e2362e2e21086808bb31804ee5b7ce6403d1756f7b6d6f9fb76d1", + "pubkeys": [ + "0xa03c2a82374e04b2e0594c4ce14fb3f225b46f13188f0d8002a523c7dcfb939ae4856053c2c9c695374d7c3685df1ca5", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0x8d8985e5dd341c9035b37bf7391c5944c28131b47c7d5359d18fca598010ba9a63e27c55e6b421a807038c320564db17", + "0x8a8bb292bcc481070d3afdbbc8789e2ab4b29c9603936e6d85f5ff71e23fc5b6d61009f0fa636b5d5b2dc309d39e3d75", + "0xa0485d71f1f5e177f7d5bc9d98c5248a6a2d0de4554c2eaf02abae48f5a3e273b2ee7765784cf2a4cb7df84f617177c9", + "0xaaddb0cb69ca18f14aed7054e98a24df0ff606aeff919d489f7884fd1bd183bcb46ea54bc363146e1a88db36dc20a7a4", + "0xaf89ab00a0eab1131645292a9cfba583a69a1e3ac58b210e262494853e67385aeb50d4af428bdd577b9399daa96d8b20", + "0xa8fa3584a92b079c8c73ed1553e5e161a0b21325fc2fc4e24a892354a899c7fc0bfb436a97a7ed1fc71bccda438ea715", + "0x9918433b8f0bc5e126da3fdef8d7b71456492dae6d2d07f2e10c7a7f852046f84ed0ce6d3bfec42200670db27dcf3037", + "0xab40dc1cfe273ad0da700c64f8fc94f91db253ca3acf20e336d9bd09de67eec5c7d3506285d83c7bb6a08d64b77e5f2d", + "0xaaf6c1251e73fb600624937760fef218aace5b253bf068ed45398aeb29d821e4d2899343ddcbbe37cb3f6cf500dff26c", + "0x96947de9e6068c22a7716656a2755a9551b0b66c2d1a741bf84a088fe1e840e992dc39861bf8ba3e8d5b6d21e8f57e64", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0xab64f900c770e2b99de6b86b4390bbd1579bd48dccec55800adbcf52e006f22128e9971bbf3a92cc0105b0974849935a", + "0xae5302796cfeca685eaf37ffd5baeb32121f2f07415bee26cc0051ee513ff3932d2c365e3d9f87b0949a5980445cb64c", + "0x8d46e9aa0c1986056e407efc7013b7f271027d3c98ce96667faa98074ab0588a61681faf78644c11819a459a95689dab", + "0xab72cbc6575c3179680a58c0ecd5de46d2678ccbafc016746348ee5688edcb21b4e15bd37c70c508e3ea73103c2d566b", + "0x91709ee06497b9ac049325853d64947290189a8c2322e3a500d91e23ea02dc158b6db63ae558b3b7670357a151cd6071", + "0x8dfa86c051edd28c3554a30e40531c898e5936ad3002711616ddd1b27054bc39caedd505a200c3d23a1c3f6b26c50ae9", + "0xb09cb155daf2022afd18114a352e506a84065c80573cb0c7c310cbe92e2706cdcf91f74bbd9e464f74e3d831386d5033", + "0x84a687ffdf21a0ad754d0164d1e2c03035613ab76359e7f5cf51ea4a425a6ee026725ec0a0dbd336f7dab759596f0bf8", + "0x86e014747c7922ccfc2b9d4bf6c1ecf0dc800197037858d0b85ab1944b4c3c14b95e0ed325bc42a6f467bc47ec27bc7b", + "0xb72cb106b7bc1ecae219e0ae1830a509ed18a042b56a2779f4033419de69ba8ae8017090caed1f5377bfa68506157360", + "0x81fa222737fe818b43f55f209f42adaee135b2801d02709617fc88c2871852358260ace97cf323e761b5cc18bc7325b3", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670", + "0xae940a07850cf904b44f31cbf0e44824bae5ec36dcfdb7fad858f2a39dba38de82ca12b0ae939a34fce7a02e4b9789f8", + "0x8725b32751419f22a54485790f8187d1ba52d84a31ad45738a93777fcd1ccbec1652229923f82f37793ce0fc2763fb4c", + "0xa2e2d8384fc87a512ee34eb43405fd82572c9d7cd96e155a382cda284e8df9eb7189c25b7473d89c63ea4e6080e10ff8", + "0x84dc37ca3cd621d3da0fbdd11ca84021e0cd81a73d772dd6fcf19775b72eb64af4e573213378ccee0915dde92ac83ba6", + "0xac69ae9e6c385a368df71d11ac68f45f05e005306df3c2bf98ed3577708256bd97f8c09d3f72115444077a9bb711d8d1", + "0xa804e4fa8d1391a9d078aa93985a12503b84ce4f6f1f9e70ab7fca421e1cf972538666299d4c1bfc39327b469b2db7a8", + "0xb63f327df68581cdc02a66c1c65e906a06a1a3a8d7a6e38f7b6da944e8e6cc2db85fced5327d8c12945ceb33018272ca" + ] + }, + "next_sync_committee_branch": [ + "0x03b7dd166a11a6a4fda91ac8edbca05f36095e3e7725afe5cb8871eb054be02c", + "0x7572f3672c846af2f3150f6d4de9316ba4147d7f665e5cdd810000bce5734542", + "0xb4cebacccbf5efa5f16715f9a9513fd0b22c4d8815859e3f137170209876e61f", + "0x9d58a1fd2f6637594e7ebe49393dd145df914ee0792e07169d926ee1bbeb73af", + "0xe5e5e5325ee4aee9930b1d0b367b625b02bf26aa3a009e766911b4547b48afa3" + ], + "signature_slot": "81", + "sync_aggregate": { + "sync_committee_bits": "0xffffffff", + "sync_committee_signature": "0xb9b857b246076b5d665abea53ff7d5a4c9b3b1903d2d1e647f3ce146fc761fac2e469d8009893252dfbe6a7f7057858403b9c27d0288e7a29490983b2d1fd2bcd624739b17067567f45a5d0d2b95dc02d5fd2834d5f3db512d2429d0b059f00a" + } + }, + "trusted_sync_committee": { + "sync_committee": { + "Next": { + "aggregate_pubkey": "0xaf6a6ebbea11649796e23a5523ef665bc7f9a726a1a6277c1da140a9211d9f3c0e9b2d06a7fafa2043f7a480296a533f", + "pubkeys": [ + "0x8d028a021c5c31a1aa1e18eda74cfaf0fba1c454c17c2e0fc730dd07a19d0c77f7a905d54017292f3e800ca06b6977cd", + "0xaaf6c1251e73fb600624937760fef218aace5b253bf068ed45398aeb29d821e4d2899343ddcbbe37cb3f6cf500dff26c", + "0x996d10c3026b9344532b06c70a596f972a1e779a1f6106d3da9f6ba376bbf7ec82d2f52629e5dbf3f7d03b00f6b862af", + "0x81ea9f74ef7d935b807474e38954ae3934856219a23e074954b2e860c5a3c400f9aedb42cd27cb4ceb697ca36d1e58cb", + "0xa62c0205fb22df8535c0b70076486e69dfa908feddae79e4a94a9d47b97ed190d228e1c6217e84a59882bb992dacae30", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0x99d83a0ba33161d8c6bbe80929fd9046d4dfdac43477ff85fea5bae925e6c179ad28eb338375ee2417acbd6576ee670a", + "0xafa10af166a0dbf3a25ff86cd6f8e44cccc818c5e70cd70e4e98e226b158f3563450b3fb184d2649adbb11e53080d1ca", + "0xa2e2d8384fc87a512ee34eb43405fd82572c9d7cd96e155a382cda284e8df9eb7189c25b7473d89c63ea4e6080e10ff8", + "0xae5302796cfeca685eaf37ffd5baeb32121f2f07415bee26cc0051ee513ff3932d2c365e3d9f87b0949a5980445cb64c", + "0xad9222dec71ff8ee6bc0426ffe7b5e66f96738225db281dd20027a1556d089fdebd040abfbc2041d6c1a0d8fdcfce183", + "0x87231421a08ed28e7d357e2b37a26a458155c8d822d829344bd1029e5d175b5edfaa78f16f784f724a2caef124944c4f", + "0x84dc37ca3cd621d3da0fbdd11ca84021e0cd81a73d772dd6fcf19775b72eb64af4e573213378ccee0915dde92ac83ba6", + "0xa759f6bcca8f35fcaadc406cc4b828c016c0ed23882987a79f52f2933b5cedefe24e31df6fd0d38e8a802dbafd750d01", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0x9763dde1b8028136a3ffd6dafd1f450e2cafb2819c7fa901f7c6e9cde8f2897ee7e9a45da6947fde1ad0d3836188eab5", + "0xb5e898a1fc06d51c695712928f44646d15451340d1b3e480a40f03250160bc07d3b6691ec94361dd524d59d9df7f76d3", + "0xa4ee6d37dc259cbb5237e4265429a9fd8ab5643af81628cc101e0d8b4a333ef2618a37df89ea3f92b5ea4333d8cda393", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670", + "0xa35c6004f387430c3797ab0157af7b824c8fe106241c7cdeb897d900c0f9e4bb945ff2a6b88cbd10e35ec48aaa554ecb", + "0x8dfa86c051edd28c3554a30e40531c898e5936ad3002711616ddd1b27054bc39caedd505a200c3d23a1c3f6b26c50ae9", + "0x8d8985e5dd341c9035b37bf7391c5944c28131b47c7d5359d18fca598010ba9a63e27c55e6b421a807038c320564db17", + "0xa54fe5c26059ed60b4f0b66ef7b0bf167580504525f83c169507dc812816df41b1da6128341c23977300dffd32a32f41", + "0x8fda66b8607af873f4c2c8218dd3ffc7940d411047eb199b5cd010156af4845d21dd2e65b0e44cfffb5e78271e9bb29d", + "0x8419cf00f2783c430dc861a710984d0429d3b3a7f6db849b4f5c05e0d87339704c5c7f5eede6adfc8776d666587b5932", + "0xb2225575d5e70da1257db7a0d1222c5041b52aac61cf161e8fc8126a3fdf5eb4f0867d98dfe272199c36cf8f02661b3d", + "0x81fa222737fe818b43f55f209f42adaee135b2801d02709617fc88c2871852358260ace97cf323e761b5cc18bc7325b3", + "0xa804e4fa8d1391a9d078aa93985a12503b84ce4f6f1f9e70ab7fca421e1cf972538666299d4c1bfc39327b469b2db7a8", + "0xa75ca9447dca3a3745ada36731187ddd1f6a152cf15d7446b785eab381e5c8562c1202a6e7a24080bc6b619a161113db", + "0x930743bfc7e18d3bd7351eaa74f477505268c1e4e1fd1ca3ccccdefb2595517343bbb8f5589c435c3c39323a4c0080f8", + "0xb24391aa97bfff29adc935d06a2b6d583433caf82f92de1980e0192d3b270323bdbf24b86dc61520a40c419dde3df4b3", + "0x958c2692b86b4d20eaea3bb45e9447ebbc5b93ccaf8d21ef659d0cefedf5c4371b31b460ae40e8243682bde505abac1e" + ] + } + }, + "trusted_slot": 32 + } + } + ] + }, + "name": "updated_light_client" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "0x20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "0x30000038" + }, + "capella": { + "epoch": 0, + "version": "0x40000038" + }, + "deneb": { + "epoch": 0, + "version": "0x50000038" + }, + "genesis_fork_version": "0x10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734449555, + "genesis_validators_root": "0xd61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0xbb24f202d3b5847326207894777cd09e06db2955", + "latest_slot": 80, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0xaf6a6ebbea11649796e23a5523ef665bc7f9a726a1a6277c1da140a9211d9f3c0e9b2d06a7fafa2043f7a480296a533f", + "next_sync_committee": "0x8cede9fc2550b89bbfe0f14b34fce3871e383d08b01e2362e2e21086808bb31804ee5b7ce6403d1756f7b6d6f9fb76d1", + "slot": 80, + "state_root": "0x5d53c367597dbc43c39ef193c63fc815eb10d7d431e9faff3493605a85e7af24", + "storage_root": "0xadc179658a97d844b4989a5639733e7a5b3b932fd26438763d4b14929536e9c4", + "timestamp": 1734450035 + }, + "path": "0x30372d74656e6465726d696e742d30010000000000000001", + "proof_slot": 80, + "storage_proof": { + "key": "0x75d7411cb01daad167713b5a9b7219670f0e500653cbbcd45cfe1bfe04222459", + "proof": [ + "0xf8718080a07598a7116cb12aa50c14cdc40fb1de43afaa8fcbdee7941b0bec2a78c8329fc6a07f43632019bf40bd3c835c5a3cc234bf7e4d481a6f44d2ad1a78d703cbe11fd08080a057b16d9a3bbb2d106b4d1b12dca3504f61899c7c660b036848511426ed342dd680808080808080808080", + "0xf843a03d3c3bcf030006afea2a677a6ff5bf3f7f111e87461c8848cf062a5756d1a888a1a05d619395e797248f5bbdce6f3e49321c6ed218f1d93a7668b0ca6fd68cbd3b6f" + ], + "value": "0x5d619395e797248f5bbdce6f3e49321c6ed218f1d93a7668b0ca6fd68cbd3b6f" + } + }, + "name": "commitment_proof" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "0x20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "0x30000038" + }, + "capella": { + "epoch": 0, + "version": "0x40000038" + }, + "deneb": { + "epoch": 0, + "version": "0x50000038" + }, + "genesis_fork_version": "0x10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734449555, + "genesis_validators_root": "0xd61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0xbb24f202d3b5847326207894777cd09e06db2955", + "latest_slot": 80, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0xaf6a6ebbea11649796e23a5523ef665bc7f9a726a1a6277c1da140a9211d9f3c0e9b2d06a7fafa2043f7a480296a533f", + "next_sync_committee": "0x8cede9fc2550b89bbfe0f14b34fce3871e383d08b01e2362e2e21086808bb31804ee5b7ce6403d1756f7b6d6f9fb76d1", + "slot": 80, + "state_root": "0x5d53c367597dbc43c39ef193c63fc815eb10d7d431e9faff3493605a85e7af24", + "storage_root": "0xadc179658a97d844b4989a5639733e7a5b3b932fd26438763d4b14929536e9c4", + "timestamp": 1734450035 + }, + "updates": [ + { + "account_update": { + "account_proof": { + "proof": [ + "0xf90211a0b554290edb46997b4c58bb518df0ce982c333d1b88d79b72b0ddae08ea3696a8a006d47616df479b46b302f2a8b7ed03cb537f6cf7c551c15421c65db4e00fa97fa0325928aeac0aede6abdf61669d0d3ae7f93322e95b9c259016846c328a653d07a095342980350a0dbd143ddaf1e6e627c9011ed8c4cfca83509d0dbfcad25a4c02a0451928b41382485e82292c1cd2a4f0097825803fa52e24ddec55fb614d9247b8a094f186439ef6a19e798c8adfac958662e63abc3e9b71209a43cfa91c215271fca04127c983a02192e96a64a06f8a967c625ad6bb91f8bbf1bc47b19ab220bb5857a0e493f9932288e2eb97a7c5d4fda172f0ffe871eb34cedf14b5a365e74f63c876a0cbcdc1d226a540c50cb1e615e7af99f171d4365b45734940e22d47ec4aa23a14a0be88e4724326382a8b56e2328eeef0ad51f18d5bae0e84296afe14c4028c4af9a018e0f191e57d4186717e0f3c9379d2438cec0babd12d3903a4ad560f017331bfa06e3a3b31f09fa0a102e52e25fda875c4fb4fcda32b274914afb8b5b539b8fbcea0a6797c23c87852503b75d97cf7e2dfb01e49d8ceb05bce0128dd02a176b2f9eba037e4876a6afbae2c19579430dd9908d5bc4b443b1c41e1a6a4ba4e5049d94a15a0962f0f7ccb43c78ba23f99be63d7fbefc9acafbb3be87270eb8d850e50906cffa00edc3f062e76b317bfbb703f484198cc4ee49dc52587dd9f987d694355cff48180", + "0xf90191a046a9f1217c365990825b7d161fc23cae5688cfb6b2307efe4b732c723e037958a02a8aa823e2176264bb52721eccde2e7bc5e875c1a7e5af8b5d9e678a2ccc53d0a0c0e0b54cb105bad41b4b925883507463ddfae71c619ba2e41d6d57da2a28effea0793c9db0e252f8f5c79a9d872efc5385ab632a9dc31217637b3509fcf6f0b010a00a8671fcc6009726b8b97c22e392555047e12794033e0dd90b0925921458cc3380a0386a1e942dbe86342b17e2e8b28a259d6db65df8e05f944951a089bb9f3d989fa0315b6e4145b520b88ff5fb638b922671ee1ecbcb65b57b9a4be650ab1fce1d39a066e01acc8a9826bc3d5f5286819fc5883dfa30943331f1e7ff2968bfc57ea2d0a08d63d018d6d5cdd70ba49d041c51fc5c899291b291a5c17e72b6488949f4a53b8080a012794aea34d39f220863a2977506ebe5555c2b6488a9469fed918b744f67d6d9a0e5fdd2cd23dcc8b76c98c662674a47ab574fa93f23724caac875af223670d4eca0e20d629ffd2bee3848106f86b98c50a9de755283203bb778c19fa269c8ddb2e38080", + "0xf869a020cb88b75e0664d3178826643be40d57e7be39d93e87687582107d7b3f631e8db846f8440180a011e3ad640168326c5804965a5bf523134ea8b3ac3bef9dffc19743e93f9c4e46a0b5501c2a9888592ebf43ad390bf13907b83d7834834d35a1ff1cf1a739745c69" + ], + "storage_root": "0x11e3ad640168326c5804965a5bf523134ea8b3ac3bef9dffc19743e93f9c4e46" + } + }, + "consensus_update": { + "attested_header": { + "beacon": { + "body_root": "0x5fac49e6c5d9a824b9970e21d5d275c36c4dd961e38204bbe7dba41f888ad221", + "parent_root": "0xd43bef2dbd79144486e237344a030a2378ef6443f3231313e09ec9036054dd88", + "proposer_index": "21", + "slot": "144", + "state_root": "0xb1e0d6c95c66f1cf4cebe46016490086ee2db95a3a37d5e2d868ffd9e5a41488" + }, + "execution": { + "base_fee_per_gas": "9", + "blob_gas_used": "0", + "block_hash": "0xf540630267f4a27efcf2eaf94a001b295cfb4f09169490e811c5f7c217bfa4c7", + "block_number": "144", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0xc79e6e06860ebabf228c01a0bd42a0844dfa17ac28ff785b9499612d94a8649b", + "prev_randao": "0x5a28e9d449c48e0186d39626dd087359fcc74949aa540c9aa2dde5e88f7190f4", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0xebfe6c8364983c13232db8ab16a2ef61efa5bc0e8ea0ce927b8e3cd4baac1516", + "timestamp": "1734450419", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0x59c4047900ff46b014275f70db9f63cc492ebb47c0053796309fb31c38eb657e", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0xa723344d5151716e18607e79c1a6dc07f288c5d3413941f533a00cc256859721" + ] + }, + "finality_branch": [ + "0x1000000000000000000000000000000000000000000000000000000000000000", + "0x5f6f02af29218292d21a69b64a794a7c0873b3e0f54611972863706e8cbdf371", + "0x891f7f27efc36f97cc7bd8af9adad8d624b19d6ad2dc1ee1bd080ffa4d6b0c8f", + "0x6869f2d8936ad8c5f2b0b62390259d9e24d85ebf13849edbbd4ea7f16df54de2", + "0x7efe8ffa58f060bc40db587d51b43189c5aae9e0101129b1a39ba0a803f5c179", + "0xeebd09888f7da9b71f28dd81dcca61adea19acf685f88114e8d52e9399d80f1a" + ], + "finalized_header": { + "beacon": { + "body_root": "0xda36fb10a054d58b55598846b14e57029dbce2bbd30d906776e9417a5bbded34", + "parent_root": "0xd0fc611c6aefafcdfd6f0bb4a6e303f9d734c5100eced7ab492a7320493d649b", + "proposer_index": "33", + "slot": "128", + "state_root": "0xaf9b07e4c7b418b74a181162fe8341ab081300ce7c4cb0d0d62a5c68fa5550f4" + }, + "execution": { + "base_fee_per_gas": "48", + "blob_gas_used": "0", + "block_hash": "0x7b158c614d61ccfd64c67537f8f03b79ce978cce66b723a23d1ab31e81a50b06", + "block_number": "128", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0x5aff449dee43663f03fa12ccc56f42123c0d85559845e5501478a2cc1847b361", + "prev_randao": "0x24c49e1451bb44a7294994b48552c6b69eec256777540ba8ce79c11464ad986e", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0xb7a33a321bccb7b0696af6bc1cf494e869336739c47983981187f7051a49b0bf", + "timestamp": "1734450323", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0xc417ca3c78b327f2f8a3ed0a073165466879b93c9162227392f301c909ff360f", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x6d29f36ab12479af489ea7b0f08367642d44dad8069361c1102a49de92078ea0" + ] + }, + "next_sync_committee": { + "aggregate_pubkey": "0x97644a8275149afa40688421672cb0e40b2a2a594058d8bd5fabf4b4329f33dfd760b01951ca432a7fa39c9edf1b4747", + "pubkeys": [ + "0x8d46e9aa0c1986056e407efc7013b7f271027d3c98ce96667faa98074ab0588a61681faf78644c11819a459a95689dab", + "0xae940a07850cf904b44f31cbf0e44824bae5ec36dcfdb7fad858f2a39dba38de82ca12b0ae939a34fce7a02e4b9789f8", + "0x96947de9e6068c22a7716656a2755a9551b0b66c2d1a741bf84a088fe1e840e992dc39861bf8ba3e8d5b6d21e8f57e64", + "0x81b676591b823270a3284ace7d81cbce2d6cdce55bb0e053874d7e3a08f729453009d3e662ec3130379f43c0f3210b6d", + "0x8fda66b8607af873f4c2c8218dd3ffc7940d411047eb199b5cd010156af4845d21dd2e65b0e44cfffb5e78271e9bb29d", + "0x8aa5bbee21e98c7b9e7a4c8ea45aa99f89e22992fa4fc2d73869d77da4cc8a05b25b61931ff521986677dd7f7159e8e6", + "0x996323af7e545fb6363ace53f1538c7ddc3eb0d985b2479da3ee4ace10cbc393b518bf02d1a2ddb2f5bdf09b473933ea", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0x84a687ffdf21a0ad754d0164d1e2c03035613ab76359e7f5cf51ea4a425a6ee026725ec0a0dbd336f7dab759596f0bf8", + "0xb24391aa97bfff29adc935d06a2b6d583433caf82f92de1980e0192d3b270323bdbf24b86dc61520a40c419dde3df4b3", + "0xb63f327df68581cdc02a66c1c65e906a06a1a3a8d7a6e38f7b6da944e8e6cc2db85fced5327d8c12945ceb33018272ca", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670", + "0x91709ee06497b9ac049325853d64947290189a8c2322e3a500d91e23ea02dc158b6db63ae558b3b7670357a151cd6071", + "0xb27ad13afc8ff30e087797b344c8382bb0a84447549f1b0274059ddd652276e7b148ba8808a10cc45746762957d4efbe", + "0xaf61f263addfb41c46d66e60ecfb598a5942f648f58718b6b4e4c92019fdb12328efbff98703134bcf28e9c1fab4bb60", + "0xa8fa3584a92b079c8c73ed1553e5e161a0b21325fc2fc4e24a892354a899c7fc0bfb436a97a7ed1fc71bccda438ea715", + "0x84d08d58c31bcd3cddf93e13d6f50203897384afa34644bff1135efe8e01c81c6a91ca6c234bb1e51ca32e41b828aaf9", + "0xa4ee6d37dc259cbb5237e4265429a9fd8ab5643af81628cc101e0d8b4a333ef2618a37df89ea3f92b5ea4333d8cda393", + "0x81ea9f74ef7d935b807474e38954ae3934856219a23e074954b2e860c5a3c400f9aedb42cd27cb4ceb697ca36d1e58cb", + "0xb72cb106b7bc1ecae219e0ae1830a509ed18a042b56a2779f4033419de69ba8ae8017090caed1f5377bfa68506157360", + "0x8a8bb292bcc481070d3afdbbc8789e2ab4b29c9603936e6d85f5ff71e23fc5b6d61009f0fa636b5d5b2dc309d39e3d75", + "0x8dfa86c051edd28c3554a30e40531c898e5936ad3002711616ddd1b27054bc39caedd505a200c3d23a1c3f6b26c50ae9", + "0xad9222dec71ff8ee6bc0426ffe7b5e66f96738225db281dd20027a1556d089fdebd040abfbc2041d6c1a0d8fdcfce183", + "0xb5e898a1fc06d51c695712928f44646d15451340d1b3e480a40f03250160bc07d3b6691ec94361dd524d59d9df7f76d3", + "0xa35c6004f387430c3797ab0157af7b824c8fe106241c7cdeb897d900c0f9e4bb945ff2a6b88cbd10e35ec48aaa554ecb", + "0xab72cbc6575c3179680a58c0ecd5de46d2678ccbafc016746348ee5688edcb21b4e15bd37c70c508e3ea73103c2d566b", + "0x87231421a08ed28e7d357e2b37a26a458155c8d822d829344bd1029e5d175b5edfaa78f16f784f724a2caef124944c4f", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0x8419cf00f2783c430dc861a710984d0429d3b3a7f6db849b4f5c05e0d87339704c5c7f5eede6adfc8776d666587b5932", + "0xb2225575d5e70da1257db7a0d1222c5041b52aac61cf161e8fc8126a3fdf5eb4f0867d98dfe272199c36cf8f02661b3d", + "0x958c2692b86b4d20eaea3bb45e9447ebbc5b93ccaf8d21ef659d0cefedf5c4371b31b460ae40e8243682bde505abac1e", + "0x8725b32751419f22a54485790f8187d1ba52d84a31ad45738a93777fcd1ccbec1652229923f82f37793ce0fc2763fb4c" + ] + }, + "next_sync_committee_branch": [ + "0xb482d0cb49a70f38480ac754e59435c3a564677abfb302ed1c310f5721dde609", + "0x8e4efb94114429cd2597cc5ef9de27d2c095b84aa1d093726247a6909913bb29", + "0x6869f2d8936ad8c5f2b0b62390259d9e24d85ebf13849edbbd4ea7f16df54de2", + "0x7efe8ffa58f060bc40db587d51b43189c5aae9e0101129b1a39ba0a803f5c179", + "0xeebd09888f7da9b71f28dd81dcca61adea19acf685f88114e8d52e9399d80f1a" + ], + "signature_slot": "145", + "sync_aggregate": { + "sync_committee_bits": "0xffffffff", + "sync_committee_signature": "0xad79a10a3fd53c501a3ca78940cfc1655919719bc5887dd46b0f499a69d635a8399a19c1f0df7bdffca5f13243f15c6c1170f744f508faf23f918edb9117dfe5bf9513cffa1baa4e5f5b4d322f0d1334c5475343b5d5300920d54807e3ead24d" + } + }, + "trusted_sync_committee": { + "sync_committee": { + "Next": { + "aggregate_pubkey": "0x8cede9fc2550b89bbfe0f14b34fce3871e383d08b01e2362e2e21086808bb31804ee5b7ce6403d1756f7b6d6f9fb76d1", + "pubkeys": [ + "0xa03c2a82374e04b2e0594c4ce14fb3f225b46f13188f0d8002a523c7dcfb939ae4856053c2c9c695374d7c3685df1ca5", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0x8d8985e5dd341c9035b37bf7391c5944c28131b47c7d5359d18fca598010ba9a63e27c55e6b421a807038c320564db17", + "0x8a8bb292bcc481070d3afdbbc8789e2ab4b29c9603936e6d85f5ff71e23fc5b6d61009f0fa636b5d5b2dc309d39e3d75", + "0xa0485d71f1f5e177f7d5bc9d98c5248a6a2d0de4554c2eaf02abae48f5a3e273b2ee7765784cf2a4cb7df84f617177c9", + "0xaaddb0cb69ca18f14aed7054e98a24df0ff606aeff919d489f7884fd1bd183bcb46ea54bc363146e1a88db36dc20a7a4", + "0xaf89ab00a0eab1131645292a9cfba583a69a1e3ac58b210e262494853e67385aeb50d4af428bdd577b9399daa96d8b20", + "0xa8fa3584a92b079c8c73ed1553e5e161a0b21325fc2fc4e24a892354a899c7fc0bfb436a97a7ed1fc71bccda438ea715", + "0x9918433b8f0bc5e126da3fdef8d7b71456492dae6d2d07f2e10c7a7f852046f84ed0ce6d3bfec42200670db27dcf3037", + "0xab40dc1cfe273ad0da700c64f8fc94f91db253ca3acf20e336d9bd09de67eec5c7d3506285d83c7bb6a08d64b77e5f2d", + "0xaaf6c1251e73fb600624937760fef218aace5b253bf068ed45398aeb29d821e4d2899343ddcbbe37cb3f6cf500dff26c", + "0x96947de9e6068c22a7716656a2755a9551b0b66c2d1a741bf84a088fe1e840e992dc39861bf8ba3e8d5b6d21e8f57e64", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0xab64f900c770e2b99de6b86b4390bbd1579bd48dccec55800adbcf52e006f22128e9971bbf3a92cc0105b0974849935a", + "0xae5302796cfeca685eaf37ffd5baeb32121f2f07415bee26cc0051ee513ff3932d2c365e3d9f87b0949a5980445cb64c", + "0x8d46e9aa0c1986056e407efc7013b7f271027d3c98ce96667faa98074ab0588a61681faf78644c11819a459a95689dab", + "0xab72cbc6575c3179680a58c0ecd5de46d2678ccbafc016746348ee5688edcb21b4e15bd37c70c508e3ea73103c2d566b", + "0x91709ee06497b9ac049325853d64947290189a8c2322e3a500d91e23ea02dc158b6db63ae558b3b7670357a151cd6071", + "0x8dfa86c051edd28c3554a30e40531c898e5936ad3002711616ddd1b27054bc39caedd505a200c3d23a1c3f6b26c50ae9", + "0xb09cb155daf2022afd18114a352e506a84065c80573cb0c7c310cbe92e2706cdcf91f74bbd9e464f74e3d831386d5033", + "0x84a687ffdf21a0ad754d0164d1e2c03035613ab76359e7f5cf51ea4a425a6ee026725ec0a0dbd336f7dab759596f0bf8", + "0x86e014747c7922ccfc2b9d4bf6c1ecf0dc800197037858d0b85ab1944b4c3c14b95e0ed325bc42a6f467bc47ec27bc7b", + "0xb72cb106b7bc1ecae219e0ae1830a509ed18a042b56a2779f4033419de69ba8ae8017090caed1f5377bfa68506157360", + "0x81fa222737fe818b43f55f209f42adaee135b2801d02709617fc88c2871852358260ace97cf323e761b5cc18bc7325b3", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670", + "0xae940a07850cf904b44f31cbf0e44824bae5ec36dcfdb7fad858f2a39dba38de82ca12b0ae939a34fce7a02e4b9789f8", + "0x8725b32751419f22a54485790f8187d1ba52d84a31ad45738a93777fcd1ccbec1652229923f82f37793ce0fc2763fb4c", + "0xa2e2d8384fc87a512ee34eb43405fd82572c9d7cd96e155a382cda284e8df9eb7189c25b7473d89c63ea4e6080e10ff8", + "0x84dc37ca3cd621d3da0fbdd11ca84021e0cd81a73d772dd6fcf19775b72eb64af4e573213378ccee0915dde92ac83ba6", + "0xac69ae9e6c385a368df71d11ac68f45f05e005306df3c2bf98ed3577708256bd97f8c09d3f72115444077a9bb711d8d1", + "0xa804e4fa8d1391a9d078aa93985a12503b84ce4f6f1f9e70ab7fca421e1cf972538666299d4c1bfc39327b469b2db7a8", + "0xb63f327df68581cdc02a66c1c65e906a06a1a3a8d7a6e38f7b6da944e8e6cc2db85fced5327d8c12945ceb33018272ca" + ] + } + }, + "trusted_slot": 80 + } + } + ] + }, + "name": "updated_light_client" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "0x20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "0x30000038" + }, + "capella": { + "epoch": 0, + "version": "0x40000038" + }, + "deneb": { + "epoch": 0, + "version": "0x50000038" + }, + "genesis_fork_version": "0x10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734449555, + "genesis_validators_root": "0xd61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0xbb24f202d3b5847326207894777cd09e06db2955", + "latest_slot": 144, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0x8cede9fc2550b89bbfe0f14b34fce3871e383d08b01e2362e2e21086808bb31804ee5b7ce6403d1756f7b6d6f9fb76d1", + "next_sync_committee": "0x97644a8275149afa40688421672cb0e40b2a2a594058d8bd5fabf4b4329f33dfd760b01951ca432a7fa39c9edf1b4747", + "slot": 144, + "state_root": "0xebfe6c8364983c13232db8ab16a2ef61efa5bc0e8ea0ce927b8e3cd4baac1516", + "storage_root": "0x11e3ad640168326c5804965a5bf523134ea8b3ac3bef9dffc19743e93f9c4e46", + "timestamp": 1734450419 + }, + "path": "0x30372d74656e6465726d696e742d30030000000000000001", + "proof_slot": 144, + "storage_proof": { + "key": "0xcf83085d37329b7e986d9c244160ec7214c7801a7cde4cfb6d867fcc42c73b70", + "proof": [ + "0xf8918080a07598a7116cb12aa50c14cdc40fb1de43afaa8fcbdee7941b0bec2a78c8329fc6808080a057b16d9a3bbb2d106b4d1b12dca3504f61899c7c660b036848511426ed342dd68080808080a0d9ec33d9f60bff6b13f9b1636c3a0ac7cbf1c866de72e36f20690feb7330490ba02a4da1fbb69a7ec1cb1979f1d313bb6188eb886242d497303065ecd7782c6a72808080", + "0xf843a0382067d529115cce05a0a8b198f46ceb4ba57b89e83f93c7e683a5a669a65d16a1a08460e21f73b53d779e4b3291cd35338e92fae9998735f1a0b7150c074c0731a6" + ], + "value": "0x8460e21f73b53d779e4b3291cd35338e92fae9998735f1a0b7150c074c0731a6" + } + }, + "name": "commitment_proof" + } + ] +} \ No newline at end of file diff --git a/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16.json b/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16.json new file mode 100644 index 000000000..df006654 --- /dev/null +++ b/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16.json @@ -0,0 +1,622 @@ +{ + "steps": [ + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "30000038" + }, + "capella": { + "epoch": 0, + "version": "40000038" + }, + "deneb": { + "epoch": 0, + "version": "50000038" + }, + "genesis_fork_version": "10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734450521, + "genesis_validators_root": "d61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0x362cadfe5ac1c1c3f23d2c6cc6444359c3b639ae", + "latest_slot": 32, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0x98b7e29b43438cee8424bbaf7a75f0275ad5c3b87c795a81c855daec0c60650230cdf694d6c084694ac260da87ffa123", + "next_sync_committee": "0x98b7e29b43438cee8424bbaf7a75f0275ad5c3b87c795a81c855daec0c60650230cdf694d6c084694ac260da87ffa123", + "slot": 32, + "state_root": "0x29853c56b1978aeb1a38f5a613c190b7f84a3fd6ab236eb077a1463fca7a10cf", + "storage_root": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": 1734450713000000000 + } + }, + "name": "initial_state" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "30000038" + }, + "capella": { + "epoch": 0, + "version": "40000038" + }, + "deneb": { + "epoch": 0, + "version": "50000038" + }, + "genesis_fork_version": "10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734450521, + "genesis_validators_root": "d61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0x362cadfe5ac1c1c3f23d2c6cc6444359c3b639ae", + "latest_slot": 32, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0x98b7e29b43438cee8424bbaf7a75f0275ad5c3b87c795a81c855daec0c60650230cdf694d6c084694ac260da87ffa123", + "next_sync_committee": "0x98b7e29b43438cee8424bbaf7a75f0275ad5c3b87c795a81c855daec0c60650230cdf694d6c084694ac260da87ffa123", + "slot": 32, + "state_root": "0x29853c56b1978aeb1a38f5a613c190b7f84a3fd6ab236eb077a1463fca7a10cf", + "storage_root": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": 1734450713000000000 + }, + "updates": [ + { + "account_update": { + "account_proof": { + "proof": [ + "0xf90211a0d470b8f6d39449144f41d049dece58af9f5ba848fe8b8c290c1e51815a69e2c9a006d47616df479b46b302f2a8b7ed03cb537f6cf7c551c15421c65db4e00fa97fa0727f50beadc850770276339c65f1bc8986ecd2fd3ce54ea34f850a6341328dd4a00b511437287dfb631b53421836126826b2dd7249848effcc068c8f421c9cf979a0bef95ed24d2bc0b6153315e0236581eef646d69ade2a9862e0ab3e578590dbfea0eea64374052ac460957bbc34a071cb8b25dcdf44d96785a55b34242914c83f9fa05d61ef3ac1c641228a041a9515231e155e3f513c597438daae5b5aa64ebb2e67a0e3fefe99329bb0861bea8bb8db98b6f9bc489051b48514e7e9f2812d62ff4859a037caa2255845a2b22ff3520d815070e1033e21f49e7bebe74f3b231933549d3ba0be88e4724326382a8b56e2328eeef0ad51f18d5bae0e84296afe14c4028c4af9a06e943bea3df35c8d2298118a332a9207a000aebc2db900faa80c19615bdf6612a014a5f536b52713fcd4e77345981e6349b65bd55df9bfdf39de40beacab2b286ca0b79b760e614b0cfe8e18daf91903fe7e80d2486efbd4af7784e8ce90c34b0c88a0899f71abb18c6c956118bf567fac629b75f7e9526873e429d3d8abb6dbb58021a04749ac8619921a00352f9623a1c6eb64ba5257c53a6f03054f59088fa949d7a9a00fc6600d6ab0e13542f589d029d576ad60c60346910467c1479c6a8abab03b8680", + "0xf901b1a090358d83779973801b7a3f4468c4f9475905a3eb4a5e1d54aa00d46599596d29a049772c68352eab4d0f878553b8d61d585797f20f9dca1e5162c03078c472c98fa014389ec4a809554bd6c0ed11ecbc90f9fc419990a636e3533ecdee11a8b6f51ea040c355a42690b5378f09b645283e594ba684b42b96ff173c80c94b2723560315a06e0b867beddead84f7d0eba31ad24fe77ad7ae1e56928aa84c7793788209caf2a01684d189bbac3ac6a4aecfd43685c40b24760d95687c004f2ab3486c1686d8a1a07fefea46ec61634eec1fb2ab477598f50ddd9259fcacfbbe4ad23b74976242b0a0804c437a2c08f59bbe8278c7fda83d0b18ef3f4ff11cd015c99c156477dbc09da003c5801bf244c28c5c430853d6797ee54f7e1a7c384f51d8c9a1dc4cd96cb74f80a0a5acd0ecfd7dcecd1f7360af116e7dd25617a0205b5f8b369be3ffc784c4f5a9a0bf90e746ea86172da995d366c29e417cc158c6689eab8f65860b5734a438719ea0ad8d5ae00a40b5ed737c67d483472b640149d82a6e191e170d3254e09f62c2fe80a0823a38527672ae42d480369a80b0b9c2ede964cb93668c0487e1341607c5d5ee8080", + "0xf871a031b1402470bfa6453f9f9ae3805e1844f0889b666f0c370e9ec79c63ecfbaee38080808080808080a09b521f0cdf2cb3c7925277b68f6c5b9e806b602130f68ed384ccce9a546393c88080a0be30eb59921caa476136fe2c9f7d5166efffa218c6cd94fca3172edca7088c8a80808080", + "0xf8689f3980c97a492094968e4a617377e19b2c64fdeb5240ad39b4db2eaf4dfba587b846f8440180a07b04fe1daccc4a8c41f7cc733d154f9edf29c4145b5c4a075645906ab6db1343a0b5501c2a9888592ebf43ad390bf13907b83d7834834d35a1ff1cf1a739745c69" + ], + "storage_root": "0x7b04fe1daccc4a8c41f7cc733d154f9edf29c4145b5c4a075645906ab6db1343" + } + }, + "consensus_update": { + "attested_header": { + "beacon": { + "body_root": "0xd8cb0e2edcf8107ee3ee9aeadf460b9ac7ccc2c1db3abe131b92317bbb6cc1eb", + "parent_root": "0xa57216008f06d693de483fc34c5ab0f5d55c63f2d4e912101f111c7a11e879cd", + "proposer_index": "10", + "slot": "80", + "state_root": "0xaeb8ed05b19f28aea3677f6c561d7d0a10304a848b70cc23f8e4ab92650c341f" + }, + "execution": { + "base_fee_per_gas": "26547", + "blob_gas_used": "0", + "block_hash": "0x9f187b3711f5b5c18a8a1ae437e784f5c98d14e6314d64bb2b5e34557ab46238", + "block_number": "80", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0x94473914db2152f394013624e53c3e742a65604109f5f2d1a746abc170236530", + "prev_randao": "0xd19481506f56199f5fb78fb943c6ca26295addeb9a6b9e2b9a66095b196a7e09", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0xdd4c19eb520c8f6ecd92ddcbaaeaf4f2666d72f06e6082c3245d4d84e0bae08a", + "timestamp": "1734451001", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0xca09ba22248f830dd69260d372aac41d210ecc200dae169dc39ee624e6edf68a", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0xcef9315ca13d113a45545d1bff980e35cfd95c28bd7dbfa8667a13d714f31891" + ] + }, + "finality_branch": [ + "0x0800000000000000000000000000000000000000000000000000000000000000", + "0x5f6f02af29218292d21a69b64a794a7c0873b3e0f54611972863706e8cbdf371", + "0x98f5798e269225241fb880f7eee4d37ada109efa71d8eb26759cf1732c0825c2", + "0x9ca26b29f7938da69634ea693cd3aa76c9189bfed0de232e5d3a422d481cf3fb", + "0xb4ee00cbb27851fdca8f95b18a598ae363532a9c93b859727a2afb87cdc54e97", + "0x6c436ca42a903aef228fa668c7203d82aed0ff1411fe9daf546c370ad5f76abb" + ], + "finalized_header": { + "beacon": { + "body_root": "0xe9d485d240155cd3cfcdc1ad93c45806cebd3dc85058b9fef7b856a3ce8a064c", + "parent_root": "0x93b742ad7561e25b64e94fd30d523fc08cba38538300d15621c53c311e680354", + "proposer_index": "27", + "slot": "64", + "state_root": "0xc2b26ce4a22b675c0b164237be4efe7ae41b15c24cca747998d39af315168edb" + }, + "execution": { + "base_fee_per_gas": "221836", + "blob_gas_used": "0", + "block_hash": "0xe0de86f05652a8943154a833bdb49a2dd9ef9ebd85957b9020f5f972300a7c07", + "block_number": "64", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0xebed5cbef629c191eac7376e907807ac315a6d04b5fc28df5fb63ea20854af57", + "prev_randao": "0x959a11a7a8d51c2635dab3c90b4667349e4eee8e4766e74b24502270a8f1c1a6", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0x32d28f55c71e05c0b56dac9bebab7d3ffd3009f37ddf9735af78943fbd7ff9d5", + "timestamp": "1734450905", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0x8ea605ff5752913c4076870e1d77687e96d4d5718de5825a92a0ecc9f83a1068", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x13f44b6fe41beda3bbdebed3be3c2ff8b72a0c1fb45d6bdc57ef2a445ce7640d" + ] + }, + "next_sync_committee": { + "aggregate_pubkey": "0xb7ca9df197280bc33af9576ebf0fa6df3e0e93767d7536df7cd4083ed6b5be984f57a3839584cdfe90d9b4ba516bee94", + "pubkeys": [ + "0xa1d9840eda3036fbf63eeea40146e4548553e6e1b2a653ab349b376f31b367c40d71fb59ff8e94b91daa99c262ec8b52", + "0xb63f327df68581cdc02a66c1c65e906a06a1a3a8d7a6e38f7b6da944e8e6cc2db85fced5327d8c12945ceb33018272ca", + "0x996d10c3026b9344532b06c70a596f972a1e779a1f6106d3da9f6ba376bbf7ec82d2f52629e5dbf3f7d03b00f6b862af", + "0x958c2692b86b4d20eaea3bb45e9447ebbc5b93ccaf8d21ef659d0cefedf5c4371b31b460ae40e8243682bde505abac1e", + "0xaf89ab00a0eab1131645292a9cfba583a69a1e3ac58b210e262494853e67385aeb50d4af428bdd577b9399daa96d8b20", + "0xa62c0205fb22df8535c0b70076486e69dfa908feddae79e4a94a9d47b97ed190d228e1c6217e84a59882bb992dacae30", + "0xa759f6bcca8f35fcaadc406cc4b828c016c0ed23882987a79f52f2933b5cedefe24e31df6fd0d38e8a802dbafd750d01", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0xb5e898a1fc06d51c695712928f44646d15451340d1b3e480a40f03250160bc07d3b6691ec94361dd524d59d9df7f76d3", + "0xa75ca9447dca3a3745ada36731187ddd1f6a152cf15d7446b785eab381e5c8562c1202a6e7a24080bc6b619a161113db", + "0x8de5a6200cebb09b2198e69fed84bcd512ec5cf317c5f1ee99aad03d2a9a8564bf3807c08da2664222268d59c34a06e4", + "0x81fa222737fe818b43f55f209f42adaee135b2801d02709617fc88c2871852358260ace97cf323e761b5cc18bc7325b3", + "0x896a51e0b0de0f29029af38b796db1f1e6d0f9f9085ade40a313a60cb723fa3d58f6587175570086c4fbf0fe5331f1c8", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670", + "0x8aa5bbee21e98c7b9e7a4c8ea45aa99f89e22992fa4fc2d73869d77da4cc8a05b25b61931ff521986677dd7f7159e8e6", + "0x8d028a021c5c31a1aa1e18eda74cfaf0fba1c454c17c2e0fc730dd07a19d0c77f7a905d54017292f3e800ca06b6977cd", + "0x9763dde1b8028136a3ffd6dafd1f450e2cafb2819c7fa901f7c6e9cde8f2897ee7e9a45da6947fde1ad0d3836188eab5", + "0x87231421a08ed28e7d357e2b37a26a458155c8d822d829344bd1029e5d175b5edfaa78f16f784f724a2caef124944c4f", + "0xa03c2a82374e04b2e0594c4ce14fb3f225b46f13188f0d8002a523c7dcfb939ae4856053c2c9c695374d7c3685df1ca5", + "0x84a687ffdf21a0ad754d0164d1e2c03035613ab76359e7f5cf51ea4a425a6ee026725ec0a0dbd336f7dab759596f0bf8", + "0xb27ad13afc8ff30e087797b344c8382bb0a84447549f1b0274059ddd652276e7b148ba8808a10cc45746762957d4efbe", + "0xac69ae9e6c385a368df71d11ac68f45f05e005306df3c2bf98ed3577708256bd97f8c09d3f72115444077a9bb711d8d1", + "0xb72cb106b7bc1ecae219e0ae1830a509ed18a042b56a2779f4033419de69ba8ae8017090caed1f5377bfa68506157360", + "0xae940a07850cf904b44f31cbf0e44824bae5ec36dcfdb7fad858f2a39dba38de82ca12b0ae939a34fce7a02e4b9789f8", + "0xa0485d71f1f5e177f7d5bc9d98c5248a6a2d0de4554c2eaf02abae48f5a3e273b2ee7765784cf2a4cb7df84f617177c9", + "0xaf61f263addfb41c46d66e60ecfb598a5942f648f58718b6b4e4c92019fdb12328efbff98703134bcf28e9c1fab4bb60", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0xb2225575d5e70da1257db7a0d1222c5041b52aac61cf161e8fc8126a3fdf5eb4f0867d98dfe272199c36cf8f02661b3d", + "0x8c0d15baa72bfcd317e9b9402ca9bb6e7ae1db35ffce7faccae0bd19b3c8e5de7d5524aef0377770b3a90626627a9304", + "0x8419cf00f2783c430dc861a710984d0429d3b3a7f6db849b4f5c05e0d87339704c5c7f5eede6adfc8776d666587b5932", + "0xab72cbc6575c3179680a58c0ecd5de46d2678ccbafc016746348ee5688edcb21b4e15bd37c70c508e3ea73103c2d566b", + "0xa54fe5c26059ed60b4f0b66ef7b0bf167580504525f83c169507dc812816df41b1da6128341c23977300dffd32a32f41" + ] + }, + "next_sync_committee_branch": [ + "0xfbcb9a4e507c4b252a48212de4426fdfca4a06a8c657adcf5d940e06bf5d8770", + "0xbc6307f3c36c7f7b8fd479a2b3615033bc71fd4e75bd3bfc00828acfa2f63c85", + "0x9ca26b29f7938da69634ea693cd3aa76c9189bfed0de232e5d3a422d481cf3fb", + "0xb4ee00cbb27851fdca8f95b18a598ae363532a9c93b859727a2afb87cdc54e97", + "0x6c436ca42a903aef228fa668c7203d82aed0ff1411fe9daf546c370ad5f76abb" + ], + "signature_slot": "81", + "sync_aggregate": { + "sync_committee_bits": "0xffffffff", + "sync_committee_signature": "0xab11c6b79b49b36fbb052e28d206170ad918c761a782740e0545c9a5479ab0a229eb6412aa45e3c2d118a838c087102f0ec2acb391033ffa4e5d64aa2890a1421864b645831b3094d634e17b44195c87316468143760958c708bd7f7bae2cc79" + } + }, + "trusted_sync_committee": { + "sync_committee": { + "Next": { + "aggregate_pubkey": "0x98b7e29b43438cee8424bbaf7a75f0275ad5c3b87c795a81c855daec0c60650230cdf694d6c084694ac260da87ffa123", + "pubkeys": [ + "0xa75ca9447dca3a3745ada36731187ddd1f6a152cf15d7446b785eab381e5c8562c1202a6e7a24080bc6b619a161113db", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0xb24391aa97bfff29adc935d06a2b6d583433caf82f92de1980e0192d3b270323bdbf24b86dc61520a40c419dde3df4b3", + "0x8fda66b8607af873f4c2c8218dd3ffc7940d411047eb199b5cd010156af4845d21dd2e65b0e44cfffb5e78271e9bb29d", + "0x8a8bb292bcc481070d3afdbbc8789e2ab4b29c9603936e6d85f5ff71e23fc5b6d61009f0fa636b5d5b2dc309d39e3d75", + "0x8d46e9aa0c1986056e407efc7013b7f271027d3c98ce96667faa98074ab0588a61681faf78644c11819a459a95689dab", + "0xab72cbc6575c3179680a58c0ecd5de46d2678ccbafc016746348ee5688edcb21b4e15bd37c70c508e3ea73103c2d566b", + "0x8de5a6200cebb09b2198e69fed84bcd512ec5cf317c5f1ee99aad03d2a9a8564bf3807c08da2664222268d59c34a06e4", + "0x958c2692b86b4d20eaea3bb45e9447ebbc5b93ccaf8d21ef659d0cefedf5c4371b31b460ae40e8243682bde505abac1e", + "0xa54fe5c26059ed60b4f0b66ef7b0bf167580504525f83c169507dc812816df41b1da6128341c23977300dffd32a32f41", + "0xa2e2d8384fc87a512ee34eb43405fd82572c9d7cd96e155a382cda284e8df9eb7189c25b7473d89c63ea4e6080e10ff8", + "0x81ea9f74ef7d935b807474e38954ae3934856219a23e074954b2e860c5a3c400f9aedb42cd27cb4ceb697ca36d1e58cb", + "0xa62c0205fb22df8535c0b70076486e69dfa908feddae79e4a94a9d47b97ed190d228e1c6217e84a59882bb992dacae30", + "0x91709ee06497b9ac049325853d64947290189a8c2322e3a500d91e23ea02dc158b6db63ae558b3b7670357a151cd6071", + "0x8d8985e5dd341c9035b37bf7391c5944c28131b47c7d5359d18fca598010ba9a63e27c55e6b421a807038c320564db17", + "0xb27ad13afc8ff30e087797b344c8382bb0a84447549f1b0274059ddd652276e7b148ba8808a10cc45746762957d4efbe", + "0x8c0d15baa72bfcd317e9b9402ca9bb6e7ae1db35ffce7faccae0bd19b3c8e5de7d5524aef0377770b3a90626627a9304", + "0x896a51e0b0de0f29029af38b796db1f1e6d0f9f9085ade40a313a60cb723fa3d58f6587175570086c4fbf0fe5331f1c8", + "0x84a687ffdf21a0ad754d0164d1e2c03035613ab76359e7f5cf51ea4a425a6ee026725ec0a0dbd336f7dab759596f0bf8", + "0x81b676591b823270a3284ace7d81cbce2d6cdce55bb0e053874d7e3a08f729453009d3e662ec3130379f43c0f3210b6d", + "0xab40dc1cfe273ad0da700c64f8fc94f91db253ca3acf20e336d9bd09de67eec5c7d3506285d83c7bb6a08d64b77e5f2d", + "0xae940a07850cf904b44f31cbf0e44824bae5ec36dcfdb7fad858f2a39dba38de82ca12b0ae939a34fce7a02e4b9789f8", + "0xab64f900c770e2b99de6b86b4390bbd1579bd48dccec55800adbcf52e006f22128e9971bbf3a92cc0105b0974849935a", + "0xac69ae9e6c385a368df71d11ac68f45f05e005306df3c2bf98ed3577708256bd97f8c09d3f72115444077a9bb711d8d1", + "0x99d83a0ba33161d8c6bbe80929fd9046d4dfdac43477ff85fea5bae925e6c179ad28eb338375ee2417acbd6576ee670a", + "0x84d08d58c31bcd3cddf93e13d6f50203897384afa34644bff1135efe8e01c81c6a91ca6c234bb1e51ca32e41b828aaf9", + "0x9918433b8f0bc5e126da3fdef8d7b71456492dae6d2d07f2e10c7a7f852046f84ed0ce6d3bfec42200670db27dcf3037", + "0xad9222dec71ff8ee6bc0426ffe7b5e66f96738225db281dd20027a1556d089fdebd040abfbc2041d6c1a0d8fdcfce183", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0x996323af7e545fb6363ace53f1538c7ddc3eb0d985b2479da3ee4ace10cbc393b518bf02d1a2ddb2f5bdf09b473933ea", + "0x96947de9e6068c22a7716656a2755a9551b0b66c2d1a741bf84a088fe1e840e992dc39861bf8ba3e8d5b6d21e8f57e64", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670" + ] + } + }, + "trusted_slot": 32 + } + } + ] + }, + "name": "updated_light_client" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "0x20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "0x30000038" + }, + "capella": { + "epoch": 0, + "version": "0x40000038" + }, + "deneb": { + "epoch": 0, + "version": "0x50000038" + }, + "genesis_fork_version": "0x10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734450521, + "genesis_validators_root": "0xd61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0x362cadfe5ac1c1c3f23d2c6cc6444359c3b639ae", + "latest_slot": 80, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0x98b7e29b43438cee8424bbaf7a75f0275ad5c3b87c795a81c855daec0c60650230cdf694d6c084694ac260da87ffa123", + "next_sync_committee": "0xb7ca9df197280bc33af9576ebf0fa6df3e0e93767d7536df7cd4083ed6b5be984f57a3839584cdfe90d9b4ba516bee94", + "slot": 80, + "state_root": "0xdd4c19eb520c8f6ecd92ddcbaaeaf4f2666d72f06e6082c3245d4d84e0bae08a", + "storage_root": "0x7b04fe1daccc4a8c41f7cc733d154f9edf29c4145b5c4a075645906ab6db1343", + "timestamp": 1734451001 + }, + "path": "0x30372d74656e6465726d696e742d30030000000000000001", + "proof_slot": 80, + "storage_proof": { + "key": "0xcf83085d37329b7e986d9c244160ec7214c7801a7cde4cfb6d867fcc42c73b70", + "proof": [ + "0xf8718080a0d86f39f51d40aa691aa0c9c914f36cd6f802031f04571db1138c1780df0c74f3808080808080808080a0d9ec33d9f60bff6b13f9b1636c3a0ac7cbf1c866de72e36f20690feb7330490ba02a4da1fbb69a7ec1cb1979f1d313bb6188eb886242d497303065ecd7782c6a72808080", + "0xf843a0382067d529115cce05a0a8b198f46ceb4ba57b89e83f93c7e683a5a669a65d16a1a08460e21f73b53d779e4b3291cd35338e92fae9998735f1a0b7150c074c0731a6" + ], + "value": "0x8460e21f73b53d779e4b3291cd35338e92fae9998735f1a0b7150c074c0731a6" + } + }, + "name": "commitment_proof" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "0x20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "0x30000038" + }, + "capella": { + "epoch": 0, + "version": "0x40000038" + }, + "deneb": { + "epoch": 0, + "version": "0x50000038" + }, + "genesis_fork_version": "0x10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734450521, + "genesis_validators_root": "0xd61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0x362cadfe5ac1c1c3f23d2c6cc6444359c3b639ae", + "latest_slot": 80, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0x98b7e29b43438cee8424bbaf7a75f0275ad5c3b87c795a81c855daec0c60650230cdf694d6c084694ac260da87ffa123", + "next_sync_committee": "0xb7ca9df197280bc33af9576ebf0fa6df3e0e93767d7536df7cd4083ed6b5be984f57a3839584cdfe90d9b4ba516bee94", + "slot": 80, + "state_root": "0xdd4c19eb520c8f6ecd92ddcbaaeaf4f2666d72f06e6082c3245d4d84e0bae08a", + "storage_root": "0x7b04fe1daccc4a8c41f7cc733d154f9edf29c4145b5c4a075645906ab6db1343", + "timestamp": 1734451001 + }, + "updates": [ + { + "account_update": { + "account_proof": { + "proof": [ + "0xf90211a0d470b8f6d39449144f41d049dece58af9f5ba848fe8b8c290c1e51815a69e2c9a006d47616df479b46b302f2a8b7ed03cb537f6cf7c551c15421c65db4e00fa97fa0727f50beadc850770276339c65f1bc8986ecd2fd3ce54ea34f850a6341328dd4a0413490ed8d3c3500f32a0ddb4a8f74168e9a002101baf009ff8a52e8c3dd928aa059660b931330f1035af3f4677a360eeb014632d05140c0b3915a14e1e350f92da0eea64374052ac460957bbc34a071cb8b25dcdf44d96785a55b34242914c83f9fa05d61ef3ac1c641228a041a9515231e155e3f513c597438daae5b5aa64ebb2e67a0e3fefe99329bb0861bea8bb8db98b6f9bc489051b48514e7e9f2812d62ff4859a037caa2255845a2b22ff3520d815070e1033e21f49e7bebe74f3b231933549d3ba0be88e4724326382a8b56e2328eeef0ad51f18d5bae0e84296afe14c4028c4af9a06e943bea3df35c8d2298118a332a9207a000aebc2db900faa80c19615bdf6612a07a077fd8bed6fed5f8cc23d0fbaca364b305a45ff1e229c7c0b3a0a6eddb9baea0b79b760e614b0cfe8e18daf91903fe7e80d2486efbd4af7784e8ce90c34b0c88a0899f71abb18c6c956118bf567fac629b75f7e9526873e429d3d8abb6dbb58021a0b1739223c1709b5d5074a07a5a117d30ed4b3fb0bb06526c345b5cf4eaa7951aa00fc6600d6ab0e13542f589d029d576ad60c60346910467c1479c6a8abab03b8680", + "0xf901b1a090358d83779973801b7a3f4468c4f9475905a3eb4a5e1d54aa00d46599596d29a049772c68352eab4d0f878553b8d61d585797f20f9dca1e5162c03078c472c98fa014389ec4a809554bd6c0ed11ecbc90f9fc419990a636e3533ecdee11a8b6f51ea040c355a42690b5378f09b645283e594ba684b42b96ff173c80c94b2723560315a06e0b867beddead84f7d0eba31ad24fe77ad7ae1e56928aa84c7793788209caf2a01684d189bbac3ac6a4aecfd43685c40b24760d95687c004f2ab3486c1686d8a1a0aa20f25ec26285016b41d32dfea8ac398ff38f5f001211ce135cb7de9f5c04a6a0804c437a2c08f59bbe8278c7fda83d0b18ef3f4ff11cd015c99c156477dbc09da003c5801bf244c28c5c430853d6797ee54f7e1a7c384f51d8c9a1dc4cd96cb74f80a0a5acd0ecfd7dcecd1f7360af116e7dd25617a0205b5f8b369be3ffc784c4f5a9a0bf90e746ea86172da995d366c29e417cc158c6689eab8f65860b5734a438719ea0ad8d5ae00a40b5ed737c67d483472b640149d82a6e191e170d3254e09f62c2fe80a0823a38527672ae42d480369a80b0b9c2ede964cb93668c0487e1341607c5d5ee8080", + "0xf871a00c51b10729a1b43fff85dc23075ed9a6fa6ebdc237308fab66ca23da54a3490c8080808080808080a09b521f0cdf2cb3c7925277b68f6c5b9e806b602130f68ed384ccce9a546393c88080a0be30eb59921caa476136fe2c9f7d5166efffa218c6cd94fca3172edca7088c8a80808080", + "0xf8689f3980c97a492094968e4a617377e19b2c64fdeb5240ad39b4db2eaf4dfba587b846f8440180a0e410160052c4e5826ee87e464901426ac022518f47675882c7c04d9f831d86e1a0b5501c2a9888592ebf43ad390bf13907b83d7834834d35a1ff1cf1a739745c69" + ], + "storage_root": "0xe410160052c4e5826ee87e464901426ac022518f47675882c7c04d9f831d86e1" + } + }, + "consensus_update": { + "attested_header": { + "beacon": { + "body_root": "0x32f0b14ceb6e6de572c0efc9bc8d5098607cbe87d1080e2c82c2227ee21211a0", + "parent_root": "0xfb97544f0caabd4454c694a94851639b684487f2578a57c5bcc7db5abce1d214", + "proposer_index": "13", + "slot": "144", + "state_root": "0xb0eaf19c20b6e08601e11031abea177788a396c9998a10f3525f6c53a52e8d6a" + }, + "execution": { + "base_fee_per_gas": "9", + "blob_gas_used": "0", + "block_hash": "0x277e10ca6a940030be38b3d9b8c4866abcb8056124fc9564f22529bc66241428", + "block_number": "144", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0x0772aa4bb79caf2457d08834da4e8a564128a7fa0f1747e5847b77dcb5f013fd", + "prev_randao": "0xfdc463ad96886c0c56ad886540254ff4342f80dd27338dd9be542153cc32cdad", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0x9e298f15daae640615b35eb0ea8823b28b5f75e66607f5c3a338e64c24d6703a", + "timestamp": "1734451385", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0xf783258fd493df1f17e44abe0e18ded4bf8bdda79eccd2ce85949f8acfad83d7", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x58e5a2c8689f443ef86d2db00cbbd46722fbf0274656185bba3d27d78fd695d8" + ] + }, + "finality_branch": [ + "0x1000000000000000000000000000000000000000000000000000000000000000", + "0x5f6f02af29218292d21a69b64a794a7c0873b3e0f54611972863706e8cbdf371", + "0xddd6f307414f229415b92bcd0e14a4189aedbabe71554fcb8b3bc5952016ca42", + "0xf569c5c92f5be4647089ed82885538f1199efe87169fe0d4b8e2217d547386e4", + "0xa963d546088ba52b92ebad43cbbde21e7b9426850b52eb26f3ec7d2a606af3e4", + "0xdef2c07df9b676044dc991f1964ea3d775bcd98733d5e94ee9e7bf12a28cb918" + ], + "finalized_header": { + "beacon": { + "body_root": "0x7a326a49ddc86376b70daaa75c73ccdc252b3509b13db504db143a771175104f", + "parent_root": "0x938ce3def42a2968a5f9a4918b3b517ce7d5bf91beb51d008d6d10718cc0f773", + "proposer_index": "16", + "slot": "128", + "state_root": "0xf5df08b2ad6ce8b9d6b842d92f6ba5acbd1bc1ac806ba1fbf628c087577ed899" + }, + "execution": { + "base_fee_per_gas": "48", + "blob_gas_used": "0", + "block_hash": "0x884aa80dc419e3c03a82c9ac03da27e792daed871c045ab01d7403d1771f83dd", + "block_number": "128", + "excess_blob_gas": "0", + "extra_data": "0xd883010e06846765746888676f312e32322e34856c696e7578", + "fee_recipient": "0x8943545177806ED17B9F23F0a21ee5948eCaa776", + "gas_limit": "30000000", + "gas_used": "0", + "logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "parent_hash": "0x3ef8a57efed10723c4d9e16b7382b3d24baa871d6b10ae3c413e670fd3b6df95", + "prev_randao": "0x4e0e0226606ebd8ceb4f47befcf119a40a7efc3687d5de0468713cadf3b731e2", + "receipts_root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "state_root": "0xdc757e0d1f88d01744ef6c67a7344e17db9fb4375904cfca648ba3ea5cc48d2c", + "timestamp": "1734451289", + "transactions_root": "0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1", + "withdrawals_root": "0x28ba1834a3a7b657460ce79fa3a1d909ab8828fd557659d4d0554a9bdbc0ec30" + }, + "execution_branch": [ + "0x8673f3b0ca01dc48eb4b938c51c8131e7c7fcec51c70e1fcd50bde3a714f7b24", + "0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x72f27050eb68acdfcd463b1fd9ce42feb54e24e554c2335df13018c7731b7015" + ] + }, + "next_sync_committee": { + "aggregate_pubkey": "0x9432fc7c4a297d9a68254deefe6e2bfa16495558c641afe9e02f81318e64caa8da62a5effec586323e91987de96e5ba8", + "pubkeys": [ + "0xb2225575d5e70da1257db7a0d1222c5041b52aac61cf161e8fc8126a3fdf5eb4f0867d98dfe272199c36cf8f02661b3d", + "0xa35c6004f387430c3797ab0157af7b824c8fe106241c7cdeb897d900c0f9e4bb945ff2a6b88cbd10e35ec48aaa554ecb", + "0xaaddb0cb69ca18f14aed7054e98a24df0ff606aeff919d489f7884fd1bd183bcb46ea54bc363146e1a88db36dc20a7a4", + "0xa1584dfe1573df8ec88c7b74d76726b4821bfe84bf886dd3c0e3f74c2ea18aa62ca44c871fb1c63971fccf6937e6501f", + "0xaf89ab00a0eab1131645292a9cfba583a69a1e3ac58b210e262494853e67385aeb50d4af428bdd577b9399daa96d8b20", + "0x81fa222737fe818b43f55f209f42adaee135b2801d02709617fc88c2871852358260ace97cf323e761b5cc18bc7325b3", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670", + "0xac69ae9e6c385a368df71d11ac68f45f05e005306df3c2bf98ed3577708256bd97f8c09d3f72115444077a9bb711d8d1", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0x81b676591b823270a3284ace7d81cbce2d6cdce55bb0e053874d7e3a08f729453009d3e662ec3130379f43c0f3210b6d", + "0x896a51e0b0de0f29029af38b796db1f1e6d0f9f9085ade40a313a60cb723fa3d58f6587175570086c4fbf0fe5331f1c8", + "0x8fda66b8607af873f4c2c8218dd3ffc7940d411047eb199b5cd010156af4845d21dd2e65b0e44cfffb5e78271e9bb29d", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0x8de5a6200cebb09b2198e69fed84bcd512ec5cf317c5f1ee99aad03d2a9a8564bf3807c08da2664222268d59c34a06e4", + "0xa8fa3584a92b079c8c73ed1553e5e161a0b21325fc2fc4e24a892354a899c7fc0bfb436a97a7ed1fc71bccda438ea715", + "0xa4ee6d37dc259cbb5237e4265429a9fd8ab5643af81628cc101e0d8b4a333ef2618a37df89ea3f92b5ea4333d8cda393", + "0x99d83a0ba33161d8c6bbe80929fd9046d4dfdac43477ff85fea5bae925e6c179ad28eb338375ee2417acbd6576ee670a", + "0x96947de9e6068c22a7716656a2755a9551b0b66c2d1a741bf84a088fe1e840e992dc39861bf8ba3e8d5b6d21e8f57e64", + "0x86e014747c7922ccfc2b9d4bf6c1ecf0dc800197037858d0b85ab1944b4c3c14b95e0ed325bc42a6f467bc47ec27bc7b", + "0x8d46e9aa0c1986056e407efc7013b7f271027d3c98ce96667faa98074ab0588a61681faf78644c11819a459a95689dab", + "0xaaf6c1251e73fb600624937760fef218aace5b253bf068ed45398aeb29d821e4d2899343ddcbbe37cb3f6cf500dff26c", + "0xafa10af166a0dbf3a25ff86cd6f8e44cccc818c5e70cd70e4e98e226b158f3563450b3fb184d2649adbb11e53080d1ca", + "0xa75ca9447dca3a3745ada36731187ddd1f6a152cf15d7446b785eab381e5c8562c1202a6e7a24080bc6b619a161113db", + "0x8dfa86c051edd28c3554a30e40531c898e5936ad3002711616ddd1b27054bc39caedd505a200c3d23a1c3f6b26c50ae9", + "0x996323af7e545fb6363ace53f1538c7ddc3eb0d985b2479da3ee4ace10cbc393b518bf02d1a2ddb2f5bdf09b473933ea", + "0xae5302796cfeca685eaf37ffd5baeb32121f2f07415bee26cc0051ee513ff3932d2c365e3d9f87b0949a5980445cb64c", + "0xae940a07850cf904b44f31cbf0e44824bae5ec36dcfdb7fad858f2a39dba38de82ca12b0ae939a34fce7a02e4b9789f8", + "0xb72cb106b7bc1ecae219e0ae1830a509ed18a042b56a2779f4033419de69ba8ae8017090caed1f5377bfa68506157360", + "0x81ea9f74ef7d935b807474e38954ae3934856219a23e074954b2e860c5a3c400f9aedb42cd27cb4ceb697ca36d1e58cb", + "0xa2e2d8384fc87a512ee34eb43405fd82572c9d7cd96e155a382cda284e8df9eb7189c25b7473d89c63ea4e6080e10ff8", + "0x8a8bb292bcc481070d3afdbbc8789e2ab4b29c9603936e6d85f5ff71e23fc5b6d61009f0fa636b5d5b2dc309d39e3d75", + "0xab40dc1cfe273ad0da700c64f8fc94f91db253ca3acf20e336d9bd09de67eec5c7d3506285d83c7bb6a08d64b77e5f2d" + ] + }, + "next_sync_committee_branch": [ + "0xb0c9b217877047327b35747a30da202e38d4585edbc5b909de780f50bbc4517a", + "0xa70726231055efad4b84fbef3234e82aff3b6fe96eaae78f849972b170fcdb34", + "0xf569c5c92f5be4647089ed82885538f1199efe87169fe0d4b8e2217d547386e4", + "0xa963d546088ba52b92ebad43cbbde21e7b9426850b52eb26f3ec7d2a606af3e4", + "0xdef2c07df9b676044dc991f1964ea3d775bcd98733d5e94ee9e7bf12a28cb918" + ], + "signature_slot": "145", + "sync_aggregate": { + "sync_committee_bits": "0xffffffff", + "sync_committee_signature": "0x89067490d5e4b5e0c48b3b38d60ccd686e5caf1ff4556f27f3b2444f3b5da29c586f2728f45423159faabe484ad055e517089c7f9111c9012ff39b88311991627b41d416c36f5e2a3eb3941cf8e8989175e082abc868e22db554634debb1d0fb" + } + }, + "trusted_sync_committee": { + "sync_committee": { + "Next": { + "aggregate_pubkey": "0xb7ca9df197280bc33af9576ebf0fa6df3e0e93767d7536df7cd4083ed6b5be984f57a3839584cdfe90d9b4ba516bee94", + "pubkeys": [ + "0xa1d9840eda3036fbf63eeea40146e4548553e6e1b2a653ab349b376f31b367c40d71fb59ff8e94b91daa99c262ec8b52", + "0xb63f327df68581cdc02a66c1c65e906a06a1a3a8d7a6e38f7b6da944e8e6cc2db85fced5327d8c12945ceb33018272ca", + "0x996d10c3026b9344532b06c70a596f972a1e779a1f6106d3da9f6ba376bbf7ec82d2f52629e5dbf3f7d03b00f6b862af", + "0x958c2692b86b4d20eaea3bb45e9447ebbc5b93ccaf8d21ef659d0cefedf5c4371b31b460ae40e8243682bde505abac1e", + "0xaf89ab00a0eab1131645292a9cfba583a69a1e3ac58b210e262494853e67385aeb50d4af428bdd577b9399daa96d8b20", + "0xa62c0205fb22df8535c0b70076486e69dfa908feddae79e4a94a9d47b97ed190d228e1c6217e84a59882bb992dacae30", + "0xa759f6bcca8f35fcaadc406cc4b828c016c0ed23882987a79f52f2933b5cedefe24e31df6fd0d38e8a802dbafd750d01", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0xb5e898a1fc06d51c695712928f44646d15451340d1b3e480a40f03250160bc07d3b6691ec94361dd524d59d9df7f76d3", + "0xa75ca9447dca3a3745ada36731187ddd1f6a152cf15d7446b785eab381e5c8562c1202a6e7a24080bc6b619a161113db", + "0x8de5a6200cebb09b2198e69fed84bcd512ec5cf317c5f1ee99aad03d2a9a8564bf3807c08da2664222268d59c34a06e4", + "0x81fa222737fe818b43f55f209f42adaee135b2801d02709617fc88c2871852358260ace97cf323e761b5cc18bc7325b3", + "0x896a51e0b0de0f29029af38b796db1f1e6d0f9f9085ade40a313a60cb723fa3d58f6587175570086c4fbf0fe5331f1c8", + "0xb570dde8ee80512e3d031caf22e775c60f7f5a6cbdeb3e52e24cf8c867d38569a53dd19cdc36a03a1bbb3a8d94b03670", + "0x8aa5bbee21e98c7b9e7a4c8ea45aa99f89e22992fa4fc2d73869d77da4cc8a05b25b61931ff521986677dd7f7159e8e6", + "0x8d028a021c5c31a1aa1e18eda74cfaf0fba1c454c17c2e0fc730dd07a19d0c77f7a905d54017292f3e800ca06b6977cd", + "0x9763dde1b8028136a3ffd6dafd1f450e2cafb2819c7fa901f7c6e9cde8f2897ee7e9a45da6947fde1ad0d3836188eab5", + "0x87231421a08ed28e7d357e2b37a26a458155c8d822d829344bd1029e5d175b5edfaa78f16f784f724a2caef124944c4f", + "0xa03c2a82374e04b2e0594c4ce14fb3f225b46f13188f0d8002a523c7dcfb939ae4856053c2c9c695374d7c3685df1ca5", + "0x84a687ffdf21a0ad754d0164d1e2c03035613ab76359e7f5cf51ea4a425a6ee026725ec0a0dbd336f7dab759596f0bf8", + "0xb27ad13afc8ff30e087797b344c8382bb0a84447549f1b0274059ddd652276e7b148ba8808a10cc45746762957d4efbe", + "0xac69ae9e6c385a368df71d11ac68f45f05e005306df3c2bf98ed3577708256bd97f8c09d3f72115444077a9bb711d8d1", + "0xb72cb106b7bc1ecae219e0ae1830a509ed18a042b56a2779f4033419de69ba8ae8017090caed1f5377bfa68506157360", + "0xae940a07850cf904b44f31cbf0e44824bae5ec36dcfdb7fad858f2a39dba38de82ca12b0ae939a34fce7a02e4b9789f8", + "0xa0485d71f1f5e177f7d5bc9d98c5248a6a2d0de4554c2eaf02abae48f5a3e273b2ee7765784cf2a4cb7df84f617177c9", + "0xaf61f263addfb41c46d66e60ecfb598a5942f648f58718b6b4e4c92019fdb12328efbff98703134bcf28e9c1fab4bb60", + "0x8aec5129a518010912215e1887191da94be419b4e75904c2ea745e2d253d707c088fa5b2c46dade1d162affe9f7ab17b", + "0xb2225575d5e70da1257db7a0d1222c5041b52aac61cf161e8fc8126a3fdf5eb4f0867d98dfe272199c36cf8f02661b3d", + "0x8c0d15baa72bfcd317e9b9402ca9bb6e7ae1db35ffce7faccae0bd19b3c8e5de7d5524aef0377770b3a90626627a9304", + "0x8419cf00f2783c430dc861a710984d0429d3b3a7f6db849b4f5c05e0d87339704c5c7f5eede6adfc8776d666587b5932", + "0xab72cbc6575c3179680a58c0ecd5de46d2678ccbafc016746348ee5688edcb21b4e15bd37c70c508e3ea73103c2d566b", + "0xa54fe5c26059ed60b4f0b66ef7b0bf167580504525f83c169507dc812816df41b1da6128341c23977300dffd32a32f41" + ] + } + }, + "trusted_slot": 80 + } + } + ] + }, + "name": "updated_light_client" + }, + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "0x20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "0x30000038" + }, + "capella": { + "epoch": 0, + "version": "0x40000038" + }, + "deneb": { + "epoch": 0, + "version": "0x50000038" + }, + "genesis_fork_version": "0x10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734450521, + "genesis_validators_root": "0xd61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0x362cadfe5ac1c1c3f23d2c6cc6444359c3b639ae", + "latest_slot": 144, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0xb7ca9df197280bc33af9576ebf0fa6df3e0e93767d7536df7cd4083ed6b5be984f57a3839584cdfe90d9b4ba516bee94", + "next_sync_committee": "0x9432fc7c4a297d9a68254deefe6e2bfa16495558c641afe9e02f81318e64caa8da62a5effec586323e91987de96e5ba8", + "slot": 144, + "state_root": "0x9e298f15daae640615b35eb0ea8823b28b5f75e66607f5c3a338e64c24d6703a", + "storage_root": "0xe410160052c4e5826ee87e464901426ac022518f47675882c7c04d9f831d86e1", + "timestamp": 1734451385 + }, + "path": "0x30372d74656e6465726d696e742d30010000000000000001", + "proof_slot": 144, + "storage_proof": { + "key": "0x75d7411cb01daad167713b5a9b7219670f0e500653cbbcd45cfe1bfe04222459", + "proof": [ + "0xf8b18080a0d86f39f51d40aa691aa0c9c914f36cd6f802031f04571db1138c1780df0c74f3a082876f44016f43845d9e0d7ae99e20d46ee3d7b7a499ee2d5d2b5cbac81fd5298080a057b16d9a3bbb2d106b4d1b12dca3504f61899c7c660b036848511426ed342dd68080808080a0d9ec33d9f60bff6b13f9b1636c3a0ac7cbf1c866de72e36f20690feb7330490ba02a4da1fbb69a7ec1cb1979f1d313bb6188eb886242d497303065ecd7782c6a72808080", + "0xf843a03d3c3bcf030006afea2a677a6ff5bf3f7f111e87461c8848cf062a5756d1a888a1a00bf33c1a8f265aa4705bb6c15bd31095a951bfbc3126b98f881f5de31707929b" + ], + "value": "0xbf33c1a8f265aa4705bb6c15bd31095a951bfbc3126b98f881f5de31707929b" + } + }, + "name": "commitment_proof" + } + ] +} \ No newline at end of file diff --git a/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferTimeoutFromEthereumToCosmosChain_Groth16.json b/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferTimeoutFromEthereumToCosmosChain_Groth16.json new file mode 100644 index 000000000..f102deda --- /dev/null +++ b/packages/ethereum-light-client/src/test_utils/fixtures/TestICS20TransferTimeoutFromEthereumToCosmosChain_Groth16.json @@ -0,0 +1,50 @@ +{ + "steps": [ + { + "data": { + "client_state": { + "chain_id": 3151908, + "epochs_per_sync_committee_period": 8, + "fork_parameters": { + "altair": { + "epoch": 0, + "version": "20000038" + }, + "bellatrix": { + "epoch": 0, + "version": "30000038" + }, + "capella": { + "epoch": 0, + "version": "40000038" + }, + "deneb": { + "epoch": 0, + "version": "50000038" + }, + "genesis_fork_version": "10000038", + "genesis_slot": 0 + }, + "frozen_slot": 0, + "genesis_time": 1734451535, + "genesis_validators_root": "d61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11", + "ibc_commitment_slot": "0x1", + "ibc_contract_address": "0x7284df3a7e15f10099f224322a8c25cb72f558bb", + "latest_slot": 24, + "min_sync_committee_participants": 32, + "seconds_per_slot": 6, + "slots_per_epoch": 8 + }, + "consensus_state": { + "current_sync_committee": "0xb0a6dab068cb7f03ba649efaaef2f48f4c51cc024a746982a2515d71f74b9e28dc6c1b94cc30b52096cbef032a06117d", + "next_sync_committee": "0xb0a6dab068cb7f03ba649efaaef2f48f4c51cc024a746982a2515d71f74b9e28dc6c1b94cc30b52096cbef032a06117d", + "slot": 24, + "state_root": "0x6c3830d0098f9149022aaa3ad988008d9e585130069f9c1f50c66b43b001a7ef", + "storage_root": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": 1734451679000000000 + } + }, + "name": "initial_state" + } + ] +} \ No newline at end of file diff --git a/packages/ethereum-light-client/src/test_utils/mod.rs b/packages/ethereum-light-client/src/test_utils/mod.rs new file mode 100644 index 000000000..56a53f16 --- /dev/null +++ b/packages/ethereum-light-client/src/test_utils/mod.rs @@ -0,0 +1,4 @@ +//! This module defines test utilities for the Ethereum light client. + +pub mod bls_verifier; +pub mod fixtures; diff --git a/packages/ethereum-light-client/src/trie.rs b/packages/ethereum-light-client/src/trie.rs index 74aeba72..25ef1aae 100644 --- a/packages/ethereum-light-client/src/trie.rs +++ b/packages/ethereum-light-client/src/trie.rs @@ -42,20 +42,15 @@ pub fn validate_merkle_branch( #[cfg(test)] #[allow(clippy::pedantic)] mod test { - use alloy_primitives::{hex::FromHex, Address, Bloom, Bytes, B256, U256}; + use alloy_primitives::{hex::FromHex, Address, Bloom, Bytes, FixedBytes, B256, U256}; + use ethereum_types::consensus::{ + fork::{Fork, ForkParameters}, + light_client_header::{BeaconBlockHeader, ExecutionPayloadHeader, LightClientHeader}, + merkle::{get_subtree_index, EXECUTION_BRANCH_DEPTH, EXECUTION_PAYLOAD_INDEX}, + }; use crate::{ - client_state::ClientState, - config::{ - consts::{floorlog2, get_subtree_index, EXECUTION_PAYLOAD_INDEX}, - MINIMAL, - }, - trie::validate_merkle_branch, - types::{ - light_client::{BeaconBlockHeader, ExecutionPayloadHeader, LightClientHeader}, - wrappers::{WrappedBloom, WrappedBranch, WrappedBytes}, - }, - verify::get_lc_execution_root, + client_state::ClientState, trie::validate_merkle_branch, verify::get_lc_execution_root, }; #[test] @@ -84,13 +79,13 @@ mod test { receipts_root: B256::from_hex( "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", ).unwrap(), - logs_bloom: WrappedBloom(Bloom::from_hex("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap()), + logs_bloom: Bloom::from_hex("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap(), prev_randao: B256::from_hex("707a729f27185bfd88c746532e0909f7f4604dc5b25b6d9ffb5cfec6ca7987d9").unwrap(), block_number: 80, gas_limit: 30000000, gas_used: 0, timestamp: 1732901097, - extra_data: WrappedBytes(Bytes::from_hex("0xd883010e06846765746888676f312e32322e34856c696e7578").unwrap()), + extra_data: Bytes::from_hex("0xd883010e06846765746888676f312e32322e34856c696e7578").unwrap(), base_fee_per_gas: U256::from(27136), block_hash: B256::from_hex("c001e15851608006eb33999e829bb265706929091f4c9a08f6853f6fbe96a730").unwrap(), transactions_root: B256::from_hex("0x7ffe241ea60187fdb0187bfa22de35d1f9bed7ab061d9401fd47e34a54fbede1").unwrap(), @@ -98,7 +93,7 @@ mod test { blob_gas_used: 0, excess_blob_gas: 0, }, - execution_branch: WrappedBranch([ + execution_branch: [ B256::from_hex("0xd320d2b395e1065b0b2e3dbb7843c6d77cb7830ef340ffc968caa0f92e26f080") .unwrap(), B256::from_hex("0x6c6dd63656639d153a2e86a9cab291e7a26e957ad635fec872d2836e92340c23") @@ -107,23 +102,48 @@ mod test { .unwrap(), B256::from_hex("0xee70868f724f428f301007b0967c82d9c31fb5fd549d7f25342605169b90a3d6") .unwrap(), - ]), + ], + }; + + let minimal_config_fork_parameters = ForkParameters { + genesis_fork_version: FixedBytes([0, 0, 0, 1]), + genesis_slot: 0, + + altair: Fork { + version: FixedBytes([1, 0, 0, 1]), + epoch: 0, + }, + + bellatrix: Fork { + version: FixedBytes([2, 0, 0, 1]), + epoch: 0, + }, + + capella: Fork { + version: FixedBytes([3, 0, 0, 1]), + epoch: 0, + }, + + deneb: Fork { + version: FixedBytes([4, 0, 0, 1]), + epoch: 0, + }, }; // inputs let leaf = get_lc_execution_root( &ClientState { slots_per_epoch: 32, - fork_parameters: MINIMAL.fork_parameters, + fork_parameters: minimal_config_fork_parameters, ..Default::default() }, &header, ) .unwrap(); - let depth = floorlog2(EXECUTION_PAYLOAD_INDEX); + let depth = EXECUTION_BRANCH_DEPTH; let index = get_subtree_index(EXECUTION_PAYLOAD_INDEX); let root = header.beacon.body_root; - validate_merkle_branch(leaf, header.execution_branch.0.into(), depth, index, root).unwrap(); + validate_merkle_branch(leaf, header.execution_branch.into(), depth, index, root).unwrap(); } } diff --git a/packages/ethereum-light-client/src/types/fork.rs b/packages/ethereum-light-client/src/types/fork.rs deleted file mode 100644 index 7dc3569e..000000000 --- a/packages/ethereum-light-client/src/types/fork.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! This module defines [`Fork`]. - -use serde::{Deserialize, Serialize}; - -use super::wrappers::WrappedVersion; - -/// The fork data -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct Fork { - /// The version of the fork - pub version: WrappedVersion, - /// The epoch at which this fork is activated - #[serde(default)] // TODO: Remove this when doing e2e integration #143 - pub epoch: u64, -} diff --git a/packages/ethereum-light-client/src/types/fork_data.rs b/packages/ethereum-light-client/src/types/fork_data.rs deleted file mode 100644 index bf26cade..000000000 --- a/packages/ethereum-light-client/src/types/fork_data.rs +++ /dev/null @@ -1,34 +0,0 @@ -//! This module defines [`compute_fork_data_root`]. - -use alloy_primitives::B256; -use serde::{Deserialize, Serialize}; -use tree_hash::TreeHash; -use tree_hash_derive::TreeHash; - -use crate::types::wrappers::WrappedVersion; - -/// The fork data -#[derive(Serialize, Deserialize, PartialEq, Clone, Debug, Default, TreeHash)] -struct ForkData { - /// The current version - pub current_version: WrappedVersion, - /// The genesis validators root - pub genesis_validators_root: B256, -} - -/// Return the 32-byte fork data root for the `current_version` and `genesis_validators_root`. -/// This is used primarily in signature domains to avoid collisions across forks/chains. -/// -/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_fork_data_root) -#[must_use] -pub fn compute_fork_data_root( - current_version: WrappedVersion, - genesis_validators_root: B256, -) -> B256 { - let fork_data = ForkData { - current_version, - genesis_validators_root, - }; - - fork_data.tree_hash_root() -} diff --git a/packages/ethereum-light-client/src/types/fork_parameters.rs b/packages/ethereum-light-client/src/types/fork_parameters.rs deleted file mode 100644 index 45841d9f..000000000 --- a/packages/ethereum-light-client/src/types/fork_parameters.rs +++ /dev/null @@ -1,40 +0,0 @@ -//! This module defines [`ForkParameters`]. - -use serde::{Deserialize, Serialize}; - -use super::{fork::Fork, wrappers::WrappedVersion}; - -/// The fork parameters -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct ForkParameters { - /// The genesis fork version - pub genesis_fork_version: WrappedVersion, - /// The genesis slot - #[serde(default)] // TODO: REMOVE AND FIX IN E2E - pub genesis_slot: u64, - /// The altair fork - pub altair: Fork, - /// The bellatrix fork - pub bellatrix: Fork, - /// The capella fork - pub capella: Fork, - /// The deneb fork - pub deneb: Fork, -} - -impl ForkParameters { - /// Returns the fork version based on the `epoch`. - /// NOTE: This implementation is based on capella. - /// - /// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/fork.md#modified-compute_fork_version) - #[must_use] - pub fn compute_fork_version(&self, epoch: u64) -> WrappedVersion { - match epoch { - _ if epoch >= self.deneb.epoch => self.deneb.version.clone(), - _ if epoch >= self.capella.epoch => self.capella.version.clone(), - _ if epoch >= self.bellatrix.epoch => self.bellatrix.version.clone(), - _ if epoch >= self.altair.epoch => self.altair.version.clone(), - _ => self.genesis_fork_version.clone(), - } - } -} diff --git a/packages/ethereum-light-client/src/types/height.rs b/packages/ethereum-light-client/src/types/height.rs deleted file mode 100644 index 75d40f0c..000000000 --- a/packages/ethereum-light-client/src/types/height.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! This module defines [`Height`]. - -use serde::{Deserialize, Serialize}; - -/// Height -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct Height { - /// The revision number - /// This is always 0 in the current implementation - #[serde(default)] - pub revision_number: u64, - /// The block height - pub revision_height: u64, -} diff --git a/packages/ethereum-light-client/src/types/mod.rs b/packages/ethereum-light-client/src/types/mod.rs deleted file mode 100644 index 3b848571..000000000 --- a/packages/ethereum-light-client/src/types/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! This module contains the types that are used in the Ethereum light client - -pub mod bls; -pub mod domain; -pub mod fork; -pub mod fork_data; -pub mod fork_parameters; -pub mod height; -pub mod light_client; -pub mod signing_data; -pub mod storage_proof; -pub mod sync_committee; -pub mod wrappers; diff --git a/packages/ethereum-light-client/src/types/sync_committee.rs b/packages/ethereum-light-client/src/types/sync_committee.rs deleted file mode 100644 index 3dcb5aa6..000000000 --- a/packages/ethereum-light-client/src/types/sync_committee.rs +++ /dev/null @@ -1,208 +0,0 @@ -//! Types related to the sync committee - -use alloy_primitives::Bytes; -use ethereum_utils::slot::compute_epoch_at_slot; -use serde::{Deserialize, Serialize}; -use serde_with::{base64::Base64, serde_as}; -use tree_hash_derive::TreeHash; - -use super::{ - bls::{BlsPublicKey, BlsSignature}, - height::Height, - wrappers::WrappedVecBlsPublicKey, -}; - -/// The sync committee data -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default, TreeHash)] -pub struct SyncCommittee { - /// The public keys of the sync committee - pub pubkeys: WrappedVecBlsPublicKey, - /// The aggregate public key of the sync committee - #[serde(with = "ethereum_utils::base64::fixed_size")] - pub aggregate_pubkey: BlsPublicKey, -} - -/// The active sync committee -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -#[allow(clippy::module_name_repetitions)] -pub enum ActiveSyncCommittee { - /// The current sync committee - Current(SyncCommittee), - /// The next sync committee - Next(SyncCommittee), -} - -// TODO: should this actually return default at any point? If not, panic or error -impl Default for ActiveSyncCommittee { - fn default() -> Self { - Self::Current(SyncCommittee { - pubkeys: WrappedVecBlsPublicKey::default(), - aggregate_pubkey: BlsPublicKey::default(), - }) - } -} - -/// The trusted sync committee -// TODO: Could we use a enum to represent the current and next sync committee like -// `ActiveSyncCommittee`? -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -#[allow(clippy::module_name_repetitions)] -pub struct TrustedSyncCommittee { - /// The trusted height - pub trusted_height: Height, - /// The current sync committee - pub current_sync_committee: Option, - /// The next sync committee - pub next_sync_committee: Option, -} - -impl TrustedSyncCommittee { - /// Returns the active sync committee - // TODO: should this actually return default at any point? If not, panic or error - // also, if not returning default, remove the impl Default - #[must_use] - pub fn get_active_sync_committee(&self) -> ActiveSyncCommittee { - match (&self.current_sync_committee, &self.next_sync_committee) { - (Some(sync_committee), _) => ActiveSyncCommittee::Current(sync_committee.clone()), - (_, Some(sync_committee)) => ActiveSyncCommittee::Next(sync_committee.clone()), - _ => ActiveSyncCommittee::default(), - } - } -} - -/// The sync committee aggregate -#[serde_as] -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct SyncAggregate { - /// The bits representing the sync committee's participation. - #[serde_as(as = "Base64")] - pub sync_committee_bits: Bytes, // TODO: Consider changing this to a BitVector - /// The aggregated signature of the sync committee. - #[serde(with = "ethereum_utils::base64::fixed_size")] - pub sync_committee_signature: BlsSignature, -} - -impl SyncAggregate { - // TODO: Unit test - /// Returns the number of bits that are set to `true`. - #[must_use] - pub fn num_sync_committe_participants(&self) -> usize { - self.sync_committee_bits - .iter() - .map(|byte| byte.count_ones()) - .sum::() as usize - } - - /// Returns the size of the sync committee. - pub fn sync_committee_size(&self) -> usize { - self.sync_committee_bits.len() * 8 - } - - /// Returns if at least 2/3 of the sync committee signed - /// - /// - // TODO: Unit test - pub fn validate_signature_supermajority(&self) -> bool { - self.num_sync_committe_participants() * 3 >= self.sync_committee_size() * 2 - } -} - -/// Returns the sync committee period at a given `epoch`. -/// -/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/validator.md#sync-committee) -#[must_use] -pub const fn compute_sync_committee_period( - epochs_per_sync_committee_period: u64, - epoch: u64, -) -> u64 { - epoch / epochs_per_sync_committee_period -} - -/// Returns the sync committee period at a given `slot`. -/// -/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md#compute_sync_committee_period_at_slot) -#[must_use] -pub fn compute_sync_committee_period_at_slot( - slots_per_epoch: u64, - epochs_per_sync_committee_period: u64, - slot: u64, -) -> u64 { - compute_sync_committee_period( - epochs_per_sync_committee_period, - compute_epoch_at_slot(slots_per_epoch, slot), - ) -} - -#[cfg(test)] -#[allow(clippy::pedantic)] -mod test { - use crate::test::fixture_types::UpdateClient; - use crate::types::sync_committee::{SyncAggregate, SyncCommittee}; - - use alloy_primitives::{hex::FromHex, B256}; - use alloy_rpc_types_beacon::BlsSignature; - use ethereum_test_utils::fixtures; - use tree_hash::TreeHash; - - #[test] - fn test_sync_committee_tree_hash_root() { - let sync_committee: SyncCommittee = fixtures::load("sync_committee_fixture"); - assert_ne!(sync_committee, SyncCommittee::default()); - - let actual_tree_hash_root = sync_committee.tree_hash_root(); - let expected_tree_hash_root = - B256::from_hex("0x5361eb179f7499edbf09e514d317002f1d365d72e14a56c931e9edaccca3ff29") - .unwrap(); - - assert_eq!(expected_tree_hash_root, actual_tree_hash_root); - } - - #[test] - fn test_validate_signature_supermajority() { - // not supermajority - let sync_aggregate = SyncAggregate { - sync_committee_bits: vec![0b10001001].into(), - sync_committee_signature: BlsSignature::default(), - }; - assert_eq!(sync_aggregate.num_sync_committe_participants(), 3); - assert_eq!(sync_aggregate.sync_committee_size(), 8); - assert!(!sync_aggregate.validate_signature_supermajority()); - - // not supermajority - let sync_aggregate = SyncAggregate { - sync_committee_bits: vec![0b10000001, 0b11111111, 0b00010000, 0b00000000].into(), - sync_committee_signature: BlsSignature::default(), - }; - assert_eq!(sync_aggregate.num_sync_committe_participants(), 11); - assert_eq!(sync_aggregate.sync_committee_size(), 32); - assert!(!sync_aggregate.validate_signature_supermajority()); - - // not supermajority - let sync_aggregate = SyncAggregate { - sync_committee_bits: vec![0b11101001, 0b11111111, 0b01010000, 0b01111110].into(), - sync_committee_signature: BlsSignature::default(), - }; - assert_eq!(sync_aggregate.num_sync_committe_participants(), 21); - assert_eq!(sync_aggregate.sync_committee_size(), 32); - assert!(!sync_aggregate.validate_signature_supermajority()); - - // supermajority - let sync_aggregate = SyncAggregate { - sync_committee_bits: vec![0b11101001, 0b11111111, 0b01011000, 0b01111110].into(), - sync_committee_signature: BlsSignature::default(), - }; - assert_eq!(sync_aggregate.num_sync_committe_participants(), 22); - assert_eq!(sync_aggregate.sync_committee_size(), 32); - assert!(sync_aggregate.validate_signature_supermajority()); - - // valid sync aggregate from fixtures with supermajority - let fixture: fixtures::StepFixture = - fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); - let client_update: UpdateClient = fixture.get_data_at_step(1); - let sync_aggregate = client_update.updates[0] - .consensus_update - .sync_aggregate - .clone(); - assert!(sync_aggregate.validate_signature_supermajority()); - } -} diff --git a/packages/ethereum-light-client/src/types/wrappers.rs b/packages/ethereum-light-client/src/types/wrappers.rs deleted file mode 100644 index c15f4e6a..000000000 --- a/packages/ethereum-light-client/src/types/wrappers.rs +++ /dev/null @@ -1,172 +0,0 @@ -//! Wrappers around types that implement `TreeHash` to provide custom serialization and encoding. - -use alloy_primitives::{aliases::B32, Bloom, Bytes, FixedBytes, B256}; -use serde::{Deserialize, Serialize}; -use serde_with::{base64::Base64, serde_as}; -use tree_hash::{MerkleHasher, TreeHash, BYTES_PER_CHUNK}; - -use super::bls::BlsPublicKey; - -/// A wrapper around a `B32` that represents a version, implements [`TreeHash`], and uses a -/// fixed-size base64 encoding. -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct WrappedVersion(#[serde(with = "ethereum_utils::base64::fixed_size")] pub B32); - -impl TreeHash for WrappedVersion { - fn tree_hash_type() -> tree_hash::TreeHashType { - FixedBytes::tree_hash_type() - } - - fn tree_hash_packed_encoding(&self) -> tree_hash::PackedEncoding { - self.0.tree_hash_packed_encoding() - } - - fn tree_hash_packing_factor() -> usize { - FixedBytes::tree_hash_packing_factor() - } - - fn tree_hash_root(&self) -> tree_hash::Hash256 { - self.0.tree_hash_root() - } -} - -/// A wrapper around [`Bytes`] that implements [`TreeHash`] and uses a base64 encoding. -#[serde_as] -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct WrappedBytes(#[serde_as(as = "Base64")] pub Bytes); - -impl TreeHash for WrappedBytes { - fn tree_hash_type() -> tree_hash::TreeHashType { - tree_hash::TreeHashType::List - } - - fn tree_hash_packed_encoding(&self) -> tree_hash::PackedEncoding { - unreachable!("List should never be packed.") - } - - fn tree_hash_packing_factor() -> usize { - unreachable!("List should never be packed.") - } - - fn tree_hash_root(&self) -> tree_hash::Hash256 { - let leaves = self.0.len().div_ceil(BYTES_PER_CHUNK); - - let mut hasher = MerkleHasher::with_leaves(leaves); - for item in &self.0 { - hasher.write(item.tree_hash_root()[..1].as_ref()).unwrap(); - } - - tree_hash::mix_in_length(&hasher.finish().unwrap(), self.0.len()) - } -} - -impl AsRef<[u8]> for WrappedBytes { - fn as_ref(&self) -> &[u8] { - self.0.as_ref() - } -} - -/// A wrapper around [`Bloom`] that implements [`TreeHash`] and uses a fixed-size base64 encoding. -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct WrappedBloom(#[serde(with = "ethereum_utils::base64::fixed_size")] pub Bloom); - -impl TreeHash for WrappedBloom { - fn tree_hash_type() -> tree_hash::TreeHashType { - tree_hash::TreeHashType::List - } - - fn tree_hash_packed_encoding(&self) -> tree_hash::PackedEncoding { - unreachable!("List should never be packed.") - } - - fn tree_hash_packing_factor() -> usize { - unreachable!("List should never be packed.") - } - - fn tree_hash_root(&self) -> tree_hash::Hash256 { - let leaves = self.0.len().div_ceil(BYTES_PER_CHUNK); - - let mut hasher = MerkleHasher::with_leaves(leaves); - for item in &self.0 { - hasher.write(item.tree_hash_root()[..1].as_ref()).unwrap(); - } - - hasher.finish().unwrap() - } -} - -/// A fixed size wrapper around a list of [`B256`] that implements [`TreeHash`] and uses a -/// fixed-size base64 encoding to represent a branch of a tree. -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct WrappedBranch( - #[serde(with = "ethereum_utils::base64::fixed_size::vec::fixed_size")] pub [B256; N], -); - -impl TreeHash for WrappedBranch { - fn tree_hash_type() -> tree_hash::TreeHashType { - tree_hash::TreeHashType::List - } - - fn tree_hash_packed_encoding(&self) -> tree_hash::PackedEncoding { - unreachable!("List should never be packed.") - } - - fn tree_hash_packing_factor() -> usize { - unreachable!("List should never be packed.") - } - - fn tree_hash_root(&self) -> tree_hash::Hash256 { - let leaves = self.0.len().div_ceil(BYTES_PER_CHUNK); - - let mut hasher = MerkleHasher::with_leaves(leaves); - for item in &self.0 { - hasher.write(item.tree_hash_root()[..1].as_ref()).unwrap(); - } - - hasher.finish().unwrap() - } -} - -impl Default for WrappedBranch { - fn default() -> Self { - Self([B256::default(); N]) - } -} - -impl From> for Vec { - fn from(val: WrappedBranch) -> Self { - val.0.to_vec() - } -} - -/// A wrapper around a list of [`BlsPublicKey`] that implements [`TreeHash`] and uses a fixed-size -/// base64 encoding. -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct WrappedVecBlsPublicKey( - #[serde(with = "ethereum_utils::base64::fixed_size::vec")] pub Vec, -); - -impl TreeHash for WrappedVecBlsPublicKey { - fn tree_hash_type() -> tree_hash::TreeHashType { - tree_hash::TreeHashType::Vector - } - - fn tree_hash_packed_encoding(&self) -> tree_hash::PackedEncoding { - unreachable!("Vector should never be packed.") - } - - fn tree_hash_packing_factor() -> usize { - unreachable!("Vector should never be packed.") - } - - fn tree_hash_root(&self) -> tree_hash::Hash256 { - let leaves = self.0.len(); - - let mut hasher = MerkleHasher::with_leaves(leaves); - for item in &self.0 { - hasher.write(item.tree_hash_root().as_ref()).unwrap(); - } - - hasher.finish().unwrap() - } -} diff --git a/packages/ethereum-light-client/src/update.rs b/packages/ethereum-light-client/src/update.rs new file mode 100644 index 000000000..dd55d811 --- /dev/null +++ b/packages/ethereum-light-client/src/update.rs @@ -0,0 +1,88 @@ +//! This module provides [`update_consensus_state`] function to update the consensus state + +use ethereum_types::consensus::{ + slot::compute_timestamp_at_slot, sync_committee::compute_sync_committee_period_at_slot, +}; +use ethereum_utils::ensure; + +use crate::{ + client_state::ClientState, consensus_state::ConsensusState, error::EthereumIBCError, + header::Header, +}; + +/// Takes in the current client and consensus state and a new header and returns the updated +/// consensus state and optionally the updated client state (if it needs to be updated) +/// # Errors +/// Returns an error if the store period is not equal to the finalized period +#[allow(clippy::module_name_repetitions, clippy::needless_pass_by_value)] +pub fn update_consensus_state( + current_consensus_state: ConsensusState, + current_client_state: ClientState, + header: Header, +) -> Result<(u64, ConsensusState, Option), EthereumIBCError> { + let trusted_sync_committee = header.trusted_sync_committee; + let trusted_slot = trusted_sync_committee.trusted_slot; + + let consensus_update = header.consensus_update; + + let store_period = compute_sync_committee_period_at_slot( + current_client_state.slots_per_epoch, + current_client_state.epochs_per_sync_committee_period, + current_consensus_state.slot, + ); + + let update_finalized_period = compute_sync_committee_period_at_slot( + current_client_state.slots_per_epoch, + current_client_state.epochs_per_sync_committee_period, + consensus_update.attested_header.beacon.slot, + ); + + let mut new_consensus_state = current_consensus_state.clone(); + let mut new_client_state: Option = None; + + if let Some(next_sync_committee) = current_consensus_state.next_sync_committee { + // sync committee only changes when the period change + if update_finalized_period == store_period + 1 { + new_consensus_state.current_sync_committee = next_sync_committee; + new_consensus_state.next_sync_committee = consensus_update + .next_sync_committee + .map(|c| c.aggregate_pubkey); + } + } else { + // if the finalized period is greater, we have to have a next sync committee + ensure!( + update_finalized_period == store_period, + EthereumIBCError::StorePeriodMustBeEqualToFinalizedPeriod + ); + new_consensus_state.next_sync_committee = consensus_update + .next_sync_committee + .map(|c| c.aggregate_pubkey); + } + + // Some updates can be only for updating the sync committee, therefore the slot number can be + // smaller. We don't want to save a new state if this is the case. + // TODO: we might to remove this functionality if we don't use it as it complicates the light client + let updated_slot = core::cmp::max(trusted_slot, consensus_update.attested_header.beacon.slot); + + if consensus_update.attested_header.beacon.slot > current_consensus_state.slot { + new_consensus_state.slot = consensus_update.attested_header.beacon.slot; + + new_consensus_state.state_root = consensus_update.attested_header.execution.state_root; + new_consensus_state.storage_root = header.account_update.account_proof.storage_root; + + new_consensus_state.timestamp = compute_timestamp_at_slot( + current_client_state.seconds_per_slot, + current_client_state.genesis_time, + consensus_update.attested_header.beacon.slot, + ); + + if current_client_state.latest_slot < consensus_update.attested_header.beacon.slot { + new_client_state = Some(ClientState { + latest_slot: consensus_update.attested_header.beacon.slot, + ..current_client_state + }); + } + } + + Ok((updated_slot, new_consensus_state, new_client_state)) +} diff --git a/packages/ethereum-light-client/src/verify.rs b/packages/ethereum-light-client/src/verify.rs index f9ea5028..c7df937d 100644 --- a/packages/ethereum-light-client/src/verify.rs +++ b/packages/ethereum-light-client/src/verify.rs @@ -3,30 +3,46 @@ use alloy_primitives::B256; use ethereum_trie_db::trie_db::verify_account_storage_root; -use ethereum_utils::{ - ensure, +use ethereum_types::consensus::{ + bls::{BlsPublicKey, BlsSignature}, + domain::{compute_domain, DomainType}, + light_client_header::{LightClientHeader, LightClientUpdate}, + merkle::{ + get_subtree_index, EXECUTION_BRANCH_DEPTH, EXECUTION_PAYLOAD_INDEX, FINALITY_BRANCH_DEPTH, + FINALIZED_ROOT_INDEX, NEXT_SYNC_COMMITTEE_BRANCH_DEPTH, NEXT_SYNC_COMMITTEE_INDEX, + }, + signing_data::compute_signing_root, slot::{compute_epoch_at_slot, compute_slot_at_timestamp, GENESIS_SLOT}, + sync_committee::compute_sync_committee_period_at_slot, }; +use ethereum_utils::ensure; use tree_hash::TreeHash; use crate::{ client_state::ClientState, - config::consts::{ - get_subtree_index, EXECUTION_BRANCH_DEPTH, EXECUTION_PAYLOAD_INDEX, FINALITY_BRANCH_DEPTH, - FINALIZED_ROOT_INDEX, NEXT_SYNC_COMMITTEE_BRANCH_DEPTH, NEXT_SYNC_COMMITTEE_INDEX, - }, consensus_state::{ConsensusState, TrustedConsensusState}, error::EthereumIBCError, + header::Header, trie::validate_merkle_branch, - types::{ - bls::BlsVerify, - domain::{compute_domain, DomainType}, - light_client::{Header, LightClientHeader, LightClientUpdate}, - signing_data::compute_signing_root, - sync_committee::compute_sync_committee_period_at_slot, - }, }; +/// The BLS verifier trait. +#[allow(clippy::module_name_repetitions)] +pub trait BlsVerify { + /// The error type for the BLS verifier. + type Error: std::fmt::Display; + + /// Verify a BLS signature. + /// # Errors + /// Returns an error if the signature cannot be verified. + fn fast_aggregate_verify( + &self, + public_keys: &[BlsPublicKey], + msg: B256, + signature: BlsSignature, + ) -> Result<(), Self::Error>; +} + /// Verifies the header of the light client. /// # Errors /// Returns an error if the header cannot be verified. @@ -40,7 +56,7 @@ pub fn verify_header( ) -> Result<(), EthereumIBCError> { let trusted_consensus_state = TrustedConsensusState { state: consensus_state.clone(), - sync_committee: header.trusted_sync_committee.get_active_sync_committee(), + sync_committee: header.trusted_sync_committee.sync_committee.clone(), }; // Ethereum consensus-spec says that we should use the slot at the current timestamp. @@ -49,7 +65,12 @@ pub fn verify_header( client_state.seconds_per_slot, current_timestamp, ) - .map_err(EthereumIBCError::EthereumUtilsError)?; + .ok_or(EthereumIBCError::FailedToComputeSlotAtTimestamp { + timestamp: current_timestamp, + genesis: client_state.genesis_time, + seconds_per_slot: client_state.seconds_per_slot, + genesis_slot: GENESIS_SLOT, + })?; validate_light_client_update::( client_state, @@ -81,13 +102,14 @@ pub fn verify_header( /// Verifies if the light client `update` is valid. /// -/// * `update`: The light client update we want to verify. +/// * `client_state`: The current client state. +/// * `trusted_consensus_state`: The trusted consensus state (previously verified and stored) +/// * `update`: The update to be verified. /// * `current_slot`: The slot number computed based on the current timestamp. -/// * `genesis_validators_root`: The latest `genesis_validators_root` that is saved by the light client. /// * `bls_verifier`: BLS verification implementation. /// /// ## Important Notes -/// * This verification does not assume that the updated header is greater (in terms of height) than the +/// * This verification does not assume that the updated header is greater (in terms of slot) than the /// light client state. When the updated header is in the next signature period, the light client uses /// the next sync committee to verify the signature, then it saves the next sync committee as the current /// sync committee. However, it's not mandatory for light clients to expect the next sync committee to be given @@ -101,7 +123,6 @@ pub fn verify_header( /// Returns an error if the update cannot be verified. /// # Panics /// If the minimum sync committee participants is not a valid usize. -// TODO: Update comments #[allow(clippy::too_many_lines, clippy::needless_pass_by_value)] pub fn validate_light_client_update( client_state: &ClientState, @@ -223,7 +244,7 @@ pub fn validate_light_client_update( // This confirms that the `finalized_header` is really finalized. validate_merkle_branch( finalized_root, - update.finality_branch.clone().into(), + update.finality_branch.into(), FINALITY_BRANCH_DEPTH, get_subtree_index(FINALIZED_ROOT_INDEX), update.attested_header.beacon.state_root, @@ -248,11 +269,7 @@ pub fn validate_light_client_update( // This validates the given next sync committee against the attested header's state root. validate_merkle_branch( next_sync_committee.tree_hash_root(), - update - .next_sync_committee_branch - .clone() - .unwrap_or_default() - .into(), + update.next_sync_committee_branch.unwrap_or_default().into(), NEXT_SYNC_COMMITTEE_BRANCH_DEPTH, get_subtree_index(NEXT_SYNC_COMMITTEE_INDEX), update.attested_header.beacon.state_root, @@ -278,8 +295,8 @@ pub fn validate_light_client_update( .sync_committee_bits .iter() .flat_map(|byte| (0..8).rev().map(move |i| (byte & (1 << i)) != 0)) - .zip(sync_committee.pubkeys.0.iter()) - .filter_map(|(included, pubkey)| included.then_some(pubkey)) + .zip(sync_committee.pubkeys.iter()) + .filter_map(|(included, pubkey)| included.then_some(*pubkey)) .collect::>(); let fork_version_slot = std::cmp::max(update.signature_slot, 1) - 1; @@ -294,13 +311,13 @@ pub fn validate_light_client_update( DomainType::SYNC_COMMITTEE, Some(fork_version), Some(client_state.genesis_validators_root), - client_state.fork_parameters.genesis_fork_version.clone(), + client_state.fork_parameters.genesis_fork_version, ); let signing_root = compute_signing_root(&update.attested_header.beacon, domain); bls_verifier .fast_aggregate_verify( - participant_pubkeys, + &participant_pubkeys, signing_root, update.sync_aggregate.sync_committee_signature, ) @@ -334,7 +351,7 @@ pub fn is_valid_light_client_header( validate_merkle_branch( get_lc_execution_root(client_state, header)?, - header.execution_branch.0.into(), + header.execution_branch.into(), EXECUTION_BRANCH_DEPTH, get_subtree_index(EXECUTION_PAYLOAD_INDEX), header.beacon.body_root, @@ -360,18 +377,13 @@ pub fn get_lc_execution_root( #[cfg(test)] mod test { - use crate::{ - test::fixture_types::{InitialState, UpdateClient}, - types::bls::{BlsPublicKey, BlsSignature}, + use crate::test_utils::{ + bls_verifier::{fast_aggregate_verify, BlsError}, + fixtures::{self, InitialState, UpdateClient}, }; use super::*; - use ethereum_test_utils::{ - bls_verifier::{fast_aggregate_verify, BlsError}, - fixtures, - }; - struct TestBlsVerifier; impl BlsVerify for TestBlsVerifier { @@ -379,7 +391,7 @@ mod test { fn fast_aggregate_verify( &self, - public_keys: Vec<&BlsPublicKey>, + public_keys: &[BlsPublicKey], msg: B256, signature: BlsSignature, ) -> Result<(), BlsError> { @@ -391,7 +403,7 @@ mod test { fn test_verify_header() { let bls_verifier = TestBlsVerifier; - let fixture: fixtures::StepFixture = + let fixture: fixtures::StepsFixture = fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); let initial_state: InitialState = fixture.get_data_at_step(0); diff --git a/packages/ethereum-test-utils/Cargo.toml b/packages/ethereum-test-utils/Cargo.toml deleted file mode 100644 index c87c9ed6..000000000 --- a/packages/ethereum-test-utils/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "ethereum-test-utils" -version = { workspace = true } -edition = { workspace = true } -repository = { workspace = true } - -[dependencies] -ethereum-light-client = { workspace = true } -ethereum-utils = { workspace = true } - -alloy-primitives = { workspace = true } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true } -milagro_bls = { workspace = true } -thiserror = { workspace = true } diff --git a/packages/ethereum-test-utils/src/fixtures.rs b/packages/ethereum-test-utils/src/fixtures.rs deleted file mode 100644 index 77180e4a..000000000 --- a/packages/ethereum-test-utils/src/fixtures.rs +++ /dev/null @@ -1,38 +0,0 @@ -use std::path::PathBuf; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)] -pub struct StepFixture { - pub steps: Vec, -} - -#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)] -pub struct Step { - pub name: String, - pub data: Value, -} - -impl StepFixture { - pub fn get_data_at_step(&self, step: usize) -> T - where - T: serde::de::DeserializeOwned, - { - serde_json::from_value(self.steps[step].data.clone()).unwrap() - } -} - -pub fn load(name: &str) -> T -where - T: serde::de::DeserializeOwned, -{ - // Construct the path relative to the Cargo manifest directory - let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - path.push("src/fixtures"); - path.push(format!("{}.json", name)); - - // Open the file and deserialize its contents - let file = std::fs::File::open(path).unwrap(); - serde_json::from_reader(file).unwrap() -} diff --git a/packages/ethereum-test-utils/src/fixtures/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16.json b/packages/ethereum-test-utils/src/fixtures/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16.json deleted file mode 100644 index 63caddf9..000000000 --- a/packages/ethereum-test-utils/src/fixtures/TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16.json +++ /dev/null @@ -1,612 +0,0 @@ -{ - "steps": [ - { - "name": "intial_state", - "data": { - "client_state": { - "chain_id": "3151908", - "genesis_validators_root": "1h6khP66z65SmNUqK1gfPjBaUfMRKpJBuWjczwGfexE=", - "genesis_time": 1733855756, - "fork_parameters": { - "genesis_fork_version": "EAAAOA==", - "altair": { - "version": "IAAAOA==" - }, - "bellatrix": { - "version": "MAAAOA==" - }, - "capella": { - "version": "QAAAOA==" - }, - "deneb": { - "version": "UAAAOA==" - } - }, - "seconds_per_slot": 6, - "slots_per_epoch": 8, - "epochs_per_sync_committee_period": 8, - "latest_slot": 32, - "frozen_height": { - "revision_number": 0, - "revision_height": 0 - }, - "ibc_commitment_slot": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=", - "ibc_contract_address": "bw0opyzI85ngM8T7HEvuR7nsyaQ=", - "min_sync_committee_participants": 32 - - }, - "consensus_state": { - "slot": 32, - "state_root": "QLfsmERVtybnotdLY/E0RpipsKGzFghmdRhlkglq34Q=", - "storage_root": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", - "timestamp": 1733855948000000000, - "current_sync_committee": "gpEz/QdWaEoK7HttvrDVrsFuWqP7jHroafNH8NoS2NdwzHN+kHwqYxHUI0oEfN+v", - "next_sync_committee": "gpEz/QdWaEoK7HttvrDVrsFuWqP7jHroafNH8NoS2NdwzHN+kHwqYxHUI0oEfN+v" - } - } - }, - { - "name": "updated_light_client", - "data": { - "client_state": { - "chain_id": "3151908", - "genesis_validators_root": "1h6khP66z65SmNUqK1gfPjBaUfMRKpJBuWjczwGfexE=", - "genesis_time": 1733855756, - "fork_parameters": { - "genesis_fork_version": "EAAAOA==", - "altair": { - "version": "IAAAOA==" - }, - "bellatrix": { - "version": "MAAAOA==" - }, - "capella": { - "version": "QAAAOA==" - }, - "deneb": { - "version": "UAAAOA==" - } - }, - "seconds_per_slot": 6, - "slots_per_epoch": 8, - "epochs_per_sync_committee_period": 8, - "latest_slot": 32, - "frozen_height": { - "revision_number": 0, - "revision_height": 0 - }, - "ibc_commitment_slot": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=", - "ibc_contract_address": "bw0opyzI85ngM8T7HEvuR7nsyaQ=", - "min_sync_committee_participants": 32 - }, - "consensus_state": { - "slot": 32, - "state_root": "QLfsmERVtybnotdLY/E0RpipsKGzFghmdRhlkglq34Q=", - "storage_root": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", - "timestamp": 1733855948000000000, - "current_sync_committee": "gpEz/QdWaEoK7HttvrDVrsFuWqP7jHroafNH8NoS2NdwzHN+kHwqYxHUI0oEfN+v", - "next_sync_committee": "gpEz/QdWaEoK7HttvrDVrsFuWqP7jHroafNH8NoS2NdwzHN+kHwqYxHUI0oEfN+v" - }, - "updates": [ - { - "trusted_sync_committee": { - "trusted_height": { - "revision_number": 0, - "revision_height": 32 - }, - "next_sync_committee": { - "pubkeys": [ - "snrROvyP8w4Id5ezRMg4K7CoREdUnxsCdAWd3WUiduexSLqICKEMxFdGdilX1O++", - "q0DcHP4nOtDacAxk+PyU+R2yU8o6zyDjNtm9Cd5n7sXH01Bihdg8e7agjWS3fl8t", - "mWMjr35UX7Y2Os5T8VOMfdw+sNmFskedo+5KzhDLw5O1GL8C0aLdsvW98JtHOTPq", - "jYmF5d00HJA1s3v3ORxZRMKBMbR8fVNZ0Y/KWYAQuppj4nxV5rQhqAcDjDIFZNsX", - "q3LLxldcMXloCljA7NXeRtJnjMuvwBZ0Y0juVojtyyG04VvTfHDFCOPqcxA8LVZr", - "gfoiJzf+gYtD9V8gn0KtruE1soAdAnCWF/yIwocYUjWCYKzpfPMj52G1zBi8cyWz", - "ouLYOE/IelEu4060NAX9glcsnXzZbhVaOCzaKE6N+etxicJbdHPYnGPqTmCA4Q/4", - "rZIi3scf+O5rwEJv/nteZvlnOCJdsoHdIAJ6FVbQif3r0ECr+8IEHWwaDY/c/OGD", - "q2T5AMdw4rmd5rhrQ5C70Veb1I3M7FWACtvPUuAG8iEo6ZcbvzqSzAEFsJdISZNa", - "hBnPAPJ4PEMNyGGnEJhNBCnTs6f224SbT1wF4NhzOXBMXH9e7eat/Id21mZYe1ky", - "r4mrAKDqsRMWRSkqnPulg6aaHjrFiyEOJiSUhT5nOFrrUNSvQovdV3uTmdqpbYsg", - "jeWmIAzrsJshmOaf7YS81RLsXPMXxfHumarQPSqahWS/OAfAjaJmQiImjVnDSgbk", - "piwCBfsi34U1wLcAdkhuad+pCP7drnnkqUqdR7l+0ZDSKOHGIX6EpZiCu5ktrK4w", - "jQKKAhxcMaGqHhjtp0z68PuhxFTBfC4PxzDdB6GdDHf3qQXVQBcpLz6ADKBraXfN", - "iuxRKaUYAQkSIV4YhxkdqUvkGbTnWQTC6nReLSU9cHwIj6WyxG2t4dFir/6ferF7", - "tXDd6O6AUS49AxyvIud1xg9/Wmy96z5S4kz4yGfThWmlPdGc3DagOhu7Oo2UsDZw", - "hyMUIaCO0o59NX4rN6JqRYFVyNgi2Ck0S9ECnl0XW17fqnjxb3hPckosrvEklExP", - "oEhdcfH14Xf31bydmMUkimotDeRVTC6vAquuSPWj4nOy7ndleEzypMt9+E9hcXfJ", - "mRhDO48LxeEm2j/e+Ne3FFZJLa5tLQfy4Qx6f4UgRvhO0M5tO/7EIgBnDbJ9zzA3", - "rpQKB4UM+QS0TzHL8ORIJLrl7Dbc/bf62Fjyo526ON6CyhKwrpOaNPznoC5Ll4n4", - "pU/lwmBZ7WC08LZu97C/FnWAUEUl+DwWlQfcgSgW30Gx2mEoNBwjl3MA3/0yoy9B", - "sJyxVdryAir9GBFKNS5QaoQGXIBXPLDHwxDL6S4nBs3PkfdLvZ5GT3Tj2DE4bVAz", - "iWpR4LDeDykCmvOLeW2x8ebQ+fkIWt5AoxOmDLcj+j1Y9lhxdVcAhsT78P5TMfHI", - "gbZ2WRuCMnCjKErOfYHLzi1s3OVbsOBTh01+Ogj3KUUwCdPmYuwxMDefQ8DzIQtt", - "mW0QwwJrk0RTKwbHCllvlyoed5ofYQbT2p9ro3a79+yC0vUmKeXb8/fQOwD2uGKv", - "pO5tN9wlnLtSN+QmVCmp/Yq1ZDr4FijMEB4Ni0ozPvJhijffieo/krXqQzPYzaOT", - "hNCNWMMbzTzd+T4T1vUCA4lzhK+jRkS/8RNe/o4ByBxqkcpsI0ux5RyjLkG4KKr5", - "mdg6C6MxYdjGu+gJKf2QRtTf2sQ0d/+F/qW66SXmwXmtKOszg3XuJBesvWV27mcK", - "jUbpqgwZhgVuQH78cBO38nECfTyYzpZmf6qYB0qwWIphaB+veGRMEYGaRZqVaJ2r", - "jA0Vuqcr/NMX6blALKm7bnrh2zX/zn+syuC9GbPI5d59VSSu8Dd3cLOpBiZiepME", - "o1xgBPOHQww3l6sBV697gkyP4QYkHHzeuJfZAMD55LuUX/KmuIy9EONexIqqVU7L", - "lpR96eYGjCKncWZWonValVGwtmwtGnQb+EoIj+HoQOmS3DmGG/i6Po1bbSHo9X5k" - ], - "aggregate_pubkey": "gpEz/QdWaEoK7HttvrDVrsFuWqP7jHroafNH8NoS2NdwzHN+kHwqYxHUI0oEfN+v" - } - }, - "consensus_update": { - "attested_header": { - "beacon": { - "slot": 80, - "proposer_index": 42, - "parent_root": "1O7lDzEE5PxbXw1fow084phX2E3ASFKvEg5mYae4s1U=", - "state_root": "2aQwWA5cAU2P6ZHla5SUGhiIJfV3tbtNF7nQjS+soNg=", - "body_root": "xqsG0dPX9F6EcxPCOH1fNCxSf++0jDF2E0q3Gyukh+A=" - }, - "execution": { - "parent_hash": "ru6Z9zOSaJ+wsLMggEkS8j0wQcXWhVUXIP8aj66l5vg=", - "fee_recipient": "iUNUUXeAbtF7nyPwoh7llI7Kp3Y=", - "state_root": "LAG0VZsJAMaMlNvMZwgtgdBXFwG1seMi1oQ2Az6C/cM=", - "receipts_root": "VugfFxvMVab/g0XmksD4bltI4BuZbK3AAWIvteNjtCE=", - "logs_bloom": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "prev_randao": "GIyUtj3YLIpxoI8O9/LoqXJVwX0Al6LVKzT2+ESmXbA=", - "block_number": 80, - "gas_limit": 30000000, - "timestamp": 1733856236, - "extra_data": "2IMBDgaEZ2V0aIhnbzEuMjIuNIVsaW51eA==", - "base_fee_per_gas": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZ74=", - "block_hash": "wlDETVSwhPXLtJSgOuU+gGcwOtCh2wRwUJLsDGF3f0E=", - "transactions_root": "f/4kHqYBh/2wGHv6It410fm+16sGHZQB/UfjSlT77eE=", - "withdrawals_root": "KLoYNKOntldGDOefo6HZCauIKP1VdlnU0FVKm9vA7DA=" - }, - "execution_branch": [ - "iHWRb/HnHxdZ5aPr2jTGL5RND6Nh3UAmNUqVHRF4eJw=", - "bG3WNlZjnRU6LoapyrKR56JulXrWNf7IctKDbpI0DCM=", - "21YRTgD91MH4XIkr81rJqJKJquyx69CpbN5ganSLXXE=", - "h1JnSIM8gJKzW/g8wB2fmTfN02XPyP0eb+qKjFQjZF8=" - ] - }, - "next_sync_committee": { - "pubkeys": [ - "geqfdO99k1uAdHTjiVSuOTSFYhmiPgdJVLLoYMWjxAD5rttCzSfLTOtpfKNtHljL", - "hyWzJ1FBnyKlRIV5D4GH0bpS2EoxrUVzipN3f80cy+wWUiKZI/gvN3k84PwnY/tM", - "q3LLxldcMXloCljA7NXeRtJnjMuvwBZ0Y0juVojtyyG04VvTfHDFCOPqcxA8LVZr", - "tyyxBre8HsriGeCuGDClCe0YoEK1aid59AM0Gd5puoroAXCQyu0fU3e/poUGFXNg", - "l2Pd4bgCgTaj/9ba/R9FDiyvsoGcf6kB98bpzejyiX7n6aRdppR/3hrQ04NhiOq1", - "hNw3yjzWIdPaD73RHKhAIeDNgac9dy3W/PGXdbcutkr05XMhM3jM7gkV3ekqyDum", - "jYmF5d00HJA1s3v3ORxZRMKBMbR8fVNZ0Y/KWYAQuppj4nxV5rQhqAcDjDIFZNsX", - "teiYofwG1RxpVxKSj0RkbRVFE0DRs+SApA8DJQFgvAfTtmkeyUNh3VJNWdnff3bT", - "mRhDO48LxeEm2j/e+Ne3FFZJLa5tLQfy4Qx6f4UgRvhO0M5tO/7EIgBnDbJ9zzA3", - "rGmunmw4WjaN9x0RrGj0XwXgBTBt88K/mO01d3CCVr2X+MCdP3IRVEQHepu3EdjR", - "r6EK8Wag2/OiX/hs1vjkTMzIGMXnDNcOTpjiJrFY81Y0ULP7GE0mSa27EeUwgNHK", - "huAUdHx5Isz8K51L9sHs8NyAAZcDeFjQuFqxlEtMPBS5Xg7TJbxCpvRnvEfsJ7x7", - "kwdDv8fhjTvXNR6qdPR3UFJoweTh/RyjzMze+yWVUXNDu7j1WJxDXDw5MjpMAID4", - "tj8yffaFgc3AKmbBxl6Qagaho6jXpuOPe22pROjmzC24X87VMn2MEpRc6zMBgnLK", - "hyMUIaCO0o59NX4rN6JqRYFVyNgi2Ck0S9ECnl0XW17fqnjxb3hPckosrvEklExP", - "skORqpe//ymtyTXQaittWDQzyvgvkt4ZgOAZLTsnAyO9vyS4bcYVIKQMQZ3ePfSz", - "siJVddXnDaElfbeg0SIsUEG1KqxhzxYej8gSaj/fXrTwhn2Y3+JyGZw2z48CZhs9", - "rpQKB4UM+QS0TzHL8ORIJLrl7Dbc/bf62Fjyo526ON6CyhKwrpOaNPznoC5Ll4n4", - "jUbpqgwZhgVuQH78cBO38nECfTyYzpZmf6qYB0qwWIphaB+veGRMEYGaRZqVaJ2r", - "mWMjr35UX7Y2Os5T8VOMfdw+sNmFskedo+5KzhDLw5O1GL8C0aLdsvW98JtHOTPq", - "oDwqgjdOBLLgWUxM4U+z8iW0bxMYjw2AAqUjx9z7k5rkhWBTwsnGlTdNfDaF3xyl", - "odmEDtowNvv2Pu6kAUbkVIVT5uGyplOrNJs3bzGzZ8QNcftZ/46UuR2qmcJi7ItS", - "j9pmuGB6+HP0wsghjdP/x5QNQRBH6xmbXNAQFWr0hF0h3S5lsORM//teeCcem7Kd", - "kXCe4GSXuawEkyWFPWSUcpAYmowjIuOlANkeI+oC3BWLbbY65Vizt2cDV6FRzWBx", - "r4mrAKDqsRMWRSkqnPulg6aaHjrFiyEOJiSUhT5nOFrrUNSvQovdV3uTmdqpbYsg", - "jA0Vuqcr/NMX6blALKm7bnrh2zX/zn+syuC9GbPI5d59VSSu8Dd3cLOpBiZiepME", - "p1ypRH3KOjdFraNnMRh93R9qFSzxXXRGt4Xqs4HlyFYsEgKm56JAgLxrYZoWERPb", - "gfoiJzf+gYtD9V8gn0KtruE1soAdAnCWF/yIwocYUjWCYKzpfPMj52G1zBi8cyWz", - "lpR96eYGjCKncWZWonValVGwtmwtGnQb+EoIj+HoQOmS3DmGG/i6Po1bbSHo9X5k", - "gbZ2WRuCMnCjKErOfYHLzi1s3OVbsOBTh01+Ogj3KUUwCdPmYuwxMDefQ8DzIQtt", - "qvbBJR5z+2AGJJN3YP7yGKrOWyU78GjtRTmK6ynYIeTSiZND3cu+N8s/bPUA3/Js", - "pU/lwmBZ7WC08LZu97C/FnWAUEUl+DwWlQfcgSgW30Gx2mEoNBwjl3MA3/0yoy9B" - ], - "aggregate_pubkey": "piW74PYzIdk0DnJi+7tM60knsusPNbNaao5uh3gQRHEqnItRtIZWrwrUPD+fTggu" - }, - "next_sync_committee_branch": [ - "CwBU3peDu2QTGV9J3v71dAPfPjZHWNE0mz2A+zCjnZA=", - "lwZkHK6SUzdlSMoFdZE1Tkt2Do5CGUP7YqXfZeUqYsQ=", - "BV9rD4Us8DDhOy4RR0zIFmiWReVrqrSoUUwCKioFFcA=", - "P4XiedemFlpmMiGID7+2ceKCA9zRIk7xJ81cXNrSCtg=", - "iQpbs2186fOH6WMYYRF+NEWN/nZfcfCg7lEwnUx4kYY=" - ], - "finalized_header": { - "beacon": { - "slot": 64, - "proposer_index": 50, - "parent_root": "KiLRWMkzOpvoBBeSfdhhDEFNKg/H8gkVEgODLIF2mmk=", - "state_root": "p+SRTw53W6vOjDwYc9TzgF3k92ROJ5hcAKus4Zl5qrE=", - "body_root": "ZnPqkQmmW0tfCkZEpotUdZBk5k2PYw0jWJGsbfukx/k=" - }, - "execution": { - "parent_hash": "RIgrTRvdvgS1Xt4wteEutMowgLQkGm1draydEKrpNi8=", - "fee_recipient": "iUNUUXeAbtF7nyPwoh7llI7Kp3Y=", - "state_root": "4ONwA+OSvHfeAwEYD3lY1dbZ8rW0uGyaiFxbMCEIyP4=", - "receipts_root": "VugfFxvMVab/g0XmksD4bltI4BuZbK3AAWIvteNjtCE=", - "logs_bloom": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "prev_randao": "N4VrKZF3d8uOIDoIm/ZB6z3Lf6M1dqio0kTFazd4MPg=", - "block_number": 64, - "gas_limit": 30000000, - "timestamp": 1733856140, - "extra_data": "2IMBDgaEZ2V0aIhnbzEuMjIuNIVsaW51eA==", - "base_fee_per_gas": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADYuU=", - "block_hash": "Os3NEkyiKm8149HAOSx2mqnzh1zOpZNMlcn85qwmeF4=", - "transactions_root": "f/4kHqYBh/2wGHv6It410fm+16sGHZQB/UfjSlT77eE=", - "withdrawals_root": "KLoYNKOntldGDOefo6HZCauIKP1VdlnU0FVKm9vA7DA=" - }, - "execution_branch": [ - "Nwt0yDluQVKBlp6j99315FRZf4vQu8GEmvlfww5OhGM=", - "bG3WNlZjnRU6LoapyrKR56JulXrWNf7IctKDbpI0DCM=", - "21YRTgD91MH4XIkr81rJqJKJquyx69CpbN5ganSLXXE=", - "gMub4iCaz4g0suRKADDwA3zkZ39YCCth9c/VHVPtElA=" - ] - }, - "finality_branch": [ - "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", - "X28CrykhgpLSGmm2SnlKfAhzs+D1RhGXKGNwboy983E=", - "7DwX1mZPgtSvOmOopjT4GmPGZus71j5IoOmsksT13Nc=", - "BV9rD4Us8DDhOy4RR0zIFmiWReVrqrSoUUwCKioFFcA=", - "P4XiedemFlpmMiGID7+2ceKCA9zRIk7xJ81cXNrSCtg=", - "iQpbs2186fOH6WMYYRF+NEWN/nZfcfCg7lEwnUx4kYY=" - ], - "sync_aggregate": { - "sync_committee_bits": "/////w==", - "sync_committee_signature": "toeilMFMq5SCh6IUiR4zCkdF6+QylRaOSXSDFPROp2N/VpN0KVpi7tR1mZviK2AMGQQZ6WTJBsm/W8dyEkobMmEl6r+6sgJt1RtG9R+xTZnp/AkDGPERxEjzhqGA11wR" - }, - "signature_slot": 81 - }, - "account_update": { - "account_proof": { - "storage_root": "FQyCzO+Kf1o+8uOU1/zh9I50iBGqiCG3tQxMoLZEE0E=", - "proof": [ - "+QIRoEqvnXgQSE6uML1+jas4PVF1tiIo22EFAKi/9NHndXGooAbUdhbfR5tGswLyqLftA8tTf2z3xVHBVCHGXbTgD6l/oLuHKSNDinwlyI+JmecT3RQCSrT57vDoTVHjUNnDx813oNi8oPl9vaMHj97bp7mRjBEbLF3LR35QM+JPyKJlJVrvoGkq5BIeaVESyepPbBR0D5TQeXhOmQ9B0YsXpxlmuhdFoO6mQ3QFKsRglXu8NKBxy4sl3N9E2WeFpVs0JCkUyD+foF1h7zrBxkEiigQalRUjHhVeP1E8WXQ42q5bWqZOuy5noGKSYZjiqQ7UeRdBYSZA+2XGPZ8ZDOZjyDX9mR1LdHVJoPnRr2R9fhhE6aKm3r7yCLaNREEdGZYSchixFYITIyXkoL6I5HJDJjgqi1biMo7u8K1R8Y1brg6EKWr+FMQCjEr5oA8y0WYWCPn0aXZh4EtQpjT+GU3aZpXUGDTyYdHqQ4DCoBeWYXQn5n7RDN+KcrAmiacAunHrkxhqGxIMmtCw5W6uoK0LuGtHGGwEIj6FqcM90ch91uXBf3U/T9ClZ3LYp4OZoFb+tXLIDCe36wVG4xP7Lp2Nv8bXo57vQKwx+UNVMd1UoJYvD3zLQ8eLoj+ZvmPX++/JrK+7O+hycOuNhQ5QkGz/oHgwS2TetxpcoSkco3l58MFOK7j4GhbaIQf7CREw8PeygA==", - "+QFRoD6TiwBD2rB8FpUnqq6OVXeMwdUN+zOByLq5YzOe8vh6gKC1zPy8Mgo5tAriiI73XuIFDClU/iUkiVrJjNQ10NUgGqDfWkJW/yX4deayShK82g9hCqUUs0cmbxEr2eZx3aWk+4CAoBg5Oha5L8XhP/JZovIotNuHSnwuLv3qmQ2yQzStrHZegKDzjJXLv3w4rfQGDl5MDol0PdW9yGP4iuh+EQ0RpVwsbKBl3iIXsq26GR0iZfo522mo2yhfEBuxKdaTM9WxhuAY5KCFrWasFfAWK346oyhshu96L08yD/W9DEUFK7X2UYxLBICg64B8mYyBIQllkJFDYEN+MFEUZh4CEbyzacUHt5mjEdegCAZwUy7i7pfJeAL2UPTFjLvTywKQ+x0xPGKqI2HirLmAoFi5pM785JAZiqlJ8+HEM+8x5Yr49QTGmR8VRhAlBAtHgA==", - "+HGAgICgWg82zhYEL4F3O3LZtw85nBcPD1+N+sHPhqaCO5rWf+6AoNv83llVsfz8cCghl+uNr0UluUBHabf45yAv5gVUtLZrgICAgICgYpsKqgTf1yVgMfDQyfWmYg5ZMa4nWI5is6fHD88LP2iAgICAgA==", - "+GifM1FcvC/LYwS9lHNetkjkXluqZ/eS8pyZh1A8MpYcc7hG+EQBgKAVDILM74p/Wj7y45TX/OH0jnSIEaqIIbe1DEygtkQTQaC1UBwqmIhZLr9DrTkL8TkHuD14NINNNaH/HPGnOXRcaQ==" - ] - } - } - } - ] - } - }, - { - "name": "commitment_proof", - "data": { - "path": "MDctdGVuZGVybWludC0wAwAAAAAAAAAB", - "storage_proof": { - "key": "z4MIXTcym36YbZwkQWDschTHgBp83kz7bYZ/zELHO3A=", - "value": "hGDiH3O1PXeeSzKRzTUzjpL66ZmHNfGgtxUMB0wHMaY=", - "proof": [ - "+HGAgKBn+HTtJcYaG/oWCy2naUfMpetX7uGWMwVxW59RjHDv+oCAgICAgICAgKDZ7DPZ9gv/axP5sWNsOgrHy/HIZt5y428gaQ/rczBJC6AqTaH7tpp+wcsZefHTE7thiOuIYkLUlzAwZezXeCxqcoCAgA==", - "+EOgOCBn1SkRXM4FoKixmPRs60ule4noP5PH5oOlpmmmXRahoIRg4h9ztT13nksykc01M46S+umZhzXxoLcVDAdMBzGm" - ] - }, - "proof_height": { - "revision_number": 0, - "revision_height": 80 - }, - "client_state": { - "chain_id": "3151908", - "genesis_validators_root": "1h6khP66z65SmNUqK1gfPjBaUfMRKpJBuWjczwGfexE=", - "genesis_time": 1733855756, - "fork_parameters": { - "genesis_fork_version": "EAAAOA==", - "altair": { - "version": "IAAAOA==" - }, - "bellatrix": { - "version": "MAAAOA==" - }, - "capella": { - "version": "QAAAOA==" - }, - "deneb": { - "version": "UAAAOA==" - } - }, - "seconds_per_slot": 6, - "slots_per_epoch": 8, - "epochs_per_sync_committee_period": 8, - "latest_slot": 80, - "frozen_height": { - "revision_number": 0, - "revision_height": 0 - }, - "ibc_commitment_slot": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=", - "ibc_contract_address": "bw0opyzI85ngM8T7HEvuR7nsyaQ=", - "min_sync_committee_participants": 32 - - }, - "consensus_state": { - "slot": 80, - "state_root": "LAG0VZsJAMaMlNvMZwgtgdBXFwG1seMi1oQ2Az6C/cM=", - "storage_root": "FQyCzO+Kf1o+8uOU1/zh9I50iBGqiCG3tQxMoLZEE0E=", - "timestamp": 1733856236000000000, - "current_sync_committee": "gpEz/QdWaEoK7HttvrDVrsFuWqP7jHroafNH8NoS2NdwzHN+kHwqYxHUI0oEfN+v", - "next_sync_committee": "piW74PYzIdk0DnJi+7tM60knsusPNbNaao5uh3gQRHEqnItRtIZWrwrUPD+fTggu" - } - } - }, - { - "name": "updated_light_client", - "data": { - "client_state": { - "chain_id": "3151908", - "genesis_validators_root": "1h6khP66z65SmNUqK1gfPjBaUfMRKpJBuWjczwGfexE=", - "genesis_time": 1733855756, - "fork_parameters": { - "genesis_fork_version": "EAAAOA==", - "altair": { - "version": "IAAAOA==" - }, - "bellatrix": { - "version": "MAAAOA==" - }, - "capella": { - "version": "QAAAOA==" - }, - "deneb": { - "version": "UAAAOA==" - } - }, - "seconds_per_slot": 6, - "slots_per_epoch": 8, - "epochs_per_sync_committee_period": 8, - "latest_slot": 80, - "frozen_height": { - "revision_number": 0, - "revision_height": 0 - }, - "ibc_commitment_slot": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=", - "ibc_contract_address": "bw0opyzI85ngM8T7HEvuR7nsyaQ=", - "min_sync_committee_participants": 32 - - }, - "consensus_state": { - "slot": 80, - "state_root": "LAG0VZsJAMaMlNvMZwgtgdBXFwG1seMi1oQ2Az6C/cM=", - "storage_root": "FQyCzO+Kf1o+8uOU1/zh9I50iBGqiCG3tQxMoLZEE0E=", - "timestamp": 1733856236000000000, - "current_sync_committee": "gpEz/QdWaEoK7HttvrDVrsFuWqP7jHroafNH8NoS2NdwzHN+kHwqYxHUI0oEfN+v", - "next_sync_committee": "piW74PYzIdk0DnJi+7tM60knsusPNbNaao5uh3gQRHEqnItRtIZWrwrUPD+fTggu" - }, - "updates": [ - { - "trusted_sync_committee": { - "trusted_height": { - "revision_number": 0, - "revision_height": 80 - }, - "next_sync_committee": { - "pubkeys": [ - "geqfdO99k1uAdHTjiVSuOTSFYhmiPgdJVLLoYMWjxAD5rttCzSfLTOtpfKNtHljL", - "hyWzJ1FBnyKlRIV5D4GH0bpS2EoxrUVzipN3f80cy+wWUiKZI/gvN3k84PwnY/tM", - "q3LLxldcMXloCljA7NXeRtJnjMuvwBZ0Y0juVojtyyG04VvTfHDFCOPqcxA8LVZr", - "tyyxBre8HsriGeCuGDClCe0YoEK1aid59AM0Gd5puoroAXCQyu0fU3e/poUGFXNg", - "l2Pd4bgCgTaj/9ba/R9FDiyvsoGcf6kB98bpzejyiX7n6aRdppR/3hrQ04NhiOq1", - "hNw3yjzWIdPaD73RHKhAIeDNgac9dy3W/PGXdbcutkr05XMhM3jM7gkV3ekqyDum", - "jYmF5d00HJA1s3v3ORxZRMKBMbR8fVNZ0Y/KWYAQuppj4nxV5rQhqAcDjDIFZNsX", - "teiYofwG1RxpVxKSj0RkbRVFE0DRs+SApA8DJQFgvAfTtmkeyUNh3VJNWdnff3bT", - "mRhDO48LxeEm2j/e+Ne3FFZJLa5tLQfy4Qx6f4UgRvhO0M5tO/7EIgBnDbJ9zzA3", - "rGmunmw4WjaN9x0RrGj0XwXgBTBt88K/mO01d3CCVr2X+MCdP3IRVEQHepu3EdjR", - "r6EK8Wag2/OiX/hs1vjkTMzIGMXnDNcOTpjiJrFY81Y0ULP7GE0mSa27EeUwgNHK", - "huAUdHx5Isz8K51L9sHs8NyAAZcDeFjQuFqxlEtMPBS5Xg7TJbxCpvRnvEfsJ7x7", - "kwdDv8fhjTvXNR6qdPR3UFJoweTh/RyjzMze+yWVUXNDu7j1WJxDXDw5MjpMAID4", - "tj8yffaFgc3AKmbBxl6Qagaho6jXpuOPe22pROjmzC24X87VMn2MEpRc6zMBgnLK", - "hyMUIaCO0o59NX4rN6JqRYFVyNgi2Ck0S9ECnl0XW17fqnjxb3hPckosrvEklExP", - "skORqpe//ymtyTXQaittWDQzyvgvkt4ZgOAZLTsnAyO9vyS4bcYVIKQMQZ3ePfSz", - "siJVddXnDaElfbeg0SIsUEG1KqxhzxYej8gSaj/fXrTwhn2Y3+JyGZw2z48CZhs9", - "rpQKB4UM+QS0TzHL8ORIJLrl7Dbc/bf62Fjyo526ON6CyhKwrpOaNPznoC5Ll4n4", - "jUbpqgwZhgVuQH78cBO38nECfTyYzpZmf6qYB0qwWIphaB+veGRMEYGaRZqVaJ2r", - "mWMjr35UX7Y2Os5T8VOMfdw+sNmFskedo+5KzhDLw5O1GL8C0aLdsvW98JtHOTPq", - "oDwqgjdOBLLgWUxM4U+z8iW0bxMYjw2AAqUjx9z7k5rkhWBTwsnGlTdNfDaF3xyl", - "odmEDtowNvv2Pu6kAUbkVIVT5uGyplOrNJs3bzGzZ8QNcftZ/46UuR2qmcJi7ItS", - "j9pmuGB6+HP0wsghjdP/x5QNQRBH6xmbXNAQFWr0hF0h3S5lsORM//teeCcem7Kd", - "kXCe4GSXuawEkyWFPWSUcpAYmowjIuOlANkeI+oC3BWLbbY65Vizt2cDV6FRzWBx", - "r4mrAKDqsRMWRSkqnPulg6aaHjrFiyEOJiSUhT5nOFrrUNSvQovdV3uTmdqpbYsg", - "jA0Vuqcr/NMX6blALKm7bnrh2zX/zn+syuC9GbPI5d59VSSu8Dd3cLOpBiZiepME", - "p1ypRH3KOjdFraNnMRh93R9qFSzxXXRGt4Xqs4HlyFYsEgKm56JAgLxrYZoWERPb", - "gfoiJzf+gYtD9V8gn0KtruE1soAdAnCWF/yIwocYUjWCYKzpfPMj52G1zBi8cyWz", - "lpR96eYGjCKncWZWonValVGwtmwtGnQb+EoIj+HoQOmS3DmGG/i6Po1bbSHo9X5k", - "gbZ2WRuCMnCjKErOfYHLzi1s3OVbsOBTh01+Ogj3KUUwCdPmYuwxMDefQ8DzIQtt", - "qvbBJR5z+2AGJJN3YP7yGKrOWyU78GjtRTmK6ynYIeTSiZND3cu+N8s/bPUA3/Js", - "pU/lwmBZ7WC08LZu97C/FnWAUEUl+DwWlQfcgSgW30Gx2mEoNBwjl3MA3/0yoy9B" - ], - "aggregate_pubkey": "piW74PYzIdk0DnJi+7tM60knsusPNbNaao5uh3gQRHEqnItRtIZWrwrUPD+fTggu" - } - }, - "consensus_update": { - "attested_header": { - "beacon": { - "slot": 144, - "proposer_index": 58, - "parent_root": "mF2KL1zqv4gZ2N++yAloFZXcTbVr0i1ELFXLzxdk5ww=", - "state_root": "aUW8ax9pw1HINE+QO9/ByUH9Y3gmZRBfHtmlGranjmQ=", - "body_root": "fafDMFnlAGT7C/wASqo+hNL3FN1RiCERClXVbU/yFtg=" - }, - "execution": { - "parent_hash": "qFoCQLx7yYrcmX5a2usJYRo1ocXSnsrP3TF5gtASHLA=", - "fee_recipient": "iUNUUXeAbtF7nyPwoh7llI7Kp3Y=", - "state_root": "+s5Ah5zXVKIu+I4QQ4TPdcxgcRhuwKLf3igMostLKG8=", - "receipts_root": "VugfFxvMVab/g0XmksD4bltI4BuZbK3AAWIvteNjtCE=", - "logs_bloom": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "prev_randao": "1RbFW2Lq8FKb2ddLIgaGkWDXvUiu3qS3FiTVSmGtPQM=", - "block_number": 144, - "gas_limit": 30000000, - "timestamp": 1733856620, - "extra_data": "2IMBDgaEZ2V0aIhnbzEuMjIuNIVsaW51eA==", - "base_fee_per_gas": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAk=", - "block_hash": "bOMaCWf9lobnDErYND5uyaOhi8dGNh5yFvE+fe9cviE=", - "transactions_root": "f/4kHqYBh/2wGHv6It410fm+16sGHZQB/UfjSlT77eE=", - "withdrawals_root": "KLoYNKOntldGDOefo6HZCauIKP1VdlnU0FVKm9vA7DA=" - }, - "execution_branch": [ - "ggg/zbZvdsdS7WG7wAx+vpH+dcbRnK6ZrIE7t8+6dMo=", - "bG3WNlZjnRU6LoapyrKR56JulXrWNf7IctKDbpI0DCM=", - "21YRTgD91MH4XIkr81rJqJKJquyx69CpbN5ganSLXXE=", - "S8o2yFqYtFoPxGKkwb1jQmfBMLDG9TceN862Ba4DNXw=" - ] - }, - "next_sync_committee": { - "pubkeys": [ - "l2Pd4bgCgTaj/9ba/R9FDiyvsoGcf6kB98bpzejyiX7n6aRdppR/3hrQ04NhiOq1", - "odmEDtowNvv2Pu6kAUbkVIVT5uGyplOrNJs3bzGzZ8QNcftZ/46UuR2qmcJi7ItS", - "hBnPAPJ4PEMNyGGnEJhNBCnTs6f224SbT1wF4NhzOXBMXH9e7eat/Id21mZYe1ky", - "hyWzJ1FBnyKlRIV5D4GH0bpS2EoxrUVzipN3f80cy+wWUiKZI/gvN3k84PwnY/tM", - "q3LLxldcMXloCljA7NXeRtJnjMuvwBZ0Y0juVojtyyG04VvTfHDFCOPqcxA8LVZr", - "q9EmeMc0Y+zqWGeoDK8lbVxea6U/8YixQ6TVvoM2WtJX7fOeqhuodTxM30xjL/me", - "iuxRKaUYAQkSIV4YhxkdqUvkGbTnWQTC6nReLSU9cHwIj6WyxG2t4dFir/6ferF7", - "iWpR4LDeDykCmvOLeW2x8ebQ+fkIWt5AoxOmDLcj+j1Y9lhxdVcAhsT78P5TMfHI", - "rZIi3scf+O5rwEJv/nteZvlnOCJdsoHdIAJ6FVbQif3r0ECr+8IEHWwaDY/c/OGD", - "hNw3yjzWIdPaD73RHKhAIeDNgac9dy3W/PGXdbcutkr05XMhM3jM7gkV3ekqyDum", - "huAUdHx5Isz8K51L9sHs8NyAAZcDeFjQuFqxlEtMPBS5Xg7TJbxCpvRnvEfsJ7x7", - "r6EK8Wag2/OiX/hs1vjkTMzIGMXnDNcOTpjiJrFY81Y0ULP7GE0mSa27EeUwgNHK", - "rpQKB4UM+QS0TzHL8ORIJLrl7Dbc/bf62Fjyo526ON6CyhKwrpOaNPznoC5Ll4n4", - "kwdDv8fhjTvXNR6qdPR3UFJoweTh/RyjzMze+yWVUXNDu7j1WJxDXDw5MjpMAID4", - "gfoiJzf+gYtD9V8gn0KtruE1soAdAnCWF/yIwocYUjWCYKzpfPMj52G1zBi8cyWz", - "iqW77iHpjHueekyOpFqpn4niKZL6T8LXOGnXfaTMigWyW2GTH/UhmGZ33X9xWejm", - "tXDd6O6AUS49AxyvIud1xg9/Wmy96z5S4kz4yGfThWmlPdGc3DagOhu7Oo2UsDZw", - "rGmunmw4WjaN9x0RrGj0XwXgBTBt88K/mO01d3CCVr2X+MCdP3IRVEQHepu3EdjR", - "r2HyY63ftBxG1m5g7PtZillC9kj1hxi2tOTJIBn9sSMo77/5hwMTS88o6cH6tLtg", - "lYwmkrhrTSDq6ju0XpRH67xbk8yvjSHvZZ0M7+31xDcbMbRgrkDoJDaCveUFq6we", - "pO5tN9wlnLtSN+QmVCmp/Yq1ZDr4FijMEB4Ni0ozPvJhijffieo/krXqQzPYzaOT", - "rlMCeWz+ymherzf/1brrMhIfLwdBW+4mzABR7lE/85MtLDZePZ+HsJSaWYBEXLZM", - "ouLYOE/IelEu4060NAX9glcsnXzZbhVaOCzaKE6N+etxicJbdHPYnGPqTmCA4Q/4", - "mRhDO48LxeEm2j/e+Ne3FFZJLa5tLQfy4Qx6f4UgRvhO0M5tO/7EIgBnDbJ9zzA3", - "qPo1hKkrB5yMc+0VU+XhYaCyEyX8L8TiSokjVKiZx/wL+0Nql6ftH8cbzNpDjqcV", - "snrROvyP8w4Id5ezRMg4K7CoREdUnxsCdAWd3WUiduexSLqICKEMxFdGdilX1O++", - "teiYofwG1RxpVxKSj0RkbRVFE0DRs+SApA8DJQFgvAfTtmkeyUNh3VJNWdnff3bT", - "j9pmuGB6+HP0wsghjdP/x5QNQRBH6xmbXNAQFWr0hF0h3S5lsORM//teeCcem7Kd", - "mWMjr35UX7Y2Os5T8VOMfdw+sNmFskedo+5KzhDLw5O1GL8C0aLdsvW98JtHOTPq", - "kXCe4GSXuawEkyWFPWSUcpAYmowjIuOlANkeI+oC3BWLbbY65Vizt2cDV6FRzWBx", - "jfqGwFHt0ow1VKMOQFMciY5ZNq0wAnEWFt3RsnBUvDnK7dUFogDD0jocP2smxQrp", - "jQKKAhxcMaGqHhjtp0z68PuhxFTBfC4PxzDdB6GdDHf3qQXVQBcpLz6ADKBraXfN" - ], - "aggregate_pubkey": "llDboaDTFWpT9oYHHw3JlS1FDDDxrU2RQQ5sVYT7qgvSFACKddjo5IXB5fUYrOBc" - }, - "next_sync_committee_branch": [ - "AGP1OJjuol6AlkzYVgpoVm1bsWReyqgg3NLKTOxctzY=", - "MgBhmm/UIND/X5sksVSDj8d0hr39DRF3Dc0R5++fia0=", - "wFZZieYdauxSNTVpVyEoIvuTfTEgu5teJovC8CX4E04=", - "rO+Pqm4gF/0zoIYv1Oj/6hC4Z0TY9F3rwAJM9hJk4y4=", - "UOXxLnocL0iqw4Ql1oJGpqppr9KLHwaTWPAqBUxR13M=" - ], - "finalized_header": { - "beacon": { - "slot": 128, - "proposer_index": 60, - "parent_root": "wosYEYU9l1ooOcUYG1eZFQFJvtPlruyVGOIpILTkm/U=", - "state_root": "Lq2yQ+CO065pLdqv6E2MBoG+UkGCKn+pvtEu6XiXjZA=", - "body_root": "b3OH6+XxIwlg7HjBTF7vgF34KXaik0JQ6T5xeGf3NNs=" - }, - "execution": { - "parent_hash": "L0j248QGmkMl+uv8mCIrroyqE4XI+CV4AMSyEOI1OC8=", - "fee_recipient": "iUNUUXeAbtF7nyPwoh7llI7Kp3Y=", - "state_root": "HLfYes1lNuLDHxw8ABcNUJaVMHezicmAr1BYeMt1EBI=", - "receipts_root": "VugfFxvMVab/g0XmksD4bltI4BuZbK3AAWIvteNjtCE=", - "logs_bloom": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "prev_randao": "4wxl64GBXfNYyGOXRbtcVGdQ3YvsXBoG3LSFlgfP78I=", - "block_number": 128, - "gas_limit": 30000000, - "timestamp": 1733856524, - "extra_data": "2IMBDgaEZ2V0aIhnbzEuMjIuNIVsaW51eA==", - "base_fee_per_gas": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA=", - "block_hash": "bamfdcRuhojTnkYzLo7HO2rlih9Nz3NDsMuj2BKu28g=", - "transactions_root": "f/4kHqYBh/2wGHv6It410fm+16sGHZQB/UfjSlT77eE=", - "withdrawals_root": "KLoYNKOntldGDOefo6HZCauIKP1VdlnU0FVKm9vA7DA=" - }, - "execution_branch": [ - "VevPI+wqOmK1kSOuJWtdU3Drmevw9+R0LnTN5Ctkwys=", - "bG3WNlZjnRU6LoapyrKR56JulXrWNf7IctKDbpI0DCM=", - "21YRTgD91MH4XIkr81rJqJKJquyx69CpbN5ganSLXXE=", - "ljGYWEISnj6hg/eg5+QK/lfQ7Lcb1i5TDOw8QiBDhT0=" - ] - }, - "finality_branch": [ - "EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", - "X28CrykhgpLSGmm2SnlKfAhzs+D1RhGXKGNwboy983E=", - "NcLtbn1GXhlgXseD9Nblrp6v+1IYLaoTXPm7hs3LpJQ=", - "wFZZieYdauxSNTVpVyEoIvuTfTEgu5teJovC8CX4E04=", - "rO+Pqm4gF/0zoIYv1Oj/6hC4Z0TY9F3rwAJM9hJk4y4=", - "UOXxLnocL0iqw4Ql1oJGpqppr9KLHwaTWPAqBUxR13M=" - ], - "sync_aggregate": { - "sync_committee_bits": "/////w==", - "sync_committee_signature": "h2oyGhzIYwwYF/OiblaBLnkFqZncQFqZ5PUZX6yAGj6b/4weHLykYCJH4qOeQbQPF6uC8wXNc5h+7evtWdpdToIwP/NlEK9aQSkCVfgvrG+iOPG/ctjZqfNStjqf2amY" - }, - "signature_slot": 145 - }, - "account_update": { - "account_proof": { - "storage_root": "OSSDYp1SYQqEE62BFntoqQKVKGw3XHklNAg3RuwW3xE=", - "proof": [ - "+QIRoEqvnXgQSE6uML1+jas4PVF1tiIo22EFAKi/9NHndXGooAbUdhbfR5tGswLyqLftA8tTf2z3xVHBVCHGXbTgD6l/oLuHKSNDinwlyI+JmecT3RQCSrT57vDoTVHjUNnDx813oMeymH8lQgoK6PLOJGcRV73/G2KbuXGDU47XuTOdvPVroGkq5BIeaVESyepPbBR0D5TQeXhOmQ9B0YsXpxlmuhdFoO6mQ3QFKsRglXu8NKBxy4sl3N9E2WeFpVs0JCkUyD+foF1h7zrBxkEiigQalRUjHhVeP1E8WXQ42q5bWqZOuy5noJyNzdK8koRQrscuwTJHpsUKqZ7OBxduwGktNXlb2zNPoINUfExmxDP+E61Jq7AgBy7diT9AGcMZrPIEN3JTz4RaoL6I5HJDJjgqi1biMo7u8K1R8Y1brg6EKWr+FMQCjEr5oKJBg+4k4qx6ERsHe7Ns4Is8ZPBToCFAIG1ecwc+G+z9oBeWYXQn5n7RDN+KcrAmiacAunHrkxhqGxIMmtCw5W6uoK0LuGtHGGwEIj6FqcM90ch91uXBf3U/T9ClZ3LYp4OZoFb+tXLIDCe36wVG4xP7Lp2Nv8bXo57vQKwx+UNVMd1UoJYvD3zLQ8eLoj+ZvmPX++/JrK+7O+hycOuNhQ5QkGz/oHgwS2TetxpcoSkco3l58MFOK7j4GhbaIQf7CREw8PeygA==", - "+QFRoNSe0WFknOy5ppfsxg071vwNegMDDi9eSsDeQy4QXXEqgKC1zPy8Mgo5tAriiI73XuIFDClU/iUkiVrJjNQ10NUgGqDfWkJW/yX4deayShK82g9hCqUUs0cmbxEr2eZx3aWk+4CAoBg5Oha5L8XhP/JZovIotNuHSnwuLv3qmQ2yQzStrHZegKDzjJXLv3w4rfQGDl5MDol0PdW9yGP4iuh+EQ0RpVwsbKBl3iIXsq26GR0iZfo522mo2yhfEBuxKdaTM9WxhuAY5KCFrWasFfAWK346oyhshu96L08yD/W9DEUFK7X2UYxLBICg64B8mYyBIQllkJFDYEN+MFEUZh4CEbyzacUHt5mjEdegCAZwUy7i7pfJeAL2UPTFjLvTywKQ+x0xPGKqI2HirLmAoFi5pM785JAZiqlJ8+HEM+8x5Yr49QTGmR8VRhAlBAtHgA==", - "+HGAgICgWg82zhYEL4F3O3LZtw85nBcPD1+N+sHPhqaCO5rWf+6AoAbsEfbGy1GbewvrgWX5DFLBcgsUfs6Z5WrTgx9O3UYNgICAgICgYpsKqgTf1yVgMfDQyfWmYg5ZMa4nWI5is6fHD88LP2iAgICAgA==", - "+GifM1FcvC/LYwS9lHNetkjkXluqZ/eS8pyZh1A8MpYcc7hG+EQBgKA5JINinVJhCoQTrYEWe2ipApUobDdceSU0CDdG7BbfEaC1UBwqmIhZLr9DrTkL8TkHuD14NINNNaH/HPGnOXRcaQ==" - ] - } - } - } - ] - } - }, - { - "name": "commitment_proof", - "data": { - "path": "MDctdGVuZGVybWludC0wAQAAAAAAAAAB", - "storage_proof": { - "key": "dddBHLAdqtFncTtam3IZZw8OUAZTy7zUXP4b/gQiJFk=", - "value": "o6k/8ZjQOClNcSihI2CKlxE5D7j12ZPz6UAdtyMI97A=", - "proof": [ - "+LGAgKBn+HTtJcYaG/oWCy2naUfMpetX7uGWMwVxW59RjHDv+qA3G1OM0aXfARdggPsZmFNPtqjUk9m9025RegfZsaIN64CAoFexbZo7uy0Qa00bEtyjUE9hiZx8ZgsDaEhRFCbtNC3WgICAgICg2ewz2fYL/2sT+bFjbDoKx8vxyGbecuNvIGkP63MwSQugKk2h+7aafsHLGXnx0xO7YYjriGJC1JcwMGXs13gsanKAgIA=", - "+EOgPTw7zwMABq/qKmd6b/W/P38RHodGHIhIzwYqV1bRqIihoKOpP/GY0DgpTXEooSNgipcROQ+49dmT8+lAHbcjCPew" - ] - }, - "proof_height": { - "revision_number": 0, - "revision_height": 144 - }, - "client_state": { - "chain_id": "3151908", - "genesis_validators_root": "1h6khP66z65SmNUqK1gfPjBaUfMRKpJBuWjczwGfexE=", - "genesis_time": 1733855756, - "fork_parameters": { - "genesis_fork_version": "EAAAOA==", - "altair": { - "version": "IAAAOA==" - }, - "bellatrix": { - "version": "MAAAOA==" - }, - "capella": { - "version": "QAAAOA==" - }, - "deneb": { - "version": "UAAAOA==" - } - }, - "seconds_per_slot": 6, - "slots_per_epoch": 8, - "epochs_per_sync_committee_period": 8, - "latest_slot": 144, - "frozen_height": { - "revision_number": 0, - "revision_height": 0 - }, - "ibc_commitment_slot": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=", - "ibc_contract_address": "bw0opyzI85ngM8T7HEvuR7nsyaQ=", - "min_sync_committee_participants": 32 - - }, - "consensus_state": { - "slot": 144, - "state_root": "+s5Ah5zXVKIu+I4QQ4TPdcxgcRhuwKLf3igMostLKG8=", - "storage_root": "OSSDYp1SYQqEE62BFntoqQKVKGw3XHklNAg3RuwW3xE=", - "timestamp": 1733856620000000000, - "current_sync_committee": "piW74PYzIdk0DnJi+7tM60knsusPNbNaao5uh3gQRHEqnItRtIZWrwrUPD+fTggu", - "next_sync_committee": "llDboaDTFWpT9oYHHw3JlS1FDDDxrU2RQQ5sVYT7qgvSFACKddjo5IXB5fUYrOBc" - } - } - } - ] -} diff --git a/packages/ethereum-test-utils/src/fixtures/sync_committee_fixture.json b/packages/ethereum-test-utils/src/fixtures/sync_committee_fixture.json deleted file mode 100644 index 20d05db0..000000000 --- a/packages/ethereum-test-utils/src/fixtures/sync_committee_fixture.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "pubkeys": [ - "geqfdO99k1uAdHTjiVSuOTSFYhmiPgdJVLLoYMWjxAD5rttCzSfLTOtpfKNtHljL", - "hNCNWMMbzTzd+T4T1vUCA4lzhK+jRkS/8RNe/o4ByBxqkcpsI0ux5RyjLkG4KKr5", - "p1n2vMqPNfyq3EBsxLgowBbA7SOIKYenn1Lykztc7e/iTjHfb9DTjoqALbr9dQ0B", - "jQKKAhxcMaGqHhjtp0z68PuhxFTBfC4PxzDdB6GdDHf3qQXVQBcpLz6ADKBraXfN", - "snrROvyP8w4Id5ezRMg4K7CoREdUnxsCdAWd3WUiduexSLqICKEMxFdGdilX1O++", - "qATk+o0TkanQeKqTmFoSUDuEzk9vH55wq3/KQh4c+XJThmYpnUwb/Dkye0abLbeo", - "mWMjr35UX7Y2Os5T8VOMfdw+sNmFskedo+5KzhDLw5O1GL8C0aLdsvW98JtHOTPq", - "lpR96eYGjCKncWZWonValVGwtmwtGnQb+EoIj+HoQOmS3DmGG/i6Po1bbSHo9X5k", - "rlMCeWz+ymherzf/1brrMhIfLwdBW+4mzABR7lE/85MtLDZePZ+HsJSaWYBEXLZM", - "mW0QwwJrk0RTKwbHCllvlyoed5ofYQbT2p9ro3a79+yC0vUmKeXb8/fQOwD2uGKv", - "o1xgBPOHQww3l6sBV697gkyP4QYkHHzeuJfZAMD55LuUX/KmuIy9EONexIqqVU7L", - "q9EmeMc0Y+zqWGeoDK8lbVxea6U/8YixQ6TVvoM2WtJX7fOeqhuodTxM30xjL/me", - "gfoiJzf+gYtD9V8gn0KtruE1soAdAnCWF/yIwocYUjWCYKzpfPMj52G1zBi8cyWz", - "q2T5AMdw4rmd5rhrQ5C70Veb1I3M7FWACtvPUuAG8iEo6ZcbvzqSzAEFsJdISZNa", - "kwdDv8fhjTvXNR6qdPR3UFJoweTh/RyjzMze+yWVUXNDu7j1WJxDXDw5MjpMAID4", - "q3LLxldcMXloCljA7NXeRtJnjMuvwBZ0Y0juVojtyyG04VvTfHDFCOPqcxA8LVZr", - "hNw3yjzWIdPaD73RHKhAIeDNgac9dy3W/PGXdbcutkr05XMhM3jM7gkV3ekqyDum", - "jUbpqgwZhgVuQH78cBO38nECfTyYzpZmf6qYB0qwWIphaB+veGRMEYGaRZqVaJ2r", - "teiYofwG1RxpVxKSj0RkbRVFE0DRs+SApA8DJQFgvAfTtmkeyUNh3VJNWdnff3bT", - "pO5tN9wlnLtSN+QmVCmp/Yq1ZDr4FijMEB4Ni0ozPvJhijffieo/krXqQzPYzaOT", - "iqW77iHpjHueekyOpFqpn4niKZL6T8LXOGnXfaTMigWyW2GTH/UhmGZ33X9xWejm", - "kXCe4GSXuawEkyWFPWSUcpAYmowjIuOlANkeI+oC3BWLbbY65Vizt2cDV6FRzWBx", - "j9pmuGB6+HP0wsghjdP/x5QNQRBH6xmbXNAQFWr0hF0h3S5lsORM//teeCcem7Kd", - "tyyxBre8HsriGeCuGDClCe0YoEK1aid59AM0Gd5puoroAXCQyu0fU3e/poUGFXNg", - "iWpR4LDeDykCmvOLeW2x8ebQ+fkIWt5AoxOmDLcj+j1Y9lhxdVcAhsT78P5TMfHI", - "qvbBJR5z+2AGJJN3YP7yGKrOWyU78GjtRTmK6ynYIeTSiZND3cu+N8s/bPUA3/Js", - "mRhDO48LxeEm2j/e+Ne3FFZJLa5tLQfy4Qx6f4UgRvhO0M5tO/7EIgBnDbJ9zzA3", - "oDwqgjdOBLLgWUxM4U+z8iW0bxMYjw2AAqUjx9z7k5rkhWBTwsnGlTdNfDaF3xyl", - "jYmF5d00HJA1s3v3ORxZRMKBMbR8fVNZ0Y/KWYAQuppj4nxV5rQhqAcDjDIFZNsX", - "skORqpe//ymtyTXQaittWDQzyvgvkt4ZgOAZLTsnAyO9vyS4bcYVIKQMQZ3ePfSz", - "r2HyY63ftBxG1m5g7PtZillC9kj1hxi2tOTJIBn9sSMo77/5hwMTS88o6cH6tLtg", - "tj8yffaFgc3AKmbBxl6Qagaho6jXpuOPe22pROjmzC24X87VMn2MEpRc6zMBgnLK" - ], - "aggregate_pubkey": "p7kUGHfzl+nSo2zYZAc4e7zsbVV7MMzZ5ircohfkWNdJW1geBI+hCEIYyt+PRbn/" -} diff --git a/packages/ethereum-test-utils/src/lib.rs b/packages/ethereum-test-utils/src/lib.rs deleted file mode 100644 index dc7f8fc4..000000000 --- a/packages/ethereum-test-utils/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod bls_verifier; -pub mod fixtures; diff --git a/packages/ethereum-trie-db/Cargo.toml b/packages/ethereum-trie-db/Cargo.toml index fbfae598..9f1a4e69 100644 --- a/packages/ethereum-trie-db/Cargo.toml +++ b/packages/ethereum-trie-db/Cargo.toml @@ -7,6 +7,7 @@ repository = { workspace = true } [dependencies] ethereum-utils = { workspace = true } +hex = { workspace = true } trie-db = { workspace = true, features = ["std"] } hash-db = { workspace = true } memory-db = { workspace = true } @@ -15,6 +16,5 @@ rlp = { workspace = true, features = ["std"] } rlp-derive = { workspace = true } primitive-types = { workspace = true, features = ["rlp"] } sha3 = { workspace = true } -alloy-primitives = { workspace = true } # Needed for alloy-based interfaces/functions thiserror = { workspace = true } -serde = { workspace = true } +alloy-primitives = { workspace = true } # Needed for alloy-based interfaces/functions diff --git a/packages/ethereum-trie-db/src/error.rs b/packages/ethereum-trie-db/src/error.rs index 83637f25..026836e1 100644 --- a/packages/ethereum-trie-db/src/error.rs +++ b/packages/ethereum-trie-db/src/error.rs @@ -1,7 +1,5 @@ //! This module defines [`TrieDBError`]. -use ethereum_utils::hex; - #[derive(Debug, PartialEq, Eq, thiserror::Error, Clone)] #[allow(missing_docs, clippy::module_name_repetitions)] pub enum TrieDBError { @@ -13,11 +11,11 @@ pub enum TrieDBError { #[error( "proof is invalid due to value mismatch, expected: {expected}, actual: {actual}", - expected = hex::to_hex(expected), - actual = hex::to_hex(actual) + expected = hex::encode(expected), + actual = hex::encode(actual) )] ValueMismatch { expected: Vec, actual: Vec }, - #[error("proof is invalid due to missing value: {v}", v = hex::to_hex(value))] + #[error("proof is invalid due to missing value: {v}", v = hex::encode(value))] ValueMissing { value: Vec }, } diff --git a/packages/ethereum-trie-db/src/lib.rs b/packages/ethereum-trie-db/src/lib.rs index 68bf41a3..eec00650 100644 --- a/packages/ethereum-trie-db/src/lib.rs +++ b/packages/ethereum-trie-db/src/lib.rs @@ -1,6 +1,12 @@ //! Ethereum trie database utilities. -#![deny(clippy::nursery, clippy::pedantic, warnings, missing_docs)] +#![deny( + clippy::nursery, + clippy::pedantic, + warnings, + missing_docs, + unused_crate_dependencies +)] mod error; pub mod trie_db; diff --git a/packages/ethereum-types/Cargo.toml b/packages/ethereum-types/Cargo.toml new file mode 100644 index 000000000..e98c2fc4 --- /dev/null +++ b/packages/ethereum-types/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "ethereum-types" +version = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } + +[dependencies] +alloy-primitives = { workspace = true, features = ["serde", "hex-compat"] } +serde = { workspace = true, features = ["derive"] } +serde_with = { workspace = true, features = ["macros"] } +schemars = { workspace = true } +tree_hash = { workspace = true } +tree_hash_derive = { workspace = true } + +[dev-dependencies] +serde_json = { workspace = true } + diff --git a/packages/ethereum-types/README.md b/packages/ethereum-types/README.md new file mode 100644 index 000000000..310b72f7 --- /dev/null +++ b/packages/ethereum-types/README.md @@ -0,0 +1,5 @@ +# `ethereum-types` + +This crate contains ethereum types that are compatible with standard API endpoints such as the beacon API and the exeuction API. + +It also contains implementations for these types to enable their use in different use cases. diff --git a/packages/ethereum-light-client/src/types/bls.rs b/packages/ethereum-types/src/consensus/bls.rs similarity index 69% rename from packages/ethereum-light-client/src/types/bls.rs rename to packages/ethereum-types/src/consensus/bls.rs index bc1675ba..241c0fd7 100644 --- a/packages/ethereum-light-client/src/types/bls.rs +++ b/packages/ethereum-types/src/consensus/bls.rs @@ -1,6 +1,6 @@ //! BLS12-381 signature types for Ethereum beacon chain. -use alloy_primitives::{FixedBytes, B256}; +use alloy_primitives::FixedBytes; /// The Domain Separation Tag for `hash_to_point` in Ethereum beacon chain BLS12-381 signatures. /// @@ -23,23 +23,7 @@ pub const BLS_SIGNATURE_BYTES_LEN: usize = 96; /// The bytes representing a BLS12-381 public key. #[allow(clippy::module_name_repetitions)] pub type BlsPublicKey = FixedBytes; + /// The bytes representing a BLS12-381 signature. #[allow(clippy::module_name_repetitions)] pub type BlsSignature = FixedBytes; - -/// The BLS verifier trait. -#[allow(clippy::module_name_repetitions)] -pub trait BlsVerify { - /// The error type for the BLS verifier. - type Error: std::fmt::Display; - - /// Verify a BLS signature. - /// # Errors - /// Returns an error if the signature cannot be verified. - fn fast_aggregate_verify( - &self, - public_keys: Vec<&BlsPublicKey>, - msg: B256, - signature: BlsSignature, - ) -> Result<(), Self::Error>; -} diff --git a/packages/ethereum-light-client/src/types/domain.rs b/packages/ethereum-types/src/consensus/domain.rs similarity index 79% rename from packages/ethereum-light-client/src/types/domain.rs rename to packages/ethereum-types/src/consensus/domain.rs index 4f43d300..220741f3 100644 --- a/packages/ethereum-light-client/src/types/domain.rs +++ b/packages/ethereum-types/src/consensus/domain.rs @@ -3,7 +3,7 @@ use alloy_primitives::{hex, FixedBytes, B256}; use serde::{Deserialize, Serialize}; -use super::{fork_data::compute_fork_data_root, wrappers::WrappedVersion}; +use super::fork::{compute_fork_data_root, Version}; /// The signature domain type. /// Defined in @@ -11,6 +11,7 @@ use super::{fork_data::compute_fork_data_root, wrappers::WrappedVersion}; #[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] #[allow(clippy::module_name_repetitions)] pub struct DomainType(pub [u8; 4]); + #[allow(missing_docs)] impl DomainType { pub const BEACON_PROPOSER: Self = Self(hex!("00000000")); @@ -34,9 +35,9 @@ impl DomainType { #[must_use] pub fn compute_domain( domain_type: DomainType, - fork_version: Option, + fork_version: Option, genesis_validators_root: Option, - genesis_fork_version: WrappedVersion, + genesis_fork_version: Version, ) -> B256 { let fork_version = fork_version.unwrap_or(genesis_fork_version); let genesis_validators_root = genesis_validators_root.unwrap_or_default(); @@ -51,20 +52,21 @@ pub fn compute_domain( #[cfg(test)] mod test { - use alloy_primitives::aliases::B32; - use ethereum_utils::base64::FromBase64; - - use crate::config::MINIMAL; + use hex::FromHex; use super::*; + const GENESIS_FORK_VERSION: Version = FixedBytes([0, 0, 0, 1]); + const DENEB_FORK_VERSION: Version = FixedBytes([4, 0, 0, 1]); + #[test] fn test_compute_domain() { let domain_type = DomainType::SYNC_COMMITTEE; - let fork_version = MINIMAL.fork_parameters.deneb.version; + let fork_version = DENEB_FORK_VERSION; let genesis_validators_root = - B256::from_base64("1h6khP66z65SmNUqK1gfPjBaUfMRKpJBuWjczwGfexE=").unwrap(); - let genesis_fork_version = MINIMAL.fork_parameters.genesis_fork_version; + B256::from_hex("d61ea484febacfae5298d52a2b581f3e305a51f3112a9241b968dccf019f7b11") + .unwrap(); + let genesis_fork_version = GENESIS_FORK_VERSION; let domain = compute_domain( domain_type, @@ -74,7 +76,9 @@ mod test { ); // expected domain taken from running the same code in the union repo - let expected = B256::from_base64("BwAAAOqlZkuFxencFtZKxu4VzJLsR3mQBhswAkaW22c=").unwrap(); + let expected = + B256::from_hex("07000000eaa5664b85c5e9dc16d64ac6ee15cc92ec477990061b30024696db67") + .unwrap(); assert_eq!(domain, expected); } @@ -83,11 +87,10 @@ mod test { fn test_compute_domain_with_union_data() { // this test is essentially a copy of the union unit test for compute_domain let domain_type = DomainType([1, 2, 3, 4]); - let current_version = WrappedVersion(B32::from([5, 6, 7, 8])); + let current_version = Version::from([5, 6, 7, 8]); let genesis_validators_root = B256::new([1; 32]); - let fork_data_root = - compute_fork_data_root(current_version.clone(), genesis_validators_root); - let genesis_version = WrappedVersion(B32::from([0, 0, 0, 0])); + let fork_data_root = compute_fork_data_root(current_version, genesis_validators_root); + let genesis_version = Version::from([0, 0, 0, 0]); let mut domain = B256::default(); domain.0[..4].copy_from_slice(&domain_type.0); @@ -101,11 +104,11 @@ mod test { domain_type.clone(), Some(current_version), Some(genesis_validators_root), - genesis_version.clone(), + genesis_version, ) ); - let fork_data_root = compute_fork_data_root(genesis_version.clone(), FixedBytes::default()); + let fork_data_root = compute_fork_data_root(genesis_version, FixedBytes::default()); let mut domain = B256::default(); domain.0[..4].copy_from_slice(&domain_type.0); domain.0[4..].copy_from_slice(&fork_data_root[..28]); diff --git a/packages/ethereum-types/src/consensus/fork.rs b/packages/ethereum-types/src/consensus/fork.rs new file mode 100644 index 000000000..df4c44bf --- /dev/null +++ b/packages/ethereum-types/src/consensus/fork.rs @@ -0,0 +1,79 @@ +//! This module defines types related to forks in Ethereum. + +use alloy_primitives::{aliases::B32, B256}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use tree_hash::TreeHash; +use tree_hash_derive::TreeHash; + +/// Type alias Etheruem Version which is a fixed 4 byte array +pub type Version = B32; + +/// The fork data +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] +pub struct Fork { + /// The version of the fork + #[schemars(with = "String")] + pub version: Version, + /// The epoch at which this fork is activated + pub epoch: u64, +} + +/// The fork data +#[derive(Serialize, Deserialize, PartialEq, Clone, Debug, Default, TreeHash)] +struct ForkData { + /// The current version + pub current_version: Version, + /// The genesis validators root + pub genesis_validators_root: B256, +} + +/// The fork parameters +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] +#[allow(clippy::module_name_repetitions)] +pub struct ForkParameters { + /// The genesis fork version + #[schemars(with = "String")] + pub genesis_fork_version: Version, + /// The genesis slot + pub genesis_slot: u64, + /// The altair fork + pub altair: Fork, + /// The bellatrix fork + pub bellatrix: Fork, + /// The capella fork + pub capella: Fork, + /// The deneb fork + pub deneb: Fork, +} + +impl ForkParameters { + /// Returns the fork version based on the `epoch`. + /// NOTE: This implementation is based on capella. + /// + /// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/fork.md#modified-compute_fork_version) + #[must_use] + pub const fn compute_fork_version(&self, epoch: u64) -> Version { + match epoch { + _ if epoch >= self.deneb.epoch => self.deneb.version, + _ if epoch >= self.capella.epoch => self.capella.version, + _ if epoch >= self.bellatrix.epoch => self.bellatrix.version, + _ if epoch >= self.altair.epoch => self.altair.version, + _ => self.genesis_fork_version, + } + } +} + +/// Return the 32-byte fork data root for the `current_version` and `genesis_validators_root`. +/// This is used primarily in signature domains to avoid collisions across forks/chains. +/// +/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_fork_data_root) +#[must_use] +pub fn compute_fork_data_root(current_version: Version, genesis_validators_root: B256) -> B256 { + let fork_data = ForkData { + current_version, + genesis_validators_root, + }; + + fork_data.tree_hash_root() +} diff --git a/packages/ethereum-light-client/src/types/light_client.rs b/packages/ethereum-types/src/consensus/light_client_header.rs similarity index 51% rename from packages/ethereum-light-client/src/types/light_client.rs rename to packages/ethereum-types/src/consensus/light_client_header.rs index b03dd2f0..d5bf6f75 100644 --- a/packages/ethereum-light-client/src/types/light_client.rs +++ b/packages/ethereum-types/src/consensus/light_client_header.rs @@ -1,69 +1,43 @@ -//! This module defines the types used in the light client updates +//! This module defines types related to beacon's light client functionality. -use alloy_primitives::{Address, B256, U256}; +use alloy_primitives::{Address, Bloom, Bytes, B256, U256}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use serde_with::{serde_as, DisplayFromStr}; use tree_hash_derive::TreeHash; -use crate::config::consts::{ - EXECUTION_BRANCH_DEPTH, FINALITY_BRANCH_DEPTH, NEXT_SYNC_COMMITTEE_BRANCH_DEPTH, -}; - use super::{ - sync_committee::{SyncAggregate, SyncCommittee, TrustedSyncCommittee}, - wrappers::{WrappedBloom, WrappedBranch, WrappedBytes}, + merkle::{EXECUTION_BRANCH_DEPTH, FINALITY_BRANCH_DEPTH, NEXT_SYNC_COMMITTEE_BRANCH_DEPTH}, + sync_committee::{SyncAggregate, SyncCommittee}, }; -/// The header of a light client update -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct Header { - /// The trusted sync committee - pub trusted_sync_committee: TrustedSyncCommittee, - /// The consensus update - pub consensus_update: LightClientUpdate, - /// The account update - pub account_update: AccountUpdate, -} - /// A light client update -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] #[allow(clippy::module_name_repetitions)] pub struct LightClientUpdate { /// Header attested to by the sync committee pub attested_header: LightClientHeader, /// Next sync committee corresponding to `attested_header.state_root` - #[serde(default)] // TODO: Check if this can be removed in #143 pub next_sync_committee: Option, /// The branch of the next sync committee - pub next_sync_committee_branch: Option>, + #[schemars(with = "Vec")] + pub next_sync_committee_branch: Option<[B256; NEXT_SYNC_COMMITTEE_BRANCH_DEPTH]>, /// Finalized header corresponding to `attested_header.state_root` pub finalized_header: LightClientHeader, /// Branch of the finalized header - pub finality_branch: WrappedBranch, + #[schemars(with = "Vec")] + pub finality_branch: [B256; FINALITY_BRANCH_DEPTH], /// Sync committee aggregate signature pub sync_aggregate: SyncAggregate, /// Slot at which the aggregate signature was created (untrusted) + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub signature_slot: u64, } -/// The account update -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct AccountUpdate { - /// The account proof - pub account_proof: AccountProof, -} - -/// The account proof -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] -pub struct AccountProof { - /// The account storage root - #[serde(with = "ethereum_utils::base64::fixed_size")] - pub storage_root: B256, - /// The account proof - pub proof: Vec, -} - /// The header of a light client -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default, TreeHash)] +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default, TreeHash)] #[allow(clippy::module_name_repetitions)] pub struct LightClientHeader { /// The beacon block header @@ -71,74 +45,92 @@ pub struct LightClientHeader { /// The execution payload header pub execution: ExecutionPayloadHeader, /// The execution branch - pub execution_branch: WrappedBranch, + #[schemars(with = "Vec")] + pub execution_branch: [B256; EXECUTION_BRANCH_DEPTH], } /// The beacon block header -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default, TreeHash)] +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default, TreeHash)] pub struct BeaconBlockHeader { /// The slot to which this block corresponds + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub slot: u64, /// The index of validator in validator registry + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub proposer_index: u64, /// The signing merkle root of the parent `BeaconBlock` - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub parent_root: B256, /// The tree hash merkle root of the `BeaconState` for the `BeaconBlock` - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub state_root: B256, /// The tree hash merkle root of the `BeaconBlockBody` for the `BeaconBlock` - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub body_root: B256, } /// Header to track the execution block -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default, TreeHash)] +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default, TreeHash)] pub struct ExecutionPayloadHeader { /// The parent hash of the execution payload header - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub parent_hash: B256, /// Block fee recipient - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub fee_recipient: Address, /// The state root - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub state_root: B256, /// The root of the receipts trie - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub receipts_root: B256, /// The logs bloom filter - pub logs_bloom: WrappedBloom, + #[schemars(with = "String")] + pub logs_bloom: Bloom, /// The previous Randao value, used to compute the randomness on the execution layer. - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub prev_randao: B256, /// The block number of the execution payload + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub block_number: u64, /// Execution block gas limit + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub gas_limit: u64, /// Execution block gas used - #[serde(default)] + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub gas_used: u64, /// The timestamp of the execution payload + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub timestamp: u64, /// The extra data of the execution payload - pub extra_data: WrappedBytes, + #[schemars(with = "String")] + pub extra_data: Bytes, /// Block base fee per gas - #[serde(with = "ethereum_utils::base64::uint256")] + #[schemars(with = "String")] pub base_fee_per_gas: U256, /// The block hash - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub block_hash: B256, /// SSZ hash tree root of the transaction list - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub transactions_root: B256, /// Tree root of the withdrawals list - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub withdrawals_root: B256, /// Blob gas used (new in Deneb) - #[serde(default)] + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub blob_gas_used: u64, /// Excess blob gas (new in Deneb) - #[serde(default)] + #[serde_as(as = "DisplayFromStr")] + #[schemars(with = "String")] pub excess_blob_gas: u64, } diff --git a/packages/ethereum-types/src/consensus/merkle.rs b/packages/ethereum-types/src/consensus/merkle.rs new file mode 100644 index 000000000..1c2e35c0 --- /dev/null +++ b/packages/ethereum-types/src/consensus/merkle.rs @@ -0,0 +1,38 @@ +//! This module defines constants related to merkle trees in the Ethereum consensus. + +// https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md#constants +// REVIEW: Is it possible to implement get_generalized_index in const rust? + +// https://github.com/ethereum/consensus-specs/blob/dev/ssz/merkle-proofs.md +/// `get_generalized_index(BeaconState, "finalized_checkpoint", "root")` +pub const FINALIZED_ROOT_INDEX: u64 = 105; +/// `get_generalized_index(BeaconState, "current_sync_committee")` +pub const CURRENT_SYNC_COMMITTEE_INDEX: u64 = 54; +/// `get_generalized_index(BeaconState, "next_sync_committee")` +pub const NEXT_SYNC_COMMITTEE_INDEX: u64 = 55; +/// `get_generalized_index(BeaconBlockBody, "execution_payload")` +pub const EXECUTION_PAYLOAD_INDEX: u64 = 25; + +// Branch depths for different merkle trees related to ethereum consensus + +/// The depth of the merkle tree for execution payloads. +pub const EXECUTION_BRANCH_DEPTH: usize = floorlog2(EXECUTION_PAYLOAD_INDEX); +/// The depth of the merkle tree for the next sync committee. +pub const NEXT_SYNC_COMMITTEE_BRANCH_DEPTH: usize = floorlog2(NEXT_SYNC_COMMITTEE_INDEX); +/// The depth of the merkle tree for the finalized root. +pub const FINALITY_BRANCH_DEPTH: usize = floorlog2(FINALIZED_ROOT_INDEX); + +/// Values that are constant across all configurations. +/// +#[must_use] +pub const fn get_subtree_index(idx: u64) -> u64 { + idx % 2_u64.pow(idx.ilog2()) +} + +/// Convenience function safely to call [`u64::ilog2`] and convert the result into a usize. +#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] +#[must_use] +const fn floorlog2(n: u64) -> usize { + // conversion is safe since usize is either 32 or 64 bits as per cfg above + n.ilog2() as usize +} diff --git a/packages/ethereum-types/src/consensus/mod.rs b/packages/ethereum-types/src/consensus/mod.rs new file mode 100644 index 000000000..6dd137b4 --- /dev/null +++ b/packages/ethereum-types/src/consensus/mod.rs @@ -0,0 +1,10 @@ +//! This module contains types assosicated with the beacon api and Ethereum consensus. + +pub mod bls; +pub mod domain; +pub mod fork; +pub mod light_client_header; +pub mod merkle; +pub mod signing_data; +pub mod slot; +pub mod sync_committee; diff --git a/packages/ethereum-light-client/src/types/signing_data.rs b/packages/ethereum-types/src/consensus/signing_data.rs similarity index 100% rename from packages/ethereum-light-client/src/types/signing_data.rs rename to packages/ethereum-types/src/consensus/signing_data.rs diff --git a/packages/ethereum-types/src/consensus/slot.rs b/packages/ethereum-types/src/consensus/slot.rs new file mode 100644 index 000000000..92a8adc4 --- /dev/null +++ b/packages/ethereum-types/src/consensus/slot.rs @@ -0,0 +1,36 @@ +//! This module provides functions to compute slot and epoch from timestamp. + +/// The genesis slot is the slot number of the first slot in the chain. +pub const GENESIS_SLOT: u64 = 0; + +/// Returns the computed slot at a given `timestamp_seconds`. +#[must_use] +pub fn compute_slot_at_timestamp( + genesis_time: u64, + seconds_per_slot: u64, + timestamp_seconds: u64, +) -> Option { + timestamp_seconds + .checked_sub(genesis_time)? + .checked_div(seconds_per_slot)? + .checked_add(GENESIS_SLOT) +} + +/// Returns the epoch at a given `slot`. +/// +/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_epoch_at_slot) +#[allow(clippy::module_name_repetitions)] +#[must_use] +pub const fn compute_epoch_at_slot(slots_per_epoch: u64, slot: u64) -> u64 { + slot / slots_per_epoch +} + +/// Returns the timestamp at a `slot`, respect to `genesis_time`. +/// +/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#compute_timestamp_at_slot) +#[allow(clippy::module_name_repetitions)] +#[must_use] +pub const fn compute_timestamp_at_slot(seconds_per_slot: u64, genesis_time: u64, slot: u64) -> u64 { + let slots_since_genesis = slot - GENESIS_SLOT; + genesis_time + (slots_since_genesis * seconds_per_slot) +} diff --git a/packages/ethereum-types/src/consensus/sync_committee.rs b/packages/ethereum-types/src/consensus/sync_committee.rs new file mode 100644 index 000000000..170f1859 --- /dev/null +++ b/packages/ethereum-types/src/consensus/sync_committee.rs @@ -0,0 +1,183 @@ +//! Types related to the sync committee + +use alloy_primitives::{Bytes, FixedBytes}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use tree_hash_derive::TreeHash; + +use super::{ + bls::{BlsPublicKey, BlsSignature, BLS_PUBLIC_KEY_BYTES_LEN}, + slot::compute_epoch_at_slot, +}; + +/// The sync committee data +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default, TreeHash)] +pub struct SyncCommittee { + /// The public keys of the sync committee + #[schemars(with = "Vec")] + pub pubkeys: Vec>, + /// The aggregate public key of the sync committee + #[schemars(with = "String")] + pub aggregate_pubkey: BlsPublicKey, +} + +/// The sync committee aggregate +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] +pub struct SyncAggregate { + /// The bits representing the sync committee's participation. + #[schemars(with = "String")] + pub sync_committee_bits: Bytes, // TODO: Consider changing this to a BitVector + /// The aggregated signature of the sync committee. + #[schemars(with = "String")] + pub sync_committee_signature: BlsSignature, +} + +impl SyncAggregate { + /// Returns the number of bits that are set to `true`. + #[must_use] + pub fn num_sync_committe_participants(&self) -> usize { + self.sync_committee_bits + .iter() + .map(|byte| byte.count_ones()) + .sum::() as usize + } + + /// Returns the size of the sync committee. + pub fn sync_committee_size(&self) -> usize { + self.sync_committee_bits.len() * 8 + } + + /// Returns if at least 2/3 of the sync committee signed + /// + /// + pub fn validate_signature_supermajority(&self) -> bool { + self.num_sync_committe_participants() * 3 >= self.sync_committee_size() * 2 + } +} + +/// Returns the sync committee period at a given `epoch`. +/// +/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/validator.md#sync-committee) +#[must_use] +pub const fn compute_sync_committee_period( + epochs_per_sync_committee_period: u64, + epoch: u64, +) -> u64 { + epoch / epochs_per_sync_committee_period +} + +/// Returns the sync committee period at a given `slot`. +/// +/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md#compute_sync_committee_period_at_slot) +#[must_use] +pub const fn compute_sync_committee_period_at_slot( + slots_per_epoch: u64, + epochs_per_sync_committee_period: u64, + slot: u64, +) -> u64 { + compute_sync_committee_period( + epochs_per_sync_committee_period, + compute_epoch_at_slot(slots_per_epoch, slot), + ) +} + +#[cfg(test)] +#[allow(clippy::pedantic)] +mod test { + use alloy_primitives::{hex::FromHex, B256}; + use tree_hash::TreeHash; + + use crate::consensus::{ + bls::BlsSignature, + sync_committee::{SyncAggregate, SyncCommittee}, + }; + + #[test] + fn test_sync_committee_tree_hash_root() { + let sync_committee_json = r#"{ + "pubkeys": [ + "0x81ea9f74ef7d935b807474e38954ae3934856219a23e074954b2e860c5a3c400f9aedb42cd27cb4ceb697ca36d1e58cb", + "0x84d08d58c31bcd3cddf93e13d6f50203897384afa34644bff1135efe8e01c81c6a91ca6c234bb1e51ca32e41b828aaf9", + "0xa759f6bcca8f35fcaadc406cc4b828c016c0ed23882987a79f52f2933b5cedefe24e31df6fd0d38e8a802dbafd750d01", + "0x8d028a021c5c31a1aa1e18eda74cfaf0fba1c454c17c2e0fc730dd07a19d0c77f7a905d54017292f3e800ca06b6977cd", + "0xb27ad13afc8ff30e087797b344c8382bb0a84447549f1b0274059ddd652276e7b148ba8808a10cc45746762957d4efbe", + "0xa804e4fa8d1391a9d078aa93985a12503b84ce4f6f1f9e70ab7fca421e1cf972538666299d4c1bfc39327b469b2db7a8", + "0x996323af7e545fb6363ace53f1538c7ddc3eb0d985b2479da3ee4ace10cbc393b518bf02d1a2ddb2f5bdf09b473933ea", + "0x96947de9e6068c22a7716656a2755a9551b0b66c2d1a741bf84a088fe1e840e992dc39861bf8ba3e8d5b6d21e8f57e64", + "0xae5302796cfeca685eaf37ffd5baeb32121f2f07415bee26cc0051ee513ff3932d2c365e3d9f87b0949a5980445cb64c", + "0x996d10c3026b9344532b06c70a596f972a1e779a1f6106d3da9f6ba376bbf7ec82d2f52629e5dbf3f7d03b00f6b862af", + "0xa35c6004f387430c3797ab0157af7b824c8fe106241c7cdeb897d900c0f9e4bb945ff2a6b88cbd10e35ec48aaa554ecb", + "0xabd12678c73463ecea5867a80caf256d5c5e6ba53ff188b143a4d5be83365ad257edf39eaa1ba8753c4cdf4c632ff99e", + "0x81fa222737fe818b43f55f209f42adaee135b2801d02709617fc88c2871852358260ace97cf323e761b5cc18bc7325b3", + "0xab64f900c770e2b99de6b86b4390bbd1579bd48dccec55800adbcf52e006f22128e9971bbf3a92cc0105b0974849935a", + "0x930743bfc7e18d3bd7351eaa74f477505268c1e4e1fd1ca3ccccdefb2595517343bbb8f5589c435c3c39323a4c0080f8", + "0xab72cbc6575c3179680a58c0ecd5de46d2678ccbafc016746348ee5688edcb21b4e15bd37c70c508e3ea73103c2d566b", + "0x84dc37ca3cd621d3da0fbdd11ca84021e0cd81a73d772dd6fcf19775b72eb64af4e573213378ccee0915dde92ac83ba6", + "0x8d46e9aa0c1986056e407efc7013b7f271027d3c98ce96667faa98074ab0588a61681faf78644c11819a459a95689dab", + "0xb5e898a1fc06d51c695712928f44646d15451340d1b3e480a40f03250160bc07d3b6691ec94361dd524d59d9df7f76d3", + "0xa4ee6d37dc259cbb5237e4265429a9fd8ab5643af81628cc101e0d8b4a333ef2618a37df89ea3f92b5ea4333d8cda393", + "0x8aa5bbee21e98c7b9e7a4c8ea45aa99f89e22992fa4fc2d73869d77da4cc8a05b25b61931ff521986677dd7f7159e8e6", + "0x91709ee06497b9ac049325853d64947290189a8c2322e3a500d91e23ea02dc158b6db63ae558b3b7670357a151cd6071", + "0x8fda66b8607af873f4c2c8218dd3ffc7940d411047eb199b5cd010156af4845d21dd2e65b0e44cfffb5e78271e9bb29d", + "0xb72cb106b7bc1ecae219e0ae1830a509ed18a042b56a2779f4033419de69ba8ae8017090caed1f5377bfa68506157360", + "0x896a51e0b0de0f29029af38b796db1f1e6d0f9f9085ade40a313a60cb723fa3d58f6587175570086c4fbf0fe5331f1c8", + "0xaaf6c1251e73fb600624937760fef218aace5b253bf068ed45398aeb29d821e4d2899343ddcbbe37cb3f6cf500dff26c", + "0x9918433b8f0bc5e126da3fdef8d7b71456492dae6d2d07f2e10c7a7f852046f84ed0ce6d3bfec42200670db27dcf3037", + "0xa03c2a82374e04b2e0594c4ce14fb3f225b46f13188f0d8002a523c7dcfb939ae4856053c2c9c695374d7c3685df1ca5", + "0x8d8985e5dd341c9035b37bf7391c5944c28131b47c7d5359d18fca598010ba9a63e27c55e6b421a807038c320564db17", + "0xb24391aa97bfff29adc935d06a2b6d583433caf82f92de1980e0192d3b270323bdbf24b86dc61520a40c419dde3df4b3", + "0xaf61f263addfb41c46d66e60ecfb598a5942f648f58718b6b4e4c92019fdb12328efbff98703134bcf28e9c1fab4bb60", + "0xb63f327df68581cdc02a66c1c65e906a06a1a3a8d7a6e38f7b6da944e8e6cc2db85fced5327d8c12945ceb33018272ca" + ], + "aggregate_pubkey": "0xa7b9141877f397e9d2a36cd86407387bbcec6d557b30ccd9e62adca217e458d7495b581e048fa1084218cadf8f45b9ff" + }"#; + let sync_committee: SyncCommittee = serde_json::from_str(sync_committee_json).unwrap(); + assert_ne!(sync_committee, SyncCommittee::default()); + + let actual_tree_hash_root = sync_committee.tree_hash_root(); + let expected_tree_hash_root = + B256::from_hex("0x5361eb179f7499edbf09e514d317002f1d365d72e14a56c931e9edaccca3ff29") + .unwrap(); + + assert_eq!(expected_tree_hash_root, actual_tree_hash_root); + } + + #[test] + fn test_validate_signature_supermajority() { + // not supermajority + let sync_aggregate = SyncAggregate { + sync_committee_bits: vec![0b10001001].into(), + sync_committee_signature: BlsSignature::default(), + }; + assert_eq!(sync_aggregate.num_sync_committe_participants(), 3); + assert_eq!(sync_aggregate.sync_committee_size(), 8); + assert!(!sync_aggregate.validate_signature_supermajority()); + + // not supermajority + let sync_aggregate = SyncAggregate { + sync_committee_bits: vec![0b10000001, 0b11111111, 0b00010000, 0b00000000].into(), + sync_committee_signature: BlsSignature::default(), + }; + assert_eq!(sync_aggregate.num_sync_committe_participants(), 11); + assert_eq!(sync_aggregate.sync_committee_size(), 32); + assert!(!sync_aggregate.validate_signature_supermajority()); + + // not supermajority + let sync_aggregate = SyncAggregate { + sync_committee_bits: vec![0b11101001, 0b11111111, 0b01010000, 0b01111110].into(), + sync_committee_signature: BlsSignature::default(), + }; + assert_eq!(sync_aggregate.num_sync_committe_participants(), 21); + assert_eq!(sync_aggregate.sync_committee_size(), 32); + assert!(!sync_aggregate.validate_signature_supermajority()); + + // supermajority + let sync_aggregate = SyncAggregate { + sync_committee_bits: vec![0b11101001, 0b11111111, 0b01011000, 0b01111110].into(), + sync_committee_signature: BlsSignature::default(), + }; + assert_eq!(sync_aggregate.num_sync_committe_participants(), 22); + assert_eq!(sync_aggregate.sync_committee_size(), 32); + assert!(sync_aggregate.validate_signature_supermajority()); + } +} diff --git a/packages/ethereum-types/src/execution/account_proof.rs b/packages/ethereum-types/src/execution/account_proof.rs new file mode 100644 index 000000000..15d24f3d --- /dev/null +++ b/packages/ethereum-types/src/execution/account_proof.rs @@ -0,0 +1,16 @@ +//! This module defines [`AccountProof`]. + +use alloy_primitives::{Bytes, B256}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +/// The account proof +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] +pub struct AccountProof { + /// The account storage root + #[schemars(with = "String")] + pub storage_root: B256, + /// The account proof + #[schemars(with = "Vec")] + pub proof: Vec, +} diff --git a/packages/ethereum-types/src/execution/mod.rs b/packages/ethereum-types/src/execution/mod.rs new file mode 100644 index 000000000..3f80e63e --- /dev/null +++ b/packages/ethereum-types/src/execution/mod.rs @@ -0,0 +1,4 @@ +//! This module contains types assosicated with Ethereum execution and api. + +pub mod account_proof; +pub mod storage_proof; diff --git a/packages/ethereum-light-client/src/types/storage_proof.rs b/packages/ethereum-types/src/execution/storage_proof.rs similarity index 51% rename from packages/ethereum-light-client/src/types/storage_proof.rs rename to packages/ethereum-types/src/execution/storage_proof.rs index ff4d2ac1..54bca985 100644 --- a/packages/ethereum-light-client/src/types/storage_proof.rs +++ b/packages/ethereum-types/src/execution/storage_proof.rs @@ -1,19 +1,19 @@ //! This module defines [`StorageProof`]. -use alloy_primitives::{B256, U256}; +use alloy_primitives::{Bytes, B256, U256}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use super::wrappers::WrappedBytes; - /// The key-value storage proof for a smart contract account -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Default)] +#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug, Default)] pub struct StorageProof { /// The key of the storage - #[serde(with = "ethereum_utils::base64::fixed_size")] + #[schemars(with = "String")] pub key: B256, /// The value of the storage - #[serde(with = "ethereum_utils::base64::uint256")] + #[schemars(with = "String")] pub value: U256, /// The proof of the storage - pub proof: Vec, + #[schemars(with = "Vec")] + pub proof: Vec, } diff --git a/packages/ethereum-types/src/lib.rs b/packages/ethereum-types/src/lib.rs new file mode 100644 index 000000000..60155ae8 --- /dev/null +++ b/packages/ethereum-types/src/lib.rs @@ -0,0 +1,11 @@ +#![doc = include_str!("../README.md")] +#![deny( + clippy::nursery, + clippy::pedantic, + warnings, + missing_docs, + unused_crate_dependencies +)] + +pub mod consensus; +pub mod execution; diff --git a/packages/ethereum-utils/Cargo.toml b/packages/ethereum-utils/Cargo.toml index 6e808638..34e81c4c 100644 --- a/packages/ethereum-utils/Cargo.toml +++ b/packages/ethereum-utils/Cargo.toml @@ -5,7 +5,3 @@ edition = { workspace = true } repository = { workspace = true } [dependencies] -alloy-primitives = { workspace = true, default-features = false } -base64 = { workspace = true } -serde = { workspace = true } -thiserror = { workspace = true } diff --git a/packages/ethereum-utils/README.md b/packages/ethereum-utils/README.md new file mode 100644 index 000000000..5050b951 --- /dev/null +++ b/packages/ethereum-utils/README.md @@ -0,0 +1,3 @@ +# Utils + +Utils package with generic rust utilities diff --git a/packages/ethereum-utils/src/base64.rs b/packages/ethereum-utils/src/base64.rs deleted file mode 100644 index d7a0809f..000000000 --- a/packages/ethereum-utils/src/base64.rs +++ /dev/null @@ -1,255 +0,0 @@ -use alloy_primitives::B256; -use base64::{prelude::*, DecodeError}; - -pub trait FromBase64: Sized { - fn from_base64(s: &str) -> Result; -} - -pub fn from_base64(s: &str) -> Result, DecodeError> { - BASE64_STANDARD.decode(s.as_bytes()) -} - -impl FromBase64 for B256 { - fn from_base64(s: &str) -> Result { - let data = from_base64(s)?; - Ok(B256::from_slice(data.as_slice())) - } -} - -pub mod fixed_size { - use base64::prelude::*; - use serde::{de, Deserialize, Deserializer}; - - use super::from_base64; - - pub fn serialize>(data: T, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(&BASE64_STANDARD.encode(data)) - } - - pub fn deserialize<'de, D, T, const N: usize>(deserializer: D) -> Result - where - D: Deserializer<'de>, - T: TryFrom<[u8; N]>, - { - let s = String::deserialize(deserializer)?; - let decoded = from_base64(&s).map_err(de::Error::custom)?; - - let fixed_sized: [u8; N] = decoded - .as_slice() - .try_into() - .map_err(|_| de::Error::custom("Invalid base64 data"))?; - T::try_from(fixed_sized).map_err(|_| de::Error::custom("Invalid base64 data")) - } - - pub mod vec { - use base64::prelude::*; - use serde::{de, Deserialize, Deserializer, Serializer}; - - use crate::base64::from_base64; - - pub fn serialize>( - #[allow(clippy::ptr_arg)] // required by serde - bytes: &Vec, - serializer: S, - ) -> Result { - serializer.collect_seq(bytes.iter().map(|b| BASE64_STANDARD.encode(b))) - } - - pub fn deserialize<'de, D, T, const N: usize>(deserializer: D) -> Result, D::Error> - where - D: Deserializer<'de>, - T: TryFrom<[u8; N]>, - { - let vec = Vec::::deserialize(deserializer)?; - vec.into_iter() - .map(|s| { - let decoded = from_base64(&s).map_err(de::Error::custom)?; - let fixed_sized: [u8; N] = decoded - .as_slice() - .try_into() - .map_err(|_| de::Error::custom("Invalid base64 data"))?; - T::try_from(fixed_sized).map_err(|_| de::Error::custom("Invalid base64 data")) - }) - .collect() - } - - pub mod fixed_size { - use base64::prelude::*; - use serde::{de, Deserialize, Deserializer, Serializer}; - - use crate::base64::from_base64; - - pub fn serialize, const NN: usize>( - #[allow(clippy::ptr_arg)] // required by serde - bytes: &[T; NN], - serializer: S, - ) -> Result { - serializer.collect_seq(bytes.iter().map(|b| BASE64_STANDARD.encode(b))) - } - - pub fn deserialize<'de, D, T, const N: usize, const NN: usize>( - deserializer: D, - ) -> Result<[T; NN], D::Error> - where - D: Deserializer<'de>, - T: TryFrom<[u8; N]>, - { - let vec = Vec::::deserialize(deserializer)?; - let items: Vec = vec - .into_iter() - .map(|s| { - let decoded = from_base64(&s).map_err(de::Error::custom)?; - let fixed_sized: [u8; N] = decoded - .as_slice() - .try_into() - .map_err(|_| de::Error::custom("Invalid base64 data"))?; - T::try_from(fixed_sized) - .map_err(|_| de::Error::custom("Invalid base64 data")) - }) - .collect::, _>>()?; - - items - .try_into() - .map_err(|_| de::Error::custom("Invalid base64 data")) - } - } - - pub mod fixed_size_with_option { - use base64::prelude::*; - use serde::{de, Deserialize, Deserializer, Serializer}; - - use crate::base64::from_base64; - - pub fn serialize, const NN: usize>( - #[allow(clippy::ptr_arg)] // required by serde - bytes: &Option<[T; NN]>, - serializer: S, - ) -> Result { - if let Some(bytes) = bytes { - serializer.collect_seq(bytes.iter().map(|b| BASE64_STANDARD.encode(b))) - } else { - serializer.collect_seq(None::) - } - } - - pub fn deserialize<'de, D, T, const N: usize, const NN: usize>( - deserializer: D, - ) -> Result, D::Error> - where - D: Deserializer<'de>, - T: TryFrom<[u8; N]>, - { - let vec = Vec::::deserialize(deserializer)?; - if vec.is_empty() { - return Ok(None); - } - let items: Vec = vec - .into_iter() - .map(|s| { - let decoded = from_base64(&s).map_err(de::Error::custom)?; - let fixed_sized: [u8; N] = decoded - .as_slice() - .try_into() - .map_err(|_| de::Error::custom("Invalid base64 data"))?; - T::try_from(fixed_sized) - .map_err(|_| de::Error::custom("Invalid base64 data")) - }) - .collect::, _>>()?; - - let data = items - .try_into() - .map_err(|_| de::Error::custom("Invalid base64 data"))?; - - Ok(Some(data)) - } - } - } -} - -pub mod uint256 { - use alloy_primitives::U256; - use base64::{prelude::BASE64_STANDARD, Engine}; - use serde::{de, Deserialize, Deserializer}; - - use super::from_base64; - - pub fn serialize(data: &U256, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(&BASE64_STANDARD.encode(data.to_be_bytes_vec())) - } - - pub fn deserialize<'de, D>(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s = String::deserialize(deserializer)?; - let decoded = from_base64(&s).map_err(de::Error::custom)?; - - Ok(U256::from_be_slice(decoded.as_slice())) - } -} - -pub mod bytes { - use alloy_primitives::Bytes; - use base64::{prelude::BASE64_STANDARD, Engine}; - use serde::{de, Deserialize, Deserializer}; - - pub fn serialize(data: &Bytes, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(&BASE64_STANDARD.encode(data)) - } - - pub fn deserialize<'de, D>(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s = String::deserialize(deserializer)?; - let decoded = BASE64_STANDARD - .decode(s.as_bytes()) - .map_err(de::Error::custom)?; - Ok(Bytes::from(decoded)) - } -} - -pub mod option_with_default { - use base64::{prelude::BASE64_STANDARD, Engine}; - use serde::{de, Deserialize, Deserializer}; - - use super::from_base64; - - pub fn serialize>(data: &Option, serializer: S) -> Result - where - S: serde::Serializer, - { - if let Some(data) = data { - serializer.serialize_str(&BASE64_STANDARD.encode(data)) - } else { - serializer.serialize_str("") - } - } - - pub fn deserialize<'de, D, T>(deserializer: D) -> Result, D::Error> - where - D: Deserializer<'de>, - for<'a> T: TryFrom<&'a [u8]>, - { - let s = String::deserialize(deserializer)?; - if s.is_empty() { - return Ok(None); - } - - let decoded = from_base64(&s).map_err(de::Error::custom)?; - - let data: T = T::try_from(decoded.as_slice()) - .map_err(|_| de::Error::custom("Invalid base64 data"))?; - - Ok(Some(data)) - } -} diff --git a/packages/ethereum-utils/src/ensure.rs b/packages/ethereum-utils/src/ensure.rs deleted file mode 100644 index 08e6e2a7..000000000 --- a/packages/ethereum-utils/src/ensure.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[macro_export] -macro_rules! ensure { - ($cond:expr, $err:expr) => { - if !$cond { - return Err($err); - } - }; -} diff --git a/packages/ethereum-utils/src/error.rs b/packages/ethereum-utils/src/error.rs deleted file mode 100644 index 377f57bc..000000000 --- a/packages/ethereum-utils/src/error.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(thiserror::Error, Debug, Clone, PartialEq)] -pub enum EthereumUtilsError { - #[error("failed to compute slot at timestamp with \ - (timestamp ({timestamp}) - genesis ({genesis})) / seconds_per_slot ({seconds_per_slot}) + genesis_slot ({genesis_slot})" - )] - FailedToComputeSlotAtTimestamp { - timestamp: u64, - genesis: u64, - seconds_per_slot: u64, - genesis_slot: u64, - }, -} diff --git a/packages/ethereum-utils/src/hex.rs b/packages/ethereum-utils/src/hex.rs deleted file mode 100644 index a71f0cce..000000000 --- a/packages/ethereum-utils/src/hex.rs +++ /dev/null @@ -1,61 +0,0 @@ -use alloy_primitives::{hex, U256}; - -// TODO: Unit test -pub fn to_hex>(data: T) -> String { - let data = data.as_ref(); - - let encoded = if data.is_empty() { - "0".to_string() - } else { - hex::encode(data) - }; - - format!("0x{encoded}") -} - -pub trait FromBeHex { - fn from_be_hex(hex_str: &str) -> Self; -} - -// TODO: Unit test sad paths (i.e. should this check for valid be?) -impl FromBeHex for U256 { - fn from_be_hex(hex_str: &str) -> Self { - let data = hex::decode(hex_str).unwrap(); - U256::from_be_slice(data.as_slice()) - } -} - -#[cfg(test)] -mod test { - use alloy_primitives::{hex::FromHex, B256, U256}; - - use super::FromBeHex; - - #[test] - // This is primarily to document how to convert the alloy primitives to and from hex - fn test_alloy_primitive_hex() { - // From hex string to B256 - let expected_hex = "0x75d7411cb01daad167713b5a9b7219670f0e500653cbbcd45cfe1bfe04222459"; - let b256 = B256::from_hex(expected_hex).unwrap(); - let b256_hex = format!("0x{b256:x}"); - assert_eq!(expected_hex, b256_hex); - - // From hex string to U256 - let u256 = U256::from_be_hex(expected_hex); - let u256_hex = format!("0x{u256:x}"); - assert_eq!(expected_hex, u256_hex); - - // From B256 to U256 to hex string - let u256: U256 = b256.into(); - let u256_hex = format!("0x{u256:x}"); - assert_eq!(expected_hex, u256_hex); - } - - #[test] - fn test_to_be_hex() { - let be_hex_str = "0x0000000000000000000000000000000000000000000000000000000000000001"; - let u256 = U256::from_be_hex(be_hex_str); - let num: u64 = u256.to_base_le(10).reduce(|acc, n| acc + n).unwrap(); - assert_eq!(1, num); - } -} diff --git a/packages/ethereum-utils/src/lib.rs b/packages/ethereum-utils/src/lib.rs index 5e03d58f..cc26879c 100644 --- a/packages/ethereum-utils/src/lib.rs +++ b/packages/ethereum-utils/src/lib.rs @@ -1,7 +1,20 @@ -pub mod base64; -pub mod error; -pub mod hex; -pub mod slot; +//! A collection of utilities for Rust projects. -#[macro_use] -pub mod ensure; +#![doc = include_str!("../README.md")] +#![deny( + clippy::nursery, + clippy::pedantic, + warnings, + missing_docs, + unused_crate_dependencies +)] + +/// Ensure that a condition is true, otherwise return an error. +#[macro_export] +macro_rules! ensure { + ($cond:expr, $err:expr) => { + if !$cond { + return Err($err); + } + }; +} diff --git a/packages/ethereum-utils/src/slot.rs b/packages/ethereum-utils/src/slot.rs deleted file mode 100644 index 055fc6ea..000000000 --- a/packages/ethereum-utils/src/slot.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::error::EthereumUtilsError; - -pub const GENESIS_SLOT: u64 = 0; - -pub fn compute_slot_at_timestamp( - genesis_time: u64, - seconds_per_slot: u64, - timestamp_seconds: u64, -) -> Result { - checked_compute_slot_at_timestamp(genesis_time, seconds_per_slot, timestamp_seconds).ok_or( - EthereumUtilsError::FailedToComputeSlotAtTimestamp { - timestamp: timestamp_seconds, - genesis: genesis_time, - seconds_per_slot, - genesis_slot: GENESIS_SLOT, - }, - ) -} - -fn checked_compute_slot_at_timestamp( - genesis_time: u64, - seconds_per_slot: u64, - timestamp_seconds: u64, -) -> Option { - timestamp_seconds - .checked_sub(genesis_time)? - .checked_div(seconds_per_slot)? - .checked_add(GENESIS_SLOT) -} - -/// Returns the epoch at a given `slot`. -/// -/// [See in consensus-spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_epoch_at_slot) -pub fn compute_epoch_at_slot(slots_per_epoch: u64, slot: u64) -> u64 { - slot / slots_per_epoch -} diff --git a/packages/relayer-lib/Cargo.toml b/packages/relayer-lib/Cargo.toml index 4429f830..4f5e3dc1 100644 --- a/packages/relayer-lib/Cargo.toml +++ b/packages/relayer-lib/Cargo.toml @@ -32,6 +32,5 @@ ibc-proto-eureka = { workspace = true } ibc-core-host-types = { workspace = true } alloy = { workspace = true, features = ["full", "node-bindings"] } -alloy-contract = { workspace = true } sp1-sdk = { workspace = true, default-features = true } diff --git a/packages/sp1-ics07-tendermint-utils/Cargo.toml b/packages/sp1-ics07-tendermint-utils/Cargo.toml index 2e448600..9269a95e 100644 --- a/packages/sp1-ics07-tendermint-utils/Cargo.toml +++ b/packages/sp1-ics07-tendermint-utils/Cargo.toml @@ -8,7 +8,6 @@ license = { workspace = true } [dependencies] anyhow = { workspace = true, features = ["std"] } async-trait = { workspace = true } -serde = { workspace = true } prost = { workspace = true } cosmos-sdk-proto = { workspace = true } tendermint-rpc = { workspace = true } diff --git a/packages/tree_hash/src/impls.rs b/packages/tree_hash/src/impls.rs index ec328aa8..f1d87c0c 100644 --- a/packages/tree_hash/src/impls.rs +++ b/packages/tree_hash/src/impls.rs @@ -1,5 +1,5 @@ use super::*; -use alloy_primitives::{Address, B256, U128, U256}; +use alloy_primitives::{Bloom, Bytes, FixedBytes, B256, U128, U256}; use std::sync::Arc; fn int_to_hash256(int: u64) -> Hash256 { @@ -103,6 +103,36 @@ impl TreeHash for [u8; 48] { } } +/// Only valid for byte types less than 32 bytes. +macro_rules! impl_for_lt_32byte_fixed_bytes { + ($len: expr) => { + impl TreeHash for FixedBytes<$len> { + fn tree_hash_type() -> TreeHashType { + TreeHashType::Vector + } + + fn tree_hash_packed_encoding(&self) -> PackedEncoding { + let mut result = [0; 32]; + result[0..$len].copy_from_slice(self.as_slice()); + PackedEncoding::from_slice(&result) + } + + fn tree_hash_packing_factor() -> usize { + HASHSIZE / $len + } + + fn tree_hash_root(&self) -> Hash256 { + let mut result = [0; 32]; + result[0..$len].copy_from_slice(self.as_slice()); + Hash256::from_slice(&result) + } + } + }; +} + +impl_for_lt_32byte_fixed_bytes!(20); +impl_for_lt_32byte_fixed_bytes!(32); + impl TreeHash for U128 { fn tree_hash_type() -> TreeHashType { TreeHashType::Basic @@ -139,61 +169,121 @@ impl TreeHash for U256 { } } -impl TreeHash for Address { +impl TreeHash for Arc { fn tree_hash_type() -> TreeHashType { - TreeHashType::Vector + T::tree_hash_type() } fn tree_hash_packed_encoding(&self) -> PackedEncoding { - let mut result = [0; 32]; - result[0..20].copy_from_slice(self.as_slice()); - PackedEncoding::from_slice(&result) + self.as_ref().tree_hash_packed_encoding() } fn tree_hash_packing_factor() -> usize { - 1 + T::tree_hash_packing_factor() } fn tree_hash_root(&self) -> Hash256 { - let mut result = [0; 32]; - result[0..20].copy_from_slice(self.as_slice()); - Hash256::from_slice(&result) + self.as_ref().tree_hash_root() } } -impl TreeHash for B256 { +impl TreeHash for Bytes { fn tree_hash_type() -> TreeHashType { - TreeHashType::Vector + TreeHashType::List } fn tree_hash_packed_encoding(&self) -> PackedEncoding { - PackedEncoding::from_slice(self.as_slice()) + unreachable!("List should never be packed.") } fn tree_hash_packing_factor() -> usize { - 1 + unreachable!("List should never be packed.") } fn tree_hash_root(&self) -> Hash256 { - *self + let leaves = self.len().div_ceil(BYTES_PER_CHUNK); + + let mut hasher = MerkleHasher::with_leaves(leaves); + for item in self { + hasher.write(item.tree_hash_root()[..1].as_ref()).unwrap(); + } + + mix_in_length(&hasher.finish().unwrap(), self.len()) } } -impl TreeHash for Arc { +impl TreeHash for Bloom { fn tree_hash_type() -> TreeHashType { - T::tree_hash_type() + TreeHashType::List } fn tree_hash_packed_encoding(&self) -> PackedEncoding { - self.as_ref().tree_hash_packed_encoding() + unreachable!("List should never be packed.") } fn tree_hash_packing_factor() -> usize { - T::tree_hash_packing_factor() + unreachable!("List should never be packed.") } fn tree_hash_root(&self) -> Hash256 { - self.as_ref().tree_hash_root() + let leaves = self.len().div_ceil(BYTES_PER_CHUNK); + + let mut hasher = MerkleHasher::with_leaves(leaves); + for item in self { + hasher.write(item.tree_hash_root()[..1].as_ref()).unwrap(); + } + + hasher.finish().unwrap() + } +} + +impl TreeHash for [B256] { + fn tree_hash_type() -> TreeHashType { + TreeHashType::List + } + + fn tree_hash_packed_encoding(&self) -> PackedEncoding { + unreachable!("List should never be packed.") + } + + fn tree_hash_packing_factor() -> usize { + unreachable!("List should never be packed.") + } + + fn tree_hash_root(&self) -> Hash256 { + let leaves = self.len().div_ceil(BYTES_PER_CHUNK); + + let mut hasher = MerkleHasher::with_leaves(leaves); + for item in self { + hasher.write(item.tree_hash_root()[..1].as_ref()).unwrap(); + } + + hasher.finish().unwrap() + } +} + +impl TreeHash for [FixedBytes<48>] { + fn tree_hash_type() -> TreeHashType { + TreeHashType::Vector + } + + fn tree_hash_packed_encoding(&self) -> PackedEncoding { + unreachable!("Vector should never be packed.") + } + + fn tree_hash_packing_factor() -> usize { + unreachable!("Vector should never be packed.") + } + + fn tree_hash_root(&self) -> Hash256 { + let leaves = self.len(); + + let mut hasher = MerkleHasher::with_leaves(leaves); + for item in self { + hasher.write(item.tree_hash_root().as_ref()).unwrap(); + } + + hasher.finish().unwrap() } } @@ -219,6 +309,12 @@ mod test { assert_eq!(one_arc.tree_hash_root(), one.tree_hash_root()); } + #[test] + fn b256() { + let b256 = B256::from([1; 32]); + assert_eq!(b256.tree_hash_root(), b256); + } + #[test] fn int_to_bytes() { assert_eq!(int_to_hash256(0).as_slice(), &[0; 32]); diff --git a/programs/cw-ics08-wasm-eth/Cargo.toml b/programs/cw-ics08-wasm-eth/Cargo.toml index e715ca4d..a736e666 100644 --- a/programs/cw-ics08-wasm-eth/Cargo.toml +++ b/programs/cw-ics08-wasm-eth/Cargo.toml @@ -10,19 +10,18 @@ crate-type = ["cdylib", "rlib"] [dependencies] ibc-proto = { workspace = true } ethereum-light-client = { workspace = true } +ethereum-types = { workspace = true } ethereum-utils = { workspace = true } alloy-primitives = { workspace = true, default-features = false } -cosmwasm-std = { workspace = true } +cosmwasm-std = { workspace = true, features = ["std"] } cosmwasm-schema = { workspace = true } -cw-storage-plus = { workspace = true } prost = { workspace = true, features = ["std"] } serde = { workspace = true } serde_json = { workspace = true } -serde_with = { workspace = true, features = ["base64"] } thiserror = { workspace = true } +hex = { workspace = true } [dev-dependencies] -cw-multi-test = { workspace = true } -ethereum-test-utils = { workspace = true } +ethereum-light-client = { workspace = true, features = ["test-utils"] } diff --git a/programs/cw-ics08-wasm-eth/src/contract.rs b/programs/cw-ics08-wasm-eth/src/contract.rs index e0ec8750..f1e20871 100644 --- a/programs/cw-ics08-wasm-eth/src/contract.rs +++ b/programs/cw-ics08-wasm-eth/src/contract.rs @@ -1,31 +1,23 @@ -//! This module handles the execution logic of the contract. +//! This module contains the `CosmWasm` entrypoints for the 08-wasm smart contract -use std::convert::Into; - -use cosmwasm_std::{ - entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, -}; +use cosmwasm_std::{entry_point, Binary, Deps, DepsMut, Env, MessageInfo, Response}; use ethereum_light_client::{ client_state::ClientState as EthClientState, consensus_state::ConsensusState as EthConsensusState, }; -use ibc_proto::{ - google::protobuf::Any, - ibc::{ - core::client::v1::Height as IbcProtoHeight, - lightclients::wasm::v1::{ - ClientState as WasmClientState, ConsensusState as WasmConsensusState, - }, +use ibc_proto::ibc::{ + core::client::v1::Height as IbcProtoHeight, + lightclients::wasm::v1::{ + ClientState as WasmClientState, ConsensusState as WasmConsensusState, }, }; -use prost::Message; -use crate::custom_query::EthereumCustomQuery; -use crate::msg::{ExecuteMsg, Height, InstantiateMsg, QueryMsg, SudoMsg}; -use crate::state::{ - consensus_db_key, get_eth_client_state, get_eth_consensus_state, HOST_CLIENT_STATE_KEY, +use crate::{custom_query::EthereumCustomQuery, query, state::store_client_state}; +use crate::{ + msg::{ExecuteMsg, InstantiateMsg, QueryMsg, SudoMsg}, + state::store_consensus_state, }; -use crate::ContractError; +use crate::{sudo, ContractError}; /// The instantiate entry point for the CosmWasm contract. /// # Errors @@ -49,27 +41,15 @@ pub fn instantiate( revision_height: client_state.latest_slot, }), }; - let wasm_client_state_any = Any::from_msg(&wasm_client_state)?; - deps.storage.set( - HOST_CLIENT_STATE_KEY.as_bytes(), - wasm_client_state_any.encode_to_vec().as_slice(), - ); + store_client_state(deps.storage, &wasm_client_state)?; let consensus_state_bz: Vec = msg.consensus_state.into(); let consensus_state: EthConsensusState = serde_json::from_slice(&consensus_state_bz) - .map_err(ContractError::DeserializeClientStateFailed)?; + .map_err(ContractError::DeserializeConsensusStateFailed)?; let wasm_consensus_state = WasmConsensusState { data: consensus_state_bz, }; - let wasm_consensus_state_any = Any::from_msg(&wasm_consensus_state)?; - let height = Height { - revision_number: 0, - revision_height: consensus_state.slot, - }; - deps.storage.set( - consensus_db_key(&height).as_bytes(), - wasm_consensus_state_any.encode_to_vec().as_slice(), - ); + store_consensus_state(deps.storage, &wasm_consensus_state, consensus_state.slot)?; Ok(Response::default()) } @@ -92,7 +72,7 @@ pub fn sudo( SudoMsg::VerifyNonMembership(verify_non_membership_msg) => { sudo::verify_non_membership(deps.as_ref(), verify_non_membership_msg)? } - SudoMsg::UpdateState(_) => sudo::update_state()?, + SudoMsg::UpdateState(update_state_msg) => sudo::update_state(deps, update_state_msg)?, SudoMsg::UpdateStateOnMisbehaviour(_) => todo!(), SudoMsg::VerifyUpgradeAndUpdateState(_) => todo!(), SudoMsg::MigrateClientStore(_) => todo!(), @@ -101,69 +81,6 @@ pub fn sudo( Ok(Response::default().set_data(result)) } -mod sudo { - use crate::msg::{UpdateStateResult, VerifyMembershipMsg, VerifyNonMembershipMsg}; - - use super::{ - get_eth_client_state, get_eth_consensus_state, to_json_binary, Binary, ContractError, Deps, - EthereumCustomQuery, - }; - - pub fn verify_membership( - deps: Deps, - verify_membership_msg: VerifyMembershipMsg, - ) -> Result { - let eth_client_state = get_eth_client_state(deps.storage); - let eth_consensus_state = - get_eth_consensus_state(deps.storage, &verify_membership_msg.height); - - ethereum_light_client::membership::verify_membership( - eth_consensus_state, - eth_client_state, - verify_membership_msg.proof.into(), - verify_membership_msg - .merkle_path - .key_path - .into_iter() - .map(Into::into) - .collect(), - Some(verify_membership_msg.value.into()), - ) - .map_err(ContractError::VerifyMembershipFailed)?; - - Ok(to_json_binary(&Ok::<(), ()>(()))?) - } - - pub fn verify_non_membership( - deps: Deps, - verify_non_membership_msg: VerifyNonMembershipMsg, - ) -> Result { - let eth_client_state = get_eth_client_state(deps.storage); - let eth_consensus_state = - get_eth_consensus_state(deps.storage, &verify_non_membership_msg.height); - - ethereum_light_client::membership::verify_membership( - eth_consensus_state, - eth_client_state, - verify_non_membership_msg.proof.into(), - verify_non_membership_msg - .merkle_path - .key_path - .into_iter() - .map(Into::into) - .collect(), - None, - ) - .map_err(ContractError::VerifyNonMembershipFailed)?; - - Ok(to_json_binary(&Ok::<(), ()>(()))?) - } - - pub fn update_state() -> Result { - Ok(to_json_binary(&UpdateStateResult { heights: vec![] })?) - } -} - /// Execute entry point is not used in this contract. #[entry_point] #[allow(clippy::needless_pass_by_value, clippy::missing_errors_doc)] @@ -190,95 +107,18 @@ pub fn query( QueryMsg::VerifyClientMessage(verify_client_message_msg) => { query::verify_client_message(deps, env, verify_client_message_msg) } - QueryMsg::CheckForMisbehaviour(_) => query::check_for_misbehaviour(), - QueryMsg::TimestampAtHeight(_) => query::timestamp_at_height(env), + QueryMsg::CheckForMisbehaviour(_) => todo!(), + QueryMsg::TimestampAtHeight(timestamp_at_height_msg) => { + query::timestamp_at_height(deps, timestamp_at_height_msg) + } QueryMsg::Status(_) => query::status(), } } -mod query { - use crate::{ - custom_query::BlsVerifier, - msg::{ - CheckForMisbehaviourResult, Height, StatusResult, TimestampAtHeightResult, - VerifyClientMessageMsg, - }, - }; - - use super::{ - get_eth_client_state, get_eth_consensus_state, to_json_binary, Binary, ContractError, Deps, - Env, EthereumCustomQuery, - }; - - #[allow(clippy::needless_pass_by_value)] - pub fn verify_client_message( - deps: Deps, - env: Env, - verify_client_message_msg: VerifyClientMessageMsg, - ) -> Result { - let eth_client_state = get_eth_client_state(deps.storage); - let eth_consensus_state = get_eth_consensus_state( - deps.storage, - &Height { - revision_number: 0, - revision_height: eth_client_state.latest_slot, - }, - ); - let header = serde_json::from_slice(&verify_client_message_msg.client_message) - .map_err(ContractError::DeserializeClientStateFailed)?; - let bls_verifier = BlsVerifier { - querier: deps.querier, - }; - - ethereum_light_client::verify::verify_header( - ð_consensus_state, - ð_client_state, - env.block.time.seconds(), - &header, - bls_verifier, - ) - .map_err(ContractError::VerifyClientMessageFailed)?; - - Ok(to_json_binary(&Ok::<(), ()>(()))?) - } - - pub fn check_for_misbehaviour() -> Result { - Ok(to_json_binary(&CheckForMisbehaviourResult { - found_misbehaviour: false, - })?) - } - - #[allow(clippy::needless_pass_by_value)] - pub fn timestamp_at_height(env: Env) -> Result { - let now = env.block.time.seconds(); - Ok(to_json_binary(&TimestampAtHeightResult { timestamp: now })?) - } - - pub fn status() -> Result { - Ok(to_json_binary(&StatusResult { - status: "Active".to_string(), - })?) - } -} - #[cfg(test)] mod tests { - use std::marker::PhantomData; - - use alloy_primitives::B256; - use cosmwasm_std::{ - testing::{ - mock_dependencies, MockApi, MockQuerier, MockQuerierCustomHandlerResult, MockStorage, - }, - Binary, OwnedDeps, SystemResult, - }; - use ethereum_light_client::types::bls::{BlsPublicKey, BlsSignature}; - use ethereum_test_utils::bls_verifier::{aggreagate, fast_aggregate_verify}; - - use crate::custom_query::EthereumCustomQuery; - mod instantiate_tests { - use alloy_primitives::{aliases::B32, Address, FixedBytes, B256, U256}; + use alloy_primitives::{Address, FixedBytes, B256, U256}; use cosmwasm_std::{ coins, testing::{message_info, mock_env}, @@ -287,8 +127,8 @@ mod tests { use ethereum_light_client::{ client_state::ClientState as EthClientState, consensus_state::ConsensusState as EthConsensusState, - types::{fork::Fork, fork_parameters::ForkParameters, wrappers::WrappedVersion}, }; + use ethereum_types::consensus::fork::{Fork, ForkParameters}; use ibc_proto::{ google::protobuf::Any, ibc::lightclients::wasm::v1::{ @@ -298,9 +138,10 @@ mod tests { use prost::{Message, Name}; use crate::{ - contract::{instantiate, tests::mk_deps}, - msg::{Height, InstantiateMsg}, + contract::instantiate, + msg::InstantiateMsg, state::{consensus_db_key, HOST_CLIENT_STATE_KEY}, + test::mk_deps, }; #[test] @@ -315,22 +156,22 @@ mod tests { min_sync_committee_participants: 0, genesis_time: 0, fork_parameters: ForkParameters { - genesis_fork_version: WrappedVersion(B32::from([0; 4])), + genesis_fork_version: FixedBytes([0; 4]), genesis_slot: 0, altair: Fork { - version: WrappedVersion(B32::from([0; 4])), + version: FixedBytes([0; 4]), epoch: 0, }, bellatrix: Fork { - version: WrappedVersion(B32::from([0; 4])), + version: FixedBytes([0; 4]), epoch: 0, }, capella: Fork { - version: WrappedVersion(B32::from([0; 4])), + version: FixedBytes([0; 4]), epoch: 0, }, deneb: Fork { - version: WrappedVersion(B32::from([0; 4])), + version: FixedBytes([0; 4]), epoch: 0, }, }, @@ -340,7 +181,7 @@ mod tests { latest_slot: 42, ibc_commitment_slot: U256::from(0), ibc_contract_address: Address::default(), - frozen_height: ethereum_light_client::types::height::Height::default(), + frozen_slot: 0, }; let client_state_bz: Vec = serde_json::to_vec(&client_state).unwrap(); @@ -386,13 +227,7 @@ mod tests { let actual_wasm_consensus_state_any_bz = deps .storage - .get( - consensus_db_key(&Height { - revision_number: 0, - revision_height: consensus_state.slot, - }) - .as_bytes(), - ) + .get(consensus_db_key(consensus_state.slot).as_bytes()) .unwrap(); let actual_wasm_consensus_state_any = Any::decode(actual_wasm_consensus_state_any_bz.as_slice()).unwrap(); @@ -407,235 +242,116 @@ mod tests { } } - mod sudo_tests { + mod integration_tests { use cosmwasm_std::{ coins, testing::{message_info, mock_env}, - Binary, - }; - use ethereum_test_utils::fixtures::{self, StepFixture}; - - use crate::{ - contract::{instantiate, sudo, tests::mk_deps}, - msg::{Height, MerklePath, SudoMsg, UpdateStateMsg, VerifyMembershipMsg}, - test::fixture_types::CommitmentProof, - }; - - #[test] - fn test_verify_membership() { - let mut deps = mk_deps(); - let creator = deps.api.addr_make("creator"); - let info = message_info(&creator, &coins(1, "uatom")); - - let fixture: StepFixture = - fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); - - let commitment_proof_fixture: CommitmentProof = fixture.get_data_at_step(2); - - let client_state = commitment_proof_fixture.client_state; - let client_state_bz: Vec = serde_json::to_vec(&client_state).unwrap(); - let consensus_state = commitment_proof_fixture.consensus_state; - let consensus_state_bz: Vec = serde_json::to_vec(&consensus_state).unwrap(); - - let msg = crate::msg::InstantiateMsg { - client_state: Binary::from(client_state_bz), - consensus_state: Binary::from(consensus_state_bz), - checksum: b"checksum".into(), // TODO: Real checksum important? - }; - instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); - - let proof = commitment_proof_fixture.storage_proof; - let proof_bz = serde_json::to_vec(&proof).unwrap(); - let path = commitment_proof_fixture.path; - let value = proof.value; - let value_bz = value.to_be_bytes_vec(); - - let msg = SudoMsg::VerifyMembership(VerifyMembershipMsg { - height: Height { - revision_number: 0, - revision_height: commitment_proof_fixture.proof_height.revision_height, - }, - delay_time_period: 0, - delay_block_period: 0, - proof: Binary::from(proof_bz), - merkle_path: MerklePath { - key_path: vec![Binary::from(path)], - }, - value: Binary::from(value_bz), - }); - let res = sudo(deps.as_mut(), mock_env(), msg).unwrap(); - assert_eq!(0, res.messages.len()); - } - - #[test] - fn test_update_state() { - let mut deps = mk_deps(); - let msg = SudoMsg::UpdateState(UpdateStateMsg { - client_message: Binary::default(), - }); - let res = sudo(deps.as_mut(), mock_env(), msg).unwrap(); - assert_eq!(0, res.messages.len()); - } - } - - mod query_tests { - use cosmwasm_std::{ - coins, from_json, - testing::{message_info, mock_env}, Binary, Timestamp, }; - use ethereum_test_utils::fixtures::{self, StepFixture}; + use ethereum_light_client::test_utils::fixtures::{ + self, CommitmentProof, InitialState, StepsFixture, UpdateClient, + }; use crate::{ - contract::{instantiate, query, tests::mk_deps}, + contract::{instantiate, query, sudo}, msg::{ - CheckForMisbehaviourMsg, CheckForMisbehaviourResult, Height, QueryMsg, StatusMsg, - StatusResult, TimestampAtHeightMsg, TimestampAtHeightResult, - VerifyClientMessageMsg, + Height, MerklePath, QueryMsg, SudoMsg, UpdateStateMsg, UpdateStateResult, + VerifyClientMessageMsg, VerifyMembershipMsg, }, - test::fixture_types::{InitialState, UpdateClient}, + test::mk_deps, }; #[test] - fn test_verify_client_message() { + // This test runs throught the e2e test scenario defined in the interchaintest: + // TestICS20TransferERC20TokenfromEthereumToCosmosAndBack_Groth16 + fn test_ics20_transfer_from_ethereum_to_cosmos_flow() { let mut deps = mk_deps(); let creator = deps.api.addr_make("creator"); let info = message_info(&creator, &coins(1, "uatom")); - let fixture: StepFixture = - fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); + let fixture: StepsFixture = + fixtures::load("TestICS20TransferERC20TokenfromEthereumToCosmosAndBack_Groth16"); let initial_state: InitialState = fixture.get_data_at_step(0); let client_state = initial_state.client_state; - let consensus_state = initial_state.consensus_state; let client_state_bz: Vec = serde_json::to_vec(&client_state).unwrap(); let consensus_state_bz: Vec = serde_json::to_vec(&consensus_state).unwrap(); - let msg = crate::msg::InstantiateMsg { + let instantiate_msg = crate::msg::InstantiateMsg { client_state: Binary::from(client_state_bz), consensus_state: Binary::from(consensus_state_bz), - checksum: b"checksum".into(), // TODO: Real checksum important? + checksum: b"checksum".into(), }; - instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + instantiate(deps.as_mut(), mock_env(), info, instantiate_msg).unwrap(); + + // At this point, the light clients are initialized and the client state is stored + // In the flow, an ICS20 transfer has been initiated from Ethereum to Cosmos + // Next up we want to prove the packet on the Cosmos chain, so we start by updating the + // light client (which is two steps: verify client message and update state) + // Verify client message let update_client: UpdateClient = fixture.get_data_at_step(1); + assert_eq!(1, update_client.updates.len()); // just to make sure let header = update_client.updates[0].clone(); let header_bz: Vec = serde_json::to_vec(&header).unwrap(); + // We update the enviornment to be after finalized execution timestamp let mut env = mock_env(); env.block.time = Timestamp::from_seconds( header.consensus_update.attested_header.execution.timestamp + 1000, ); - query( - deps.as_ref(), - env, - QueryMsg::VerifyClientMessage(VerifyClientMessageMsg { - client_message: Binary::from(header_bz), - }), - ) - .unwrap(); - } + let query_verify_client_msg = QueryMsg::VerifyClientMessage(VerifyClientMessageMsg { + client_message: Binary::from(header_bz.clone()), + }); + query(deps.as_ref(), env.clone(), query_verify_client_msg).unwrap(); - #[test] - fn test_check_for_misbehaviour() { - let deps = mk_deps(); - let res = query( - deps.as_ref(), - mock_env(), - QueryMsg::CheckForMisbehaviour(CheckForMisbehaviourMsg { - client_message: Binary::default(), - }), - ) - .unwrap(); - let misbehaviour_result: CheckForMisbehaviourResult = from_json(&res).unwrap(); - assert!(!misbehaviour_result.found_misbehaviour); - } + // Update state - #[test] - fn test_timestamp_at_height() { - let deps = mk_deps(); - let res = query( - deps.as_ref(), - mock_env(), - QueryMsg::TimestampAtHeight(TimestampAtHeightMsg { - height: Height { - revision_number: 0, - revision_height: 1, - }, - }), - ) - .unwrap(); - let timestamp_at_height_result: TimestampAtHeightResult = from_json(&res).unwrap(); + let sudo_update_state_msg = SudoMsg::UpdateState(UpdateStateMsg { + client_message: Binary::from(header_bz), + }); + let update_res = sudo(deps.as_mut(), env.clone(), sudo_update_state_msg).unwrap(); + let update_state_result: UpdateStateResult = + serde_json::from_slice(&update_res.data.unwrap()) + .expect("update state result should be deserializable"); + assert_eq!(1, update_state_result.heights.len()); + assert_eq!(0, update_state_result.heights[0].revision_number); assert_eq!( - mock_env().block.time.seconds(), - timestamp_at_height_result.timestamp + header.consensus_update.attested_header.beacon.slot, + update_state_result.heights[0].revision_height ); - } - #[test] - fn test_status() { - let deps = mk_deps(); - let res = query(deps.as_ref(), mock_env(), QueryMsg::Status(StatusMsg {})).unwrap(); - let status_response: StatusResult = from_json(&res).unwrap(); - assert_eq!("Active", status_response.status); - } - } + // The client has now been updated, and we would submit the packet to the cosmos chain, + // along with the proof of th packet commitment. IBC will call verify_membership. - // TODO: Find a way to reuse the test handling code that already exists in the - // ethereum-light-client package - pub fn custom_query_handler(query: &EthereumCustomQuery) -> MockQuerierCustomHandlerResult { - match query { - EthereumCustomQuery::AggregateVerify { - public_keys, - message, - signature, - } => { - let public_keys = public_keys - .iter() - .map(|pk| pk.as_ref().try_into().unwrap()) - .collect::>(); - let message = B256::try_from(message.as_slice()).unwrap(); - let signature = BlsSignature::try_from(signature.as_slice()).unwrap(); - - fast_aggregate_verify(public_keys, message, signature).unwrap(); - - SystemResult::Ok(cosmwasm_std::ContractResult::Ok::( - serde_json::to_vec(&true).unwrap().into(), - )) - } - EthereumCustomQuery::Aggregate { public_keys } => { - let public_keys = public_keys - .iter() - .map(|pk| pk.as_ref().try_into().unwrap()) - .collect::>(); - - let aggregate_pubkey = aggreagate(public_keys).unwrap(); - - SystemResult::Ok(cosmwasm_std::ContractResult::Ok::( - serde_json::to_vec(&Binary::from(aggregate_pubkey.as_slice())) - .unwrap() - .into(), - )) - } - } - } + // Verify memebership + let commitment_proof_fixture: CommitmentProof = fixture.get_data_at_step(2); - fn mk_deps( - ) -> OwnedDeps, EthereumCustomQuery> - { - let deps = mock_dependencies(); - - OwnedDeps { - storage: deps.storage, - api: deps.api, - querier: MockQuerier::::new(&[]) - .with_custom_handler(custom_query_handler), - custom_query_type: PhantomData, + let proof = commitment_proof_fixture.storage_proof; + let proof_bz = serde_json::to_vec(&proof).unwrap(); + let path = commitment_proof_fixture.path; + let value = proof.value; + let value_bz = value.to_be_bytes_vec(); + + let query_verify_membership_msg = SudoMsg::VerifyMembership(VerifyMembershipMsg { + height: Height { + revision_number: 0, + revision_height: commitment_proof_fixture.proof_slot, + }, + delay_time_period: 0, + delay_block_period: 0, + proof: Binary::from(proof_bz), + merkle_path: MerklePath { + key_path: vec![Binary::from(path.to_vec())], + }, + value: Binary::from(value_bz), + }); + sudo(deps.as_mut(), env, query_verify_membership_msg).unwrap(); } } } diff --git a/programs/cw-ics08-wasm-eth/src/custom_query.rs b/programs/cw-ics08-wasm-eth/src/custom_query.rs index 0c41ef09..d69bdbcc 100644 --- a/programs/cw-ics08-wasm-eth/src/custom_query.rs +++ b/programs/cw-ics08-wasm-eth/src/custom_query.rs @@ -2,8 +2,9 @@ use alloy_primitives::B256; use cosmwasm_std::{Binary, CustomQuery, QuerierWrapper, QueryRequest}; -use ethereum_light_client::types::bls::{BlsPublicKey, BlsSignature, BlsVerify}; -use ethereum_utils::{ensure, hex::to_hex}; +use ethereum_light_client::verify::BlsVerify; +use ethereum_types::consensus::bls::{BlsPublicKey, BlsSignature}; +use ethereum_utils::ensure; use thiserror::Error; /// The custom query for the Ethereum light client @@ -43,7 +44,7 @@ pub enum BlsVerifierError { #[error("fast aggregate verify error: {0}")] FastAggregateVerify(String), - #[error("signature cannot be verified (public_keys: {public_keys:?}, msg: {msg}, signature: {signature})", msg = to_hex(.msg))] + #[error("signature cannot be verified (public_keys: {public_keys:?}, msg: {msg}, signature: {signature})", msg = hex::encode(.msg))] InvalidSignature { /// The public keys used to verify the signature public_keys: Vec, @@ -59,13 +60,12 @@ impl BlsVerify for BlsVerifier<'_> { fn fast_aggregate_verify( &self, - public_keys: Vec<&BlsPublicKey>, + public_keys: &[BlsPublicKey], msg: B256, signature: BlsSignature, ) -> Result<(), Self::Error> { let binary_public_keys: Vec = public_keys - .clone() - .into_iter() + .iter() .map(|p| Binary::from(p.to_vec())) .collect(); @@ -84,7 +84,7 @@ impl BlsVerify for BlsVerifier<'_> { ensure!( is_valid, BlsVerifierError::InvalidSignature { - public_keys: public_keys.into_iter().copied().collect(), + public_keys: public_keys.to_vec(), msg, signature, } diff --git a/programs/cw-ics08-wasm-eth/src/error.rs b/programs/cw-ics08-wasm-eth/src/error.rs index c23247ed..0e65e89f 100644 --- a/programs/cw-ics08-wasm-eth/src/error.rs +++ b/programs/cw-ics08-wasm-eth/src/error.rs @@ -10,27 +10,49 @@ pub enum ContractError { #[error("{0}")] Std(#[from] StdError), - #[error("Unauthorized")] + #[error("unauthorized")] Unauthorized, + #[error("serializing client state failed: {0}")] + SerializeClientStateFailed(#[source] serde_json::Error), + + #[error("serializing consensus state failed: {0}")] + SerializeConsensusStateFailed(#[source] serde_json::Error), + #[error("deserializing client state failed: {0}")] DeserializeClientStateFailed(#[source] serde_json::Error), #[error("deserializing consensus state failed: {0}")] DeserializeConsensusStateFailed(#[source] serde_json::Error), - #[error("Verify membership failed: {0}")] + #[error("deserializing client message failed: {0}")] + DeserializeClientMessageFailed(#[source] serde_json::Error), + + #[error("verify membership failed: {0}")] VerifyMembershipFailed(#[source] EthereumIBCError), - #[error("Verify non-membership failed: {0}")] + #[error("verify non-membership failed: {0}")] VerifyNonMembershipFailed(#[source] EthereumIBCError), - #[error("Verify client message failed: {0}")] + #[error("verify client message failed: {0}")] VerifyClientMessageFailed(#[source] EthereumIBCError), + #[error("update client state failed: {0}")] + UpdateClientStateFailed(#[source] EthereumIBCError), + + #[error("client state not found")] + ClientStateNotFound, + + #[error("consensus state not found")] + ConsensusStateNotFound, + + // Generic translation errors #[error("prost encoding error: {0}")] ProstEncodeError(#[from] prost::EncodeError), #[error("prost decoding error: {0}")] ProstDecodeError(#[from] prost::DecodeError), + + #[error("serde json error: {0}")] + SerdeJsonError(#[from] serde_json::Error), } diff --git a/programs/cw-ics08-wasm-eth/src/lib.rs b/programs/cw-ics08-wasm-eth/src/lib.rs index 2a1714eb..912a0c3e 100644 --- a/programs/cw-ics08-wasm-eth/src/lib.rs +++ b/programs/cw-ics08-wasm-eth/src/lib.rs @@ -1,12 +1,19 @@ #![doc = include_str!("../README.md")] -#![deny(clippy::nursery, clippy::pedantic, warnings, missing_docs)] +#![deny( + clippy::nursery, + clippy::pedantic, + warnings, + missing_docs, + unused_crate_dependencies +)] pub mod contract; pub mod custom_query; mod error; -#[allow(clippy::module_name_repetitions)] pub mod msg; +pub mod query; pub mod state; +pub mod sudo; pub use error::ContractError; diff --git a/programs/cw-ics08-wasm-eth/src/msg.rs b/programs/cw-ics08-wasm-eth/src/msg.rs index ac4009f4..7a3d8e65 100644 --- a/programs/cw-ics08-wasm-eth/src/msg.rs +++ b/programs/cw-ics08-wasm-eth/src/msg.rs @@ -1,4 +1,5 @@ //! The messages that are passed between the contract and the ibc-go module +#![allow(clippy::module_name_repetitions)] use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::Binary; @@ -25,7 +26,6 @@ pub enum SudoMsg { VerifyMembership(VerifyMembershipMsg), /// The message to verify non-membership VerifyNonMembership(VerifyNonMembershipMsg), - /// The message to update the client state UpdateState(UpdateStateMsg), /// The message to update the client state on misbehaviour diff --git a/programs/cw-ics08-wasm-eth/src/query.rs b/programs/cw-ics08-wasm-eth/src/query.rs new file mode 100644 index 000000000..54db09b3 --- /dev/null +++ b/programs/cw-ics08-wasm-eth/src/query.rs @@ -0,0 +1,191 @@ +//! This module contains the query message handlers + +use cosmwasm_std::{to_json_binary, Binary, Deps, Env}; + +use crate::{ + custom_query::{BlsVerifier, EthereumCustomQuery}, + msg::{StatusResult, TimestampAtHeightMsg, TimestampAtHeightResult, VerifyClientMessageMsg}, + state::{get_eth_client_state, get_eth_consensus_state}, + ContractError, +}; + +/// Verifies the client message (header) that will be used for updating the state of the light client +/// The actual verification logic is done in the ethereum light client package +/// # Errors +/// Returns an error if the client message is invalid +/// # Returns +/// An empty response +#[allow(clippy::needless_pass_by_value)] +pub fn verify_client_message( + deps: Deps, + env: Env, + verify_client_message_msg: VerifyClientMessageMsg, +) -> Result { + let eth_client_state = get_eth_client_state(deps.storage)?; + let eth_consensus_state = get_eth_consensus_state(deps.storage, eth_client_state.latest_slot)?; + let header = serde_json::from_slice(&verify_client_message_msg.client_message) + .map_err(ContractError::DeserializeClientMessageFailed)?; + let bls_verifier = BlsVerifier { + querier: deps.querier, + }; + + ethereum_light_client::verify::verify_header( + ð_consensus_state, + ð_client_state, + env.block.time.seconds(), + &header, + bls_verifier, + ) + .map_err(ContractError::VerifyClientMessageFailed)?; + + Ok(Binary::default()) +} + +/// Gets the consensus timestamp at a given height +/// # Errors +/// Returns an error if the conensus state is not found +/// # Returns +/// The timestamp at the given height +#[allow(clippy::needless_pass_by_value)] +pub fn timestamp_at_height( + deps: Deps, + timestamp_at_height_msg: TimestampAtHeightMsg, +) -> Result { + let eth_consensus_state = + get_eth_consensus_state(deps.storage, timestamp_at_height_msg.height.revision_height)?; + + Ok(to_json_binary(&TimestampAtHeightResult { + timestamp: eth_consensus_state.timestamp, + })?) +} + +/// Gets the status of the light client +/// # Returns +/// Active status, because no other state is currently implemented +/// # Errors +/// It won't error at this point +// TODO: Implement a proper status once freezing/misbehaviour is implemented #164 +pub fn status() -> Result { + Ok(to_json_binary(&StatusResult { + status: "Active".to_string(), + })?) +} + +#[cfg(test)] +mod tests { + use cosmwasm_std::{ + coins, from_json, + testing::{message_info, mock_env}, + Binary, Timestamp, + }; + use ethereum_light_client::test_utils::fixtures::{ + self, InitialState, StepsFixture, UpdateClient, + }; + + use crate::{ + contract::{instantiate, query}, + msg::{ + Height, QueryMsg, StatusMsg, StatusResult, TimestampAtHeightMsg, + TimestampAtHeightResult, VerifyClientMessageMsg, + }, + query::timestamp_at_height, + test::mk_deps, + }; + + use super::verify_client_message; + + #[test] + fn test_verify_client_message() { + let mut deps = mk_deps(); + let creator = deps.api.addr_make("creator"); + let info = message_info(&creator, &coins(1, "uatom")); + + let fixture: StepsFixture = + fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); + + let initial_state: InitialState = fixture.get_data_at_step(0); + + let client_state = initial_state.client_state; + + let consensus_state = initial_state.consensus_state; + + let client_state_bz: Vec = serde_json::to_vec(&client_state).unwrap(); + let consensus_state_bz: Vec = serde_json::to_vec(&consensus_state).unwrap(); + + let msg = crate::msg::InstantiateMsg { + client_state: Binary::from(client_state_bz), + consensus_state: Binary::from(consensus_state_bz), + checksum: b"checksum".into(), + }; + + instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + + let update_client: UpdateClient = fixture.get_data_at_step(1); + let header = update_client.updates[0].clone(); + let header_bz: Vec = serde_json::to_vec(&header).unwrap(); + + let mut env = mock_env(); + env.block.time = Timestamp::from_seconds( + header.consensus_update.attested_header.execution.timestamp + 1000, + ); + + verify_client_message( + deps.as_ref(), + env, + VerifyClientMessageMsg { + client_message: Binary::from(header_bz), + }, + ) + .unwrap(); + } + + #[test] + fn test_timestamp_at_height() { + let mut deps = mk_deps(); + let creator = deps.api.addr_make("creator"); + let info = message_info(&creator, &coins(1, "uatom")); + + let fixture: StepsFixture = + fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); + + let initial_state: InitialState = fixture.get_data_at_step(0); + + let client_state = initial_state.client_state; + let consensus_state = initial_state.consensus_state; + + let client_state_bz: Vec = serde_json::to_vec(&client_state).unwrap(); + let consensus_state_bz: Vec = serde_json::to_vec(&consensus_state).unwrap(); + + let msg = crate::msg::InstantiateMsg { + client_state: Binary::from(client_state_bz), + consensus_state: Binary::from(consensus_state_bz), + checksum: b"checksum".into(), + }; + + instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + + let res = timestamp_at_height( + deps.as_ref(), + TimestampAtHeightMsg { + height: Height { + revision_number: 0, + revision_height: consensus_state.slot, + }, + }, + ) + .unwrap(); + let timestamp_at_height_result: TimestampAtHeightResult = from_json(&res).unwrap(); + assert_eq!( + consensus_state.timestamp, + timestamp_at_height_result.timestamp + ); + } + + #[test] + fn test_status() { + let deps = mk_deps(); + let res = query(deps.as_ref(), mock_env(), QueryMsg::Status(StatusMsg {})).unwrap(); + let status_response: StatusResult = from_json(&res).unwrap(); + assert_eq!("Active", status_response.status); + } +} diff --git a/programs/cw-ics08-wasm-eth/src/state.rs b/programs/cw-ics08-wasm-eth/src/state.rs index 89519c34..7d7fb4b4 100644 --- a/programs/cw-ics08-wasm-eth/src/state.rs +++ b/programs/cw-ics08-wasm-eth/src/state.rs @@ -11,7 +11,7 @@ use ibc_proto::{ }; use prost::Message; -use crate::msg::Height; +use crate::ContractError; /// The store key used by `ibc-go` to store the client state pub const HOST_CLIENT_STATE_KEY: &str = "clientState"; @@ -20,38 +20,89 @@ pub const HOST_CONSENSUS_STATES_KEY: &str = "consensusStates"; /// The key used to store the consensus states by height #[must_use] -pub fn consensus_db_key(height: &Height) -> String { - format!( - "{}/{}-{}", - HOST_CONSENSUS_STATES_KEY, height.revision_number, height.revision_height - ) +pub fn consensus_db_key(slot: u64) -> String { + format!("{}/{}-{}", HOST_CONSENSUS_STATES_KEY, 0, slot) +} + +/// Get the Wasm client state +/// # Errors +/// Returns an error if the client state is not found or cannot be deserialized +/// # Returns +/// The Wasm client state +#[allow(clippy::module_name_repetitions)] +pub fn get_wasm_client_state(storage: &dyn Storage) -> Result { + let wasm_client_state_any_bz = storage + .get(HOST_CLIENT_STATE_KEY.as_bytes()) + .ok_or(ContractError::ClientStateNotFound)?; + let wasm_client_state_any = Any::decode(wasm_client_state_any_bz.as_slice())?; + + Ok(WasmClientState::decode( + wasm_client_state_any.value.as_slice(), + )?) } -// TODO: Proper errors /// Get the Ethereum client state -/// # Panics -/// Panics if the client state is not found or cannot be deserialized +/// # Errors +/// Returns an error if the client state is not found or cannot be deserialized +/// # Returns +/// The Ethereum client state #[allow(clippy::module_name_repetitions)] -pub fn get_eth_client_state(storage: &dyn Storage) -> EthClientState { - let wasm_client_state_any_bz = storage.get(HOST_CLIENT_STATE_KEY.as_bytes()).unwrap(); - let wasm_client_state_any = Any::decode(wasm_client_state_any_bz.as_slice()).unwrap(); - let wasm_client_state = - WasmClientState::decode(wasm_client_state_any.value.as_slice()).unwrap(); - - // TODO: map to ContractError - serde_json::from_slice(&wasm_client_state.data).unwrap() +pub fn get_eth_client_state(storage: &dyn Storage) -> Result { + let wasm_client_state = get_wasm_client_state(storage)?; + Ok(serde_json::from_slice(&wasm_client_state.data)?) } -// TODO: Proper errors /// Get the Ethereum consensus state at a given height -/// # Panics -/// Panics if the consensus state is not found or cannot be deserialized +/// # Errors +/// Returns an error if the consensus state is not found or cannot be deserialized +/// # Returns +/// The Ethereum consensus state #[allow(clippy::module_name_repetitions)] -pub fn get_eth_consensus_state(storage: &dyn Storage, height: &Height) -> EthConsensusState { - let wasm_consensus_state_any_bz = storage.get(consensus_db_key(height).as_bytes()).unwrap(); - let wasm_consensus_state_any = Any::decode(wasm_consensus_state_any_bz.as_slice()).unwrap(); +pub fn get_eth_consensus_state( + storage: &dyn Storage, + slot: u64, +) -> Result { + let wasm_consensus_state_any_bz = storage + .get(consensus_db_key(slot).as_bytes()) + .ok_or(ContractError::ConsensusStateNotFound)?; + let wasm_consensus_state_any = Any::decode(wasm_consensus_state_any_bz.as_slice())?; let wasm_consensus_state = - WasmConsensusState::decode(wasm_consensus_state_any.value.as_slice()).unwrap(); + WasmConsensusState::decode(wasm_consensus_state_any.value.as_slice())?; + + Ok(serde_json::from_slice(&wasm_consensus_state.data)?) +} + +/// Store the consensus state +/// # Errors +/// Returns an error if the consensus state cannot be serialized into an Any +#[allow(clippy::module_name_repetitions)] +pub fn store_consensus_state( + storage: &mut dyn Storage, + wasm_consensus_state: &WasmConsensusState, + slot: u64, +) -> Result<(), ContractError> { + let wasm_consensus_state_any = Any::from_msg(wasm_consensus_state)?; + storage.set( + consensus_db_key(slot).as_bytes(), + wasm_consensus_state_any.encode_to_vec().as_slice(), + ); + + Ok(()) +} + +/// Store the client state +/// # Errors +/// Returns an error if the client state cannot be serialized into an Any +#[allow(clippy::module_name_repetitions)] +pub fn store_client_state( + storage: &mut dyn Storage, + wasm_client_state: &WasmClientState, +) -> Result<(), ContractError> { + let wasm_client_state_any = Any::from_msg(wasm_client_state)?; + storage.set( + HOST_CLIENT_STATE_KEY.as_bytes(), + wasm_client_state_any.encode_to_vec().as_slice(), + ); - serde_json::from_slice(&wasm_consensus_state.data).unwrap() + Ok(()) } diff --git a/programs/cw-ics08-wasm-eth/src/sudo.rs b/programs/cw-ics08-wasm-eth/src/sudo.rs new file mode 100644 index 000000000..4ae4f074 --- /dev/null +++ b/programs/cw-ics08-wasm-eth/src/sudo.rs @@ -0,0 +1,235 @@ +//! This module contains the sudo message handlers + +use cosmwasm_std::{to_json_binary, Binary, Deps, DepsMut}; +use ethereum_light_client::update::update_consensus_state; +use ibc_proto::ibc::{ + core::client::v1::Height as IbcProtoHeight, + lightclients::wasm::v1::ConsensusState as WasmConsensusState, +}; + +use crate::{ + custom_query::EthereumCustomQuery, + msg::{Height, UpdateStateMsg, UpdateStateResult, VerifyMembershipMsg, VerifyNonMembershipMsg}, + state::{ + get_eth_client_state, get_eth_consensus_state, get_wasm_client_state, store_client_state, + store_consensus_state, + }, + ContractError, +}; + +/// Verify the membership of a value at a given height +/// # Errors +/// Returns an error if the membership proof verification fails +/// # Returns +/// An empty response +pub fn verify_membership( + deps: Deps, + verify_membership_msg: VerifyMembershipMsg, +) -> Result { + let eth_client_state = get_eth_client_state(deps.storage)?; + let eth_consensus_state = + get_eth_consensus_state(deps.storage, verify_membership_msg.height.revision_height)?; + + ethereum_light_client::membership::verify_membership( + eth_consensus_state, + eth_client_state, + verify_membership_msg.proof.into(), + verify_membership_msg + .merkle_path + .key_path + .into_iter() + .map(Into::into) + .collect(), + Some(verify_membership_msg.value.into()), + ) + .map_err(ContractError::VerifyMembershipFailed)?; + + Ok(Binary::default()) +} + +/// Verify the non-membership of a value at a given height +/// # Errors +/// Returns an error if the non-membership proof verification fails +/// # Returns +/// An empty response +pub fn verify_non_membership( + deps: Deps, + verify_non_membership_msg: VerifyNonMembershipMsg, +) -> Result { + let eth_client_state = get_eth_client_state(deps.storage)?; + let eth_consensus_state = get_eth_consensus_state( + deps.storage, + verify_non_membership_msg.height.revision_height, + )?; + + ethereum_light_client::membership::verify_membership( + eth_consensus_state, + eth_client_state, + verify_non_membership_msg.proof.into(), + verify_non_membership_msg + .merkle_path + .key_path + .into_iter() + .map(Into::into) + .collect(), + None, + ) + .map_err(ContractError::VerifyNonMembershipFailed)?; + + Ok(Binary::default()) +} + +/// Update the state of the light client +/// This function is always called after the verify client message, so +/// we can assume the client message is valid and that the consensus state can be updated +/// # Errors +/// Returns an error if deserialization failes or if the light client update logic fails +/// # Returns +/// The updated slot (called height in regular IBC terms) +#[allow(clippy::needless_pass_by_value)] +pub fn update_state( + deps: DepsMut, + update_state_msg: UpdateStateMsg, +) -> Result { + let header_bz: Vec = update_state_msg.client_message.into(); + let header = serde_json::from_slice(&header_bz) + .map_err(ContractError::DeserializeClientMessageFailed)?; + + let eth_client_state = get_eth_client_state(deps.storage)?; + let eth_consensus_state = get_eth_consensus_state(deps.storage, eth_client_state.latest_slot)?; + + let (updated_slot, updated_consensus_state, updated_client_state) = + update_consensus_state(eth_consensus_state, eth_client_state, header) + .map_err(ContractError::UpdateClientStateFailed)?; + + let consensus_state_bz: Vec = serde_json::to_vec(&updated_consensus_state) + .map_err(ContractError::SerializeConsensusStateFailed)?; + let wasm_consensus_state = WasmConsensusState { + data: consensus_state_bz, + }; + store_consensus_state(deps.storage, &wasm_consensus_state, updated_slot)?; + + if let Some(client_state) = updated_client_state { + let client_state_bz: Vec = + serde_json::to_vec(&client_state).map_err(ContractError::SerializeClientStateFailed)?; + + let mut wasm_client_state = get_wasm_client_state(deps.storage)?; + wasm_client_state.data = client_state_bz; + wasm_client_state.latest_height = Some(IbcProtoHeight { + revision_number: 0, + revision_height: updated_slot, + }); + store_client_state(deps.storage, &wasm_client_state)?; + } + + Ok(to_json_binary(&UpdateStateResult { + heights: vec![Height { + revision_number: 0, + revision_height: updated_slot, + }], + })?) +} + +#[cfg(test)] +mod tests { + use cosmwasm_std::{ + coins, from_json, + testing::{message_info, mock_env}, + Binary, + }; + use ethereum_light_client::test_utils::fixtures::{ + self, CommitmentProof, InitialState, StepsFixture, UpdateClient, + }; + + use crate::{ + contract::instantiate, + msg::{Height, MerklePath, UpdateStateMsg, UpdateStateResult, VerifyMembershipMsg}, + sudo::{update_state, verify_membership}, + test::mk_deps, + }; + + #[test] + fn test_verify_membership() { + let mut deps = mk_deps(); + let creator = deps.api.addr_make("creator"); + let info = message_info(&creator, &coins(1, "uatom")); + + let fixture: StepsFixture = + fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); + + let commitment_proof_fixture: CommitmentProof = fixture.get_data_at_step(2); + + let client_state = commitment_proof_fixture.client_state; + let client_state_bz: Vec = serde_json::to_vec(&client_state).unwrap(); + let consensus_state = commitment_proof_fixture.consensus_state; + let consensus_state_bz: Vec = serde_json::to_vec(&consensus_state).unwrap(); + + let msg = crate::msg::InstantiateMsg { + client_state: Binary::from(client_state_bz), + consensus_state: Binary::from(consensus_state_bz), + checksum: b"checksum".into(), + }; + instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + + let proof = commitment_proof_fixture.storage_proof; + let proof_bz = serde_json::to_vec(&proof).unwrap(); + let path = commitment_proof_fixture.path; + let value = proof.value; + let value_bz = value.to_be_bytes_vec(); + + let msg = VerifyMembershipMsg { + height: Height { + revision_number: 0, + revision_height: commitment_proof_fixture.proof_slot, + }, + delay_time_period: 0, + delay_block_period: 0, + proof: Binary::from(proof_bz), + merkle_path: MerklePath { + key_path: vec![Binary::from(path.to_vec())], + }, + value: Binary::from(value_bz), + }; + verify_membership(deps.as_ref(), msg).unwrap(); + } + + #[test] + fn test_update_state() { + let mut deps = mk_deps(); + let creator = deps.api.addr_make("creator"); + let info = message_info(&creator, &coins(1, "uatom")); + + let fixture: StepsFixture = + fixtures::load("TestICS20TransferNativeCosmosCoinsToEthereumAndBack_Groth16"); + + let initial_state: InitialState = fixture.get_data_at_step(0); + + let client_state = initial_state.client_state; + let consensus_state = initial_state.consensus_state; + + let client_state_bz: Vec = serde_json::to_vec(&client_state).unwrap(); + let consensus_state_bz: Vec = serde_json::to_vec(&consensus_state).unwrap(); + + let msg = crate::msg::InstantiateMsg { + client_state: Binary::from(client_state_bz), + consensus_state: Binary::from(consensus_state_bz), + checksum: b"checksum".into(), + }; + instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + + let update_client: UpdateClient = fixture.get_data_at_step(1); + let header = update_client.updates[0].clone(); + let header_bz: Vec = serde_json::to_vec(&header).unwrap(); + + let msg = UpdateStateMsg { + client_message: Binary::from(header_bz), + }; + let res = update_state(deps.as_mut(), msg).unwrap(); + let update_state_result: UpdateStateResult = from_json(res).unwrap(); + assert_eq!(1, update_state_result.heights.len()); + assert_eq!( + header.consensus_update.attested_header.beacon.slot, + update_state_result.heights[0].revision_height + ); + } +} diff --git a/programs/cw-ics08-wasm-eth/src/test/fixture_types.rs b/programs/cw-ics08-wasm-eth/src/test/fixture_types.rs deleted file mode 100644 index e83e01dc..000000000 --- a/programs/cw-ics08-wasm-eth/src/test/fixture_types.rs +++ /dev/null @@ -1,40 +0,0 @@ -use ethereum_light_client::{ - client_state::ClientState, - consensus_state::ConsensusState, - types::{height::Height, light_client::Header, storage_proof::StorageProof}, -}; -use serde::{Deserialize, Serialize}; -use serde_with::{base64::Base64, serde_as}; - -// TODO: Remove this file once these types are in a separate package #143 - -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub enum DataType { - InitialState(Box), - CommitmentProof(Box), - UpdateClient(Box), -} - -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct InitialState { - pub client_state: ClientState, - pub consensus_state: ConsensusState, -} - -#[serde_as] -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct CommitmentProof { - #[serde_as(as = "Base64")] - pub path: Vec, - pub storage_proof: StorageProof, - pub proof_height: Height, - pub client_state: ClientState, - pub consensus_state: ConsensusState, -} - -#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct UpdateClient { - pub client_state: ClientState, - pub consensus_state: ConsensusState, - pub updates: Vec
, -} diff --git a/programs/cw-ics08-wasm-eth/src/test/mod.rs b/programs/cw-ics08-wasm-eth/src/test/mod.rs index 11036963..015c4d0c 100644 --- a/programs/cw-ics08-wasm-eth/src/test/mod.rs +++ b/programs/cw-ics08-wasm-eth/src/test/mod.rs @@ -1 +1,63 @@ -pub mod fixture_types; +use std::marker::PhantomData; + +use alloy_primitives::B256; +use cosmwasm_std::{ + testing::{ + mock_dependencies, MockApi, MockQuerier, MockQuerierCustomHandlerResult, MockStorage, + }, + Binary, OwnedDeps, SystemResult, +}; +use ethereum_light_client::test_utils::bls_verifier::{aggreagate, fast_aggregate_verify}; +use ethereum_types::consensus::bls::{BlsPublicKey, BlsSignature}; + +use crate::custom_query::EthereumCustomQuery; + +pub fn custom_query_handler(query: &EthereumCustomQuery) -> MockQuerierCustomHandlerResult { + match query { + EthereumCustomQuery::AggregateVerify { + public_keys, + message, + signature, + } => { + let public_keys = public_keys + .iter() + .map(|pk| pk.as_ref().try_into().unwrap()) + .collect::>(); + let message = B256::try_from(message.as_slice()).unwrap(); + let signature = BlsSignature::try_from(signature.as_slice()).unwrap(); + + fast_aggregate_verify(&public_keys, message, signature).unwrap(); + + SystemResult::Ok(cosmwasm_std::ContractResult::Ok::( + serde_json::to_vec(&true).unwrap().into(), + )) + } + EthereumCustomQuery::Aggregate { public_keys } => { + let public_keys = public_keys + .iter() + .map(|pk| pk.as_ref().try_into().unwrap()) + .collect::>(); + + let aggregate_pubkey = aggreagate(&public_keys).unwrap(); + + SystemResult::Ok(cosmwasm_std::ContractResult::Ok::( + serde_json::to_vec(&Binary::from(aggregate_pubkey.as_slice())) + .unwrap() + .into(), + )) + } + } +} + +pub fn mk_deps( +) -> OwnedDeps, EthereumCustomQuery> { + let deps = mock_dependencies(); + + OwnedDeps { + storage: deps.storage, + api: deps.api, + querier: MockQuerier::::new(&[]) + .with_custom_handler(custom_query_handler), + custom_query_type: PhantomData, + } +} diff --git a/programs/operator/Cargo.toml b/programs/operator/Cargo.toml index 0a30b073..3ef65b93 100644 --- a/programs/operator/Cargo.toml +++ b/programs/operator/Cargo.toml @@ -11,7 +11,6 @@ sp1-sdk = { workspace = true, default-features = true } serde_json = { workspace = true } serde = { workspace = true } serde_with = { workspace = true, features = ["hex", "macros"] } -hex = { workspace = true } subtle-encoding = { workspace = true } tokio = { workspace = true } @@ -21,15 +20,12 @@ anyhow = { workspace = true } clap = { workspace = true } tracing = { workspace = true, default-features = true } -cosmos-sdk-proto = { workspace = true } ibc-proto = { workspace = true } -tendermint = { workspace = true } tendermint-rpc = { workspace = true, features = ["http-client"] } tendermint-light-client-verifier = { workspace = true } ibc-client-tendermint-types = { workspace = true } -ibc-core-client-types = { workspace = true } ibc-core-commitment-types = { workspace = true } ibc-eureka-solidity-types = { workspace = true, features = ["rpc"] } @@ -37,5 +33,4 @@ sp1-ics07-tendermint-utils = { workspace = true } sp1-ics07-tendermint-prover = { workspace = true } alloy-sol-types = { workspace = true } -alloy-primitives = { workspace = true } alloy = { workspace = true, features = ["full", "node-bindings"] } diff --git a/programs/sp1-programs/misbehaviour/Cargo.toml b/programs/sp1-programs/misbehaviour/Cargo.toml index 41e0658f..9b9c459e 100644 --- a/programs/sp1-programs/misbehaviour/Cargo.toml +++ b/programs/sp1-programs/misbehaviour/Cargo.toml @@ -18,7 +18,6 @@ ibc-client-tendermint = { workspace = true, features = ["serde"] } ibc-core-host-types = { workspace = true } ibc-core-client = { workspace = true } ibc-primitives = { workspace = true } -ibc-core-handler-types = { workspace = true } sha2 = { workspace = true } alloy-sol-types = { workspace = true } serde_cbor = { workspace = true, features = ["std"] } diff --git a/programs/sp1-programs/update-client/Cargo.toml b/programs/sp1-programs/update-client/Cargo.toml index 00bdd181..f7545a86 100644 --- a/programs/sp1-programs/update-client/Cargo.toml +++ b/programs/sp1-programs/update-client/Cargo.toml @@ -18,7 +18,6 @@ ibc-client-tendermint = { workspace = true, features = ["serde"] } ibc-core-host-types = { workspace = true } ibc-core-client = { workspace = true } ibc-primitives = { workspace = true } -ibc-core-handler-types = { workspace = true } sha2 = { workspace = true } alloy-sol-types = { workspace = true } serde_cbor = { workspace = true, features = ["std"] }