Skip to content

fix(stamp): remove unused immutable batch flag#319

Open
0xCardiE wants to merge 2 commits into
masterfrom
fix/immutable_stamp_removal
Open

fix(stamp): remove unused immutable batch flag#319
0xCardiE wants to merge 2 commits into
masterfrom
fix/immutable_stamp_removal

Conversation

@0xCardiE

@0xCardiE 0xCardiE commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the legacy immutableFlag from PostageStamp. The field was stored and exposed on-chain but never enforced — not in PostageStamp, not in Redistribution, and not at the network level. Keeping it implied a guarantee that does not exist.

Closes #317 (cleanup path).

Changes

  • Remove immutableFlag from Batch / ImportBatch structs
  • Drop _immutable from createBatch() and copyBatch()
  • Remove batchImmutableFlag() view and immutableFlag from BatchCreated event
  • Update Redistribution.stampFunction() batch destructuring
  • Update tests, echidna harnesses, migration scripts, and docs/POSTAGE_STAMP.md

Breaking changes

This is a breaking ABI change for the next PostageStamp deployment:

Before After
createBatch(owner, balance, depth, bucketDepth, nonce, immutable) createBatch(owner, balance, depth, bucketDepth, nonce)
copyBatch(owner, balance, depth, bucketDepth, batchId, immutable) copyBatch(owner, balance, depth, bucketDepth, batchId)
batchImmutableFlag(batchId) removed
BatchCreated(..., immutableFlag) BatchCreated(...) (no flag)
batches(id) returns 6 fields returns 5 fields

Existing mainnet batches are unaffected until the next contract migration.

Follow-up work (not in this PR)

Swarm / Bee docs

  • Remove or rewrite references to on-chain batch immutability in Bee and Swarm docs
  • Clarify that Bee's local overwrite protection (if any) is a node-side safeguard, not a network guarantee
  • Document the new createBatch / copyBatch signatures for integrators

Bee node

  • Update postage batch purchase / creation calls to drop the _immutable argument
  • Remove reads of batchImmutableFlag() if used anywhere
  • Keep local DB overwrite protection if still desired — that behavior is independent of the contract field
  • No change needed to chunk stamping logic unless Bee was branching on the on-chain flag (it had no network effect anyway)

Batch migration

  • Migration JSON exports may still contain an immutable field — safe to ignore on import (updated import.ts / import.sh / copy task no longer pass it)
  • Next migration run should use the updated copyBatch signature
  • Verify batch-migration tooling and any offline export scripts drop the field or treat it as legacy metadata only

Future (separate RFC)

Network-level immutability + depth-lock is a protocol change (Bee overwrite policy, conflict resolution, redistribution) — not a contract-only toggle. Track separately if we pursue storage guarantees.

Test plan

  • npx hardhat compile
  • npx hardhat test test/PostageStamp.test.ts
  • npx hardhat test test/Redistribution.test.ts

The immutableFlag was stored and exposed on-chain but never enforced.
Remove it from PostageStamp ABI, events, and migration helpers to stop
implying a network guarantee that does not exist.
Run prettier on touched files and remove stale commented copyBatch tests.
@0xCardiE
0xCardiE requested a review from nugaon July 18, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove immutable stamp field in the smart contract

1 participant