algo/audit: More security improvements

This commit is contained in:
Josh Siegel 2022-08-02 12:23:50 +00:00 committed by jumpsiegel
parent 5470ed134a
commit e738eda7fd
1 changed files with 5 additions and 7 deletions

View File

@ -259,13 +259,9 @@ def getCoreContracts( genTeal, approve_name, clear_name,
MagicAssert(len.load() > Int(0)),
Pop(blob.write(Int(3), Int(0), Extract(Txn.application_args[1], off.load(), Int(1) + (Int(20) * len.load())))),
# Make this block expire.. as long as it is
# not being used to sign itself. We stick the
# expiration 1000 bytes into the account...
#
# 19200 is approx 24 hours assuming a 4.5 seconds per block (24 * 3600 / 4.5) = 19200
If(Txn.accounts[3] != Txn.accounts[2],
Pop(blob.write(Int(2), Int(1000), Itob(Txn.first_valid() + Int(19200))))),
Pop(blob.write(Int(2), Int(1000), Itob(Global.latest_timestamp() + Int(86400))))),
blob.meta(Int(3), Bytes("guardian"))
])],
[a.load() == Int(3), Seq([
@ -379,12 +375,14 @@ def getCoreContracts( genTeal, approve_name, clear_name,
blob.checkMeta(Int(2), Bytes("guardian")),
# Lets grab the total keyset
total_guardians.store(blob.get_byte(Int(2), Int(0))),
MagicAssert(total_guardians.load() > Int(0)),
guardian_keys.store(blob.read(Int(2), Int(1), Int(1) + Int(20) * total_guardians.load())),
# I wonder if this is an expired guardian set
s.store(Btoi(blob.read(Int(2), Int(1000), Int(1008)))),
If(s.load() != Int(0),
MagicAssert(Txn.first_valid() < s.load())),
MagicAssert(Global.latest_timestamp() < s.load())),
hits.store(Bytes("base16", "0x00000000")),