Skip to content

Commit

Permalink
Merge pull request #2026 from ergoplatform/v5.0.15
Browse files Browse the repository at this point in the history
5.0.15 release candidate
  • Loading branch information
kushti authored Oct 17, 2023
2 parents a057767 + 4de322a commit b2bd8d4
Show file tree
Hide file tree
Showing 109 changed files with 1,647 additions and 889 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ val circeVersion = "0.13.0"
val akkaVersion = "2.6.10"
val akkaHttpVersion = "10.2.4"

val sigmaStateVersion = "5.0.10"
val sigmaStateVersion = "5.0.12"

// for testing current sigmastate build (see sigmastate-ergo-it jenkins job)
val effectiveSigmaStateVersion = Option(System.getenv().get("SIGMASTATE_VERSION")).getOrElse(sigmaStateVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.ergoplatform.ErgoLikeTransaction;
import org.ergoplatform.UnsignedErgoLikeTransaction;
import scala.collection.JavaConverters;
import sigmastate.basics.DLogProtocol;
import sigmastate.crypto.DLogProtocol;
import java.util.Map;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.ergoplatform.{Height, MinerPubkey, Outputs, Self}
import sigmastate.Values.{ByteArrayConstant, ErgoTree, IntConstant, LongConstant, SigmaPropValue, Value}
import sigmastate.utxo._
import sigmastate._
import special.collection.Coll
import sigma.Coll

/**
* Container for re-emission related contracts. Contains re-emission contract and pay-to-reemission contract.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.ergoplatform.wallet.boxes

import java7.compat.Math
import org.ergoplatform.ErgoBoxCandidate
import special.collection.Extensions._
import sigma.Extensions._

import scala.collection.compat.immutable.ArraySeq
import scala.collection.mutable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.ergoplatform.wallet.serialization.ErgoWalletSerializer
import org.ergoplatform.{ErgoBox, ErgoBoxAssets, ErgoLikeTransaction}
import scorex.util.serialization.{Reader, Writer}
import scorex.util.{ModifierId, bytesToId, idToBytes}
import special.collection.Extensions._
import sigma.Extensions._

/**
* A box tracked by a wallet that contains Ergo box itself as well as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.ergoplatform.wallet.crypto
import org.bouncycastle.util.BigIntegers
import scorex.crypto.hash.Blake2b256
import scorex.util.encode.Base16
import sigmastate.basics.CryptoConstants
import sigmastate.crypto.CryptoConstants
import sigmastate.serialization.GroupElementSerializer

import scala.annotation.tailrec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.ergoplatform.wallet.interpreter

import org.ergoplatform.ErgoLikeContext.Height
import org.ergoplatform.sdk.wallet.protocol.context.ErgoLikeParameters
import org.ergoplatform.sdk.BlockchainParameters
import org.ergoplatform.wallet.protocol.Constants
import org.ergoplatform.{ErgoBox, ErgoBoxCandidate, ErgoLikeContext, ErgoLikeInterpreter}
import scorex.util.ScorexLogging
import sigmastate.Values.ErgoTree
import sigmastate.interpreter.Interpreter.{ScriptEnv, VerificationResult}
import sigmastate.{AvlTreeData, AvlTreeFlags}
import special.collection.Coll
import sigma.Coll

import scala.util.Try

Expand All @@ -18,7 +18,7 @@ import scala.util.Try
*
* @param params - current values of adjustable blockchain settings
*/
class ErgoInterpreter(params: ErgoLikeParameters)
class ErgoInterpreter(params: BlockchainParameters)
extends ErgoLikeInterpreter with ScorexLogging {

/** Override default logging for all Ergo interpreters. */
Expand Down Expand Up @@ -96,7 +96,7 @@ object ErgoInterpreter {
val interpreterInitCost = 10000

/** Creates an interpreter with the given parameters. */
def apply(params: ErgoLikeParameters): ErgoInterpreter =
def apply(params: BlockchainParameters): ErgoInterpreter =
new ErgoInterpreter(params)

/** Create [[AvlTreeData]] with the given digest and all operations enabled. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package org.ergoplatform.wallet.interpreter

import org.ergoplatform._
import org.ergoplatform.sdk.BlockchainParameters
import org.ergoplatform.sdk.utils.ArithUtils.{addExact, multiplyExact}
import org.ergoplatform.sdk.wallet.protocol.context.{ErgoLikeParameters, ErgoLikeStateContext}
import org.ergoplatform.sdk.wallet.protocol.context.BlockchainStateContext
import org.ergoplatform.sdk.wallet.secrets.{ExtendedPublicKey, ExtendedSecretKey, SecretKey}
import org.ergoplatform.validation.{SigmaValidationSettings, ValidationRules}
import org.ergoplatform.wallet.boxes.ErgoBoxAssetExtractor
import scorex.crypto.authds.ADDigest
import scorex.util.encode.Base16
import sigmastate.AvlTreeData
import sigmastate.Values.SigmaBoolean
import sigmastate.basics.SigmaProtocolPrivateInput
import sigmastate.crypto.SigmaProtocolPrivateInput
import sigmastate.interpreter.{ContextExtension, ProverInterpreter}
import special.collection.Coll
import special.sigma.{Header, PreHeader}
import sigma.{Coll, Header, PreHeader}

import java.util
import scala.util.{Failure, Success, Try}
Expand All @@ -39,14 +38,14 @@ import scala.util.{Failure, Success, Try}
* (to not to recompute them)
*/
class ErgoProvingInterpreter(val secretKeys: IndexedSeq[SecretKey],
params: ErgoLikeParameters,
params: BlockchainParameters,
val cachedHdPubKeysOpt: Option[IndexedSeq[ExtendedPublicKey]] = None)
extends ErgoInterpreter(params) with ProverInterpreter {

/**
* Interpreter's secrets, in form of sigma protocols private inputs
*/
val secrets: IndexedSeq[SigmaProtocolPrivateInput[_, _]] = secretKeys.map(_.privateInput)
val secrets: IndexedSeq[SigmaProtocolPrivateInput[_]] = secretKeys.map(_.privateInput)

/**
* Only secrets corresponding to hierarchical deterministic scheme (BIP-32 impl)
Expand Down Expand Up @@ -93,14 +92,14 @@ class ErgoProvingInterpreter(val secretKeys: IndexedSeq[SecretKey],
* @param newParams - updated parameters
* @return modified prover
*/
def withNewParameters(newParams: ErgoLikeParameters): ErgoProvingInterpreter = {
def withNewParameters(newParams: BlockchainParameters): ErgoProvingInterpreter = {
new ErgoProvingInterpreter(this.secretKeys, newParams, this.cachedHdPubKeysOpt)
}

def signInputs(unsignedTx: UnsignedErgoLikeTransaction,
boxesToSpend: IndexedSeq[ErgoBox],
dataBoxes: IndexedSeq[ErgoBox],
stateContext: ErgoLikeStateContext,
stateContext: BlockchainStateContext,
txHints: TransactionHintsBag): Try[(IndexedSeq[Input], Long)] = {
if (unsignedTx.inputs.length != boxesToSpend.length) {
Failure(new Exception("Not enough boxes to spend"))
Expand Down Expand Up @@ -164,7 +163,7 @@ class ErgoProvingInterpreter(val secretKeys: IndexedSeq[SecretKey],
def sign(unsignedTx: UnsignedErgoLikeTransaction,
boxesToSpend: IndexedSeq[ErgoBox],
dataBoxes: IndexedSeq[ErgoBox],
stateContext: ErgoLikeStateContext,
stateContext: BlockchainStateContext,
txHints: TransactionHintsBag = TransactionHintsBag.empty): Try[ErgoLikeTransaction] = {

val signedInputs: Try[(IndexedSeq[Input], Long)] =
Expand All @@ -190,7 +189,7 @@ class ErgoProvingInterpreter(val secretKeys: IndexedSeq[SecretKey],
def generateCommitmentsFor(unsignedTx: UnsignedErgoLikeTransaction,
boxesToSpend: IndexedSeq[ErgoBox],
dataBoxes: IndexedSeq[ErgoBox],
stateContext: ErgoLikeStateContext): Try[TransactionHintsBag] = Try {
stateContext: BlockchainStateContext): Try[TransactionHintsBag] = Try {
val inputCmts = unsignedTx.inputs.zipWithIndex.map { case (unsignedInput, inpIndex) =>

val inputBox = boxesToSpend(inpIndex)
Expand Down Expand Up @@ -230,7 +229,7 @@ class ErgoProvingInterpreter(val secretKeys: IndexedSeq[SecretKey],
def bagForTransaction(tx: ErgoLikeTransaction,
boxesToSpend: IndexedSeq[ErgoBox],
dataBoxes: IndexedSeq[ErgoBox],
stateContext: ErgoLikeStateContext,
stateContext: BlockchainStateContext,
realSecretsToExtract: Seq[SigmaBoolean],
simulatedSecretsToExtract: Seq[SigmaBoolean]): TransactionHintsBag = {
val augmentedInputs = tx.inputs.zipWithIndex.zip(boxesToSpend)
Expand Down Expand Up @@ -262,11 +261,11 @@ class ErgoProvingInterpreter(val secretKeys: IndexedSeq[SecretKey],
object ErgoProvingInterpreter {

def apply(secrets: IndexedSeq[SecretKey],
params: ErgoLikeParameters): ErgoProvingInterpreter =
params: BlockchainParameters): ErgoProvingInterpreter =
new ErgoProvingInterpreter(secrets, params)

def apply(rootSecret: ExtendedSecretKey,
params: ErgoLikeParameters): ErgoProvingInterpreter =
params: BlockchainParameters): ErgoProvingInterpreter =
new ErgoProvingInterpreter(IndexedSeq(rootSecret), params)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.ergoplatform.wallet.interpreter

import org.ergoplatform.{ErgoLikeTransaction, Input, UnsignedErgoLikeTransaction}
import scorex.util.encode.Base16
import sigmastate.basics.DLogProtocol.DLogProverInput
import sigmastate.crypto.DLogProtocol.DLogProverInput
import sigmastate.interpreter.{ContextExtension, ProverResult}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import scorex.util.{ModifierId, bytesToId}
import sigmastate.eval.Extensions._
import sigmastate.eval._
import sigmastate.utils.Extensions._
import special.collection.Coll
import special.collection.Extensions._
import sigma.Coll
import sigma.Extensions._

import scala.collection.JavaConverters._
import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.ergoplatform.wallet.transactions.TransactionBuilder;
import org.ergoplatform.wallet.transactions.TransactionBuilder.Payment;
import scorex.util.Random;
import sigmastate.basics.DLogProtocol;
import sigmastate.crypto.DLogProtocol;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import sigmastate.Values.SigmaPropValue
import sigmastate.eval.Extensions._
import sigmastate.helpers.TestingHelpers._
import sigmastate.utils.Extensions._
import special.collection.Extensions._
import sigma.Extensions._

import scala.util.Random

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.ergoplatform.wallet.utils.Generators
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
import scorex.util.Random
import sigmastate.basics.DLogProtocol.DLogProverInput
import sigmastate.crypto.DLogProtocol.DLogProverInput

class ErgoSignatureSpec extends AnyPropSpec with Matchers with Generators {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.scalatest.matchers.should.Matchers
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import scorex.util.{ModifierId, Random}
import scorex.util.encode.Base16
import sigma.Colls
import sigmastate.CTHRESHOLD
import sigmastate.Values.{GroupElementConstant, SigmaBoolean}
import sigmastate.interpreter.{ContextExtension, HintsBag}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.ergoplatform.wallet.interpreter

import org.ergoplatform.sdk.wallet.protocol.context.{ErgoLikeParameters, ErgoLikeStateContext}
import org.ergoplatform.sdk.BlockchainParameters
import org.ergoplatform.sdk.wallet.protocol.context.BlockchainStateContext
import scorex.util.encode.Base16
import sigmastate.basics.CryptoConstants
import sigmastate.crypto.CryptoConstants
import sigmastate.eval.Extensions.ArrayOps
import sigmastate.eval.{CGroupElement, CPreHeader, Colls}
import special.collection.Coll
import special.sigma.{Header, PreHeader}
import sigmastate.eval.{CGroupElement, CPreHeader}
import sigma.{Coll, Colls, Header, PreHeader}

trait InterpreterSpecCommon {

protected val parameters = new ErgoLikeParameters {
protected val parameters = new BlockchainParameters {

override def storageFeeFactor: Int = 1250000

Expand All @@ -35,7 +35,7 @@ trait InterpreterSpecCommon {
override def blockVersion: Byte = 1
}

protected val stateContext = new ErgoLikeStateContext {
protected val stateContext = new BlockchainStateContext {

override def sigmaLastHeaders: Coll[Header] = Colls.emptyColl

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.scalacheck.{Arbitrary, Gen}
import scorex.crypto.authds.ADKey
import scorex.util._
import sigmastate.Values.{ByteArrayConstant, CollectionConstant, ErgoTree, EvaluatedValue, FalseLeaf, TrueLeaf}
import sigmastate.basics.DLogProtocol.ProveDlog
import sigmastate.crypto.DLogProtocol.ProveDlog
import sigmastate.crypto.CryptoFacade.SecretKeyLength
import sigmastate.eval.Extensions._
import sigmastate.eval._
Expand Down
1 change: 1 addition & 0 deletions src/it/scala/org/ergoplatform/it/WalletSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.ergoplatform.{ErgoBox, P2PKAddress}
import org.scalatest.wordspec.AsyncWordSpec
import scorex.util.ModifierId
import scorex.util.encode.Base16
import sigma.Colls
import sigmastate.Values.{ErgoTree, TrueLeaf}

import scala.concurrent.ExecutionContext
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/api/openapi-ai.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: "3.0.2"

info:
version: "5.0.14"
version: "5.0.15"
title: Ergo Node API
description: Specification of Ergo Node API for ChatGPT plugin.
The following endpoints supported
Expand Down
Loading

0 comments on commit b2bd8d4

Please sign in to comment.