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

Gossip storage and relays rank/score #570

Open
yukibtc opened this issue Sep 10, 2024 · 9 comments
Open

Gossip storage and relays rank/score #570

yukibtc opened this issue Sep 10, 2024 · 9 comments

Comments

@yukibtc
Copy link
Member

yukibtc commented Sep 10, 2024

  • Add dedicated persistent storage for gossip data
  • Implement a relays rank/score
@reyamir
Copy link
Contributor

reyamir commented Oct 28, 2024

I see a cons of current gossip method is the client is trying connect inbox/outbox relays before query event

// Add outbox relays
for url in broken_down.outbox_urls.into_iter() {
    if self.add_outbox_relay(&url).await? {
        self.connect_relay(url).await?;
    }
}

// Add inbox relays
for url in broken_down.inbox_urls.into_iter() {
    if self.add_inbox_relay(&url).await? {
        self.connect_relay(url).await?;
    }
}

If relay have some errors, client will try reconnect, the fetch events will become very slow. I wonder if when this issue is resolved (gossip storage and relays rank/score implemented). Will this problem be solved too?

@yukibtc
Copy link
Member Author

yukibtc commented Oct 28, 2024

If relay have some errors, client will try reconnect, the fetch events will become very slow.

Yes, this is true but after few attempts the SDK will start skipping unresponsive relays (this in general, not only for gossip). This require some secs so if the relay was just added it will not be skipped.

I wonder if when this issue is resolved (gossip storage and relays rank/score implemented). Will this problem be solved too?

Yeah, partially. I still have to study the best way to implement it. Using a relay score I can ignore the unresponsive relays but for new ones the issue could still persist (if the relays are new, never saw before).

@yukibtc yukibtc modified the milestones: Release v0.37, Release v0.38 Nov 26, 2024
@yukibtc yukibtc modified the milestones: Release v0.38, Release v0.39 Dec 12, 2024
@yukibtc yukibtc removed this from the Release v0.41 milestone Feb 24, 2025
@reyamir
Copy link
Contributor

reyamir commented Feb 25, 2025

I wonder is there a way to clear the gossip graph?, I want after user update their NIP65 or NIP17 relays, the gossip graph will be refresh to use their latest relay list or mark their public key outdated, then gossip graph will use latest info.

I think will be nice if we have a command to force refresh gossip graph for certain public key like this

client.gossip_invalidate(public_key)

@yukibtc
Copy link
Member Author

yukibtc commented Feb 25, 2025

I wonder is there a way to clear the gossip graph?, I want after user update their NIP65 or NIP17 relays, the gossip graph will be refresh to use their latest relay list or mark their public key outdated, then gossip graph will use latest info.

I think will be nice if we have a command to force refresh gossip graph for certain public key like this

client.gossip_invalidate(public_key)

What if the gossip data were updated automatically when sending or receiving a NIP17/NIP65 relay list event?
So, would be enough to send a REQ asking for the relay list of the public keys to update the gossip data (i.e., an auto-closing or long-lived subscription).

@reyamir
Copy link
Contributor

reyamir commented Feb 25, 2025

I fear it will take too much concurrent subscriptions, some relays have limit max subscriptions per users.

@reyamir
Copy link
Contributor

reyamir commented Feb 25, 2025

Or we can do same approach like automatic_authentication, when receive NIP17 or NIP65 events from pool, gossip graph for event's author will be updated.

@yukibtc
Copy link
Member Author

yukibtc commented Feb 25, 2025

I fear it will take too much concurrent subscriptions, some relays have limit max subscriptions per users.

If you "invalidate" the public key, a REQ will still be sent to relays, to update the relay lists.

@reyamir
Copy link
Contributor

reyamir commented Feb 25, 2025

I think it will be fine if it is auto-closing

@yukibtc
Copy link
Member Author

yukibtc commented Feb 25, 2025

I think it will be fine if it is auto-closing

Yeah, currently is auto-closing.

Or we can do same approach like automatic_authentication, when receive NIP17 or NIP65 events from pool, gossip graph for event's author will be updated.

Yes, I was thinking to this. If gossip is enabled and an event with kind 10002 or 10050 is received, the gossip data is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants