Documentation ¶
Index ¶
Constants ¶
const ( DefaultURL = "http://localhost:8080" DefaultTimeout = 10 DefaultMaxRetries = 5 DefaultMaxOnlineConnections = 120 // most OS have a default limit of 128 DefaultMaxOfflineConnections = 4 // we shouldn't need many connections for construction DefaultMaxSyncConcurrency = 64 DefaultActiveReconciliationConcurrency = 16 DefaultInactiveReconciliationConcurrency = 4 DefaultInactiveReconciliationFrequency = 250 DefaultConfirmationDepth = 10 DefaultStaleDepth = 30 DefaultBroadcastLimit = 3 DefaultTipDelay = 300 DefaultBlockBroadcastLimit = 5 // ETH Defaults EthereumIDBlockchain = "Ethereum" EthereumIDNetwork = "Ropsten" )
Default Configuration Values
Variables ¶
var ( EthereumNetwork = &types.NetworkIdentifier{ Blockchain: EthereumIDBlockchain, Network: EthereumIDNetwork, } )
Default Configuration Values
Functions ¶
This section is empty.
Types ¶
type CheckDataEndCondition ¶ added in v0.5.0
type CheckDataEndCondition string
CheckDataEndCondition is a type of "successful" end for the "check:data" method.
const ( // IndexEndCondition is used to indicate that the index end condition // has been met. IndexEndCondition CheckDataEndCondition = "Index End Condition" // DurationEndCondition is used to indicate that the duration // end condition has been met. DurationEndCondition CheckDataEndCondition = "Duration End Condition" // TipEndCondition is used to indicate that the tip end condition // has been met. TipEndCondition CheckDataEndCondition = "Tip End Condition" // ReconciliationCoverageEndCondition is used to indicate that the reconciliation // coverage end condition has been met. ReconciliationCoverageEndCondition CheckDataEndCondition = "Reconciliation Coverage End Condition" )
type Configuration ¶
type Configuration struct { // Network is the *types.NetworkIdentifier where transactions should // be constructed and where blocks should be synced to monitor // for broadcast success. Network *types.NetworkIdentifier `json:"network"` // OnlineURL is the URL of a Rosetta API implementation in "online mode". OnlineURL string `json:"online_url"` // DataDirectory is a folder used to store logs and any data used to perform validation. DataDirectory string `json:"data_directory"` // HTTPTimeout is the timeout for a HTTP request in seconds. HTTPTimeout uint64 `json:"http_timeout"` // MaxRetries is the number of times we will retry an HTTP request. If retry_elapsed_time // is also populated, we may stop attempting retries early. MaxRetries uint64 `json:"max_retries"` // RetryElapsedTime is the total time to spend retrying a HTTP request in seconds. RetryElapsedTime uint64 `json:"retry_elapsed_time"` // MaxOnlineConnections is the maximum number of open connections that the online // fetcher will open. MaxOnlineConnections int `json:"max_online_connections"` // MaxSyncConcurrency is the maximum sync concurrency to use while syncing blocks. // Sync concurrency is managed automatically by the `syncer` package. MaxSyncConcurrency int64 `json:"max_sync_concurrency"` // TipDelay dictates how many seconds behind the current time is considered // tip. If we are > TipDelay seconds from the last processed block, // we are considered to be behind tip. TipDelay int64 `json:"tip_delay"` // LogConfiguration determines if the configuration settings // should be printed to the console when a file is loaded. LogConfiguration bool `json:"log_configuration"` Construction *ConstructionConfiguration `json:"construction"` Data *DataConfiguration `json:"data"` }
Configuration contains all configuration settings for running check:data or check:construction.
func DefaultConfiguration ¶
func DefaultConfiguration() *Configuration
DefaultConfiguration returns a *Configuration with the EthereumNetwork, DefaultURL, DefaultTimeout, DefaultConstructionConfiguration and DefaultDataConfiguration.
func LoadConfiguration ¶
func LoadConfiguration(filePath string) (*Configuration, error)
LoadConfiguration returns a parsed and asserted Configuration for running tests.
type ConstructionConfiguration ¶
type ConstructionConfiguration struct { // OfflineURL is the URL of a Rosetta API implementation in "offline mode". OfflineURL string `json:"offline_url"` // MaxOffineConnections is the maximum number of open connections that the offline // fetcher will open. MaxOfflineConnections int `json:"max_offline_connections"` // StaleDepth is the number of blocks to wait before attempting // to rebroadcast after not finding a transaction on-chain. StaleDepth int64 `json:"stale_depth"` // BroadcastLimit is the number of times to attempt re-broadcast // before giving up on a transaction broadcast. BroadcastLimit int `json:"broadcast_limit"` // IgnoreBroadcastFailures determines if we should exit when there // are broadcast failures (that surpass the BroadcastLimit). IgnoreBroadcastFailures bool `json:"ignore_broadcast_failures"` // ClearBroadcasts indicates if all pending broadcasts should // be removed from BroadcastStorage on restart. ClearBroadcasts bool `json:"clear_broadcasts"` // BroadcastBehindTip indicates if we should broadcast transactions // when we are behind tip (as defined by TipDelay). BroadcastBehindTip bool `json:"broadcast_behind_tip"` // BlockBroadcastLimit is the number of transactions to attempt // broadcast in a single block. When there are many pending // broadcasts, it may make sense to limit the number of broadcasts. BlockBroadcastLimit int `json:"block_broadcast_limit"` // RebroadcastAll indicates if all pending broadcasts should be // rebroadcast from BroadcastStorage on restart. RebroadcastAll bool `json:"rebroadcast_all"` // PrefundedAccounts is an array of prefunded accounts // to use while testing. PrefundedAccounts []*storage.PrefundedAccount `json:"prefunded_accounts,omitempty"` // Workflows are executed by the rosetta-cli to test // certain construction flows. Make sure to define a // "request_funds" and "create_account" workflow. Workflows []*job.Workflow `json:"workflows"` // EndConditions is a map of workflow:count that // indicates how many of each workflow should be performed // before check:construction should stop. For example, // {"create_account": 5} indicates that 5 "create_account" // workflows should be performed before stopping. EndConditions map[string]int `json:"end_conditions,omitempty"` // ResultsOutputFile is the absolute filepath of where to save // the results of a check:construction run. ResultsOutputFile string `json:"results_output_file,omitempty"` }
ConstructionConfiguration contains all configurations to run check:construction.
type DataConfiguration ¶
type DataConfiguration struct { // ActiveReconciliationConcurrency is the concurrency to use while fetching accounts // during active reconciliation. ActiveReconciliationConcurrency uint64 `json:"active_reconciliation_concurrency"` // InactiveReconciliationConcurrency is the concurrency to use while fetching accounts // during inactive reconciliation. InactiveReconciliationConcurrency uint64 `json:"inactive_reconciliation_concurrency"` // InactiveReconciliationFrequency is the number of blocks to wait between // inactive reconiliations on each account. InactiveReconciliationFrequency uint64 `json:"inactive_reconciliation_frequency"` // LogBlocks is a boolean indicating whether to log processed blocks. LogBlocks bool `json:"log_blocks"` // LogTransactions is a boolean indicating whether to log processed transactions. LogTransactions bool `json:"log_transactions"` // LogBalanceChanges is a boolean indicating whether to log all balance changes. LogBalanceChanges bool `json:"log_balance_changes"` // LogReconciliations is a boolean indicating whether to log all reconciliations. LogReconciliations bool `json:"log_reconciliations"` // IgnoreReconciliationError determines if block processing should halt on a reconciliation // error. It can be beneficial to collect all reconciliation errors or silence // reconciliation errors during development. IgnoreReconciliationError bool `json:"ignore_reconciliation_error"` // ExemptAccounts is a path to a file listing all accounts to exempt from balance // tracking and reconciliation. Look at the examples directory for an example of // how to structure this file. ExemptAccounts string `json:"exempt_accounts"` // BootstrapBalances is a path to a file used to bootstrap balances // before starting syncing. If this value is populated after beginning syncing, // it will be ignored. BootstrapBalances string `json:"bootstrap_balances"` // HistoricalBalanceEnabled is a boolean that dictates how balance lookup is performed. // When set to true, balances are looked up at the block where a balance // change occurred instead of at the current block. Blockchains that do not support // historical balance lookup should set this to false. HistoricalBalanceEnabled *bool `json:"historical_balance_enabled,omitempty"` // InterestingAccounts is a path to a file listing all accounts to check on each block. Look // at the examples directory for an example of how to structure this file. InterestingAccounts string `json:"interesting_accounts"` // ReconciliationDisabled is a boolean that indicates reconciliation should not // be attempted. When first testing an implementation, it can be useful to disable // some of the more advanced checks to confirm syncing is working as expected. ReconciliationDisabled bool `json:"reconciliation_disabled"` // InactiveDiscrepencySearchDisabled is a boolean indicating if a search // should be performed to find any inactive reconciliation discrepencies. // Note, a search will never be performed if historical balance lookup // is disabled. InactiveDiscrepencySearchDisabled bool `json:"inactive_discrepency_search_disabled"` // BalanceTrackingDisabled is a boolean that indicates balances calculation // should not be attempted. When first testing an implemenation, it can be // useful to just try to fetch all blocks before checking for balance // consistency. BalanceTrackingDisabled bool `json:"balance_tracking_disabled"` // CoinTrackingDisabled is a boolean that indicates coin (or UTXO) tracking // should not be attempted. When first testing an implemenation, it can be // useful to just try to fetch all blocks before checking for coin // consistency. CoinTrackingDisabled bool `json:"coin_tracking_disabled"` // StartIndex is the block height to start syncing from. If no StartIndex // is provided, syncing will start from the last saved block. // If no blocks have ever been synced, syncing will start from genesis. StartIndex *int64 `json:"start_index,omitempty"` // EndCondition contains the conditions for the syncer to stop EndConditions *DataEndConditions `json:"end_conditions,omitempty"` // ResultsOutputFile is the absolute filepath of where to save // the results of a check:data run. ResultsOutputFile string `json:"results_output_file"` // PruningDisabled is a bolean that indicates storage pruning should // not be attempted. This should really only ever be set to true if you // wish to use `start_index` at a later point to restart from some // previously synced block. PruningDisabled bool `json:"pruning_disabled"` }
DataConfiguration contains all configurations to run check:data.
func DefaultDataConfiguration ¶
func DefaultDataConfiguration() *DataConfiguration
DefaultDataConfiguration returns the default *DataConfiguration for running `check:data`.
type DataEndConditions ¶ added in v0.5.0
type DataEndConditions struct { // Index configures the syncer to stop once reaching a particular block height. Index *int64 `json:"index,omitempty"` // Tip configures the syncer to stop once it reached the tip. // Make sure to configure `tip_delay` if you use this end // condition. Tip *bool `json:"tip,omitempty"` // Duration configures the syncer to stop after running // for Duration seconds. Duration *uint64 `json:"duration,omitempty"` // ReconciliationCoverage configures the syncer to stop // once it has reached tip AND some proportion of // all addresses have been reconciled at an index >= // to when tip was first reached. The range of inputs // for this condition are [0.0, 1.0]. ReconciliationCoverage *float64 `json:"reconciliation_coverage,omitempty"` }
DataEndConditions contains all the conditions for the syncer to stop when running check:data.