Skip to content

Commit

Permalink
added ErgoDslPredef
Browse files Browse the repository at this point in the history
  • Loading branch information
ergomorphic committed Jan 31, 2019
1 parent 1e167d5 commit 0c58520
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

*.log
test-out/

flamegraphs/
# sbt specific
.cache
.lib/
Expand Down
2 changes: 2 additions & 0 deletions profile-sbt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sbt -J-agentpath:/Applications/YourKit-Java-Profiler-2018.04.app/Contents/Resources/bin/mac/libyjpagent.jnilib

21 changes: 18 additions & 3 deletions src/main/scala/org/ergoplatform/ErgoScriptPredef.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,31 @@ package org.ergoplatform
import org.ergoplatform.ErgoAddressEncoder.NetworkPrefix
import org.ergoplatform.settings.MonetarySettings
import sigmastate.SCollection.SByteArray
import sigmastate.Values.{IntArrayConstant, IntConstant, LongConstant, SigmaPropValue, Value}
import sigmastate._
import sigmastate.Values.{LongConstant, IntArrayConstant, Value, SigmaPropValue, IntConstant}
import sigmastate.basics.DLogProtocol.ProveDlog
import sigmastate.eval.IRContext
import sigmastate.interpreter.CryptoConstants
import sigmastate.lang.Terms.ValueOps
import sigmastate.lang.{SigmaCompiler, TransformingSigmaBuilder}
import sigmastate.{SLong, _}
import special.sigma.{SigmaDslBuilder, Context, SigmaContract}
import sigmastate.lang.{TransformingSigmaBuilder, SigmaCompiler}
import sigmastate.serialization.ErgoTreeSerializer
import sigmastate.utxo._

/** Each method defines the corresponding predef script using ErgoDsl.
* This can be used to stepping through the code using IDE's debugger.
* It can also be used in unit tests */
class ErgoDslPredef(ctx: Context, val builder: SigmaDslBuilder) extends SigmaContract {

// def rewardOutputScript(minerPubkey: ECPoint, delta: Int): Boolean = {
// val createdAtHeight = SELF.creationInfo._1
// HEIGHT >= createdAtHeight + delta &&
// proveDlog(decodePoint(placeholder[Coll[Byte]](0)))
// }
override def canOpen(ctx: Context): Boolean = ???
}


object ErgoScriptPredef {

import sigmastate.interpreter.Interpreter._
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/sigmastate/eval/RuntimeCosting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ trait RuntimeCosting extends SigmaLibrary with DataCosting with Slicing { IR: Ev
// /** Pass configuration which is used during splitting cost function out of cost graph.
// * @see `RuntimeCosting.split2` */
// val costPass = new DefaultPass("costPass", Pass.defaultPassConfig.copy(constantPropagation = true))
//

/** To enable specific configuration uncomment one of the lines above and use it in the beginPass below. */
// beginPass(costPass)

def createSliceAnalyzer = new SliceAnalyzer
Expand Down Expand Up @@ -464,7 +465,7 @@ trait RuntimeCosting extends SigmaLibrary with DataCosting with Slicing { IR: Ev
colBuilder.replicate(xs.sizes.length, typeSize(tpeB))
} else
xs.sizes.map(sizeF)
RCCostedColl(vals, costs, sizes, xs.valuesCost)
RCCostedColl(vals, costs, sizes, xs.valuesCost) // TODO add cost of map node

case CCM.foldCosted(xs: RCostedColl[a], zero: RCosted[b], _f) =>
val f = asRep[Costed[(b,a)] => Costed[b]](_f)
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/sigmastate/interpreter/Interpreter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ trait Interpreter extends ScorexLogging {
case cProp: SigmaBoolean =>
cProp match {
case TrivialProp.TrueProp => true
case TrivialProp.FalseProp => false
case _ =>
// Perform Verifier Steps 1-3
SigSerializer.parseAndComputeChallenges(cProp, proof) match {
Expand Down

0 comments on commit 0c58520

Please sign in to comment.