mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 00:27:38 +00:00
Remove Statistical Package (#3129)
This commit is contained in:
parent
0beb919fc0
commit
b1fcaa03ae
@ -977,12 +977,6 @@ go_repository(
|
||||
importpath = "gopkg.in/natefinch/npipe.v2",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
name = "org_gonum_v1_gonum",
|
||||
commit = "70a1e933af10e87000d2ccabdd509b87d8626153",
|
||||
importpath = "gonum.org/v1/gonum",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
name = "org_golang_x_exp",
|
||||
commit = "438050ddec5e7f808979ed57d041cebbc8e2d8a9",
|
||||
|
@ -19,8 +19,6 @@ go_library(
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_urfave_cli//:go_default_library",
|
||||
"@com_github_x_cray_logrus_prefixed_formatter//:go_default_library",
|
||||
"@org_golang_x_exp//rand:go_default_library",
|
||||
"@org_gonum_v1_gonum//stat/distuv:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"math/big"
|
||||
"os"
|
||||
"time"
|
||||
@ -24,8 +23,6 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
prefixed "github.com/x-cray/logrus-prefixed-formatter"
|
||||
rand2 "golang.org/x/exp/rand"
|
||||
"gonum.org/v1/gonum/stat/distuv"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -43,8 +40,6 @@ func main() {
|
||||
var numberOfDeposits int64
|
||||
var depositAmount int64
|
||||
var depositDelay int64
|
||||
var variableTx bool
|
||||
var txDeviation int64
|
||||
var randomKey bool
|
||||
|
||||
customFormatter := new(prefixed.TextFormatter)
|
||||
@ -112,17 +107,6 @@ func main() {
|
||||
Usage: "The time delay between sending the deposits to the contract(in seconds)",
|
||||
Destination: &depositDelay,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "variableTx",
|
||||
Usage: "This enables variable transaction latencies to simulate real-world transactions",
|
||||
Destination: &variableTx,
|
||||
},
|
||||
cli.Int64Flag{
|
||||
Name: "txDeviation",
|
||||
Usage: "The standard deviation between transaction times",
|
||||
Value: 2,
|
||||
Destination: &txDeviation,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "random-key",
|
||||
Usage: "Use a randomly generated keystore key",
|
||||
@ -183,8 +167,6 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
statDist := buildStatisticalDist(depositDelay, numberOfDeposits, txDeviation)
|
||||
|
||||
validatorKeys := make(map[string]*prysmKeyStore.Key)
|
||||
if randomKey {
|
||||
validatorKey, err := prysmKeyStore.NewKey(rand.Reader)
|
||||
@ -221,12 +203,6 @@ func main() {
|
||||
"Transaction Hash": fmt.Sprintf("%#x", tx.Hash()),
|
||||
}).Infof("Deposit %d sent to contract address %v for validator with a public key %#x", i, depositContractAddr, validatorKey.PublicKey.Marshal())
|
||||
|
||||
// If flag is enabled make transaction times variable
|
||||
if variableTx {
|
||||
time.Sleep(time.Duration(math.Abs(statDist.Rand())) * time.Second)
|
||||
continue
|
||||
}
|
||||
|
||||
time.Sleep(time.Duration(depositDelay) * time.Second)
|
||||
}
|
||||
}
|
||||
@ -238,18 +214,6 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func buildStatisticalDist(depositDelay int64, numberOfDeposits int64, txDeviation int64) *distuv.StudentsT {
|
||||
src := rand2.NewSource(uint64(time.Now().Unix()))
|
||||
dist := &distuv.StudentsT{
|
||||
Mu: float64(depositDelay),
|
||||
Sigma: float64(txDeviation),
|
||||
Nu: float64(numberOfDeposits - 1),
|
||||
Src: src,
|
||||
}
|
||||
|
||||
return dist
|
||||
}
|
||||
|
||||
func loadTextFromFile(filepath string) string {
|
||||
// #nosec - Inclusion of file via variable is OK for this tool.
|
||||
file, err := os.Open(filepath)
|
||||
|
Loading…
Reference in New Issue
Block a user