mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-04 01:54:28 +00:00
3102a04d7f
* 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>
62 lines
1.6 KiB
Go
62 lines
1.6 KiB
Go
package erigon
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/common/dbg"
|
|
"github.com/ledgerwatch/erigon/cmd/devnettest/rpcdaemon"
|
|
"github.com/ledgerwatch/erigon/params"
|
|
erigonapp "github.com/ledgerwatch/erigon/turbo/app"
|
|
erigoncli "github.com/ledgerwatch/erigon/turbo/cli"
|
|
"github.com/ledgerwatch/erigon/turbo/node"
|
|
"github.com/ledgerwatch/log/v3"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
const DevPeriod = 5
|
|
|
|
func RunNode() {
|
|
defer func() {
|
|
panicResult := recover()
|
|
if panicResult == nil {
|
|
return
|
|
}
|
|
|
|
log.Error("catch panic", "err", panicResult, "stack", dbg.Stack())
|
|
os.Exit(1)
|
|
}()
|
|
|
|
app := erigonapp.MakeApp(runDevnet, erigoncli.DefaultFlags) // change to erigoncli.DefaultFlags later on
|
|
customArgs := []string{"./build/bin/devnettest", "--datadir=./dev", "--chain=dev", "--mine", fmt.Sprintf("--dev.period=%d", DevPeriod), "--verbosity=0"}
|
|
if err := app.Run(customArgs); err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func runDevnet(cliCtx *cli.Context) {
|
|
logger := log.New()
|
|
// initializing the node and providing the current git commit there
|
|
logger.Info("Build info", "git_branch", params.GitBranch, "git_tag", params.GitTag, "git_commit", params.GitCommit)
|
|
|
|
nodeCfg := node.NewNodConfigUrfave(cliCtx)
|
|
ethCfg := node.NewEthConfigUrfave(cliCtx, nodeCfg)
|
|
|
|
ethNode, err := node.New(nodeCfg, ethCfg, logger)
|
|
if err != nil {
|
|
log.Error("Devnet startup", "err", err)
|
|
return
|
|
}
|
|
err = ethNode.Serve()
|
|
if err != nil {
|
|
log.Error("error while serving a Devnet node", "err", err)
|
|
}
|
|
}
|
|
|
|
func StartProcess() {
|
|
fmt.Println("Starting erigon node and rpc daemon...")
|
|
go RunNode()
|
|
go rpcdaemon.RunDaemon()
|
|
}
|