Skip to content

Conversation

@audrenbdb
Copy link

@audrenbdb audrenbdb commented Sep 29, 2025

Addresses following issue: #4794

Rename Allocator.Allocate to Allocator.Account to reflect that the method only performs memory accounting — it does not perform Go runtime allocation.

Rename InterfaceType.Methods (type []FieldType) to FieldTypes to reflect that the slice can contain both methods and embedded interfaces, not only methods.

Rename Allocator.Allocate to Allocator.Account to reflect that the method only performs memory accounting, gas billing, and GC-callback invocation — it does not perform Go runtime allocation.
Update internal helper call sites to call Account(...) instead of Allocate(...).
Rename InterfaceType.Methods (type []FieldType) to FieldTypes to reflect that the slice can contain both methods and embedded interfaces, not only methods.
@audrenbdb audrenbdb changed the title Refactor: rename gnovm InterfaceType property Method to FieldTypes and allocator Allocate to Acclj t Refactor: rename gnovm InterfaceType property Method to FieldTypes and allocator Allocate to Account Sep 29, 2025
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Sep 29, 2025
@Gno2D2 Gno2D2 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Sep 29, 2025
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Sep 29, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details
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)
🟢 Pending initial approval by a review team member, or review from tech-staff

☑️ 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
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: audrenbdb/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🟢 Requirement satisfied
└── 🟢 If
    ├── 🟢 Condition
    │   └── 🟢 Or
    │       ├── 🔴 At least one of these user(s) reviewed the pull request: [jefft0 leohhhn n0izn0iz notJoon omarsy x1unix] (with state "APPROVED")
    │       ├── 🟢 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🔴 This pull request is a draft
    └── 🟢 Then
        └── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)

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
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)
    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

@audrenbdb audrenbdb changed the title Refactor: rename gnovm InterfaceType property Method to FieldTypes and allocator Allocate to Account refactor(gnovm): rename gnovm InterfaceType property Method to FieldTypes and allocator Allocate to Account Sep 29, 2025
@ltzmaxwell
Copy link
Contributor

thank you for handling this. please see comment: #4794 (comment)

Comment on lines +944 to +945
for i := range it.FieldTypes {
im := &it.FieldTypes[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

seems in consistent with the func name.

Copy link
Author

Choose a reason for hiding this comment

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

You right I missed this one, I think the function could be simply GetMethodFieldType => GetFieldType

What do you think ?

Copy link
Author

Choose a reason for hiding this comment

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

As part of the same PR, do you think I should also rename methods to something else in:

gnovm/pkg/gnolang/nodes.go:704

type InterfaceTypeExpr struct {
	Attributes
	Methods FieldTypeExprs // list of methods
	Generic Name           // for uverse generics
}

Copy link
Contributor

@ltzmaxwell ltzmaxwell Oct 1, 2025

Choose a reason for hiding this comment

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

GetMethodFieldType => GetFieldType

looks good to me.

As part of the same PR, do you think I should also rename methods to something else in:

gnovm/pkg/gnolang/nodes.go:704

i think yes.

==========================================================
looking back to the InterfaceType, StructType, StructValue definition, i think there's some inaccurate in modification of Methods - > FieldTypes, perhaps Fields would be a better option—especially if we consider that Methods may not be entirely accurate due to embedding situation.

Overall, these are minor differences. I don’t have a strong opinion about changing the name due to the reason mentioned in the initial issue.

cc :/ @thehowl @mvertes for deeper insights.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with the rename of Allocator.Allocate to Allocator.Account.
But I'm not convinced that InterfaceType.FieldTypes is better that InterfaceType.Methods. Even if objects implementing an interface have embedded structs to reach a particular method, interface types are still about methods only.

@jefft0 jefft0 removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Sep 30, 2025
@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
gnovm/pkg/gnolang/realm.go 60.00% 1 Missing and 1 partial ⚠️
gnovm/pkg/gnolang/types.go 87.50% 1 Missing ⚠️
gnovm/tests/stdlibs/fmt/print.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 🤖 gnovm Issues or PRs gnovm related

Projects

Status: No status
Status: Triage

Development

Successfully merging this pull request may close these issues.

5 participants