From 3971e7f4d9009e9400693d086d8b30eb23b8d4c2 Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Tue, 27 Sep 2022 08:36:42 -0400 Subject: [PATCH] feat: adding app id param --- README.org | 8 ++++++++ cmd/loadtest.go | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index 5f016b79..e6e4763b 100644 --- a/README.org +++ b/README.org @@ -275,6 +275,14 @@ transaction. polycli loadtest --verbosity 700 --chain-id 1256 --concurrency 1 --requests 50 --rate-limit 0.5 --mode f --function 164 --iterations 25078 http://private.validator-001.devnet02.pos-v3.polygon.private:8545 #+end_src +** Avail / Substrate + +The loadtest tool works with Avail, but not with the same level of functionality. There's no EVM so the functional calls will not work. This is a basic example which would transfer value in a loop 10 times + +#+begin_src shell +polycli loadtest --app-id 0 --to-random=true --data-avail --verbosity 700 --chain-id 42 --concurrency 1 --requests 10 --rate-limit 1 --mode t 'http://devnet01.dataavailability.link:8545' +#+end_src + * Monitor diff --git a/cmd/loadtest.go b/cmd/loadtest.go index 3be60813..87b26b4c 100644 --- a/cmd/loadtest.go +++ b/cmd/loadtest.go @@ -225,6 +225,7 @@ type ( ByteCount *uint64 Seed *int64 IsAvail *bool + AvailAppID *uint32 // Computed CurrentGas *big.Int @@ -265,6 +266,8 @@ func init() { ltp.ByteCount = loadtestCmd.PersistentFlags().Uint64P("byte-count", "b", 1024, "If we're in store mode, this controls how many bytes we'll try to store in our contract") ltp.Seed = loadtestCmd.PersistentFlags().Int64("seed", 123456, "A seed for generating random values and addresses") ltp.IsAvail = loadtestCmd.PersistentFlags().Bool("data-avail", false, "Is this a test of avail rather than an EVM / Geth Chain") + ltp.AvailAppID = loadtestCmd.PersistentFlags().Uint32("app-id", 0, "The AppID used for avail") + inputLoadTestParams = *ltp // TODO batch size @@ -993,7 +996,7 @@ func initAvailTestParams(ctx context.Context, c *gsrpc.SubstrateAPI) error { *inputLoadTestParams.PrivateKey = codeQualitySeed } - kp, err := gssignature.KeyringPairFromSecret(*inputLoadTestParams.PrivateKey, 42 /*hopefully?*/) + kp, err := gssignature.KeyringPairFromSecret(*inputLoadTestParams.PrivateKey, uint8(*inputLoadTestParams.ChainID)) if err != nil { log.Error().Err(err).Msg("could not create key pair") return err @@ -1054,7 +1057,7 @@ func loadtestSubstrateTransfer(ctx context.Context, c *gsrpc.SubstrateAPI, nonce SpecVersion: rv.SpecVersion, Tip: gstypes.NewUCompactFromUInt(100), TransactionVersion: rv.TransactionVersion, - AppID: gstypes.U32(0), + AppID: gstypes.U32(*ltp.AvailAppID), } // Sign the transaction using Alice's default account err = ext.Sign(kp, o)