Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add CIP for block limits on pfbs and tx size #220

Closed
wants to merge 14 commits into from

Conversation

jcstein
Copy link
Member

@jcstein jcstein commented Oct 16, 2024

Overview

Resolves #219

@jcstein jcstein self-assigned this Oct 16, 2024
Comment on lines 18 to 20
1. The number of PFBs per block is limited to 600 by setting `PFBTransactionCap` to 600. `PFBTransactionCap` is the maximum number of PFB messages a block can contain.

1. The number of non-PFB transactions per block is limited to 200 by setting `NonPFBTransactionCap` to 200. `NonPFBTransactionCap` is the maximum number of SDK messages, aside from PFBs, that a block can contain.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional] I think it's worth calling out that these limits aren't actually enforced. They're limits used by the celestia-app implementation but a validator could hypothetically modify prepare proposal, run that binary and create blocks with more PFBs or non-PFBs.

[nit] the constants are poorly named b/c the thing being limited is the number of messages in a block not the number of transactions. Should we change the implementation and the specs here? cc: @rach-id

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rootulp yes sure. want me to open a PR or you do it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8fbee0e updated to new variables, if these don't get included with v3.0.0-rc, I will revert to names NonPFBTransactionCap and PFBTransactionCap

cips/cip-tx-limits.md Outdated Show resolved Hide resolved

The rationale for this proposal is twofold:

1. To prevent congestion on the network by limiting the number of PFBs and non-PFB transactions per block. This was initially not considered consensus-breaking, but it has a meaningful effect on users and should be formalized in a CIP.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional] I think specifically to prevent block times from spiking b/c if a block includes > 600 PFB messages and 200 non-PFB messages, the time to process the block expands past the 6 second time window. cc: @rach-id can clarify

Suggested change
1. To prevent congestion on the network by limiting the number of PFBs and non-PFB transactions per block. This was initially not considered consensus-breaking, but it has a meaningful effect on users and should be formalized in a CIP.
1. To prevent long block times on the network by limiting the number of PFBs and non-PFB transactions per block. This was initially not considered consensus-breaking, but it has a meaningful effect on users and should be formalized in a CIP.

cips/cip-tx-limits.md Outdated Show resolved Hide resolved
cips/cip-tx-limits.md Outdated Show resolved Hide resolved
cips/cip-tx-limits.md Outdated Show resolved Hide resolved

The rationale for this proposal is twofold:

1. To prevent long block times on the network by limiting the number of PFBs and non-PFBs messages per block. This was initially not considered consensus-breaking, but it has a meaningful effect on users and should be formalized in a CIP.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this at a later point but it might be helpful to remember later on how these numbers were chosen

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could point to this PR celestiaorg/celestia-app#390 as I am adding the results to it and will open it for review afterwards

Copy link
Member Author

@jcstein jcstein Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR 309 referenced is from deciding on the prefix for addresses and unrelated to this? celestiaorg/celestia-app#390
Screenshot 2024-10-17 at 12 26 35

@rach-id Can you please provide a condensed explanation of what you learned in the PR that was intended to be linked? to explain why these values were chosen?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, this PR: celestiaorg/celestia-app#3904

That PR contains benchmarks that we run to measure the processing time different ABCI methods take with different transaction types.

Then, to limit that processing time to ~0.25sec, we added a soft limiter in prepare proposal so that the default block created by the block construction mechanism respects that processing time limit.

This soft limiter is a simple cap on the number of messages a block can contain, based on running the PRs benchmarks on 4 CPU 16GB RAM machines, which is the suggested validator configuration.

This way, the default blocks don't take much time to process. However, if a block not respecting those limits reaches consensus, it still can be included and won't be wasted.

cips/cip-tx-limits.md Outdated Show resolved Hide resolved

1. It's important to note that these limits are not strictly enforced. While they are defined by the `celestia-app` implementation, a validator could potentially modify the `PrepareProposal` logic, run a custom binary, and produce blocks that exceed the specified limits for PFB or non-PFBs transactions.

1. The size of a transaction is limited to 2MiB by setting `MaxTxSize` to 2097152, which is 2MiB in bytes. From version v3 and above, in `CheckTx`, `PrepareProposal`, and `ProcessProposal`, each transaction's size is checked against the `appconsts.MaxTxSize` threshold. This ensures that transactions over the limit are rejected or excluded at all stages, from initial submission to execution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This first line also feels verbose. We should also point out that this is a versioned parameter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cips/cip-tx-limits.md Outdated Show resolved Hide resolved
cips/cip-tx-limits.md Outdated Show resolved Hide resolved
cips/cip-tx-limits.md Outdated Show resolved Hide resolved
cips/cip-tx-limits.md Outdated Show resolved Hide resolved
cips/cip-tx-limits.md Outdated Show resolved Hide resolved
cips/cip-tx-limits.md Outdated Show resolved Hide resolved
@@ -0,0 +1,44 @@
| cip | TBD(27) |
| - | - |
| title | Block limits for number of PFBs/non-PFBs and transaction size |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this in all core devs but IMO there wasn't a clear decision made in the call. I think we could split this into two CIPs:

  1. Block limits for PFBs / non-PFBs
  2. Limit transaction size

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @cmwaters explanation is that these both impact how a block is constructed, so was okay to leave it as 1 CIP.

Copy link
Member Author

@jcstein jcstein Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also happy to scrap this and have it split to 2 CIPs by authors of the features. but I worry this will likely just add more delay to these being drafted.

cips/cip-tx-limits.md Outdated Show resolved Hide resolved
@jcstein
Copy link
Member Author

jcstein commented Oct 17, 2024

closing this in favor of 2 separate CIPs for these features

@jcstein jcstein closed this Oct 17, 2024
@jcstein jcstein deleted the jcs/cip-pfbs-limits-tx-limit branch October 17, 2024 20:19
evan-forbes pushed a commit to celestiaorg/celestia-app that referenced this pull request Oct 18, 2024
Motivation:
celestiaorg/CIPs#220 (comment)

IMO we should either include this in v3.0.0-rc0 or close it b/c not
worth it to break these constant names after that.
rach-id pushed a commit to celestiaorg/celestia-app that referenced this pull request Nov 26, 2024
Motivation:
celestiaorg/CIPs#220 (comment)

IMO we should either include this in v3.0.0-rc0 or close it b/c not
worth it to break these constant names after that.

(cherry picked from commit f217064)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: CIP for limiting tx size
5 participants