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

Bugfix/nully values #61

Merged
merged 18 commits into from
Dec 13, 2023
Merged

Bugfix/nully values #61

merged 18 commits into from
Dec 13, 2023

Conversation

tavurth
Copy link
Contributor

@tavurth tavurth commented Sep 16, 2022

When passing null or sometimes and empty string to certain value convertors an AssertionError was raised, crashing my tests.

I was seeing crashes when converting to RlpEncodedBytes and TypedTransaction

This PR fixes the above, but I'm still looking into how exactly to inject JSON directly into the contract reader for a deeper level of testing.

@tavurth tavurth requested a review from zah September 16, 2022 11:16
@tavurth tavurth self-assigned this Sep 16, 2022
@tavurth
Copy link
Contributor Author

tavurth commented Sep 16, 2022

tests/test_deposit_nulls.nim Outdated Show resolved Hide resolved
tests/test_deposit_nulls.nim Outdated Show resolved Hide resolved
Strip out unused JSON

Update comment

Remove echo

Added DynamicBytes test

More correct naming

Remove one extra double check
@tavurth tavurth force-pushed the bugfix/nully-values branch from db31b8f to 564f826 Compare September 16, 2022 11:42
web3/conversions.nim Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
var resUInt256Ref: ref UInt256

# Nully values
should_be_value_error("null", resAddress)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in Discord, the most likely reason for the crashes in the object handling function in nim-json-rpc/jsonmarshal.nim, which is quite happy to propagate nil values to further calls to fromJson.

Your tests here are not covering it.

Copy link
Contributor Author

@tavurth tavurth Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you take a look at the tests added below?

web3/conversions.nim Outdated Show resolved Hide resolved
@jangko jangko closed this Dec 13, 2023
@jangko jangko reopened this Dec 13, 2023
@tavurth
Copy link
Contributor Author

tavurth commented Dec 13, 2023

@jangko I would suggest rebasing instead of merging master into this

@jangko
Copy link
Contributor

jangko commented Dec 13, 2023

Well, I plan to squash them, so I think either way is fine.

@tavurth
Copy link
Contributor Author

tavurth commented Dec 13, 2023

Yea, code guidelines & whatnot. Still, best practices are best practices

Have fun 🙂

@jangko jangko merged commit 23c06ca into master Dec 13, 2023
12 checks passed
@jangko jangko deleted the bugfix/nully-values branch December 13, 2023 23:56
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

Successfully merging this pull request may close these issues.

4 participants