Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean opcodes do not compile on latest devel #63

Closed
mratsim opened this issue Jul 3, 2018 · 1 comment
Closed

Boolean opcodes do not compile on latest devel #63

mratsim opened this issue Jul 3, 2018 · 1 comment

Comments

@mratsim
Copy link
Contributor

mratsim commented Jul 3, 2018

The current boolean implementation relies on 0 == false in a corner macro case that was fixed in devel.

Consequently, Nimbus does not compile on latest devel

.../nimbus/nimbus/vm/interpreter/opcodes_impl/comparison.nim(11, 13) template/generic instantiation from here
.../nimbus/nimbus/vm/interpreter/opcodes_impl/helpers.nim(33, 12) template/generic instantiation from here
lib/system.nim(414, 10) Error: type mismatch: got <bool, int literal(0)>
but expected one of:
proc `==`[Enum: enum](x, y: Enum): bool
  first type mismatch at position: 1
  required type: Enum: enum
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: pointer): bool
  first type mismatch at position: 1
  required type: pointer
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: string): bool
  first type mismatch at position: 1
  required type: string
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: char): bool
  first type mismatch at position: 1
  required type: char
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: bool): bool
  first type mismatch at position: 2
  required type: bool
  but expression '0' is of type: int literal(0)
proc `==`[T](x, y: set[T]): bool
  first type mismatch at position: 1
  required type: set[T]
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[T](x, y: ref T): bool
  first type mismatch at position: 1
  required type: ref T
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[T](x, y: ptr T): bool
  first type mismatch at position: 1
  required type: ptr T
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[T: proc](x, y: T): bool
  first type mismatch at position: 1
  required type: T: proc
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: int16): bool
  first type mismatch at position: 1
  required type: int16
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: int64): bool
  first type mismatch at position: 1
  required type: int64
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a343728: StUint[bits]; b343730: int{lit}): bool
  first type mismatch at position: 1
  required type: StUint[==.bits]
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[T: SomeUnsignedInt](x, y: T): bool
  first type mismatch at position: 1
  required type: T: SomeUnsignedInt
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: int8): bool
  first type mismatch at position: 1
  required type: int8
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: float32): bool
  first type mismatch at position: 1
  required type: float32
  but expression '<(leftSigned, rightSigned)' is of type: bool
func `==`(x329224, y329226: StUint): bool
  first type mismatch at position: 1
  required type: StUint
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: float): bool
  first type mismatch at position: 1
  required type: float
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: int32): bool
  first type mismatch at position: 1
  required type: int32
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: cstring): bool
  first type mismatch at position: 1
  required type: cstring
  but expression '<(leftSigned, rightSigned)' is of type: bool
func `==`(x, y: IntImpl): bool
  first type mismatch at position: 1
  required type: IntImpl
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a2532798: SomeInteger;
                           b2532800: StInt[bits]): bool
  first type mismatch at position: 1
  required type: SomeInteger
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a2532794: StInt[bits]; b2532796: SomeInteger): bool
  first type mismatch at position: 1
  required type: StInt[==.bits]
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[T](x, y: seq[T]): bool
  first type mismatch at position: 1
  required type: seq[T]
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a343736: StInt[bits]; b343738: int{lit}): bool
  first type mismatch at position: 1
  required type: StInt[==.bits]
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(x, y: int): bool
  first type mismatch at position: 1
  required type: int
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[T: tuple |
    object](x, y: T): bool
  first type mismatch at position: 1
  required type: T: tuple or object
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[I, T](x, y: array[I, T]): bool
  first type mismatch at position: 1
  required type: array[I, T]
  but expression '<(leftSigned, rightSigned)' is of type: bool
func `==`(x339224, y339226: StInt): bool
  first type mismatch at position: 1
  required type: StInt
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a2532786: StUint[bits]; b2532788: SomeInteger): bool
  first type mismatch at position: 1
  required type: StUint[==.bits]
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(a, b: NimIdent): bool
  first type mismatch at position: 1
  required type: NimIdent
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(a, b: NimSym): bool
  first type mismatch at position: 1
  required type: NimSym
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a343740: int{lit};
                           b343742: StInt[bits]): bool
  first type mismatch at position: 1
  required type: int
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a2532790: SomeInteger;
                           b2532792: StUint[bits]): bool
  first type mismatch at position: 1
  required type: SomeInteger
  but expression '<(leftSigned, rightSigned)' is of type: bool
func `==`(x, y: UintImpl): bool
  first type mismatch at position: 1
  required type: UintImpl
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`[bits: static[int]](a343732: int{lit};
                           b343734: StUint[bits]): bool
  first type mismatch at position: 1
  required type: int
  but expression '<(leftSigned, rightSigned)' is of type: bool
proc `==`(a, b: NimNode): bool
  first type mismatch at position: 1
  required type: NimNode
  but expression '<(leftSigned, rightSigned)' is of type: bool

expression: <(leftSigned, rightSigned) == 0

https://github.com/status-im/nimbus/blob/6f28d1186675f648e0587f44e730b9dc23291bab/nimbus/vm/interpreter/opcodes_impl/helpers.nim#L13-L39

@mratsim
Copy link
Contributor Author

mratsim commented Jul 3, 2018

This will be addressed in 67476a1

mratsim pushed a commit that referenced this issue Jul 5, 2018
Merge note: currently cannot compile due to `quasiBoolean` (#63). This will be solved by #65
----

* Implemented most of the stubbed out state handling instructions

The code compiles, but still fails at the moment due to incorrect

initialization of the VM. Don't merge yet. More commits will be
pushed in the coming days.

* Fixed crash

* trie put and del are void now

* getBlockTransactionData and getReceipts

* Working code for extcodesize0.json

* fix origin.json

* fix calldatasize1

* fix calldataloadSizeTooHighPartial

* fix calldataloadSizeTooHigh

* more efficient PushX implementation

* fix and, or, xor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant