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

Fixed peers.dat parser #3973

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grpc-server/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inConfig(Compile)(
)

enablePlugins(RunApplicationSettings, ExtensionPackaging)

Universal / maintainer := "com.wavesplatform"
Debian / debianControlFile := {
val generatedFile = (Debian / debianControlFile).value
IO.append(generatedFile, s"""Conflicts: grpc-server${network.value.packageSuffix}
Expand Down
2 changes: 2 additions & 0 deletions node/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ versionScheme := Some("pvp")

Compile / packageDoc / publishArtifact := true
Test / packageDoc / publishArtifact := false
Compile / packageDoc / mappings := Seq()

inConfig(Compile)(
Seq(
Expand Down Expand Up @@ -88,6 +89,7 @@ linuxScriptReplacements += ("network" -> network.value.toString)

inConfig(Universal)(
Seq(
maintainer := "com.wavesplatform",
packageName := s"waves-${version.value}",
mappings += (baseDirectory.value / s"waves-sample.conf" -> "doc/waves.conf.sample"),
javaOptions ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ class PeerDatabaseImpl(settings: NetworkSettings, ticker: Ticker = Ticker.system

private val IPAndPort = """(\d+)\.(\d+)\.(\d+)\.(\d+):(\d+)""".r

for (f <- settings.file if f.exists()) try {
for (f <- settings.file if f.exists && f.isFile && f.length > 0) try {
JsonFileStorage.load[PeersPersistenceType](f.getCanonicalPath).map {
case IPAndPort(a, b, c, d, port) =>
addCandidate(new InetSocketAddress(InetAddress.getByAddress(Array(a.toByte, b.toByte, c.toByte, d.toByte)), port.toInt))
addCandidate(new InetSocketAddress(InetAddress.getByAddress(Array(a, b, c, d).map(_.toInt.toByte)), port.toInt))
case _ =>
}

log.info(s"Loaded ${unverifiedPeers.size} known peer(s) from ${f.getName}")
} catch {
case NonFatal(_) => log.info("Legacy or corrupted peers.dat, ignoring, starting all over from known-peers...")
case NonFatal(e) => log.info("Legacy or corrupted peers.dat, ignoring, starting all over from known-peers...", e)
}

override def addCandidate(socketAddress: InetSocketAddress): Boolean = unverifiedPeers.synchronized {
Expand Down
12 changes: 6 additions & 6 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Dependencies {

private def akkaHttpModule(module: String) = "com.typesafe.akka" %% module % "10.2.10"

private def kamonModule(module: String) = "io.kamon" %% s"kamon-$module" % "2.7.3"
private def kamonModule(module: String) = "io.kamon" %% s"kamon-$module" % "2.7.5"

private def jacksonModule(group: String, module: String) = s"com.fasterxml.jackson.$group" % s"jackson-$module" % "2.15.3"

Expand All @@ -28,7 +28,7 @@ object Dependencies {
val googleGuava = "com.google.guava" % "guava" % "33.3.1-jre"
val kamonCore = kamonModule("core")
val machinist = "org.typelevel" %% "machinist" % "0.6.8"
val logback = "ch.qos.logback" % "logback-classic" % "1.5.8"
val logback = "ch.qos.logback" % "logback-classic" % "1.5.11"
val janino = "org.codehaus.janino" % "janino" % "3.1.12"
val asyncHttpClient = "org.asynchttpclient" % "async-http-client" % "3.0.0"
val curve25519 = "com.wavesplatform" % "curve25519-java" % "0.6.6"
Expand All @@ -41,8 +41,8 @@ object Dependencies {
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.19" % Test
val scalaJsTest = Def.setting("com.lihaoyi" %%% "utest" % "0.8.4" % Test)

val sttp3 = "com.softwaremill.sttp.client3" % "core_2.13" % "3.9.8"
val sttp3Monix = "com.softwaremill.sttp.client3" %% "monix" % "3.9.8"
val sttp3 = "com.softwaremill.sttp.client3" % "core_2.13" % "3.10.1"
val sttp3Monix = "com.softwaremill.sttp.client3" %% "monix" % "3.10.1"

val bouncyCastleProvider = "org.bouncycastle" % s"bcprov-jdk18on" % "1.78.1"

Expand Down Expand Up @@ -75,7 +75,7 @@ object Dependencies {

lazy val it = scalaTest +: Seq(
logback,
"com.github.jnr" % "jnr-unixsocket" % "0.38.22", // To support Apple ARM
"com.github.jnr" % "jnr-unixsocket" % "0.38.23", // To support Apple ARM
"com.spotify" % "docker-client" % "8.16.0",
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-properties" % "2.18.0",
asyncHttpClient
Expand Down Expand Up @@ -128,7 +128,7 @@ object Dependencies {
nettyHandler,
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5",
"eu.timepit" %% "refined" % "0.11.2" exclude ("org.scala-lang.modules", "scala-xml_2.13"),
"com.esaulpaugh" % "headlong" % "12.3.0",
"com.esaulpaugh" % "headlong" % "12.3.1",
"com.github.jbellis" % "jamm" % "0.4.0", // Weighing caches
web3jModule("abi").excludeAll(ExclusionRule("org.bouncycastle", "bcprov-jdk15on"))
) ++ console ++ logDeps ++ protobuf.value ++ langCompilerPlugins.value
Expand Down
8 changes: 4 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.7")
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.17"

Seq(
"com.eed3si9n" % "sbt-assembly" % "2.2.0",
"com.eed3si9n" % "sbt-assembly" % "2.3.0",
"com.github.sbt" % "sbt-native-packager" % "1.10.4",
"se.marcuslonnberg" % "sbt-docker" % "1.11.0",
"org.scala-js" % "sbt-scalajs" % "1.16.0",
"org.scala-js" % "sbt-scalajs" % "1.17.0",
"org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2",
"pl.project13.scala" % "sbt-jmh" % "0.4.7",
"com.github.sbt" % "sbt-ci-release" % "1.6.1",
"com.github.sbt" % "sbt-ci-release" % "1.8.0",
"com.lightbend.sbt" % "sbt-javaagent" % "0.1.6"
).map(addSbtPlugin)

libraryDependencies ++= Seq(
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.17.2",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.18.0",
"org.hjson" % "hjson" % "3.1.0",
"org.vafer" % "jdeb" % "1.11" artifacts Artifact("jdeb", "jar", "jar"),
"org.slf4j" % "jcl-over-slf4j" % "2.0.16",
Expand Down