Skip to content

Commit

Permalink
Merge pull request #2091 from ergoplatform/v5.0.19
Browse files Browse the repository at this point in the history
Candidate for 5.0.19 release
  • Loading branch information
kushti authored Jan 18, 2024
2 parents 48239ef + d099ed4 commit 9f29235
Show file tree
Hide file tree
Showing 45 changed files with 532 additions and 179 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.8, 2.12.10, 2.11.12]
scala: [2.13.12, 2.12.18, 2.11.12]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.10]
scala: [2.12.18]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish release-binaries

on:
release:
types: [published]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
release-binaries:
name: Publish release binaries
runs-on: macos-latest
env:
ERGO_RELEASE_PLATFORM: macos-x64
ERGO_RELEASE_TAG: ${{ github.event.release.tag_name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Download ergo node jar
run: |
echo $GITHUB_REF
gh release download $ERGO_RELEASE_TAG -p "ergo*"
- name: Create release binary files
run: python ci/release-binaries.py
- name: Put binary files into release
run: gh release upload $ERGO_RELEASE_TAG $(echo $(find release -name "ergo-node-*"))
33 changes: 21 additions & 12 deletions avldb/build.sbt
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
import sbt.Keys.testFrameworks

val scala211 = "2.11.12"
val scala212 = "2.12.18"
val scala213 = "2.13.12"

name := "avldb"

val Versions = new {

val spire = (scalaVersion: String) =>
if (scalaVersion == scala213) "0.17.0"
else "0.14.1"

val scalameter = (scalaVersion: String) =>
if (scalaVersion == scala213) "0.19"
else "0.9"
}

libraryDependencies ++= Seq(
"javax.xml.bind" % "jaxb-api" % "2.4.0-b180830.0359",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.google.guava" % "guava" % "23.0",
"org.scorexfoundation" %% "scrypto" % "2.3.0"
)

libraryDependencies ++= Seq(
"org.scorexfoundation" %% "scrypto" % "2.3.0",
"org.scalatest" %% "scalatest" % "3.1.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.14.3" % "test",
"org.scalatestplus" %% "scalatestplus-scalacheck" % "3.1.0.0-RC2" % Test,
"com.storm-enroute" %% "scalameter" % "0.9" % "test"
)

libraryDependencies ++= Seq(
"com.storm-enroute" %% "scalameter" % Versions.scalameter(scalaVersion.value) % "test",
"org.ethereum" % "leveldbjni-all" % "1.18.3",
"org.typelevel" %% "spire" % "0.14.1"
"org.typelevel" %% "spire" % Versions.spire(scalaVersion.value)
)

testOptions in Test := Seq(Tests.Filter(t => !t.matches(".*Benchmark$")))
Expand All @@ -38,13 +47,13 @@ publishTo := {

pomIncludeRepository := { _ => false }

scalacOptions ++= Seq("-Xfatal-warnings", "-feature", "-deprecation")
scalacOptions ++= Seq("-feature", "-deprecation")

// set bytecode version to 8 to fix NoSuchMethodError for various ByteBuffer methods
// see https://github.com/eclipse/jetty.project/issues/3244
// these options applied only in "compile" task since scalac crashes on scaladoc compilation with "-release 8"
// see https://github.com/scala/community-builds/issues/796#issuecomment-423395500
scalacOptions in(Compile, compile) ++= Seq("-release", "8")
scalacOptions --= Seq("-Ywarn-numeric-widen", "-Ywarn-value-discard")
scalacOptions in(Compile, compile) ++= (if (scalaBinaryVersion.value == "2.11") Seq() else Seq("-release", "8"))
scalacOptions --= Seq("-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Ywarn-unused:params", "-Xfatal-warnings")

enablePlugins(ReproducibleBuildsPlugin)
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class VersionedLDBAVLStorage(store: LDBVersionedStore)
}

def dumpSubtree(sid: DigestType): Try[Unit] = {
val builder = mutable.ArrayBuilder.make[Byte]()
val builder = new mutable.ArrayBuilder.ofByte
builder.sizeHint(200000)
subtreeLoop(sid, builder)
dumpStorage.insert(sid, builder.result())
Expand All @@ -141,7 +141,7 @@ class VersionedLDBAVLStorage(store: LDBVersionedStore)

require(rootNodeLabel.sameElements(expectedRootHash), "Root node hash changed")

val manifestBuilder = mutable.ArrayBuilder.make[Byte]()
val manifestBuilder = new mutable.ArrayBuilder.ofByte
manifestBuilder.sizeHint(200000)
manifestBuilder += rootNodeHeight
manifestBuilder += manifestDepth
Expand Down
12 changes: 6 additions & 6 deletions avldb/src/main/scala/scorex/db/ByteArrayUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package scorex.db

object ByteArrayUtils {

import java.util.Comparator

// Java comparator
val BYTE_ARRAY_COMPARATOR: Comparator[Array[Byte]] = (o1: Array[Byte], o2: Array[Byte]) => compare(o1, o2)

object BYTE_ARRAY_COMPARATOR extends Ordering[Array[Byte]] {
def compare(o1: Array[Byte], o2: Array[Byte]) = compare(o1, o2)
}
// Scala comparator
implicit val ByteArrayOrdering: Ordering[Array[Byte]] =
(o1: Array[Byte], o2: Array[Byte]) => ByteArrayUtils.compare(o1, o2)
implicit object ByteArrayOrdering extends Ordering[Array[Byte]] {
def compare(o1: Array[Byte], o2: Array[Byte]) = ByteArrayUtils.compare(o1, o2)
}

def compare(o1: Array[Byte], o2: Array[Byte]): Int = {
val len = Math.min(o1.length, o2.length)
Expand Down
2 changes: 1 addition & 1 deletion avldb/src/main/scala/scorex/db/LDBKVStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class LDBKVStore(protected val db: DB) extends KVStoreReader with ScorexLogging
breakable {
while (i.hasNext) {
val key = i.next().getKey
if (ByteArrayUtils.compare(key, last) <= 0) res = Some(key) else break
if (ByteArrayUtils.compare(key, last) <= 0) res = Some(key) else break()
}
}
res
Expand Down
11 changes: 7 additions & 4 deletions avldb/src/test/scala/scorex/db/ByteArrayUtilsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks

import scala.math.Ordering.Implicits._

class ByteArrayUtilsSpec extends AnyPropSpec with ScalaCheckPropertyChecks with Matchers {

lazy val nonEmptyBytesGen: Gen[Array[Byte]] = Gen.nonEmptyListOf(Arbitrary.arbitrary[Byte])
.map(_.toArray).suchThat(_.length > 0)

property("compare works properly") {

//Simple and inefficient way to order byte arrays, based on
// https://stackoverflow.com/questions/7109943/how-to-define-orderingarraybyte
// but we compare unsigned bytes
val ordering: Ordering[Array[Byte]] = Ordering.by((_: Array[Byte]).toIterable.map(_ & 0xFF))
val ordering: Ordering[Array[Byte]] =
new Ordering[Array[Byte]] {
override def compare(o1: Array[Byte], o2: Array[Byte]): Int =
implicitly[Ordering[Seq[Int]]].compare(o1.toSeq.map(_ & 0xFF), o2.toSeq.map(_ & 0xFF))
}

forAll(nonEmptyBytesGen, nonEmptyBytesGen) { case (bs1, bs2) =>
val efficientOrdering = Seq(bs1, bs2).sorted(ByteArrayUtils.ByteArrayOrdering)
Expand Down
25 changes: 15 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ logLevel := Level.Debug

// this values should be in sync with ergo-wallet/build.sbt
val scala211 = "2.11.12"
val scala212 = "2.12.10"
val scala213 = "2.13.8"
val scala212 = "2.12.18"
val scala213 = "2.13.12"

lazy val commonSettings = Seq(
organization := "org.ergoplatform",
Expand Down Expand Up @@ -44,16 +44,10 @@ val ficusVersion = "1.4.7"
val effectiveSigmaStateVersion = Option(System.getenv().get("SIGMASTATE_VERSION")).getOrElse(sigmaStateVersion)
val effectiveSigma = "org.scorexfoundation" %% "sigma-state" % effectiveSigmaStateVersion


libraryDependencies ++= Seq(
effectiveSigma.force()
.exclude("ch.qos.logback", "logback-classic")
.exclude("org.scorexfoundation", "scrypto"),

// api dependencies
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,

"ch.qos.logback" % "logback-classic" % "1.3.5",

Expand Down Expand Up @@ -208,14 +202,17 @@ scapegoatDisabledInspections := Seq("FinalModifierOnCaseClass")
Test / testOptions := Seq(Tests.Filter(s => !s.endsWith("Bench")))

lazy val avldb = (project in file("avldb"))
.disablePlugins(ScapegoatSbtPlugin) // not compatible with crossScalaVersions
.settings(
crossScalaVersions := Seq(scala213, scalaVersion.value, scala211),
commonSettings,
name := "avldb",
// set bytecode version to 8 to fix NoSuchMethodError for various ByteBuffer methods
// see https://github.com/eclipse/jetty.project/issues/3244
// these options applied only in "compile" task since scalac crashes on scaladoc compilation with "-release 8"
// see https://github.com/scala/community-builds/issues/796#issuecomment-423395500
scalacOptions in(Compile, compile) ++= Seq("-release", "8"),
scalacOptions in(Compile, compile) ++= (if (scalaBinaryVersion.value == "2.11") Seq() else Seq("-release", "8")),
scalacOptions in(Compile, compile) --= scalacOpts,
javacOptions in(Compile, compile) ++= javacReleaseOption,
libraryDependencies ++= Seq(
// database dependencies
Expand Down Expand Up @@ -244,17 +241,19 @@ lazy val avldb_benchmarks = (project in file("avldb/benchmarks"))
.enablePlugins(JmhPlugin)

lazy val ergoCore = (project in file("ergo-core"))
.disablePlugins(ScapegoatSbtPlugin) // not compatible with crossScalaVersions
.dependsOn(avldb % "test->test;compile->compile")
.dependsOn(ergoWallet % "test->test;compile->compile")
.settings(
crossScalaVersions := Seq(scala213, scalaVersion.value, scala211),
commonSettings,
name := "ergo-core",
libraryDependencies ++= Seq(
"com.iheart" %% "ficus" % ficusVersion,
effectiveSigma,
(effectiveSigma % Test).classifier("tests")
),
scalacOptions in(Compile, compile) ++= Seq("-release", "8"),
scalacOptions in(Compile, compile) ++= (if (scalaBinaryVersion.value == "2.11") Seq() else Seq("-release", "8")),
scalacOptions in(Compile, compile) --= scalacOpts,
)

Expand Down Expand Up @@ -293,12 +292,18 @@ lazy val ergo = (project in file("."))
scalacOptions in(Compile, compile) ++= Seq("-release", "8"),
javacOptions in(Compile, compile) ++= javacReleaseOption,
libraryDependencies ++= Seq(
// api dependencies
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
// network dependencies
"com.typesafe.akka" %% "akka-stream" % akkaVersion, // required for akka-http to compile
"com.typesafe.akka" %% "akka-actor" % akkaVersion, // required for akka-http to compile
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-core" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-parsing" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,

"org.bitlet" % "weupnp" % "0.1.4",
// command line args parsing
"com.github.scopt" %% "scopt" % "4.0.1",
Expand Down
Binary file added ci/ergo.icns
Binary file not shown.
Loading

0 comments on commit 9f29235

Please sign in to comment.