Documentation
¶
Overview ¶
Package utils is a generated GoMock package.
Package utils is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CopyDir(src string, dst string) error
- func CreateTestSubstateDb(t *testing.T, encoding substateDb.SubstateEncodingSchema) (*substate.Substate, string)
- func DownloadTestDataset(outputDir string) (err error)
- func FindBlockRangeInSubstate(db db.SubstateDB) (uint64, uint64, bool)
- func FindEpochNumber(blockNumber uint64, chainId ChainID) (uint64, error)
- func FindHeadEpochNumber(chainId ChainID) (uint64, error)
- func GetDirectorySize(path string) (int64, error)
- func GetFilesWithinDirectories(suffix string, paths []string) ([]string, error)
- func GetFreeSpace(path string) (int64, error)
- func GetProvider(chainId ChainID) (string, error)
- func GetRandom(rangeLower int, rangeUpper int) int
- func GetTestSubstate(encoding string) *substate.Substate
- func HasStateHashPatch(path string) (bool, error)
- func IsEthereumNetwork(chainID ChainID) bool
- func MakeAccountStorage(t *testing.T) map[common.Hash]common.Hash
- func MakeRandomByteSlice(t *testing.T, bufferLength int) []byte
- func MakeWorldState(t *testing.T) (txcontext.AidaWorldState, []common.Address)
- func MemoryBreakdown(db state.StateDB, cfg *Config, log logger.Logger)
- func NewConfigContext(cfg *Config, ctx *cli.Context) *configContext
- func NewShell() shell
- func OverwriteStateDB(patch txcontext.WorldState, db state.VmStateDB)
- func PrepareBlockCtx(inputEnv txcontext.BlockEnvironment, hashError *error) *vm.BlockContext
- func PrepareStateDB(cfg *Config) (state.StateDB, string, error)
- func PrintEvmStatistics(cfg *Config)
- func ProcessCloneLikeMetadata(aidaDb db.BaseDB, typ AidaDbType, logLevel string, ...) error
- func ProcessGenLikeMetadata(aidaDb db.BaseDB, firstBlock uint64, lastBlock uint64, firstEpoch uint64, ...) error
- func ProcessPatchLikeMetadata(aidaDb db.BaseDB, logLevel string, ...) error
- func RenameTempStateDbDirectory(cfg *Config, oldDirectory string, block uint64) string
- func RlpHash(x interface{}) (h common.Hash)
- func SendRpcRequest(payload JsonRPCRequest, chainId ChainID) (map[string]interface{}, error)
- func SetBlockRange(firstArg string, lastArg string, chainId ChainID) (uint64, uint64, error)
- func StartCPUProfile(cfg *Config) error
- func StartMemoryProfile(cfg *Config) error
- func StopCPUProfile(cfg *Config)
- func ToTitleCase(fork string) string
- func WriteStateDbInfo(directory string, cfg *Config, block uint64, root common.Hash, ...) error
- type AidaDbMetadata
- func (md *AidaDbMetadata) CheckUpdateMetadata(cfg *Config, patchDb db.BaseDB) error
- func (md *AidaDbMetadata) DeleteMetadata()
- func (md *AidaDbMetadata) GetChainID() ChainID
- func (md *AidaDbMetadata) GetDbHash() []byte
- func (md *AidaDbMetadata) GetDbType() AidaDbType
- func (md *AidaDbMetadata) GetFirstBlock() uint64
- func (md *AidaDbMetadata) GetFirstEpoch() uint64
- func (md *AidaDbMetadata) GetLastBlock() uint64
- func (md *AidaDbMetadata) GetLastEpoch() uint64
- func (md *AidaDbMetadata) GetMetadata()
- func (md *AidaDbMetadata) GetTimestamp() uint64
- func (md *AidaDbMetadata) SetAll() error
- func (md *AidaDbMetadata) SetAllMetadata(firstBlock uint64, lastBlock uint64, firstEpoch uint64, lastEpoch uint64, ...) error
- func (md *AidaDbMetadata) SetBlockRange(firstBlock uint64, lastBlock uint64) error
- func (md *AidaDbMetadata) SetChainID(chainID ChainID) error
- func (md *AidaDbMetadata) SetDbHash(dbHash []byte) error
- func (md *AidaDbMetadata) SetDbType(dbType AidaDbType) error
- func (md *AidaDbMetadata) SetFirstBlock(firstBlock uint64) error
- func (md *AidaDbMetadata) SetFirstEpoch(firstEpoch uint64) error
- func (md *AidaDbMetadata) SetFreshMetadata(chainID ChainID) error
- func (md *AidaDbMetadata) SetHasHashPatch() error
- func (md *AidaDbMetadata) SetLastBlock(lastBlock uint64) error
- func (md *AidaDbMetadata) SetLastEpoch(lastEpoch uint64) error
- func (md *AidaDbMetadata) SetTimestamp() error
- func (md *AidaDbMetadata) SetUpdatesetInterval(val uint64) error
- func (md *AidaDbMetadata) SetUpdatesetSize(val uint64) error
- func (md *AidaDbMetadata) UpdateMetadataInOldAidaDb(chainId ChainID, firstAidaDbBlock uint64, lastAidaDbBlock uint64) error
- type AidaDbType
- type ArgsBuilder
- type ArgumentMode
- type ChainID
- type ChainIDs
- type Config
- type EthTestType
- type Event
- type Flusher
- type IFlusher
- type Interval
- type JsonRPCRequest
- type MockIFlusher
- type MockIFlusherMockRecorder
- type MockPrinter
- type MockPrinterMockRecorder
- type MockShellExecutor
- type MockShellExecutorMockRecorder
- type PatchJson
- type Printer
- type PrinterToBuffer
- type PrinterToDb
- type PrinterToFile
- type PrinterToWriter
- type Printers
- func (ps *Printers) AddPrinter(p Printer) *Printers
- func (ps *Printers) AddPrinterToConsole(isDisabled bool, f func() string) *Printers
- func (ps *Printers) AddPrinterToFile(filepath string, f func() string) *Printers
- func (ps *Printers) AddPrinterToSqlite3(conn string, create string, insert string, f func() [][]any) *Printers
- func (ps *Printers) AddPrinterToWriter(w io.Writer, f func() string) *Printers
- func (ps *Printers) Close() error
- func (ps *Printers) Print() error
- type ProgressTracker
- type ShellExecutor
- type StateDbInfo
- type StateDbTestCase
- type ValidationMode
Constants ¶
const ( AidaDbRepositorySonicUrl = "https://storage.googleapis.com/aida-repository-public/sonic/aida-patches" AidaDbRepositoryOperaUrl = "https://storage.googleapis.com/aida-repository-public/mainnet/aida-patches" AidaDbRepositoryTestnetUrl = "https://storage.googleapis.com/aida-repository-public/testnet/aida-patches" AidaDbRepositoryEthereumUrl = "https://storage.googleapis.com/aida-repository-public/ethereum/aida-patches" AidaDbRepositoryHoleskyUrl = "https://storage.googleapis.com/aida-repository-public/holesky/aida-patches" AidaDbRepositoryHoodiUrl = "https://storage.googleapis.com/aida-repository-public/hoodi/aida-patches" AidaDbRepositorySepoliaUrl = "https://storage.googleapis.com/aida-repository-public/sepolia/aida-patches" )
const ( FirstBlockPrefix = db.MetadataPrefix + "fb" LastBlockPrefix = db.MetadataPrefix + "lb" FirstEpochPrefix = db.MetadataPrefix + "fe" LastEpochPrefix = db.MetadataPrefix + "le" TypePrefix = db.MetadataPrefix + "ty" ChainIDPrefix = db.MetadataPrefix + "ci" TimestampPrefix = db.MetadataPrefix + "ti" DbHashPrefix = db.MetadataPrefix + "md" HasStateHashPatchPrefix = db.MetadataPrefix + "sh" )
const ( RPCSonicMainnet = "https://rpc.soniclabs.com" RPCOperaMainnet = "https://rpcapi.fantom.network" RPCTestnet = "https://rpc.blaze.soniclabs.com" )
const ( PathToPrimaryStateDb = "/prime" PathToShadowStateDb = "/shadow" )
const OperationThreshold = 1_000_000
threshold for wrapping a bulk load and reporting a priming progress
const PathToDbInfo = "statedb_info.json"
const (
// special transaction number for pseudo transactions
PseudoTx = 99999
)
Variables ¶
var ( FirstOperaBlock uint64 // id of the first block in substate AidaDbRepositoryUrl string // url of the Aida DB repository )
var ( RpcRecordingFileFlag = cli.PathFlag{ Name: "rpc-recording", Usage: "Path to source file with recorded API data", Aliases: []string{"r"}, } ArchiveModeFlag = cli.BoolFlag{ Name: "archive", Usage: "set node type to archival mode. If set, the node keep all the EVM state history; otherwise the state history will be pruned.", } ArchiveQueryRateFlag = cli.IntFlag{ Name: "archive-query-rate", Usage: "sets the number of queries send to the archive per second, disabled if 0 or negative", } ArchiveMaxQueryAgeFlag = cli.IntFlag{ Name: "archive-max-query-age", Usage: "sets an upper limit for the number of blocks an archive query may be lagging behind the head block", Value: 100_000, } ArchiveVariantFlag = cli.StringFlag{ Name: "archive-variant", Usage: "set the archive implementation variant for the selected DB implementation, ignored if not running in archive mode", } BlockLengthFlag = cli.Uint64Flag{ Name: "block-length", Usage: "defines the number of transactions per block", Value: 10, } BalanceRangeFlag = cli.Int64Flag{ Name: "balance-range", Usage: "sets the balance range of the stochastic simulation", Value: 1000000, } CarmenCheckpointInterval = cli.IntFlag{ Name: "carmen-checkpoint-interval", Usage: "defines how often (in blocks) will Carmen create checkpoints", Value: 0, } CarmenCheckpointPeriod = cli.IntFlag{ Name: "carmen-checkpoint-period", Usage: "defines how often (in minutes) will Carmen create checkpoints", Value: 0, } CarmenSchemaFlag = cli.IntFlag{ Name: "carmen-schema", Usage: "select the DB schema used by Carmen's current state DB", Value: 5, } ChainIDFlag = cli.IntFlag{ Name: "chainid", Usage: "ChainID for replayer", } CacheFlag = cli.IntFlag{ Name: "cache", Usage: "Cache limit for StateDb or Priming", Value: 8192, } ContinueOnFailureFlag = cli.BoolFlag{ Name: "continue-on-failure", Usage: "continue execute after validation failure detected", } CpuProfileFlag = cli.StringFlag{ Name: "cpu-profile", Usage: "enables CPU profiling", } CpuProfilePerIntervalFlag = cli.BoolFlag{ Name: "cpu-profile-per-interval", Usage: "enables CPU profiling for individual 100k intervals", } DebugFromFlag = cli.Uint64Flag{ Name: "debug-from", Usage: "sets the first block to print trace debug", Value: 0, } DeletionDbFlag = cli.PathFlag{ Name: "deletion-db", Usage: "sets the directory containing deleted accounts database", } DiagnosticServerFlag = cli.Int64Flag{ Name: "diagnostic-port", Usage: "enable hosting of a realtime diagnostic server by providing a port", Value: 0, } KeepDbFlag = cli.BoolFlag{ Name: "keep-db", Usage: "if set, state-db is not deleted after run", } CustomDbNameFlag = cli.StringFlag{ Name: "custom-db-name", Usage: "sets the name of state-db direcotry when --keep-db is enabled", } MemoryProfileFlag = cli.StringFlag{ Name: "memory-profile", Usage: "enables memory allocation profiling", } SyncPeriodLengthFlag = cli.Uint64Flag{ Name: "sync-period", Usage: "defines the number of blocks per sync-period", Value: 300, } MemoryBreakdownFlag = cli.BoolFlag{ Name: "memory-breakdown", Usage: "enables printing of memory usage breakdown", } NonceRangeFlag = cli.IntFlag{ Name: "nonce-range", Usage: "sets nonce range for stochastic simulation", Value: 1000000, } ProfileFlag = cli.BoolFlag{ Name: "profile", Usage: "enable profiling", } ProfileDepthFlag = cli.IntFlag{ Name: "profile-depth", Usage: "0=interval, 1=interval+block, 2=interval+block+transaction", Value: 0, } ProfileSqlite3Flag = cli.StringFlag{ Name: "profile-sqlite3", Usage: "output profiling data to sqlite3 db", } ProfileFileFlag = cli.StringFlag{ Name: "profile-file", Usage: "output file containing profiling data", } ProfileIntervalFlag = cli.Uint64Flag{ Name: "profile-interval", Usage: "Frequency of logging block statistics", Value: 1_000_000_000, } RegisterRunFlag = cli.StringFlag{ Name: "register-run", Usage: "When enabled, register results/metadata to an external service.", } OverwriteRunIdFlag = cli.StringFlag{ Name: "overwrite-run-id", Usage: "Use provided run id instead of auto-generating run id", } RandomizePrimingFlag = cli.BoolFlag{ Name: "prime-random", Usage: "randomize order of accounts in StateDB priming", } PrimeThresholdFlag = cli.IntFlag{ Name: "prime-threshold", Usage: "set number of accounts written to stateDB before applying pending state updates", Value: 0, } RandomSeedFlag = cli.Int64Flag{ Name: "random-seed", Usage: "Set random seed", Value: -1, } EnableCoverageFlag = cli.BoolFlag{ Name: "enable-coverage", Usage: "Enable coverage-guided fuzzing (requires binary built with -cover)", } CoverageSnapshotIntervalFlag = cli.IntFlag{ Name: "coverage-snapshot-interval", Usage: "Number of operations between coverage snapshots (0 = every operation)", Value: 100, } SkipPrimingFlag = cli.BoolFlag{ Name: "skip-priming", Usage: "if set, DB priming should be skipped; most useful with the 'memory' DB implementation", } DeltaTraceFileFlag = cli.StringSliceFlag{ Name: "trace-file", Usage: "path to a trace file (repeatable)", Aliases: []string{"f"}, } DeltaOutputFlag = cli.StringFlag{ Name: "output", Aliases: []string{"o"}, Usage: "write the minimized trace to the given path", } AddressSampleRunsFlag = cli.IntFlag{ Name: "address-sample-runs", Usage: "number of attempts per sampling factor when reducing contracts", Value: 5, } DeltaTimeoutFlag = cli.DurationFlag{ Name: "timeout", Usage: "overall timeout for the minimization run", } MaxFactorFlag = cli.IntFlag{ Name: "max-factor", Usage: "maximum sampling factor when reducing addresses", } StateDbImplementationFlag = cli.StringFlag{ Name: "db-impl", Usage: "select state DB implementation", Value: "geth", } StateDbVariantFlag = cli.StringFlag{ Name: "db-variant", Usage: "select a state DB variant", Value: "", } StateDbSrcFlag = cli.PathFlag{ Name: "db-src", Usage: "sets the directory contains source state DB data", } StateDbSrcOverwriteFlag = cli.BoolFlag{ Name: "db-src-overwrite", Usage: "Modify source db directly", } DbTmpFlag = cli.PathFlag{ Name: "db-tmp", Usage: "sets the temporary directory where to place DB data; uses system default if empty", } StateDbLoggingFlag = cli.PathFlag{ Name: "db-logging", Usage: "sets path to file for db-logging output", } DeltaLoggingFlag = cli.PathFlag{ Name: "delta-log", Usage: "sets path to file for delta-debugger compatible DB logs", } ShadowDb = cli.BoolFlag{ Name: "shadow-db", Usage: "use this flag when using an existing ShadowDb", Value: false, } ShadowDbImplementationFlag = cli.StringFlag{ Name: "db-shadow-impl", Usage: "select state DB implementation to shadow the prime DB implementation", Value: "", } ShadowDbVariantFlag = cli.StringFlag{ Name: "db-shadow-variant", Usage: "select a state DB variant to shadow the prime DB implementation", Value: "", } SubstateEncodingFlag = cli.StringFlag{ Name: "substate-encoding", Usage: "select encoding when reading substate from disk: rlp (default) or protobuf", Value: "protobuf", } TraceFlag = cli.BoolFlag{ Name: "trace", Usage: "enable tracing", } TraceDebugFlag = cli.BoolFlag{ Name: "trace-debug", Usage: "enable debug output for tracing", } TraceFileFlag = cli.PathFlag{ Name: "trace-file", Usage: "set storage trace's output directory", Value: "./", } TraceDirectoryFlag = cli.PathFlag{ Name: "trace-dir", Usage: "set storage trace directory", } UpdateDbFlag = cli.PathFlag{ Name: "update-db", Usage: "set update-set database directory", } UpdateTypeFlag = cli.StringFlag{ Name: "update-type", Usage: "select update type (\"stable\" or \"nightly\")", Value: "stable", } OperaBinaryFlag = cli.PathFlag{ Name: "opera-binary", Usage: "opera binary path", } ValidateFlag = cli.BoolFlag{ Name: "validate", Usage: "enables all validations", } ValidateTxStateFlag = cli.BoolFlag{ Name: "validate-tx", Usage: "enables validation after transaction processing", } EvmImplementation = cli.StringFlag{ Name: "evm-impl", Usage: "select EVM implementation", Value: "opera", } VmImplementation = cli.StringFlag{ Name: "vm-impl", Usage: "select VM implementation", Value: "geth", } MaxNumTransactionsFlag = cli.IntFlag{ Name: "max-tx", Usage: "limit the maximum number of processed transactions, default: unlimited", Value: -1, } OutputFlag = cli.PathFlag{ Name: "output", Usage: "output path", } PortFlag = cli.StringFlag{ Name: "port", Aliases: []string{"v"}, Usage: "enable visualization on `PORT`", DefaultText: "8080", } DeleteSourceDbsFlag = cli.BoolFlag{ Name: "delete-source-dbs", Usage: "delete source databases while merging into one database", Value: false, } CompactDbFlag = cli.BoolFlag{ Name: "compact", Usage: "compact target database", Value: false, } AidaDbFlag = cli.PathFlag{ Name: "aida-db", Usage: "set substate, updateset and deleted accounts directory", Required: true, } ContractNumberFlag = cli.Int64Flag{ Name: "num-contracts", Usage: "Number of contracts to create", Value: 1_000, } KeysNumberFlag = cli.Int64Flag{ Name: "num-keys", Usage: "Number of keys to generate", Value: 1_000, } ValuesNumberFlag = cli.Int64Flag{ Name: "num-values", Usage: "Number of values to generate", Value: 1_000, } TransactionLengthFlag = cli.Uint64Flag{ Name: "transaction-length", Usage: "Determines indirectly the length of a transaction", Value: 10, } SnapshotDepthFlag = cli.IntFlag{ Name: "snapshot-depth", Usage: "Depth of snapshot history", Value: 100, } ClientDbFlag = cli.PathFlag{ Name: "db", Aliases: []string{"datadir"}, Usage: "Path to the opera database", } GenesisFlag = cli.PathFlag{ Name: "genesis", Usage: "Path to genesis file", } EthTestTypeFlag = cli.IntFlag{ Name: "eth-test-type", Usage: "1 - state tests, 2 - block-chain tests", Value: 1, } TargetDbFlag = cli.PathFlag{ Name: "target-db", Usage: "target database path", } IncludeStorageFlag = cli.BoolFlag{ Name: "include-storage", Usage: "display full storage content", } ProfileEVMCallFlag = cli.BoolFlag{ Name: "profiling-call", Usage: "enable profiling for EVM call", } MicroProfilingFlag = cli.BoolFlag{ Name: "micro-profiling", Usage: "enable micro-profiling of EVM", } BasicBlockProfilingFlag = cli.BoolFlag{ Name: "basic-block-profiling", Usage: "enable profiling of basic block", } OnlySuccessfulFlag = cli.BoolFlag{ Name: "only-successful", Usage: "only runs transactions that have been successful", } ProfilingDbNameFlag = cli.StringFlag{ Name: "profiling-db-name", Usage: "set a database name for storing micro-profiling results", Value: "./profiling.db", } ChannelBufferSizeFlag = cli.IntFlag{ Name: "buffer-size", Usage: "set a buffer size for profiling channel", Value: 100_000, } UpdateBufferSizeFlag = cli.Uint64Flag{ Name: "update-buffer-size", Usage: "buffer size for holding update set in MB", Value: 1_000_000, } TargetEpochFlag = cli.Uint64Flag{ Name: "target-epoch", Aliases: []string{"epoch"}, Usage: "target epoch ID", Value: 0, } MaxNumErrorsFlag = cli.IntFlag{ Name: "max-errors", Usage: "maximum number of errors when ContinueOnFailure is enabled, 0 is endless", Value: 10, } OverwritePreWorldStateFlag = cli.BoolFlag{ Name: "overwrite-pre-world-state", Usage: "if enabled and continue-on-failure is also enabled, this corrects any error found in StateDb", Value: false, } 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", } TrackProgressFlag = cli.BoolFlag{ Name: "track-progress", Usage: "enables track progress logging", } TrackerGranularityFlag = cli.IntFlag{ Name: "tracker-granularity", Usage: "chooses how often will tracker report achieved block", Value: 100_000, } ValidateStateHashesFlag = cli.BoolFlag{ Name: "validate-state-hash", Usage: "enables state hash validation", } ProfileBlocksFlag = cli.BoolFlag{ Name: "profile-blocks", Usage: "enables block profiling", } ProfileDBFlag = cli.PathFlag{ Name: "profile-db", Usage: "defines path to profile-db", Value: "/var/opera/Aida/profile.db", } ErrorLoggingFlag = cli.PathFlag{ Name: "err-logging", Usage: "defines path to error-log-file where any PROCESSING error is recorded", } ForkFlag = cli.StringFlag{ Name: "fork", Usage: "defines a fork to get executed by the eth-tests (\"all\", \"osaka\", \"prague\", \"cancun\", \"shanghai\", \"paris\", \"bellatrix\", \"grayglacier\", \"arrowglacier\", \"altair\", \"london\", \"berlin\", \"istanbul\", \"muirglacier\")", Value: "All", } DbComponentFlag = cli.StringFlag{ Name: "db-component", Usage: "db component to be used (\"all\", \"substate\", \"delete\", \"update\", \"state-hash\", \"block-hash\", \"exception\")", Required: true, } TxGeneratorTypeFlag = cli.StringSliceFlag{ Name: "tx-type", Usage: "list of tx generator application type (\"all\" | <\"erc20\", \"counter\", \"store\", \"uniswap\">)", Value: cli.NewStringSlice("all"), } WorkersFlag = cli.IntFlag{ Name: "workers", Aliases: []string{"w"}, Usage: "determines number of workers", Value: 4, } )
Command line options for common flags in record and replay.
var AllowedChainIDs = ChainIDs{ SonicMainnetChainID: "mainnet-sonic", OperaMainnetChainID: "mainnet-opera", OperaTestnetChainID: "testnet", EthereumChainID: "ethereum", HoleskyChainID: "holesky", HoodiChainID: "hoodi", SepoliaChainID: "sepolia", EthTestsChainID: "eth-tests", }
var ErrRPCUnsupported = fmt.Errorf("chain-id is not supported")
var EthereumChainIDs = ChainIDs{ EthereumChainID: "ethereum", HoleskyChainID: "holesky", HoodiChainID: "hoodi", SepoliaChainID: "sepolia", EthTestsChainID: "eth-tests", }
var GitCommit = "0000000000000000000000000000000000000000"
GitCommit represents the GitHub commit hash the app was built from.
var KeywordBlocks = map[ChainID]map[string]uint64{ SonicMainnetChainID: { "zero": 0, "opera": 0, "istanbul": 0, "muirglacier": 0, "berlin": 0, "london": 0, "shanghai": 0, "cancun": 0, "prague": 1764165761, "osaka": maxLastBlock, "BPO1": maxLastBlock, "BPO2": maxLastBlock, "first": 0, "last": maxLastBlock, "lastpatch": 0, }, OperaMainnetChainID: { "zero": 0, "opera": 4_564_026, "istanbul": 0, "muirglacier": 0, "berlin": 37_455_223, "london": 37_534_833, "shanghai": maxLastBlock, "cancun": maxLastBlock, "first": 0, "last": maxLastBlock, "lastpatch": 0, }, OperaTestnetChainID: { "zero": 0, "opera": 479_327, "istanbul": 0, "muirglacier": 0, "berlin": 1_559_470, "london": 7_513_335, "shanghai": maxLastBlock, "cancun": maxLastBlock, "first": 0, "last": maxLastBlock, "lastpatch": 0, }, EthereumChainID: { "zero": 0, "opera": 0, "istanbul": 9_069_000, "muirglacier": 9_200_000, "berlin": 12_244_000, "london": 12_965_000, "shanghai": 1681338455, "cancun": 1710338135, "prague": 1746612311, "osaka": 1764798551, "BPO1": 1765290071, "BPO2": 1767747671, "first": 0, "last": maxLastBlock, "lastpatch": 0, }, HoleskyChainID: { "zero": 0, "opera": 0, "istanbul": 0, "muirglacier": maxLastBlock, "berlin": 0, "london": 0, "shanghai": 1696000704, "cancun": 1707305664, "prague": 1740434112, "osaka": 1759308480, "BPO1": 1759800000, "BPO2": 1760389824, "first": 0, "last": maxLastBlock, "lastpatch": 0, }, HoodiChainID: { "zero": 0, "opera": 0, "istanbul": 0, "muirglacier": 0, "berlin": 0, "london": 0, "shanghai": 0, "cancun": 0, "prague": 1742999832, "osaka": 1761677592, "BPO1": 1762365720, "BPO2": 1762955544, "first": 0, "last": maxLastBlock, "lastpatch": 0, }, SepoliaChainID: { "zero": 0, "opera": 0, "istanbul": 0, "muirglacier": 0, "berlin": 0, "london": 0, "shanghai": 1677557088, "cancun": 1706655072, "prague": 1741159776, "osaka": 1760427360, "BPO1": 1761017184, "BPO2": 1761607008, "first": 0, "last": maxLastBlock, "lastpatch": 0, }, EthTestsChainID: {}, }
A map of key blocks on Fantom chain
var RealChainIDs = ChainIDs{ SonicMainnetChainID: "mainnet-sonic", OperaMainnetChainID: "mainnet-opera", OperaTestnetChainID: "testnet", EthereumChainID: "ethereum", HoleskyChainID: "holesky", HoodiChainID: "hoodi", SepoliaChainID: "sepolia", }
Functions ¶
func CreateTestSubstateDb ¶
func CreateTestSubstateDb(t *testing.T, encoding substateDb.SubstateEncodingSchema) (*substate.Substate, string)
CreateTestSubstateDb creates a test substate database with a predefined substate.
func DownloadTestDataset ¶
func FindBlockRangeInSubstate ¶
func FindBlockRangeInSubstate(db db.SubstateDB) (uint64, uint64, bool)
FindBlockRangeInSubstate if AidaDb does not yet have metadata
func FindEpochNumber ¶
FindEpochNumber via RPC request GetBlockByNumber
func FindHeadEpochNumber ¶
FindHeadEpochNumber via RPC request GetBlockByNumber
func GetDirectorySize ¶
GetDirectorySize iterates over all files inside given directory (including subdirectories) and returns size in bytes.
func GetFilesWithinDirectories ¶
GetFilesWithinDirectories iterates all paths and returns array of paths of every file within these paths. Note: Files inside any subdirectories are included.
func GetFreeSpace ¶
GetFreeSpace returns the amount of free space in bytes on the filesystem containing the given path.
func GetProvider ¶
func GetTestSubstate ¶
func HasStateHashPatch ¶
HasStateHashPatch checks whether given db has already acquired patch with StateHashes.
func IsEthereumNetwork ¶
IsEthereumNetwork checks if the chainID is an Ethereum network - mainnet, holesky, hoodi or sepolia. Special conditions for miner rewards and validation are applied.
func MakeAccountStorage ¶
MakeAccountStorage generates randomized account storage with testAccountStorageSize length
func MakeRandomByteSlice ¶
MakeRandomByteSlice creates byte slice of given length with randomized values
func MakeWorldState ¶
MakeWorldState generates randomized world state containing 100 accounts
func MemoryBreakdown ¶
MemoryBreakdown prints memory usage details of statedb if applicable
func NewConfigContext ¶
func OverwriteStateDB ¶
func OverwriteStateDB(patch txcontext.WorldState, db state.VmStateDB)
OverwriteStateDB overwrites the StateDb with the expected state.
func PrepareBlockCtx ¶
func PrepareBlockCtx(inputEnv txcontext.BlockEnvironment, hashError *error) *vm.BlockContext
PrepareBlockCtx creates a block context for evm call from given BlockEnvironment.
func PrepareStateDB ¶
PrepareStateDB creates stateDB or load existing stateDB Use this function when both opening existing and creating new StateDB
func PrintEvmStatistics ¶
func PrintEvmStatistics(cfg *Config)
PrintEvmStatistics prints EVM implementation specific statical information to the console. Does nothing, if such information is not offered.
func ProcessCloneLikeMetadata ¶
func ProcessCloneLikeMetadata(aidaDb db.BaseDB, typ AidaDbType, logLevel string, firstBlock, lastBlock uint64, chainID ChainID) error
ProcessCloneLikeMetadata inserts every metadata from sourceDb, only epochs are excluded. We can't be certain if given epoch is whole
func ProcessGenLikeMetadata ¶
func ProcessPatchLikeMetadata ¶
func ProcessPatchLikeMetadata(aidaDb db.BaseDB, logLevel string, firstBlock, lastBlock, firstEpoch, lastEpoch uint64, chainID ChainID, isNew bool, dbHash []byte) error
ProcessPatchLikeMetadata decides whether patch is new or not. If so the DbType is Set to GenType, otherwise its PatchType. Then it inserts all given metadata
func RenameTempStateDbDirectory ¶
RenameTempStateDbDirectory renames a temp directory to a meaningful name
func SendRpcRequest ¶
func SendRpcRequest(payload JsonRPCRequest, chainId ChainID) (map[string]interface{}, error)
func SetBlockRange ¶
SetBlockRange checks the validity of a block range and return the first and last block as numbers.
func StartCPUProfile ¶
func StartMemoryProfile ¶
func StopCPUProfile ¶
func StopCPUProfile(cfg *Config)
func ToTitleCase ¶
ToTitleCase adjusts fork names to title case. If the input string contains word glacier anywhere in the string, the word is replaced by "Glacier".
Types ¶
type AidaDbMetadata ¶
type AidaDbMetadata struct {
Db db.BaseDB
FirstBlock, LastBlock uint64
FirstEpoch, LastEpoch uint64
ChainId ChainID
DbType AidaDbType
// contains filtered or unexported fields
}
AidaDbMetadata holds any information about AidaDb needed for putting it into the Db
func NewAidaDbMetadata ¶
func NewAidaDbMetadata(db db.BaseDB, logLevel string) *AidaDbMetadata
NewAidaDbMetadata creates new instance of AidaDbMetadata
func ProcessMergeMetadata ¶
func ProcessMergeMetadata(cfg *Config, aidaDb db.BaseDB, sourceDbs []db.BaseDB, paths []string) (*AidaDbMetadata, error)
ProcessMergeMetadata decides the type according to the types of merged Dbs and inserts every metadata
func (*AidaDbMetadata) CheckUpdateMetadata ¶
func (md *AidaDbMetadata) CheckUpdateMetadata(cfg *Config, patchDb db.BaseDB) error
CheckUpdateMetadata goes through metadata of updated AidaDb and its patch, looks if blocks and epoch align and if chainIDs are same for both Dbs
func (*AidaDbMetadata) DeleteMetadata ¶
func (md *AidaDbMetadata) DeleteMetadata()
func (*AidaDbMetadata) GetChainID ¶
func (md *AidaDbMetadata) GetChainID() ChainID
GetChainID and return it
func (*AidaDbMetadata) GetDbHash ¶
func (md *AidaDbMetadata) GetDbHash() []byte
GetDbHash and return it
func (*AidaDbMetadata) GetDbType ¶
func (md *AidaDbMetadata) GetDbType() AidaDbType
GetDbType and return it
func (*AidaDbMetadata) GetFirstBlock ¶
func (md *AidaDbMetadata) GetFirstBlock() uint64
GetFirstBlock and return it
func (*AidaDbMetadata) GetFirstEpoch ¶
func (md *AidaDbMetadata) GetFirstEpoch() uint64
GetFirstEpoch and return it
func (*AidaDbMetadata) GetLastBlock ¶
func (md *AidaDbMetadata) GetLastBlock() uint64
GetLastBlock and return it
func (*AidaDbMetadata) GetLastEpoch ¶
func (md *AidaDbMetadata) GetLastEpoch() uint64
GetLastEpoch and return it
func (*AidaDbMetadata) GetMetadata ¶
func (md *AidaDbMetadata) GetMetadata()
GetMetadata from given Db and save it
func (*AidaDbMetadata) GetTimestamp ¶
func (md *AidaDbMetadata) GetTimestamp() uint64
GetTimestamp and return it
func (*AidaDbMetadata) SetAllMetadata ¶
func (md *AidaDbMetadata) SetAllMetadata(firstBlock uint64, lastBlock uint64, firstEpoch uint64, lastEpoch uint64, chainID ChainID, dbHash []byte, dbType AidaDbType) error
SetAllMetadata in given Db
func (*AidaDbMetadata) SetBlockRange ¶
func (md *AidaDbMetadata) SetBlockRange(firstBlock uint64, lastBlock uint64) error
func (*AidaDbMetadata) SetChainID ¶
func (md *AidaDbMetadata) SetChainID(chainID ChainID) error
SetChainID in given Db
func (*AidaDbMetadata) SetDbHash ¶
func (md *AidaDbMetadata) SetDbHash(dbHash []byte) error
SetDbHash in given Db
func (*AidaDbMetadata) SetDbType ¶
func (md *AidaDbMetadata) SetDbType(dbType AidaDbType) error
SetDbType in given Db
func (*AidaDbMetadata) SetFirstBlock ¶
func (md *AidaDbMetadata) SetFirstBlock(firstBlock uint64) error
SetFirstBlock in given Db
func (*AidaDbMetadata) SetFirstEpoch ¶
func (md *AidaDbMetadata) SetFirstEpoch(firstEpoch uint64) error
SetFirstEpoch in given Db
func (*AidaDbMetadata) SetFreshMetadata ¶
func (md *AidaDbMetadata) SetFreshMetadata(chainID ChainID) error
SetFreshMetadata for an existing AidaDb without metadata
func (*AidaDbMetadata) SetHasHashPatch ¶
func (md *AidaDbMetadata) SetHasHashPatch() error
SetHasHashPatch marks AidaDb that it already has HashPatch merged so it will not get downloaded next update.
func (*AidaDbMetadata) SetLastBlock ¶
func (md *AidaDbMetadata) SetLastBlock(lastBlock uint64) error
SetLastBlock in given Db
func (*AidaDbMetadata) SetLastEpoch ¶
func (md *AidaDbMetadata) SetLastEpoch(lastEpoch uint64) error
SetLastEpoch in given Db
func (*AidaDbMetadata) SetTimestamp ¶
func (md *AidaDbMetadata) SetTimestamp() error
SetTimestamp in given Db
func (*AidaDbMetadata) SetUpdatesetInterval ¶
func (md *AidaDbMetadata) SetUpdatesetInterval(val uint64) error
func (*AidaDbMetadata) SetUpdatesetSize ¶
func (md *AidaDbMetadata) SetUpdatesetSize(val uint64) error
func (*AidaDbMetadata) UpdateMetadataInOldAidaDb ¶
func (md *AidaDbMetadata) UpdateMetadataInOldAidaDb(chainId ChainID, firstAidaDbBlock uint64, lastAidaDbBlock uint64) error
UpdateMetadataInOldAidaDb Sets metadata necessary for update in old aida-db, which doesn't have any metadata
type AidaDbType ¶
type AidaDbType byte
const ( NoType AidaDbType = iota GenType PatchType CloneType CustomType )
type ArgsBuilder ¶
type ArgsBuilder struct {
// contains filtered or unexported fields
}
ArgsBuilder helps create []string for CLI testing in a type-safe way
func NewArgs ¶
func NewArgs(cmd string) *ArgsBuilder
func (*ArgsBuilder) Arg ¶
func (b *ArgsBuilder) Arg(value interface{}) *ArgsBuilder
func (*ArgsBuilder) Build ¶
func (b *ArgsBuilder) Build() []string
func (*ArgsBuilder) Flag ¶
func (b *ArgsBuilder) Flag(name string, value interface{}) *ArgsBuilder
type ArgumentMode ¶
type ArgumentMode int
const ( BlockRangeArgs ArgumentMode = iota // requires 2 arguments: first block and last block LastBlockArg // requires 1 argument: last block NoArgs // requires no arguments OneToNArgs // requires at least one argument, but accepts up to N PathArg // requires 1 argument: path to file )
An enums of argument modes used by trace subcommands
type ChainID ¶
type ChainID int64
ChainID is typed int64 same as in go-ethereum
const ( UnknownChainID ChainID = 0 EthereumChainID ChainID = 1 SonicMainnetChainID ChainID = 146 OperaMainnetChainID ChainID = 250 OperaTestnetChainID ChainID = 4002 HoleskyChainID ChainID = 17000 HoodiChainID ChainID = 560048 SepoliaChainID ChainID = 11155111 // EthTestsChainID is a mock ChainID which is necessary for setting // the chain rules to allow any block number for any fork. EthTestsChainID ChainID = 1337 )
type Config ¶
type Config struct {
// command
AppName string
CommandName string
// block range
First uint64 // first block
Last uint64 // last block
// global configs
AidaDb string // directory to profiling database containing substate, update, delete accounts data
ArchiveMaxQueryAge int // the maximum age for archive queries (in blocks)
ArchiveMode bool // enable archive mode
ArchiveQueryRate int // the queries per second send to the archive
ArchiveVariant string // selects the implementation variant of the archive
ArgPath string // path to file or directory given as argument
BalanceRange int64 // balance range for stochastic simulation/replay
BasicBlockProfiling bool // enable profiling of basic block
BlockLength uint64 // length of a block in number of transactions
CPUProfile string // pprof cpu profile output file name
CPUProfilePerInterval bool // a different CPU profile is taken per 100k block interval
Cache int // Cache for StateDb or Priming
CarmenCheckpointInterval int // how often (in blocks) will Carmen create checkpoints
CarmenCheckpointPeriod int // how often (in minutes) will Carmen create checkpoints
CarmenNodeCacheSize int // the size of the in-memory cache to be used by a Carmen LiveDB in byte (0 for default value)
CarmenSchema int // the current DB schema ID to use in Carmen
CarmenStateCacheSize int // the number of values cached in the Carmen StateDB (0 for default value)
ChainID ChainID // Blockchain ID (mainnet: 250/testnet: 4002)
ChannelBufferSize int // set a buffer size for profiling channel
CompactDb bool // compact database after merging
ContinueOnFailure bool // continue validation when an error detected
ContractNumber int64 // number of contracts to create
CustomDbName string // name of state-db directory
DbComponent string // options for util-db info are 'all', 'substate', 'delete', 'update', 'state-hash', 'exception'
DbImpl string // storage implementation
DbLogging string // set to true if all DB operations should be logged
DeltaLogging string // path to delta-debugger formatted DB log file
DbTmp string // path to temporary database
DbVariant string // database variant
Debug bool // enable trace debug flag
DebugFrom uint64 // the first block to print trace debug
DeleteSourceDbs bool // delete source databases
DeletionDb string // directory of deleted account database
DiagnosticServer int64 // if not zero, the port used for hosting a HTTP server for performance diagnostics
ErrorLogging string // if defined, error logging to file is enabled
EthTestType EthTestType // which geth test are we running
EvmImpl string // processor implementation
Fork string // Which forks are going to get executed byz
Genesis string // genesis file
IncludeStorage bool // represents a flag for contract storage inclusion in an operation
IsExistingStateDb bool // this is true if we are using an existing StateDb
KeepDb bool // set to true if db is kept after run
KeysNumber int64 // number of keys to generate
LogLevel string // level of the logging of the app action
MaxNumErrors int // maximum number of errors when ContinueOnFailure is enabled
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
MicroProfiling bool // enable micro-profiling of EVM
NoHeartbeatLogging bool // disables heartbeat logging
NonceRange int // nonce range for stochastic simulation/replay
OnlySuccessful bool // only runs transactions that have been successful
OperaBinary string // path to opera binary
ClientDb string // path to client database
Output string // output directory for aida-db patches or path to events.json file in stochastic generation
OverwriteRunId string // when registering runs, use provided id instead of the autogenerated run id
PathToStateDb string // Path to a working state-db directory
PrimeRandom bool // enable randomized priming
PrimeThreshold int // set account threshold before commit
Profile bool // enable micro profiling
ProfileBlocks bool // enables block profiler extension
ProfileDB string // profile db for parallel transaction execution
ProfileDepth int // 0 = Interval, 1 = Interval+Block, 2 = Interval+Block+Tx
ProfileEVMCall bool // enable profiling for EVM call
ProfileFile string // output file containing profiling result
ProfileInterval uint64 // interval of printing profile result
ProfileSqlite3 string // output profiling results to sqlite3 DB
ProfilingDbName string // set a database name for storing micro-profiling results
RandomSeed int64 // set random seed for stochastic testing
EnableCoverage bool // enable coverage-guided fuzzing
CoverageSnapshotInterval int // number of operations between coverage snapshots
RegisterRun string // register run to the provided connection string
RpcRecordingPath string // path to source file (or dir with files) with recorded RPC requests
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
SkipMetadata bool // skip metadata insert/getting into AidaDb
SkipPriming bool // skip priming of the state DB
SkipStateHashScrapping bool // if enabled, then state-hashes are not loaded from rpc
SnapshotDepth int // depth of snapshot history
StateDbSrc string // directory to load an existing State DB data
StateDbSrcDirectAccess bool // if true, read and write directly from the source database
StateDbSrcReadOnly bool // if true, source database is not modified
StateValidationMode ValidationMode // state validation mode
SubstateDb string // substate directory
SubstateEncoding db.SubstateEncodingSchema // rlp (default) or protobuf - when reading from disk
SyncPeriodLength uint64 // length of a sync-period in number of blocks
TargetDb string // represents the path of a target DB
TargetEpoch uint64 // represents the ID of target epoch to be reached by autogen patch generator
Trace bool // trace flag
TraceDirectory string // name of trace directory
TraceFile string // name of trace file
TrackProgress bool // enables track progress logging
TrackerGranularity int // defines how often will tracker report achieved block
TransactionLength uint64 // determines indirectly the length of a transaction
TxGeneratorType []string // type of the application used for transaction generation
UpdateBufferSize uint64 // cache size in Bytes
UpdateDb string // update-set directory
OverwritePreWorldState bool // instead of validation of StateDb we overwrite it with the provided data
UpdateType string // download datatype
Validate bool // validate validate aida-db
ValidateStateHashes bool // if this is true state hash validation is enabled in Executor
ValidateTxState bool // validate stateDB before and after transaction
ValuesNumber int64 // number of values to generate
VmImpl string // vm implementation (geth/lfvm)
Workers int // number of worker threads
// -- cached results --
ChainCfg *params.ChainConfig // cached chain configuration
VmCfg vm.Config
// contains filtered or unexported fields
}
Config represents execution configuration for Aida tools.
func MakeTestConfig ¶
func MakeTestConfig(testCase StateDbTestCase) *Config
MakeTestConfig creates a config struct for testing
func NewConfig ¶
func NewConfig(ctx *cli.Context, mode ArgumentMode) (*Config, error)
NewConfig creates and initializes Config with commandline arguments.
func NewTestConfig ¶
func NewTestConfig(t *testing.T, chainId ChainID, first, last uint64, validate bool, fork string) *Config
NewTestConfig creates a new config for test purpose
func (*Config) GetChainConfig ¶
func (cfg *Config) GetChainConfig(fork string) (*params.ChainConfig, error)
func (*Config) GetInterpreterFactory ¶
func (cfg *Config) GetInterpreterFactory() (vm.InterpreterFactory, error)
func (*Config) SetStateDbSrcReadOnly ¶
func (cfg *Config) SetStateDbSrcReadOnly()
type Event ¶
type Event interface {
// HasHappened returns whether the event has already occurred or not.
HasHappened() bool
// Wait provides a channel which will be closed once the event occurred.
Wait() <-chan struct{}
// Signal triggers the event.
Signal()
}
Event is a synchronization primitive for signaling the occurrence of a one-time event. The life cycle of each event is divided in two phases: the time before and the time after the event.
event := MakeEvent() // The event has not yet occurred event.Signal() // The event has occurred, any further signaling has no effect
Signaling and checking whether the event has occurred is thread safe. Furthermore, goroutines may wait for the occurrence of the event through a provided channel.
type Interval ¶
type Interval struct {
// contains filtered or unexported fields
}
func NewInterval ¶
type JsonRPCRequest ¶
type MockIFlusher ¶
type MockIFlusher struct {
// contains filtered or unexported fields
}
MockIFlusher is a mock of IFlusher interface.
func NewMockIFlusher ¶
func NewMockIFlusher(ctrl *gomock.Controller) *MockIFlusher
NewMockIFlusher creates a new mock instance.
func (*MockIFlusher) EXPECT ¶
func (m *MockIFlusher) EXPECT() *MockIFlusherMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockIFlusherMockRecorder ¶
type MockIFlusherMockRecorder struct {
// contains filtered or unexported fields
}
MockIFlusherMockRecorder is the mock recorder for MockIFlusher.
func (*MockIFlusherMockRecorder) Close ¶
func (mr *MockIFlusherMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockIFlusherMockRecorder) Print ¶
func (mr *MockIFlusherMockRecorder) Print() *gomock.Call
Print indicates an expected call of Print.
type MockPrinter ¶
type MockPrinter struct {
// contains filtered or unexported fields
}
MockPrinter is a mock of Printer interface.
func NewMockPrinter ¶
func NewMockPrinter(ctrl *gomock.Controller) *MockPrinter
NewMockPrinter creates a new mock instance.
func (*MockPrinter) EXPECT ¶
func (m *MockPrinter) EXPECT() *MockPrinterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockPrinterMockRecorder ¶
type MockPrinterMockRecorder struct {
// contains filtered or unexported fields
}
MockPrinterMockRecorder is the mock recorder for MockPrinter.
func (*MockPrinterMockRecorder) Close ¶
func (mr *MockPrinterMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockPrinterMockRecorder) Print ¶
func (mr *MockPrinterMockRecorder) Print() *gomock.Call
Print indicates an expected call of Print.
type MockShellExecutor ¶
type MockShellExecutor struct {
// contains filtered or unexported fields
}
MockShellExecutor is a mock of ShellExecutor interface.
func NewMockShellExecutor ¶
func NewMockShellExecutor(ctrl *gomock.Controller) *MockShellExecutor
NewMockShellExecutor creates a new mock instance.
func (*MockShellExecutor) Command ¶
func (m *MockShellExecutor) Command(name string, arg ...string) ([]byte, error)
Command mocks base method.
func (*MockShellExecutor) EXPECT ¶
func (m *MockShellExecutor) EXPECT() *MockShellExecutorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockShellExecutorMockRecorder ¶
type MockShellExecutorMockRecorder struct {
// contains filtered or unexported fields
}
MockShellExecutorMockRecorder is the mock recorder for MockShellExecutor.
type PatchJson ¶
type PatchJson struct {
FileName string
FromBlock, ToBlock uint64
FromEpoch, ToEpoch uint64
DbHash, TarHash string
Nightly bool
}
PatchJson represents struct of JSON file where information about patches is written
func DownloadPatchesJson ¶
DownloadPatchesJson downloads list of available patches from aida-db generation server.
type PrinterToBuffer ¶
type PrinterToBuffer struct {
// contains filtered or unexported fields
}
func (*PrinterToBuffer) Close ¶
func (p *PrinterToBuffer) Close() error
func (*PrinterToBuffer) Length ¶
func (p *PrinterToBuffer) Length() int
func (*PrinterToBuffer) Print ¶
func (p *PrinterToBuffer) Print() error
func (*PrinterToBuffer) Reset ¶
func (p *PrinterToBuffer) Reset()
type PrinterToDb ¶
type PrinterToDb struct {
// contains filtered or unexported fields
}
PrinterToDb writes by inserting rows into DB Wrap f, returns an array of values to be inserted
func NewPrinterToSqlite3 ¶
func (*PrinterToDb) Bufferize ¶
func (p *PrinterToDb) Bufferize(capacity int) (*PrinterToBuffer, *Flusher)
Bufferize split PrintToDB into 2 printers: 1. print to buffer 2. flush buffer to DB
func (*PrinterToDb) Close ¶
func (p *PrinterToDb) Close() error
func (*PrinterToDb) Print ¶
func (p *PrinterToDb) Print() error
type PrinterToFile ¶
type PrinterToFile struct {
// contains filtered or unexported fields
}
PrinterToFile writes to a File Wrap f, returns a string to be printed
func NewPrinterToFile ¶
func NewPrinterToFile(filepath string, f func() string) *PrinterToFile
func (*PrinterToFile) Close ¶
func (p *PrinterToFile) Close() error
func (*PrinterToFile) Print ¶
func (p *PrinterToFile) Print() (err error)
type PrinterToWriter ¶
type PrinterToWriter struct {
// contains filtered or unexported fields
}
PrinterToWriter writes to any io.Writer Wrap f, returns a string to be printed
func NewPrinterToConsole ¶
func NewPrinterToConsole(f func() string) *PrinterToWriter
func NewPrinterToWriter ¶
func NewPrinterToWriter(w io.Writer, f func() string) *PrinterToWriter
func (*PrinterToWriter) Close ¶
func (p *PrinterToWriter) Close() error
func (*PrinterToWriter) Print ¶
func (p *PrinterToWriter) Print() error
type Printers ¶
type Printers struct {
// contains filtered or unexported fields
}
func NewCustomPrinters ¶
func NewPrinters ¶
func NewPrinters() *Printers
func (*Printers) AddPrinter ¶
func (*Printers) AddPrinterToConsole ¶
func (*Printers) AddPrinterToFile ¶
func (*Printers) AddPrinterToSqlite3 ¶
func (*Printers) AddPrinterToWriter ¶
type ProgressTracker ¶
type ProgressTracker struct {
// contains filtered or unexported fields
}
func NewProgressTracker ¶
func NewProgressTracker(target int, log logger.Logger) *ProgressTracker
NewProgressTracker creates a new progress tracer
func (*ProgressTracker) PrintProgress ¶
func (pt *ProgressTracker) PrintProgress()
PrintProgress reports a priming rates and estimated time after n operations has been executed.
type ShellExecutor ¶
type StateDbInfo ¶
type StateDbInfo struct {
Impl string `json:"dbImpl"` // type of db engine
Variant string `json:"dbVariant"` // type of db variant
ArchiveMode bool `json:"archiveMode"` // archive mode
ArchiveVariant string `json:"archiveVariant"` // archive variant
Schema int `json:"schema"` // DB schema version used
Block uint64 `json:"block"` // last block height
RootHash common.Hash `json:"rootHash"` // root hash of the last block height
GitCommit string `json:"gitCommit"` // Aida git version when creating stateDB
CreateTime string `json:"createTimeUTC"` // time of creation in utc timezone
HasFinished bool `json:"HasFinished"` // True if run has finished without interrupting
}
StateDbInfo StateDB meta information
func ReadStateDbInfo ¶
func ReadStateDbInfo(dbpath string) (StateDbInfo, error)
ReadStateDbInfo reads meta file of loaded stateDB
type StateDbTestCase ¶
type StateDbTestCase struct {
Variant string
ShadowImpl string
ArchiveVariant string
// contains filtered or unexported fields
}
func GetStateDbTestCases ¶
func GetStateDbTestCases() []StateDbTestCase
type ValidationMode ¶
type ValidationMode int
Type of validation performs on stateDB during Tx processing.
const ( SubsetCheck ValidationMode = iota // confirms whether a substate is contained in stateDB. EqualityCheck // confirms whether a substate and StateDB are identical. )