diff --git a/README.org b/README.org index 67ba512f..a928214f 100644 --- a/README.org +++ b/README.org @@ -204,6 +204,8 @@ Usage: Flags: --chain-id uint The chain id for the transactions that we're going to send (default 1256) -c, --concurrency int Number of multiple requests to perform at a time. Default is one request at a time. (default 1) + --del-address string A pre-deployed delegator contract address + --lt-address string A pre-deployed load test contract address -f, --function --mode f A specific function to be called if running with --mode f (default 1) -h, --help help for loadtest -i, --iterations uint If we're making contract calls, this controls how many times the contract will execute the instruction in a loop (default 100) @@ -405,7 +407,7 @@ we'll startup geth. # v3 -go run cmd/borv3/main.go server --dev \ +go run main.go server --dev \ --dev.period 2 \ --ws --ws.port 8546 \ --http --http.port 8545 \ @@ -459,7 +461,7 @@ INFO [08-14|16:09:31.452] Generated ephemeral JWT secret secret=0xdfa5 I'll usually then use that line to attach #+begin_src shell -./build/bin/geth attach /var/folders/zs/k8swqskj1t79cgnjh6yt0fqm0000gn/T/geth.ip +./build/bin/geth attach /var/folders/zs/k8swqskj1t79cgnjh6yt0fqm0000gn/T/geth.ipc #+end_src After attaching to geth, we can fund the default load testing account diff --git a/cmd/loadtest.go b/cmd/loadtest.go index cc78f189..ba377dbd 100644 --- a/cmd/loadtest.go +++ b/cmd/loadtest.go @@ -226,6 +226,8 @@ type ( Seed *int64 IsAvail *bool AvailAppID *uint32 + LtAddress *string + DelAddress *string // Computed CurrentGas *big.Int @@ -267,6 +269,8 @@ func init() { 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") + ltp.LtAddress = loadtestCmd.PersistentFlags().String("lt-address", "", "A pre-deployed load test contract address") + ltp.DelAddress = loadtestCmd.PersistentFlags().String("del-address", "", "A pre-deployed delegator contract address") inputLoadTestParams = *ltp @@ -507,16 +511,30 @@ func mainLoop(ctx context.Context, c *ethclient.Client) error { } cops := new(bind.CallOpts) - ltAddr, _, _, err := contracts.DeployLoadTester(tops, c) - if err != nil { - log.Error().Err(err).Msg("Failed to create the load testing contract. Do you have the right chain id? Do you have enough funds?") - return err + var ltAddr ethcommon.Address + if *inputLoadTestParams.ToAddress == "" { + ltAddr, _, _, err = contracts.DeployLoadTester(tops, c) + if err != nil { + log.Error().Err(err).Msg("Failed to create the load testing contract. Do you have the right chain id? Do you have enough funds?") + return err + } + } else { + ltAddr = ethcommon.HexToAddress(*inputLoadTestParams.LtAddress) } log.Trace().Interface("contractaddress", ltAddr).Msg("Load test contract address") // bump the nonce since deploying a contract should cause it to increase currentNonce = currentNonce + 1 - delegatorAddr, _, _, err := contracts.DeployDelegator(tops, c) + var delegatorAddr ethcommon.Address + if *inputLoadTestParams.ToAddress == "" { + delegatorAddr, _, _, err = contracts.DeployDelegator(tops, c) + if err != nil { + log.Error().Err(err).Msg("Failed to create the load testing contract. Do you have the right chain id? Do you have enough funds?") + return err + } + } else { + delegatorAddr = ethcommon.HexToAddress(*inputLoadTestParams.DelAddress) + } if err != nil { log.Error().Err(err).Msg("Failed to create the delegator contract. Do you have the right chain id? Do you have enough funds?") return err @@ -540,6 +558,7 @@ func mainLoop(ctx context.Context, c *ethclient.Client) error { waitCounter := 30 for { ltCounter, err := ltContract.GetCallCounter(cops) + if err != nil { log.Trace().Msg("Waiting for contract to deploy") time.Sleep(time.Second) diff --git a/go.mod b/go.mod index 20a06fb3..1d46c0d3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/centrifuge/go-substrate-rpc-client/v4 v4.0.6 - github.com/ethereum/go-ethereum v1.10.20 + github.com/ethereum/go-ethereum v1.10.25 github.com/gizak/termui/v3 v3.1.0 github.com/libp2p/go-libp2p v0.22.0 github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae @@ -103,5 +103,3 @@ require ( ) replace github.com/centrifuge/go-substrate-rpc-client/v4 => github.com/prabal-banerjee/go-substrate-rpc-client/v4 v4.0.0-avail-alpha - - diff --git a/go.sum b/go.sum index 68ffe941..5b50b89a 100644 --- a/go.sum +++ b/go.sum @@ -121,6 +121,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.10.20 h1:75IW830ClSS40yrQC1ZCMZCt5I+zU16oqId2SiQwdQ4= github.com/ethereum/go-ethereum v1.10.20/go.mod h1:LWUN82TCHGpxB3En5HVmLLzPD7YSrEUFmFfN1nKkVN0= +github.com/ethereum/go-ethereum v1.10.25 h1:5dFrKJDnYf8L6/5o42abCE6a9yJm9cs4EJVRyYMr55s= +github.com/ethereum/go-ethereum v1.10.25/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=