Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pusher skipping syncing for chunks with expired stamps #2392

Merged
merged 6 commits into from
Aug 3, 2021

Conversation

istae
Copy link
Member

@istae istae commented Aug 2, 2021

This change is Reviewable

@istae istae changed the title feat: pusher stamp validation feat: pusher stamp validation warning log Aug 2, 2021
@istae istae changed the title feat: pusher stamp validation warning log feat: pusher skipping syncing on invalid stamps Aug 2, 2021
@istae istae changed the title feat: pusher skipping syncing on invalid stamps feat: pusher skipping syncing for chunks with expired stamps Aug 2, 2021
@istae istae requested review from aloknerurkar and acud August 2, 2021 14:45
@istae istae added the ready for review The PR is ready to be reviewed label Aug 2, 2021
Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 3 files at r1.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @acud, @aloknerurkar, and @istae)


pkg/pusher/pusher_test.go, line 36 at r1 (raw file):

var noOfRetries = 20
var block = common.HexToHash("0x1").Bytes()
var defaultValidStamp = func(ch swarm.Chunk, stamp []byte) (swarm.Chunk, error) {

call it mock no?


pkg/pusher/pusher_test.go, line 465 at r1 (raw file):

	}

	// Check is the chunk is set as synced in the DB.

check IF typo

_, err = s.validStamp(ch, stampBytes)
if err != nil {
s.logger.Warningf("pusher: stamp with batch ID %x is no longer valid, skipping syncing for chunk %s: %v", ch.Stamp().BatchID(), ch.Address().String(), err)
if err = s.storer.Set(ctx, storage.ModeSetSync, ch.Address()); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is what was agreed on, however, I do not like this approach of marking the chunk as synced. For a user of bee, this will result in incorrect information on the /tags API. He would assume the chunk is synced. The only way to know for sure right now is to keep monitoring logs for this warning msg.

The problem is while designing dapps, they might rely on the /tags endpoint to possibly show some status to their users and this will break their applications. Maybe we should consider adding a new state here which can be returned on the tags endpoint, this will allow developers to take some corrective action.

@acud @zelig

Copy link
Member

Choose a reason for hiding this comment

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

@aloknerurkar it is a good point but I'm not sure how a new state would resolve things. I personally don't think that our storage abstraction can deal with this correctly right now even with the addition of a new mode, since we would need more ways to communicate the information to the users.
TBH from my side the best solution would be to revive the concept of uploading directly to the network, this would allow easier error propagation to the user with regards to network errors or postage stamp validity.

Copy link
Contributor

Choose a reason for hiding this comment

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

For now, I think we should at least add some comments here to mention this hack and come back to it later.

@istae istae merged commit 657c723 into master Aug 3, 2021
@istae istae deleted the pusher-postage-validation branch August 3, 2021 15:27
@acud acud added this to the v1.2.0 milestone Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants