Skip to content

Commit 31f1f47

Browse files
committed
[ETCM-910] PR remarks applied
1 parent 55699da commit 31f1f47

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/scala/io/iohk/ethereum/vm/PrecompiledContracts.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ object PrecompiledContracts {
213213

214214
def calculate(baseLength: Int, modLength: Int, expLength: Int, expBytes: ByteString): BigInt = {
215215
val multComplexity = getMultComplexity(math.max(baseLength, modLength))
216-
val adjExpLen = adjExpLength(expBytes, expLength)
217-
multComplexity * math.max(adjExpLen, 1) / GQUADDIVISOR
216+
val adjusted = adjustExpLength(expBytes, expLength)
217+
multComplexity * math.max(adjusted, 1) / GQUADDIVISOR
218218
}
219219

220220
private def getMultComplexity(x: BigInt): BigInt = {
@@ -233,8 +233,8 @@ object PrecompiledContracts {
233233

234234
def calculate(baseLength: Int, modLength: Int, expLength: Int, expBytes: ByteString): BigInt = {
235235
val multComplexity = getMultComplexity(math.max(baseLength, modLength))
236-
val adjExpLen = adjExpLength(expBytes, expLength)
237-
val r = multComplexity * math.max(adjExpLen, 1) / GQUADDIVISOR
236+
val adjusted = adjustExpLength(expBytes, expLength)
237+
val r = multComplexity * math.max(adjusted, 1) / GQUADDIVISOR
238238
if (r <= 200) 200
239239
else r
240240
}
@@ -264,7 +264,7 @@ object PrecompiledContracts {
264264
safeInt(ByteUtils.toBigInt(bytes.slice(start, start + lengthBytes)))
265265
}
266266

267-
private def adjExpLength(expBytes: ByteString, expLength: Int): Long = {
267+
private def adjustExpLength(expBytes: ByteString, expLength: Int): Long = {
268268
val expHead =
269269
if (expLength <= lengthBytes)
270270
expBytes.padToByteString(expLength, 0.toByte)

src/test/scala/io/iohk/ethereum/vm/PrecompiledContractsSpec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class PrecompiledContractsSpec
199199
)
200200
val testData = Table(
201201
("input", "Expected")
202-
) ++ modexpTestInupts.map {case (name, (input, _)) => (input, modexpPost198ExpectedCosts(name))}
202+
) ++ modexpTestInputs.map {case (name, (input, _)) => (input, modexpPost198ExpectedCosts(name))}
203203

204204
forAll(testData) { (input, expectedResult) =>
205205
val res = ModExp.gas(ByteString(Hex.decode(input)), EtcForks.BeforeAtlantis, EthForks.BeforeByzantium)
@@ -227,15 +227,15 @@ class PrecompiledContractsSpec
227227
)
228228
val testData = Table(
229229
("input", "Expected")
230-
) ++ modexpTestInupts.map {case (name, (input, _)) => (input, modexpPost2565ExpectedCosts(name))}
230+
) ++ modexpTestInputs.map {case (name, (input, _)) => (input, modexpPost2565ExpectedCosts(name))}
231231

232232
forAll(testData) { (input, expectedResult) =>
233233
val res = ModExp.gas(ByteString(Hex.decode(input)), EtcForks.Magneto, EthForks.Berlin)
234234
res shouldEqual expectedResult
235235
}
236236
}
237237

238-
val modexpTestInupts = Map(
238+
val modexpTestInputs = Map(
239239
"modexp_nagydani_1_square" ->
240240
("000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040e09ad9675465c53a109fac66a445c91b292d2bb2c5268addb30cd82f80fcb0033ff97c80a5fc6f39193ae969c6ede6710a6b7ac27078a06d90ef1c72e5c85fb502fc9e1f6beb81516545975218075ec2af118cd8798df6e08a147c60fd6095ac2bb02c2908cf4dd7c81f11c289e4bce98f3553768f392a80ce22bf5c4f4a248c6b",
241241
"60008f1614cc01dcfb6bfb09c625cf90b47d4468db81b5f8b7a39d42f332eab9b2da8f2d95311648a8f243f4bb13cfb3d8f7f2a3c014122ebb3ed41b02783adc"),

0 commit comments

Comments
 (0)