Skip to content

Commit

Permalink
feat: adding app id param
Browse files Browse the repository at this point in the history
  • Loading branch information
praetoriansentry committed Sep 27, 2022
1 parent 0d856c7 commit 3971e7f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions cmd/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ type (
ByteCount *uint64
Seed *int64
IsAvail *bool
AvailAppID *uint32

// Computed
CurrentGas *big.Int
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3971e7f

Please sign in to comment.