Skip to content

[CT-12] Add bulk document registration to document registry contract #920

@mftee

Description

@mftee

Problem

A single shipment typically has multiple associated documents (Bill of Lading, Proof of Delivery, customs declaration, insurance certificate). Registering each document separately on-chain requires a separate transaction per document, multiplying the cost and latency of post-delivery document submission.

Proposed Solution

Create a bulk document registration function in a new contract inside contracts/package/document-bulk/ that registers multiple documents in a single atomic transaction.

Note: All work must be done inside the contracts/package/ directory. Do not modify any existing contract files outside this folder.

Acceptance Criteria

  • register_documents_batch(docs: Vec<DocumentEntry>) where DocumentEntry = { hash: BytesN<32>, doc_type: Symbol, ipfs_cid: String, expires_at: Option<u64> }
  • Maximum 10 documents per batch; exceeding returns BatchLimitExceeded
  • Each hash is validated to be unique (not previously registered); a duplicate returns HashAlreadyRegistered
  • The batch is atomic: if any document fails validation, no documents from the batch are registered
  • Returns Vec<BytesN<32>> — the list of document IDs created
  • Unit tests cover: valid batch of 5, duplicate hash causes full rollback, batch exceeding 10 documents

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions