Skip to content

Commit d21071a

Browse files
authored
[ETCM-1161] revert FastSync to version before header skeleton (#1117)
* revert FastSync to version before header skeleton as there are still some issues with it * delay switching to regular sync to improve reliability, minor tweak to log output * change pivot retry logic to pick next-highest one instead of picking a slightly lower one * add config option for periodic consistency check and default to false
1 parent c947a27 commit d21071a

File tree

11 files changed

+84
-422
lines changed

11 files changed

+84
-422
lines changed

src/it/scala/io/iohk/ethereum/sync/FastSyncItSpec.scala

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -233,52 +233,6 @@ class FastSyncItSpec extends FlatSpecBase with Matchers with BeforeAndAfterAll {
233233
.getBestBlockNumber() == peer3.blockchainReader.getBestBlockNumber() - peer3.testSyncConfig.pivotBlockOffset
234234
)
235235
}
236-
237-
it should "blacklist peer on Invalid batch last header number" in customTestCaseResourceM(
238-
FakePeer.start3FakePeersRes()
239-
) { case (peer1, peer2, peer3) =>
240-
for {
241-
_ <- peer2.importBlocksUntil(1000)(IdentityUpdate)
242-
_ <- peer3.importInvalidBlockNumbers(201, 1200)(IdentityUpdate)
243-
244-
_ <- peer1.connectToPeers(Set(peer2.node, peer3.node))
245-
_ <- peer1.startFastSync().delayExecution(50.milliseconds)
246-
_ <- peer1.waitForFastSyncFinish()
247-
} yield {
248-
// Peer3 is blacklisted
249-
val blacklistedPeer = PeerId(peer3.node.toUri.getUserInfo)
250-
val blacklistReason = peer1.blacklist.cache.getIfPresent(blacklistedPeer)
251-
252-
assert(peer1.blacklist.isBlacklisted(blacklistedPeer))
253-
assert(blacklistReason.get == BlacklistReasonType.BlockHeaderValidationFailedType)
254-
}
255-
}
256-
257-
it should "sync blockchain when peer responds with invalid batch last header hash" in customTestCaseResourceM(
258-
FakePeer.start4FakePeersRes()
259-
) { case (peer1, peer2, peer3, peer4) =>
260-
for {
261-
_ <- peer1.importBlocksUntil(400)(IdentityUpdate)
262-
_ <- peer2.importBlocksUntil(1000)(IdentityUpdate)
263-
264-
_ <- peer3.importInvalidBlocks(600, 800)(IdentityUpdate)
265-
_ <- peer3.importBlocksUntil(1200)(updateStateAtBlock(1000))
266-
267-
_ <- peer4.importBlocksUntil(1100)(IdentityUpdate)
268-
269-
_ <- peer1.connectToPeers(Set(peer2.node, peer3.node, peer4.node)).delayExecution(5.seconds)
270-
_ <- peer1.startFastSync().delayExecution(50.millis)
271-
_ <- peer2.importBlocksUntil(1200)(IdentityUpdate)
272-
_ <- peer1.waitForFastSyncFinish()
273-
} yield {
274-
// Peer3 is blacklisted
275-
val blacklistedPeer = PeerId(peer3.node.toUri.getUserInfo)
276-
val blacklistReason = peer1.blacklist.cache.getIfPresent(blacklistedPeer)
277-
278-
assert(peer1.blacklist.isBlacklisted(blacklistedPeer))
279-
assert(blacklistReason.get == BlacklistReasonType.BlockHeaderValidationFailedType)
280-
}
281-
}
282236
}
283237

284238
object FastSyncItSpec {

src/main/resources/conf/base.conf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ mantis {
354354
# Also retry interval in regular sync: for picking blocks batch and retrying requests
355355
sync-retry-interval = 0.5 seconds
356356

357+
# Delay between finishing fast sync and starting regular sync
358+
sync-switch-delay = 0.5 seconds
359+
357360
# Response time-out from peer during sync. If a peer fails to respond within this limit, it will be blacklisted
358361
peer-response-timeout = 30.seconds
359362

@@ -475,10 +478,6 @@ mantis {
475478
# On reaching this limit, it will perform branch resolving.
476479
fast-sync-max-batch-retries = 5
477480

478-
# If the expected pivot block cannot be confirmed from `min-peers-to-choose-pivot-block`,
479-
# the pivot block number is pushed back by the follwing number of blocks and the confirmation process repeats.
480-
pivot-block-number-reset-delta = 50
481-
482481
# Max number of times a pivot block is checked against available best peers before the whole process is restarted.
483482
max-pivot-block-failures-count = 5
484483
}
@@ -571,6 +570,9 @@ mantis {
571570

572571
# Define which database to use [rocksdb]
573572
data-source = "rocksdb"
573+
574+
# Run database checks every 10 mins and shut down when an inconsistency is found
575+
periodic-consistency-check = false
574576
}
575577

576578
filter {

0 commit comments

Comments
 (0)