algo/patch2: optins cannot have arguments

This commit is contained in:
Josh Siegel 2022-08-23 14:13:10 -05:00 committed by jumpsiegel
parent d3d68fde26
commit d724d42cf1
2 changed files with 10 additions and 7 deletions

View File

@ -984,14 +984,14 @@ def approve_token_bridge(seed_amt: int, tmpl_sig: TmplSig, devMode: bool):
# Check that we're paying it
algo_seed.type_enum() == TxnType.Payment,
algo_seed.amount() == Int(seed_amt),
algo_seed.receiver() == optin.sender(),
# Check that its an opt in to us
optin.type_enum() == TxnType.ApplicationCall,
optin.on_completion() == OnComplete.OptIn,
optin.application_id() == Global.current_application_id(),
algo_seed.receiver() == optin.sender(),
optin.rekey_to() == Global.current_application_address()
optin.rekey_to() == Global.current_application_address(),
optin.application_args.length() == Int(0)
)
return Seq(

View File

@ -127,14 +127,14 @@ def getCoreContracts( genTeal, approve_name, clear_name,
# Check that we're paying it
algo_seed.type_enum() == TxnType.Payment,
algo_seed.amount() == Int(seed_amt),
algo_seed.receiver() == optin.sender(),
# Check that its an opt in to us
optin.type_enum() == TxnType.ApplicationCall,
optin.on_completion() == OnComplete.OptIn,
# Not strictly necessary since we wouldn't be seeing this unless it was us, but...
optin.application_id() == Global.current_application_id(),
algo_seed.receiver() == optin.sender(),
optin.rekey_to() == Global.current_application_address()
optin.rekey_to() == Global.current_application_address(),
optin.application_args.length() == Int(0)
)
return Seq(
@ -460,6 +460,9 @@ def getCoreContracts( genTeal, approve_name, clear_name,
# What signatures did this verifySigs check?
s.store(Gtxn[i.load()].application_args[1]),
# Make sure we bail earlier on incorrect arguments...
MagicAssert(Len(s.load()) > Int(0)),
# Look at the vaa and confirm those were the expected signatures we should have been checking
# at this point in the process
MagicAssert(Extract(Txn.application_args[1], off.load(), Len(s.load())) == s.load()),