PyTeal opcodes cost (Asserts vs And)

What is the preferred way to do these checks (in terms of opcode cost and PyTeal style guide):

Multiple Assert's inside a Seq, or a single And opcode with multiple conditions inside it?

This:

Assert( Global.group_size() == Int(1) ),

Assert( Txn.application_args.length() == Int(3) ),

Assert( Txn.accounts.length() == Int(0) ),

vs. this:

And( 

   Global.group_size() == Int(1) ,

   Txn.application_args.length() == Int(3) ,

   Txn.accounts.length() == Int(0) 
)

Thanks in advance.

I prefer the above because I think it’s less error prone from my point of view.

Code size and cost is the same (up to one byte/one cost difference)

1 Like

I’ll add that debugging separate Asserts is much easier than when a large And expression has a ton of things on the stack.

1 Like