From 0dcc53cbf8f08dfd0637e26db49c1f6e6d7d8fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Nu=C3=B1ez=20Cortes?= Date: Wed, 16 Aug 2023 13:55:26 -0300 Subject: [PATCH] algorand: Ensure optin transaction is the current transaction (#3131) * Ensure optin transaction is the current transaction and address the algo_seed transaction in a relative manner. * Added core_approve.teal based on previous change. * Fixed admin.py to make the tests pass. --- algorand/admin.py | 2 +- algorand/teal/core_approve.teal | 707 +++++++++++++++++++------------- algorand/wormhole_core.py | 4 +- 3 files changed, 416 insertions(+), 297 deletions(-) diff --git a/algorand/admin.py b/algorand/admin.py index a274ab402e..cd156fcc9a 100644 --- a/algorand/admin.py +++ b/algorand/admin.py @@ -1151,7 +1151,7 @@ def parseVAA(self, vaa): off += 2 ret["Fee"] = vaa[off:(off + 32)].hex() - if int.from_bytes((vaa[off:off+1]), "big") == 3: + if len(vaa[off:]) > 133 and int.from_bytes((vaa[off:off+1]), "big") == 3: ret["Meta"] = "TokenBridge Transfer With Payload" ret["Type"] = int.from_bytes((vaa[off:off+1]), "big") off += 1 diff --git a/algorand/teal/core_approve.teal b/algorand/teal/core_approve.teal index 8128d68731..3473f78674 100644 --- a/algorand/teal/core_approve.teal +++ b/algorand/teal/core_approve.teal @@ -1,5 +1,5 @@ #pragma version 6 -intcblock 1 0 127 2 1000 86400 128 255 +intcblock 1 0 127 2 1000 214 216 220 285 278 244 252 268 86400 256 257 233 208 128 255 bytecblock 0x 0x0008 0x677561726469616e 0x63757272656e74477561726469616e536574496e646578 0x6e6f70 0x76657269667953696773 0x4d657373616765466565 0x76616c6964557064617465417070726f766548617368 0x767068617368 0x766572696679564141 0x7075626c6973684d657373616765 0x0001 0x0000000000000000000000000000000000000000000000000000000000000004 0x00000000000000000000000000000000000000000000000000000000436f7265 0x0000 0x626f6f746564 0x50726f6772616d 0x6d657461 txn ApplicationID intc_1 // 0 @@ -129,11 +129,13 @@ gtxnsa Accounts 2 txna Accounts 2 == && +pushint 519 // 519 +&& assert bytec_3 // "currentGuardianSetIndex" app_global_get -store 26 -load 26 +store 27 +load 27 intc_1 // 0 != bnz main_l28 @@ -145,102 +147,110 @@ pushint 66 // 66 * pushint 14 // 14 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 intc_3 // 2 extract3 bytec 11 // 0x0001 == +intc 5 // 214 +&& assert txna ApplicationArgs 1 -load 21 +load 22 intc_3 // 2 + pushint 32 // 32 extract3 bytec 12 // 0x0000000000000000000000000000000000000000000000000000000000000004 == +intc 6 // 216 +&& assert -load 21 +load 22 pushint 43 // 43 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 pushint 32 // 32 extract3 bytec 13 // 0x00000000000000000000000000000000000000000000000000000000436f7265 == +intc 7 // 220 +&& assert -load 21 +load 22 pushint 32 // 32 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 intc_0 // 1 + intc_3 // 2 extract3 -store 28 +store 30 txna ApplicationArgs 1 -load 21 +load 22 intc_0 // 1 extract3 btoi -store 22 -load 22 +store 23 +load 23 intc_0 // 1 == bnz main_l27 -load 22 +load 23 intc_3 // 2 == bnz main_l22 -load 22 +load 23 pushint 3 // 3 == bnz main_l21 -load 22 +load 23 pushint 4 // 4 == bnz main_l19 err main_l19: -load 21 +load 22 intc_0 // 1 + -store 21 -load 28 +store 22 +load 30 bytec_1 // 0x0008 == +intc 8 // 285 +&& assert -load 21 +load 22 pushint 26 // 26 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 pushint 8 // 8 extract3 btoi -store 24 -load 21 +store 25 +load 22 pushint 8 // 8 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 pushint 32 // 32 extract3 -store 23 +store 24 itxn_begin intc_0 // pay itxn_field TypeEnum -load 23 -itxn_field Receiver load 24 +itxn_field Receiver +load 25 itxn_field Amount intc_1 // 0 itxn_field Fee @@ -251,54 +261,62 @@ return intc_0 // 1 return main_l21: -load 21 +load 22 intc_0 // 1 + -store 21 -load 28 +store 22 +load 30 bytec_1 // 0x0008 == +intc 9 // 278 +&& assert -load 21 +load 22 intc_3 // 2 + pushint 24 // 24 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 pushint 8 // 8 extract3 btoi -store 24 +store 25 bytec 6 // "MessageFee" -load 24 +load 25 app_global_put b main_l20 main_l22: -load 28 +load 30 bytec_1 // 0x0008 == -load 28 +load 30 bytec 14 // 0x0000 == || +intc 10 // 244 +&& assert -load 21 +load 22 pushint 3 // 3 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 pushint 4 // 4 extract3 +store 29 +load 29 btoi -store 25 +store 26 txna Accounts 3 -load 25 +load 26 bytec_2 // "guardian" callsub getsigaddress_9 == +intc 11 // 252 +&& assert intc_1 // 0 intc_1 // 0 @@ -306,29 +324,31 @@ intc_1 // 0 bnz main_l26 main_l23: bytec_3 // "currentGuardianSetIndex" -load 25 +load 26 app_global_put -load 21 +load 22 pushint 4 // 4 + -store 21 +store 22 txna ApplicationArgs 1 -load 21 +load 22 intc_0 // 1 extract3 btoi -store 27 -load 27 +store 28 +load 28 intc_1 // 0 > +intc 12 // 268 +&& assert pushint 3 // 3 intc_1 // 0 txna ApplicationArgs 1 -load 21 +load 22 intc_0 // 1 pushint 20 // 20 -load 27 +load 28 * + extract3 @@ -347,7 +367,7 @@ main_l25: intc_3 // 2 intc 4 // 1000 global LatestTimestamp -intc 5 // 86400 +intc 13 // 86400 + itob callsub write_7 @@ -357,26 +377,32 @@ main_l26: txna Accounts 3 txna Accounts 2 != +intc 14 // 256 +&& assert -load 25 load 26 +load 27 intc_0 // 1 + == +intc 15 // 257 +&& assert b main_l23 main_l27: -load 28 +load 30 bytec_1 // 0x0008 == +intc 16 // 233 +&& assert -load 21 +load 22 pushint 3 // 3 + -store 21 +store 22 bytec 7 // "validUpdateApproveHash" txna ApplicationArgs 1 -load 21 +load 22 pushint 32 // 32 extract3 app_global_put @@ -384,11 +410,13 @@ b main_l20 main_l28: txna ApplicationArgs 1 extract 1 4 -store 25 -load 25 -btoi +store 26 load 26 +btoi +load 27 == +intc 17 // 208 +&& assert b main_l14 main_l29: @@ -399,6 +427,8 @@ btoi bytec_2 // "guardian" callsub getsigaddress_9 == +pushint 380 // 380 +&& assert intc_3 // 2 bytec_2 // "guardian" @@ -406,162 +436,174 @@ callsub checkMeta_6 intc_3 // 2 intc_1 // 0 callsub getbyte_2 -store 12 -load 12 +store 13 +load 13 intc_1 // 0 > +pushint 384 // 384 +&& assert intc_3 // 2 intc_0 // 1 intc_0 // 1 pushint 20 // 20 -load 12 +load 13 * + callsub read_4 -store 13 +store 14 intc_3 // 2 intc 4 // 1000 pushint 1008 // 1008 callsub read_4 btoi -store 18 -load 18 +store 19 +load 19 intc_1 // 0 != bnz main_l50 main_l30: pushbytes 0x00000000 // 0x00000000 -store 17 +store 18 txna ApplicationArgs 1 extract 5 1 btoi -store 14 +store 15 pushint 6 // 6 -load 14 +load 15 pushint 66 // 66 * + -store 15 +store 16 txna ApplicationArgs 1 -load 15 +load 16 txna ApplicationArgs 1 len -load 15 +load 16 - extract3 keccak256 keccak256 -store 16 -load 12 +store 17 +load 13 intc_1 // 0 > -load 14 -load 12 +load 15 +load 13 <= && -load 14 -load 12 +load 15 +load 13 intc_3 // 2 * pushint 3 // 3 / > && +pushint 403 // 403 +&& assert pushint 6 // 6 -store 15 +store 16 txn GroupIndex intc_1 // 0 > +pushint 432 // 432 +&& assert txn GroupIndex intc_0 // 1 - -store 10 -load 10 +store 11 +load 11 gtxns NumAppArgs intc_1 // 0 > +pushint 435 // 435 +&& assert -load 10 +load 11 gtxnsa ApplicationArgs 0 -store 11 +store 12 main_l31: -load 10 +load 11 intc_1 // 0 > -load 11 +load 12 bytec 5 // "verifySigs" == -load 11 +load 12 bytec 4 // "nop" == || && bnz main_l47 main_l32: -load 11 +load 12 bytec 5 // "verifySigs" != -load 11 +load 12 bytec 4 // "nop" != && bnz main_l46 main_l33: -load 10 +load 11 txn GroupIndex <= bnz main_l35 -load 15 +load 16 pushint 6 // 6 -load 14 +load 15 pushint 66 // 66 * + == +pushint 510 // 510 +&& assert intc_0 // 1 return main_l35: -load 10 +load 11 gtxns TypeEnum pushint 6 // appl == -load 10 +load 11 gtxns RekeyTo global ZeroAddress == && -load 10 +load 11 gtxns ApplicationID txn ApplicationID == && -load 10 +load 11 gtxnsa Accounts 1 txna Accounts 1 == && -load 10 +load 11 gtxnsa Accounts 2 txna Accounts 2 == && +pushint 454 // 454 +&& assert -load 10 -gtxnsa ApplicationArgs 0 -store 11 load 11 +gtxnsa ApplicationArgs 0 +store 12 +load 12 bytec 5 // "verifySigs" == bnz main_l42 -load 11 +load 12 bytec 4 // "nop" == bnz main_l41 -load 11 +load 12 bytec 9 // "verifyVAA" == bnz main_l41 @@ -574,117 +616,127 @@ main_l40: intc_1 // 0 return main_l41: -load 10 +load 11 intc_0 // 1 + -store 10 +store 11 b main_l33 main_l42: -load 10 +load 11 gtxnsa ApplicationArgs 1 -store 18 -load 18 +store 19 +load 19 len intc_1 // 0 > +pushint 470 // 470 +&& assert txna ApplicationArgs 1 -load 15 -load 18 +load 16 +load 19 len extract3 -load 18 +load 19 == +pushint 474 // 474 +&& assert -load 15 -load 18 +load 16 +load 19 len + -store 19 +store 20 bytec_0 // "" -store 18 +store 19 main_l43: -load 15 -load 19 +load 16 +load 20 < bnz main_l45 -load 10 +load 11 gtxnsa ApplicationArgs 2 -load 18 +load 19 == -load 10 +load 11 gtxns Sender bytec 8 // "vphash" app_global_get == && -load 10 +load 11 gtxnsa ApplicationArgs 3 -load 16 +load 17 == && +pushint 494 // 494 +&& assert b main_l41 main_l45: txna ApplicationArgs 1 -load 15 +load 16 intc_0 // 1 extract3 btoi -store 20 -load 17 -load 20 +store 21 +load 18 +load 21 getbit intc_1 // 0 == +pushint 485 // 485 +&& assert -load 17 -load 20 +load 18 +load 21 intc_0 // 1 setbit -store 17 -load 18 -load 13 -load 20 +store 18 +load 19 +load 14 +load 21 pushint 20 // 20 * pushint 20 // 20 extract3 concat -store 18 -load 15 +store 19 +load 16 pushint 66 // 66 + -store 15 +store 16 b main_l43 main_l46: -load 10 +load 11 intc_0 // 1 + -store 10 +store 11 b main_l33 main_l47: -load 10 +load 11 intc_0 // 1 - -store 10 -load 10 +store 11 +load 11 gtxns NumAppArgs intc_1 // 0 > bnz main_l49 bytec_0 // "" -store 11 +store 12 b main_l32 main_l49: -load 10 +load 11 gtxnsa ApplicationArgs 0 -store 11 +store 12 b main_l31 main_l50: global LatestTimestamp -load 18 +load 19 < +pushint 391 // 391 +&& assert b main_l30 main_l51: @@ -700,11 +752,15 @@ app_global_put txn Sender global CreatorAddress == +pushint 312 // 312 +&& assert bytec 15 // "booted" app_global_get intc_1 // 0 == +pushint 315 // 315 +&& assert bytec 15 // "booted" pushbytes 0x74727565 // "true" @@ -732,6 +788,8 @@ intc_3 // 2 extract3 bytec 11 // 0x0001 == +intc 5 // 214 +&& assert txna ApplicationArgs 1 load 2 @@ -741,6 +799,8 @@ pushint 32 // 32 extract3 bytec 12 // 0x0000000000000000000000000000000000000000000000000000000000000004 == +intc 6 // 216 +&& assert load 2 pushint 43 // 43 @@ -752,6 +812,8 @@ pushint 32 // 32 extract3 bytec 13 // 0x00000000000000000000000000000000000000000000000000000000436f7265 == +intc 7 // 220 +&& assert load 2 pushint 32 // 32 @@ -763,7 +825,7 @@ intc_0 // 1 + intc_3 // 2 extract3 -store 9 +store 10 txna ApplicationArgs 1 load 2 intc_0 // 1 @@ -792,9 +854,11 @@ load 2 intc_0 // 1 + store 2 -load 9 +load 10 bytec_1 // 0x0008 == +intc 8 // 285 +&& assert load 2 pushint 26 // 26 @@ -833,9 +897,11 @@ load 2 intc_0 // 1 + store 2 -load 9 +load 10 bytec_1 // 0x0008 == +intc 9 // 278 +&& assert load 2 intc_3 // 2 @@ -854,13 +920,15 @@ load 5 app_global_put b main_l59 main_l61: -load 9 +load 10 bytec_1 // 0x0008 == -load 9 +load 10 bytec 14 // 0x0000 == || +intc 10 // 244 +&& assert load 2 pushint 3 // 3 @@ -870,6 +938,8 @@ txna ApplicationArgs 1 load 2 pushint 4 // 4 extract3 +store 9 +load 9 btoi store 6 txna Accounts 3 @@ -877,6 +947,8 @@ load 6 bytec_2 // "guardian" callsub getsigaddress_9 == +intc 11 // 252 +&& assert intc_0 // 1 intc_1 // 0 @@ -899,6 +971,8 @@ store 8 load 8 intc_1 // 0 > +intc 12 // 268 +&& assert pushint 3 // 3 intc_1 // 0 @@ -925,7 +999,7 @@ main_l64: intc_3 // 2 intc 4 // 1000 global LatestTimestamp -intc 5 // 86400 +intc 13 // 86400 + itob callsub write_7 @@ -935,18 +1009,24 @@ main_l65: txna Accounts 3 txna Accounts 2 != +intc 14 // 256 +&& assert load 6 load 7 intc_0 // 1 + == +intc 15 // 257 +&& assert b main_l62 main_l66: -load 9 +load 10 bytec_1 // 0x0008 == +intc 16 // 233 +&& assert load 2 pushint 3 // 3 @@ -967,6 +1047,8 @@ load 6 btoi load 7 == +intc 17 // 208 +&& assert b main_l53 main_l68: @@ -978,6 +1060,8 @@ intc_1 // 0 txn Sender callsub getsigaddress_9 == +pushint 166 // 166 +&& assert bytec 6 // "MessageFee" app_global_get @@ -1036,6 +1120,8 @@ gtxns RekeyTo global ZeroAddress == && +pushint 170 // 170 +&& assert b main_l70 main_l72: @@ -1052,6 +1138,8 @@ sha512_256 bytec 7 // "validUpdateApproveHash" app_global_get == +pushint 572 // 572 +&& assert txn ClearStateProgram len @@ -1062,6 +1150,8 @@ extract 1 3 pushbytes 0x810143 // 0x810143 == && +pushint 573 // 573 +&& assert intc_0 // 1 return @@ -1083,43 +1173,47 @@ return // intkey intkey_0: +store 33 +load 33 itob extract 7 1 retsub // zero zero_1: -store 51 +store 58 intc_1 // 0 -store 52 +store 59 zero_1_l1: -load 52 +load 59 pushint 15 // 15 < bz zero_1_l3 -load 51 -load 52 +load 58 +load 59 callsub intkey_0 intc_2 // 127 bzero app_local_put -load 52 +load 59 intc_0 // 1 + -store 52 +store 59 b zero_1_l1 zero_1_l3: retsub // get_byte getbyte_2: -store 29 -load 29 +store 32 +store 31 +load 31 +load 32 intc_2 // 127 / callsub intkey_0 app_local_get -load 29 +load 32 intc_2 // 127 % getbyte @@ -1127,107 +1221,111 @@ retsub // set_byte setbyte_3: -store 60 -store 59 -store 58 -load 58 -load 59 +store 67 +store 66 +store 65 +load 65 +load 66 intc_2 // 127 / callsub intkey_0 -load 58 -load 59 +load 65 +load 66 intc_2 // 127 / callsub intkey_0 app_local_get -load 59 +load 66 intc_2 // 127 % -load 60 +load 67 setbyte app_local_put retsub // read read_4: -store 32 -store 31 -store 30 -bytec_0 // "" +store 36 +store 35 store 34 -load 31 +bytec_0 // "" +store 38 +load 35 intc_2 // 127 / -store 33 +store 37 read_4_l1: -load 33 -load 32 +load 37 +load 36 intc_2 // 127 / <= bz read_4_l9 -load 33 -load 31 +load 37 +load 35 intc_2 // 127 / == bnz read_4_l8 intc_1 // 0 read_4_l4: -store 35 -load 33 -load 32 +store 39 +load 37 +load 36 intc_2 // 127 / == bnz read_4_l7 intc_2 // 127 read_4_l6: -store 36 +store 40 +load 38 load 34 -load 30 -load 33 +load 37 callsub intkey_0 app_local_get -load 35 -load 36 +load 39 +load 40 substring3 concat -store 34 -load 33 +store 38 +load 37 intc_0 // 1 + -store 33 +store 37 b read_4_l1 read_4_l7: -load 32 +load 36 intc_2 // 127 % b read_4_l6 read_4_l8: -load 31 +load 35 intc_2 // 127 % b read_4_l4 read_4_l9: -load 34 +load 38 retsub // meta meta_5: -store 37 +store 42 +store 41 +load 41 bytec 17 // "meta" -load 37 +load 42 app_local_put retsub // checkMeta checkMeta_6: -store 38 +store 44 +store 43 +load 43 bytec 17 // "meta" app_local_get -load 38 +load 44 == pushint 145 // 145 && @@ -1236,37 +1334,37 @@ retsub // write write_7: -store 41 -store 40 -store 39 -intc_1 // 0 +store 47 +store 46 store 45 -load 40 +intc_1 // 0 +store 51 +load 46 intc_2 // 127 / -store 42 +store 48 write_7_l1: -load 42 -load 40 -load 41 +load 48 +load 46 +load 47 len + intc_2 // 127 / <= bz write_7_l12 -load 42 -load 40 +load 48 +load 46 intc_2 // 127 / == bnz write_7_l11 intc_1 // 0 write_7_l4: -store 43 -load 42 -load 40 -load 41 +store 49 +load 48 +load 46 +load 47 len + intc_2 // 127 @@ -1275,135 +1373,139 @@ intc_2 // 127 bnz write_7_l10 intc_2 // 127 write_7_l6: -store 44 -load 39 -load 42 +store 50 +load 45 +load 48 callsub intkey_0 -load 44 +load 50 intc_2 // 127 != -load 43 +load 49 intc_1 // 0 != || bnz write_7_l9 intc_2 // 127 -store 46 -load 41 -load 45 +store 52 +load 47 +load 51 intc_2 // 127 extract3 write_7_l8: app_local_put -load 45 -load 46 +load 51 +load 52 + -store 45 -load 42 +store 51 +load 48 intc_0 // 1 + -store 42 +store 48 b write_7_l1 write_7_l9: -load 44 -load 43 +load 50 +load 49 - -store 46 -load 39 -load 42 +store 52 +load 45 +load 48 callsub intkey_0 app_local_get intc_1 // 0 -load 43 +load 49 substring3 -load 41 -load 45 -load 46 +load 47 +load 51 +load 52 extract3 concat -load 39 -load 42 +load 45 +load 48 callsub intkey_0 app_local_get -load 44 +load 50 intc_2 // 127 substring3 concat b write_7_l8 write_7_l10: -load 40 -load 41 +load 46 +load 47 len + intc_2 // 127 % b write_7_l6 write_7_l11: -load 40 +load 46 intc_2 // 127 % b write_7_l4 write_7_l12: -load 45 +load 51 retsub // encode_uvarint encodeuvarint_8: -store 50 -store 49 -load 50 -load 49 -intc 6 // 128 +store 56 +store 55 +load 56 +store 57 +load 57 +load 55 +intc 18 // 128 >= bnz encodeuvarint_8_l2 -load 49 -intc 7 // 255 +load 55 +intc 19 // 255 & itob extract 7 1 b encodeuvarint_8_l3 encodeuvarint_8_l2: -load 49 +load 55 pushint 7 // 7 shr -load 49 -intc 7 // 255 +load 55 +intc 19 // 255 & -intc 6 // 128 +intc 18 // 128 | itob extract 7 1 -load 49 -load 50 -uncover 3 -uncover 3 +load 55 +load 56 +load 57 +uncover 4 +uncover 4 callsub encodeuvarint_8 -cover 2 -store 50 -store 49 +cover 3 +store 57 +store 56 +store 55 encodeuvarint_8_l3: concat retsub // get_sig_address getsigaddress_9: -store 48 -store 47 +store 54 +store 53 bytec 16 // "Program" pushbytes 0x0620010181 // 0x0620010181 concat -load 47 +load 53 bytec_0 // "" callsub encodeuvarint_8 concat pushbytes 0x4880 // 0x4880 concat -load 48 +load 54 len bytec_0 // "" callsub encodeuvarint_8 concat -load 48 +load 54 concat pushbytes 0x483110810612443119221244311881 // 0x483110810612443119221244311881 concat @@ -1427,37 +1529,48 @@ retsub // optin optin_10: -gtxn 0 TypeEnum +txn GroupIndex +intc_0 // 1 +- +gtxns TypeEnum intc_0 // pay == -gtxn 0 Amount +txn GroupIndex +intc_0 // 1 +- +gtxns Amount pushint 1002000 // 1002000 == && -gtxn 0 Receiver -gtxn 1 Sender +txn GroupIndex +intc_0 // 1 +- +gtxns Receiver +txn Sender == && -gtxn 1 TypeEnum +txn TypeEnum pushint 6 // appl == && -gtxn 1 OnCompletion +txn OnCompletion intc_0 // OptIn == && -gtxn 1 ApplicationID +txn ApplicationID global CurrentApplicationID == && -gtxn 1 RekeyTo +txn RekeyTo global CurrentApplicationAddress == && -gtxn 1 NumAppArgs +txn NumAppArgs intc_1 // 0 == && +pushint 148 // 148 +&& assert intc_1 // 0 callsub zero_1 @@ -1471,6 +1584,8 @@ extract 0 1 btoi intc_0 // 1 == +pushint 338 // 338 +&& assert txna ApplicationArgs 1 extract 5 1 @@ -1479,52 +1594,56 @@ pushint 66 // 66 * pushint 14 // 14 + -store 53 +store 60 txna ApplicationArgs 1 -load 53 +load 60 pushint 34 // 34 extract3 -store 54 +store 61 txna ApplicationArgs 1 -load 53 +load 60 pushint 34 // 34 + pushint 8 // 8 extract3 btoi -store 55 -load 55 +store 62 +load 62 pushint 15240 // 15240 / -store 57 +store 64 txna Accounts 1 -load 57 -load 54 +load 64 +load 61 callsub getsigaddress_9 == +pushint 348 // 348 +&& assert -load 55 +load 62 pushint 8 // 8 / pushint 1905 // 1905 % -store 57 +store 64 intc_0 // 1 -load 57 +load 64 callsub getbyte_2 -store 56 -load 56 -load 55 +store 63 +load 63 +load 62 pushint 8 // 8 % getbit intc_1 // 0 == +pushint 355 // 355 +&& assert intc_0 // 1 -load 57 -load 56 -load 55 +load 64 +load 63 +load 62 pushint 8 // 8 % intc_0 // 1 diff --git a/algorand/wormhole_core.py b/algorand/wormhole_core.py index dc34ad9794..566623ad02 100644 --- a/algorand/wormhole_core.py +++ b/algorand/wormhole_core.py @@ -126,8 +126,8 @@ def get_sig_address(acct_seq_start: Expr, emitter: Expr): @Subroutine(TealType.uint64) def optin(): # Alias for readability - algo_seed = Gtxn[0] - optin = Gtxn[1] + algo_seed = Gtxn[Txn.group_index() - Int(1)] + optin = Txn well_formed_optin = And( # Check that we're paying it