Skip to content

Commit

Permalink
fixup! Merge branch 'tiago/max-proposal-bytes-validation' (#3220)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed May 14, 2024
1 parent 46d2c75 commit 4cafd2c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/apps/src/lib/node/ledger/tendermint_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,12 @@ async fn update_tendermint_config(
// during some round's start
config.mempool.max_tx_bytes = 1024 * 1024;

// Hold 50x the max amount of txs in a block
config.mempool.max_txs_bytes = 50 * ProposalBytes::MAX.get();
// Hold 50x the max amount of txs in a block.
#[allow(clippy::arithmetic_side_effects)]
{
// Multiply with consts - cannot overflow
config.mempool.max_txs_bytes = 50 * ProposalBytes::MAX.get();
}

// Hold up to 4k txs in the mempool
config.mempool.size = 4000;
Expand Down Expand Up @@ -477,7 +481,9 @@ async fn write_tm_genesis(
// maximum size of a serialized Tendermint block.
// on Namada, we have a hard-cap of 16 MiB (6 MiB max
// txs in a block + 10 MiB reserved for evidence data,
// block headers and protobuf serialization overhead)
// block headers and protobuf serialization overhead).
// Addition with consts - cannot overflow.
#[allow(clippy::arithmetic_side_effects)]
max_bytes: EVIDENCE_AND_PROTOBUF_OVERHEAD + ProposalBytes::MAX.get(),
// gas is metered app-side, so we disable it
// at the Tendermint level
Expand Down

0 comments on commit 4cafd2c

Please sign in to comment.