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

Fix Cadence 1.0 migration of dictionary values when using atree inlined data #3316

Merged

Conversation

fxamacker
Copy link
Member

@fxamacker fxamacker commented May 6, 2024

Closes #3288

This PR fixes MigrateNestedValue() for dictionary values.

Previously, MigrateNestedValue() migrates dictionary by using readonly iterator and migrating values in place.

This PR migrates keys first using read-only iterator and then migrates values using mutable iterator.

More details at the test/reproducer:


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

This commit fixes Cadence 1.0 migration when
using atree inlined data. See issue:

  #3288

Previously, MigrateNestedValue() migrates dictionary by using
readonly iterator and migrating values in place.

This commit migrates keys first using readonly iterator and
then migrates values using mutable iterator.
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Great fix!

As discussed in the review meeting, splitting up the migration into a pass migrating the keys using read-only iteration, and another pass migrating the values using mutable iteration, makes sense 👍

I only realized this after the call but: To have the atree-register inlining branch not drift too much, let's apply the refactor to master, even if it is not needed.

@turbolent
Copy link
Member

@fxamacker I'm working on porting this to master. After that we can improve it a bit more (TODOs we discussed), update the atree register inlining branch, and then add the tests with #3314

@fxamacker
Copy link
Member Author

@turbolent Thanks for approving and code review of this PR yesterday!

In addition to passing all tests in PR #3314, I also verified this morning that it resolves "slab not found error" using input file tn-a47a2d3a3b7e9133-inlined.payloads you extracted last week while investigating #3288.

@turbolent
Copy link
Member

@fxamacker Awesome! Thank you for checking this, it's great to see the fix works as expected 👌

@turbolent turbolent closed this May 7, 2024
@turbolent turbolent reopened this May 7, 2024
@turbolent turbolent mentioned this pull request May 7, 2024
6 tasks
@turbolent
Copy link
Member

@fxamacker Ported this to master in #3318, and added the improvements we discussed yesterday. PTAL 🙏

@fxamacker fxamacker merged commit a0f835b into fxamacker/add-reproducer-for-issue-3288 May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants