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

feat: map.deepEquals for deep map comparison #637

Merged
merged 12 commits into from
Aug 28, 2024

Conversation

Gusarich
Copy link
Member

@Gusarich Gusarich commented Jul 29, 2024

Closes #196

  • I have updated CHANGELOG.md
  • I have documented my contribution in Tact Docs: https://github.com/tact-lang/tact-docs/pull/PR-NUMBER
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
  • I have run all the tests locally and no test failure was reported
  • I have run the linter, formatter and spellchecker
  • I did not do unrelated and/or undiscussed refactorings

@Gusarich Gusarich added this to the v1.5.0 milestone Jul 29, 2024
@Gusarich Gusarich changed the title WIP: Implement map.deepEquals for WIP: Implement map.deepEquals for deep map comparison Jul 29, 2024
@anton-trunov anton-trunov self-assigned this Jul 30, 2024
@anton-trunov
Copy link
Member

Let's also add a negative test case based on #196 (comment). It should show that deepEquals works fine on it, whereas == fails.

@Gusarich Gusarich marked this pull request as ready for review August 27, 2024 17:33
@anton-trunov anton-trunov changed the title WIP: Implement map.deepEquals for deep map comparison feat: map.deepEquals for deep map comparison Aug 27, 2024
@Gusarich
Copy link
Member Author

We should also note in documentation that this function is very expensive in terms of gas (iterating a map + using slice_hash, both are expensive things), and in most cases it'll be enough to use hash comparison via ==.

Copy link
Member

@anton-trunov anton-trunov left a comment

Choose a reason for hiding this comment

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

Awesome work!

@anton-trunov anton-trunov merged commit 12def54 into tact-lang:main Aug 28, 2024
3 checks passed
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.

Map comparison can produce false-negative results
2 participants