Skip to content

Commit 8cab019

Browse files
committed
Address lion's comments
1 parent cbf7dca commit 8cab019

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

beacon_node/network/src/subnet_service/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,8 @@ impl<T: BeaconChainTypes> Stream for SubnetService<T> {
636636
match self.scheduled_subscriptions.poll_next_unpin(cx) {
637637
Poll::Ready(Some(Ok(exact_subnet))) => {
638638
let ExactSubnet { subnet, slot } = exact_subnet;
639+
// Set the `end_slot` for the subscription to be `duty.slot + 1` so that we unsubscribe
640+
// only at the end of the duty slot.
639641
if let Err(e) = self.subscribe_to_subnet_immediately(subnet, slot + 1) {
640642
debug!(self.log, "Failed to subscribe to short lived subnet"; "subnet" => ?subnet, "err" => e);
641643
}

beacon_node/network/src/subnet_service/tests/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ use types::{
2020
SyncCommitteeSubscription, SyncSubnetId, ValidatorSubscription,
2121
};
2222

23-
// Set to enable/disable logging
24-
// const TEST_LOG_LEVEL: Option<slog::Level> = Some(slog::Level::Debug);
25-
const TEST_LOG_LEVEL: Option<slog::Level> = None;
26-
2723
const SLOT_DURATION_MILLIS: u64 = 400;
2824

2925
type TestBeaconChainType = Witness<
@@ -45,7 +41,7 @@ impl TestBeaconChain {
4541

4642
let keypairs = generate_deterministic_keypairs(1);
4743

48-
let log = get_logger(TEST_LOG_LEVEL);
44+
let log = logging::test_logger();
4945
let store =
5046
HotColdDB::open_ephemeral(StoreConfig::default(), spec.clone(), log.clone()).unwrap();
5147

@@ -118,7 +114,7 @@ fn get_logger(log_level: Option<slog::Level>) -> Logger {
118114
static CHAIN: LazyLock<TestBeaconChain> = LazyLock::new(TestBeaconChain::new_with_system_clock);
119115

120116
fn get_subnet_service() -> SubnetService<TestBeaconChainType> {
121-
let log = get_logger(TEST_LOG_LEVEL);
117+
let log = logging::test_logger();
122118
let config = NetworkConfig::default();
123119

124120
let beacon_chain = CHAIN.chain.clone();

0 commit comments

Comments
 (0)