Skip to content

feat(gnodev): add tx-indexer process manager to gnodev #4074

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

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

Conversation

itsHabib
Copy link

@itsHabib itsHabib commented Apr 8, 2025

Issue

Description

  • Adds an internal package to manage the tx-indexer process for gnodev development
    • Flags are passed through from gnodev to tx-indexer, disabled by default
    • logging is forwarded from the tx-indexer process through the gnodev logger
  • Supports Start,Stop,Reload functionality for the tx-indexer process

Testing Validation

Performed validation by doing some basic checks

Running gnodev

  • Starting gnodev without the tx-indexer flag enabled, assert that tx-indexer process is not started
    no-tx-indexer

  • Starting gnodev with tx-indexer flag enabled, assert tx indexer starts
    tx-indexer-enabled

  • Reloading gnodev, assert tx-indexer reloads

go run . -tx-indexer -tx-indexer-log-level=warn
r

tx-indexer-reload

  • Resetting via R key gnodev, assert tx-indexer reloads
go run . -tx-indexer -tx-indexer-log-level=warn
R

tx-indexer-reset

Basic checks on tx-indexer endpoints

  • getBlockFilter
curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"newBlockFilter","params":[],"id":1}' http://localhost:8546 | jq
====
200 OK
{
   "result": "1a62ef69-3283-40cf-bc68-005583ea585d",
   "jsonrpc": "2.0",
    "id": 1
}
  • getFilterChanges
curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"getFilterChanges","params":["1a62ef69-3283-40cf-bc68-005583ea585d"],"id":1}' http://localhost:8546 | jq '
====
200 OK
{
   "result": [  "Cgt2MS4wLjAtcmMuMBIDZGV2GMwiIgwI7bfSvwYQoOLgmAJCSAogVePu36+30Bk77WS65j6fZhKudE5HLaSvy1yFbg+M2HUSJAgCEiCbAywr9IYLvukOuq8qV6Az7nKnGVR7C68M0AEAshl8X0ogbtwydtDjEqcZdycLqDLZVmpB4dauJ2KCOUcLsqwtpX5aIMX8AbmpUwYsVOi6e6ca0apNw5+eGF4K6AC/De+rp4q5YiDF/AG5qVMGLFToununGtGqTcOfnhheCugAvw3vq6eKuWogJlhOjaEgGjNB6JJbY32cyWC0QYWsF40ch1R+A7Wg+vByIJmAhI1EraXYaZ7mH60kshtgNGingSBMlZOnmFOjQqSVggEoZzFocGF5NG5rcDJtMG0wNHNlYXZzcWVlZm5nZWF0bWRoc3Fncnhhdw==",
      ......omitted due to size
  ]
  "jsonrpc": "2.0",
   "id": 1
}

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Apr 8, 2025

🛠 PR Checks Summary

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

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: itsHabib/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 not 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
    └── 🔴 Else
        └── 🔴 And
            ├── 🟢 This label is applied to pull request: review/triage-pending
            └── 🔴 On no 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
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

@itsHabib itsHabib changed the title Feat/gnodev/run txindexer feat(gnodev): add tx-indexer process manager to gnodev Apr 8, 2025
@itsHabib
Copy link
Author

itsHabib commented Apr 8, 2025

👋 hey all, couple comments/questions:

  • I do think that although this has worked for my basic tests, it would be ideal if tx-indexer was part of the monorepo or exposed some pkg that we can import and do a txindexer.Start() etc that tx-indexer owned without having to worry about trying to do this via exec.Cmd as ive done.
  • The PR is already getting relatively large so i held off on things like unit tests and such as im not sure what the process is/standards for open source w.r.t sub tickets and how big a PR can be. I am happy to add some tests but also wanted to get feedback first to see if im way off the mark here or not before doing more
  • Any other types of validation that I can do/edge cases i can test out to make sure this works as expected for the interested parties?

@leohhhn leohhhn requested review from gfanton and ajnavarro April 8, 2025 08:23
@jefft0
Copy link
Contributor

jefft0 commented Apr 8, 2025

@itsHabib , thanks for working on issue #2082 . As we commented, tx-indexer is now working properly, so this is not urgent. On that issue, we can discuss if gnodev should start tx-indexer as a convenience.

@itsHabib itsHabib marked this pull request as ready for review April 8, 2025 12:09
@Gno2D2 Gno2D2 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Apr 8, 2025
@leohhhn
Copy link
Contributor

leohhhn commented Apr 8, 2025

If the indexer is properly integrated with gnodev- meaning it supports reloading, and the indexer service reloads accordingly and has clean, proper data, then this would be a step towards enabling the indexer on the Portal Loop. This feature probably shouldn't be on by default, but under gnodev staging as a flag - cc @gfanton @moul

Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@Kouteki Kouteki moved this from Triage to In Review in 🧙‍♂️gno.land core team Apr 17, 2025
@Kouteki Kouteki removed the request for review from a team April 17, 2025 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review/triage-pending PRs opened by external contributors that are waiting for the 1st review
Projects
Status: No status
Status: In Review
Development

Successfully merging this pull request may close these issues.

feature request: Include tx-indexer in gnodev, automatically refresh on reload
4 participants