Open
Conversation
SOC chunks uploaded via the generic /chunks endpoint are misclassified as CAC chunks because the handler tries CAC parsing first, which always succeeds for valid SOC data (8-4104 bytes). These tests demonstrate that SOC uploads return incorrect addresses and are unretrievable.
Try SOC parsing before CAC in the chunk upload handler. CAC parsing accepts any data between 8-4104 bytes, so valid SOC data was always misclassified as CAC and stored at the wrong content-addressed hash instead of the correct SOC address (Hash(Identifier || Owner)).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Description
The
POST /chunkshandler tries CAC (Content Addressed Chunk) parsing before SOC (Single Owner Chunk) parsing. Since CAC parsing accepts any data between 8-4104 bytes, valid SOC data is always misclassified as CAC and stored at the wrong content-addressed hash instead of the correct SOC address (Hash(Identifier || Owner)).This breaks client-side SOC construction workflows where pre-stamped SOCs are uploaded via
POST /chunks— the chunk is stored but can never be retrieved at its expected SOC address.The fix reverses the detection order: try SOC parsing first, fall back to CAC.
Open API Spec Version Changes (if applicable)
N/A — no API contract change, only fixes incorrect internal routing of chunk types.
Motivation and Context
Client-side SOC construction (e.g. using
bee-jsmakeContentAddressedChunk().toSingleOwnerChunk()thenuploadChunk()) relies onPOST /chunkscorrectly identifying and storing SOCs at their SOC address. Without this fix, all SOCs uploaded via this endpoint are silently stored as CACs at the wrong address.Related Issue
N/A
Screenshots (if appropriate):
N/A
AI Disclosure