jamescowens / Gridcoin-Research

Gridcoin-Research
MIT License
2 stars 0 forks source link

Remove ZERO from superblocks. #17

Closed denravonska closed 5 years ago

denravonska commented 5 years ago

Each superblock contains a ZERO field which holds a number of "0,15;" entries. This is a legacy compatibility issue which sole purpose was so the number of CPIDs sent to the VB scraper matched the number of CPIDs returned in the contract.

In the new scraper we should see if we can either remove the ZERO field completely or just replace it with <ZERO></ZERO>. The former would be better while the latter might be required for compatibility.

jamescowens commented 5 years ago

The "," is in the packed version, not unpacked. Unpacked, 15,0; entries are placed at into the magnitudes list...

Hmm... GenerateSBCoreDataFromScraperStats(ScraperStats& mScraperStats) is not doing any of this. It is currently writing the full CPID as CPID,0; My guess is that actually works, but wastes a lot of space.

The problem with this whole approach is that you LOSE information. Since the CPID is wiped out in this approach for all zero magnitude entries to save space, you have to INFER the zero magnitude CPIDs by comparing to the active Beacon List and finding the CPIDs that are missing. This is certainly fine for research payments, but complicates SB based stats historical summarization, if we ever want to do that, because you have to construct the BeaconList map for every SB to figure out the actual zero CPIDs.

jamescowens commented 5 years ago

For right now to maintain absolute compatibility, I will change GenerateSBCoreDataFromScraperStats to put all the zero magnitude entries at the end of the mag list as 15,0; entries.

We should keep this issue active to remember to change GenerateSBCoreDataFromScraperStats and the packer to use in both the unpacked and packed versions.

tomasbrod commented 5 years ago

Possibly bundle this with https://github.com/gridcoin-community/Gridcoin-Research/issues/1384 serialization rewrite.

jamescowens commented 5 years ago

Agreed.

jamescowens commented 5 years ago

This is addressed in https://github.com/gridcoin-community/Gridcoin-Research/pull/1488.