From 9f2252f7920ec3d8a6b74c82a0ab0f0ca4c05765 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 12 May 2022 19:05:15 +0200 Subject: [PATCH] fix: update soft block limit to 2MiB This is needed because the 1MiB limit is the chunker limit, however the actual blocks can be wrapped in protobuf which adds a small ~10 byte overhead. --- core/commands/cmdutils/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/commands/cmdutils/utils.go b/core/commands/cmdutils/utils.go index ebbbca64e46d..3ad27f42d0f2 100644 --- a/core/commands/cmdutils/utils.go +++ b/core/commands/cmdutils/utils.go @@ -11,7 +11,7 @@ import ( const ( AllowBigBlockOptionName = "allow-big-block" - SoftBlockLimit = 1024 * 1024 // https://github.com/ipfs/go-ipfs/issues/7421#issuecomment-910833499 + SoftBlockLimit = 1024 * 1024 * 2 // https://github.com/web3-storage/web3.storage/pull/1269#issuecomment-1108834504 ) var AllowBigBlockOption cmds.Option @@ -44,7 +44,7 @@ func CheckBlockSize(req *cmds.Request, size uint64) error { // when transmitting them over BitSwap. The 1 MiB constant is an // unenforced and undeclared rule of thumb hard-coded here. if size > SoftBlockLimit { - return fmt.Errorf("produced block is over 1MiB: big blocks can't be exchanged with other peers. consider using UnixFS for automatic chunking of bigger files, or pass --allow-big-block to override") + return fmt.Errorf("produced block is over 2MiB: big blocks can't be exchanged with other peers. consider using UnixFS for automatic chunking of bigger files, or pass --allow-big-block to override") } return nil