Skip to content

Commit

Permalink
fix: bump MAX_BLOCK_SIZE to 2MiB limit imposed by bitswap
Browse files Browse the repository at this point in the history
Bitswap spec is being updated to clarify the 2MiB limit: ipfs/specs#269

go-ipfs chunker accepts a max size of 1MiB but protobuf wrapping can make it a bit bigger. Switching to 2MiB allows us to support blocks created using that max chunker size.
  • Loading branch information
Alan Shaw committed Apr 28, 2022
1 parent 459c4c1 commit f0fcee5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/routes/nfts-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { JSONResponse } from '../utils/json-response.js'
import { checkAuth } from '../utils/auth.js'
import { toNFTResponse } from '../utils/db-transforms.js'

const MAX_BLOCK_SIZE = 1 << 20 // Maximum permitted block size in bytes (1MiB).
const MAX_BLOCK_SIZE = 1 << 21 // Maximum permitted block size in bytes (2MiB).
const decoders = [pb, raw, cbor]

/**
Expand Down Expand Up @@ -195,7 +195,7 @@ export async function nftUpdateUpload(event, ctx) {
*
* - Missing root CIDs
* - >1 root CID
* - Any block bigger than MAX_BLOCK_SIZE (1MiB)
* - Any block bigger than MAX_BLOCK_SIZE (2MiB)
* - 0 blocks
* - Missing root block
* - Missing non-root blocks (when root block has links)
Expand Down

0 comments on commit f0fcee5

Please sign in to comment.