-
Notifications
You must be signed in to change notification settings - Fork 5
Allow agent to claim custom networks #924
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
base: staging
Are you sure you want to change the base?
Conversation
After discussing this issue in our sprint, we have highlighted some behavioural questions regarding network switching. This issue is only relevant for when the network is switched in the middle of the agent's lifecycle. If we start the agent on a network, then we can start with creating new connections to the nodes in that network. There is no issues in this case. However, if we are switching from a network to another one, then how should the agent behave? The agent will need to end old connections and start new connections in the new network. What if a peer has a stream open to our node? If we choose to reject new connections and wait for the previous stream to end, then wouldn't it also suffer from similar issues that sometimes the agent shutdown suffers with, when some tasks or streams just refuse to cancel? The tests might be able to catch some of these issues. We also need to plan for the behaviour of this function properly to avoid some of these hidden issues or make the system more brittle. |
Brian and I ran into another question when working on this PR. The Currently, I have just disabled the network claiming logic when the network is undefined, but I feel that this is not the optimal behaviour. I believe raising an error when starting the agent if the network is unpopulated seems to be the optimal solution here. |
This PR is ready for merging. I will start working on the PKCLI side of this issue now before merging them both. |
Why is the network allowed to be undefined? Perhaps it means there is no network it's part of. In which case claiming a network means setting that network option. |
Description
The Polykey agent needs a way to join a network. The target network can either be a public or a private one. he network join can be triggered at any time in the agent's lifecycle. First, when starting, the
--network
flag should be able to change the network to one created by PKE as well as the testnet and mainnet. The second should be a RPC handler which will allow the network switching logic to happen while the agent is still running.Issues Fixed
Tasks
syncNodeGraph
to claim the network if a claim does not exist, otherwise switch the network to the target networkFinal checklist