From 80e9cb00b849e19636a8f349eae9c6df3a1174cb Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 8 Oct 2021 23:21:26 +0200 Subject: [PATCH] Setup unused accounts --- benchmarks/app_test.go | 25 ++++++++++++++++++++----- benchmarks/bench_test.go | 12 ++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/benchmarks/app_test.go b/benchmarks/app_test.go index 3c0c2b50..77f53f67 100644 --- a/benchmarks/app_test.go +++ b/benchmarks/app_test.go @@ -88,14 +88,29 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo { addr := sdk.AccAddress(minter.PubKey().Address()) denom := "uatom" - // genesis setup - genAccs := []authtypes.GenesisAccount{&authtypes.BaseAccount{ + // genesis setup (with a bunch of random accounts) + genAccs := make([]authtypes.GenesisAccount, numAccounts+1) + bals := make([]banktypes.Balance, numAccounts+1) + genAccs[0] = &authtypes.BaseAccount{ Address: addr.String(), - }} - bals := []banktypes.Balance{{ + } + bals[0] = banktypes.Balance{ Address: addr.String(), Coins: sdk.NewCoins(sdk.NewInt64Coin(denom, 100000000000)), - }} + } + for i := 0; i <= numAccounts; i++ { + acct := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String() + if i == 0 { + acct = addr.String() + } + genAccs[i] = &authtypes.BaseAccount{ + Address: acct, + } + bals[i] = banktypes.Balance{ + Address: acct, + Coins: sdk.NewCoins(sdk.NewInt64Coin(denom, 100000000000)), + } + } wasmApp := SetupWithGenesisAccounts(db, genAccs, bals...) // add wasm contract diff --git a/benchmarks/bench_test.go b/benchmarks/bench_test.go index a323fc91..af00ebf8 100644 --- a/benchmarks/bench_test.go +++ b/benchmarks/bench_test.go @@ -86,6 +86,18 @@ func BenchmarkTxSending(b *testing.B) { blockSize: 20, txBuilder: cw20TransferTxs, }, + "basic send - leveldb - 10k accounts": { + db: buildLevelDB, + blockSize: 20, + txBuilder: bankSendTxs, + numAccounts: 10000, + }, + "cw20 transfer - leveldb - 10k accounts": { + db: buildLevelDB, + blockSize: 20, + txBuilder: cw20TransferTxs, + numAccounts: 10000, + }, } for name, tc := range cases {