Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config consistency #266

Merged
merged 2 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import (
)

var (
startIndex = int64(89)
badStartIndex = int64(-10)
goodCoverage = float64(0.33)
badCoverage = float64(-2)
endTip = false
historicalEnabled = true
fakeWorkflows = []*job.Workflow{
startIndex = int64(89)
badStartIndex = int64(-10)
goodCoverage = float64(0.33)
badCoverage = float64(-2)
endTip = false
historicalDisabled = false
fakeWorkflows = []*job.Workflow{
{
Name: string(job.CreateAccount),
Concurrency: job.ReservedWorkflowConcurrency,
Expand All @@ -62,16 +62,16 @@ var (
Blockchain: "sweet",
Network: "sweeter",
},
OnlineURL: "http://hasudhasjkdk",
MaxOnlineConnections: 10,
HTTPTimeout: 21,
MaxRetries: 1000,
MaxSyncConcurrency: 12,
TipDelay: 1231,
MaxReorgDepth: 12,
SeenBlockWorkers: 300,
SerialBlockWorkers: 200,
ErrorStackTraceEnabled: true,
OnlineURL: "http://hasudhasjkdk",
MaxOnlineConnections: 10,
HTTPTimeout: 21,
MaxRetries: 1000,
MaxSyncConcurrency: 12,
TipDelay: 1231,
MaxReorgDepth: 12,
SeenBlockWorkers: 300,
SerialBlockWorkers: 200,
ErrorStackTraceDisabled: false,
Construction: &ConstructionConfiguration{
OfflineURL: "https://ashdjaksdkjshdk",
MaxOfflineConnections: 21,
Expand All @@ -92,7 +92,7 @@ var (
InactiveReconciliationConcurrency: 2938,
InactiveReconciliationFrequency: 3,
ReconciliationDisabled: false,
HistoricalBalanceEnabled: &historicalEnabled,
HistoricalBalanceDisabled: &historicalDisabled,
StartIndex: &startIndex,
StatusPort: 123,
EndConditions: &DataEndConditions{
Expand Down
12 changes: 6 additions & 6 deletions configuration/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ type DataConfiguration struct {
// 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
// HistoricalBalanceDisabled is a boolean that dictates how balance lookup is performed.
// When set to false, 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"`
// historical balance lookup should set this to true.
HistoricalBalanceDisabled *bool `json:"historical_balance_disabled,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.
Expand Down Expand Up @@ -421,9 +421,9 @@ type Configuration struct {
// specific validation will be done
ValidationFile string `json:"validation_file,omitempty"`

// ErrorStackTraceEnabled if true then it will print error stack trace
// ErrorStackTraceDisabled if false then it will print error stack trace
// if the data or construction check fails
ErrorStackTraceEnabled bool `json:"error_stack_trace_enabled"`
ErrorStackTraceDisabled bool `json:"error_stack_trace_disabled"`

Construction *ConstructionConfiguration `json:"construction"`
Data *DataConfiguration `json:"data"`
Expand Down
2 changes: 1 addition & 1 deletion examples/configuration/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"log_configuration": false,
"compression_disabled": false,
"memory_limit_disabled": false,
"error_stack_trace_enabled": false,
"error_stack_trace_disabled": false,
shrimalmadhur marked this conversation as resolved.
Show resolved Hide resolved
"construction": null,
"data": {
"active_reconciliation_concurrency": 16,
Expand Down
2 changes: 1 addition & 1 deletion examples/configuration/simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"http_timeout": 10,
"tip_delay": 300,
"data": {
"historical_balance_enabled": false,
"historical_balance_disabled": true,
"reconciliation_disabled": true,
"inactive_discrepancy_search_disabled": true,
"balance_tracking_disabled": true,
Expand Down
2 changes: 1 addition & 1 deletion pkg/results/construction_results.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func ExitConstruction(
jobStorage *modules.JobStorage,
err error,
) error {
if config.ErrorStackTraceEnabled {
if !config.ErrorStackTraceDisabled {
err = pkgError.WithStack(err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/results/data_results.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ func ExitData(
endCondition configuration.CheckDataEndCondition,
endConditionDetail string,
) error {
if config.ErrorStackTraceEnabled {
if !config.ErrorStackTraceDisabled {
err = pkgError.WithStack(err)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/tester/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ func InitializeData(

// Determine if we should perform historical balance lookups
var historicalBalanceEnabled bool
if config.Data.HistoricalBalanceEnabled != nil {
historicalBalanceEnabled = *config.Data.HistoricalBalanceEnabled
if config.Data.HistoricalBalanceDisabled != nil {
historicalBalanceEnabled = !*config.Data.HistoricalBalanceDisabled
} else { // we must look it up
historicalBalanceEnabled = networkOptions.Allow.HistoricalBalanceLookup
}
Expand Down