Skip to content

Commit 60dcecb

Browse files
committed
Merge remote-tracking branch 'origin/develop' into ETCM-165-separate-rlp-sbt-project
2 parents 6f083f5 + 233d547 commit 60dcecb

File tree

7 files changed

+29
-7
lines changed

7 files changed

+29
-7
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ val mantisDev = sys.props.get("mantisDev").contains("true") || sys.env.get("MANT
1212
def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
1313
name := projectName,
1414
organization := "io.iohk",
15-
version := "3.1.0",
15+
version := "3.2.0",
1616
scalaVersion := "2.12.12",
1717
// Scalanet snapshots are published to Sonatype after each build.
1818
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",

src/main/resources/application.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ mantis {
328328
# are controlled by a single party, eg. private networks)
329329
blacklist-duration = 200.seconds
330330

331+
# Duration for high offense blacklisting of a peer. Blacklisting reason include: header validation failure.
332+
critical-blacklist-duration = 240.minutes
333+
331334
# Retry interval when not having enough peers to start fast-sync
332335
start-retry-interval = 5.seconds
333336

src/main/resources/chains/etc-chain.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@
186186
"enode://c7ec057ad9450d2d5c4002e49e53e1d90142acd54128c89e794d11401de026b91aa0e84e3f679fb6b47f7940e08b5e7d21d8178c5fa6ba0f36971098cb566ea6@101.133.229.66:30303", //ETC Labs
187187
"enode://70b74fef51aa4f36330cc52ac04f16d38e1838f531f58bbc88365ca5fd4a3da6e8ec32316c43f79b157d0575faf53064fd925644d0f620b2b201b028c2b410d0@47.115.150.90:30303", //ETC Labs
188188
"enode://fa64d1fcb2d4cd1d1606cb940ea2b69fee7dc6c7a85ac4ad05154df1e9ae9616a6a0fa67a59cb15f79346408efa5a4efeba1e5993ddbf4b5cedbda27644a61cf@47.91.30.48:30303", //ETC Labs
189+
190+
"enode://a7219ff608bdca40174d005610f80a8d216aa9695e34542d27d69cfd6bf5478fd3b5c83c08ad537a06425cce9cda975571053dcb174d44f109b7362d26798256@52.29.180.62:9076?discport=30303", // bootstrap3.mantis.pw
191+
"enode://fbcd6fc04fa7ea897558c3f5edf1cd192e3b2c3b5b9b3d00be179b2e9d04e623e017ed6ce6a1369fff126661afa1c5caa12febce92dcb70ff1352b86e9ebb44f@18.193.251.235:9076?discport=30303", // bootstrap1.mantis.pw
192+
"enode://1619217a01fb87745bb104872aa84314a2d42d99c7b915cd187245bfd898d679cbf78b3ea950c32051db860e2c4e3fe7d6329107587be33ab37541ca65046f91@18.198.165.189:9076?discport=30303", // bootstrap2.mantis.pw
189193
]
190194

191195
# List of hex encoded public keys of Checkpoint Authorities

src/main/resources/chains/testnet-internal-nomad-chain.conf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,13 @@
149149
]
150150

151151
# List of hex encoded public keys of Checkpoint Authorities
152-
checkpoint-public-keys = []
152+
checkpoint-public-keys = [
153+
"c3df1dc09a6cc56b94dd9044f087634f06a2cf6f671204d5ffefd062e6c34e272a0699af50bd17f03b7d4926d02cfe6a457915dee95d9b85ea3483b3fa14bc38",
154+
"4e846daa19e0dd2da56237475a24ceb9807e76e0c1952b880d963b8afd2aba4251b517641f89a5c214677cceda795d1ea7c4d5a044baf0d1852b87fb87ce40ce",
155+
"c1e2c120ecf251b7144813786307b62725c13e4c23197aca9199cc81f1a7a042b8f68b552f5f92963b040703fb3ce0c62d860fb5ddfc272b6feba56713123abd",
156+
"faa7718b649fa4713897fcd4331b4f3e26261c1d9d35061cecf414b78a090f76e805e773eaf3e22e2f79d7d7268f38df14f40b72de4f16da0a7066959febb1b8",
157+
"5355fc1bba22b121c3954b0174c8ebfd52efe95e3d062980a916770aec1316c6116a46af591f47f07074f48564cb31c15c90498f2ff9fadf86639e60f3cb2c0d"
158+
]
153159

154160
# List of hex encoded public keys of miners which can extend chain (only used when using restricted-ethash consensus)
155161
# empty means that everybody can mine

src/main/scala/io/iohk/ethereum/blockchain/sync/fast/FastSync.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ class FastSync(
408408
blockchain.getChainWeightByHash(header.parentHash).toRight(ParentChainWeightNotFound(header))
409409
}
410410

411-
private def handleRewind(header: BlockHeader, peer: Peer, N: Int): Unit = {
412-
blacklist(peer.id, blacklistDuration, "block header validation failed")
411+
private def handleRewind(header: BlockHeader, peer: Peer, N: Int, duration: FiniteDuration): Unit = {
412+
blacklist(peer.id, duration, "block header validation failed")
413413
if (header.number <= syncState.safeDownloadTarget) {
414414
discardLastBlocks(header.number, N)
415415
syncState = syncState.updateDiscardedBlocks(header, N)
@@ -431,14 +431,20 @@ class FastSync(
431431
// we blacklist peer just in case we got malicious peer which would send us bad blocks, forcing us to rollback
432432
// to genesis
433433
log.warning("Parent chain weight not found for block {}, not processing rest of headers", header.idTag)
434-
handleRewind(header, peer, syncConfig.fastSyncBlockValidationN)
434+
handleRewind(header, peer, syncConfig.fastSyncBlockValidationN, syncConfig.blacklistDuration)
435435
case HeadersProcessingFinished =>
436436
processSyncing()
437437
case ImportedPivotBlock =>
438438
updatePivotBlock(ImportedLastBlock)
439439
case ValidationFailed(header, peerToBlackList) =>
440-
log.warning(s"validation fo header ${header.idTag} failed")
441-
handleRewind(header, peerToBlackList, syncConfig.fastSyncBlockValidationN)
440+
log.warning(s"validation of header ${header.idTag} failed")
441+
// pow validation failure indicate that either peer is malicious or it is on wrong fork
442+
handleRewind(
443+
header,
444+
peerToBlackList,
445+
syncConfig.fastSyncBlockValidationN,
446+
syncConfig.criticalBlacklistDuration
447+
)
442448
}
443449
} else {
444450
blacklist(peer.id, blacklistDuration, "error in block headers response")

src/main/scala/io/iohk/ethereum/utils/Config.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ object Config {
9494
doFastSync: Boolean,
9595
peersScanInterval: FiniteDuration,
9696
blacklistDuration: FiniteDuration,
97+
criticalBlacklistDuration: FiniteDuration,
9798
startRetryInterval: FiniteDuration,
9899
syncRetryInterval: FiniteDuration,
99100
peerResponseTimeout: FiniteDuration,
@@ -136,6 +137,7 @@ object Config {
136137
doFastSync = syncConfig.getBoolean("do-fast-sync"),
137138
peersScanInterval = syncConfig.getDuration("peers-scan-interval").toMillis.millis,
138139
blacklistDuration = syncConfig.getDuration("blacklist-duration").toMillis.millis,
140+
criticalBlacklistDuration = syncConfig.getDuration("critical-blacklist-duration").toMillis.millis,
139141
startRetryInterval = syncConfig.getDuration("start-retry-interval").toMillis.millis,
140142
syncRetryInterval = syncConfig.getDuration("sync-retry-interval").toMillis.millis,
141143
peerResponseTimeout = syncConfig.getDuration("peer-response-timeout").toMillis.millis,

src/test/scala/io/iohk/ethereum/blockchain/sync/TestSyncConfig.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ trait TestSyncConfig extends SyncConfigBuilder {
1212
pivotBlockOffset = 500,
1313
branchResolutionRequestSize = 2,
1414
blacklistDuration = 5.seconds,
15+
criticalBlacklistDuration = 10.seconds,
1516
syncRetryInterval = 1.second,
1617
checkForNewBlockInterval = 1.milli,
1718
startRetryInterval = 500.milliseconds,

0 commit comments

Comments
 (0)