Skip to content

Commit

Permalink
Merge pull request #2060 from ccellado/extract-nipopow
Browse files Browse the repository at this point in the history
Extract NiPoPow
  • Loading branch information
kushti committed Nov 22, 2023
2 parents 360ef88 + 3f74a7a commit 4aabb51
Show file tree
Hide file tree
Showing 332 changed files with 3,542 additions and 2,227 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scorex.core.serialization
package org.ergoplatform.serialization

import java.nio.ByteBuffer
import scorex.util.ByteArrayBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scorex.core.serialization
package org.ergoplatform.serialization

import scorex.crypto.authds.avltree.batch.Constants.DigestType
import scorex.crypto.authds.avltree.batch.serialization.{BatchAVLProverManifest, ProxyInternalNode}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scorex.core.serialization
package org.ergoplatform.serialization

import scorex.crypto.authds.avltree.batch.Constants.DigestType
import scorex.crypto.authds.avltree.batch.{InternalProverNode, ProverLeaf, ProverNodes, VersionedLDBAVLStorage}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scorex.crypto.authds.avltree.batch

import com.google.common.primitives.Ints
import scorex.core.serialization.ErgoSerializer
import org.ergoplatform.serialization.ErgoSerializer
import scorex.crypto.authds.{ADKey, ADValue, Balance}
import scorex.crypto.authds.avltree.batch.Constants.{DigestType, hashFn}
import scorex.crypto.authds.avltree.batch.serialization.ProxyInternalNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.scalatest.Assertion
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.core.serialization.{ManifestSerializer, SubtreeSerializer}
import org.ergoplatform.serialization.{ManifestSerializer, SubtreeSerializer}
import scorex.crypto.authds.avltree.batch.helpers.TestHelper
import scorex.crypto.authds.{ADDigest, ADKey, ADValue, SerializedAdProof}
import scorex.util.encode.Base16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package org.ergoplatform.bench.misc

import java.io.{InputStream, OutputStream}
import com.google.common.primitives.Ints
import org.ergoplatform.NodeViewModifier
import org.ergoplatform.Utils._
import org.ergoplatform.modifiers.{BlockSection, NetworkObjectTypeId}
import org.ergoplatform.modifiers.history._
import org.ergoplatform.modifiers.history.header.{Header, HeaderSerializer}
import scorex.core.serialization.ErgoSerializer
import scorex.core.NodeViewModifier
import org.ergoplatform.serialization.ErgoSerializer

object ModifierWriter {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.ergoplatform.nodeView.mempool

import org.ergoplatform.modifiers.mempool.{ErgoTransaction, UnconfirmedTransaction}
import org.ergoplatform.testkit.properties.mempool.MempoolFilterPerformanceTest
import org.ergoplatform.utils.generators.{ErgoGenerators, ErgoTransactionGenerators}
import org.scalacheck.Gen
import org.scalatest.propspec.AnyPropSpec
import scorex.testkit.properties.mempool.MempoolFilterPerformanceTest

class MempoolPerformanceBench extends AnyPropSpec
with MempoolFilterPerformanceTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.ergoplatform.nodeView.NVBenchmark
import org.ergoplatform.settings.{ErgoValidationSettingsUpdate, Parameters}
import org.ergoplatform.settings.Parameters.MaxBlockCostIncrease
import org.ergoplatform.utils.{HistoryTestHelpers, RandomWrapper}
import scorex.core.validation.ValidationResult.Valid
import org.ergoplatform.validation.ValidationResult.Valid
import scorex.db.ByteArrayWrapper

import scala.collection.mutable
Expand Down Expand Up @@ -41,7 +41,7 @@ object TransactionExecutionBenchmark extends HistoryTestHelpers with NVBenchmark
val boxes = bh.boxes
def bench: Long =
Utils.time {
assert(ErgoState.execTransactions(txs, emptyStateContext)(id => Try(boxes(ByteArrayWrapper(id)))) == Valid(178665000))
assert(ErgoState.execTransactions(txs, emptyStateContext, settings.nodeSettings)(id => Try(boxes(ByteArrayWrapper(id)))) == Valid(178665000))
}.toLong

(0 to WarmupRuns).foreach(_ => bench)
Expand Down
24 changes: 23 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ val akkaVersion = "2.6.10"
val akkaHttpVersion = "10.2.4"

val sigmaStateVersion = "5.0.12"
val ficusVersion = "1.4.7"

// for testing current sigmastate build (see sigmastate-ergo-it jenkins job)
val effectiveSigmaStateVersion = Option(System.getenv().get("SIGMASTATE_VERSION")).getOrElse(sigmaStateVersion)
Expand Down Expand Up @@ -76,7 +77,7 @@ libraryDependencies ++= Seq(
"org.iq80.leveldb" % "leveldb" % "0.12",

"javax.xml.bind" % "jaxb-api" % "2.4.0-b180830.0359",
"com.iheart" %% "ficus" % "1.4.7",
"com.iheart" %% "ficus" % ficusVersion,
"ch.qos.logback" % "logback-classic" % "1.3.5",
"com.google.guava" % "guava" % "21.0",
"com.github.ben-manes.caffeine" % "caffeine" % "2.9.3", // use 3.x only for java 11+
Expand Down Expand Up @@ -130,6 +131,8 @@ val opts = Seq(

javaOptions in run ++= opts
scalacOptions --= Seq("-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Ywarn-unused:params", "-Xcheckinit")
val scalacOpts = Seq("-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Ywarn-unused:params", "-Xcheckinit")


sourceGenerators in Compile += Def.task {
val versionFile = (sourceManaged in Compile).value / "org" / "ergoplatform" / "Version.scala"
Expand Down Expand Up @@ -262,6 +265,24 @@ lazy val avldb_benchmarks = (project in file("avldb/benchmarks"))
.dependsOn(avldb)
.enablePlugins(JmhPlugin)

lazy val ergoCore = (project in file("ergo-core"))
.dependsOn(avldb % "test->test;compile->compile")
.dependsOn(ergoWallet % "test->test;compile->compile")
.settings(
commonSettings,
name := "ergo-core",
libraryDependencies ++= Seq(
"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.iheart" %% "ficus" % ficusVersion,
effectiveSigma,
(effectiveSigma % Test).classifier("tests")
),
scalacOptions in(Compile, compile) ++= Seq("-release", "8"),
scalacOptions in(Compile, compile) --= scalacOpts,
)

lazy val ergoWallet = (project in file("ergo-wallet"))
.disablePlugins(ScapegoatSbtPlugin) // not compatible with crossScalaVersions
.settings(
Expand Down Expand Up @@ -297,6 +318,7 @@ lazy val ergo = (project in file("."))
scalacOptions in(Compile, compile) ++= Seq("-release", "8"),
javacOptions in(Compile, compile) ++= javacReleaseOption
)
.dependsOn(ergoCore % "test->test;compile->compile")
.dependsOn(ergoWallet % "test->test;compile->compile")
.dependsOn(avldb % "test->test;compile->compile")
.configs(It2Test)
Expand Down
4 changes: 4 additions & 0 deletions ergo-core/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// this values should be in sync with root (i.e. ../build.sbt)
val scala211 = "2.11.12"
val scala212 = "2.12.10"
val scala213 = "2.13.8"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.ergoplatform

/** Exception that triggers proper system shutdown */
case class CriticalSystemException(message: String) extends Exception(message)
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package scorex.core
package org.ergoplatform

trait NodeViewComponent
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package scorex.core
package org.ergoplatform

import org.ergoplatform.core.BytesSerializable
import org.ergoplatform.modifiers.NetworkObjectTypeId
import org.ergoplatform.modifiers.mempool.ErgoTransaction
import scorex.core.serialization.BytesSerializable
import scorex.core.utils.ScorexEncoding
import org.ergoplatform.utils.ScorexEncoding

sealed trait NodeViewModifier extends BytesSerializable with ScorexEncoding {self =>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scorex.core.consensus
package org.ergoplatform.consensus

import org.ergoplatform.modifiers.ErgoNodeViewModifier
import scorex.util.ModifierId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scorex.core.consensus
package org.ergoplatform.consensus

/**
* Outcome of modifier semantic validation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package scorex.core.consensus

package org.ergoplatform.consensus

/**
* Status of a peer's chain relatively to our
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package scorex.core.consensus
package org.ergoplatform.consensus

import org.ergoplatform.PersistentNodeViewModifier
import org.ergoplatform.modifiers.NetworkObjectTypeId
import scorex.core.utils.ScorexEncoder
import scorex.core.PersistentNodeViewModifier
import org.ergoplatform.utils.ScorexEncoder
import scorex.util.ModifierId

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scorex.core.consensus
package org.ergoplatform.consensus

import scorex.core.serialization.BytesSerializable
import org.ergoplatform.core.BytesSerializable

/**
* Syncing info provides information about starting points this node recommends another to start
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package scorex.core.serialization
package org.ergoplatform.core

import org.ergoplatform.serialization.ErgoSerializer

/**
* Basic interface for objects which can be represented as bytes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package scorex
package org.ergoplatform

import org.ergoplatform.modifiers.NetworkObjectTypeId
import scorex.core.network.message.InvData
import scorex.core.utils.ScorexEncoder
import org.ergoplatform.network.message.InvData
import org.ergoplatform.utils.ScorexEncoder
import scorex.util
import scorex.util.encode.Base16
import supertagged.TaggedType

Expand Down

0 comments on commit 4aabb51

Please sign in to comment.