-
Notifications
You must be signed in to change notification settings - Fork 992
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
Harden max proposal bytes configuration and deserialization #3220
Conversation
a105902
to
ad9482b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3220 +/- ##
=======================================
Coverage 60.24% 60.24%
=======================================
Files 303 303
Lines 93191 93199 +8
=======================================
+ Hits 56145 56152 +7
- Misses 37046 37047 +1 ☔ View full report in Codecov by Sentry. |
e1712cc
to
ca6aaa8
Compare
max_tx_bytes
provided by CometBFT when initializing block allocatorca6aaa8
to
d8f959c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes are fine, but comment needs to be updated
@@ -475,12 +472,13 @@ async fn write_tm_genesis( | |||
.try_into() | |||
.expect("Failed to convert initial genesis height"); | |||
} | |||
const EVIDENCE_AND_PROTOBUF_OVERHEAD: u64 = 10 * 1024 * 1024; | |||
let size = block::Size { | |||
// maximum size of a serialized Tendermint block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is now out of date
* origin/tiago/max-proposal-bytes-validation: Changelog for #3220 Avoid using hardcoded values when configuring CometBFT Validate borsh deserialization of ProposalBytes
* origin/tiago/max-proposal-bytes-validation: Changelog for #3220 Avoid using hardcoded values when configuring CometBFT Validate borsh deserialization of ProposalBytes
* tomas/split-up-apps: changelog: add #3259 test/apps_lib: fix the top-level dir check fix paths for split up namada_apps_lib git: ignore the new generated version.rs path symlink proto from `apps_lib` `mv crates/apps/build.rs crates/apps_lib/` `mv crates/apps_lib/src/lib/mod.rs crates/apps_lib/src/lib.rs` `mv crates/apps/src/lib crates/apps_lib/src` apps_lib: add a new crate for apps lib crate fixup! Merge branch 'grarco/masp-fees' (#3217) fixup! Merge branch 'grarco/tx-batch' (#3103) fixup! Merge branch 'grarco/tx-batch' (#3103) fixup! Merge branch 'bat/fix/issue-1796' (#3226) fixup! Merge branch 'tiago/max-proposal-bytes-validation' (#3220) fixup! Merge branch 'tomas/more-checked-arith' (#3214) empty commit changelog: add #3216 deliberatly empty Changelog #2817 added clone to transaction structs
Describe your changes
Closes #3189
Indeed, Namada ignores the
max_tx_bytes
parameter from CometBFT, which may shrink dynamically based on the presence of evidence of misbehavior data in blocks.This parameter is only passed as an argument to
PrepareProposal
ABCI calls, and (crucially) never toProcessProposal
calls, forcing it to be available underProcessProposal
via some other means.As such,
max_proposal_bytes
(a semantically equivalent Namada-only parameter) was introduced in #843. To ensure the application never exceedsmax_tx_bytes
, CometBFT was configured with a much larger maximum block size (100 MiB, and 90 MiB max formax_proposal_bytes
).In #2187, we modified these bounds, setting the max block size to 16 MiB and the max value of
max_proposal_bytes
to 6 MiB. Evidence data is the only reason the space reserved for txs may shrink; as 10 MiB is plenty of available space for misbehavior reports, we should never exceed the maximum block size.It is also important to state CometBFT faces a problem of the same nature. During CometBFT block validation,
MaxTxBytes
is never checked. The only place where it is checked is during block construction, leaving the burden of this validation to ABCI apps. Unfortunately, as we stated,ProcessProposal
is not called withmax_tx_bytes
...That said, this PR does the following:
BorshDeserialize
forProposalBytes
.ProposalBytes::MAX
instead.Indicate on which release or other PRs this topic is based on
v0.35.1
Checklist before merging to
draft