-
Notifications
You must be signed in to change notification settings - Fork 255
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
fix: substrate runner, support new libp2p addr log #1892
Conversation
.rsplit_once("New listen address: /ip4/127.0.0.1/tcp/") | ||
// slightly newer message: | ||
.or_else(|| line.rsplit_once("New listen address address=/ip4/127.0.0.1/tcp/")) |
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.
EDIT: ok I see, it comes from libp2p_tcp, probably this crate was bumped in polkadot-sdk
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.
But a small nit: while we are at it can we make function try_find_substrate_port_from_output
in subxt-runner
return Result<SubstrateNodeInfo, Error>
and fail early in the function if some of the values are not present?(we use the function only once on line 105 and we try to unconditionally extract optinoal values)
We can't really just return early if some line couldn't be parsed because these are logs from the substrate node which we iterator line by line (i.e. std::io::Read) that contains a bunch of unrelated stuff which we are not interested in. So the assumption is the rpc server port, libp2p address and libp2p port should be found in the first 100 log entries when starting the node. Then line 105 is just a way to stop the iteration as soon as all values are found which is checked every iteration Also, this function panics if any of patterns was matched but parsing the value failed, which works in the same way but less elegant ^^ Perhaps we could just read all lines to a String then do search it for the values but should be less efficient but more readable I guess. |
I was thinking more inline of just making fields non optional in the struct SubstrateNodeInfo |
aight, I see yeah that's a good idea :) |
No description provided.