forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 30
/
benchmark.go
39 lines (36 loc) · 1.27 KB
/
benchmark.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//go:build benchmark
package simapp
import (
runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
benchmarkmodulev1 "cosmossdk.io/api/cosmos/benchmark/module/v1"
"cosmossdk.io/depinject/appconfig"
benchmark "cosmossdk.io/tools/benchmark/module"
"fmt"
)
func init() {
// WARNING!
// Enabling this module will produce 3M keys in the genesis state for the benchmark module.
// Will also enable processing of benchmark transactions which can easily overwhelm the system.
appConfig.Modules = append(appConfig.Modules, &appv1alpha1.ModuleConfig{
Name: benchmark.ModuleName,
Config: appconfig.WrapAny(&benchmarkmodulev1.Module{
GenesisParams: &benchmarkmodulev1.GeneratorParams{
Seed: 34,
BucketCount: 3,
GenesisCount: 3_000_000,
KeyMean: 64,
KeyStdDev: 12,
ValueMean: 1024,
ValueStdDev: 256,
},
}),
})
runtimeConfig := &runtimev1alpha1.Module{}
err := appConfig.Modules[0].Config.UnmarshalTo(runtimeConfig)
if err != nil {
panic(fmt.Errorf("benchmark init: failed to unmarshal runtime module config: %w", err))
}
runtimeConfig.InitGenesis = append(runtimeConfig.InitGenesis, benchmark.ModuleName)
appConfig.Modules[0].Config = appconfig.WrapAny(runtimeConfig)
}