diff --git a/pyteal/ast/abi/address.py b/pyteal/ast/abi/address.py index 35a567a41..145b0f336 100644 --- a/pyteal/ast/abi/address.py +++ b/pyteal/ast/abi/address.py @@ -100,8 +100,10 @@ def set( ) case Expr(): return Seq( - Assert(Len(value) == Int(AddressLength.Bytes.value)), self.stored_value.store(value), + Assert( + Len(self.stored_value.load()) == Int(AddressLength.Bytes.value) + ), ) case CollectionSequence(): if len(value) != AddressLength.Bytes: diff --git a/pyteal/ast/abi/address_test.py b/pyteal/ast/abi/address_test.py index 1b9f793f9..823623f51 100644 --- a/pyteal/ast/abi/address_test.py +++ b/pyteal/ast/abi/address_test.py @@ -201,12 +201,12 @@ def test_Address_set_expr(): expected = pt.TealSimpleBlock( [ vts.ops[0], + pt.TealOp(None, pt.Op.store, value.stored_value.slot), + pt.TealOp(None, pt.Op.load, value.stored_value.slot), pt.TealOp(None, pt.Op.len), pt.TealOp(None, pt.Op.int, AddressLength.Bytes.value), pt.TealOp(None, pt.Op.eq), pt.TealOp(None, pt.Op.assert_), - vts.ops[0], - pt.TealOp(None, pt.Op.store, value.stored_value.slot), ] )