Complexity Changes by Version#

Every built-in function has a complexity cost, charged against a script’s complexity limit. Several built-ins get cheaper (rarely, more expensive) at a later standard library version, with no change to their arguments or return type, so a script recompiled at a higher STDLIB_VERSION can pass where it previously failed the complexity limit, with no code change.

Note

Generated from node-scala commit 104ddc70e8 by docs/scripts/generate_ride_reference.py. The generator reads the compiled standard library the node evaluates scripts with, not the Scala source text, so every cost on this page is the one the node charges. To change this page, change the generator or move it to a newer node-scala commit and regenerate. CI fails on any hand edit.

The table lists every function whose cost differs anywhere between V5 and V9: 74 rows, one per overload. A dash means the function does not exist at that version. Functions that are new in V6 to V9 appear here only if their cost changes after they are added; for everything a version adds, see Standard Library Versions, and for the full list of functions and costs at one version, see the function reference.

Function

V5

V6

V7

V8

V9

%(a: BigInt, b: BigInt): BigInt

64

64

64

1

1

*(a: BigInt, b: BigInt): BigInt

64

64

64

1

1

+(a: BigInt, b: BigInt): BigInt

8

8

8

1

1

+(a: String, b: String): String

20

1

1

1

1

-(a: BigInt, b: BigInt): BigInt

8

8

8

1

1

-(n: BigInt): BigInt

8

8

8

1

1

/(a: BigInt, b: BigInt): BigInt

64

64

64

1

1

>(a: BigInt, b: BigInt): Boolean

8

8

8

1

1

>=(a: BigInt, b: BigInt): Boolean

8

8

8

1

1

addressFromPublicKey(publicKey: ByteVector): Address

63

1

1

1

1

blake2b256(bytes: ByteVector): ByteVector

200

136

136

136

136

blake2b256_128Kb(bytes: ByteVector): ByteVector

100

115

115

115

115

blake2b256_16Kb(bytes: ByteVector): ByteVector

10

13

13

13

13

blake2b256_32Kb(bytes: ByteVector): ByteVector

25

29

29

29

29

blake2b256_64Kb(bytes: ByteVector): ByteVector

50

58

58

58

58

createMerkleRoot(merkleProof: List[ByteVector], valueBytes: ByteVector, index: Int): ByteVector

30

30

30

30

3

drop(xs: ByteVector, number: Int): ByteVector

6

6

6

6

2

drop(xs: String, number: Int): String

20

20

20

20

2

dropRight(xs: ByteVector, number: Int): ByteVector

6

6

6

6

2

dropRight(xs: String, number: Int): String

20

20

20

20

2

fraction(value: BigInt, numerator: BigInt, denominator: BigInt): BigInt

128

1

1

1

1

fraction(value: BigInt, numerator: BigInt, denominator: BigInt, round: Ceiling|Down|Floor|HalfEven|HalfUp): BigInt

128

1

1

1

1

fraction(value: Int, numerator: Int, denominator: Int): Int

14

1

1

1

1

fraction(value: Int, numerator: Int, denominator: Int, round: Ceiling|Down|Floor|HalfEven|HalfUp): Int

17

1

1

1

1

fromBase16String(str: String): ByteVector

10

10

10

10

4

fromBase64String(str: String): ByteVector

40

40

40

40

12

getBinary(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): ByteVector|Unit

4

4

4

4

2

getBinaryValue(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): ByteVector

4

4

4

4

2

getBoolean(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): Boolean|Unit

4

4

4

4

2

getBooleanValue(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): Boolean

4

4

4

4

2

getElement(arr: List[T], pos: Int): T

2

2

2

2

1

getInteger(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): Int|Unit

4

4

4

4

2

getIntegerValue(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): Int

4

4

4

4

2

getString(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): String|Unit

4

4

4

4

2

getStringValue(data: List[BinaryEntry|BooleanEntry|DeleteEntry|IntegerEntry|StringEntry], index: Int): String

4

4

4

4

2

keccak256(bytes: ByteVector): ByteVector

200

195

195

195

195

keccak256_128Kb(bytes: ByteVector): ByteVector

100

147

147

147

147

keccak256_16Kb(bytes: ByteVector): ByteVector

10

20

20

20

20

keccak256_32Kb(bytes: ByteVector): ByteVector

25

39

39

39

39

keccak256_64Kb(bytes: ByteVector): ByteVector

50

74

74

74

74

makeString(list: List[String], separator: String): String

30

1

1

1

1

max(list: List[BigInt]): BigInt

192

192

192

6

6

median(arr: List[BigInt]): BigInt

160

160

160

35

35

min(list: List[BigInt]): BigInt

192

192

192

6

6

parseBigInt(n: String): BigInt|Unit

65

65

65

1

1

parseBigIntValue(n: String): BigInt

65

65

65

1

1

pow(base: BigInt, bp: Int, exponent: BigInt, ep: Int, rp: Int, round: Ceiling|Down|Floor|HalfEven|HalfUp): BigInt

200

270

270

270

270

pow(base: Int, bp: Int, exponent: Int, ep: Int, rp: Int, round: Ceiling|Down|Floor|HalfEven|HalfUp): Int

100

28

28

28

28

removeByIndex(list: List[T], index: Int): List[T]

7

7

7

4

1

replaceByIndex(list: List[T], index: Int, element: T): List[T]

—

—

—

4

1

sha256(bytes: ByteVector): ByteVector

200

118

118

118

36

sha256_128Kb(bytes: ByteVector): ByteVector

100

93

93

93

32

sha256_16Kb(bytes: ByteVector): ByteVector

10

12

12

12

5

sha256_32Kb(bytes: ByteVector): ByteVector

25

23

23

23

9

sha256_64Kb(bytes: ByteVector): ByteVector

50

47

47

47

17

sigVerify(message: ByteVector, sig: ByteVector, pub: ByteVector): Boolean

200

180

180

180

180

sigVerify_128Kb(message: ByteVector, sig: ByteVector, pub: ByteVector): Boolean

172

150

150

150

150

sigVerify_16Kb(message: ByteVector, sig: ByteVector, pub: ByteVector): Boolean

57

50

50

50

50

sigVerify_32Kb(message: ByteVector, sig: ByteVector, pub: ByteVector): Boolean

70

64

64

64

64

sigVerify_64Kb(message: ByteVector, sig: ByteVector, pub: ByteVector): Boolean

102

93

93

93

93

sigVerify_8Kb(message: ByteVector, sig: ByteVector, pub: ByteVector): Boolean

47

43

43

43

43

size(arr: List[T]): Int

2

2

2

2

1

split(str: String, separator: String): List[String]

75

1

1

1

1

take(xs: ByteVector, number: Int): ByteVector

6

6

6

6

2

take(xs: String, number: Int): String

20

20

20

20

2

takeRight(xs: ByteVector, number: Int): ByteVector

6

6

6

6

2

takeRight(xs: String, number: Int): String

20

20

20

20

2

toBase16String(bytes: ByteVector): String

10

10

10

10

4

toBase64String(bytes: ByteVector): String

35

35

35

35

3

toBigInt(n: ByteVector): BigInt

65

65

65

1

1

toBigInt(n: ByteVector, off: Int, size: Int): BigInt

65

65

65

1

1

toBytes(n: BigInt): ByteVector

65

65

65

1

1

toString(Address: Address): String

10

1

1

1

1

toString(n: BigInt): String

65

1

1

1

1

Where a function’s argument types are written differently at different versions, the row shows the newest spelling. For example, rsaVerify takes the digest algorithm as RsaDigestAlgs up to V5 and as the equivalent spelled-out union from V6.