Skip to content

Commit

Permalink
feat: check that old field is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
joanestebanr committed Sep 18, 2024
1 parent e54a3ad commit 9ab6491
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
32 changes: 29 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const (
FlagOutputFile = "output"
// FlagMaxAmount is the flag to avoid to use the flag FlagAmount
FlagMaxAmount = "max-amount"

deprecatedFieldSyncDB = "Aggregator.Synchronizer.DB is deprecated use Aggregator.Synchronizer.SQLDB instead"
)

type ForbiddenField struct {
Expand All @@ -62,8 +64,32 @@ type ForbiddenField struct {
var (
forbiddenFieldsOnConfig = []ForbiddenField{
{
FieldName: "Aggregator.Synchronizer.DB",
Reason: "Field deprecated use Aggregator.Synchronizer.SQLDB instead",
FieldName: "aggregator.synchronizer.db.port",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.host",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.enablelog",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.password",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.user",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.name",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.maxcoons",
Reason: deprecatedFieldSyncDB,
},
}
)
Expand Down Expand Up @@ -201,7 +227,7 @@ func Load(ctx *cli.Context) (*Config, error) {
if forbbidenInfo != nil {
log.Warnf("forbidden field %s in config file: %s", field, forbbidenInfo.Reason)
} else {
log.Warnf("unexpected field %s in config file", field)
log.Debugf("field %s in config file doesnt have a default value", field)
}
}
}
Expand Down
16 changes: 15 additions & 1 deletion config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ SequencerPrivateKey = {}
L1ChainID = 11155111
HTTPHeaders = []
[Aggregator.Synchronizer]
[Aggregator.Synchronizer.Log]
Environment = "development" # "production" or "development"
Level = "info"
Outputs = ["stderr"]
[Aggregator.Synchronizer.SQLDB]
DriverName = "sqlite3"
DataSourceName = "file:/tmp/aggregator_sync_db.sqlite"
Expand All @@ -117,9 +121,19 @@ SequencerPrivateKey = {}
BlockFinality = "finalized"
OverrideStorageCheck = false
[Aggregator.Synchronizer.Etherman]
L1URL = "http://localhost:8545"
ForkIDChunkSize = 100
L1ChainID = 0
[Aggregator.Synchronizer.Etherman.Validium]
Enabled = false
TrustedSequencerURL = ""
RetryOnDACErrorInterval = "1m"
DataSourcePriority = ["trusted", "external"]
[Aggregator.Synchronizer.Etherman.Validium.Translator]
FullMatchRules = []
[Aggregator.Synchronizer.Etherman.Validium.RateLimit]
NumRequests = 900
Interval = "1s"
[ReorgDetectorL1]
DBPath = "/tmp/reorgdetectorl1"
Expand Down

0 comments on commit 9ab6491

Please sign in to comment.