-
Notifications
You must be signed in to change notification settings - Fork 18
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
improv: local bootstrap node set up w/ example #200
Conversation
Updating my branch to the latest changes
packages/network/src/node.ts
Outdated
const bootstrap_nodes_list = this._config?.bootstrap_peers | ||
? this._config.bootstrap_peers | ||
: [ | ||
"/dns4/relay.droak.sh/tcp/443/wss/p2p/Qma3GsJmB47xYuyahPZPSadh1avvxfyYQwk8R3UnFrQ6aP", | ||
]; | ||
|
||
const _pubsubPeerDiscovery = pubsubPeerDiscovery({ | ||
interval: 10_000, | ||
topics: ["topology::discovery"], | ||
}); | ||
|
||
const peer_discovery = bootstrap_nodes_list.length | ||
? [ | ||
_pubsubPeerDiscovery, | ||
bootstrap({ | ||
list: bootstrap_nodes_list, | ||
}), | ||
] | ||
: [_pubsubPeerDiscovery]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you disconnect WiFi and the relay.droak.sh
is still in the list of bootstrap_peers, when the relay is run it produces an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean? this change is restructuring code, is not changing logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there is no bootstrap node list, I shouldn't have the bootstrap({list : []})
property.
If it is in the object, I am getting the following error :
@topology-foundation/[email protected] cli /Users/monordi/apps/topology/ts-topology/packages/node
> tsx ./src/run.ts "relay" "--config" "configs/local-bootstrap.json"
/Users/monordi/apps/topology/ts-topology/node_modules/.pnpm/@[email protected]/node_modules/@libp2p/bootstrap/src/index.ts:98
throw new Error('Bootstrap requires a list of peer addresses')
^
Error: Bootstrap requires a list of peer addresses```
That's why I created the condition to check if I have bootstrap nodes in my config. If not, pass the `peer-discovery` not having the bootstrap property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Overview
This PR enhances the Developer Experience (DX) for the local environment. It streamlines the process of running a topology bootstrap on a local device or network, making it easier to connect peers efficiently.
Currently, the changes are applied to the chat example, but if approved, I can extend this implementation to the other examples as well.
Summary of Changes
Here are the edited files :
Here are the created files :
Feel free to let me know if there are any adjustments or suggestions. Once approved, I can proceed with applying the same improvements to the other examples.