Skip to content

Commit

Permalink
Add logicsig size pooling in transaction groups
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliop committed Nov 7, 2024
1 parent 8774fcb commit 43403c1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
20 changes: 12 additions & 8 deletions dev/TEAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,18 @@ of a contract account.
transaction against the contract account is for the program to
approve it.

The bytecode plus the length of all Args must add up to no more than
1000 bytes (consensus parameter LogicSigMaxSize). Each opcode has an
associated cost, usually 1, but a few slow operations have higher
costs. Prior to v4, the program's cost was estimated as the static sum
of all the opcode costs in the program (whether they were actually
executed or not). Beginning with v4, the program's cost is tracked
dynamically, while being evaluated. If the program exceeds its budget,
it fails.
The size of a Smart Signature is defined as the length of its bytecode
plus the length of all its Args. The sum of the sizes of all Smart
Signatures in a group must not exceed 1000 bytes times the number of
transactions in the group (1000 bytes is defined in consensus parameter
`LogicSigMaxSize`).

Each opcode has an associated cost, usually 1, but a few slow operations
have higher costs. Prior to v4, the program's cost was estimated as the
static sum of all the opcode costs in the program (whether they were
actually executed or not). Beginning with v4, the program's cost is
tracked dynamically, while being evaluated. If the program exceeds its
budget, it fails.

The total program cost of all Smart Signatures in a group must not
exceed 20,000 (consensus parameter LogicSigMaxCost) times the number
Expand Down
6 changes: 5 additions & 1 deletion dev/ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,11 @@ modification) in a transaction group exceeds the I/O Budget of the
group at any time during evaluation (see [ApplicationCall Transaction
Semantics]), then the block is invalid.

Beyond the TxGroup, MinFee, and Box size checks, each transaction in a
If the sum of the lenghts of all the logic signatures and their arguments
in a transaction group exceeds the number of transactions in the group times
1000 bytes (consensus variable `MaxLogicSigSize`), then the block in invalid.

Beyond the TxGroup, MinFee, Box, and LogicSig size checks, each transaction in a
group is evaluated separately and must be valid on its own, as
described below in the [Validity and State Changes] section. For
example, an account with balance 50 could not spend 100 in transaction
Expand Down

0 comments on commit 43403c1

Please sign in to comment.