diff --git a/beacon_chain/beacon_chain_db_light_client.nim b/beacon_chain/beacon_chain_db_light_client.nim index b452baf8a..4b838fdee 100644 --- a/beacon_chain/beacon_chain_db_light_client.nim +++ b/beacon_chain/beacon_chain_db_light_client.nim @@ -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, diff --git a/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim b/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim index 8bad5e140..56e194b2c 100644 --- a/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim +++ b/beacon_chain/consensus_object_pools/blockchain_dag_light_client.nim @@ -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: diff --git a/beacon_chain/light_client_db.nim b/beacon_chain/light_client_db.nim index ddf909d65..3cd4b66f3 100644 --- a/beacon_chain/light_client_db.nim +++ b/beacon_chain/light_client_db.nim @@ -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) = diff --git a/beacon_chain/validators/validator_monitor.nim b/beacon_chain/validators/validator_monitor.nim index bf6874ad9..9c4c19aef 100644 --- a/beacon_chain/validators/validator_monitor.nim +++ b/beacon_chain/validators/validator_monitor.nim @@ -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: diff --git a/config.nims b/config.nims index de36c2f11..d35d1b5a1 100644 --- a/config.nims +++ b/config.nims @@ -182,6 +182,11 @@ switch("warning", "ObservableStores:off") # Too many false positives for "Warning: method has lock level , 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") diff --git a/tests/consensus_spec/phase0/test_fixture_state_transition_epoch.nim b/tests/consensus_spec/phase0/test_fixture_state_transition_epoch.nim index e3680a749..fc75d3a3c 100644 --- a/tests/consensus_spec/phase0/test_fixture_state_transition_epoch.nim +++ b/tests/consensus_spec/phase0/test_fixture_state_transition_epoch.nim @@ -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[]) diff --git a/vendor/nim-presto b/vendor/nim-presto index a6c32794b..18837545f 160000 --- a/vendor/nim-presto +++ b/vendor/nim-presto @@ -1 +1 @@ -Subproject commit a6c32794bf9ac04989764f2b5242fb76e4232c9c +Subproject commit 18837545f3234f2eae187b2fd1ea24477398775e