erigon-pulse/cmd/devnettest/commands/all.go
leonardchinonso 3102a04d7f
Draft PR for the devnet automation (#4057)
* Draft PR for the devnet automation

* Committing to save for later edit

* Finished creating shells, to test

* Changes:
* Added a shell for picking eth commands
* Implemented erigon node running with the --http flag to save processes
* Shell commands for get-balance and send-tx implemented
TODO:
* Make UX more friendly by adding start, stop and exit commands
* Add progress bar to show wait in progress
* Add flag or input to enable mining option for erigon node
* Implemented stress tests for other eth methods

* Experimenting

* little clean up

* lint

* Transitioned to static runs and tests from shell

* Finished stress test methods

* Rendering fixes

* save

* Cleanup

* Fixed lint

* Still fixing lint

* Removed args append ineffect

* Removed println in genesis init.go

* Removed println in genesis init.go

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Enrique Avila <eavilaasapche@gmail.com>
2022-05-26 13:08:25 +01:00

58 lines
1.5 KiB
Go

package commands
import (
"fmt"
"github.com/ledgerwatch/erigon/cmd/devnettest/erigon"
"github.com/ledgerwatch/erigon/cmd/devnettest/services"
"github.com/spf13/cobra"
"time"
)
func init() {
rootCmd.AddCommand(allCmd)
}
var allCmd = &cobra.Command{
Use: "all",
Short: "Runs all the simulation tests for erigon devnet",
Run: func(cmd *cobra.Command, args []string) {
if clearDev {
defer services.ClearDevDB()
}
// Test connection to JSON RPC
fmt.Println("Mocking get requests to JSON RPC...")
callMockGetRequest()
fmt.Println()
// First get balance of the receiver's account
callGetBalance(recvAddr, blockNum, 0)
fmt.Println()
// Send a token from the dev address to the receiver's address
callSendRegularTxAndSearchBlock(sendValue, devAddress, recvAddr, true)
fmt.Println()
// Check the balance to make sure the receiver received such token
callGetBalance(recvAddr, blockNum, sendValue)
fmt.Println()
// Get the nonce of the devAddress, it should be 1
callGetTransactionCount(devAddress, blockNum, 1)
fmt.Println()
// Create a contract transaction signed by the dev address and emit a log for it
go callContractTx()
time.Sleep(erigon.DevPeriod * 2 * time.Second)
fmt.Println()
// Get the nonce of the devAddress, check that it is 3
callGetTransactionCount(devAddress, blockNum, 3)
fmt.Println()
// Confirm that the txpool is empty (meaning all txs have been mined)
fmt.Println("Confirming the tx pool is empty...")
showTxPoolContent()
},
}