Use Zipf distribution for messages
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
15a81707b4
commit
f27a122787
@ -2,7 +2,6 @@ package messagepool
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
@ -916,13 +915,14 @@ func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand) (float64, flo
|
|||||||
nMessages := 10 * int(build.BlockGasLimit/gasLimit)
|
nMessages := 10 * int(build.BlockGasLimit/gasLimit)
|
||||||
t.Log("nMessages", nMessages)
|
t.Log("nMessages", nMessages)
|
||||||
nonces := make([]uint64, nActors)
|
nonces := make([]uint64, nActors)
|
||||||
|
zipf := rand.NewZipf(rng, 1.001, 1, 40000)
|
||||||
for i := 0; i < nMessages; i++ {
|
for i := 0; i < nMessages; i++ {
|
||||||
from := rng.Intn(nActors)
|
from := rng.Intn(nActors)
|
||||||
to := rng.Intn(nActors)
|
to := rng.Intn(nActors)
|
||||||
premium := 20000*math.Exp(-3.*rand.Float64()) + 5000
|
|
||||||
nonce := nonces[from]
|
nonce := nonces[from]
|
||||||
nonces[from]++
|
nonces[from]++
|
||||||
m := makeTestMessage(wallets[from], actors[from], actors[to], uint64(nonce), gasLimit, uint64(premium))
|
premium := zipf.Uint64() + 10000
|
||||||
|
m := makeTestMessage(wallets[from], actors[from], actors[to], uint64(nonce), gasLimit, premium)
|
||||||
mustAdd(t, mp, m)
|
mustAdd(t, mp, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -936,7 +936,7 @@ func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand) (float64, flo
|
|||||||
|
|
||||||
capacityBoost := 0.0
|
capacityBoost := 0.0
|
||||||
rewardBoost := 0.0
|
rewardBoost := 0.0
|
||||||
const runs = 1
|
const runs = 50
|
||||||
for i := 0; i < runs; i++ {
|
for i := 0; i < runs; i++ {
|
||||||
// 2. optimal selection
|
// 2. optimal selection
|
||||||
minersRand := rng.Float64()
|
minersRand := rng.Float64()
|
||||||
|
Loading…
Reference in New Issue
Block a user