From bc5eb8e4c8fdfba95b7d68c5d97a84c46a5199a4 Mon Sep 17 00:00:00 2001 From: matejmlejnek <97440610+matejmlejnek@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:03:15 +0100 Subject: [PATCH] Fix manual generation (#796) * Fix manual generation * Add option to skip state-hash scrapping --- cmd/util-db/db/gen_deleted_accounts.go | 8 +- cmd/util-db/db/generate.go | 94 +++++++++++-- utils/config.go | 179 +++++++++++++------------ utils/default_config.go | 171 +++++++++++------------ utils/flags.go | 5 + 5 files changed, 266 insertions(+), 191 deletions(-) diff --git a/cmd/util-db/db/gen_deleted_accounts.go b/cmd/util-db/db/gen_deleted_accounts.go index 89e0a3722..3227536ac 100644 --- a/cmd/util-db/db/gen_deleted_accounts.go +++ b/cmd/util-db/db/gen_deleted_accounts.go @@ -134,16 +134,16 @@ func genDeletedAccountsAction(ctx *cli.Context) error { } defer ddb.Close() - return GenDeletedAccountsAction(cfg, ddb, cfg.First) + return GenDeletedAccountsAction(cfg, ddb, cfg.First, cfg.Last) } // GenDeletedAccountsAction replays transactions and record self-destructed accounts and resurrected accounts. -func GenDeletedAccountsAction(cfg *utils.Config, ddb *substate.DestroyedAccountDB, firstBlock uint64) error { +func GenDeletedAccountsAction(cfg *utils.Config, ddb *substate.DestroyedAccountDB, firstBlock uint64, lastBlock uint64) error { var err error log := logger.NewLogger(cfg.LogLevel, "Generate Deleted Accounts") - log.Infof("chain-id: %v", cfg.ChainID) + log.Noticef("Generate deleted accounts from block %v to block %v", firstBlock, lastBlock) start := time.Now() sec := time.Since(start).Seconds() @@ -157,7 +157,7 @@ func GenDeletedAccountsAction(cfg *utils.Config, ddb *substate.DestroyedAccountD for iter.Next() { tx := iter.Value() - if tx.Block > cfg.Last { + if tx.Block > lastBlock { break } diff --git a/cmd/util-db/db/generate.go b/cmd/util-db/db/generate.go index b377b42a6..e4c4258fe 100644 --- a/cmd/util-db/db/generate.go +++ b/cmd/util-db/db/generate.go @@ -41,20 +41,20 @@ var GenerateCommand = cli.Command{ Flags: []cli.Flag{ &utils.AidaDbFlag, &utils.ChainIDFlag, - &utils.GenesisFlag, + &utils.OperaDbFlag, &utils.WorldStateFlag, &utils.OperaBinaryFlag, &utils.OutputFlag, - &utils.TargetEpochFlag, &utils.UpdateBufferSizeFlag, + &utils.SkipStateHashScrappingFlag, &substate.WorkersFlag, &logger.LogLevelFlag, }, Description: ` -The db generate command requires events as an argument: - - - are fed into the opera database (either existing or genesis needs to be specified), processing them generates updated aida-db.`, +The db generate command requires 4 arguments: + +This command is designed for manual generation of deletion, updateset and patch just from substates in aidadb. +`, } type generator struct { @@ -82,6 +82,11 @@ func generate(ctx *cli.Context) error { return err } + err = g.prepareManualGenerate(ctx, cfg) + if err != nil { + return fmt.Errorf("prepareManualGenerate: %v; make sure you have correct substate range already recorded in aidadb", err) + } + if err = g.Generate(); err != nil { return err } @@ -91,6 +96,64 @@ func generate(ctx *cli.Context) error { return printMetadata(g.cfg.AidaDb) } +// prepareManualGenerate prepares generator for manual generation +func (g *generator) prepareManualGenerate(ctx *cli.Context, cfg *utils.Config) (err error) { + if ctx.Args().Len() != 4 { + return fmt.Errorf("generate command requires exactly 4 arguments - first block, last block, first epoch, last epoch") + } + + g.opera.firstBlock, g.opera.lastBlock, err = utils.SetBlockRange(ctx.Args().Get(0), ctx.Args().Get(1), cfg.ChainID) + if err != nil { + return err + } + + g.opera.firstEpoch, g.opera.lastEpoch, err = utils.SetBlockRange(ctx.Args().Get(2), ctx.Args().Get(3), cfg.ChainID) + if err != nil { + return err + } + + if g.opera.firstBlock > g.opera.lastBlock { + return fmt.Errorf("generation range first block %v cannot be greater than available last block %v", g.opera.firstBlock, g.opera.lastBlock) + } + + if g.opera.firstEpoch > g.opera.lastEpoch { + return fmt.Errorf("generation range first epoch %v cannot be greater than available last epoch %v", g.opera.firstEpoch, g.opera.lastEpoch) + } + + firstSubstate := substate.NewSubstateDB(g.aidaDb).GetFirstSubstate() + lastSubstate, err := substate.NewSubstateDB(g.aidaDb).GetLastSubstate() + if err != nil { + return fmt.Errorf("cannot get last substate; %v", err) + } + + if firstSubstate.Env.Number > g.opera.firstBlock { + return fmt.Errorf("generation range first block %v cannot be greater than first substate block %v", g.opera.firstBlock, firstSubstate.Env.Number) + } + + if lastSubstate.Env.Number < g.opera.lastBlock { + return fmt.Errorf("generation range last block %v cannot be greater than last substate block %v", g.opera.lastBlock, lastSubstate.Env.Number) + } + + firstAvailableEpoch, err := utils.FindEpochNumber(firstSubstate.Env.Number, g.cfg.ChainID) + if err != nil { + return fmt.Errorf("cannot find first epoch number; %v", err) + } + + lastAvailableEpoch, err := utils.FindEpochNumber(lastSubstate.Env.Number, g.cfg.ChainID) + if err != nil { + return fmt.Errorf("cannot find last epoch number; %v", err) + } + + if g.opera.firstEpoch < firstAvailableEpoch { + return fmt.Errorf("generation range first epoch %v cannot be less than first available epoch %v", g.opera.firstEpoch, firstAvailableEpoch) + } + + if g.opera.lastEpoch > lastAvailableEpoch { + return fmt.Errorf("generation range last epoch %v cannot be greater than last available epoch %v", g.opera.lastEpoch, lastAvailableEpoch) + } + return nil +} + // newGenerator returns new instance of generator func newGenerator(ctx *cli.Context, cfg *utils.Config) (*generator, error) { if cfg.AidaDb == "" { @@ -135,9 +198,13 @@ func (g *generator) Generate() error { return err } - err = g.runStateHashScraper(g.ctx) - if err != nil { - return fmt.Errorf("cannot scrape state hashes; %v", err) + if g.cfg.SkipStateHashScrapping { + g.log.Noticef("Skipping state hash scraping...") + } else { + err = g.runStateHashScraper(g.ctx) + if err != nil { + return fmt.Errorf("cannot scrape state hashes; %v", err) + } } err = g.runDbHashGeneration(err) @@ -271,7 +338,7 @@ func (g *generator) processDeletedAccounts(ddb *substate.DestroyedAccountDB) err start = time.Now() g.log.Noticef("Generating DeletionDb...") - err = GenDeletedAccountsAction(g.cfg, ddb, 0) + err = GenDeletedAccountsAction(g.cfg, ddb, 0, g.opera.lastBlock) if err != nil { return fmt.Errorf("cannot doGenerations deleted accounts; %v", err) } @@ -333,7 +400,7 @@ func (g *generator) createPatch() (string, error) { // creating patch name // add leading zeroes to filename to make it sortable - patchName := fmt.Sprintf("aida-db-%09s", strconv.FormatUint(g.opera.lastEpoch, 10)) + patchName := fmt.Sprintf("%s-%s", strconv.FormatUint(g.opera.firstEpoch, 10), strconv.FormatUint(g.opera.lastEpoch, 10)) patchPath := filepath.Join(g.cfg.Output, patchName) g.cfg.TargetDb = patchPath @@ -346,8 +413,9 @@ func (g *generator) createPatch() (string, error) { } err = CreatePatchClone(g.cfg, g.aidaDb, patchDb, g.opera.firstEpoch, g.opera.lastEpoch, g.opera.isNew) - - g.log.Notice("Patch metadata") + if err != nil { + return "", fmt.Errorf("cannot create patch clone; %v", err) + } // metadata err = utils.ProcessPatchLikeMetadata(patchDb, g.cfg.LogLevel, g.cfg.First, g.cfg.Last, g.opera.firstEpoch, diff --git a/utils/config.go b/utils/config.go index 700296da8..7e559140e 100644 --- a/utils/config.go +++ b/utils/config.go @@ -95,95 +95,96 @@ type Config struct { First uint64 // first block Last uint64 // last block - RpcRecordingFile string // path to source file with recorded RPC requests - ArchiveMode bool // enable archive mode - ArchiveQueryRate int // the queries per second send to the archive - ArchiveMaxQueryAge int // the maximum age for archive queries (in blocks) - ArchiveVariant string // selects the implementation variant of the archive - BlockLength uint64 // length of a block in number of transactions - BalanceRange int64 // balance range for stochastic simulation/replay - CarmenSchema int // the current DB schema ID to use in Carmen - ChainID ChainID // Blockchain ID (mainnet: 250/testnet: 4002) - Cache int // Cache for StateDb or Priming - ContinueOnFailure bool // continue validation when an error detected - ContractNumber int64 // number of contracts to create - CompactDb bool // compact database after merging - SrcDbReadonly bool // if false, make a copy the source statedb - CPUProfile string // pprof cpu profile output file name - CPUProfilePerInterval bool // a different CPU profile is taken per 100k block interval - OperaDb string // path to opera database - DbTmp string // path to temporary database - DbImpl string // storage implementation - DiagnosticServer int64 // if not zero, the port used for hosting a HTTP server for performance diagnostics - Genesis string // genesis file - DbVariant string // database variant - DbLogging bool // set to true if all DB operations should be logged - Debug bool // enable trace debug flag - DeleteSourceDbs bool // delete source databases - DebugFrom uint64 // the first block to print trace debug - DeletionDb string // directory of deleted account database - Quiet bool // disable progress report flag - SyncPeriodLength uint64 // length of a sync-period in number of blocks - HasDeletedAccounts bool // true if DeletionDb is not empty; otherwise false - KeepDb bool // set to true if db is kept after run - KeysNumber int64 // number of keys to generate - MaxNumTransactions int // the maximum number of processed transactions - MemoryBreakdown bool // enable printing of memory breakdown - MemoryProfile string // capture the memory heap profile into the file - NonceRange int // nonce range for stochastic simulation/replay - TransactionLength uint64 // determines indirectly the length of a transaction - PrimeRandom bool // enable randomized priming - PrimeThreshold int // set account threshold before commit - Profile bool // enable micro profiling - ProfileFile string // output file containing profiling result - ProfileInterval uint64 // interval of printing profile result - RandomSeed int64 // set random seed for stochastic testing - SkipPriming bool // skip priming of the state DB - SkipMetadata bool // skip metadata insert/getting into AidaDb - ShadowDb bool // defines we want to open an existing db as shadow - ShadowImpl string // implementation of the shadow DB to use, empty if disabled - ShadowVariant string // database variant of the shadow DB to be used - StateDbSrc string // directory to load an existing State DB data - AidaDb string // directory to profiling database containing substate, update, delete accounts data - StateValidationMode ValidationMode // state validation mode - UpdateDb string // update-set directory - UpdateType string // download datatype - Output string // output directory for aida-db patches or path to events.json file in stochastic generation - SnapshotDepth int // depth of snapshot history - SubstateDb string // substate directory - OperaBinary string // path to opera binary - Validate bool // validate validate aida-db - ValidateTxState bool // validate stateDB before and after transaction - ValidateWorldState bool // validate stateDB before and after replay block range - ValuesNumber int64 // number of values to generate - VmImpl string // vm implementation (geth/lfvm) - WorldStateDb string // path to worldstate - Workers int // number of worker threads - TraceFile string // name of trace file - TraceDirectory string // name of trace directory - Trace bool // trace flag - LogLevel string // level of the logging of the app action - SourceTableName string // represents the name of a source DB table - TargetDb string // represents the path of a target DB - TrieRootHash string // represents a hash of a state trie root to be decoded - IncludeStorage bool // represents a flag for contract storage inclusion in an operation - ProfileEVMCall bool // enable profiling for EVM call - MicroProfiling bool // enable micro-profiling of EVM - BasicBlockProfiling bool // enable profiling of basic block - OnlySuccessful bool // only runs transactions that have been successful - ProfilingDbName string // set a database name for storing micro-profiling results - ChannelBufferSize int // set a buffer size for profiling channel - TargetBlock uint64 // represents the ID of target block to be reached by state evolve process or in dump state - TargetEpoch uint64 // represents the ID of target epoch to be reached by autogen patch generator - UpdateBufferSize uint64 // cache size in Bytes - ProfileDB string // profile db for parallel transaction execution - MaxNumErrors int // maximum number of errors when ContinueOnFailure is enabled - UpdateOnFailure bool // if enabled and continue-on-failure is also enabled, this updates any error found in StateDb - NoHeartbeatLogging bool // disables heartbeat logging - TrackProgress bool // enables track progress logging - IsExistingStateDb bool // this is true if we are using an existing StateDb - ValidateStateHashes bool // if this is true state hash validation is enabled in Executor - ProfileBlocks bool // enables block profiler extension + RpcRecordingFile string // path to source file with recorded RPC requests + ArchiveMode bool // enable archive mode + ArchiveQueryRate int // the queries per second send to the archive + ArchiveMaxQueryAge int // the maximum age for archive queries (in blocks) + ArchiveVariant string // selects the implementation variant of the archive + BlockLength uint64 // length of a block in number of transactions + BalanceRange int64 // balance range for stochastic simulation/replay + CarmenSchema int // the current DB schema ID to use in Carmen + ChainID ChainID // Blockchain ID (mainnet: 250/testnet: 4002) + Cache int // Cache for StateDb or Priming + ContinueOnFailure bool // continue validation when an error detected + ContractNumber int64 // number of contracts to create + CompactDb bool // compact database after merging + SrcDbReadonly bool // if false, make a copy the source statedb + CPUProfile string // pprof cpu profile output file name + CPUProfilePerInterval bool // a different CPU profile is taken per 100k block interval + OperaDb string // path to opera database + DbTmp string // path to temporary database + DbImpl string // storage implementation + DiagnosticServer int64 // if not zero, the port used for hosting a HTTP server for performance diagnostics + Genesis string // genesis file + DbVariant string // database variant + DbLogging bool // set to true if all DB operations should be logged + Debug bool // enable trace debug flag + DeleteSourceDbs bool // delete source databases + DebugFrom uint64 // the first block to print trace debug + DeletionDb string // directory of deleted account database + Quiet bool // disable progress report flag + SyncPeriodLength uint64 // length of a sync-period in number of blocks + HasDeletedAccounts bool // true if DeletionDb is not empty; otherwise false + KeepDb bool // set to true if db is kept after run + KeysNumber int64 // number of keys to generate + MaxNumTransactions int // the maximum number of processed transactions + MemoryBreakdown bool // enable printing of memory breakdown + MemoryProfile string // capture the memory heap profile into the file + NonceRange int // nonce range for stochastic simulation/replay + TransactionLength uint64 // determines indirectly the length of a transaction + PrimeRandom bool // enable randomized priming + PrimeThreshold int // set account threshold before commit + Profile bool // enable micro profiling + ProfileFile string // output file containing profiling result + ProfileInterval uint64 // interval of printing profile result + RandomSeed int64 // set random seed for stochastic testing + SkipPriming bool // skip priming of the state DB + SkipMetadata bool // skip metadata insert/getting into AidaDb + ShadowDb bool // defines we want to open an existing db as shadow + ShadowImpl string // implementation of the shadow DB to use, empty if disabled + ShadowVariant string // database variant of the shadow DB to be used + StateDbSrc string // directory to load an existing State DB data + AidaDb string // directory to profiling database containing substate, update, delete accounts data + StateValidationMode ValidationMode // state validation mode + UpdateDb string // update-set directory + UpdateType string // download datatype + Output string // output directory for aida-db patches or path to events.json file in stochastic generation + SnapshotDepth int // depth of snapshot history + SubstateDb string // substate directory + OperaBinary string // path to opera binary + Validate bool // validate validate aida-db + ValidateTxState bool // validate stateDB before and after transaction + ValidateWorldState bool // validate stateDB before and after replay block range + ValuesNumber int64 // number of values to generate + VmImpl string // vm implementation (geth/lfvm) + WorldStateDb string // path to worldstate + Workers int // number of worker threads + TraceFile string // name of trace file + TraceDirectory string // name of trace directory + Trace bool // trace flag + LogLevel string // level of the logging of the app action + SourceTableName string // represents the name of a source DB table + TargetDb string // represents the path of a target DB + TrieRootHash string // represents a hash of a state trie root to be decoded + IncludeStorage bool // represents a flag for contract storage inclusion in an operation + ProfileEVMCall bool // enable profiling for EVM call + MicroProfiling bool // enable micro-profiling of EVM + BasicBlockProfiling bool // enable profiling of basic block + OnlySuccessful bool // only runs transactions that have been successful + ProfilingDbName string // set a database name for storing micro-profiling results + ChannelBufferSize int // set a buffer size for profiling channel + TargetBlock uint64 // represents the ID of target block to be reached by state evolve process or in dump state + TargetEpoch uint64 // represents the ID of target epoch to be reached by autogen patch generator + UpdateBufferSize uint64 // cache size in Bytes + ProfileDB string // profile db for parallel transaction execution + MaxNumErrors int // maximum number of errors when ContinueOnFailure is enabled + UpdateOnFailure bool // if enabled and continue-on-failure is also enabled, this updates any error found in StateDb + SkipStateHashScrapping bool // if enabled, then state-hashes are not loaded from rpc + NoHeartbeatLogging bool // disables heartbeat logging + TrackProgress bool // enables track progress logging + IsExistingStateDb bool // this is true if we are using an existing StateDb + ValidateStateHashes bool // if this is true state hash validation is enabled in Executor + ProfileBlocks bool // enables block profiler extension } // GetChainConfig returns chain configuration of either mainnet or testnets. diff --git a/utils/default_config.go b/utils/default_config.go index e4244b476..3efaa6999 100644 --- a/utils/default_config.go +++ b/utils/default_config.go @@ -15,91 +15,92 @@ func createConfigFromFlags(ctx *cli.Context) *Config { RpcRecordingFile: getFlagValue(ctx, RpcRecordingFileFlag).(string), - ArchiveMode: getFlagValue(ctx, ArchiveModeFlag).(bool), - ArchiveQueryRate: getFlagValue(ctx, ArchiveQueryRateFlag).(int), - ArchiveMaxQueryAge: getFlagValue(ctx, ArchiveMaxQueryAgeFlag).(int), - ArchiveVariant: getFlagValue(ctx, ArchiveVariantFlag).(string), - BlockLength: getFlagValue(ctx, BlockLengthFlag).(uint64), - BalanceRange: getFlagValue(ctx, BalanceRangeFlag).(int64), - CarmenSchema: getFlagValue(ctx, CarmenSchemaFlag).(int), - ChainID: ChainID(getFlagValue(ctx, ChainIDFlag).(int)), - Cache: getFlagValue(ctx, CacheFlag).(int), - ContractNumber: getFlagValue(ctx, ContractNumberFlag).(int64), - ContinueOnFailure: getFlagValue(ctx, ContinueOnFailureFlag).(bool), - SrcDbReadonly: false, - CPUProfile: getFlagValue(ctx, CpuProfileFlag).(string), - CPUProfilePerInterval: getFlagValue(ctx, CpuProfilePerIntervalFlag).(bool), - OperaDb: getFlagValue(ctx, OperaDbFlag).(string), - DbTmp: getFlagValue(ctx, DbTmpFlag).(string), - Debug: getFlagValue(ctx, TraceDebugFlag).(bool), - DebugFrom: getFlagValue(ctx, DebugFromFlag).(uint64), - Quiet: getFlagValue(ctx, QuietFlag).(bool), - SyncPeriodLength: getFlagValue(ctx, SyncPeriodLengthFlag).(uint64), - Genesis: getFlagValue(ctx, GenesisFlag).(string), - DbImpl: getFlagValue(ctx, StateDbImplementationFlag).(string), - DbVariant: getFlagValue(ctx, StateDbVariantFlag).(string), - DbLogging: getFlagValue(ctx, StateDbLoggingFlag).(bool), - DeletionDb: getFlagValue(ctx, DeletionDbFlag).(string), - DeleteSourceDbs: getFlagValue(ctx, DeleteSourceDbsFlag).(bool), - DiagnosticServer: getFlagValue(ctx, DiagnosticServerFlag).(int64), - CompactDb: getFlagValue(ctx, CompactDbFlag).(bool), - HasDeletedAccounts: true, - KeepDb: getFlagValue(ctx, KeepDbFlag).(bool), - KeysNumber: getFlagValue(ctx, KeysNumberFlag).(int64), - MaxNumTransactions: getFlagValue(ctx, MaxNumTransactionsFlag).(int), - MemoryBreakdown: getFlagValue(ctx, MemoryBreakdownFlag).(bool), - MemoryProfile: getFlagValue(ctx, MemoryProfileFlag).(string), - NonceRange: getFlagValue(ctx, NonceRangeFlag).(int), - TransactionLength: getFlagValue(ctx, TransactionLengthFlag).(uint64), - PrimeRandom: getFlagValue(ctx, RandomizePrimingFlag).(bool), - RandomSeed: getFlagValue(ctx, RandomSeedFlag).(int64), - PrimeThreshold: getFlagValue(ctx, PrimeThresholdFlag).(int), - Profile: getFlagValue(ctx, ProfileFlag).(bool), - ProfileFile: getFlagValue(ctx, ProfileFileFlag).(string), - ProfileInterval: getFlagValue(ctx, ProfileIntervalFlag).(uint64), - SkipPriming: getFlagValue(ctx, SkipPrimingFlag).(bool), - SkipMetadata: getFlagValue(ctx, flags.SkipMetadata).(bool), - ShadowDb: getFlagValue(ctx, ShadowDb).(bool), - ShadowImpl: getFlagValue(ctx, ShadowDbImplementationFlag).(string), - ShadowVariant: getFlagValue(ctx, ShadowDbVariantFlag).(string), - SnapshotDepth: getFlagValue(ctx, SnapshotDepthFlag).(int), - StateDbSrc: getFlagValue(ctx, StateDbSrcFlag).(string), - AidaDb: getFlagValue(ctx, AidaDbFlag).(string), - Output: getFlagValue(ctx, OutputFlag).(string), - StateValidationMode: EqualityCheck, - UpdateDb: getFlagValue(ctx, UpdateDbFlag).(string), - UpdateType: getFlagValue(ctx, UpdateTypeFlag).(string), - SubstateDb: getFlagValue(ctx, substate.SubstateDbFlag).(string), - OperaBinary: getFlagValue(ctx, OperaBinaryFlag).(string), - ValuesNumber: getFlagValue(ctx, ValuesNumberFlag).(int64), - Validate: getFlagValue(ctx, ValidateFlag).(bool), - VmImpl: getFlagValue(ctx, VmImplementation).(string), - Workers: getFlagValue(ctx, substate.WorkersFlag).(int), - WorldStateDb: getFlagValue(ctx, WorldStateFlag).(string), - TraceFile: getFlagValue(ctx, TraceFileFlag).(string), - TraceDirectory: getFlagValue(ctx, TraceDirectoryFlag).(string), - Trace: getFlagValue(ctx, TraceFlag).(bool), - LogLevel: getFlagValue(ctx, logger.LogLevelFlag).(string), - SourceTableName: getFlagValue(ctx, SourceTableNameFlag).(string), - TargetDb: getFlagValue(ctx, TargetDbFlag).(string), - TrieRootHash: getFlagValue(ctx, TrieRootHashFlag).(string), - IncludeStorage: getFlagValue(ctx, IncludeStorageFlag).(bool), - ProfileEVMCall: getFlagValue(ctx, ProfileEVMCallFlag).(bool), - MicroProfiling: getFlagValue(ctx, MicroProfilingFlag).(bool), - BasicBlockProfiling: getFlagValue(ctx, BasicBlockProfilingFlag).(bool), - OnlySuccessful: getFlagValue(ctx, OnlySuccessfulFlag).(bool), - ProfilingDbName: getFlagValue(ctx, ProfilingDbNameFlag).(string), - ChannelBufferSize: getFlagValue(ctx, ChannelBufferSizeFlag).(int), - TargetBlock: getFlagValue(ctx, TargetBlockFlag).(uint64), - TargetEpoch: getFlagValue(ctx, TargetEpochFlag).(uint64), - UpdateBufferSize: getFlagValue(ctx, UpdateBufferSizeFlag).(uint64), - UpdateOnFailure: getFlagValue(ctx, UpdateOnFailure).(bool), - MaxNumErrors: getFlagValue(ctx, MaxNumErrorsFlag).(int), - NoHeartbeatLogging: getFlagValue(ctx, NoHeartbeatLoggingFlag).(bool), - TrackProgress: getFlagValue(ctx, TrackProgressFlag).(bool), - ValidateStateHashes: getFlagValue(ctx, ValidateStateHashesFlag).(bool), - ProfileDB: getFlagValue(ctx, ProfileDBFlag).(string), - ProfileBlocks: getFlagValue(ctx, ProfileBlocksFlag).(bool), + ArchiveMode: getFlagValue(ctx, ArchiveModeFlag).(bool), + ArchiveQueryRate: getFlagValue(ctx, ArchiveQueryRateFlag).(int), + ArchiveMaxQueryAge: getFlagValue(ctx, ArchiveMaxQueryAgeFlag).(int), + ArchiveVariant: getFlagValue(ctx, ArchiveVariantFlag).(string), + BlockLength: getFlagValue(ctx, BlockLengthFlag).(uint64), + BalanceRange: getFlagValue(ctx, BalanceRangeFlag).(int64), + CarmenSchema: getFlagValue(ctx, CarmenSchemaFlag).(int), + ChainID: ChainID(getFlagValue(ctx, ChainIDFlag).(int)), + Cache: getFlagValue(ctx, CacheFlag).(int), + ContractNumber: getFlagValue(ctx, ContractNumberFlag).(int64), + ContinueOnFailure: getFlagValue(ctx, ContinueOnFailureFlag).(bool), + SrcDbReadonly: false, + CPUProfile: getFlagValue(ctx, CpuProfileFlag).(string), + CPUProfilePerInterval: getFlagValue(ctx, CpuProfilePerIntervalFlag).(bool), + OperaDb: getFlagValue(ctx, OperaDbFlag).(string), + DbTmp: getFlagValue(ctx, DbTmpFlag).(string), + Debug: getFlagValue(ctx, TraceDebugFlag).(bool), + DebugFrom: getFlagValue(ctx, DebugFromFlag).(uint64), + Quiet: getFlagValue(ctx, QuietFlag).(bool), + SyncPeriodLength: getFlagValue(ctx, SyncPeriodLengthFlag).(uint64), + Genesis: getFlagValue(ctx, GenesisFlag).(string), + DbImpl: getFlagValue(ctx, StateDbImplementationFlag).(string), + DbVariant: getFlagValue(ctx, StateDbVariantFlag).(string), + DbLogging: getFlagValue(ctx, StateDbLoggingFlag).(bool), + DeletionDb: getFlagValue(ctx, DeletionDbFlag).(string), + DeleteSourceDbs: getFlagValue(ctx, DeleteSourceDbsFlag).(bool), + DiagnosticServer: getFlagValue(ctx, DiagnosticServerFlag).(int64), + CompactDb: getFlagValue(ctx, CompactDbFlag).(bool), + HasDeletedAccounts: true, + KeepDb: getFlagValue(ctx, KeepDbFlag).(bool), + KeysNumber: getFlagValue(ctx, KeysNumberFlag).(int64), + MaxNumTransactions: getFlagValue(ctx, MaxNumTransactionsFlag).(int), + MemoryBreakdown: getFlagValue(ctx, MemoryBreakdownFlag).(bool), + MemoryProfile: getFlagValue(ctx, MemoryProfileFlag).(string), + NonceRange: getFlagValue(ctx, NonceRangeFlag).(int), + TransactionLength: getFlagValue(ctx, TransactionLengthFlag).(uint64), + PrimeRandom: getFlagValue(ctx, RandomizePrimingFlag).(bool), + RandomSeed: getFlagValue(ctx, RandomSeedFlag).(int64), + PrimeThreshold: getFlagValue(ctx, PrimeThresholdFlag).(int), + Profile: getFlagValue(ctx, ProfileFlag).(bool), + ProfileFile: getFlagValue(ctx, ProfileFileFlag).(string), + ProfileInterval: getFlagValue(ctx, ProfileIntervalFlag).(uint64), + SkipPriming: getFlagValue(ctx, SkipPrimingFlag).(bool), + SkipMetadata: getFlagValue(ctx, flags.SkipMetadata).(bool), + ShadowDb: getFlagValue(ctx, ShadowDb).(bool), + ShadowImpl: getFlagValue(ctx, ShadowDbImplementationFlag).(string), + ShadowVariant: getFlagValue(ctx, ShadowDbVariantFlag).(string), + SnapshotDepth: getFlagValue(ctx, SnapshotDepthFlag).(int), + StateDbSrc: getFlagValue(ctx, StateDbSrcFlag).(string), + AidaDb: getFlagValue(ctx, AidaDbFlag).(string), + Output: getFlagValue(ctx, OutputFlag).(string), + StateValidationMode: EqualityCheck, + UpdateDb: getFlagValue(ctx, UpdateDbFlag).(string), + UpdateType: getFlagValue(ctx, UpdateTypeFlag).(string), + SubstateDb: getFlagValue(ctx, substate.SubstateDbFlag).(string), + OperaBinary: getFlagValue(ctx, OperaBinaryFlag).(string), + ValuesNumber: getFlagValue(ctx, ValuesNumberFlag).(int64), + Validate: getFlagValue(ctx, ValidateFlag).(bool), + VmImpl: getFlagValue(ctx, VmImplementation).(string), + Workers: getFlagValue(ctx, substate.WorkersFlag).(int), + WorldStateDb: getFlagValue(ctx, WorldStateFlag).(string), + TraceFile: getFlagValue(ctx, TraceFileFlag).(string), + TraceDirectory: getFlagValue(ctx, TraceDirectoryFlag).(string), + Trace: getFlagValue(ctx, TraceFlag).(bool), + LogLevel: getFlagValue(ctx, logger.LogLevelFlag).(string), + SourceTableName: getFlagValue(ctx, SourceTableNameFlag).(string), + TargetDb: getFlagValue(ctx, TargetDbFlag).(string), + TrieRootHash: getFlagValue(ctx, TrieRootHashFlag).(string), + IncludeStorage: getFlagValue(ctx, IncludeStorageFlag).(bool), + ProfileEVMCall: getFlagValue(ctx, ProfileEVMCallFlag).(bool), + MicroProfiling: getFlagValue(ctx, MicroProfilingFlag).(bool), + BasicBlockProfiling: getFlagValue(ctx, BasicBlockProfilingFlag).(bool), + OnlySuccessful: getFlagValue(ctx, OnlySuccessfulFlag).(bool), + ProfilingDbName: getFlagValue(ctx, ProfilingDbNameFlag).(string), + ChannelBufferSize: getFlagValue(ctx, ChannelBufferSizeFlag).(int), + TargetBlock: getFlagValue(ctx, TargetBlockFlag).(uint64), + TargetEpoch: getFlagValue(ctx, TargetEpochFlag).(uint64), + UpdateBufferSize: getFlagValue(ctx, UpdateBufferSizeFlag).(uint64), + UpdateOnFailure: getFlagValue(ctx, UpdateOnFailure).(bool), + SkipStateHashScrapping: getFlagValue(ctx, SkipStateHashScrappingFlag).(bool), + MaxNumErrors: getFlagValue(ctx, MaxNumErrorsFlag).(int), + NoHeartbeatLogging: getFlagValue(ctx, NoHeartbeatLoggingFlag).(bool), + TrackProgress: getFlagValue(ctx, TrackProgressFlag).(bool), + ValidateStateHashes: getFlagValue(ctx, ValidateStateHashesFlag).(bool), + ProfileDB: getFlagValue(ctx, ProfileDBFlag).(string), + ProfileBlocks: getFlagValue(ctx, ProfileBlocksFlag).(bool), } return cfg diff --git a/utils/flags.go b/utils/flags.go index 2f11bd808..6ee1aa6d8 100644 --- a/utils/flags.go +++ b/utils/flags.go @@ -355,6 +355,11 @@ var ( Usage: "if enabled and continue-on-failure is also enabled, this corrects any error found in StateDb", Value: true, } + SkipStateHashScrappingFlag = cli.BoolFlag{ + Name: "skip-state-hash-scrapping", + Usage: "if enabled, then state-hashes are not loaded from rpc", + Value: false, + } NoHeartbeatLoggingFlag = cli.BoolFlag{ Name: "no-heartbeat-logging", Usage: "disables heartbeat logging",