Skip to content

Commit

Permalink
Merge pull request #422 from ergoplatform/v1.6
Browse files Browse the repository at this point in the history
prepare branch for version 1.6
  • Loading branch information
kushti authored Sep 13, 2018
2 parents ce5c37a + 409b932 commit 1446a31
Show file tree
Hide file tree
Showing 159 changed files with 5,257 additions and 1,407 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ my*.conf
# logs
*.log
*.log.gz
*.tmp

# binary files
*.pdf
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ language: scala
sudo: false
branches:
only:
- sigma
- v1.6
- master
- /^\d\.\d+$/
jdk:
- oraclejdk9
scala:
- 2.12.3
- 2.12.6
script:
- sbt clean coverage test coverageReport
- sbt bench:compile
Expand Down
6 changes: 6 additions & 0 deletions benchmarks/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sourceDirectory in Jmh := (sourceDirectory in Test).value
classDirectory in Jmh := (classDirectory in Test).value
dependencyClasspath in Jmh := (dependencyClasspath in Test).value
// rewire tasks, so that 'jmh:run' automatically invokes 'jmh:compile' (otherwise a clean 'jmh:run' would fail)
compile in Jmh := (compile in Jmh).dependsOn(compile in Test).value
run in Jmh := (run in Jmh).dependsOn(Keys.compile in Jmh).evaluated
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.ergoplatform.nodeView.state

import org.ergoplatform.modifiers.mempool.ErgoTransaction
import org.ergoplatform.nodeView.state.ErgoStateBenchmark.BenchmarkState
import org.ergoplatform.utils.ErgoTestHelpers
import org.openjdk.jmh.annotations._
import org.openjdk.jmh.infra.Blackhole
import org.openjdk.jmh.profile.GCProfiler
import org.openjdk.jmh.runner.options.OptionsBuilder
import org.openjdk.jmh.runner.{Runner, RunnerException}

import scala.util.Random


class ErgoStateBenchmark {
@Benchmark
def boxChanges(state: BenchmarkState, bh: Blackhole): Unit = {
bh.consume {
ErgoState.boxChanges(state.txs)
}
}
}

object ErgoStateBenchmark extends ErgoTestHelpers {

@throws[RunnerException]
def main(args: Array[String]): Unit = {
val opt = new OptionsBuilder()
.include(".*" + classOf[ErgoStateBenchmark].getSimpleName + ".*")
.forks(1)
.addProfiler(classOf[GCProfiler])
.build
new Runner(opt).run
}

@State(Scope.Benchmark)
class BenchmarkState {
val blockSize = 1024 * 400
val txsSeq: Seq[Seq[ErgoTransaction]] = (0 until 5) map { i =>
validTransactionsFromBoxHolder(boxesHolderGen.sample.get, new Random, blockSize)._1
}

def txs: Seq[ErgoTransaction] = txsSeq(Random.nextInt(txsSeq.length))
}

}
50 changes: 27 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import sbt.Keys._
import sbt.Keys.{licenses, _}
import sbt._

organization := "org.ergoplatform"

name := "ergo"

version := "1.5.3"

scalaVersion := "2.12.6"

resolvers ++= Seq("Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/",
"SonaType" at "https://oss.sonatype.org/content/groups/public",
"Typesafe maven releases" at "http://repo.typesafe.com/typesafe/maven-releases/",
"Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/")
lazy val commonSettings = Seq(
organization := "org.ergoplatform",
name := "ergo",
version := "1.6.0-SNAPSHOT",
scalaVersion := "2.12.6",
resolvers ++= Seq("Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/",
"SonaType" at "https://oss.sonatype.org/content/groups/public",
"Typesafe maven releases" at "http://repo.typesafe.com/typesafe/maven-releases/",
"Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"),
homepage := Some(url("http://ergoplatform.org/")),
licenses := Seq("CC0" -> url("https://creativecommons.org/publicdomain/zero/1.0/legalcode"))
)

val scorexVersion = "1f5b7c39-SNAPSHOT"
val scorexVersion = "41f3db48-SNAPSHOT"

libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.google.guava" % "guava" % "21.0",
("org.scorexfoundation" %% "scrypto" % "2.1.2").exclude("ch.qos.logback", "logback-classic"),
"org.scorexfoundation" %% "sigma-state" % "0.9.5-SNAPSHOT",
("org.scorexfoundation" %% "sigma-state" % "0.10.0")
.exclude("ch.qos.logback", "logback-classic")
.exclude("org.scorexfoundation", "scrypto"),
"org.scala-lang.modules" %% "scala-async" % "0.9.7",
("org.scorexfoundation" %% "avl-iodb" % "0.2.14").exclude("ch.qos.logback", "logback-classic"),
("org.scorexfoundation" %% "avl-iodb" % "0.2.15").exclude("ch.qos.logback", "logback-classic"),
"org.scorexfoundation" %% "iodb" % "0.3.2",
("org.scorexfoundation" %% "scorex-core" % scorexVersion).exclude("ch.qos.logback", "logback-classic"),
"javax.xml.bind" % "jaxb-api" % "2.+",
Expand Down Expand Up @@ -70,10 +71,6 @@ val opts = Seq(
javaOptions in run ++= opts
scalacOptions ++= Seq("-Xfatal-warnings", "-feature", "-deprecation")

homepage := Some(url("http://ergoplatform.org/"))

licenses := Seq("CC0" -> url("https://creativecommons.org/publicdomain/zero/1.0/legalcode"))

sourceGenerators in Compile += Def.task {
val versionFile = (sourceManaged in Compile).value / "org" / "ergoplatform" / "Version.scala"
val versionExtractor = """(\d+)\.(\d+)\.(\d+).*""".r
Expand Down Expand Up @@ -102,7 +99,7 @@ assemblyMergeStrategy in assembly := {
enablePlugins(sbtdocker.DockerPlugin)

Defaults.itSettings
configs(IntegrationTest extend(Test))
configs(IntegrationTest extend (Test))
inConfig(IntegrationTest)(Seq(
parallelExecution := false,
test := (test dependsOn docker).value,
Expand Down Expand Up @@ -140,7 +137,7 @@ scapegoatDisabledInspections := Seq("FinalModifierOnCaseClass")

val Bench = config("bench") extend Test

inConfig(Bench)(Defaults.testSettings ++ Seq(
inConfig(Bench)(Defaults.testSettings ++ Seq(
fork in run := true,
classDirectory := (classDirectory in Compile).value,
dependencyClasspath := (dependencyClasspath in Compile).value
Expand All @@ -149,3 +146,10 @@ inConfig(Bench)(Defaults.testSettings ++ Seq(
compile in Bench := (compile in Bench).dependsOn(compile in Test).value

Test / testOptions := Seq(Tests.Filter(s => !s.endsWith("Bench")))

lazy val ergo = (project in file(".")).settings(commonSettings: _*)

lazy val benchmarks = (project in file("benchmarks"))
.settings(commonSettings, name := "ergo-benchmarks")
.dependsOn(ergo % "test->test")
.enablePlugins(JmhPlugin)
33 changes: 17 additions & 16 deletions lock.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ dependencyOverrides in ThisBuild ++= Seq(
"com.lihaoyi" % "fastparse_2.12" % "1.0.0",
"com.lihaoyi" % "sourcecode_2.12" % "0.1.4",
"com.sksamuel.scapegoat" % "scalac-scapegoat-plugin_2.12" % "1.3.3",
"com.typesafe" % "config" % "1.3.2",
"com.typesafe" % "ssl-config-core_2.12" % "0.2.3",
"com.typesafe.akka" % "akka-actor_2.12" % "2.5.13",
"com.typesafe.akka" % "akka-http-core_2.12" % "10.1.3",
"com.typesafe.akka" % "akka-http_2.12" % "10.1.3",
"com.typesafe.akka" % "akka-parsing_2.12" % "10.1.3",
"com.typesafe.akka" % "akka-protobuf_2.12" % "2.5.13",
"com.typesafe.akka" % "akka-stream_2.12" % "2.5.13",
"com.typesafe" % "config" % "1.3.3",
"com.typesafe" % "ssl-config-core_2.12" % "0.2.4",
"com.typesafe.akka" % "akka-actor_2.12" % "2.5.16",
"com.typesafe.akka" % "akka-http-core_2.12" % "10.1.4",
"com.typesafe.akka" % "akka-http_2.12" % "10.1.4",
"com.typesafe.akka" % "akka-parsing_2.12" % "10.1.4",
"com.typesafe.akka" % "akka-protobuf_2.12" % "2.5.16",
"com.typesafe.akka" % "akka-stream_2.12" % "2.5.16",
"com.typesafe.scala-logging" % "scala-logging_2.12" % "3.9.0",
"commons-net" % "commons-net" % "3.6",
"de.heikoseeberger" % "akka-http-circe_2.12" % "1.19.0",
Expand All @@ -29,28 +29,29 @@ dependencyOverrides in ThisBuild ++= Seq(
"io.circe" % "circe-numbers_2.12" % "0.9.0",
"io.circe" % "circe-parser_2.12" % "0.8.0",
"javax.activation" % "javax.activation-api" % "1.2.0",
"javax.xml.bind" % "jaxb-api" % "2.4.0-b180725.0427",
"javax.xml.bind" % "jaxb-api" % "2.4.0-b180830.0359",
"jline" % "jline" % "2.14.3",
"net.jpountz.lz4" % "lz4" % "1.3.0",
"org.bitbucket.inkytonik.dsinfo" % "dsinfo_2.12" % "0.4.0",
"org.bitbucket.inkytonik.dsprofile" % "dsprofile_2.12" % "0.4.0",
"org.bitbucket.inkytonik.kiama" % "kiama_2.12" % "2.1.0",
"org.bitlet" % "weupnp" % "0.1.4",
"org.bouncycastle" % "bcprov-jdk15on" % "1.59",
"org.bouncycastle" % "bcprov-jdk15on" % "1.60",
"org.reactivestreams" % "reactive-streams" % "1.0.2",
"org.rogach" % "scallop_2.12" % "2.1.1",
"org.rudogma" % "supertagged_2.12" % "1.4",
"org.scala-lang.modules" % "scala-async_2.12" % "0.9.7",
"org.scala-lang.modules" % "scala-java8-compat_2.12" % "0.8.0",
"org.scala-lang.modules" % "scala-parser-combinators_2.12" % "1.1.0",
"org.scala-lang.modules" % "scala-parser-combinators_2.12" % "1.1.1",
"org.scala-lang.modules" % "scala-xml_2.12" % "1.0.5",
"org.scala-sbt" % "test-interface" % "1.0",
"org.scalacheck" % "scalacheck_2.12" % "1.13.5",
"org.scorexfoundation" % "avl-iodb_2.12" % "0.2.14",
"org.scorexfoundation" % "avl-iodb_2.12" % "0.2.15",
"org.scorexfoundation" % "iodb_2.12" % "0.3.2",
"org.scorexfoundation" % "scorex-core_2.12" % "1f5b7c39-SNAPSHOT",
"org.scorexfoundation" % "scrypto_2.12" % "2.1.2",
"org.scorexfoundation" % "sigma-state_2.12" % "0.9.5-SNAPSHOT",
"org.scorexfoundation" % "scorex-core_2.12" % "41f3db48-SNAPSHOT",
"org.scorexfoundation" % "scorex-util_2.12" % "0.1.1",
"org.scorexfoundation" % "scrypto_2.12" % "2.1.4",
"org.scorexfoundation" % "sigma-state_2.12" % "0.10.0",
"org.slf4j" % "slf4j-api" % "1.7.25",
"org.spire-math" % "jawn-parser_2.12" % "0.11.0",
"org.typelevel" % "cats-core_2.12" % "1.0.1",
Expand All @@ -60,4 +61,4 @@ dependencyOverrides in ThisBuild ++= Seq(
"org.typelevel" % "macro-compat_2.12" % "1.1.1",
"org.whispersystems" % "curve25519-java" % "0.5.0"
)
// LIBRARY_DEPENDENCIES_HASH 18196227db324c7e211f3f318aa56c17d82dc9fb
// LIBRARY_DEPENDENCIES_HASH d0d26edc5215ea45bae038055ab40c18f874d261
4 changes: 2 additions & 2 deletions papers/yellow/block.tex
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ \subsection{Extension}
It contains 2 parts:
\begin{itemize}
\item{\em Mandatory fields } - fields which keys are set via consensus rules and may be changed
via soft/hard forks only. This fields have 4 bytes key and at most 64 bytes value.
via soft/hard forks only. These fields have 4 bytes key and at most 64 bytes value.
Value length is known for all peers and this limit only important due to soft forks -
it is allowed to add at most 1 new key to this section per epoch (256 blocks between
difficulty recalculation), if key is not known to a peer it assumes that soft fork that
added this key was performed.
\item{\em Optional fields } - random data miner may add to a block. This section contains at most 2
elements with 32 byte key size and at most 32 byte value size.
elements with 32 byte key size and at most 64 byte value size.
\end{itemize}

Binary file added papers/yellow/img/box-transition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions papers/yellow/img/box-transition.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<diagram program="umletino" version="14.2"><zoom_level>10</zoom_level><element><id>UMLClass</id><coordinates><x>78</x><y>30</y><w>150</w><h>100</h></coordinates><panel_attributes>Unspent
Offchain

creationHeight = None
spendingHeight = None


</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>448</x><y>30</y><w>150</w><h>100</h></coordinates><panel_attributes>Spent
Offchain

creationHeight = None
spendingHeight = None
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>218</x><y>60</y><w>250</w><h>40</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessSpending(atHeight = None)</panel_attributes><additional_attributes>230;20;10;20</additional_attributes></element><element><id>UMLClass</id><coordinates><x>78</x><y>360</y><w>150</w><h>100</h></coordinates><panel_attributes>Unspent
Onchain

creationHeight = Some
spendingHeight = None


</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>868</x><y>360</y><w>150</w><h>100</h></coordinates><panel_attributes>Spent
Onchain

creationHeight = Some
spendingHeight = Some


</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>218</x><y>370</y><w>670</w><h>40</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessSpending(atHeight = Some)</panel_attributes><additional_attributes>650;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>888</x><y>120</y><w>220</w><h>260</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessSpending(atHeight = Some)</panel_attributes><additional_attributes>10;240;10;10</additional_attributes></element><element><id>Relation</id><coordinates><x>218</x><y>120</y><w>670</w><h>260</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessSpending(atHeight = None)</panel_attributes><additional_attributes>650;10;10;240</additional_attributes></element><element><id>Relation</id><coordinates><x>108</x><y>120</y><w>140</w><h>260</h></coordinates><panel_attributes>lt=&lt;&lt;-
CreationConfirmation
</panel_attributes><additional_attributes>10;240;10;10</additional_attributes></element><element><id>UMLClass</id><coordinates><x>868</x><y>30</y><w>150</w><h>100</h></coordinates><panel_attributes>Spent
Offchain

creationHeight = Some
spendingHeight = None
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>588</x><y>40</y><w>300</w><h>40</h></coordinates><panel_attributes>lt=&lt;&lt;-
CreationConfirmation</panel_attributes><additional_attributes>280;20;10;20</additional_attributes></element><element><id>Relation</id><coordinates><x>178</x><y>120</y><w>340</w><h>260</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessRollback(toHeight &lt; creationHeight)

fg=red</panel_attributes><additional_attributes>50;10;120;120;10;240</additional_attributes></element><element><id>Relation</id><coordinates><x>218</x><y>410</y><w>670</w><h>50</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessRollback(creationHeight &lt;= toHeight &lt; spendingHeight)

fg=red</panel_attributes><additional_attributes>10;20;650;20</additional_attributes></element><element><id>Relation</id><coordinates><x>588</x><y>80</y><w>300</w><h>50</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessRollback(toHeight &lt; creationHeight)

fg=red</panel_attributes><additional_attributes>10;20;280;20</additional_attributes></element><element><id>Relation</id><coordinates><x>28</x><y>90</y><w>890</w><h>450</h></coordinates><panel_attributes>lt=&lt;&lt;-
ProcessRollback(toHeight &lt; creationHeight)

fg=red</panel_attributes><additional_attributes>50;10;10;10;10;390;40;430;870;430;870;370</additional_attributes></element></diagram>
9 changes: 9 additions & 0 deletions papers/yellow/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,15 @@ \part{The Reference Implementation}

\include{sync}

\section{Wallet}

\begin{figure}[H]
\centering
\includegraphics[width=\textwidth]{img/box-transition.png}
\caption{State transitions for boxes tracked by the wallet
\label{fig:emission}}
\end{figure}

\bibliographystyle{elsarticle-num}
\bibliography{sources.bib}
\addcontentsline{toc}{section}{References}
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.1.4
sbt.version=1.2.1
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

addSbtPlugin("com.github.sbt" % "sbt-cpd" % "2.0.0")

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4")
2 changes: 1 addition & 1 deletion src/bench/scala/org/ergoplatform/bench/BenchActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.ergoplatform.bench.protocol.Start
import org.ergoplatform.modifiers.{ErgoFullBlock, ErgoPersistentModifier}
import org.ergoplatform.nodeView.state.StateType
import scorex.core.network.NodeViewSynchronizer.ReceivableMessages.SemanticallySuccessfulModifier
import scorex.core.utils.ScorexLogging
import scorex.util.ScorexLogging

import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
Expand Down
8 changes: 4 additions & 4 deletions src/bench/scala/org/ergoplatform/bench/BenchRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import javax.net.ssl.HttpsURLConnection
import org.ergoplatform.bench.misc.ModifierWriter
import org.ergoplatform.bench.protocol.Start
import org.ergoplatform.mining.EquihashPowScheme
import org.ergoplatform.mining.emission.CoinsEmission
import org.ergoplatform.mining.emission.EmissionRules
import org.ergoplatform.modifiers.ErgoPersistentModifier
import org.ergoplatform.modifiers.history.Header
import org.ergoplatform.nodeView.ErgoNodeViewRef
Expand All @@ -20,8 +20,8 @@ import org.ergoplatform.nodeView.wallet.ErgoWallet
import org.ergoplatform.settings.{ChainSettings, ErgoSettings, MonetarySettings}
import scorex.core.NodeViewHolder.CurrentView
import scorex.core.NodeViewHolder.ReceivableMessages.{GetDataFromCurrentView, LocallyGeneratedModifier}
import scorex.core.utils.{NetworkTimeProvider, NetworkTimeProviderSettings, ScorexLogging}

import scorex.core.utils.{NetworkTimeProvider, NetworkTimeProviderSettings}
import scorex.util.ScorexLogging
import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration._
import scala.language.postfixOps
Expand Down Expand Up @@ -54,7 +54,7 @@ object BenchRunner extends ScorexLogging {
log.info(s"Setting that being used:")
log.info(s"$ergoSettings")

val ce = new CoinsEmission(ergoSettings.chainSettings.monetary)
val ce = new EmissionRules(ergoSettings.chainSettings.monetary)
val ntpSettings = NetworkTimeProviderSettings("pool.ntp.org", 30 minutes, 30 seconds)
val timeProvider = new NetworkTimeProvider(ntpSettings)

Expand Down
2 changes: 1 addition & 1 deletion src/bench/scala/org/ergoplatform/bench/CrawlerActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import org.ergoplatform.bench.misc.CrawlerConfig
import org.ergoplatform.modifiers.{ErgoFullBlock, ErgoPersistentModifier}
import scorex.core.network.NodeViewSynchronizer.ReceivableMessages.SemanticallySuccessfulModifier
import scorex.core.utils.ScorexLogging
import scorex.util.ScorexLogging

class CrawlerActor(c: CrawlerConfig) extends Actor with ScorexLogging {

Expand Down
4 changes: 2 additions & 2 deletions src/bench/scala/org/ergoplatform/bench/CrawlerRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import akka.actor.{ActorRef, Props}
import org.ergoplatform.api.{BlocksApiRoute, InfoRoute, TransactionsApiRoute}
import org.ergoplatform.bench.misc.CrawlerConfig
import org.ergoplatform.local.{ErgoMinerRef, ErgoStatsCollectorRef}
import org.ergoplatform.mining.emission.CoinsEmission
import org.ergoplatform.mining.emission.EmissionRules
import org.ergoplatform.modifiers.ErgoPersistentModifier
import org.ergoplatform.modifiers.mempool.ErgoTransaction
import org.ergoplatform.network.ErgoNodeViewSynchronizer
Expand Down Expand Up @@ -41,7 +41,7 @@ class CrawlerRunner(args: Array[String]) extends Application {

lazy val ergoSettings: ErgoSettings = ErgoSettings.read(cfgPath)

lazy val emission = new CoinsEmission(ergoSettings.chainSettings.monetary)
lazy val emission = new EmissionRules(ergoSettings.chainSettings.monetary)

override implicit lazy val settings: ScorexSettings = ergoSettings.scorexSettings

Expand Down
Loading

0 comments on commit 1446a31

Please sign in to comment.