From e04b6c9b43a32c8020c84105bbead9b54560badd Mon Sep 17 00:00:00 2001 From: Warren He Date: Wed, 19 Feb 2020 16:58:34 -0800 Subject: [PATCH 1/3] go extra stats: switch to availability ranking for next phase --- go/extra/stats/cmd/stats.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/go/extra/stats/cmd/stats.go b/go/extra/stats/cmd/stats.go index faf74d813e9..564f9a6d6c5 100644 --- a/go/extra/stats/cmd/stats.go +++ b/go/extra/stats/cmd/stats.go @@ -68,10 +68,11 @@ type stats struct { // printEntitySignatures prints topN entities by block signature counts. func (s stats) printEntitySignatures(topN int) { type results struct { - entityID signature.PublicKey - signatures int64 - proposals int64 - nodes int + entityID signature.PublicKey + signatures int64 + proposals int64 + nodes int + availablityScore int64 } res := []results{} @@ -84,18 +85,19 @@ func (s stats) printEntitySignatures(topN int) { for _, proposals := range eStats.nodeProposals { entity.proposals += proposals } + entity.availablityScore = entity.signatures + 50*entity.proposals res = append(res, entity) } sort.Slice(res, func(i, j int) bool { - return res[i].signatures > res[j].signatures + return res[i].availablityScore > res[j].availablityScore }) // Print results. - fmt.Printf("|%-5s|%-64s|%-6s|%10s|%10s|\n", "Rank", "Entity ID", "Nodes", "Signatures", "Proposals") - fmt.Println(strings.Repeat("-", 5+64+6+10+10+6)) + fmt.Printf("|%-5s|%-64s|%-6s|%10s|%10s|%18s|\n", "Rank", "Entity ID", "Nodes", "Signatures", "Proposals", "Availability score") + fmt.Println(strings.Repeat("-", 5+64+6+10+10+18+7)) for idx, r := range res { - fmt.Printf("|%-5d|%-64s|%6d|%10d|%10d|\n", idx+1, r.entityID, r.nodes, r.signatures, r.proposals) + fmt.Printf("|%-5d|%-64s|%6d|%10d|%10d|%18d|\n", idx+1, r.entityID, r.nodes, r.signatures, r.proposals, r.availablityScore) } } From a9e3b04b786dc53291b01dcf43bb73887e941b96 Mon Sep 17 00:00:00 2001 From: Warren He Date: Thu, 20 Feb 2020 11:57:58 -0800 Subject: [PATCH 2/3] go extra stats: move availability score coefficients to constants --- go/extra/stats/cmd/stats.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/extra/stats/cmd/stats.go b/go/extra/stats/cmd/stats.go index 564f9a6d6c5..9ba312bba41 100644 --- a/go/extra/stats/cmd/stats.go +++ b/go/extra/stats/cmd/stats.go @@ -27,6 +27,9 @@ const ( cfgStartBlock = "start-block" cfgEndBlock = "end-block" cfgTopN = "top-n" + + availabilityScorePerSignature = 1 + availabilityScorePerProposal = 50 ) var ( @@ -85,7 +88,7 @@ func (s stats) printEntitySignatures(topN int) { for _, proposals := range eStats.nodeProposals { entity.proposals += proposals } - entity.availablityScore = entity.signatures + 50*entity.proposals + entity.availablityScore = availabilityScorePerSignature*entity.signatures + availabilityScorePerProposal*entity.proposals res = append(res, entity) } From 61ba3cf457c29dff0253d87a5fa679202ff47d64 Mon Sep 17 00:00:00 2001 From: Warren He Date: Thu, 20 Feb 2020 12:59:29 -0800 Subject: [PATCH 3/3] add changelog Co-Authored-By: Jernej Kos --- .changelog/2699.feature.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changelog/2699.feature.md diff --git a/.changelog/2699.feature.md b/.changelog/2699.feature.md new file mode 100644 index 00000000000..e8744aeeb46 --- /dev/null +++ b/.changelog/2699.feature.md @@ -0,0 +1,7 @@ +go/extra/stats: Availability ranking for next Quest phase + +A new availability score will take into account more than the number of +block signatures alone. +This introduces the mechanism to compute a score and print the +rankings based on that. +This also implements a provisional scoring formula.