Skip to content

Commit

Permalink
fix: update soft block limit to 2MiB
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Jorropo committed May 12, 2022
1 parent 53299e8 commit 9f2252f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/commands/cmdutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 9f2252f

Please sign in to comment.