Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unknown block sync to subscribe/unsubscribe to network events #5654

Merged
merged 3 commits into from
Jun 18, 2023

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jun 16, 2023

Motivation

Unknown block sync received unknown block roots while the node is syncing, this lead to:

Description

  • Add subscribe/unsubscribe methods to UnknownBlock sync
  • Only subscribe once the node is synced, similar to network.subscribeGossipCoreTopics()

Closes #5653

@github-actions
Copy link
Contributor

github-actions bot commented Jun 16, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 8b099f9 Previous: aecb3d1 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 875.79 us/op 1.1107 ms/op 0.79
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 44.774 us/op 94.290 us/op 0.47
BLS verify - blst-native 1.2048 ms/op 1.9111 ms/op 0.63
BLS verifyMultipleSignatures 3 - blst-native 2.4409 ms/op 4.0104 ms/op 0.61
BLS verifyMultipleSignatures 8 - blst-native 5.2687 ms/op 8.6398 ms/op 0.61
BLS verifyMultipleSignatures 32 - blst-native 18.931 ms/op 32.074 ms/op 0.59
BLS aggregatePubkeys 32 - blst-native 25.487 us/op 43.817 us/op 0.58
BLS aggregatePubkeys 128 - blst-native 99.102 us/op 145.84 us/op 0.68
getAttestationsForBlock 52.275 ms/op 113.45 ms/op 0.46
isKnown best case - 1 super set check 260.00 ns/op 372.00 ns/op 0.70
isKnown normal case - 2 super set checks 255.00 ns/op 411.00 ns/op 0.62
isKnown worse case - 16 super set checks 256.00 ns/op 374.00 ns/op 0.68
CheckpointStateCache - add get delete 4.8610 us/op 8.5650 us/op 0.57
validate gossip signedAggregateAndProof - struct 2.7537 ms/op 3.7127 ms/op 0.74
validate gossip attestation - struct 1.2418 ms/op 1.6599 ms/op 0.75
pickEth1Vote - no votes 1.1491 ms/op 1.9464 ms/op 0.59
pickEth1Vote - max votes 10.692 ms/op 17.988 ms/op 0.59
pickEth1Vote - Eth1Data hashTreeRoot value x2048 9.0199 ms/op 17.183 ms/op 0.52
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 14.152 ms/op 26.072 ms/op 0.54
pickEth1Vote - Eth1Data fastSerialize value x2048 619.81 us/op 969.88 us/op 0.64
pickEth1Vote - Eth1Data fastSerialize tree x2048 8.1583 ms/op 8.4618 ms/op 0.96
bytes32 toHexString 483.00 ns/op 1.3080 us/op 0.37
bytes32 Buffer.toString(hex) 343.00 ns/op 702.00 ns/op 0.49
bytes32 Buffer.toString(hex) from Uint8Array 540.00 ns/op 1.3390 us/op 0.40
bytes32 Buffer.toString(hex) + 0x 346.00 ns/op 741.00 ns/op 0.47
Object access 1 prop 0.15800 ns/op 0.34100 ns/op 0.46
Map access 1 prop 0.15400 ns/op 0.28800 ns/op 0.53
Object get x1000 6.9820 ns/op 10.934 ns/op 0.64
Map get x1000 0.60100 ns/op 1.6490 ns/op 0.36
Object set x1000 50.995 ns/op 117.13 ns/op 0.44
Map set x1000 43.011 ns/op 88.993 ns/op 0.48
Return object 10000 times 0.23320 ns/op 0.68000 ns/op 0.34
Throw Error 10000 times 4.1296 us/op 8.8030 us/op 0.47
fastMsgIdFn sha256 / 200 bytes 3.3810 us/op 5.8820 us/op 0.57
fastMsgIdFn h32 xxhash / 200 bytes 286.00 ns/op 730.00 ns/op 0.39
fastMsgIdFn h64 xxhash / 200 bytes 395.00 ns/op 1.0620 us/op 0.37
fastMsgIdFn sha256 / 1000 bytes 11.557 us/op 20.140 us/op 0.57
fastMsgIdFn h32 xxhash / 1000 bytes 416.00 ns/op 934.00 ns/op 0.45
fastMsgIdFn h64 xxhash / 1000 bytes 468.00 ns/op 1.1640 us/op 0.40
fastMsgIdFn sha256 / 10000 bytes 102.93 us/op 170.51 us/op 0.60
fastMsgIdFn h32 xxhash / 10000 bytes 1.9240 us/op 3.2370 us/op 0.59
fastMsgIdFn h64 xxhash / 10000 bytes 1.3700 us/op 1.9650 us/op 0.70
enrSubnets - fastDeserialize 64 bits 1.2740 us/op 3.1290 us/op 0.41
enrSubnets - ssz BitVector 64 bits 490.00 ns/op 1.1700 us/op 0.42
enrSubnets - fastDeserialize 4 bits 168.00 ns/op 385.00 ns/op 0.44
enrSubnets - ssz BitVector 4 bits 479.00 ns/op 958.00 ns/op 0.50
prioritizePeers score -10:0 att 32-0.1 sync 2-0 103.66 us/op 236.49 us/op 0.44
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 130.01 us/op 283.91 us/op 0.46
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 160.75 us/op 359.58 us/op 0.45
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 296.70 us/op 717.41 us/op 0.41
prioritizePeers score 0:0 att 64-1 sync 4-1 360.78 us/op 670.47 us/op 0.54
array of 16000 items push then shift 1.5936 us/op 3.1345 us/op 0.51
LinkedList of 16000 items push then shift 8.5710 ns/op 17.203 ns/op 0.50
array of 16000 items push then pop 80.475 ns/op 213.91 ns/op 0.38
LinkedList of 16000 items push then pop 8.2550 ns/op 12.403 ns/op 0.67
array of 24000 items push then shift 2.2737 us/op 3.1074 us/op 0.73
LinkedList of 24000 items push then shift 8.6970 ns/op 12.890 ns/op 0.67
array of 24000 items push then pop 74.957 ns/op 128.19 ns/op 0.58
LinkedList of 24000 items push then pop 8.2490 ns/op 10.568 ns/op 0.78
intersect bitArray bitLen 8 12.785 ns/op 16.055 ns/op 0.80
intersect array and set length 8 75.976 ns/op 112.47 ns/op 0.68
intersect bitArray bitLen 128 42.502 ns/op 50.962 ns/op 0.83
intersect array and set length 128 1.0295 us/op 1.4102 us/op 0.73
Buffer.concat 32 items 2.8230 us/op 3.2940 us/op 0.86
Uint8Array.set 32 items 2.9480 us/op 3.5860 us/op 0.82
transfer serialized Status (84 B) 2.0140 us/op 2.6240 us/op 0.77
copy serialized Status (84 B) 1.7180 us/op 2.1770 us/op 0.79
transfer serialized SignedVoluntaryExit (112 B) 2.2010 us/op 2.6230 us/op 0.84
copy serialized SignedVoluntaryExit (112 B) 1.6380 us/op 2.1910 us/op 0.75
transfer serialized ProposerSlashing (416 B) 2.3870 us/op 2.9760 us/op 0.80
copy serialized ProposerSlashing (416 B) 2.7530 us/op 2.6860 us/op 1.02
transfer serialized Attestation (485 B) 2.8260 us/op 2.9650 us/op 0.95
copy serialized Attestation (485 B) 2.8240 us/op 2.7060 us/op 1.04
transfer serialized AttesterSlashing (33232 B) 3.2680 us/op 2.9020 us/op 1.13
copy serialized AttesterSlashing (33232 B) 6.4700 us/op 8.2380 us/op 0.79
transfer serialized Small SignedBeaconBlock (128000 B) 3.4610 us/op 3.4290 us/op 1.01
copy serialized Small SignedBeaconBlock (128000 B) 13.788 us/op 25.107 us/op 0.55
transfer serialized Avg SignedBeaconBlock (200000 B) 3.7250 us/op 4.6730 us/op 0.80
copy serialized Avg SignedBeaconBlock (200000 B) 53.739 us/op 47.937 us/op 1.12
transfer serialized BlobsSidecar (524380 B) 3.5080 us/op 4.5100 us/op 0.78
copy serialized BlobsSidecar (524380 B) 80.027 us/op 226.36 us/op 0.35
transfer serialized Big SignedBeaconBlock (1000000 B) 3.5970 us/op 5.1570 us/op 0.70
copy serialized Big SignedBeaconBlock (1000000 B) 337.64 us/op 373.10 us/op 0.90
pass gossip attestations to forkchoice per slot 2.5868 ms/op 3.1848 ms/op 0.81
forkChoice updateHead vc 100000 bc 64 eq 0 2.0340 ms/op 2.3750 ms/op 0.86
forkChoice updateHead vc 600000 bc 64 eq 0 11.177 ms/op 16.528 ms/op 0.68
forkChoice updateHead vc 1000000 bc 64 eq 0 20.849 ms/op 23.275 ms/op 0.90
forkChoice updateHead vc 600000 bc 320 eq 0 16.256 ms/op 18.875 ms/op 0.86
forkChoice updateHead vc 600000 bc 1200 eq 0 77.274 ms/op 96.613 ms/op 0.80
forkChoice updateHead vc 600000 bc 64 eq 1000 20.407 ms/op 23.280 ms/op 0.88
forkChoice updateHead vc 600000 bc 64 eq 10000 22.875 ms/op 26.525 ms/op 0.86
forkChoice updateHead vc 600000 bc 64 eq 300000 30.863 ms/op 36.717 ms/op 0.84
computeDeltas 3.8595 ms/op 3.0466 ms/op 1.27
computeProposerBoostScoreFromBalances 1.7708 ms/op 1.8057 ms/op 0.98
altair processAttestation - 250000 vs - 7PWei normalcase 2.1366 ms/op 2.2818 ms/op 0.94
altair processAttestation - 250000 vs - 7PWei worstcase 3.2836 ms/op 3.3839 ms/op 0.97
altair processAttestation - setStatus - 1/6 committees join 136.90 us/op 142.61 us/op 0.96
altair processAttestation - setStatus - 1/3 committees join 266.20 us/op 283.37 us/op 0.94
altair processAttestation - setStatus - 1/2 committees join 358.55 us/op 384.07 us/op 0.93
altair processAttestation - setStatus - 2/3 committees join 455.75 us/op 486.51 us/op 0.94
altair processAttestation - setStatus - 4/5 committees join 636.20 us/op 685.46 us/op 0.93
altair processAttestation - setStatus - 100% committees join 739.33 us/op 786.18 us/op 0.94
altair processBlock - 250000 vs - 7PWei normalcase 19.583 ms/op 17.365 ms/op 1.13
altair processBlock - 250000 vs - 7PWei normalcase hashState 26.322 ms/op 25.231 ms/op 1.04
altair processBlock - 250000 vs - 7PWei worstcase 52.423 ms/op 50.947 ms/op 1.03
altair processBlock - 250000 vs - 7PWei worstcase hashState 67.732 ms/op 72.727 ms/op 0.93
phase0 processBlock - 250000 vs - 7PWei normalcase 2.0198 ms/op 2.2513 ms/op 0.90
phase0 processBlock - 250000 vs - 7PWei worstcase 27.989 ms/op 29.927 ms/op 0.94
altair processEth1Data - 250000 vs - 7PWei normalcase 466.18 us/op 510.07 us/op 0.91
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.8820 us/op 7.2010 us/op 0.96
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 19.394 us/op 23.811 us/op 0.81
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 8.8200 us/op 11.583 us/op 0.76
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.4040 us/op 6.3810 us/op 1.00
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 74.274 us/op 74.947 us/op 0.99
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 627.96 us/op 622.74 us/op 1.01
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 893.43 us/op 892.80 us/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 885.43 us/op 858.98 us/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.3118 ms/op 2.3171 ms/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.5497 ms/op 1.8592 ms/op 0.83
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.5778 ms/op 3.9515 ms/op 0.91
Tree 40 250000 create 297.75 ms/op 307.48 ms/op 0.97
Tree 40 250000 get(125000) 171.12 ns/op 189.74 ns/op 0.90
Tree 40 250000 set(125000) 910.70 ns/op 985.22 ns/op 0.92
Tree 40 250000 toArray() 16.904 ms/op 18.777 ms/op 0.90
Tree 40 250000 iterate all - toArray() + loop 16.513 ms/op 18.272 ms/op 0.90
Tree 40 250000 iterate all - get(i) 66.444 ms/op 71.187 ms/op 0.93
MutableVector 250000 create 9.7548 ms/op 11.182 ms/op 0.87
MutableVector 250000 get(125000) 6.2990 ns/op 6.5900 ns/op 0.96
MutableVector 250000 set(125000) 246.89 ns/op 263.52 ns/op 0.94
MutableVector 250000 toArray() 2.6639 ms/op 2.8040 ms/op 0.95
MutableVector 250000 iterate all - toArray() + loop 2.7622 ms/op 2.9554 ms/op 0.93
MutableVector 250000 iterate all - get(i) 1.4974 ms/op 1.5450 ms/op 0.97
Array 250000 create 2.4890 ms/op 2.6826 ms/op 0.93
Array 250000 clone - spread 1.1884 ms/op 1.2616 ms/op 0.94
Array 250000 get(125000) 0.57900 ns/op 0.62100 ns/op 0.93
Array 250000 set(125000) 0.65000 ns/op 0.67400 ns/op 0.96
Array 250000 iterate all - loop 81.069 us/op 107.85 us/op 0.75
effectiveBalanceIncrements clone Uint8Array 300000 31.264 us/op 40.870 us/op 0.76
effectiveBalanceIncrements clone MutableVector 300000 376.00 ns/op 409.00 ns/op 0.92
effectiveBalanceIncrements rw all Uint8Array 300000 165.67 us/op 177.05 us/op 0.94
effectiveBalanceIncrements rw all MutableVector 300000 81.186 ms/op 96.906 ms/op 0.84
phase0 afterProcessEpoch - 250000 vs - 7PWei 111.49 ms/op 118.71 ms/op 0.94
phase0 beforeProcessEpoch - 250000 vs - 7PWei 39.220 ms/op 35.096 ms/op 1.12
altair processEpoch - mainnet_e81889 296.81 ms/op 338.91 ms/op 0.88
mainnet_e81889 - altair beforeProcessEpoch 61.609 ms/op 67.961 ms/op 0.91
mainnet_e81889 - altair processJustificationAndFinalization 17.427 us/op 22.392 us/op 0.78
mainnet_e81889 - altair processInactivityUpdates 5.0638 ms/op 6.2795 ms/op 0.81
mainnet_e81889 - altair processRewardsAndPenalties 52.792 ms/op 68.766 ms/op 0.77
mainnet_e81889 - altair processRegistryUpdates 2.7540 us/op 3.1030 us/op 0.89
mainnet_e81889 - altair processSlashings 586.00 ns/op 834.00 ns/op 0.70
mainnet_e81889 - altair processEth1DataReset 637.00 ns/op 647.00 ns/op 0.98
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.1517 ms/op 1.6293 ms/op 0.71
mainnet_e81889 - altair processSlashingsReset 4.8580 us/op 6.8420 us/op 0.71
mainnet_e81889 - altair processRandaoMixesReset 4.5290 us/op 6.5410 us/op 0.69
mainnet_e81889 - altair processHistoricalRootsUpdate 759.00 ns/op 2.0260 us/op 0.37
mainnet_e81889 - altair processParticipationFlagUpdates 2.6060 us/op 4.3650 us/op 0.60
mainnet_e81889 - altair processSyncCommitteeUpdates 574.00 ns/op 1000.0 ns/op 0.57
mainnet_e81889 - altair afterProcessEpoch 115.97 ms/op 158.08 ms/op 0.73
phase0 processEpoch - mainnet_e58758 319.70 ms/op 476.06 ms/op 0.67
mainnet_e58758 - phase0 beforeProcessEpoch 119.92 ms/op 163.08 ms/op 0.74
mainnet_e58758 - phase0 processJustificationAndFinalization 15.150 us/op 24.374 us/op 0.62
mainnet_e58758 - phase0 processRewardsAndPenalties 55.184 ms/op 69.003 ms/op 0.80
mainnet_e58758 - phase0 processRegistryUpdates 7.6980 us/op 10.032 us/op 0.77
mainnet_e58758 - phase0 processSlashings 562.00 ns/op 721.00 ns/op 0.78
mainnet_e58758 - phase0 processEth1DataReset 558.00 ns/op 821.00 ns/op 0.68
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 949.07 us/op 1.1161 ms/op 0.85
mainnet_e58758 - phase0 processSlashingsReset 2.9320 us/op 6.6080 us/op 0.44
mainnet_e58758 - phase0 processRandaoMixesReset 4.6600 us/op 5.7340 us/op 0.81
mainnet_e58758 - phase0 processHistoricalRootsUpdate 835.00 ns/op 842.00 ns/op 0.99
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.9150 us/op 4.5460 us/op 0.86
mainnet_e58758 - phase0 afterProcessEpoch 95.879 ms/op 101.00 ms/op 0.95
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2366 ms/op 1.2529 ms/op 0.99
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4619 ms/op 1.5697 ms/op 0.93
altair processInactivityUpdates - 250000 normalcase 19.460 ms/op 27.083 ms/op 0.72
altair processInactivityUpdates - 250000 worstcase 22.452 ms/op 28.749 ms/op 0.78
phase0 processRegistryUpdates - 250000 normalcase 5.9910 us/op 6.4220 us/op 0.93
phase0 processRegistryUpdates - 250000 badcase_full_deposits 223.45 us/op 282.10 us/op 0.79
phase0 processRegistryUpdates - 250000 worstcase 0.5 112.34 ms/op 143.54 ms/op 0.78
altair processRewardsAndPenalties - 250000 normalcase 50.774 ms/op 73.209 ms/op 0.69
altair processRewardsAndPenalties - 250000 worstcase 54.608 ms/op 74.361 ms/op 0.73
phase0 getAttestationDeltas - 250000 normalcase 6.4196 ms/op 7.4106 ms/op 0.87
phase0 getAttestationDeltas - 250000 worstcase 6.4500 ms/op 7.0751 ms/op 0.91
phase0 processSlashings - 250000 worstcase 3.4048 ms/op 3.8769 ms/op 0.88
altair processSyncCommitteeUpdates - 250000 168.22 ms/op 192.82 ms/op 0.87
BeaconState.hashTreeRoot - No change 270.00 ns/op 284.00 ns/op 0.95
BeaconState.hashTreeRoot - 1 full validator 49.363 us/op 55.584 us/op 0.89
BeaconState.hashTreeRoot - 32 full validator 520.02 us/op 570.25 us/op 0.91
BeaconState.hashTreeRoot - 512 full validator 4.7602 ms/op 5.8811 ms/op 0.81
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 60.506 us/op 69.887 us/op 0.87
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 866.18 us/op 917.60 us/op 0.94
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 11.088 ms/op 13.408 ms/op 0.83
BeaconState.hashTreeRoot - 1 balances 46.810 us/op 51.538 us/op 0.91
BeaconState.hashTreeRoot - 32 balances 439.49 us/op 465.20 us/op 0.94
BeaconState.hashTreeRoot - 512 balances 4.2966 ms/op 5.0646 ms/op 0.85
BeaconState.hashTreeRoot - 250000 balances 69.199 ms/op 83.833 ms/op 0.83
aggregationBits - 2048 els - zipIndexesInBitList 16.467 us/op 18.676 us/op 0.88
regular array get 100000 times 31.814 us/op 36.086 us/op 0.88
wrappedArray get 100000 times 31.981 us/op 35.938 us/op 0.89
arrayWithProxy get 100000 times 15.498 ms/op 18.339 ms/op 0.85
ssz.Root.equals 546.00 ns/op 593.00 ns/op 0.92
byteArrayEquals 524.00 ns/op 594.00 ns/op 0.88
shuffle list - 16384 els 6.8110 ms/op 7.4932 ms/op 0.91
shuffle list - 250000 els 99.691 ms/op 111.57 ms/op 0.89
processSlot - 1 slots 8.2980 us/op 10.793 us/op 0.77
processSlot - 32 slots 1.2898 ms/op 1.6457 ms/op 0.78
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 33.154 ms/op 39.901 ms/op 0.83
getCommitteeAssignments - req 1 vs - 250000 vc 2.8581 ms/op 3.0675 ms/op 0.93
getCommitteeAssignments - req 100 vs - 250000 vc 4.0504 ms/op 4.5081 ms/op 0.90
getCommitteeAssignments - req 1000 vs - 250000 vc 4.4417 ms/op 4.8134 ms/op 0.92
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.3700 ns/op 5.4600 ns/op 0.80
state getBlockRootAtSlot - 250000 vs - 7PWei 966.24 ns/op 712.70 ns/op 1.36
computeProposers - vc 250000 10.639 ms/op 11.597 ms/op 0.92
computeEpochShuffling - vc 250000 98.461 ms/op 114.34 ms/op 0.86
getNextSyncCommittee - vc 250000 165.35 ms/op 208.39 ms/op 0.79
computeSigningRoot for AttestationData 13.041 us/op 16.539 us/op 0.79
hash AttestationData serialized data then Buffer.toString(base64) 2.3995 us/op 2.8692 us/op 0.84
toHexString serialized data 1.0906 us/op 1.3575 us/op 0.80
Buffer.toString(base64) 308.08 ns/op 435.87 ns/op 0.71

by benchmarkbot/action

@twoeths twoeths force-pushed the tuyen/delay_unknown_block_sync branch 5 times, most recently from 64c049c to dd102fe Compare June 16, 2023 13:33
@twoeths twoeths marked this pull request as ready for review June 16, 2023 14:08
@twoeths twoeths requested a review from a team as a code owner June 16, 2023 14:08
@philknows philknows added this to the v1.9.0 milestone Jun 16, 2023
@twoeths twoeths force-pushed the tuyen/delay_unknown_block_sync branch from dd102fe to 07e47b9 Compare June 17, 2023 06:12
.catch((e) => {
this.logger.error("Error subscribing to gossip core topics", {}, e);
});
}
Copy link
Contributor

@dapplion dapplion Jun 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rebundle this if statement as before? If you need you can re-order the conditions

    if (
      state === SyncState.Synced &&
      this.chain.clock.currentEpoch >= MIN_EPOCH_TO_START_GOSSIP &&
      !this.network.isSubscribedToGossipCoreTopics()
    ) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we can do it but then the below this.unknownBlockSync.subscribeToNetwork(); has to depend on this.network.isSubscribedToGossipCoreTopics(). Logically it's the same but it'll make it hard to reason about later.

Copy link
Contributor

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of any immediate issues with this, let's merge it. Added a minor comment to reduce diff

@twoeths twoeths merged commit 483aad7 into unstable Jun 18, 2023
@twoeths twoeths deleted the tuyen/delay_unknown_block_sync branch June 18, 2023 07:57
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.9.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only enable unknown block sync after block is synced
4 participants