From 8d76cab46ad9536ff2907e4b5560ae9220d88a9b Mon Sep 17 00:00:00 2001 From: mratsim Date: Wed, 13 Jun 2018 16:05:52 +0200 Subject: [PATCH] =?UTF-8?q?Was=20confused=20about=20=E2=88=A7=20in=20the?= =?UTF-8?q?=20Yellow=20paper.=20Fix=20#50=20-=20pass=202=20new=20tests.=20?= =?UTF-8?q?Only=201=20arithmetic=20failure=20left.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VMTests.md | 10 +++++----- nimbus/vm/forks/gas_costs.nim | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/VMTests.md b/VMTests.md index e75c5ee84..fa678fa0b 100644 --- a/VMTests.md +++ b/VMTests.md @@ -9,7 +9,7 @@ VMTests + add4.json OK + addmod0.json OK + addmod1.json OK -- addmod1_overflow2.json Fail ++ addmod1_overflow2.json OK + addmod1_overflow3.json OK + addmod1_overflow4.json OK + addmod1_overflowDiff.json OK @@ -135,7 +135,7 @@ VMTests + mulUnderFlow.json OK + mulmod0.json OK + mulmod1.json OK -- mulmod1_overflow.json Fail ++ mulmod1_overflow.json OK + mulmod1_overflow2.json OK + mulmod1_overflow3.json OK + mulmod1_overflow4.json OK @@ -185,9 +185,9 @@ VMTests + smod2.json OK + smod3.json OK + smod4.json OK -- smod5.json Fail ++ smod5.json OK + smod6.json OK -- smod7.json Fail ++ smod7.json OK + smod8_byZero.json OK + smod_i256min1.json OK + smod_i256min2.json OK @@ -198,7 +198,7 @@ VMTests + sub3.json OK + sub4.json OK ``` -OK: 189/195 Fail: 5/195 Skip: 1/195 +OK: 193/195 Fail: 1/195 Skip: 1/195 ## vmBitwiseLogicOperation ```diff + and0.json OK diff --git a/nimbus/vm/forks/gas_costs.nim b/nimbus/vm/forks/gas_costs.nim index 2eabe1150..fa4e48cf9 100644 --- a/nimbus/vm/forks/gas_costs.nim +++ b/nimbus/vm/forks/gas_costs.nim @@ -183,13 +183,13 @@ template gasCosts(FeeSchedule: GasFeeSchedule, prefix, ResultGasCostsName: untyp gSreset = FeeSchedule[GasSreset] # Gas cost - literal translation of Yellow Paper - result.gasCost = if value.isZero.not xor gasParams.s_isStorageEmpty: + result.gasCost = if value.isZero.not and gasParams.s_isStorageEmpty: gSet else: gSreset # Refund - if value.isZero xor gasParams.s_isStorageEmpty: + if value.isZero and not gasParams.s_isStorageEmpty: result.gasRefund = static(FeeSchedule[RefundSclear]) func `prefix gasLog0`(activeMemSize, requestedMemSize: Natural): GasInt {.nimcall.} =