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

chore: remove govdao dependency in r/gov/dao/bridge #3523

Merged
merged 26 commits into from
Feb 6, 2025

Conversation

leohhhn
Copy link
Contributor

@leohhhn leohhhn commented Jan 15, 2025

Description

Cherry-picked from: #3166

This PR removes the r/gov/dao/v2 import from the r/gov/dao/bridge realm. Previously, cyclic imports were easily created if a realm imported the bridge realm (to expose a executor constructor func), and GovDAO imported that realm. In my case:

  • r/sys/users imported r/gov/dao/bridge to create executor constructors
  • r/gov/dao/bridge imported r/gov/dao/v2 to have access to the implementation
  • r/gov/dao/v2 imported r/sys/users to have access to user data.
  • -> creating a cyclic dependency which is not allowed.

This is fixed by modifying the r/gov/dao/v2 contract to expose a safe-object, which in turn exposes all top-level functions as methods. Then, the bridge uses a one-time init package which will load v2 into the bridge in genesis, as per @moul's comment.

@leohhhn leohhhn changed the title chore: remove govdao dependency in gov/dao/bridge chore: remove govdao dependency in r/gov/dao/bridge Jan 15, 2025
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Jan 15, 2025
@leohhhn leohhhn requested a review from moul January 15, 2025 18:23
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jan 15, 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
        └── 🟢 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

@leohhhn leohhhn requested a review from zivkovicmilos January 15, 2025 18:23
@leohhhn leohhhn marked this pull request as ready for review January 15, 2025 18:41
@leohhhn
Copy link
Contributor Author

leohhhn commented Jan 15, 2025

Fixing tests...

@leohhhn leohhhn marked this pull request as draft January 15, 2025 18:48
@leohhhn leohhhn requested a review from ajnavarro January 16, 2025 17:39
@leohhhn leohhhn mentioned this pull request Jan 17, 2025
6 tasks
@moul
Copy link
Member

moul commented Jan 17, 2025

#3166 (comment)

@leohhhn leohhhn marked this pull request as ready for review January 17, 2025 12:13
@leohhhn
Copy link
Contributor Author

leohhhn commented Jan 17, 2025

Lint has a bug, will write an issue on it. To be ignored for now.

Copy link
Contributor

@ajnavarro ajnavarro left a comment

Choose a reason for hiding this comment

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

LGTM, just two small comments. I would love to have some review from @zivkovicmilos too.

examples/gno.land/r/gov/dao/v2/prop4_filetest.gno Outdated Show resolved Hide resolved
examples/gno.land/r/sys/params/params.gno Outdated Show resolved Hide resolved
examples/gno.land/r/sys/params/params_test.gno Outdated Show resolved Hide resolved
@zivkovicmilos zivkovicmilos added the don't merge Please don't merge this functionality temporarily label Jan 20, 2025
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Blocking until I review 🙏

@Kouteki Kouteki added this to the 🚀 Mainnet beta launch milestone Jan 27, 2025
@Gno2D2 Gno2D2 requested a review from a team February 2, 2025 13:32
@Gno2D2 Gno2D2 requested a review from a team February 2, 2025 13:36
Copy link
Member

@moul moul left a comment

Choose a reason for hiding this comment

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

LGTM

@Gno2D2 Gno2D2 requested a review from a team February 2, 2025 13:41
@Kouteki Kouteki removed the in focus label Feb 3, 2025
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Unblocking this PR, but left comments below, more as a historical reference. I see @moul has no objections to the way we use indirection and increase complexity for the bridge management, which signals to me this is not important, and I shouldn't care either 🙂

This is also not entirely true:

r/gov/dao/v2 imported r/sys/users to have access to user data.

The GovDAO doesn't need a dependency on users for any critical function, but only to render the usernames. Let that sync in, we're trading this insane orchestration complexity for resolving an address to a username in a user-render function.

I spoke to @ajnavarro, we are dropping the bridge in future DAO implementations anyway for a more scalable method

examples/gno.land/r/gov/dao/v2/dao.gno Show resolved Hide resolved
examples/gno.land/r/sys/params/params_test.gno Outdated Show resolved Hide resolved
examples/gno.land/r/gov/dao/v2/dao.gno Show resolved Hide resolved
examples/gno.land/r/gov/dao/bridge/bridge.gno Show resolved Hide resolved
@zivkovicmilos
Copy link
Member

Check the CI please 🙏

@Gno2D2 Gno2D2 requested a review from a team February 4, 2025 12:58
@zivkovicmilos zivkovicmilos removed the don't merge Please don't merge this functionality temporarily label Feb 4, 2025
@leohhhn
Copy link
Contributor Author

leohhhn commented Feb 4, 2025

Waiting on #3597 to merge

@leohhhn leohhhn merged commit dd0360d into gnolang:master Feb 6, 2025
58 checks passed
@leohhhn leohhhn deleted the remove-govdao-dep-bridge branch February 6, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Development

Successfully merging this pull request may close these issues.

6 participants