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(gnovm): save object when refCount changed #2992

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

omarsy
Copy link
Member

@omarsy omarsy commented Oct 21, 2024

This PR a fix in the gnovm to ensure that objects are saved correctly when their reference count changes.

closes: #2266 #1543

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Oct 21, 2024
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@omarsy omarsy force-pushed the fix/2266 branch 2 times, most recently from ed24417 to 2368fed Compare October 27, 2024 12:44
@omarsy omarsy force-pushed the fix/2266 branch 2 times, most recently from d81df2c to ff7e012 Compare October 27, 2024 15:40
@omarsy omarsy marked this pull request as ready for review October 27, 2024 19:24
@notJoon notJoon added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 28, 2024
@jefft0
Copy link
Contributor

jefft0 commented Nov 19, 2024

Hello @omarsy . There is a merge conflict with master in gno.land/pkg/sdk/vm/gas_test.go . Can you resolve it?

Copy link
Contributor

@jefft0 jefft0 left a comment

Choose a reason for hiding this comment

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

The main change is to one file gnovm/pkg/gnolang/realm.go . The rest of the changes are tests. All CI checks pass.

@jefft0 jefft0 removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Nov 20, 2024
@jefft0
Copy link
Contributor

jefft0 commented Nov 20, 2024

Removed the review/triage-pending label because jefft0 approved. Ready for core devs to review if the change is technically correct.

Copy link
Contributor

@ltzmaxwell ltzmaxwell left a comment

Choose a reason for hiding this comment

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

just start looking.

gnovm/pkg/gnolang/realm.go Show resolved Hide resolved
@Kouteki Kouteki added the in focus Core team is prioritizing this work label Nov 28, 2024
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Nov 28, 2024

🛠 PR Checks Summary

🔴 Maintainers must be able to edit this pull request (more info)

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🔴 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: TERITORI/gno)

Then

🔴 Requirement not satisfied
└── 🔴 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@omarsy omarsy requested a review from ltzmaxwell December 3, 2024 22:01
@zivkovicmilos
Copy link
Member

@omarsy
Can you please check the CI? 🙏

@omarsy
Copy link
Member Author

omarsy commented Dec 4, 2024

@omarsy Can you please check the CI? 🙏

Done ^^

Copy link
Contributor

@ltzmaxwell ltzmaxwell 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!


var (
a = &A{A: "here"}
a2 = &A{A: "here"}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: not used. and is this same with zrealm14?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch ^^ . Don't know why I have this test. Maybe I used it for my local test

@github-actions github-actions bot added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Dec 7, 2024
@Gno2D2 Gno2D2 requested review from a team December 7, 2024 22:10
@omarsy omarsy removed request for a team December 7, 2024 22:13
Copy link
Member

Choose a reason for hiding this comment

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

what's going on here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is caused by the change of the reference count of the time package.
It occurs because the time.Time struct is a field of the Board object. When the Board object is referenced, it indirectly causes the reference count of the time package to change, as the time.Time struct is part of the Board

Copy link
Member

Choose a reason for hiding this comment

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

mhhh, should package values be persisted like this? I don't think so?

In the very least, we shouldn't have a 15k line long file with the entire PackageValue of the time package, but I'm thinking whether we need to add an exception to saving package values?

Copy link
Member Author

@omarsy omarsy Dec 21, 2024

Choose a reason for hiding this comment

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

Maybe we should avoid to log Block operation like this 7438f8a#diff-152fa445ed649a7f12eb067c6a67f7c6cb98c3242e23da200744b851aaeb3b20R522 ?

@omarsy omarsy requested a review from thehowl December 20, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in focus Core team is prioritizing this work 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: In Progress
Status: In Review
Development

Successfully merging this pull request may close these issues.

[gnovm/avl] Removing keys from AVL trees does not work
8 participants