taskpools: bump (#6757)

* taskpools: bump

* better raises effects
* get rid of custom naming

* bump

* oops

* bump stable
This commit is contained in:
Jacek Sieka 2024-12-11 12:12:56 +01:00 committed by GitHub
parent 7d81ee17db
commit 031d24ff41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 27 additions and 28 deletions

View File

@ -144,7 +144,7 @@ type
proc new*( proc new*(
T: type BatchCrypto, rng: ref HmacDrbgContext, T: type BatchCrypto, rng: ref HmacDrbgContext,
eager: Eager, genesis_validators_root: Eth2Digest, taskpool: TaskPoolPtr): eager: Eager, genesis_validators_root: Eth2Digest, taskpool: Taskpool):
Result[ref BatchCrypto, string] = Result[ref BatchCrypto, string] =
let res = (ref BatchCrypto)( let res = (ref BatchCrypto)(
rng: rng, taskpool: taskpool, rng: rng, taskpool: taskpool,

View File

@ -169,7 +169,7 @@ proc new*(T: type Eth2Processor,
blobQuarantine: ref BlobQuarantine, blobQuarantine: ref BlobQuarantine,
rng: ref HmacDrbgContext, rng: ref HmacDrbgContext,
getBeaconTime: GetBeaconTimeFn, getBeaconTime: GetBeaconTimeFn,
taskpool: TaskPoolPtr taskpool: Taskpool
): ref Eth2Processor = ): ref Eth2Processor =
(ref Eth2Processor)( (ref Eth2Processor)(
doppelgangerDetectionEnabled: doppelgangerDetectionEnabled, doppelgangerDetectionEnabled: doppelgangerDetectionEnabled,

View File

@ -291,7 +291,7 @@ proc initFullNode(
rng: ref HmacDrbgContext, rng: ref HmacDrbgContext,
dag: ChainDAGRef, dag: ChainDAGRef,
clist: ChainListRef, clist: ChainListRef,
taskpool: TaskPoolPtr, taskpool: Taskpool,
getBeaconTime: GetBeaconTimeFn) {.async.} = getBeaconTime: GetBeaconTimeFn) {.async.} =
template config(): auto = node.config template config(): auto = node.config
@ -654,7 +654,6 @@ proc init*(T: type BeaconNode,
metadata: Eth2NetworkMetadata): Future[BeaconNode] metadata: Eth2NetworkMetadata): Future[BeaconNode]
{.async.} = {.async.} =
var var
taskpool: TaskPoolPtr
genesisState: ref ForkedHashedBeaconState = nil genesisState: ref ForkedHashedBeaconState = nil
template cfg: auto = metadata.cfg template cfg: auto = metadata.cfg
@ -690,18 +689,20 @@ proc init*(T: type BeaconNode,
altair_fork_epoch = metadata.cfg.ALTAIR_FORK_EPOCH altair_fork_epoch = metadata.cfg.ALTAIR_FORK_EPOCH
quit 1 quit 1
let taskpool =
try: try:
if config.numThreads < 0: if config.numThreads < 0:
fatal "The number of threads --numThreads cannot be negative." fatal "The number of threads --num-threads cannot be negative."
quit 1 quit 1
elif config.numThreads == 0: elif config.numThreads == 0:
taskpool = TaskPoolPtr.new(numThreads = min(countProcessors(), 16)) Taskpool.new(numThreads = min(countProcessors(), 16))
else: else:
taskpool = TaskPoolPtr.new(numThreads = config.numThreads) Taskpool.new(numThreads = config.numThreads)
except CatchableError as e:
fatal "Cannot start taskpool", err = e.msg
quit 1
info "Threadpool started", numThreads = taskpool.numThreads info "Threadpool started", numThreads = taskpool.numThreads
except Exception:
raise newException(Defect, "Failure in taskpool initialization.")
if metadata.genesis.kind == BakedIn: if metadata.genesis.kind == BakedIn:
if config.genesisState.isSome: if config.genesisState.isSome:

View File

@ -26,18 +26,16 @@ import
export results, rand, altair, phase0, taskpools, signatures export results, rand, altair, phase0, taskpools, signatures
type type
TaskPoolPtr* = Taskpool
BatchVerifier* = object BatchVerifier* = object
sigVerifCache*: BatchedBLSVerifierCache sigVerifCache*: BatchedBLSVerifierCache
## A cache for batch BLS signature verification contexts ## A cache for batch BLS signature verification contexts
rng*: ref HmacDrbgContext rng*: ref HmacDrbgContext
## A reference to the Nimbus application-wide RNG ## A reference to the Nimbus application-wide RNG
taskpool*: TaskPoolPtr taskpool*: Taskpool
proc init*( proc init*(
T: type BatchVerifier, rng: ref HmacDrbgContext, T: type BatchVerifier, rng: ref HmacDrbgContext,
taskpool: TaskPoolPtr): BatchVerifier = taskpool: Taskpool): BatchVerifier =
BatchVerifier( BatchVerifier(
sigVerifCache: BatchedBLSVerifierCache.init(taskpool), sigVerifCache: BatchedBLSVerifierCache.init(taskpool),
rng: rng, rng: rng,
@ -46,7 +44,7 @@ proc init*(
proc new*( proc new*(
T: type BatchVerifier, rng: ref HmacDrbgContext, T: type BatchVerifier, rng: ref HmacDrbgContext,
taskpool: TaskPoolPtr): ref BatchVerifier = taskpool: Taskpool): ref BatchVerifier =
(ref BatchVerifier)( (ref BatchVerifier)(
sigVerifCache: BatchedBLSVerifierCache.init(taskpool), sigVerifCache: BatchedBLSVerifierCache.init(taskpool),
rng: rng, rng: rng,

View File

@ -144,7 +144,7 @@ proc runTest(suiteName, path: string, consensusFork: static ConsensusFork) =
lcDataConfig = LightClientDataConfig( lcDataConfig = LightClientDataConfig(
serve: true, importMode: LightClientDataImportMode.Full)) serve: true, importMode: LightClientDataImportMode.Full))
rng = HmacDrbgContext.new() rng = HmacDrbgContext.new()
taskpool = TaskPool.new() taskpool = Taskpool.new()
var var
verifier = BatchVerifier.init(rng, taskpool) verifier = BatchVerifier.init(rng, taskpool)
quarantine = newClone(Quarantine.init()) quarantine = newClone(Quarantine.init())

@ -1 +1 @@
Subproject commit 66585e2e960b7695e48ea60377fb3aeac96406e8 Subproject commit 25f24dddaf1b6d0c791751e209109ba79fea6802