diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b42fb061..ebd139cc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Rates: Limit rates recipient to only one address [(#669)](https://github.com/andromedaprotocol/andromeda-core/pull/669) - Address Validation: Cross-chain recipients don't need to be registered in VFS [(#725)](https://github.com/andromedaprotocol/andromeda-core/pull/725) - Weighted Splitter: Replace Recipient with AndrAddr in RemoveRecipient and GetUserWeight [(#739)](https://github.com/andromedaprotocol/andromeda-core/pull/739) +- feat: IBC packet tracking adjustments [#748](https://github.com/andromedaprotocol/andromeda-core/pull/748) ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 78e4e6bae..0117c8db9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -424,7 +424,7 @@ dependencies = [ "lazy_static", "log", "regex", - "reqwest 0.12.11", + "reqwest 0.12.12", "schemars", "semver", "serde", @@ -605,7 +605,7 @@ dependencies = [ [[package]] name = "andromeda-kernel" -version = "1.2.0-b.3" +version = "1.2.0-b.4" dependencies = [ "andromeda-std", "cosmwasm-schema", @@ -866,7 +866,7 @@ dependencies = [ [[package]] name = "andromeda-splitter" -version = "2.3.0-b.1" +version = "2.3.0-b.2" dependencies = [ "andromeda-app", "andromeda-finance", @@ -1131,7 +1131,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -1153,18 +1153,18 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "1b1244b10dcd56c92219da4e14caa97e312079e185f04ba3eea25061561dc0a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -1192,7 +1192,7 @@ dependencies = [ "futures-util", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "itoa", "matchit", "memchr", @@ -1399,9 +1399,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.3" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" dependencies = [ "shlex", ] @@ -1669,7 +1669,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -1784,7 +1784,7 @@ checksum = "bad52865e313bb7ed3f3938f7ad9d566e430fb6143a63476c22bed505ea78cd7" dependencies = [ "convert_case", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2254,7 +2254,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2307,7 +2307,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2436,9 +2436,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ "log", "regex", @@ -2646,7 +2646,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2717,9 +2717,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "group" @@ -2903,9 +2903,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[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", @@ -2927,9 +2927,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", @@ -2953,7 +2953,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", @@ -2961,15 +2961,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", "http 1.2.0", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", - "rustls 0.23.19", + "rustls 0.23.20", "rustls-pki-types", "tokio", "tokio-rustls 0.26.1", @@ -2982,7 +2982,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.31", + "hyper 0.14.32", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -2995,7 +2995,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", @@ -3009,7 +3009,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "native-tls", "tokio", @@ -3028,7 +3028,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", @@ -3263,7 +3263,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3424,9 +3424,9 @@ checksum = "82de9bb5d9e8ff5e13532a45583ea972e220b8a6efef755daad1f285333a8afa" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libm" @@ -3492,9 +3492,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[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", ] @@ -3596,7 +3596,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3641,9 +3641,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.5" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -3683,7 +3683,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3836,7 +3836,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3966,7 +3966,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3989,9 +3989,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -4034,9 +4034,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags 2.6.0", ] @@ -4101,7 +4101,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", @@ -4133,9 +4133,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.11" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe060fe50f524be480214aba758c71f99f90ee8c83c5a36b5e9e1d568eb4eb3" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64 0.22.1", "bytes", @@ -4147,8 +4147,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.5", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -4236,7 +4236,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.90", + "syn 2.0.94", "unicode-ident", ] @@ -4282,9 +4282,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.19" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "once_cell", "rustls-pki-types", @@ -4325,9 +4325,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" [[package]] name = "rustls-webpki" @@ -4352,9 +4352,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -4401,7 +4401,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -4468,9 +4468,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", @@ -4535,7 +4535,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -4546,7 +4546,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -4569,7 +4569,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -4771,9 +4771,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.90" +version = "2.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "987bc0be1cdea8b10216bd06e2ca407d40b9543468fafd3ddfb02f36e77f71f3" dependencies = [ "proc-macro2", "quote", @@ -4803,7 +4803,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -4850,12 +4850,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", @@ -5053,7 +5054,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5064,7 +5065,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "test-case-core", ] @@ -5146,7 +5147,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5157,7 +5158,7 @@ checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5247,7 +5248,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5276,7 +5277,7 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ - "rustls 0.23.19", + "rustls 0.23.20", "tokio", ] @@ -5362,7 +5363,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-timeout", "percent-encoding", "pin-project", @@ -5389,7 +5390,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-timeout", "percent-encoding", "pin-project", @@ -5472,7 +5473,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5631,7 +5632,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "wasm-bindgen-shared", ] @@ -5666,7 +5667,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5907,9 +5908,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" dependencies = [ "memchr", ] @@ -5956,7 +5957,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "synstructure", ] @@ -5978,7 +5979,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5998,7 +5999,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "synstructure", ] @@ -6019,7 +6020,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -6041,5 +6042,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] diff --git a/contracts/finance/andromeda-splitter/Cargo.toml b/contracts/finance/andromeda-splitter/Cargo.toml index 3c6d6fad6..dd8b45534 100644 --- a/contracts/finance/andromeda-splitter/Cargo.toml +++ b/contracts/finance/andromeda-splitter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "andromeda-splitter" -version = "2.3.0-b.1" +version = "2.3.0-b.2" edition = "2021" rust-version = "1.75.0" diff --git a/contracts/finance/andromeda-splitter/src/contract.rs b/contracts/finance/andromeda-splitter/src/contract.rs index 151c58394..3de38cc16 100644 --- a/contracts/finance/andromeda-splitter/src/contract.rs +++ b/contracts/finance/andromeda-splitter/src/contract.rs @@ -199,7 +199,6 @@ fn execute_send( for recipient_addr in splitter_recipients { let recipient_percent = recipient_addr.percent; - let mut vec_coin: Vec = Vec::new(); for (i, coin) in info.funds.clone().iter().enumerate() { let amount_owed = coin.amount.mul_floor(recipient_percent); if !amount_owed.is_zero() { @@ -207,16 +206,14 @@ fn execute_send( recip_coin.amount = amount_owed; remainder_funds[i].amount = remainder_funds[i].amount.checked_sub(recip_coin.amount)?; - vec_coin.push(recip_coin.clone()); - amp_funds.push(recip_coin); + amp_funds.push(recip_coin.clone()); + + let amp_msg = recipient_addr + .recipient + .generate_amp_msg(&deps.as_ref(), Some(vec![recip_coin.clone()]))?; + pkt = pkt.add_message(amp_msg); } } - if !vec_coin.is_empty() { - let amp_msg = recipient_addr - .recipient - .generate_amp_msg(&deps.as_ref(), Some(vec_coin))?; - pkt = pkt.add_message(amp_msg); - } } remainder_funds.retain(|x| x.amount > Uint128::zero()); diff --git a/contracts/os/andromeda-kernel/Cargo.toml b/contracts/os/andromeda-kernel/Cargo.toml index 485719b04..919928c76 100644 --- a/contracts/os/andromeda-kernel/Cargo.toml +++ b/contracts/os/andromeda-kernel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "andromeda-kernel" -version = "1.2.0-b.3" +version = "1.2.0-b.4" authors = ["Connor Barr "] edition = "2021" rust-version = "1.65.0" diff --git a/contracts/os/andromeda-kernel/src/execute.rs b/contracts/os/andromeda-kernel/src/execute.rs index 892c8ca8d..b4bf2bb2e 100644 --- a/contracts/os/andromeda-kernel/src/execute.rs +++ b/contracts/os/andromeda-kernel/src/execute.rs @@ -4,8 +4,8 @@ use andromeda_std::amp::addresses::AndrAddr; use andromeda_std::amp::messages::{AMPCtx, AMPMsg, AMPPkt}; use andromeda_std::amp::{ADO_DB_KEY, VFS_KEY}; use andromeda_std::common::context::ExecuteContext; -use andromeda_std::common::has_coins_merged; use andromeda_std::common::reply::ReplyId; +use andromeda_std::common::{has_coins_merged, merge_coins}; use andromeda_std::error::ContractError; use andromeda_std::os::aos_querier::AOSQuerier; #[cfg(not(target_arch = "wasm32"))] @@ -44,7 +44,7 @@ pub fn trigger_relay( ContractError::Unauthorized {} ); let ics20_packet_info = CHANNEL_TO_EXECUTE_MSG - .load(ctx.deps.storage, (channel_id, packet_sequence)) + .load(ctx.deps.storage, (channel_id.clone(), packet_sequence)) .expect("No packet found for channel_id and sequence"); let chain = @@ -68,7 +68,7 @@ pub fn trigger_relay( ctx.info, ctx.env, ctx.amp_ctx, - 0, + packet_sequence, channel_info, ics20_packet_info, ), @@ -80,7 +80,11 @@ pub fn trigger_relay( }); Ok(Response::default() .add_message(refund_msg) - .add_attribute("action", "refund") + .add_attribute("action", "relay_packet") + .add_attribute("relay_outcome", "refund") + .add_attribute("relay_sequence", packet_sequence.to_string()) + .add_attribute("relay_channel", channel_id) + .add_attribute("relay_chain", chain) .add_attribute("recipient", ics20_packet_info.sender) .add_attribute("amount", ics20_packet_info.funds.to_string())) } @@ -156,10 +160,12 @@ fn handle_ibc_transfer_funds_reply( Ok(Response::default() .add_message(CosmosMsg::Ibc(msg)) - .add_attribute(format!("method:{sequence}"), "execute_send_message") - .add_attribute(format!("channel:{sequence}"), channel) - .add_attribute("receiving_kernel_address:{}", channel_info.kernel_address) - .add_attribute("chain:{}", chain)) + .add_attribute("action", "relay_packet") + .add_attribute("relay_outcome", "success") + .add_attribute("relay_sequence", sequence.to_string()) + .add_attribute("relay_channel", ics20_packet_info.channel) + .add_attribute("relay_chain", chain) + .add_attribute("receiving_kernel_address", channel_info.kernel_address)) } pub fn amp_receive( @@ -170,7 +176,8 @@ pub fn amp_receive( ) -> Result { // Only verified ADOs can access this function ensure!( - query::verify_address(deps.as_ref(), info.sender.to_string())?.verify_address, + info.sender == env.contract.address + || query::verify_address(deps.as_ref(), info.sender.to_string())?.verify_address, ContractError::Unauthorized {} ); ensure!( @@ -188,18 +195,39 @@ pub fn amp_receive( } ); + let msg = packet.messages.first().unwrap(); + let mut handler = MsgHandler::new(msg.clone()); + let msg_res = handler.handle( + deps.branch(), + info.clone(), + env.clone(), + Some(packet.clone()), + 0, + )?; + + res.messages.extend_from_slice(&msg_res.messages); + res.attributes.extend_from_slice(&msg_res.attributes); + res.events.extend_from_slice(&msg_res.events); + + let mut new_pkt = AMPPkt::from_ctx(Some(packet.clone()), env.contract.address.to_string()); + for (idx, message) in packet.messages.iter().enumerate() { - let mut handler = MsgHandler::new(message.clone()); - let msg_res = handler.handle( - deps.branch(), - info.clone(), - env.clone(), - Some(packet.clone()), - idx as u64, - )?; - res.messages.extend_from_slice(&msg_res.messages); - res.attributes.extend_from_slice(&msg_res.attributes); - res.events.extend_from_slice(&msg_res.events); + if idx == 0 { + continue; + } + new_pkt = new_pkt.add_message(message.clone()); + } + + if !new_pkt.messages.is_empty() { + let new_funds = new_pkt + .messages + .iter() + .flat_map(|m| m.funds.clone()) + .collect::>(); + + let new_pkt_msg = + new_pkt.to_sub_msg(env.contract.address.to_string(), Some(new_funds), 0)?; + res.messages.extend_from_slice(&[new_pkt_msg]); } let message_funds = packet @@ -825,8 +853,10 @@ impl MsgHandler { error: Some(format!("Channel not found for chain {chain}")), }); }?; + deps.api.debug(&format!("info.funds: {:?}", info.funds)); + deps.api.debug(&format!("funds: {:?}", funds)); ensure!( - funds.len() == 1 && info.funds.len() == 1, + funds.len() == 1, ContractError::InvalidFunds { msg: "Number of funds should be exactly one".to_string() } diff --git a/tests-integration/tests/splitter.rs b/tests-integration/tests/splitter.rs index 9badd969e..73ae7d711 100644 --- a/tests-integration/tests/splitter.rs +++ b/tests-integration/tests/splitter.rs @@ -614,14 +614,27 @@ fn test_splitter_cross_chain_recipient() { splitter_juno .instantiate( &SplitterInstantiateMsg { - recipients: vec![AddressPercent { - recipient: Recipient { - address: AndrAddr::from_string(format!("ibc://osmosis/{}", recipient)), - msg: None, - ibc_recovery_address: None, + recipients: vec![ + AddressPercent { + recipient: Recipient { + address: AndrAddr::from_string(format!("ibc://osmosis/{}", recipient)), + msg: None, + ibc_recovery_address: None, + }, + percent: Decimal::from_ratio(Uint128::from(1u128), Uint128::from(2u128)), }, - percent: Decimal::one(), - }], + AddressPercent { + recipient: Recipient { + address: AndrAddr::from_string(format!( + "ibc://osmosis/{}", + kernel_osmosis.address().unwrap().into_string() + )), + msg: None, + ibc_recovery_address: None, + }, + percent: Decimal::from_ratio(Uint128::from(1u128), Uint128::from(2u128)), + }, + ], lock_time: None, kernel_address: kernel_osmosis.address().unwrap().into_string(), owner: None, @@ -638,7 +651,7 @@ fn test_splitter_cross_chain_recipient() { &SplitterExecuteMsg::Send { config: None }, Some(&[Coin { denom: "juno".to_string(), - amount: Uint128::new(100), + amount: Uint128::new(200), }]), ) .unwrap(); @@ -658,7 +671,7 @@ fn test_splitter_cross_chain_recipient() { .unwrap(); assert_eq!(balances.len(), 1); assert_eq!(balances[0].denom, ibc_denom); - assert_eq!(balances[0].amount.u128(), 100); + assert_eq!(balances[0].amount.u128(), 200); } else { panic!("packet timed out"); // There was a decode error or the packet timed out