try reduce stack size in test

This commit is contained in:
Etan Kissling 2024-06-21 18:36:54 +02:00
parent 0d89dcd363
commit c0d07e1b24
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
1 changed files with 33 additions and 29 deletions

View File

@ -146,22 +146,35 @@ suite "Light client processor" & preset():
proc applyPeriodWithoutSupermajority(
period: SyncCommitteePeriod, update: ref ForkedLightClientUpdate) =
for i in 0 ..< 2:
res = processor[].storeObject(
MsgSource.gossip, getBeaconTime(), update[])
check update[].kind <= store[].kind
if finalizationMode == LightClientFinalizationMode.Optimistic or
period == lastPeriodWithSupermajority + 1:
# Reduce stack size by making this a `proc`
proc applyInitial(update: ref ForkedLightClientUpdate) =
res = processor[].storeObject(
MsgSource.gossip, getBeaconTime(), update[])
check update[].kind <= store[].kind
if finalizationMode == LightClientFinalizationMode.Optimistic or
i == 0:
withForkyStore(store[]):
when lcDataFork > LightClientDataFork.None:
let upgraded = newClone(
update[].migratingToDataFork(lcDataFork))
template forkyUpdate: untyped = upgraded[].forky(lcDataFork)
check:
res.isOk
forkyStore.best_valid_update.isSome
forkyStore.best_valid_update.get.matches(forkyUpdate)
period == lastPeriodWithSupermajority + 1:
if finalizationMode == LightClientFinalizationMode.Optimistic or
i == 0:
withForkyStore(store[]):
when lcDataFork > LightClientDataFork.None:
let upgraded = newClone(
update[].migratingToDataFork(lcDataFork))
template forkyUpdate: untyped = upgraded[].forky(lcDataFork)
check:
res.isOk
forkyStore.best_valid_update.isSome
forkyStore.best_valid_update.get.matches(forkyUpdate)
else:
withForkyStore(store[]):
when lcDataFork > LightClientDataFork.None:
let upgraded = newClone(
update[].migratingToDataFork(lcDataFork))
template forkyUpdate: untyped = upgraded[].forky(lcDataFork)
check:
res.isErr
res.error == VerifierError.Duplicate
forkyStore.best_valid_update.isSome
forkyStore.best_valid_update.get.matches(forkyUpdate)
else:
withForkyStore(store[]):
when lcDataFork > LightClientDataFork.None:
@ -170,20 +183,11 @@ suite "Light client processor" & preset():
template forkyUpdate: untyped = upgraded[].forky(lcDataFork)
check:
res.isErr
res.error == VerifierError.Duplicate
res.error == VerifierError.MissingParent
forkyStore.best_valid_update.isSome
forkyStore.best_valid_update.get.matches(forkyUpdate)
else:
withForkyStore(store[]):
when lcDataFork > LightClientDataFork.None:
let upgraded = newClone(
update[].migratingToDataFork(lcDataFork))
template forkyUpdate: untyped = upgraded[].forky(lcDataFork)
check:
res.isErr
res.error == VerifierError.MissingParent
forkyStore.best_valid_update.isSome
not forkyStore.best_valid_update.get.matches(forkyUpdate)
not forkyStore.best_valid_update.get.matches(forkyUpdate)
applyInitial(update)
# Reduce stack size by making this a `proc`
proc applyDuplicate(update: ref ForkedLightClientUpdate) =