From 7889385501a6fb6bef26c8746020a770dcbeca68 Mon Sep 17 00:00:00 2001 From: Daniel Savu <23065004+daniel-savu@users.noreply.github.com> Date: Tue, 4 Jul 2023 11:22:04 +0100 Subject: [PATCH] Relayer aggregation ism (#2411) ### Description Adds AggregationISM support to the relayer, by adding the scaffolding, sub-ism metadata fetching, and custom metadata encoding. ### Drive-by changes - adds `dry_run_verify(...)` to the `InterchainSecurityModule` trait and implements it for `EthereumInterchainSecurityModule` - changes the default ISM in the test environment from `routingIsm(multisigIsm)` to `routingIsm(aggregationIsm([multisigIsm, messageIdIsm], threshold = 1))` ### Related issues - Fixes https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/1757 ### Backward compatibility _Are these changes backward compatible?_ Yes _Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling?_ None ### Testing The AggregationISM metadata encoding is tested using unit tests whose input was taken from the tests in `AggregationIsm.t.sol`, by printing the individual ISM metadatas and the final metadata. The overall AggregationISM is tested with the `run-locally` script. --- .gitignore | 1 + rust/Cargo.lock | 714 ++++++++---------- .../relayer/src/msg/metadata/aggregation.rs | 262 +++++++ rust/agents/relayer/src/msg/metadata/base.rs | 25 +- rust/agents/relayer/src/msg/metadata/mod.rs | 2 + rust/chains/hyperlane-ethereum/Cargo.toml | 1 + .../abis/IAggregationIsm.abi.json | 63 ++ .../hyperlane-ethereum/src/aggregation_ism.rs | 117 +++ .../src/interchain_security_module.rs | 22 +- rust/chains/hyperlane-ethereum/src/lib.rs | 10 +- rust/hyperlane-base/src/settings/chains.rs | 31 +- .../src/traits/aggregation_ism.rs | 18 + .../src/traits/interchain_security_module.rs | 11 +- rust/hyperlane-core/src/traits/mod.rs | 2 + solidity/update_abis.sh | 3 +- .../environments/test/aggregationIsm.ts | 14 + .../infra/config/environments/test/core.ts | 7 +- .../config/environments/test/multisigIsm.ts | 42 +- .../config/environments/test/routingIsm.ts | 16 + 19 files changed, 951 insertions(+), 410 deletions(-) create mode 100644 rust/agents/relayer/src/msg/metadata/aggregation.rs create mode 100644 rust/chains/hyperlane-ethereum/abis/IAggregationIsm.abi.json create mode 100644 rust/chains/hyperlane-ethereum/src/aggregation_ism.rs create mode 100644 rust/hyperlane-core/src/traits/aggregation_ism.rs create mode 100644 typescript/infra/config/environments/test/aggregationIsm.ts create mode 100644 typescript/infra/config/environments/test/routingIsm.ts diff --git a/.gitignore b/.gitignore index 10470bd4a..98b688d0e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ yarn-error.log .idea **/*.ignore +.vscode diff --git a/rust/Cargo.lock b/rust/Cargo.lock index be99c270b..be26edcbd 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -52,9 +52,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher 0.4.4", @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -98,6 +98,18 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" +[[package]] +name = "allocator-api2" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -115,9 +127,9 @@ checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "ascii" @@ -144,7 +156,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -155,7 +167,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -289,9 +301,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64ct" @@ -313,9 +325,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bigdecimal" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" +checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" dependencies = [ "num-bigint", "num-integer", @@ -385,7 +397,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -493,9 +505,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bumpalo" -version = "3.12.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byte-slice-cast" @@ -511,9 +523,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytecheck" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fe11640a23eb24562225322cd3e452b93a3d4091d62fab69c70542fcd17d1f" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -522,9 +534,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31225543cb46f81a7e224762764f4a6a0f097b1db0b175f69e8065efaa42de5" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ "proc-macro2", "quote", @@ -615,13 +627,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "serde", "time 0.1.45", @@ -701,16 +713,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "coins-bip32" version = "0.7.0" @@ -720,13 +722,13 @@ dependencies = [ "bincode", "bs58", "coins-core", - "digest 0.10.6", + "digest 0.10.7", "getrandom", "hmac 0.12.1", "k256", "lazy_static", "serde", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -743,7 +745,7 @@ dependencies = [ "hmac 0.12.1", "pbkdf2 0.11.0", "rand", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -757,14 +759,14 @@ dependencies = [ "base64 0.12.3", "bech32 0.7.3", "blake2", - "digest 0.10.6", + "digest 0.10.7", "generic-array 0.14.7", "hex 0.4.3", "ripemd", "serde", "serde_derive", - "sha2 0.10.6", - "sha3 0.10.7", + "sha2 0.10.7", + "sha3 0.10.8", "thiserror", ] @@ -861,23 +863,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.20", + "time 0.3.22", "version_check", ] [[package]] name = "cookie_store" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e4b6aa369f41f5faa04bb80c9b1f4216ea81646ed6124d76ba5c49a7aafd9cd" +checksum = "d606d0fba62e13cf04db20536c05cb7f13673c161cb47a47a82b9b9e7d3f1daa" dependencies = [ "cookie", "idna 0.2.3", "log", "publicsuffix", "serde", + "serde_derive", "serde_json", - "time 0.3.20", + "time 0.3.22", "url", ] @@ -908,9 +911,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -952,9 +955,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -1038,56 +1041,12 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.2.5" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbcf33c2a618cbe41ee43ae6e9f2e48368cd9f9db2896f10167d8d762679f639" +checksum = "2a011bbe2c35ce9c1f143b7af6f94f29a167beb4cd1d29e6740ce836f723120e" dependencies = [ "nix", - "windows-sys 0.45.0", -] - -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.15", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", + "windows-sys 0.48.0", ] [[package]] @@ -1210,7 +1169,7 @@ dependencies = [ "hashbrown 0.12.3", "lock_api", "once_cell", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -1324,9 +1283,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", @@ -1440,7 +1399,7 @@ dependencies = [ "base16ct", "crypto-bigint 0.4.9", "der 0.6.1", - "digest 0.10.6", + "digest 0.10.7", "ff", "generic-array 0.14.7", "group", @@ -1521,9 +1480,9 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ - "aes 0.8.2", + "aes 0.8.3", "ctr 0.9.2", - "digest 0.10.6", + "digest 0.10.7", "hex 0.4.3", "hmac 0.12.1", "pbkdf2 0.11.0", @@ -1531,8 +1490,8 @@ dependencies = [ "scrypt 0.10.0", "serde", "serde_json", - "sha2 0.10.6", - "sha3 0.10.7", + "sha2 0.10.7", + "sha3 0.10.8", "thiserror", "uuid 0.8.2", ] @@ -1549,7 +1508,7 @@ dependencies = [ "regex", "serde", "serde_json", - "sha3 0.10.7", + "sha3 0.10.8", "thiserror", "uint", ] @@ -1809,7 +1768,7 @@ dependencies = [ "rand", "rusoto_core", "rusoto_kms", - "sha2 0.10.6", + "sha2 0.10.7", "spki", "thiserror", "tracing", @@ -1915,9 +1874,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1952,9 +1911,9 @@ dependencies = [ [[package]] name = "fuel-core-chain-config" -version = "0.17.11" +version = "0.17.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c858f8848e1f1a3d2dc060679983b75bd3160e62a5dfcf7afc2e5eabfdfa227" +checksum = "486833b8b3af3fce41c1f8c5e12acb45f93b0a6db8a771a5e2a84f920f356582" dependencies = [ "anyhow", "bech32 0.9.1", @@ -1972,9 +1931,9 @@ dependencies = [ [[package]] name = "fuel-core-client" -version = "0.17.11" +version = "0.17.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808f7273c7ea1ad10766794701f4dfc234426aa5a8b7e69720af007cd551889d" +checksum = "4cc0830731d96e7f5ce0e8a18c3d0fbc20ce84f9b879e0bc3afa73e63ae5ce25" dependencies = [ "anyhow", "cynic", @@ -1995,9 +1954,9 @@ dependencies = [ [[package]] name = "fuel-core-storage" -version = "0.17.11" +version = "0.17.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0430e82e41e840c954645450113bae55ab5b31d8f0e77154c94fa6eb6c01a04" +checksum = "56af0afd67f4384c074f1cea8f7c10eb96ab9a792c3756f4e2365da9dfec8ff1" dependencies = [ "anyhow", "fuel-core-types", @@ -2007,9 +1966,9 @@ dependencies = [ [[package]] name = "fuel-core-types" -version = "0.17.11" +version = "0.17.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b7da3d01bd0cc89a8e74f4b40bd5bf160fcec3b506d8503bdb0703846fc567" +checksum = "8ac1234394c27638b57adb9f7e36bbcb9bff3abfd484fc794c9962cdc4e60180" dependencies = [ "anyhow", "derive_more", @@ -2036,7 +1995,7 @@ dependencies = [ "rand", "secp256k1", "serde", - "sha2 0.10.6", + "sha2 0.10.7", "zeroize", ] @@ -2046,11 +2005,11 @@ version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b13103bf12f62930dd26f75f90d6a95d952fdcd677a356f57d8ef8df7ae02b84" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "fuel-storage", "hashbrown 0.13.2", "hex 0.4.3", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", ] @@ -2106,7 +2065,7 @@ dependencies = [ "itertools", "rand", "serde", - "sha3 0.10.7", + "sha3 0.10.8", "tai64", "thiserror", ] @@ -2371,7 +2330,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -2440,9 +2399,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -2453,9 +2412,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "glob" @@ -2486,9 +2445,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" dependencies = [ "bytes", "fnv", @@ -2530,6 +2489,16 @@ dependencies = [ "ahash 0.8.3", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash 0.8.3", + "allocator-api2", +] + [[package]] name = "hashers" version = "1.0.1" @@ -2541,11 +2510,11 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" +checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" dependencies = [ - "hashbrown 0.12.3", + "hashbrown 0.14.0", ] [[package]] @@ -2661,7 +2630,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2742,15 +2711,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.2" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" dependencies = [ "http", "hyper", - "rustls 0.20.8", + "rustls 0.21.2", "tokio", - "tokio-rustls 0.23.4", + "tokio-rustls 0.24.1", ] [[package]] @@ -2850,7 +2819,7 @@ dependencies = [ "primitive-types", "serde", "serde_json", - "sha3 0.10.7", + "sha3 0.10.8", "strum 0.24.1", "thiserror", "tokio", @@ -2869,6 +2838,7 @@ dependencies = [ "ethers-core", "ethers-prometheus", "ethers-signers", + "futures-util", "hex 0.4.3", "hyperlane-core", "num", @@ -2910,9 +2880,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2924,12 +2894,11 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -2959,6 +2928,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "impl-codec" version = "0.6.0" @@ -3042,9 +3021,9 @@ checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -3083,9 +3062,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -3110,15 +3089,15 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve 0.12.3", - "sha2 0.10.6", - "sha3 0.10.7", + "sha2 0.10.7", + "sha3 0.10.8", ] [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -3137,9 +3116,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.142" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libloading" @@ -3178,15 +3157,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -3195,15 +3165,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64f40e5e03e0d54f03845c8197d0291253cdbedfb1cb46b13c2c117554a9f4c" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -3211,12 +3181,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "lz4-sys" @@ -3266,7 +3233,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -3283,7 +3250,7 @@ dependencies = [ "sea-orm", "sea-orm-migration", "serde", - "time 0.3.20", + "time 0.3.22", "tokio", "tracing", "tracing-subscriber", @@ -3322,14 +3289,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -3535,18 +3501,18 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -3587,9 +3553,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.52" +version = "0.10.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" +checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019" dependencies = [ "bitflags", "cfg-if", @@ -3608,7 +3574,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -3619,9 +3585,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.87" +version = "0.9.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" +checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617" dependencies = [ "cc", "libc", @@ -3761,9 +3727,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.5.0" +version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" [[package]] name = "ouroboros" @@ -3802,9 +3768,9 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "parity-scale-codec" -version = "3.4.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" +checksum = "430d26d62e66cbff6ae144e8eebd43c0235922dec7e3aa0d2016c32d4575bf45" dependencies = [ "arrayvec", "bitvec 1.0.1", @@ -3816,9 +3782,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "a1620b1e3fc72ebaee01ff56fca838bab537c5d093a18b3549c3bbea374aa0b6" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -3844,7 +3810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -3863,15 +3829,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] @@ -3927,10 +3893,10 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "hmac 0.12.1", "password-hash 0.4.2", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -3941,15 +3907,15 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "16833386b02953ca926d19f64af613b9bf742c48dcd5e09b32fbfc9740bf84e2" dependencies = [ "thiserror", "ucd-trie", @@ -3957,9 +3923,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "7763190f9406839f99e5197afee8c9e759969f7dbfa40ad3b8dbee8757b745b5" dependencies = [ "pest", "pest_generator", @@ -3967,26 +3933,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "249061b22e99973da1f5f5f1410284419e283bb60b79255bf5f42a94b66a2e00" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "457c310cfc9cf3f22bc58901cc7f0d3410ac5d6298e432a4f9a6138565cb6df6" dependencies = [ "once_cell", "pest", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -4001,22 +3967,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] @@ -4043,9 +4009,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "portpicker" @@ -4162,9 +4128,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -4228,9 +4194,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -4308,13 +4274,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.1", + "regex-syntax 0.7.2", ] [[package]] @@ -4334,9 +4300,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "relayer" @@ -4382,11 +4348,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.17" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "bytes", "cookie", "cookie_store", @@ -4397,7 +4363,7 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls 0.23.2", + "hyper-rustls 0.24.0", "hyper-tls", "ipnet", "js-sys", @@ -4407,14 +4373,14 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.20.8", + "rustls 0.21.2", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", - "tokio-rustls 0.23.4", + "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", @@ -4456,28 +4422,31 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] name = "rkyv" -version = "0.7.41" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21499ed91807f07ae081880aabb2ccc0235e9d88011867d984525e9a4c3cfa3e" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" dependencies = [ + "bitvec 1.0.1", "bytecheck", "hashbrown 0.12.3", "ptr_meta", "rend", "rkyv_derive", "seahash", + "tinyvec", + "uuid 1.3.4", ] [[package]] name = "rkyv_derive" -version = "0.7.41" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1c672430eb41556291981f45ca900a0239ad007242d1cb4b4167af842db666" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ "proc-macro2", "quote", @@ -4661,9 +4630,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.29.1" +version = "1.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26bd36b60561ee1fb5ec2817f198b6fd09fa571c897a5e86d1487cfc2b096dfc" +checksum = "d0446843641c69436765a35a5a77088e28c2e6a12da93e84aa3ab1cd4aa5a042" dependencies = [ "arrayvec", "borsh", @@ -4706,9 +4675,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.18" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", @@ -4743,6 +4712,18 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "rustls" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct 0.7.0", +] + [[package]] name = "rustls-native-certs" version = "0.5.0" @@ -4761,7 +4742,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +dependencies = [ + "ring", + "untrusted", ] [[package]] @@ -4805,9 +4796,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfdef77228a4c05dc94211441595746732131ad7f6530c6c18f045da7b7ab937" +checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" dependencies = [ "cfg-if", "derive_more", @@ -4869,7 +4860,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "time 0.3.20", + "time 0.3.22", "tokio", "tokio-test", "tracing", @@ -4877,12 +4868,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "scrypt" version = "0.7.0" @@ -4906,7 +4891,7 @@ dependencies = [ "hmac 0.12.1", "pbkdf2 0.11.0", "salsa20 0.10.2", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -4951,10 +4936,10 @@ dependencies = [ "serde_json", "sqlx", "thiserror", - "time 0.3.20", + "time 0.3.22", "tracing", "url", - "uuid 1.3.2", + "uuid 1.3.4", ] [[package]] @@ -5005,24 +4990,24 @@ dependencies = [ [[package]] name = "sea-query" -version = "0.28.4" +version = "0.28.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd34be05fdde9ec79231414bdd44ba1aa9c57349190076699e90721cb5eb59b" +checksum = "bbab99b8cd878ab7786157b7eb8df96333a6807cc6e45e8888c85b51534b401a" dependencies = [ "bigdecimal", "chrono", "rust_decimal", "sea-query-derive", "serde_json", - "time 0.3.20", - "uuid 1.3.2", + "time 0.3.22", + "uuid 1.3.4", ] [[package]] name = "sea-query-binder" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03548c63aec07afd4fd190923e0160d2f2fc92def27470b54154cf232da6203b" +checksum = "4cea85029985b40dfbf18318d85fe985c04db7c1b4e5e8e0a0a0cdff5f1e30f9" dependencies = [ "bigdecimal", "chrono", @@ -5030,8 +5015,8 @@ dependencies = [ "sea-query", "serde_json", "sqlx", - "time 0.3.20", - "uuid 1.3.2", + "time 0.3.22", + "uuid 1.3.4", ] [[package]] @@ -5142,9 +5127,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ "bitflags", "core-foundation", @@ -5155,9 +5140,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" dependencies = [ "core-foundation-sys", "libc", @@ -5180,9 +5165,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] @@ -5199,20 +5184,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" dependencies = [ "itoa", "ryu", @@ -5262,7 +5247,7 @@ checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -5273,7 +5258,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -5303,13 +5288,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -5326,11 +5311,11 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c2bb1a323307527314a36bfb73f24febb08ce2b8a554bf4ffd6f51ad15198c" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "keccak", ] @@ -5364,7 +5349,7 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "rand_core", ] @@ -5487,16 +5472,16 @@ dependencies = [ "serde", "serde_json", "sha1", - "sha2 0.10.6", + "sha2 0.10.7", "smallvec", "sqlformat", "sqlx-rt", "stringprep", "thiserror", - "time 0.3.20", + "time 0.3.22", "tokio-stream", "url", - "uuid 1.3.2", + "uuid 1.3.4", "whoami", ] @@ -5618,9 +5603,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -5644,24 +5629,16 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.45.0", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", + "windows-sys 0.48.0", ] [[package]] @@ -5693,7 +5670,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -5741,9 +5718,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", "serde", @@ -5753,15 +5730,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" dependencies = [ "time-core", ] @@ -5792,9 +5769,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.0" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "bytes", @@ -5827,7 +5804,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -5862,6 +5839,16 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.2", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.14" @@ -5939,15 +5926,15 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ "indexmap", "toml_datetime", @@ -5981,14 +5968,14 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", "valuable", @@ -6166,9 +6153,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -6185,12 +6172,6 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "unicode-xid" version = "0.2.4" @@ -6220,11 +6201,11 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.6.2" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" +checksum = "d4b45063f47caea744e48f5baa99169bd8bd9b882d80a99941141327bbb00f99" dependencies = [ - "base64 0.13.1", + "base64 0.21.2", "log", "once_cell", "url", @@ -6232,12 +6213,12 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna 0.3.0", + "idna 0.4.0", "percent-encoding", ] @@ -6259,9 +6240,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.3.2" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dad5567ad0cf5b760e5665964bec1b47dfd077ba8a2544b513f3556d3d239a2" +checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" dependencies = [ "serde", ] @@ -6326,11 +6307,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -6379,9 +6359,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -6389,24 +6369,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -6416,9 +6396,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6426,22 +6406,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-timer" @@ -6460,9 +6440,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -6564,7 +6544,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets", ] [[package]] @@ -6582,37 +6562,13 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -6716,9 +6672,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] @@ -6762,9 +6718,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.4" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" +checksum = "52839dc911083a8ef63efa4d039d1f58b5e409f923e44c80828f206f66e5541c" [[package]] name = "yaml-rust" @@ -6792,7 +6748,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] diff --git a/rust/agents/relayer/src/msg/metadata/aggregation.rs b/rust/agents/relayer/src/msg/metadata/aggregation.rs new file mode 100644 index 000000000..3c6e9ee17 --- /dev/null +++ b/rust/agents/relayer/src/msg/metadata/aggregation.rs @@ -0,0 +1,262 @@ +use async_trait::async_trait; +use derive_more::Deref; +use futures_util::future::join_all; + +use derive_new::new; +use eyre::Context; +use tracing::{info, instrument}; + +use hyperlane_core::{HyperlaneMessage, InterchainSecurityModule, H256, U256}; + +use super::{BaseMetadataBuilder, MetadataBuilder}; + +/// Bytes used to store one member of the (start, end) range tuple +/// Copied from `AggregationIsmMetadata.sol` +const METADATA_RANGE_SIZE: usize = 4; + +#[derive(Clone, Debug, new, Deref)] +pub struct AggregationIsmMetadataBuilder { + base: BaseMetadataBuilder, +} + +#[derive(Clone, Debug, new, PartialEq, Eq)] +struct SubModuleMetadata { + /// The index of the sub-module (ISM) in the aggregation ISM. + index: usize, + /// The metadata for the sub-module. + metadata: Vec, +} + +#[derive(Debug)] +struct IsmAndMetadata { + ism: Box, + meta: SubModuleMetadata, +} + +impl IsmAndMetadata { + fn new(ism: Box, index: usize, metadata: Vec) -> Self { + Self { + ism, + meta: SubModuleMetadata::new(index, metadata), + } + } +} + +impl AggregationIsmMetadataBuilder { + fn format_metadata(metadatas: &mut [SubModuleMetadata], ism_count: usize) -> Vec { + // See test solidity implementation of this fn at: + // https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/445da4fb0d8140a08c4b314e3051b7a934b0f968/solidity/test/isms/AggregationIsm.t.sol#L35 + fn encode_byte_index(i: usize) -> [u8; 4] { + (i as u32).to_be_bytes() + } + let range_tuples_size = METADATA_RANGE_SIZE * 2 * ism_count; + // Format of metadata: + // [????:????] Metadata start/end uint32 ranges, packed as uint64 + // [????:????] ISM metadata, packed encoding + // Initialize the range tuple part of the buffer, so the actual metadatas can + // simply be appended to it + let mut buffer = vec![0; range_tuples_size]; + for SubModuleMetadata { index, metadata } in metadatas.iter_mut() { + let range_start = buffer.len(); + buffer.append(metadata); + let range_end = buffer.len(); + + // The new tuple starts at the end of the previous ones. + // Also see: https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/445da4fb0d8140a08c4b314e3051b7a934b0f968/solidity/contracts/libs/isms/AggregationIsmMetadata.sol#L49 + let encoded_range_start = METADATA_RANGE_SIZE * 2 * (*index); + // Overwrite the 0-initialized buffer + buffer.splice( + encoded_range_start..(encoded_range_start + METADATA_RANGE_SIZE * 2), + [encode_byte_index(range_start), encode_byte_index(range_end)].concat(), + ); + } + buffer + } + + fn n_cheapest_metas( + mut metas_and_gas: Vec<(SubModuleMetadata, U256)>, + n: usize, + ) -> Vec { + // Sort by gas cost in ascending order + metas_and_gas.sort_by(|(_, gas_1), (_, gas_2)| gas_1.cmp(gas_2)); + // Take the cheapest n (the aggregation ISM threshold) + let mut cheapest: Vec<_> = metas_and_gas[..n].into(); + // Sort by index in ascending order, to match the order expected by the smart contract + cheapest.sort_by(|(meta_1, _), (meta_2, _)| meta_1.index.cmp(&meta_2.index)); + cheapest.into_iter().map(|(meta, _)| meta).collect() + } + + async fn cheapest_valid_metas( + sub_modules: Vec, + message: &HyperlaneMessage, + threshold: usize, + ) -> Option> { + let gas_cost_results: Vec<_> = join_all( + sub_modules + .iter() + .map(|module| module.ism.dry_run_verify(message, &(module.meta.metadata))), + ) + .await; + + // Filter out the ISMs without a gas cost estimate + let metas_and_gas: Vec<_> = sub_modules + .into_iter() + .zip(gas_cost_results.into_iter()) + .filter_map(|(module, gas_cost)| gas_cost.ok().flatten().map(|gc| (module.meta, gc))) + .collect(); + + let metas_and_gas_count = metas_and_gas.len(); + if metas_and_gas_count < threshold { + info!("Could not fetch all metadata: Found {metas_and_gas_count} of the {threshold} required ISM metadata pieces"); + return None; + } + Some(Self::n_cheapest_metas(metas_and_gas, threshold)) + } +} + +#[async_trait] +impl MetadataBuilder for AggregationIsmMetadataBuilder { + #[instrument(err, skip(self))] + async fn build( + &self, + ism_address: H256, + message: &HyperlaneMessage, + ) -> eyre::Result>> { + const CTX: &str = "When fetching AggregationIsm metadata"; + let ism = self.build_aggregation_ism(ism_address).await.context(CTX)?; + let (ism_addresses, threshold) = ism.modules_and_threshold(message).await.context(CTX)?; + let threshold = threshold as usize; + + let metas = join_all( + ism_addresses + .iter() + .map(|ism_address| self.base.build(*ism_address, message)), + ) + .await; + + let sub_modules = join_all( + ism_addresses + .iter() + .map(|ism_address| self.base.build_ism(*ism_address)), + ) + .await; + + let filtered_sub_module_metas = metas + .into_iter() + .enumerate() + .zip(sub_modules.into_iter()) + .filter_map(|((index, meta_result), sub_module_result)| { + match (meta_result, sub_module_result) { + (Ok(Some(meta)), Ok(ism)) => Some(IsmAndMetadata::new(ism, index, meta)), + _ => None, + } + }) + .collect(); + + let maybe_aggregation_metadata = + Self::cheapest_valid_metas(filtered_sub_module_metas, message, threshold) + .await + .map(|mut metas| Self::format_metadata(&mut metas, ism_addresses.len())); + Ok(maybe_aggregation_metadata) + } +} + +#[cfg(test)] +mod test { + use ethers::utils::hex::FromHex; + + use super::*; + + #[test] + fn test_format_n_of_n_metadata_works_correctly() { + let mut metadatas = vec![ + SubModuleMetadata::new( + 0, + Vec::from_hex("290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563") + .unwrap(), + ), + SubModuleMetadata::new( + 1, + Vec::from_hex("510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9") + .unwrap(), + ), + SubModuleMetadata::new( + 2, + Vec::from_hex("356e5a2cc1eba076e650ac7473fccc37952b46bc2e419a200cec0c451dce2336") + .unwrap(), + ), + ]; + let expected = Vec::from_hex("000000180000003800000038000000580000005800000078290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9356e5a2cc1eba076e650ac7473fccc37952b46bc2e419a200cec0c451dce2336").unwrap(); + assert_eq!( + AggregationIsmMetadataBuilder::format_metadata(&mut metadatas, 3), + expected + ); + } + + #[test] + fn test_format_n_of_m_metadata_works_correctly() { + // We're passing the metadatas of 4 ISMs (indexes 0, 1, 2, 4) out of 5 + let mut metadatas = vec![ + SubModuleMetadata::new( + 0, + Vec::from_hex("290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563") + .unwrap(), + ), + SubModuleMetadata::new( + 1, + Vec::from_hex("510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9") + .unwrap(), + ), + SubModuleMetadata::new( + 2, + Vec::from_hex("356e5a2cc1eba076e650ac7473fccc37952b46bc2e419a200cec0c451dce2336") + .unwrap(), + ), + SubModuleMetadata::new( + 4, + Vec::from_hex("f2e59013a0a379837166b59f871b20a8a0d101d1c355ea85d35329360e69c000") + .unwrap(), + ), + ]; + let expected = Vec::from_hex("000000280000004800000048000000680000006800000088000000000000000000000088000000a8290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9356e5a2cc1eba076e650ac7473fccc37952b46bc2e419a200cec0c451dce2336f2e59013a0a379837166b59f871b20a8a0d101d1c355ea85d35329360e69c000").unwrap(); + assert_eq!( + AggregationIsmMetadataBuilder::format_metadata(&mut metadatas, 5), + expected + ); + } + + #[test] + fn test_format_empty_metadata_works_correctly() { + let mut metadatas = vec![SubModuleMetadata::new(0, Vec::from_hex("").unwrap())]; + let expected = Vec::from_hex("0000000800000008").unwrap(); + assert_eq!( + AggregationIsmMetadataBuilder::format_metadata(&mut metadatas, 1), + expected + ); + } + + #[test] + fn test_n_cheapest_metas_works() { + let metas_and_gas = vec![ + ( + SubModuleMetadata::new(3, vec![]), + U256::from_dec_str("3").unwrap(), + ), + ( + SubModuleMetadata::new(2, vec![]), + U256::from_dec_str("2").unwrap(), + ), + ( + SubModuleMetadata::new(1, vec![]), + U256::from_dec_str("1").unwrap(), + ), + ]; + assert_eq!( + AggregationIsmMetadataBuilder::n_cheapest_metas(metas_and_gas, 2), + vec![ + SubModuleMetadata::new(1, vec![]), + SubModuleMetadata::new(2, vec![]) + ] + ) + } +} diff --git a/rust/agents/relayer/src/msg/metadata/base.rs b/rust/agents/relayer/src/msg/metadata/base.rs index 32d6e488f..78698d534 100644 --- a/rust/agents/relayer/src/msg/metadata/base.rs +++ b/rust/agents/relayer/src/msg/metadata/base.rs @@ -13,8 +13,8 @@ use hyperlane_base::{ }; use hyperlane_core::accumulator::merkle::Proof; use hyperlane_core::{ - Checkpoint, HyperlaneDomain, HyperlaneMessage, ModuleType, MultisigIsm, RoutingIsm, - ValidatorAnnounce, H160, H256, + AggregationIsm, Checkpoint, HyperlaneDomain, HyperlaneMessage, InterchainSecurityModule, + ModuleType, MultisigIsm, RoutingIsm, ValidatorAnnounce, H160, H256, }; use crate::merkle_tree_builder::MerkleTreeBuilder; @@ -22,7 +22,7 @@ use crate::msg::metadata::multisig::{ LegacyMultisigMetadataBuilder, MerkleRootMultisigMetadataBuilder, MessageIdMultisigMetadataBuilder, }; -use crate::msg::metadata::RoutingIsmMetadataBuilder; +use crate::msg::metadata::{AggregationIsmMetadataBuilder, RoutingIsmMetadataBuilder}; #[derive(Debug, thiserror::Error)] pub enum MetadataBuilderError { @@ -72,11 +72,7 @@ impl MetadataBuilder for BaseMetadataBuilder { message: &HyperlaneMessage, ) -> Result>> { const CTX: &str = "When fetching module type"; - let ism = self - .destination_chain_setup - .build_ism(ism_address, &self.metrics) - .await - .context(CTX)?; + let ism = self.build_ism(ism_address).await.context(CTX)?; let module_type = ism.module_type().await.context(CTX)?; let base = self.clone_with_incremented_depth()?; @@ -87,6 +83,7 @@ impl MetadataBuilder for BaseMetadataBuilder { } ModuleType::MessageIdMultisig => Box::new(MessageIdMultisigMetadataBuilder::new(base)), ModuleType::Routing => Box::new(RoutingIsmMetadataBuilder::new(base)), + ModuleType::Aggregation => Box::new(AggregationIsmMetadataBuilder::new(base)), _ => return Err(MetadataBuilderError::UnsupportedModuleType(module_type).into()), }; metadata_builder @@ -138,6 +135,12 @@ impl BaseMetadataBuilder { self.origin_prover_sync.read().await.count() - 1 } + pub async fn build_ism(&self, address: H256) -> Result> { + self.destination_chain_setup + .build_ism(address, &self.metrics) + .await + } + pub async fn build_routing_ism(&self, address: H256) -> Result> { self.destination_chain_setup .build_routing_ism(address, &self.metrics) @@ -150,6 +153,12 @@ impl BaseMetadataBuilder { .await } + pub async fn build_aggregation_ism(&self, address: H256) -> Result> { + self.destination_chain_setup + .build_aggregation_ism(address, &self.metrics) + .await + } + pub async fn build_checkpoint_syncer( &self, validators: &[H256], diff --git a/rust/agents/relayer/src/msg/metadata/mod.rs b/rust/agents/relayer/src/msg/metadata/mod.rs index ee829e935..725821a54 100644 --- a/rust/agents/relayer/src/msg/metadata/mod.rs +++ b/rust/agents/relayer/src/msg/metadata/mod.rs @@ -1,7 +1,9 @@ +mod aggregation; mod base; mod multisig; mod routing; +use aggregation::AggregationIsmMetadataBuilder; pub(crate) use base::BaseMetadataBuilder; pub(crate) use base::MetadataBuilder; use routing::RoutingIsmMetadataBuilder; diff --git a/rust/chains/hyperlane-ethereum/Cargo.toml b/rust/chains/hyperlane-ethereum/Cargo.toml index eb99995db..dac732e5e 100644 --- a/rust/chains/hyperlane-ethereum/Cargo.toml +++ b/rust/chains/hyperlane-ethereum/Cargo.toml @@ -15,6 +15,7 @@ ethers-contract.workspace = true ethers-core.workspace = true ethers-signers.workspace = true ethers.workspace = true +futures-util.workspace = true hex = "0.4.3" num = "0.4" reqwest.workspace = true diff --git a/rust/chains/hyperlane-ethereum/abis/IAggregationIsm.abi.json b/rust/chains/hyperlane-ethereum/abis/IAggregationIsm.abi.json new file mode 100644 index 000000000..ea571318d --- /dev/null +++ b/rust/chains/hyperlane-ethereum/abis/IAggregationIsm.abi.json @@ -0,0 +1,63 @@ +[ + { + "inputs": [], + "name": "moduleType", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + } + ], + "name": "modulesAndThreshold", + "outputs": [ + { + "internalType": "address[]", + "name": "modules", + "type": "address[]" + }, + { + "internalType": "uint8", + "name": "threshold", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_metadata", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/rust/chains/hyperlane-ethereum/src/aggregation_ism.rs b/rust/chains/hyperlane-ethereum/src/aggregation_ism.rs new file mode 100644 index 000000000..7a56dc06b --- /dev/null +++ b/rust/chains/hyperlane-ethereum/src/aggregation_ism.rs @@ -0,0 +1,117 @@ +#![allow(clippy::enum_variant_names)] +#![allow(missing_docs)] + +use std::collections::HashMap; +use std::sync::Arc; + +use async_trait::async_trait; +use ethers::providers::Middleware; +use tracing::instrument; + +use hyperlane_core::{ + AggregationIsm, ChainResult, ContractLocator, HyperlaneAbi, HyperlaneChain, HyperlaneContract, + HyperlaneDomain, HyperlaneMessage, HyperlaneProvider, RawHyperlaneMessage, H256, +}; + +use crate::contracts::i_aggregation_ism::{ + IAggregationIsm as EthereumAggregationIsmInternal, IAGGREGATIONISM_ABI, +}; +use crate::trait_builder::BuildableWithProvider; +use crate::EthereumProvider; + +pub struct AggregationIsmBuilder {} + +#[async_trait] +impl BuildableWithProvider for AggregationIsmBuilder { + type Output = Box; + + async fn build_with_provider( + &self, + provider: M, + locator: &ContractLocator, + ) -> Self::Output { + Box::new(EthereumAggregationIsm::new(Arc::new(provider), locator)) + } +} + +/// A reference to an AggregationIsm contract on some Ethereum chain +#[derive(Debug)] +pub struct EthereumAggregationIsm +where + M: Middleware, +{ + contract: Arc>, + domain: HyperlaneDomain, +} + +impl EthereumAggregationIsm +where + M: Middleware + 'static, +{ + /// Create a reference to a mailbox at a specific Ethereum address on some + /// chain + pub fn new(provider: Arc, locator: &ContractLocator) -> Self { + Self { + contract: Arc::new(EthereumAggregationIsmInternal::new( + locator.address, + provider, + )), + domain: locator.domain.clone(), + } + } +} + +impl HyperlaneChain for EthereumAggregationIsm +where + M: Middleware + 'static, +{ + fn domain(&self) -> &HyperlaneDomain { + &self.domain + } + + fn provider(&self) -> Box { + Box::new(EthereumProvider::new( + self.contract.client(), + self.domain.clone(), + )) + } +} + +impl HyperlaneContract for EthereumAggregationIsm +where + M: Middleware + 'static, +{ + fn address(&self) -> H256 { + self.contract.address().into() + } +} + +#[async_trait] +impl AggregationIsm for EthereumAggregationIsm +where + M: Middleware + 'static, +{ + #[instrument(err)] + async fn modules_and_threshold( + &self, + message: &HyperlaneMessage, + ) -> ChainResult<(Vec, u8)> { + let (isms, threshold) = self + .contract + .modules_and_threshold(RawHyperlaneMessage::from(message).to_vec().into()) + .call() + .await?; + let isms_h256 = isms.iter().map(|address| (*address).into()).collect(); + Ok((isms_h256, threshold)) + } +} + +pub struct EthereumRoutingIsmAbi; + +impl HyperlaneAbi for EthereumRoutingIsmAbi { + const SELECTOR_SIZE_BYTES: usize = 4; + + fn fn_map() -> HashMap, &'static str> { + super::extract_fn_map(&IAGGREGATIONISM_ABI) + } +} diff --git a/rust/chains/hyperlane-ethereum/src/interchain_security_module.rs b/rust/chains/hyperlane-ethereum/src/interchain_security_module.rs index f317659a2..accc0ef29 100644 --- a/rust/chains/hyperlane-ethereum/src/interchain_security_module.rs +++ b/rust/chains/hyperlane-ethereum/src/interchain_security_module.rs @@ -8,9 +8,11 @@ use async_trait::async_trait; use ethers::providers::Middleware; use tracing::{instrument, warn}; +use futures_util::future::try_join; use hyperlane_core::{ ChainResult, ContractLocator, HyperlaneAbi, HyperlaneChain, HyperlaneContract, HyperlaneDomain, - HyperlaneProvider, InterchainSecurityModule, ModuleType, H256, + HyperlaneMessage, HyperlaneProvider, InterchainSecurityModule, ModuleType, RawHyperlaneMessage, + H256, U256, }; use num_traits::cast::FromPrimitive; @@ -106,6 +108,24 @@ where Ok(ModuleType::Unused) } } + + #[instrument] + async fn dry_run_verify( + &self, + message: &HyperlaneMessage, + metadata: &[u8], + ) -> ChainResult> { + let tx = self.contract.verify( + metadata.to_owned().into(), + RawHyperlaneMessage::from(message).to_vec().into(), + ); + let (verifies, gas_estimate) = try_join(tx.call(), tx.estimate_gas()).await?; + if verifies { + Ok(Some(gas_estimate)) + } else { + Ok(None) + } + } } pub struct EthereumInterchainSecurityModuleAbi; diff --git a/rust/chains/hyperlane-ethereum/src/lib.rs b/rust/chains/hyperlane-ethereum/src/lib.rs index 0a8d33300..791d84793 100644 --- a/rust/chains/hyperlane-ethereum/src/lib.rs +++ b/rust/chains/hyperlane-ethereum/src/lib.rs @@ -10,9 +10,9 @@ use ethers::prelude::{abi, Lazy, Middleware}; #[cfg(not(doctest))] pub use self::{ - config::*, interchain_gas::*, interchain_security_module::*, mailbox::*, multisig_ism::*, - provider::*, routing_ism::*, rpc_clients::*, signers::*, singleton_signer::*, trait_builder::*, - validator_announce::*, + aggregation_ism::*, config::*, interchain_gas::*, interchain_security_module::*, mailbox::*, + multisig_ism::*, provider::*, routing_ism::*, rpc_clients::*, signers::*, singleton_signer::*, + trait_builder::*, validator_announce::*, }; #[cfg(not(doctest))] @@ -49,6 +49,10 @@ mod routing_ism; #[cfg(not(doctest))] mod validator_announce; +/// AggregationIsm abi +#[cfg(not(doctest))] +mod aggregation_ism; + /// Generated contract bindings. #[cfg(not(doctest))] mod contracts; diff --git a/rust/hyperlane-base/src/settings/chains.rs b/rust/hyperlane-base/src/settings/chains.rs index 46a1e49bf..233b1a9ba 100644 --- a/rust/hyperlane-base/src/settings/chains.rs +++ b/rust/hyperlane-base/src/settings/chains.rs @@ -8,10 +8,10 @@ use ethers_prometheus::middleware::{ ChainInfo, ContractInfo, PrometheusMiddlewareConf, WalletInfo, }; use hyperlane_core::{ - config::*, ContractLocator, HyperlaneAbi, HyperlaneDomain, HyperlaneDomainProtocol, - HyperlaneProvider, HyperlaneSigner, Indexer, InterchainGasPaymaster, InterchainGasPayment, - InterchainSecurityModule, Mailbox, MessageIndexer, MultisigIsm, RoutingIsm, ValidatorAnnounce, - H160, H256, + config::*, AggregationIsm, ContractLocator, HyperlaneAbi, HyperlaneDomain, + HyperlaneDomainProtocol, HyperlaneProvider, HyperlaneSigner, Indexer, InterchainGasPaymaster, + InterchainGasPayment, InterchainSecurityModule, Mailbox, MessageIndexer, MultisigIsm, + RoutingIsm, ValidatorAnnounce, H160, H256, }; use hyperlane_ethereum::{ self as h_eth, BuildableWithProvider, EthereumInterchainGasPaymasterAbi, EthereumMailboxAbi, @@ -529,6 +529,29 @@ impl ChainConf { .context(ctx) } + /// Try to convert the chain setting into an AggregationIsm Ism contract + pub async fn build_aggregation_ism( + &self, + address: H256, + metrics: &CoreMetrics, + ) -> Result> { + let ctx = "Building aggregation ISM"; + let locator = ContractLocator { + domain: &self.domain, + address, + }; + + match &self.connection()? { + ChainConnectionConf::Ethereum(conf) => { + self.build_ethereum(conf, &locator, metrics, h_eth::AggregationIsmBuilder {}) + .await + } + + ChainConnectionConf::Fuel(_) => todo!(), + } + .context(ctx) + } + async fn signer(&self) -> Result> { if let Some(conf) = &self.signer { Ok(Some(conf.build::().await?)) diff --git a/rust/hyperlane-core/src/traits/aggregation_ism.rs b/rust/hyperlane-core/src/traits/aggregation_ism.rs new file mode 100644 index 000000000..178598b4a --- /dev/null +++ b/rust/hyperlane-core/src/traits/aggregation_ism.rs @@ -0,0 +1,18 @@ +use std::fmt::Debug; + +use async_trait::async_trait; +use auto_impl::auto_impl; + +use crate::{ChainResult, HyperlaneContract, HyperlaneMessage, H256}; + +/// Interface for the AggregationIsm chain contract. Allows abstraction over +/// different chains +#[async_trait] +#[auto_impl(&, Box, Arc)] +pub trait AggregationIsm: HyperlaneContract + Send + Sync + Debug { + /// Returns the `m` ISMs and `n` threshold needed to n-of-m verify the message + async fn modules_and_threshold( + &self, + message: &HyperlaneMessage, + ) -> ChainResult<(Vec, u8)>; +} diff --git a/rust/hyperlane-core/src/traits/interchain_security_module.rs b/rust/hyperlane-core/src/traits/interchain_security_module.rs index 1f4f707e8..04b20aa58 100644 --- a/rust/hyperlane-core/src/traits/interchain_security_module.rs +++ b/rust/hyperlane-core/src/traits/interchain_security_module.rs @@ -3,9 +3,10 @@ use std::fmt::Debug; use async_trait::async_trait; use auto_impl::auto_impl; use num_derive::FromPrimitive; +use primitive_types::U256; use strum::Display; -use crate::{ChainResult, HyperlaneContract}; +use crate::{ChainResult, HyperlaneContract, HyperlaneMessage}; /// Enumeration of all known module types #[derive(FromPrimitive, Clone, Debug, Default, Display, Copy, PartialEq, Eq)] @@ -33,4 +34,12 @@ pub trait InterchainSecurityModule: HyperlaneContract + Send + Sync + Debug { /// Returns the module type of the ISM compliant with the corresponding /// metadata offchain fetching and onchain formatting standard. async fn module_type(&self) -> ChainResult; + + /// Dry runs the `verify()` ISM call and returns `Some(gas_estimate)` if the call + /// succeeds. + async fn dry_run_verify( + &self, + message: &HyperlaneMessage, + metadata: &[u8], + ) -> ChainResult>; } diff --git a/rust/hyperlane-core/src/traits/mod.rs b/rust/hyperlane-core/src/traits/mod.rs index ea0c62a97..63a3bcd8f 100644 --- a/rust/hyperlane-core/src/traits/mod.rs +++ b/rust/hyperlane-core/src/traits/mod.rs @@ -1,3 +1,4 @@ +pub use aggregation_ism::*; pub use cursor::*; pub use db::*; pub use deployed::*; @@ -12,6 +13,7 @@ pub use routing_ism::*; pub use signing::*; pub use validator_announce::*; +mod aggregation_ism; mod cursor; mod db; mod deployed; diff --git a/solidity/update_abis.sh b/solidity/update_abis.sh index 48e44f005..94e95ed98 100755 --- a/solidity/update_abis.sh +++ b/solidity/update_abis.sh @@ -14,4 +14,5 @@ copy interfaces/IInterchainGasPaymaster && \ copy interfaces/IValidatorAnnounce && \ copy interfaces/IInterchainSecurityModule && \ copy interfaces/isms/IMultisigIsm && \ -copy interfaces/isms/IRoutingIsm +copy interfaces/isms/IRoutingIsm && \ +copy interfaces/isms/IAggregationIsm diff --git a/typescript/infra/config/environments/test/aggregationIsm.ts b/typescript/infra/config/environments/test/aggregationIsm.ts new file mode 100644 index 000000000..0e0d140af --- /dev/null +++ b/typescript/infra/config/environments/test/aggregationIsm.ts @@ -0,0 +1,14 @@ +import { AggregationIsmConfig, ModuleType } from '@hyperlane-xyz/sdk'; + +import { merkleRootMultisig, messageIdMultisig } from './multisigIsm'; + +export const aggregationIsm = (validatorKey: string): AggregationIsmConfig => { + return { + type: ModuleType.AGGREGATION, + modules: [ + merkleRootMultisig(validatorKey), + messageIdMultisig(validatorKey), + ], + threshold: 1, + }; +}; diff --git a/typescript/infra/config/environments/test/core.ts b/typescript/infra/config/environments/test/core.ts index 8554d2bcc..ee36617c1 100644 --- a/typescript/infra/config/environments/test/core.ts +++ b/typescript/infra/config/environments/test/core.ts @@ -6,7 +6,8 @@ import { objMap, } from '@hyperlane-xyz/sdk'; -import { multisigIsm } from './multisigIsm'; +import { aggregationIsm } from './aggregationIsm'; +import { chainToValidator } from './multisigIsm'; import { owners } from './owners'; export const core: ChainMap = objMap(owners, (local, owner) => { @@ -14,7 +15,9 @@ export const core: ChainMap = objMap(owners, (local, owner) => { type: ModuleType.ROUTING, owner, domains: Object.fromEntries( - Object.entries(multisigIsm).filter(([chain]) => chain !== local), + Object.entries(chainToValidator) + .filter(([chain, _]) => chain !== local) + .map(([chain, validatorKey]) => [chain, aggregationIsm(validatorKey)]), ), }; diff --git a/typescript/infra/config/environments/test/multisigIsm.ts b/typescript/infra/config/environments/test/multisigIsm.ts index facd03963..a704bea5e 100644 --- a/typescript/infra/config/environments/test/multisigIsm.ts +++ b/typescript/infra/config/environments/test/multisigIsm.ts @@ -1,21 +1,41 @@ import { ChainMap, ModuleType, MultisigIsmConfig } from '@hyperlane-xyz/sdk'; // the addresses here must line up with the e2e test's validator addresses -export const multisigIsm: ChainMap = { - // Validators are anvil accounts 4-6 - test1: { +// Validators are anvil accounts 4-6 +export const chainToValidator: Record = { + test1: '0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65', + test2: '0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc', + test3: '0x976EA74026E726554dB657fA54763abd0C3a0aa9', +}; + +export const legacyMultisig = (validatorKey: string): MultisigIsmConfig => { + return { type: ModuleType.LEGACY_MULTISIG, - validators: ['0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65'], + validators: [chainToValidator[validatorKey]], threshold: 1, - }, - test2: { + }; +}; + +export const merkleRootMultisig = (validatorKey: string): MultisigIsmConfig => { + return { type: ModuleType.MERKLE_ROOT_MULTISIG, - validators: ['0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc'], + validators: [validatorKey], threshold: 1, - }, - test3: { + }; +}; + +export const messageIdMultisig = (validatorKey: string): MultisigIsmConfig => { + return { type: ModuleType.MESSAGE_ID_MULTISIG, - validators: ['0x976EA74026E726554dB657fA54763abd0C3a0aa9'], + validators: [validatorKey], threshold: 1, - }, + }; +}; + +// the addresses here must line up with the e2e test's validator addresses +export const multisigIsm: ChainMap = { + // Validators are anvil accounts 4-6 + test1: legacyMultisig('test1'), + test2: merkleRootMultisig('test2'), + test3: messageIdMultisig('test3'), }; diff --git a/typescript/infra/config/environments/test/routingIsm.ts b/typescript/infra/config/environments/test/routingIsm.ts new file mode 100644 index 000000000..bbe97fe44 --- /dev/null +++ b/typescript/infra/config/environments/test/routingIsm.ts @@ -0,0 +1,16 @@ +import { ModuleType, RoutingIsmConfig } from '@hyperlane-xyz/sdk'; + +import { multisigIsm } from './multisigIsm'; + +export const routingIsm = ( + local_chain: string, + owner: string, +): RoutingIsmConfig => { + return { + type: ModuleType.ROUTING, + owner, + domains: Object.fromEntries( + Object.entries(multisigIsm).filter(([chain]) => chain !== local_chain), + ), + }; +};