ethersphere / bee

Bee is a Swarm client implemented in Go. It’s the basic building block for the Swarm network: a private; decentralized; and self-sustaining network for permissionless publishing and access to your (application) data.
https://www.ethswarm.org
BSD 3-Clause "New" or "Revised" License
1.45k stars 338 forks source link

SOC pullsync with different payloads #4739

Open nugaon opened 2 months ago

nugaon commented 2 months ago

Context

most recent master branch fdp-play 5 nodes

Summary

When multiple payloads being uploaded under one Single Owner Chunk address, the pullsync will not transfer the chunk with newer payload to the downstream. Nevertheless, the SOC gets marked for syncing each time when a node gets a new payload.

This can lead to Shelling point mismatches.

Expected behavior

All valid versions of a Single Owner Chunk are synchronized in the neighborhood.

Actual behavior

It always synchronizes the first payload that reached upstream even when a new (and different) payload should be transferred.

Steps to reproduce

My tests based on the #4727 gsoc-subscribe branch and I tried to upload different payloads from one node meanwhile another node was listening on the /gsoc/subscribe/{address} websocket endpoint.

In order to carry out this manual testing easily, I used the GSOC JS library.

receiver node:

gsoc = require('./dist/index.js')
is = new gsoc.InformationSignal('http://localhost:11633')
cancelSub = is.subscribe({onMessage: msg => console.log('gsoc-pull-sync', msg), onError: console.log})

sender node:

gsoc = require('./dist/index.js')
is = new gsoc.InformationSignal('http://localhost:1633', {postageBatchId: '69650e45a19fe3a625b73ef69cf586f6209ff3588e012a05c8e50072a7e39263'})
is.write('Hello there!')
is.write('This is a really important and uplifting message. I hope you will receive it!')

Possible solution

Reserve chunk-get should be able to retrieve chunk satisfying optional postageBatchHash parameter.