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

serde_v8 improvements to avoid hitting unimplemented codepaths #13915

Merged
merged 11 commits into from
Jul 28, 2022

Conversation

arthurprs
Copy link
Contributor

@arthurprs arthurprs commented Mar 11, 2022

I've made some chances in order to avoid silent data loss and hitting unimplemented code paths, some of it might be opinionated though. Let me know what you think.

Rusty v8 related

  • Optimize object deserialization by avoid getting each keys twice
  • Handle Javascript Map objects correctly
  • Handle chars and bytes without panicking

There are also some changes wrt. deno-core dependencies so it's easier to use outside of deno.

  • Downgrade minor version of indexmap to avoid ahash dependency cycle

@CLAassistant
Copy link

CLAassistant commented Mar 11, 2022

CLA assistant check
All committers have signed the CLA.

serde_v8/src/ser.rs Outdated Show resolved Hide resolved
serde_v8/src/de.rs Outdated Show resolved Hide resolved
…ndle Javascript Map objects properly & Handle chars and bytes without panicking
It makes it difficult to integrate it with other projects.
Deno itself is not affected as cargo will still honer the fixed version
definitions from the other crates.
@bartlomieju
Copy link
Member

@AaronO please review

@arthurprs arthurprs changed the title serde_v8 improvements to avoid silent data loss (eg. big int overflows) and hitting unimplemented codepaths serde_v8 improvements to avoid hitting unimplemented codepaths Apr 29, 2022
@arthurprs
Copy link
Contributor Author

I updated the PR to fix the merge conflicts and to account for other recent PRs.

@bartlomieju bartlomieju added this to the 1.22 milestone May 11, 2022
@bartlomieju bartlomieju removed this from the 1.22 milestone May 17, 2022
@bartlomieju
Copy link
Member

@arthurprs sorry for late response, please rebase and we'll merge it

@arthurprs arthurprs force-pushed the main branch 3 times, most recently from 4a47fac to 6db684a Compare July 5, 2022 20:47
@arthurprs
Copy link
Contributor Author

No problem. The PR is now merged with the upstream repo.

serde_v8/de.rs Outdated Show resolved Hide resolved
Comment on lines +19 to +21
# Stay on 1.6 to avoid a dependency cycle in ahash https://github.com/tkaitchuck/aHash/issues/95
# Projects not depending on ahash are unafected as cargo will pull any 1.X that is >= 1.6.
indexmap = "1.6"
Copy link
Member

Choose a reason for hiding this comment

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

Is this still required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe so, there hasn't been much movement trying to break this dependency cycle tkaitchuck/aHash#95. Luckily it doesn't pose any significant problems for Deno.

Copy link
Member

Choose a reason for hiding this comment

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

Right, but we were already on v1.8.1, so why downgrade?

Copy link
Contributor Author

@arthurprs arthurprs Jul 6, 2022

Choose a reason for hiding this comment

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

This is not a real downgrade but a downgrade of the "minimum" minor version for 1.*. deno cargo.lock still defines 1.8.1 and will go up as needed as long as it's < 2.

At the same time, if we don't downgrade the minimum minor version any crate depending on deno_core (like the project I'm trying to use deno in) also uses ahash (or any of the other problematic dependencies) it won't compile as cargo won't be able solve the dependency cycle.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @arthurprs, sorry it took so long to land

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.

None yet

5 participants