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

Candidate for 5.0.7 #1942

Merged
merged 129 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
891bdde
initial commit
jellymlg Aug 14, 2022
970b235
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Aug 16, 2022
79dc4bf
optimizations & bugfixes
jellymlg Aug 16, 2022
851fe2b
Merge remote-tracking branch 'origin/i1050-indexing' into i1050-indexing
jellymlg Aug 16, 2022
8531a56
more optimizations
jellymlg Aug 18, 2022
7b5ee0f
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Aug 18, 2022
0cfc609
optimizations(cfor), time debug
jellymlg Aug 21, 2022
53d6909
changed write interval
jellymlg Aug 21, 2022
80bbba0
changed to manual serialization and insertion
jellymlg Aug 21, 2022
0d4be4d
optimized db operations, fixed modifier size getting too big
jellymlg Aug 23, 2022
241b886
fixed variable retrieval, optimized addTx
jellymlg Aug 23, 2022
25de33d
split load between multiple buffers, stricter segmentation
jellymlg Aug 24, 2022
1809afc
[UNTESTED] added token tracking, eliminated separate address based in…
jellymlg Aug 29, 2022
0ca8f1d
tested and fixed token tracking
jellymlg Aug 30, 2022
519cd14
efficient serialization
jellymlg Aug 31, 2022
b786d18
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Aug 31, 2022
49752c8
small fixes, token detection broken
jellymlg Aug 31, 2022
5cefc35
fixed token indexing
jellymlg Sep 2, 2022
13b2d41
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Sep 2, 2022
8a84786
cfor not necessary for serialization
jellymlg Sep 2, 2022
8e1935a
bugfixes, token indexing done
jellymlg Sep 2, 2022
65d9f62
major bugfixes in token indexing
jellymlg Sep 3, 2022
4d1eeeb
minor changes
jellymlg Sep 3, 2022
23bba4f
negative decimals fixed
jellymlg Sep 3, 2022
6f9f450
bugfixes
jellymlg Sep 3, 2022
7a8e379
refractors and more bugfixes
jellymlg Sep 4, 2022
b35350f
lots of bugfixes, added balance tracking [UNTESTED]
jellymlg Sep 9, 2022
0135bee
bugfixes in balance tracking, added api endpoints
jellymlg Sep 11, 2022
3f7ff3d
smaller optimizations
jellymlg Sep 11, 2022
40fe104
small refactor
jellymlg Sep 11, 2022
bf3c5a9
[UNTESTED] bugfix in balance tracking
jellymlg Sep 13, 2022
af035ac
balance tracking mostly working and optimized
jellymlg Sep 14, 2022
ac19515
refactored indexing order to match explorer
jellymlg Sep 16, 2022
8789891
different approach for indexing order, big speed improvement
jellymlg Sep 17, 2022
3194ebc
Merge branch 'master' into i1050-indexing
jellymlg Sep 18, 2022
ceb1584
updated indexer
jellymlg Sep 18, 2022
bc32152
more optimizations, tx sorting working
jellymlg Sep 18, 2022
00b00bf
removed unused stuff
jellymlg Sep 19, 2022
9810d58
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Sep 19, 2022
0a23a86
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Sep 19, 2022
a01f127
Merge branch 'master' into i1050-indexing
jellymlg Sep 26, 2022
3ff45cb
reverted sorting changes
jellymlg Sep 26, 2022
980316b
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Sep 28, 2022
b78ab48
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Oct 2, 2022
e638c63
tx sorting done, boxes seem good
jellymlg Oct 2, 2022
248c6bd
fixed comment
jellymlg Oct 2, 2022
e7b5fe8
fixed tests
jellymlg Oct 2, 2022
0468c1c
added isExplorer flag in /info
jellymlg Oct 3, 2022
e00297b
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Oct 7, 2022
265e087
changed some API endpoints to POST, so large addresses/ergotrees are …
jellymlg Oct 12, 2022
491141d
Merge branch 'v4.0.106' into i1050-indexing
jellymlg Oct 21, 2022
e68a0de
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Oct 21, 2022
4ad2fde
removed null
jellymlg Oct 21, 2022
d789d74
added scaladoc, separate db methods and serializer class
jellymlg Oct 22, 2022
3996b5c
ExtraIndex not inherited from BlockSection
kushti Oct 24, 2022
f389646
minor changes
jellymlg Oct 24, 2022
5fe0787
Merge branch 'v4.0.106' into i1050-indexing
jellymlg Oct 25, 2022
6afa775
Merge branch 'v5.0.2' into i1050-indexing
jellymlg Oct 26, 2022
7b12946
Merge remote-tracking branch 'origin/master' into i1050-indexing
jellymlg Nov 16, 2022
9e20502
CrawlerRunner removed, Rollback signal sent
kushti Nov 21, 2022
ef26fb9
Merge remote-tracking branch 'origin/rollback-signal' into i1050-inde…
jellymlg Nov 22, 2022
3553ae1
rollback half done
jellymlg Nov 23, 2022
6ef6241
[UNTESTED] finished rollback
jellymlg Nov 24, 2022
7386382
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Dec 9, 2022
0885936
refactored ExtraIndexer to use trait and started working on test
jellymlg Dec 23, 2022
40ac420
Merge remote-tracking branch 'origin/i1050-indexing' into i1050-indexing
jellymlg Dec 23, 2022
0105637
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Jan 13, 2023
fca840f
Merge branch 'ergoplatform:master' into i1050-indexing
jellymlg Jan 16, 2023
1298308
reworked rollback, todo test
jellymlg Jan 17, 2023
469e494
small fix
jellymlg Jan 17, 2023
8ce625f
finally done
jellymlg Jan 21, 2023
78b8ebb
Added indexed height endpoint to monitor progress
jellymlg Jan 22, 2023
c6934a4
Application removed
kushti Jan 23, 2023
4518704
NetworkObjectTypeId
kushti Jan 24, 2023
0d33ba7
5.0.7 version set
kushti Jan 25, 2023
252d435
ModifierTypeId no longer used
jellymlg Jan 26, 2023
94796b1
Merge branch 'v5.0.7' of github.com:ergoplatform/ergo into utxo-set-b…
kushti Jan 26, 2023
c09a73b
ScalaDoc, ResponseFromLocal removed
kushti Jan 26, 2023
efac9b4
reworked address encoding
jellymlg Jan 26, 2023
7e723b9
fixed tests
jellymlg Jan 26, 2023
23e88cc
scaladoc #2
kushti Jan 26, 2023
87d9f54
Merge pull request #1859 from jellymlg/i1050-indexing
kushti Jan 26, 2023
f8841f3
Merge pull request #1940 from ergoplatform/utxo-set-bootstrapping-pre…
kushti Jan 26, 2023
aa47d13
ntp dependency removed
kushti Jan 28, 2023
63cf8f3
merging w. 5.0.7
kushti Jan 28, 2023
a91a6a1
after-merging fixes
kushti Jan 28, 2023
7d22bba
readme update
kushti Jan 30, 2023
f9f86b0
private acess for different methods and fields
kushti Jan 30, 2023
cedc212
DifficultyEstimation.scala removed
kushti Jan 30, 2023
8a890f1
scaladoc
kushti Jan 30, 2023
0184480
Update README.md
kushti Jan 30, 2023
7b183f1
Merge pull request #1943 from ergoplatform/i1941
kushti Jan 31, 2023
2e525aa
safety check
jellymlg Jan 31, 2023
cd36311
Merge pull request #1944 from jellymlg/v5.0.7
kushti Feb 1, 2023
70f5a2e
invalidate quick fix
kushti Feb 2, 2023
c6095e5
upgrade sigma to v5.0.4
aslesarenko Feb 2, 2023
baf1c01
upgrade sigma to v5.0.5-RC1
aslesarenko Feb 2, 2023
90e318c
upgrade sigma to v5.0.5
aslesarenko Feb 2, 2023
6e9d2ed
SnapshotsInfo, SnapshotsInfoSpecification
kushti Feb 3, 2023
c5dfa17
Merge pull request #1946 from ergoplatform/sigma-v5.0.4
kushti Feb 3, 2023
1bdf823
addressing review comments
kushti Feb 6, 2023
620b83c
Merge pull request #1945 from ergoplatform/invalidate-fix
kushti Feb 6, 2023
30a9747
Merge pull request #1947 from ergoplatform/utxo-set-bootstrapping-pre…
kushti Feb 6, 2023
05662a3
configure build.sbt for Scala 2.13
aslesarenko Feb 7, 2023
7007e79
fix 2.13 compilation errors
aslesarenko Feb 7, 2023
8ab18cd
add 2.13 to CI
aslesarenko Feb 7, 2023
305b8b2
fix 2.11 compilation
aslesarenko Feb 8, 2023
c63784c
Merge pull request #1948 from ergoplatform/wallet-scala-2.13
kushti Feb 8, 2023
2966717
bump scala-sbt image to 11.0.15_1.7.1_2.13.8
reqlez Feb 9, 2023
0ba8713
Merge pull request #1949 from reqlez/patch-2
kushti Feb 9, 2023
4c5e363
put fix
kushti Feb 9, 2023
a6f4692
further optimization
jellymlg Feb 9, 2023
16168ed
fixed api doc
jellymlg Feb 9, 2023
54eb51e
added ScalaDoc
jellymlg Feb 9, 2023
d4c3a9d
invalidate fix
kushti Feb 10, 2023
30c0823
condition fix
kushti Feb 10, 2023
0cdada3
updated ScalaDoc
jellymlg Feb 11, 2023
74c632f
orderedTransactions.filter
kushti Feb 13, 2023
e65e14a
currentTime memoization
kushti Feb 13, 2023
012fd2b
rollback scaladoc
kushti Feb 13, 2023
410990c
Merge branch 'v5.0.7' of github.com:ergoplatform/ergo into mp-fix2
kushti Feb 13, 2023
89714c6
Merge pull request #1950 from jellymlg/i1050-indexing
kushti Feb 14, 2023
a9c3df9
Merge branch 'v5.0.7' of github.com:ergoplatform/ergo into mp-fix2
kushti Feb 14, 2023
50dffbe
peersToSyncWith optimization
kushti Feb 14, 2023
b637d1b
peersToSyncWith optimization
kushti Feb 14, 2023
596e0aa
Merge branch 'v5.0.7' of github.com:ergoplatform/ergo into v5.0.7
kushti Feb 14, 2023
b78d348
Merge branch 'v5.0.7' of github.com:ergoplatform/ergo into mp-fix2
kushti Feb 14, 2023
5ac73d5
scaladoc for invalidate
kushti Feb 14, 2023
3bce9e7
Merge pull request #1951 from ergoplatform/mp-fix2
kushti Feb 14, 2023
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 .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.12.10, 2.11.12]
scala: [2.13.8, 2.12.10, 2.11.12]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ local.conf
.metals/
.vscode/
project/metals.sbt
null/

# scala worksheets
*.worksheet.sc
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sbtscala/scala-sbt:eclipse-temurin-11.0.15_1.6.2_2.12.16 as builder
FROM sbtscala/scala-sbt:eclipse-temurin-11.0.15_1.7.1_2.13.8 as builder
WORKDIR /mnt
COPY build.sbt findbugs-exclude.xml ./
COPY project/ project/
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ heavy validation attacks
A [White Paper](https://ergoplatform.org/docs/whitepaper.pdf) with a brief description is available. A Yellow Paper with detailed specification is underway and will be available shortly. At the moment, there are [drafts of the Yellow Paper](https://github.com/ergoplatform/ergo/tree/master/papers/yellow) available,
and currently the reference implementation code should be considered as the specification.

## Security assumptions

This client relies on some assumptions in regards with its environment:

* execution environment is trusted. While seed is stored in encrypted files, and the client's
wallet tries to remove secret key from memory as soon as possible when it is not needed, the
client has no protection from side-channel attacks, memory scans etc.
* clocks should be more or less synchronized. If timestamp of a block is more than 20 minutes
in future, the block will be temporarily rejected. The client does not use NTP or other time
syncing protocols.

## Building and Running Node and UI

See [documentation](https://docs.ergoplatform.com/node/install/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Helper {
type HF = Blake2b256.type
type Prover = PersistentBatchAVLProver[Digest32, HF]

implicit val hf = Blake2b256
implicit val hf: HF = Blake2b256

val kl = 32
val vl = 8
Expand Down
3 changes: 2 additions & 1 deletion avldb/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ libraryDependencies ++= Seq(
)

libraryDependencies ++= Seq(
"org.ethereum" % "leveldbjni-all" % "1.18.3"
"org.ethereum" % "leveldbjni-all" % "1.18.3",
"org.typelevel" %% "spire" % "0.14.1"
)

testOptions in Test := Seq(Tests.Filter(t => !t.matches(".*Benchmark$")))
Expand Down
13 changes: 8 additions & 5 deletions avldb/src/main/scala/scorex/db/LDBKVStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.iq80.leveldb.DB
import scorex.util.ScorexLogging

import scala.util.{Failure, Success, Try}
import spire.syntax.all.cfor


/**
Expand All @@ -13,11 +14,13 @@ import scala.util.{Failure, Success, Try}
*/
class LDBKVStore(protected val db: DB) extends KVStoreReader with ScorexLogging {

def update(toInsert: Seq[(K, V)], toRemove: Seq[K]): Try[Unit] = {
def update(toInsert: Array[(K, V)], toRemove: Array[K]): Try[Unit] = {
val batch = db.createWriteBatch()
val insertLen = toInsert.length
val removeLen = toRemove.length
try {
toInsert.foreach { case (k, v) => batch.put(k, v) }
toRemove.foreach(batch.delete)
cfor(0)(_ < insertLen, _ + 1) { i => batch.put(toInsert(i)._1, toInsert(i)._2)}
cfor(0)(_ < removeLen, _ + 1) { i => batch.delete(toRemove(i))}
db.write(batch)
Success(())
} catch {
Expand All @@ -42,9 +45,9 @@ class LDBKVStore(protected val db: DB) extends KVStoreReader with ScorexLogging
}
}

def insert(values: Seq[(K, V)]): Try[Unit] = update(values, Seq.empty)
def insert(values: Array[(K, V)]): Try[Unit] = update(values, Array.empty)

def remove(keys: Seq[K]): Try[Unit] = update(Seq.empty, keys)
def remove(keys: Array[K]): Try[Unit] = update(Array.empty, keys)

/**
* Get last key within some range (inclusive) by used comparator.
Expand Down
7 changes: 5 additions & 2 deletions avldb/src/main/scala/scorex/db/LDBVersionedStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,12 @@ class LDBVersionedStore(protected val dir: File, val initialKeepVersions: Int) e
Undo(versionID, key, value)
}

/**
* Write versioned batch update to the database, removing keys from the database and adding new key -> value pairs
*/
def update(versionID: VersionID,
toRemove: Iterable[Array[Byte]],
toUpdate: Iterable[(Array[Byte], Array[Byte])]): Try[Unit] = Try {
toRemove: TraversableOnce[Array[Byte]],
toUpdate: TraversableOnce[(Array[Byte], Array[Byte])]): Try[Unit] = Try {
lock.writeLock().lock()
val lastLsn = lsn // remember current LSN value
val batch = db.createWriteBatch()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object BatchingBenchmark extends App with FileHelper {
val NumMods = 200000


implicit val hf = Blake2b256
implicit val hf: HF = Blake2b256
type HF = Blake2b256.type

val store = new LDBVersionedStore(getRandomTempDir, initialKeepVersions = 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ import org.ergoplatform.nodeView.{ErgoNodeViewRef, NVBenchmark}
import org.ergoplatform.settings.{Args, ErgoSettings}
import org.ergoplatform.nodeView.ErgoNodeViewHolder.CurrentView
import org.ergoplatform.nodeView.ErgoNodeViewHolder.ReceivableMessages.{GetDataFromCurrentView, LocallyGeneratedModifier}
import scorex.core.utils.{NetworkTimeProvider, NetworkTimeProviderSettings}
import scorex.util.ScorexLogging

import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration._
import scala.language.postfixOps

object BenchRunner extends ScorexLogging with NVBenchmark {

Expand All @@ -41,10 +37,7 @@ object BenchRunner extends ScorexLogging with NVBenchmark {
log.info(s"Setting that being used:")
log.info(s"$ergoSettings")

val ntpSettings = NetworkTimeProviderSettings("pool.ntp.org", 30 minutes, 30 seconds)
val timeProvider = new NetworkTimeProvider(ntpSettings)

val nodeViewHolderRef: ActorRef = ErgoNodeViewRef(ergoSettings, timeProvider)
val nodeViewHolderRef: ActorRef = ErgoNodeViewRef(ergoSettings)

/**
* It's a hack to set minimalFullBlockHeightVar to 0 and to avoid "Header Is Not Synced" error, cause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import java.io.FileOutputStream
import org.ergoplatform.bench.misc.ModifierWriter
import org.ergoplatform.nodeView.history.ErgoHistory
import org.ergoplatform.settings.{Args, ErgoSettings}
import scorex.core.settings.ScorexSettings
import scorex.core.utils.NetworkTimeProvider
import scorex.util.ScorexLogging

import scala.concurrent.ExecutionContext.Implicits.global

object HistoryExtractor extends ScorexLogging {

Expand All @@ -18,11 +15,9 @@ object HistoryExtractor extends ScorexLogging {
lazy val cfgPath: Option[String] = args.headOption
lazy val outputFile: String = args.lift(1).getOrElse("blocks.dat")
lazy val ergoSettings: ErgoSettings = ErgoSettings.read(Args(cfgPath, None))
lazy val settings: ScorexSettings = ergoSettings.scorexSettings

val timeProvider = new NetworkTimeProvider(settings.ntp)
val os = new FileOutputStream(outputFile)
val h = ErgoHistory.readOrGenerate(ergoSettings, timeProvider)
val h = ErgoHistory.readOrGenerate(ergoSettings)(null)
val wholeChain = h.chainToHeader(None, h.bestHeaderOpt.get)

var counter = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package org.ergoplatform.bench.misc

import java.io.{InputStream, OutputStream}

import com.google.common.primitives.Ints
import org.ergoplatform.Utils._
import org.ergoplatform.modifiers.BlockSection
import org.ergoplatform.modifiers.{BlockSection, NetworkObjectTypeId}
import org.ergoplatform.modifiers.history._
import org.ergoplatform.modifiers.history.header.{Header, HeaderSerializer}
import scorex.core.serialization.ScorexSerializer
import scorex.core.{ModifierTypeId, NodeViewModifier}
import scorex.core.NodeViewModifier

object ModifierWriter {

val modifierSerializers: Map[ModifierTypeId, ScorexSerializer[_ <: BlockSection]] =
val modifierSerializers: Map[NetworkObjectTypeId.Value, ScorexSerializer[_ <: BlockSection]] =
Map(Header.modifierTypeId -> HeaderSerializer,
BlockTransactions.modifierTypeId -> BlockTransactionsSerializer,
ADProofs.modifierTypeId -> ADProofsSerializer)
Expand All @@ -34,9 +33,9 @@ object ModifierWriter {
mod <- modifierSerializers(typeId).parseBytesTry(bytes).toOption
} yield mod

private def readModId(implicit fis: InputStream): Option[ModifierTypeId] = {
private def readModId(implicit fis: InputStream): Option[NetworkObjectTypeId.Value] = {
val int = fis.read()
if (int == -1) { None } else { Some(ModifierTypeId @@ int.toByte) }
if (int == -1) { None } else { Some(NetworkObjectTypeId.fromByte(int.toByte)) }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object LDBStoreBench
}

val txsWithDbGen: Gen[(Seq[BlockTransactions], LDBKVStore)] = txsGen.map { bts =>
val toInsert = bts.map(bt => idToBytes(bt.headerId) -> bt.bytes)
val toInsert = bts.map(bt => idToBytes(bt.headerId) -> bt.bytes).toArray
val db = storeLDB()
toInsert.grouped(5).foreach(db.insert(_).get)
bts -> storeLDB
Expand All @@ -53,7 +53,7 @@ object LDBStoreBench
private def randomVersion: Digest32 = Algos.hash(Longs.toByteArray(Random.nextLong()))

private def benchWriteLDB(bts: Seq[BlockTransactions]): Unit = {
val toInsert = bts.map(bt => idToBytes(bt.headerId) -> bt.bytes)
val toInsert = bts.map(bt => idToBytes(bt.headerId) -> bt.bytes).toArray
val db = storeLDB()
toInsert.grouped(5).foreach(db.insert(_).get)
}
Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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"

lazy val commonSettings = Seq(
organization := "org.ergoplatform",
Expand Down Expand Up @@ -36,7 +37,7 @@ val circeVersion = "0.13.0"
val akkaVersion = "2.6.10"
val akkaHttpVersion = "10.2.4"

val sigmaStateVersion = "5.0.3"
val sigmaStateVersion = "5.0.5"

// for testing current sigmastate build (see sigmastate-ergo-it jenkins job)
val effectiveSigmaStateVersion = Option(System.getenv().get("SIGMASTATE_VERSION")).getOrElse(sigmaStateVersion)
Expand All @@ -61,7 +62,6 @@ libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-parsing" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"org.bitlet" % "weupnp" % "0.1.4",
"commons-net" % "commons-net" % "3.6",

// api dependencies
"io.circe" %% "circe-core" % circeVersion,
Expand Down Expand Up @@ -265,7 +265,7 @@ lazy val avldb_benchmarks = (project in file("avldb/benchmarks"))
lazy val ergoWallet = (project in file("ergo-wallet"))
.disablePlugins(ScapegoatSbtPlugin) // not compatible with crossScalaVersions
.settings(
crossScalaVersions := Seq(scalaVersion.value, scala211),
crossScalaVersions := Seq(scala213, scalaVersion.value, scala211),
commonSettings,
name := "ergo-wallet",
libraryDependencies ++= Seq(
Expand Down
3 changes: 2 additions & 1 deletion ergo-wallet/build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// 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"

val circeVersion = "0.13.0"
val circeVersion211 = "0.10.0"

libraryDependencies ++= Seq(
"org.scodec" %% "scodec-bits" % "1.1.6",
"org.scodec" %% "scodec-bits" % "1.1.34",

"io.circe" %% "circe-core" % (if (scalaVersion.value == scala211) circeVersion211 else circeVersion),
"io.circe" %% "circe-generic" % (if (scalaVersion.value == scala211) circeVersion211 else circeVersion),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.ergoplatform.ErgoLikeTransaction;
import org.ergoplatform.UnsignedErgoLikeTransaction;
import scala.collection.JavaConversions;
import scala.collection.JavaConverters;
import sigmastate.basics.DLogProtocol;
import java.util.Map;

Expand All @@ -26,8 +26,10 @@ public ErgoLikeTransaction prove(UnsignedErgoLikeTransaction unsignedTx, DLogPro
* @return signed transaction
*/
public ErgoLikeTransaction prove(UnsignedErgoLikeTransaction unsignedTx, Map<String, DLogProtocol.DLogProverInput> sks) {
// JavaConversions used to support Scala 2.11
return org.ergoplatform.wallet.interpreter.ErgoUnsafeProver.prove(unsignedTx, JavaConversions.mapAsScalaMap(sks));
// This method of JavaConverters is supported across Scala 2.11-2.13
return org.ergoplatform.wallet.interpreter.ErgoUnsafeProver.prove(
unsignedTx,
JavaConverters.mapAsScalaMapConverter(sks).asScala());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class DefaultBoxSelector(override val reemissionDataOpt: Option[ReemissionData])
assetsMet
)) {
formChangeBoxes(currentBalance, targetBalance, currentAssets, targetAssets).mapRight { changeBoxes =>
selectionResultWithEip27Output(res, changeBoxes)
selectionResultWithEip27Output(res.toSeq, changeBoxes)
}
} else {
Left(NotEnoughTokensError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package org.ergoplatform.wallet.boxes
import org.ergoplatform.ErgoBoxCandidate
import sigmastate.eval.Extensions._
import java7.compat.Math

import scala.collection.compat.immutable.ArraySeq
import scala.collection.mutable
import scala.util.Try

Expand All @@ -29,7 +31,7 @@ object ErgoBoxAssetExtractor {
)
box.additionalTokens.foreach {
case (assetId, amount) =>
val aiWrapped = mutable.WrappedArray.make(assetId)
val aiWrapped = ArraySeq.unsafeWrapArray(assetId)
val total = map.getOrElse(aiWrapped, 0L)
map.put(aiWrapped, Math.addExact(total, amount))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ object Mnemonic {
* Converts mnemonic phrase to seed it was derived from.
*/
def toSeed(mnemonic: SecretString, passOpt: Option[SecretString] = None): Array[Byte] = {
val normalizedMnemonic = normalize(mnemonic.getData(), NFKD).toCharArray
val normalizedPass = normalize(("mnemonic".toCharArray ++ passOpt.fold("".toCharArray())(_.getData())), NFKD)
val normalizedMnemonic = normalize(ArrayCharSequence(mnemonic.getData()), NFKD).toCharArray
val normalizedPass = normalize(ArrayCharSequence("mnemonic".toCharArray ++ passOpt.fold("".toCharArray())(_.getData())), NFKD)

passOpt.fold(())(_.erase())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ object TransactionBuilder {

// add burnTokens to target assets so that they are excluded from the change outputs
// thus total outputs assets will be reduced which is interpreted as _token burning_
val tokensOutWithBurned = AssetUtils.mergeAssets(tokensOutNoMinted, burnTokens)
val tokensOutWithBurned = AssetUtils.mergeAssets(tokensOutNoMinted.toMap, burnTokens)

val selection = boxSelector.select(inputs.toIterator, outputTotal, tokensOutWithBurned) match {
case Left(err) => throw new IllegalArgumentException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class MnemonicSpec
val strength = Mnemonic.AllowedStrengths.zip(Mnemonic.MnemonicSentenceSizes).find(_._2 == sentenceSize).map(_._1).get
val mnemonic = new Mnemonic(langId, strength)
Base16.encode(Mnemonic.toSeed(SecretString.create(sentence), Some(SecretString.create(pass)))) shouldEqual seed
normalize(mnemonic.toMnemonic(Base16.decode(entropy).get).get.getData(), NFKD) shouldEqual normalize(sentence, NFKD)
normalize(ArrayCharSequence(mnemonic.toMnemonic(Base16.decode(entropy).get).get.getData()), NFKD) shouldEqual normalize(sentence, NFKD)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import sigmastate.basics.DLogProtocol.ProveDlog
import sigmastate.{SByte, SType}
import org.ergoplatform.wallet.Constants.{ScanId, PaymentsScanId}
import scorex.util._
import scala.collection.IndexedSeq
import org.ergoplatform.ErgoBox
import org.ergoplatform.ErgoBoxCandidate
import org.ergoplatform.ErgoScriptPredef
Expand Down
4 changes: 2 additions & 2 deletions src/it/scala/org/ergoplatform/it/WalletSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class WalletSpec extends AsyncWordSpec with IntegrationSuite with WalletTestOps

val encodedBox = Base16.encode(ErgoBoxSerializer.toBytes(input))

val paymentRequest = PaymentRequest(P2PKAddress(pk), 50000000, Seq.empty, Map.empty)
val requestsHolder = RequestsHolder(Seq(paymentRequest), feeOpt = Some(100000L), Seq(encodedBox), dataInputsRaw = Seq.empty, minerRewardDelay = 720)
val paymentRequest = PaymentRequest(P2PKAddress(pk)(addressEncoder), 50000000, Seq.empty, Map.empty)
val requestsHolder = RequestsHolder(Seq(paymentRequest), feeOpt = Some(100000L), Seq(encodedBox), dataInputsRaw = Seq.empty, minerRewardDelay = 720)(addressEncoder)

node.waitForStartup.flatMap { node: Node =>
for {
Expand Down
Loading