erigon-pulse/cmd/state/commands/stateless.go
ledgerwatch 4f5c858f00
Collect data about Keccak256 invocations for evaluation of STARK proof sizes and performance (#315)
* Gathering start data on witnesses

* Fix number parsing

* Proper filename, actually outputting

* Correct block

* Visualise states

* Code and value fix

* Visualise code hash and storage hash

* Current block number

* Print bucket

* Fix lint

* Fix lint

* Fix lint

* Fix lint

* Fix typo

* Fixes after merging master

* Fix lint

Co-authored-by: b00ris <b00ris@mail.ru>
2020-01-15 17:33:36 +00:00

71 lines
2.3 KiB
Go

package commands
import (
"github.com/ledgerwatch/turbo-geth/cmd/state/stateless"
"github.com/ledgerwatch/turbo-geth/ethdb"
"github.com/spf13/cobra"
)
var (
statefile string
triesize uint32
preroot bool
snapshotInterval uint64
snapshotFrom uint64
witnessInterval uint64
noverify bool
bintries bool
starkBlocksFile string
starkStatsBase string
)
func init() {
withChaindata(statelessCmd)
withStatsfile(statelessCmd)
withBlock(statelessCmd)
statelessCmd.Flags().StringVar(&statefile, "statefile", "state", "path to the file where the state will be periodically written during the analysis")
statelessCmd.Flags().Uint32Var(&triesize, "triesize", 1024*1024, "maximum number of nodes in the state trie")
statelessCmd.Flags().BoolVar(&preroot, "preroot", false, "Attempt to compute hash of the trie without modifying it")
statelessCmd.Flags().Uint64Var(&snapshotInterval, "snapshotInterval", 0, "how often to take snapshots (0 - never, 1 - every block, 1000 - every 1000th block, etc)")
statelessCmd.Flags().Uint64Var(&snapshotFrom, "snapshotFrom", 0, "from which block to start snapshots")
statelessCmd.Flags().Uint64Var(&witnessInterval, "witnessInterval", 1, "after which block to extract witness (put a large number like 10000000 to disable)")
statelessCmd.Flags().BoolVar(&noverify, "noVerify", false, "skip snapshot verification on loading")
statelessCmd.Flags().BoolVar(&bintries, "bintries", false, "use binary tries instead of hexary to generate/load block witnesses")
statelessCmd.Flags().StringVar(&starkBlocksFile, "starkBlocksFile", "", "file with the list of blocks for which to produce stark data")
statelessCmd.Flags().StringVar(&starkStatsBase, "starkStatsBase", "stark_stats", "template for names of the files to write stark stats in")
rootCmd.AddCommand(statelessCmd)
}
var statelessCmd = &cobra.Command{
Use: "stateless",
Short: "Stateless Ethereum prototype",
RunE: func(cmd *cobra.Command, args []string) error {
createDb := func(path string) (ethdb.Database, error) {
return ethdb.NewBoltDatabase(path)
}
stateless.Stateless(
block,
chaindata,
statefile,
triesize,
preroot,
snapshotInterval,
snapshotFrom,
witnessInterval,
statsfile,
!noverify,
bintries,
createDb,
starkBlocksFile,
starkStatsBase,
)
return nil
},
}