Skip to content

Commit

Permalink
Was confused about ∧ in the Yellow paper. Fix #50 - pass 2 new tests.…
Browse files Browse the repository at this point in the history
… Only 1 arithmetic failure left.
  • Loading branch information
mratsim committed Jun 13, 2018
1 parent 90c3ca4 commit 8d76cab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions VMTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions nimbus/vm/forks/gas_costs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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.} =
Expand Down

0 comments on commit 8d76cab

Please sign in to comment.