From 33b01b2c8e0f0b160a006001867ae9ba3333f48a Mon Sep 17 00:00:00 2001 From: ALPAC-4 Date: Thu, 19 Dec 2024 15:52:32 +0900 Subject: [PATCH 1/5] fix: deprecate `finalize_arb` and make new version of it --- .../initia_stdlib/sources/minitswap.move | 72 ++++++++----------- 1 file changed, 31 insertions(+), 41 deletions(-) diff --git a/precompile/modules/initia_stdlib/sources/minitswap.move b/precompile/modules/initia_stdlib/sources/minitswap.move index 687c03fb..01da242a 100644 --- a/precompile/modules/initia_stdlib/sources/minitswap.move +++ b/precompile/modules/initia_stdlib/sources/minitswap.move @@ -42,6 +42,7 @@ module initia_std::minitswap { const EINVAILD_METADATA: u64 = 16; const ESMALL_ARB_PROFIT: u64 = 17; const EVIRTUAL_POOL_EXISTS: u64 = 18; + const EDEPRECATED: u64 = 19; const A_PRECISION: u256 = 100; const U64_MAX: u128 = 18_446_744_073_709_551_615; @@ -1451,17 +1452,11 @@ module initia_std::minitswap { primary_fungible_store::deposit(signer::address_of(account), return_asset); } - public entry fun finalize_arb( - account: &signer, - arb_index: u64, - output_index: u64, - withdrawal_proofs: vector, - sender: address, - sequence: u64, - version: String, - state_root: String, - storage_root: String, - latest_block_hash: String + // Since MsgFinalizeWithdrawal can now be executed by anyone, + // Make executor triggers MsgFinalizeWithdrawal by themselves + // and then calls `finalize_arb_v2`. + public entry fun finalize_arb_v2( + account: &signer, arb_index: u64 ) acquires ModuleStore, VirtualPool { // check arb info let module_store = borrow_global(@initia_std); @@ -1470,46 +1465,41 @@ module initia_std::minitswap { &module_store.global_arb_batch_map, table_key::encode_u64(arb_index) ); - let pool = borrow_global(object::object_address(&*pool_obj)); + let pool_addr = object::object_address(&*pool_obj); + let pool = borrow_global(pool_addr); let arb_info = table::borrow( &pool.arb_batch_map, table_key::encode_u64(arb_index) ); - // execute finalize token withdrawal - let pool_signer = object::generate_signer_for_extending(&pool.extend_ref); - let withdrawal_msg = - generate_finalize_token_withdrawal_msg( - pool.op_bridge_id, - output_index, - withdrawal_proofs, - sender, - signer::address_of(&pool_signer), - sequence, - string::utf8(b"uinit"), - arb_info.ibc_op_init_sent, - version, - state_root, - storage_root, - latest_block_hash - ); - cosmos::stargate(&pool_signer, withdrawal_msg); + let uinit_pool_balance = coin::balance(pool_addr, init_metadata()); + assert!( + uinit_pool_balance > arb_info.ibc_op_init_sent, + error::invalid_state(ENOT_ENOUGH_BALANCE) + ); // execute hook let module_signer = object::generate_signer_for_extending(&module_store.extend_ref); - cosmos::move_execute( - &module_signer, - @initia_std, - string::utf8(b"minitswap"), - string::utf8(b"finalize_arb_hook"), - vector[], - vector[ - bcs::to_bytes(&arb_index), - bcs::to_bytes(&signer::address_of(account)) - ] - ); + + finalize_arb_hook(&module_signer, arb_index, signer::address_of(account)); + } + + // deprecated + public entry fun finalize_arb( + _account: &signer, + _arb_index: u64, + _output_index: u64, + _withdrawal_proofs: vector, + _sender: address, + _sequence: u64, + _version: String, + _state_root: String, + _storage_root: String, + _latest_block_hash: String + ) { + abort(error::unavailable(EDEPRECATED)); } public entry fun finalize_arb_hook( From 7e844a3230abe09a0a3fc7646c43ef2c1377e8c9 Mon Sep 17 00:00:00 2001 From: ALPAC-4 Date: Thu, 19 Dec 2024 15:58:00 +0900 Subject: [PATCH 2/5] fix: fix balance condition --- precompile/modules/initia_stdlib/sources/minitswap.move | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompile/modules/initia_stdlib/sources/minitswap.move b/precompile/modules/initia_stdlib/sources/minitswap.move index 01da242a..a8eb16a6 100644 --- a/precompile/modules/initia_stdlib/sources/minitswap.move +++ b/precompile/modules/initia_stdlib/sources/minitswap.move @@ -1475,7 +1475,7 @@ module initia_std::minitswap { let uinit_pool_balance = coin::balance(pool_addr, init_metadata()); assert!( - uinit_pool_balance > arb_info.ibc_op_init_sent, + uinit_pool_balance >= arb_info.ibc_op_init_sent, error::invalid_state(ENOT_ENOUGH_BALANCE) ); From 94453a7e232fdc999cfd9cbe17cc9bf78dbcf6dc Mon Sep 17 00:00:00 2001 From: ALPAC-4 Date: Thu, 19 Dec 2024 16:11:25 +0900 Subject: [PATCH 3/5] chore: make precompile --- precompile/binaries/stdlib/minitswap.mv | Bin 21441 -> 21413 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/precompile/binaries/stdlib/minitswap.mv b/precompile/binaries/stdlib/minitswap.mv index a79ed333aaa66a7b8c8162edbaa72051c8f528d5..09ef77a4186a80ef77c547f2ab8b32b0d139ca25 100644 GIT binary patch delta 3069 zcmY*bX>b(B74Fw_Zg=nO_G+aSAlbXRcC|W?gn+DyjTPDwQ8jx#Co%Dz+i96DO}{Wjh&Z-}H39 z_r0F)9X*#%!3(FL`9#qt+#!SsAkDP-BQQ?VCj;g?{4KDqh|6K;_2S6#9Sw zd2Q&<1Ddvk=4kS^7i&`5ZM(+}C;fJmB4Yi7rRH*cCYKuf9ynwb4a-7S8Fx zC3?ZPo~GIhd4;~L)vQk6ygI=4Df7m2?M8)n6SGCge{ zG}Jgt)>B&;)ZzxXrfa(-H!^HDYzSKj!(gtkEW;J}pZlABn$4rrzY?cB&Tk*iPGkp% zvRj7KPv$_{VsS9|89lvR`p8e6uGx#J_7w(J@2 zADgZznxu}sb!2SU$k_C`YtDh%8?WOmuxoI5aD42J?5H{&f8Y3n6PezTcm$$(BzN(S z_KtNu9c`_>9qrRsOY-v;BJK7!tC&kY$@O4TlGvVgNSX+P5ot0bTqt`J=0;|OVhm(c zrb7L4K^`R4M+<7BDdsRcCb$=n-CS$)OiCpeCZJMvE=*0{;KS`~a7Yyql+kbwA)N^! zxKWh|2YtjU*)2?Na8uqWtZ+0c9By%^!mQ#Hop%b?b2$i0I}ipg8FD@41ULoToOwAJ zPTqvW;UdS83>7va*hY0=VdZ2sy#*I0?t@H?LmXE!jE}=9ceou1Mr5WoGdIG8%Sb&* zm~9M%?F1y#zm~`hIPuI(o&2t6W$IBHdfXB*W)=k#TnG{5HV<;aIcJebrXlEtibL1r zb0`pA&~un%vWt7d=C%lW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VrIMC!4Pj#p}KN+HDD2&(K1z6_v`2r0qJ1jJ8nl> zwyK=^K8<2$P@by~P+Sq>Zd@=PVh*BQsSi*DYL%(K*8iz?$N!>~(49I8&q98XOUQIO z9Pq6}`6OmjxsRekv4#TpjvC)kHLA>KG>UF1x<%n=;cAgmI~uC8zniYZ{K0&AV2^2t zwb@VvPpQuuhP1uV_CnhWZ7;OFK>MNTRXN(;!#w38!a1IR;R&$URH$E0e;5Xj&e+H@ zd-$M2ZJV()tCIsK+1!)`nWTu*UF!EUDxqC@GZRp$#?PEmI38IVXHMk~a7;j#B0h`a zCW}^SF+qE%R)=Sf8EnT2j1581qE295VULQ$EAKbaR1)9H6b3fWW%z~$x02>aPR(px zn!AD8fc)#9tSsJhA7teJ2cZFoiFs@$&Fp*js(jWM*sGdnC9Rhs$B}CDtU7zYM*Xq6 zG%GdXUfg9bR?@w&-y>vSLd|0Mt&VChA>a*F6^S_6u z19B2#L3K3?GwAk^Ch{2&mS=G)b*Y)$k``XaI!As2bsmv>!JLf4cmYBGrih!bcFrjq zu?*EM4$O?vbQ7o18l>b|b#+cvYB!!A+tp72yRZ&t(4SHQ@Q%z-An{Klzp zN-b)9#m0(@$^+_)#xZu0j~C7XHG1w;y_=2G$L3Ce)9Uctes7)Z!qh4B<(i-cMVlTP zy+yRW_47w&9|3wKAovn2{|2W$ z^QX8+L5@a(3)F@ANv9o~3XN2%Pv%bsrLq7eXs o5FG=*R`PwL20sHqw(GkRV{))H1?B2;YZpy=DtB>(YF^y-AMW1qy8r+H From 871ac52dca34ed6ee92d7623ccc776beac13e84f Mon Sep 17 00:00:00 2001 From: ALPAC-4 Date: Thu, 19 Dec 2024 16:13:12 +0900 Subject: [PATCH 4/5] fix: remove `generate_finalize_token_withdrawal_msg` function --- precompile/binaries/stdlib/minitswap.mv | Bin 21413 -> 21201 bytes .../initia_stdlib/sources/minitswap.move | 54 ------------------ 2 files changed, 54 deletions(-) diff --git a/precompile/binaries/stdlib/minitswap.mv b/precompile/bin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)6P` zOshF;5QepAG_pOV3L59~M$W1+Y@+HqsyZ8sc(aJ}xOuN@hb?Mn;!2o2v7>=`LZpI#ZM7kfzs6$LL`tn^QSqPVB3;%%wA%+>#qr zZFAXF^DLv|omG9!MSOX5yw&8YRh?{}4` z`@mPSc`b8G|4+7xs>ZQxCYaA`Q#OTdcu4JPDX}g>o}E+|TWaJA@Td)`lo%e?`+Q9O zrlp3;AXui$pmv!qgWhF-s~saZ^qfKvwZST3QVURvhD;s-Vfhx7qV5TOJPVIR=f4E? zK9h&k>E-S5l^l~b6r!W*qvcf&J@WcmxvVm+>)dw0M3nVs)SlMMFs^2_mD1SS)m{k{lgV>DITRm6gJlg+4tc zYI=JoKL&uuqhP$CcDK(;wjup;qQkrbA3}88m)pDj6EJzh3*U{)!>V}IzVcN(g|2YD zTv6b1Dy0IM7Sd|caw;De=mv|^L*!B*PpBWS+S_=Nf=IYvPc`ZYNqjstl?P8>Q!+;w zbWPBe88XTUqX3@gibFoh54ql*?%a_^`T4>*v&OI||{v`mCd+`aK8QE4sktZisnbN~xGU z?z>)^@<$mgGhYJN=kc@Zf$0e%2`bX1GpWTU!I)QlG5-{l5W;5C5?M diff --git a/precompile/modules/initia_stdlib/sources/minitswap.move b/precompile/modules/initia_stdlib/sources/minitswap.move index a8eb16a6..a27042fb 100644 --- a/precompile/modules/initia_stdlib/sources/minitswap.move +++ b/precompile/modules/initia_stdlib/sources/minitswap.move @@ -2506,38 +2506,6 @@ module initia_std::minitswap { amount: u64 } - fun generate_finalize_token_withdrawal_msg( - bridge_id: u64, - output_index: u64, - withdrawal_proofs: vector, - sender: address, - receiver: address, - sequence: u64, - denom: String, - amount: u64, - version: String, - state_root: String, - storage_root: String, - latest_block_hash: String - ): vector { - json::marshal( - &FinalizeTokenWithdrawalRequest { - _type_: string::utf8(b"/opinit.ophost.v1.MsgFinalizeTokenWithdrawal"), - bridge_id, - output_index, - withdrawal_proofs, - sender: to_sdk(sender), - receiver: to_sdk(receiver), - sequence, - amount: CosmosCoin { denom, amount }, - version, - state_root, - storage_root, - latest_block_hash - } - ) - } - fun init_metadata(): Object { let addr = object::create_object_address(&@initia_std, b"uinit"); object::address_to_object(addr) @@ -3116,28 +3084,6 @@ module initia_std::minitswap { ); } - #[test] - fun test_finalize_token_withdrawal_msg() { - let msg = - generate_finalize_token_withdrawal_msg( - 1, - 2, - vector[string::utf8(b"abc"), string::utf8(b"123")], - @0x1, - @0x2, - 3, - string::utf8(b"uinit"), - 100, - string::utf8(b"version"), - string::utf8(b"state_root"), - string::utf8(b"storage_root"), - string::utf8(b"latest_block_hash") - ); - let json_str = - b"{\"@type\":\"/opinit.ophost.v1.MsgFinalizeTokenWithdrawal\",\"amount\":{\"amount\":\"100\",\"denom\":\"uinit\"},\"bridge_id\":\"1\",\"latest_block_hash\":\"latest_block_hash\",\"output_index\":\"2\",\"receiver\":\"init1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzwsp0lj\",\"sender\":\"init1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqr5e3d\",\"sequence\":\"3\",\"state_root\":\"state_root\",\"storage_root\":\"storage_root\",\"version\":\"version\",\"withdrawal_proofs\":[\"abc\",\"123\"]}"; - assert!(msg == json_str, 0); - } - #[test] fun test_ibc_denom() { let ibc_denom = From cee8c2f23f3cd6cd7b841bd5afef3b8253e662e9 Mon Sep 17 00:00:00 2001 From: ALPAC-4 Date: Mon, 23 Dec 2024 12:50:10 +0900 Subject: [PATCH 5/5] chore: make precompile --- precompile/binaries/stdlib/minitswap.mv | Bin 21201 -> 21291 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/precompile/binaries/stdlib/minitswap.mv b/precompile/binaries/stdlib/minitswap.mv index 09be1e964a8b443a8d735fb7a99eece3dac8c232..3fc4a17ddfcc8fea4de96855f2adf8c7ceb62c64 100644 GIT binary patch delta 3466 zcmZ`*33yc16~6zu@4dP6-py=DfH0Y4lDr972!Vv)2u(r)hO)^gTE6y^QqXM z2LTa9MR?+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