disable BareExcept warnings (#4662)

* disable BareExcept warnings

* BareExcept only exists in >= 1.6.11
This commit is contained in:
tersec 2023-02-24 19:50:46 +00:00 committed by GitHub
parent e21742a325
commit 2dd2a782d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 24 deletions

View File

@ -499,8 +499,7 @@ proc getBestUpdate*(
doAssert period.isSupportedBySQLite
var update: (int64, seq[byte])
template body: untyped =
res.expect("SQL query OK")
proc processUpdate(): ForkedLightClientUpdate =
try:
withAll(LightClientDataFork):
when lcDataFork > LightClientDataFork.None:
@ -519,12 +518,13 @@ proc getBestUpdate*(
if distinctBase(db.bestUpdates.getStmt) != nil:
for res in db.bestUpdates.getStmt.exec(period.int64, update):
body
elif distinctBase(db.legacyBestUpdates.getStmt) != nil:
res.expect("SQL query OK")
return processUpdate()
if distinctBase(db.legacyBestUpdates.getStmt) != nil:
for res in db.legacyBestUpdates.getStmt.exec(period.int64, update):
body
else:
return default(ForkedLightClientUpdate)
res.expect("SQL query OK")
return processUpdate()
default(ForkedLightClientUpdate)
func putBestUpdate*(
db: LightClientDataDB, period: SyncCommitteePeriod,

View File

@ -989,16 +989,12 @@ proc getLightClientBootstrap*(
return default(ForkedLightClientBootstrap)
# Try to load from cache
template tryFromCache(lcDataFork: static LightClientDataFork): untyped =
block:
withAll(LightClientDataFork):
when lcDataFork > LightClientDataFork.None:
let header = getHeader[lcDataFork.LightClientHeader](
dag.lcDataStore.db, blockRoot)
if header.isOk:
return dag.getLightClientBootstrap(header.get)
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
tryFromCache(LightClientDataFork.EIP4844)
tryFromCache(LightClientDataFork.Capella)
tryFromCache(LightClientDataFork.Altair)
# Fallback to DAG
let bdata = dag.getForkedBlock(blockRoot).valueOr:

View File

@ -147,8 +147,7 @@ proc getLatestFinalizedHeader*(
const key = LightClientHeaderKey.Finalized
var header: (int64, seq[byte])
template body: untyped =
res.expect("SQL query OK")
proc processHeader(): ForkedLightClientHeader =
try:
withAll(LightClientDataFork):
when lcDataFork > LightClientDataFork.None:
@ -167,12 +166,13 @@ proc getLatestFinalizedHeader*(
if distinctBase(db.headers.getStmt) != nil:
for res in db.headers.getStmt.exec(key.int64, header):
body
elif distinctBase(db.legacyHeaders.getStmt) != nil:
res.expect("SQL query OK")
return processHeader()
if distinctBase(db.legacyHeaders.getStmt) != nil:
for res in db.legacyHeaders.getStmt.exec(key.int64, header):
body
else:
return default(ForkedLightClientHeader)
res.expect("SQL query OK")
return processHeader()
default(ForkedLightClientHeader)
func putLatestFinalizedHeader*(
db: LightClientDB, header: ForkedLightClientHeader) =

View File

@ -297,10 +297,10 @@ proc updateEpoch(self: var ValidatorMonitor, epoch: Epoch) =
var agg: int64
for monitor {.inject.} in self.monitors.mvalues:
agg += monitor.summaries[summaryIdx].name
metric.set(agg, [total])
metrics.set(metric, agg, [total])
else:
for monitor {.inject.} in self.monitors.mvalues:
metric.set(monitor.summaries[summaryIdx].name, [monitor.id])
metrics.set(metric, monitor.summaries[summaryIdx].name, [monitor.id])
template observeAll(metric, name: untyped) =
for monitor {.inject.} in self.monitors.mvalues:

View File

@ -182,6 +182,11 @@ switch("warning", "ObservableStores:off")
# Too many false positives for "Warning: method has lock level <unknown>, but another method has 0 [LockLevel]"
switch("warning", "LockLevel:off")
# Too many right now to read compiler output. Warnings are legitimate, but
# should be fixed out-of-band of `unstable` branch.
if (NimMajor, NimMinor, NimPatch) >= (1, 6, 11):
switch("warning", "BareExcept:off")
# Too many of these because of Defect compat in 1.2
switch("hint", "XCannotRaiseY:off")

View File

@ -53,7 +53,7 @@ template runSuite(suiteDir, testName: string, transitionProc: untyped): untyped
type T = phase0.BeaconState
let preState {.inject.} = newClone(parseTest(testDir/"pre.ssz_snappy", SSZ, T))
var cache {.inject, used.} = StateCache()
var info {.inject.}: EpochInfo
var info {.inject.}: phase0.EpochInfo
template state: untyped {.inject, used.} = preState[]
template cfg: untyped {.inject, used.} = defaultRuntimeConfig
init(info, preState[])

2
vendor/nim-presto vendored

@ -1 +1 @@
Subproject commit a6c32794bf9ac04989764f2b5242fb76e4232c9c
Subproject commit 18837545f3234f2eae187b2fd1ea24477398775e