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

Another typedesc issue, manifesting at runtime #5

Closed
mratsim opened this issue May 16, 2019 · 2 comments
Closed

Another typedesc issue, manifesting at runtime #5

mratsim opened this issue May 16, 2019 · 2 comments

Comments

@mratsim
Copy link
Contributor

mratsim commented May 16, 2019

This is a followup on #4.

Last week the fix worked on my machine (I'm like 99% sure). This week it doesn't, I have a runtime exception when parsing.

This exception only happen when the type is passed as typedesc.

The branch is the same as before: https://github.com/status-im/nim-beacon-chain/tree/serialization_typedesc

And screenshots:

Working
DeepinScreenshot_select-area_20190516165149

Failing
DeepinScreenshot_select-area_20190516165101

@mratsim
Copy link
Contributor Author

mratsim commented May 16, 2019

The simple change from

proc parseTests*(jsonPath: string): ShufflingTests =
  result = Json.loadFile(jsonPath, ShufflingTests)

to

proc parseTests*(jsonPath: string, T: typedesc = ShufflingTests): ShufflingTests =
  result = Json.loadFile(jsonPath, ShufflingTests)

will change the test from a pass to a stacktrace:

test_fixture_shuffling.nim(25) test_fixture_shuffling
serialization.nim(101)   parseTests
serialization.nim(46)    readValue
reader.nim(181)          readValue
object_serialization.nim(90) :anonymous
reader.nim(154)          readValue
reader.nim(181)          readValue
object_serialization.nim(90) :anonymous
reader.nim(171)          readValue
reader.nim(102)          skipToken
reader.nim(91)           requireToken
reader.nim(64)           raiseUnexpectedToken

    Unhandled exception:  [UnexpectedToken]

And generics instead of typedesc also fails

zah added a commit to status-im/nimbus-eth2 that referenced this issue May 16, 2019
@zah
Copy link
Contributor

zah commented May 16, 2019

This is the same issue, Mamy.
I guess I should thank you for proving my point in nim-lang/Nim#11225 that the underlying Nim issue is quite hard for the user to figure out.

@zah zah closed this as completed May 16, 2019
tersec pushed a commit to status-im/nimbus-eth2 that referenced this issue Jun 17, 2019
* Generics over tests (status-im/nim-serialization#4, status-im/nim-serialization#5, nim-lang/Nim#11225)

* Skeleton of SSZ uint tests

* Check all primitive uint types

* Add deserialization test. "wrong length" skipped due to #280

* Move test types to their specific test files

* Stint also sometimes throws an AssertionError for invalid ranges

* Add debug path for Access denied issue in Appveyor 64-bit (https://ci.appveyor.com/project/nimbus/nim-beacon-chain/builds/25278666/job/fs8q0bcluvj2gdor#L866)

* indent the Appveyor debug info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants