Skip to content

Commit

Permalink
Increase MAX_COMPRESSED_STATE_WITNESS_SIZE to 48 MiB (#11683)
Browse files Browse the repository at this point in the history
The `MAX_COMPRESSED_STATE_WITNESS_SIZE` has been set to 32 MiB in
#11511. Back then it was a
reasonable choice, but since then we increased some of the runtime
parameters, which increased the worst case witness size by ~17MiB.
(#11582,
#11629). I'd feel safer with a
larger limit on the compressed witness size.
  • Loading branch information
jancionear committed Jun 28, 2024
1 parent 6216bd6 commit 32397b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::encoding::{WitnessEncoder, WitnessEncoderCache, WitnessPart};
/// Max number of chunks to keep in the witness tracker cache. We reach here only after validation
/// of the partial_witness so the LRU cache size need not be too large.
/// This effectively limits memory usage to the size of the cache multiplied by
/// MAX_COMPRESSED_STATE_WITNESS_SIZE, currently 40 * 32MiB = 1280MiB
/// MAX_COMPRESSED_STATE_WITNESS_SIZE, currently 40 * 48MiB = 1920MiB.
const WITNESS_PARTS_CACHE_SIZE: usize = 40;

/// Number of entries to keep in LRU cache of the processed state witnesses
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/src/stateless_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use near_primitives_core::version::{ProtocolFeature, PROTOCOL_VERSION};

/// Represents max allowed size of the compressed state witness,
/// corresponds to EncodedChunkStateWitness struct size.
pub const MAX_COMPRESSED_STATE_WITNESS_SIZE: ByteSize = ByteSize::mib(32);
pub const MAX_COMPRESSED_STATE_WITNESS_SIZE: ByteSize = ByteSize::mib(48);

/// Represents max allowed size of the raw (not compressed) state witness,
/// corresponds to the size of borsh-serialized ChunkStateWitness.
Expand Down

0 comments on commit 32397b9

Please sign in to comment.