mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 14:54:12 +00:00
4f7a8cf79d
* register vc duties with subnet tracker * fix activation logging during startup * cache slot signature to avoid duplicate signature work * schedule aggregation duties one slot at a time to avoid CPU spike at each epoch * lower aggregation subnet pre-subscription time to 4 slots (lowers bandwidth and CPU usage) * update stability subnets in ENR on startup * log gossip state * perform gossip subscriptions just before the next slot starts * document stuff * add random include * don't overwrite subscription state when not subscribed * log target gossip state * updating gossip status once is enough * add test * remove syncQueueLen - this one is not updated at the end of the sync and may cause gossip to disconnect itself completely - use a simple head distance instead * fix gossip disconnection - if in hysteresis, node.gossipState will be set to disabled even though we don't disable topic subscriptions * fix extra duty registration call
44 lines
1.3 KiB
Nim
44 lines
1.3 KiB
Nim
{.used.}
|
|
|
|
import
|
|
unittest2,
|
|
eth/keys,
|
|
../beacon_chain/validators/action_tracker
|
|
|
|
suite "subnet tracker":
|
|
let rng = keys.newRng()
|
|
|
|
test "should register stability subnets on attester duties":
|
|
var tracker = ActionTracker.init(rng, false)
|
|
|
|
check:
|
|
tracker.stabilitySubnets(Slot(0)).countOnes() == 0
|
|
tracker.aggregateSubnets(Slot(0)).countOnes() == 0
|
|
|
|
tracker.registerDuty(Slot(0), SubnetId(0), ValidatorIndex(0), true)
|
|
|
|
tracker.updateSlot(Slot(0))
|
|
|
|
check:
|
|
tracker.stabilitySubnets(Slot(0)).countOnes() == 1
|
|
tracker.aggregateSubnets(Slot(0)).countOnes() == 1
|
|
tracker.aggregateSubnets(Slot(1)).countOnes() == 0
|
|
|
|
tracker.registerDuty(Slot(1), SubnetId(1), ValidatorIndex(0), true)
|
|
check:
|
|
tracker.aggregateSubnets(Slot(0)).countOnes() == 2
|
|
tracker.aggregateSubnets(Slot(1)).countOnes() == 1
|
|
|
|
tracker.registerDuty(Slot(SUBNET_SUBSCRIPTION_LEAD_TIME_SLOTS), SubnetId(2), ValidatorIndex(0), true)
|
|
check:
|
|
tracker.aggregateSubnets(Slot(0)).countOnes() == 2
|
|
tracker.aggregateSubnets(Slot(1)).countOnes() == 2
|
|
|
|
# Guaranteed to expire
|
|
tracker.updateSlot(
|
|
Slot(EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION * 2 * SLOTS_PER_EPOCH))
|
|
|
|
check:
|
|
tracker.stabilitySubnets(Slot(0)).countOnes() == 0
|
|
tracker.aggregateSubnets(Slot(0)).countOnes() == 0
|