Skip to content

Commit 8b18ae6

Browse files
committed
final polishing
1 parent 5b9d2b9 commit 8b18ae6

File tree

8 files changed

+10
-12
lines changed

8 files changed

+10
-12
lines changed

core/shared/src/main/scala/sigma/ast/SType.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ object SCollection extends STypeCompanion {
775775
override val reprClass: RClass[_] = RClass(classOf[Coll[_]])
776776
override def typeId = SCollectionType.CollectionTypeCode
777777

778-
/** Costructs a collection type with the given type of elements. */
778+
/** Constructs a collection type with the given type of elements. */
779779
implicit def typeCollection[V <: SType](implicit tV: V): SCollection[V] = SCollection[V](tV)
780780

781781
/** Helper descriptors reused across different method descriptors. */

data/shared/src/main/scala/sigma/ast/CostKind.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ case object DynamicCost extends CostKind
6060
object NumericCastCostKind extends TypeBasedCost {
6161
override def costFunc(targetTpe: SType): JitCost = targetTpe match {
6262
case SBigInt => JitCost(30)
63+
case SUnsignedBigInt => JitCost(30)
6364
case _ => JitCost(10)
6465
}
6566
}
@@ -78,7 +79,7 @@ object PowHitCostKind extends CostKind {
7879
def cost(k: Int, msg: Coll[Byte], nonce: Coll[Byte], h: Coll[Byte]): JitCost = {
7980
val chunkSize = CalcBlake2b256.costKind.chunkSize
8081
val perChunkCost = CalcBlake2b256.costKind.perChunkCost
81-
val baseCost = 300
82+
val baseCost = 500
8283

8384
// the heaviest part inside is k + 1 Blake2b256 invocations
8485
val c = baseCost + (k + 1) * ((msg.length + nonce.length + h.length) / chunkSize + 1) * perChunkCost.value

data/shared/src/main/scala/sigma/ast/methods.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ object SNumericTypeMethods extends MethodsContainer {
482482
}
483483

484484
/** Collection of names of numeric casting methods (like `toByte`, `toInt`, etc). */
485-
// todo: add unsigned big int
486485
val castMethods: Array[String] =
487486
Array(ToByteMethod, ToShortMethod, ToIntMethod, ToLongMethod, ToBigIntMethod)
488487
.map(_.name)
@@ -1240,7 +1239,6 @@ object STupleMethods extends MethodsContainer {
12401239
/** A list of Coll methods inherited from Coll type and available as method of tuple. */
12411240
lazy val colMethods: Seq[SMethod] = {
12421241
val subst = Map(SType.tIV -> SAny)
1243-
// TODO: implement other methods
12441242
val activeMethods = Set(1.toByte /*Coll.size*/, 10.toByte /*Coll.apply*/)
12451243
SCollectionMethods.methods.filter(m => activeMethods.contains(m.methodId)).map { m =>
12461244
m.copy(stype = applySubst(m.stype, subst).asFunc)

data/shared/src/main/scala/sigma/data/CHeader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sigma.data
22

3-
import org.ergoplatform.{AutolykosSolution, ErgoHeader, HeaderWithoutPow, HeaderWithoutPowSerializer}
3+
import org.ergoplatform.{AutolykosSolution, ErgoHeader, HeaderWithoutPowSerializer}
44
import scorex.crypto.authds.ADDigest
55
import scorex.crypto.hash.Digest32
66
import scorex.util.{bytesToId, idToBytes}

data/shared/src/main/scala/sigma/data/UnsignedBigIntegerOps.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package sigma.data
33
import debox.cfor
44
import scorex.util.encode.Base16
55
import sigma._
6-
import sigma.crypto.BigIntegers
76
import sigma.data.UnsignedBigIntOrderingOps.UnsignedBigIntOrdering
87
import sigma.eval.Extensions.IntExt
98

data/shared/src/main/scala/sigma/serialization/OpCodes.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,12 @@ object OpCodes {
179179
val BitShiftLeftCode : OpCode = newOpCode(135)
180180
val BitShiftRightZeroedCode : OpCode = newOpCode(136)
181181

182+
// todo: not used, remove
182183
val CollShiftRightCode : OpCode = newOpCode(137)
183184
val CollShiftLeftCode : OpCode = newOpCode(138)
184185
val CollShiftRightZeroedCode : OpCode = newOpCode(139)
185186

187+
// todo: not used, remove
186188
val CollRotateLeftCode : OpCode = newOpCode(140)
187189
val CollRotateRightCode : OpCode = newOpCode(141)
188190

data/shared/src/main/scala/sigma/serialization/SigmaSerializer.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package sigma.serialization
33
import java.nio.ByteBuffer
44
import scorex.util.ByteArrayBuilder
55
import scorex.util.serialization._
6-
import sigma.ast.{Constant, EvaluatedCollection, EvaluatedValue, GroupGenerator, SHeader, SType, SUnsignedBigInt}
76
import sigma.data.SigmaConstants
87
import sigma.serialization.SigmaByteWriter.{FixedCostCallback, PerItemCostCallback}
98
import sigma.serialization.ValueCodes.OpCode

docs/LangSpec.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
ErgoScript is a language to write contracts for [Ergo
66
blockchain](https://ergoplatform.org). ErgoScript contracts can be compiled to
7-
[ErgoTrees](https://ergoplatform.org/docs/ErgoTree.pdf), typed abstract serialized and stored
7+
[ErgoTrees](https://ergoplatform.org/docs/ErgoTree.pdf), typed abstract syntax treeы which are serialized and stored
88
in UTXOs.
99

1010
A good starting point to writing contracts is to use [ErgoScript by
@@ -221,7 +221,7 @@ class Numeric {
221221

222222
The only exception for conversions is about BigInt to and from UnsignedBigInt. To convert from signed big int to unsigned, use
223223
`.toUnsigned` method to convert signed big integer to unsigned, or `.toUnsignedMod(m)` to convert modulo `m` (and modulo
224-
operation is cryptographic, ie always returns positive number modulo `m`). To convert from unsigned big int to signed,
224+
operation is cryptographic, i.e. always returns positive number modulo `m`). To convert from unsigned big int to signed,
225225
use `.toSigned`.
226226

227227
All the predefined numeric types inherit Numeric class and its methods.
@@ -1017,12 +1017,11 @@ satisfying some predicate (condition)
10171017
val ok = OUTPUTS.exists { (box: Box) => box.value > 1000 }
10181018
```
10191019

1020-
### Predefined global functions
1020+
### Global functions
10211021

10221022
There are some functions which do not belong to other types, thus they put under `Global` type. Those functions are:
10231023

10241024

1025-
10261025
```
10271026
{
10281027
/** The generator g of the group is an element of the group such that, when written
@@ -1084,7 +1083,7 @@ src == restored
10841083
```
10851084

10861085

1087-
### Predefined global functions
1086+
### Predefined functions
10881087
<a name="PredefinedFunctions"></a>
10891088

10901089
ErgoScript standard library include predefined functions that can be called

0 commit comments

Comments
 (0)