0chain / blobber

A storage provider (blobber) interface to the blockchain and consumers of storage.
Other
19 stars 23 forks source link

Blobber filter out expired challenges. #93

Closed Sriep closed 3 years ago

Sriep commented 3 years ago

The blobber should not waste time trying to resolve expired challenges. Filter out the expired challenges from the challenges sent by the 0chain /openchallenges call.

Sriep commented 3 years ago

Update FindChallenge in worker.go. The filtering can be added to the code following the API call.

Write a unit test to confirm the filtering is working ok.

andrenerd commented 3 years ago

@Sriep How to determine if a challenge is expired or not? Looks like there is no timestamp or status field to be based on.

Sriep commented 3 years ago

The information is sent to the blobber, the blobber does not decode it.

ochian handler OpenChallengehandler returns blobberChalaengeObj which is a BlobberChallenge object which significantly has an array of StorageChallenge objects with a Created common.Timestamp field.

This array of StorageChallenge objects in 0chain is decoded into an array of ChallengeEntity objects. Adding a Created field to the ChallengeEntity object should give you the information you need.

andrenerd commented 3 years ago

@Sriep Created a pull request, but not sure the update fully meets the requirements: https://github.com/0chain/blobber/pull/125

There are a couple of questions:

Sriep commented 3 years ago

The expiration is in 0cahin_blobber.yaml.challenge_completion_time. If Created plus challenge_completion_time has passed then the challenge can be filtered out.

andrenerd commented 3 years ago

@Sriep updated. please, review the pr: https://github.com/0chain/blobber/pull/125