spacemeshos / explorer-backend

Spacemesh explorer backend designed to provide data for explorer-frontends
GNU General Public License v3.0
6 stars 2 forks source link

Wrong `Decentral` calculation for epoch #19

Closed abergasov closed 8 months ago

abergasov commented 2 years ago

in this place calculates Decentral value.

epoch.Stats.Current.Decentral = int64(100.0 * (0.5*(a*a)/1e8 + 0.5*(1.0-utils.Gini(smeshers))))

Problem that smeshers is map[string]int64 always contain zeros as values of map. It happens because of wrong mapping in mongoDB:

cSize always 0, because activations does not keep info about smesher czise. it contains numunits, which should be multiplied to postUnitsSize = BitsPerLabel * LabelsPerUnit / 8

should be used or smesher.CommitmentSize or correct multiplication for numunits