Skip to content

chore(ownable): separate current & previous checks #4278

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

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

leohhhn
Copy link
Contributor

@leohhhn leohhhn commented May 14, 2025

Description

Re-adds _ByPrevious methods, cleans up tests.

Need to fix the following:

FAIL    examples/gno.land/p/demo/memeland       0.05s
FAIL    examples/gno.land/p/demo/ownable/exts/authorizable      0.05s
FAIL    examples/gno.land/p/demo/subscription/lifetime  0.03s
FAIL    examples/gno.land/p/demo/subscription/recurring         0.04s
FAIL    examples/gno.land/p/thox/accesscontrol  0.03s
FAIL    examples/gno.land/p/thox/timelock       0.04s
FAIL    examples/gno.land/r/demo/disperse       0.04s
FAIL    examples/gno.land/r/demo/grc20factory   0.04s
FAIL    examples/gno.land/r/gnoland/home        0.12s
FAIL    examples/gno.land/r/gnoland/valopers    0.34s

These realms were definitely not fixed properly in the meta PRs. The tests are passing but the functionality is wrong.

@Gno2D2
Copy link
Collaborator

Gno2D2 commented May 14, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

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)
🟢 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: leohhhn/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 1 user(s) of the organization reviewed the pull request (with state "APPROVED")
    │       ├── 🟢 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🟢 This pull request is a draft
    └── 🟢 Then
        └── 🟢 And
            ├── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)
            └── 🟢 At least 1 user(s) of the team tech-staff reviewed 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

Comment on lines -23 to -27
origin := std.OriginCaller()
previous := std.PreviousRealm()
if origin != previous.Address() {
panic("NewWithOrigin() should be called from init() where std.PreviousRealm() is origin")
}
Copy link
Member

Choose a reason for hiding this comment

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

I believe this check is sensible as it protects against intentional misuse.

I prefer to keep it and expect those who do not want this extra check and are willing to take more risks to manually call std.origincaller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about then just calling this function New?

Copy link
Member

@moul moul May 16, 2025

Choose a reason for hiding this comment

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

it only works in init(); New should work from so many places

NewWithOrigin // init
New(addr) // default explicit
NewWithCurrent()
NewWithPrevious()

moul added a commit that referenced this pull request May 15, 2025
This PR adds a txtar testing the journey of typical users on gnoland. It
also fixes some crossing issues in certain Realms.

Depends on #4278

---------

Co-authored-by: Manfred Touron <[email protected]>
@leohhhn
Copy link
Contributor Author

leohhhn commented May 16, 2025

The discussion on this is; ownable is not a very gno-like library- its a concept taken from Solidity.

We should try replacing this with newer, better libraries, such as authz. Ideally, we use ownable only for embedding it into objects; so maybe it's worth considering renaming this library to something else, so people do not automatically start with the premise of Solidity's ownable.

n0izn0iz pushed a commit to n0izn0iz/gno that referenced this pull request May 17, 2025
This PR adds a txtar testing the journey of typical users on gnoland. It
also fixes some crossing issues in certain Realms.

Depends on gnolang#4278

---------

Co-authored-by: Manfred Touron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: No status
Status: Triage
Development

Successfully merging this pull request may close these issues.

3 participants