-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: catch dot port missing early #4082
Conversation
PRO-881 Error should notify that only Polkadot requires a port to be specified
From one of the mainnet validators: — if I omit port in the setting:
it gives error: — Because the other chains don't require the port, only Polkadot does, it is confusing. |
I'm getting some unexpected behaviour from the URL crate, it seems to follow this logic. If wss or https is used with a non default port, it will return None as the port number.
Can you confirm that we will not support wss or https endpoints on port 443? |
Codecov Report
@@ Coverage Diff @@
## main #4082 +/- ##
======================================
- Coverage 71% 71% -0%
======================================
Files 376 377 +1
Lines 59703 60078 +375
Branches 59703 60078 +375
======================================
+ Hits 42599 42804 +205
- Misses 14961 15025 +64
- Partials 2143 2249 +106
... and 42 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
For visibility:
This won't handle the case we're trying to handle - Jamie to look into it tomorrow :)
engine/src/settings.rs
Outdated
validate_port_exists(&endpoints.http_endpoint) | ||
}; | ||
validate_dot_endpoints(&self.nodes.primary) | ||
.map_err(|e| ConfigError::Message(format!("{CONTEXT_MESSAGE}: {e}")))?; |
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.
this map error should be able to be pulled out too? - thus removing the need for the const too
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.
let validate_dot_endpoints = |endpoints: &WsHttpEndpoints| -> Result<(), ConfigError> {
validate_port_exists(&endpoints.ws_endpoint)
.and_then(|_| validate_port_exists(&endpoints.http_endpoint))
.map_err(|e| {
ConfigError::Message(format!(
"Polkadot node endpoints must include a port number: {e}"
))
})
};
Pull Request
Closes: PRO-881
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
Added a check to the validate settings code for the Dot settings that checks that the port number exist for all endpoints.
This catches the error early and gives a nice error message.