Address @Magik6k CR
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
36d5880a30
commit
88352c74fc
@ -558,8 +558,6 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round abi.ChainEpoch,
|
||||
return nil, xerrors.Errorf("failed to compute VRF: %w", err)
|
||||
}
|
||||
|
||||
// TODO: wire in real power
|
||||
// TODO: is above TODO still applicable?
|
||||
ep := &types.ElectionProof{VRFProof: vrfout}
|
||||
j := ep.ComputeWinCount(mbi.MinerPower, mbi.NetworkPower)
|
||||
ep.WinCount = j
|
||||
|
@ -21,11 +21,11 @@ func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigIn
|
||||
if ts == nil {
|
||||
return types.NewInt(0), nil
|
||||
}
|
||||
// >>> w[r] <<< + wFunction(totalPowerAtTipset(ts)) * 2^8 + (wFunction(totalPowerAtTipset(ts)) * sum(ts.blocks.ElectionProof.WinCount) * wRatio_num * 2^8) / (e * wRatio_den)
|
||||
// >>> w[r] <<< + wFunction(totalPowerAtTipset(ts)) * 2^8 + (wFunction(totalPowerAtTipset(ts)) * sum(ts.blocks[].ElectionProof.WinCount) * wRatio_num * 2^8) / (e * wRatio_den)
|
||||
|
||||
var out = new(big.Int).Set(ts.Blocks()[0].ParentWeight.Int)
|
||||
|
||||
// >>> wFunction(totalPowerAtTipset(ts)) * 2^8 <<< + (wFunction(totalPowerAtTipset(ts)) * sum(ts.blocks.ElectionProof.WinCount) * wRatio_num * 2^8) / (e * wRatio_den)
|
||||
// >>> wFunction(totalPowerAtTipset(ts)) * 2^8 <<< + (wFunction(totalPowerAtTipset(ts)) * sum(ts.blocks[].ElectionProof.WinCount) * wRatio_num * 2^8) / (e * wRatio_den)
|
||||
|
||||
tpow := big2.Zero()
|
||||
{
|
||||
@ -57,7 +57,7 @@ func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigIn
|
||||
|
||||
out.Add(out, big.NewInt(log2P<<8))
|
||||
|
||||
// (wFunction(totalPowerAtTipset(ts)) * sum(ts.blocks.ElectionProof.WinCount) * wRatio_num * 2^8) / (e * wRatio_den)
|
||||
// (wFunction(totalPowerAtTipset(ts)) * sum(ts.blocks[].ElectionProof.WinCount) * wRatio_num * 2^8) / (e * wRatio_den)
|
||||
|
||||
totalJ := uint64(0)
|
||||
for _, b := range ts.Blocks() {
|
||||
|
@ -82,7 +82,7 @@ func TestSizeStrUnitsSymmetry(t *testing.T) {
|
||||
s := rand.NewSource(time.Now().UnixNano())
|
||||
r := rand.New(s)
|
||||
|
||||
for i := 0; i < 1000; i++ {
|
||||
for i := 0; i < 10000; i++ {
|
||||
n := r.Uint64()
|
||||
l := strings.ReplaceAll(units.BytesSize(float64(n)), " ", "")
|
||||
r := strings.ReplaceAll(SizeStr(NewInt(n)), " ", "")
|
||||
|
Loading…
Reference in New Issue
Block a user