Skip to content

Commit

Permalink
reword bp(+) max outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Boog900 committed Jan 9, 2024
1 parent c0e28b3 commit bf0e078
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/consensus_rules/transactions/outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The and the outputs when summed must not overflow a u64[^amount-overflow].

### Output Amount

For version 1 txs the total amount of the outputs must be less than the total inputs, the difference between the
For version 1 txs sum of the outputs must be less than the sum of the inputs, the difference between the
inputs and the outputs is then the fee.[^more-in-than-out] The amount of each outputs must also not be zero.[^zero-output]

From hard-fork 2 version 1 transaction output amounts also must be validly decomposed[^decomposed-amounts].
Expand Down
2 changes: 1 addition & 1 deletion src/consensus_rules/transactions/ring_ct/borromean.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The amount of Borromean range proofs must be the same as the number of outputs.[

### Ci Valid Points

Each Ci (bit commitment) must be valid points.[^ci-valid-points]
Each Ci (bit commitment) must be canonically encoded points.[^ci-valid-points]

### Sum Ci

Expand Down
15 changes: 10 additions & 5 deletions src/consensus_rules/transactions/ring_ct/bulletproofs+.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ These rules apply to all ringCT types that use bulletproofs+.

### L & R Length

The Length of the L & R fields must be the same, they must both be greater than or equal to 6 and less than or equal to \\( 6 + log_2(maxOutputs) \\),
maxOutputs being 16.[^L-R-Size]
The Length of the L & R fields must be the same, they must both be equal to \\( 6 + log_2(firstPower2AboveNumbOuts) \\).[^L-R-Size]

Where `firstPower2AboveNumbOuts` is the first power of 2 above or equal to the amount of outputs in the transaction, so:

If outputs = 3, firstPower2AboveNumbOuts = 4.

If outputs = 8, firstPower2AboveNumbOuts = 8.

### Number Of Bulletproofs

There must only be one bulletproof in a transaction.[^one-bulletproof+]

### Max Outputs

The amount of outputs in the transaction must not be more than \\(2^{(len(L) - 6)} \\) and 2 * NumbOutputs must be more than \\(2^{(len(L) - 6)}\\) [^max-outputs]
The amount of outputs in the transaction must not be more than 16 [^max-outputs]

### Canonical Encoding

Expand All @@ -32,11 +37,11 @@ There must be at least one element of V, which is constructed from the outPKs wh

The bulletproof must pass verification. [^bulletproof+-valid]

[^L-R-Size]: <https://github.com/monero-project/monero/blob/master/src/ringct/rctTypes.cpp#L300-L304>
[^L-R-Size]: <https://github.com/monero-project/monero/blob/master/src/ringct/rctTypes.cpp#L300-L304> && <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/ringct/bulletproofs_plus.cc#L850>

[^one-bulletproof+]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/cryptonote_basic/cryptonote_format_utils.cpp#L173>

[^max-outputs]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/ringct/rctTypes.cpp#L261-L262>
[^max-outputs]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/cryptonote_core/cryptonote_core.cpp#L887>

[^scalars-reduced]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/ringct/bulletproofs_plus.cc#L825-L827>

Expand Down
15 changes: 10 additions & 5 deletions src/consensus_rules/transactions/ring_ct/bulletproofs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ These rules apply to all ringCT types that use bulletproofs.

### L & R Length

The Length of the L & R fields must be the same, they must both be greater than or equal to 6 and less than or equal to \\( 6 + log_2(maxOutputs) \\),
maxOutputs being 16.[^L-R-Size]
The Length of the L & R fields must be the same, they must both be equal to \\( 6 + log_2(firstPower2AboveNumbOuts) \\).[^L-R-Size]

Where `firstPower2AboveNumbOuts` is the first power of 2 above or equal to the amount of outputs in the transaction, so:

If outputs = 3, firstPower2AboveNumbOuts = 4.

If outputs = 8, firstPower2AboveNumbOuts = 8.

### Number Of Bulletproofs

There must only be one bulletproof in a transaction.[^one-bulletproof]

### Max Outputs

The amount of outputs in the transaction must not be more than \\(2^{(len(L) - 6)} \\) and 2 * NumbOutputs must be more than \\(2^{(len(L) - 6)}\\) [^max-outputs]
The amount of outputs in the transaction must not be more 16 [^max-outputs]

### At Least One Output

Expand All @@ -35,11 +40,11 @@ The bulletproof must pass verification. [^bulletproof-valid]

---

[^L-R-Size]: <https://github.com/monero-project/monero/blob/master/src/ringct/rctTypes.cpp#L300-L304>
[^L-R-Size]: <https://github.com/monero-project/monero/blob/master/src/ringct/rctTypes.cpp#L300-L304> && <https://github.com/monero-project/monero/blob/master/src/ringct/bulletproofs.cc#L862-L863>

[^one-bulletproof]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/cryptonote_basic/cryptonote_format_utils.cpp#L197>

[^max-outputs]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/ringct/rctTypes.cpp#L261-L262>
[^max-outputs]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/cryptonote_core/cryptonote_core.cpp#L877>

[^one-out]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/ringct/bulletproofs.cc#L839>

Expand Down

0 comments on commit bf0e078

Please # to comment.