Skip to content

Commit ecf2c60

Browse files
authored
Merge pull request #105 from giuliop/lsig-size-pooling
Add logicsig size pooling in transaction groups
2 parents 8774fcb + 071f781 commit ecf2c60

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

dev/TEAL.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,18 @@ of a contract account.
148148
transaction against the contract account is for the program to
149149
approve it.
150150

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

160164
The total program cost of all Smart Signatures in a group must not
161165
exceed 20,000 (consensus parameter LogicSigMaxCost) times the number

dev/ledger.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ which can be encoded as a msgpack struct:
490490
- The number of digits after the decimal place to be used when displaying the
491491
asset, encoded with msgpack field `dc`. A value of 0 represents an asset
492492
that is not divisible, while a value of 1 represents an asset divisible into
493-
into tenths, 2 into hundredths, and so on. This value must be between 0 and
493+
into tenths, 2 into hundredths, and so on. This value must be between 0
494494
and 19 (inclusive) ($2^{64}-1$ is 20 decimal digits).
495495

496496
- Whether holdings of that asset are frozen by default, a boolean flag encoded
@@ -638,9 +638,9 @@ specific fashion:
638638
In more detail, let $r$ be the last round in which a transaction touched account $I$ (and therefore all pending rewards were added to it). Consider the following quantities, as defined in the [Account State](#account-state):
639639

640640
- The raw balance $a_I$ of account $I$ at round $r$ is its total balance on that round.
641-
- The rewards base $a'_I$ is meant to capture the total rewards that were allocated to all accounts upto round $r$, expressed as a fraction of the total stake (with limited precision as described below).
641+
- The rewards base $a'_I$ is meant to capture the total rewards that were allocated to all accounts up to round $r$, expressed as a fraction of the total stake (with limited precision as described below).
642642

643-
Given these two quantities, the normalized balance of an online account $I$ is $a_I/(1+a'_I)$. For example, if the total amount of rewards distributed upto round $r$ is 20% of the total stake, then the normalized balance is $a_I/1.2$.
643+
Given these two quantities, the normalized balance of an online account $I$ is $a_I/(1+a'_I)$. For example, if the total amount of rewards distributed up to round $r$ is 20% of the total stake, then the normalized balance is $a_I/1.2$.
644644

645645
To limit the required precision in this calculation, the system uses a parameter $ru$ that specifies the rewards-earning unit, namely accounts only earn rewards for a whole number of $ru$ microAlgos. (Currently $ru=1,000,000$, so the rewards-earning unit is one Algo.)
646646

@@ -1155,7 +1155,7 @@ If the sum of the fees paid by the transactions in a transaction group is less t
11551155

11561156
If the sum of the lengths of the boxes denoted by the box references in a
11571157
transaction group exceeds 1,024 times the total number of box
1158-
referencess in the transaction group, then the block is invalid. Call
1158+
references in the transaction group, then the block is invalid. Call
11591159
this limit the _I/O Budget_ for the group. Box references with an
11601160
empty name are counted toward the total number of references, but add
11611161
nothing to the sum of lengths.
@@ -1165,7 +1165,11 @@ modification) in a transaction group exceeds the I/O Budget of the
11651165
group at any time during evaluation (see [ApplicationCall Transaction
11661166
Semantics]), then the block is invalid.
11671167

1168-
Beyond the TxGroup, MinFee, and Box size checks, each transaction in a
1168+
If the sum of the lengths of all the logic signatures and their arguments
1169+
in a transaction group exceeds the number of transactions in the group times
1170+
1000 bytes (consensus variable `MaxLogicSigSize`), then the block in invalid.
1171+
1172+
Beyond the TxGroup, MinFee, Box size, and LogicSig size checks, each transaction in a
11691173
group is evaluated separately and must be valid on its own, as
11701174
described below in the [Validity and State Changes] section. For
11711175
example, an account with balance 50 could not spend 100 in transaction

0 commit comments

Comments
 (0)