Skip to content

fix: stewardship re-upload dispersed replicas - #5594

Open
aloknerurkar wants to merge 1 commit into
masterfrom
fix/stewardship-dispersed-replicas-5450
Open

fix: stewardship re-upload dispersed replicas#5594
aloknerurkar wants to merge 1 commit into
masterfrom
fix/stewardship-dispersed-replicas-5450

Conversation

@aloknerurkar

@aloknerurkar aloknerurkar commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

PUT /stewardship/{reference} with a non-zero Swarm-Redundancy-Level re-uploads all BMT trie chunks (data + RS parity) but never re-creates the root chunk's dispersed replicas — the SOC-wrapped copies spread across neighborhoods for retrieval resilience. traversal.Traverse only walks the trie; replicas are created separately by replicas.NewPutter at original upload time and are invisible to traversal.

Fix: after traversal succeeds, if rLevel != redundancy.NONE, fetch the root chunk (already local from traversal), re-stamp it, and push it through replicas.NewPutter(uploaderSession, rLevel) before calling uploaderSession.Done(root) — mirroring what the original upload path does.

Changes

  • pkg/steward/steward.go: added the post-traversal replica re-upload step in Reupload.
  • pkg/steward/steward_test.go: updated TestSteward to account for the extra replica traffic on the same push channel (was previously silently absent), and added an assertion that the expected number of dispersed replicas (redundancy.PARANOID.GetReplicaCount()) are actually re-uploaded and retrievable.

Testing

  • go build ./...
  • go vet ./pkg/steward/...
  • go test -race ./pkg/steward/... -count=5 — deterministic pass
  • golangci-lint run ./pkg/steward/...### Open API Spec Version Changes (if applicable)

Related Issue (Optional)

Fixes #5450

AI Disclosure

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

Comment thread pkg/steward/steward.go
}

if rLevel != redundancy.NONE {
rootChunk, err := getter.Get(ctx, root)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dispersed replicas are keyed on the 32 byte content address, but root here can be an encrypted reference, which carries the decryption key in its trailing 32 bytes, so it should be trimmed before the lookup.

Comment thread pkg/steward/steward.go
return errors.Join(fmt.Errorf("stamping root chunk for dispersed replicas: %w", err), uploaderSession.Cleanup())
}

if err := replicas.NewPutter(uploaderSession, rLevel).Put(ctx, rootChunk.WithStamp(stamp)); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should cehck if rootChank is valid content addressed chunk. Also, the replicas need to be stamped, not the root chunk.

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.

Stewardship Reupload Does Not Re-create Dispersed Replicas for Root Chunk

3 participants