ソースを参照

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.
Marcos Nuñez Cortes 2 年 前
コミット
0dcc53cbf8
3 ファイル変更301 行追加203 行削除
  1. 1 1
      algorand/admin.py
  2. 298 200
      algorand/teal/core_approve.teal
  3. 2 2
      algorand/wormhole_core.py

+ 1 - 1
algorand/admin.py

@@ -1151,7 +1151,7 @@ class PortalCore:
             off += 2
             off += 2
             ret["Fee"] = vaa[off:(off + 32)].hex()
             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["Meta"] = "TokenBridge Transfer With Payload"
             ret["Type"] = int.from_bytes((vaa[off:off+1]), "big")
             ret["Type"] = int.from_bytes((vaa[off:off+1]), "big")
             off += 1
             off += 1

ファイルの差分が大きいため隠しています
+ 298 - 200
algorand/teal/core_approve.teal


+ 2 - 2
algorand/wormhole_core.py

@@ -126,8 +126,8 @@ def getCoreContracts(   genTeal, approve_name, clear_name,
         @Subroutine(TealType.uint64)
         @Subroutine(TealType.uint64)
         def optin():
         def optin():
             # Alias for readability
             # Alias for readability
-            algo_seed = Gtxn[0]
-            optin = Gtxn[1]
+            algo_seed = Gtxn[Txn.group_index() - Int(1)]
+            optin = Txn
     
     
             well_formed_optin = And(
             well_formed_optin = And(
                 # Check that we're paying it
                 # Check that we're paying it

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません