fix: raise block size limits from 1MiB to 2MiB#1101
Conversation
align chunker and importer block size limits with the bitswap spec (https://specs.ipfs.tech/bitswap-protocol/#block-sizes) which mandates 2MiB as the maximum block size. the previous 1MiB limit broke `dag import` of 1MiB-chunked non-raw-leaf data where protobuf wrapping pushes blocks slightly over 1MiB. max chunker size is set to 2MiB - 256 bytes to leave room for protobuf framing overhead when chunks are wrapped in non-raw leaves. IPIP-499 profiles use lower chunk sizes (256KiB and 1MiB) and are not affected.
This comment was marked as off-topic.
This comment was marked as off-topic.
- chunker: verify ChunkSizeLimit + ChunkOverheadBudget == BlockSizeLimit - bitswap/message: verify BlockSizeLimit block (CIDv1+raw+SHA2-256) serializes within libp2p network.MessageSizeMax and round-trips - use explicit byte values instead of bit-shift notation
lidel
left a comment
There was a problem hiding this comment.
Merging as the new 2MiB block size limit matches the bitswap spec and is well above any chunk size used by IPIP-499 profiles (unixfs-v1-2025 uses 1MiB, unixfs-v0-2015 uses 256KiB). Existing users are not affected.
If someone creates blocks between 2MiB and ~4MiB using --allow-big-block, they will still transfer fine over bitswap. The actual hard limit on the wire is network.MessageSizeMax (4MiB) minus a few bytes of protobuf envelope. We have tests confirming this in ipfs/kubo#11185, including regression tests at the exact byte boundary where libp2p starts rejecting messages.
The 256-byte overhead budget (ChunkSizeLimit = BlockSizeLimit - 256) is a precaution that accounts for protobuf/UnixFS framing when --raw-leaves=false, so the max --chunker value produces blocks that stay within 2MiB after wrapping.
IPIP-499's unixfs-v1-2025 profile uses 1MiB chunks. with --raw-leaves=false, protobuf wrapping pushes blocks slightly over 1MiB. the previous 1MiB SoftBlockLimit rejected these blocks on dag import. raise SoftBlockLimit to 2MiB to match the bitswap spec, which requires implementations to support blocks up to 2MiB. - raise SoftBlockLimit to 2MiB per the bitswap spec - update error messages and help text - bump boxo to main with ipfs/boxo#1101 (raised ChunkSizeLimit/BlockSizeLimit, 256-byte overhead budget) - update sharness tests for 2MiB boundary - add test/cli boundary tests for block put, dag put, dag import, ipfs add (raw and wrapped leaves), and bitswap exchange including regression tests for the libp2p message size hard limit
IPIP-499's unixfs-v1-2025 profile uses 1MiB chunks. with --raw-leaves=false, protobuf wrapping pushes blocks slightly over 1MiB. the previous 1MiB SoftBlockLimit rejected these blocks on dag import. raise SoftBlockLimit to 2MiB to match the bitswap spec, which requires implementations to support blocks up to 2MiB. - raise SoftBlockLimit to 2MiB per the bitswap spec - update error messages and help text - bump boxo to main with ipfs/boxo#1101 (raised ChunkSizeLimit/BlockSizeLimit, 256-byte overhead budget) - update sharness tests for 2MiB boundary - add test/cli boundary tests for block put, dag put, dag import, ipfs add (raw and wrapped leaves), and bitswap exchange including regression tests for the libp2p message size hard limit
align chunker and importer block size limits with the bitswap spec (https://specs.ipfs.tech/bitswap-protocol/#block-sizes) which mandates 2MiB as the maximum block size.
the previous 1MiB limit broke things like Kubo's
dag importof 1MiB-chunked non-raw-leaf data where protobuf wrapping pushes blocks slightly over 1MiB (see ipfs/kubo#8968 (comment))max chunker size is set to 2MiB - 256 bytes to leave room for protobuf framing overhead when chunks are wrapped in non-raw leaves. IPIP-499 profiles use lower chunk sizes (256KiB and 1MiB) and are not affected.