-
Notifications
You must be signed in to change notification settings - Fork 184
Fix certificate verification #752
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
Merged
pavlenex
merged 16 commits into
stratum-mining:main
from
plebhash:fix-certificate-verify
Feb 16, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
dddafd9
fix certificate validation
plebhash ec0785c
add clarification comment for certificate verification
plebhash b5492f4
rename tp_authority_public_key variables
plebhash 095dc87
fix comment
plebhash 251baa4
verify certificate against authority_pk
plebhash 7f53874
rename responder_authority_pk
plebhash 559b789
fix jd-client for new TP authority certificate validation
plebhash 570d827
add comments for TP authority key
plebhash bb1a1c2
add tp_authority_public_key to test configs
plebhash 310d4e4
clippy
plebhash ef75b40
change tp_authority_public_key for tests
plebhash b654473
allow null tp_authority_public_key
plebhash f61cc95
remove tp_authority_public_key from test configs
plebhash e3712be
move match inside verify
plebhash a1cf7b3
improve comments around tp_authority_public_key
plebhash b4a4387
replace match with if let
plebhash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,13 +43,17 @@ impl TemplateRx { | |
| message_received_signal: Receiver<()>, | ||
| status_tx: status::Sender, | ||
| coinbase_out_len: u32, | ||
| authority_public_key: Secp256k1PublicKey, | ||
| expected_tp_authority_public_key: Option<Secp256k1PublicKey>, | ||
| ) -> PoolResult<()> { | ||
| let stream = TcpStream::connect(address).await?; | ||
| info!("Connected to template distribution server at {}", address); | ||
|
|
||
| let pub_key: Secp256k1PublicKey = authority_public_key; | ||
| let initiator = Initiator::from_raw_k(pub_key.into_bytes())?; | ||
| let initiator = match expected_tp_authority_public_key { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing of the previous comment |
||
| Some(expected_tp_authority_public_key) => { | ||
| Initiator::from_raw_k(expected_tp_authority_public_key.into_bytes()) | ||
| } | ||
| None => Initiator::without_pk(), | ||
| }?; | ||
| let (mut receiver, mut sender, _, _) = | ||
| Connection::new(stream, HandshakeRole::Initiator(initiator)) | ||
| .await | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Here you can turn
authority_public_key: Option<Secp256k1PublicKey>in a variableauthority_public_key_x_only: Option<XOnlyPublicKey>and initialize the initiator withInitiator::new(autority_public_key_x_only). You save some lines of code.I understand that you didn't write the whole code, but perhaps the methods
Initiator::from_raw_k()andInitiator::without_pk()can be eliminated.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.
while I agree this would be a desirable improvement to the code, this would imply refactoring multiple parts of the codebase which don't really have much to do with the context of this PR
so in order to keep PR atomicity, I created this issue so we can implement this improvement in the future:
#760