Skip to content

Commit

Permalink
Merge pull request #225 from ergoplatform/sigma-v5.0.8
Browse files Browse the repository at this point in the history
Upgrade to sigma v5.0.8
  • Loading branch information
aslesarenko authored Jun 20, 2023
2 parents 44fddd9 + 0d99cb9 commit 5804527
Show file tree
Hide file tree
Showing 88 changed files with 342 additions and 1,453 deletions.
4 changes: 4 additions & 0 deletions MIGRATION
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[5.0.3]
- ErgoId, ErgoToken, ExtendedInputBox, SecretString moved from package org.ergoplatform.appkit to org.ergoplatform.sdk
The org.ergoplatform.sdk package is part of sigmastate library.

[5.0.0]
- block version now required to construct ColdErgoClient
- getBoxById(String boxId) was replaced by getBoxById(String boxId, boolean findInPool, boolean findInSpent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.ergoplatform.appkit.cli

import java.io.{BufferedReader, PrintStream}

import org.ergoplatform.appkit.SecretString
import org.ergoplatform.sdk.SecretString
import org.ergoplatform.appkit.commands.UsageException

/** Abstract interface for Console interactions (print and read operations).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.ergoplatform.appkit.commands

import java.io.File

import org.ergoplatform.appkit._
import org.ergoplatform.appkit.config.ErgoToolConfig
import org.ergoplatform.appkit.cli.{Console, AppContext, CmdLineParser}
import org.ergoplatform.appkit.cli.Console.readNewPassword
import org.ergoplatform.appkit.cli.{AppContext, CmdLineParser, Console}
import org.ergoplatform.appkit.config.ErgoToolConfig
import org.ergoplatform.sdk.{ErgoId, SecretString}

import java.io.File

/** Base class for all commands which can be executed by ErgoTool.
* Inherit this class to implement a new command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.ergoplatform.appkit
import org.ergoplatform.appkit.examples.RunMockedScala
import org.ergoplatform.appkit.examples.RunMockedScala.createMockedErgoClient
import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.SecretString
import org.ergoplatform.{ErgoAddressEncoder, Pay2SAddress}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import org.ergoplatform.appkit.testing.AppkitTesting
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.basics.CryptoConstants
import sigmastate.eval._
import sigmastate.helpers.NegativeTesting
import sigmastate.interpreter.CryptoConstants
import special.sigma.GroupElement

class AnonymousAccessSpec extends AnyPropSpec with Matchers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.ergoplatform.appkit

import org.ergoplatform.appkit.examples.ExampleScenarios
import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.{JavaHelpers, SecretString}
import org.ergoplatform.settings.ErgoAlgos
import org.ergoplatform.validation.ValidationRules
import org.scalatest.matchers.should.Matchers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.JavaHelpers._
import org.ergoplatform.{ErgoScriptPredef, ErgoBox, UnsignedErgoLikeTransaction}
import org.ergoplatform.appkit.impl.{BlockchainContextImpl, InputBoxImpl, UnsignedTransactionBuilderImpl, UnsignedTransactionImpl}
import org.ergoplatform.sdk.JavaHelpers._
import org.ergoplatform.sdk._
import org.ergoplatform.settings.ErgoAlgos
import org.ergoplatform.{ErgoBox, ErgoTreePredef, UnsignedErgoLikeTransaction}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import sigmastate.helpers.NegativeTesting
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.TestsBase
import sigmastate.eval.Colls
import sigmastate.eval.Extensions.ArrayByteOps
import sigmastate.helpers.NegativeTesting
import sigmastate.helpers.TestingHelpers.createBox

import java.util
import java.util.Collections
import util.{List => JList}
import java.util.{Collections, List => JList}

class AppkitProvingInterpreterSpec extends AnyPropSpec
with Matchers
Expand Down Expand Up @@ -73,10 +73,10 @@ class AppkitProvingInterpreterSpec extends AnyPropSpec
val prover = ctx.newProverBuilder()
.withMnemonic(mnemonic, SecretString.empty(), false)
.build()
val tree1 = ErgoScriptPredef.TrueProp(ergoTreeHeaderInTests)
val tree2 = ErgoScriptPredef.FalseProp(ergoTreeHeaderInTests)
val token1 = (ErgoAlgos.hash("id1"), 10L)
val token2 = (ErgoAlgos.hash("id2"), 20L)
val tree1 = ErgoTreePredef.TrueProp(ergoTreeHeaderInTests)
val tree2 = ErgoTreePredef.FalseProp(ergoTreeHeaderInTests)
val token1 = (ErgoAlgos.hash("id1").toTokenId, 10L)
val token2 = (ErgoAlgos.hash("id2").toTokenId, 20L)
val ergoToken1 = Iso.isoErgoTokenToPair.from(token1)
val ergoToken2 = Iso.isoErgoTokenToPair.from(token2)

Expand Down Expand Up @@ -106,7 +106,7 @@ class AppkitProvingInterpreterSpec extends AnyPropSpec
{
case e: TokenBalanceException =>
val cond1 = exceptionLike[TokenBalanceException]("Transaction tries to burn tokens when no burning was requested")
cond1(e) && e.tokensDiff.exists(t => t == (Colls.fromArray(token2._1), -token2._2))
cond1(e) && e.tokensDiff.exists(t => t == (token2._1, -token2._2))
case _ => false
}
)
Expand All @@ -121,7 +121,7 @@ class AppkitProvingInterpreterSpec extends AnyPropSpec
{
case e: TokenBalanceException =>
val cond1 = exceptionLike[TokenBalanceException]("Transaction tries to burn tokens when no burning was requested")
cond1(e) && e.tokensDiff.exists(t => t == (Colls.fromArray(token2._1), -10))
cond1(e) && e.tokensDiff.exists(t => t == (token2._1, -10))
case _ => false
}
)
Expand All @@ -148,7 +148,7 @@ class AppkitProvingInterpreterSpec extends AnyPropSpec
{
case e: TokenBalanceException =>
val cond1 = exceptionLike[TokenBalanceException]("Transaction tries to burn tokens when no burning was requested")
cond1(e) && e.tokensDiff.exists(t => t == (Colls.fromArray(token1._1), -20))
cond1(e) && e.tokensDiff.exists(t => t == (token1._1, -20))
case _ => false
}
)
Expand All @@ -167,8 +167,8 @@ class AppkitProvingInterpreterSpec extends AnyPropSpec
val cond1 = exceptionLike[TokenBalanceException](
"Transaction tries to burn tokens, but not how it was requested")
val ok = cond1(e)
val token2_BurningWasNotRequested = e.tokensDiff.exists(t => t == (Colls.fromArray(token2._1), 10))
val token1_WasRequestedButNotBurned = e.tokensDiff.exists(t => t == (Colls.fromArray(token1._1), -10))
val token2_BurningWasNotRequested = e.tokensDiff.exists(t => t == (token2._1, 10))
val token1_WasRequestedButNotBurned = e.tokensDiff.exists(t => t == (token1._1, -10))
ok && token2_BurningWasNotRequested && token1_WasRequestedButNotBurned
case _ => false
}
Expand All @@ -188,8 +188,8 @@ class AppkitProvingInterpreterSpec extends AnyPropSpec
val cond1 = exceptionLike[TokenBalanceException](
"Only one token can be minted in a transaction")
val ok = cond1(e)
val token1_mint_attempted = e.tokensDiff.exists(t => t == (Colls.fromArray(token1._1), token1._2))
val token2_mint_attempted = e.tokensDiff.exists(t => t == (Colls.fromArray(token2._1), token2._2))
val token1_mint_attempted = e.tokensDiff.exists(t => t == (token1._1, token1._2))
val token2_mint_attempted = e.tokensDiff.exists(t => t == (token2._1, token2._2))
ok && token1_mint_attempted && token2_mint_attempted && e.tokensDiff.length == 2
case _ => false
}
Expand All @@ -209,7 +209,7 @@ class AppkitProvingInterpreterSpec extends AnyPropSpec
val cond1 = exceptionLike[TokenBalanceException](
"Cannot mint a token with invalid id")
val ok = cond1(e)
val token1_mint_attempted = e.tokensDiff.exists(t => t == (Colls.fromArray(token1._1), token1._2))
val token1_mint_attempted = e.tokensDiff.exists(t => t == (token1._1, token1._2))
ok && token1_mint_attempted && e.tokensDiff.length == 1
case _ => false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.babelfee.{BabelFeeOperations, BabelFeeBoxContract, BabelFeeBoxState}
import org.ergoplatform.appkit.babelfee.{BabelFeeBoxContract, BabelFeeBoxState, BabelFeeOperations}
import org.ergoplatform.sdk.{ErgoId, ErgoToken, SecretString}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.{JavaHelpers, SecretString}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.Parameters.MinFee
import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.JavaHelpers.UniversalConverter
import org.ergoplatform.sdk.{ErgoToken, JavaHelpers}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.basics.CryptoConstants
import sigmastate.eval._
import sigmastate.interpreter.CryptoConstants
import special.sigma.GroupElement
import JavaHelpers._

import java.util.{Arrays, List => JList}
import org.ergoplatform.appkit.Parameters.MinFee
import org.ergoplatform.appkit.testing.AppkitTesting
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec

class ChangeOutputSpec extends AnyPropSpec with Matchers
with ScalaCheckDrivenPropertyChecks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.JavaHelpers
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.basics.CryptoConstants
import sigmastate.eval._
import sigmastate.interpreter.CryptoConstants
import special.sigma.GroupElement

class DHTProverSpec extends AnyPropSpec with Matchers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.ergoplatform.appkit

import org.ergoplatform.sdk.SecretString
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.ergoplatform.appkit

import scalan.util.{FileUtil => SFileUtil}
import JavaHelpers._
import org.ergoplatform.appkit
import org.ergoplatform.sdk.JavaHelpers.UniversalConverter

import java.util.{List => JList}
import java.lang.{String => JString}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ package org.ergoplatform.appkit

import org.ergoplatform.ErgoBox
import org.ergoplatform.appkit.testing.AppkitTesting
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.Values.{EvaluatedValue, ByteArrayConstant, IntConstant}
import sigmastate.{SType, TrivialProp}
import sigmastate.helpers.TestingHelpers._
import org.ergoplatform.sdk.JavaHelpers
import org.ergoplatform.sdk.JavaHelpers.UniversalConverter
import org.ergoplatform.wallet.mnemonic.{Mnemonic => WMnemonic}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.Values.{ByteArrayConstant, EvaluatedValue, IntConstant}
import sigmastate.helpers.TestingHelpers._
import sigmastate.{SType, TrivialProp}

class JavaHelpersSpec extends AnyPropSpec with Matchers
with ScalaCheckDrivenPropertyChecks
with AppkitTesting {
import ErgoBox._
import Iso._
import JavaHelpers.UniversalConverter

type Registers = Map[NonMandatoryRegisterId, _ <: EvaluatedValue[_ <: SType]]

Expand All @@ -25,7 +25,7 @@ class JavaHelpersSpec extends AnyPropSpec with Matchers

def check(regs: Registers, expRegs: IndexedSeq[ErgoValue[_]]) = {
val box = boxWithRegs(regs)
val res = JavaHelpers.getBoxRegisters(box).convertTo[IndexedSeq[ErgoValue[_]]]
val res = AppkitHelpers.getBoxRegisters(box).convertTo[IndexedSeq[ErgoValue[_]]]
res shouldBe expRegs
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.ergoplatform.appkit
import java.util
import org.ergoplatform.appkit.Mnemonic._
import org.ergoplatform.appkit.MnemonicValidationException.{MnemonicWrongListSizeException, MnemonicChecksumException, MnemonicWordException, MnemonicEmptyException}
import org.ergoplatform.sdk.{JavaHelpers, SecretString}
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.ergoplatform.appkit;

import org.ergoplatform.sdk.ErgoToken;

import java.util.Collections;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.JavaHelpers
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.basics.CryptoConstants
import sigmastate.eval._
import sigmastate.interpreter.CryptoConstants
import special.sigma.GroupElement

import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.JavaHelpers
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import sigmastate.basics.CryptoConstants
import sigmastate.eval._
import sigmastate.interpreter.CryptoConstants
import special.sigma.GroupElement

import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package org.ergoplatform.appkit

import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import org.ergoplatform.appkit.InputBoxesSelectionException.{InputBoxLimitExceededException, NotEnoughErgsException, NotEnoughCoinsForChangeException}
import org.ergoplatform.appkit.JavaHelpers._
import org.ergoplatform.appkit.AppkitHelpers._
import org.ergoplatform.appkit.InputBoxesSelectionException.{InputBoxLimitExceededException, NotEnoughCoinsForChangeException, NotEnoughErgsException}
import org.ergoplatform.appkit.impl.{Eip4TokenBuilder, ErgoTreeContract}
import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.explorer.client.model.{Items, TokenInfo}
import org.ergoplatform.{ErgoScriptPredef, ErgoBox, appkit}
import org.ergoplatform.sdk.JavaHelpers._
import org.ergoplatform.sdk.{ErgoToken, SecretString}
import org.ergoplatform.{ErgoBox, ErgoTreePredef, appkit}
import org.scalacheck.Gen
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
Expand Down Expand Up @@ -157,7 +159,7 @@ class TxBuilderSpec extends AnyPropSpec with Matchers
.contract(truePropContract(ctx)).build()
val feeOut = txB.outBoxBuilder()
.value(1000000)
.contract(ctx.newContract(ErgoScriptPredef.feeProposition()))
.contract(ctx.newContract(ErgoTreePredef.feeProposition()))
.build()

val changeAddr = Address.fromErgoTree(input.getErgoTree, NetworkType.MAINNET).getErgoAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.ergoplatform.appkit.cli

import org.ergoplatform.appkit
import scalan.util.{FileUtil => SFileUtil}
import org.ergoplatform.appkit.JavaHelpers._
import org.ergoplatform.sdk.JavaHelpers._

import java.util.{List => JList}
import java.lang.{String => JString}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ergoplatform.appkit

import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.sdk.JavaHelpers
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ergoplatform.appkit.examples;

import org.ergoplatform.appkit.*;
import org.ergoplatform.sdk.SecretString;

import java.util.Arrays;

Expand Down Expand Up @@ -30,7 +31,7 @@ public ExampleScenarios(BlockchainContext ctx) {
* @param boxIds string encoded (base16) ids of the boxes to be spent and agregated into the new box.
*/
public SignedTransaction aggregateUtxoBoxes(
String storageFile, SecretString storagePass, String changeAddr, int deadline, String... boxIds) {
String storageFile, SecretString storagePass, String changeAddr, int deadline, String... boxIds) {
UnsignedTransactionBuilder txB = _ctx.newTxBuilder();
InputBox[] boxes = _ctx.getBoxesById(boxIds);
Long total = Arrays.stream(boxes).map(b -> b.getValue()).reduce(0L, (x, y) -> x + y);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.ergoplatform.appkit.examples

import org.ergoplatform.appkit.testing.AppkitTesting
import org.ergoplatform.appkit.{HttpClientTesting, SecretString, BlockchainContext}
import org.ergoplatform.appkit.{BlockchainContext, HttpClientTesting}
import org.ergoplatform.sdk.SecretString

object RunMockedScala extends App with AppkitTesting with HttpClientTesting {
val data = MockData(
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ assemblyMergeStrategy in assembly := {

lazy val allConfigDependency = "compile->compile;test->test"

val sigmaStateVersion = "5.0.7"
val ergoWalletVersion = "5.0.10"
val sigmaStateVersion = "5.0.8"
val ergoWalletVersion = "5.0.12"
lazy val sigmaState = ("org.scorexfoundation" %% "sigma-state" % sigmaStateVersion).force()
.exclude("ch.qos.logback", "logback-classic")
.exclude("org.scorexfoundation", "scrypto")
Expand Down
Loading

0 comments on commit 5804527

Please sign in to comment.