Skip to content

assertPieceValid

assertPieceValid(piece): void

Defined in: packages/synapse-core/src/sp/add-pieces-fits.ts:210

Throw if a piece can never be added: its PieceCID size is outside Curio’s upload bounds or its metadata exceeds the contract limits. Use it to reject bad pieces before any network work.

Parameter Type Description
piece LimiterPiece The piece to check.

void

InvalidUploadSizeError when the PieceCID size is below SIZE_CONSTANTS.MIN_UPLOAD_SIZE or above SIZE_CONSTANTS.MAX_UPLOAD_SIZE

Error when the piece metadata exceeds the contract limits