Skip to content
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!: make DhtHeader field non-malleable #3243

Closed

Conversation

philipr-za
Copy link
Contributor

@philipr-za philipr-za commented Aug 24, 2021

Description

This PR includes the relevant DhtHeader fields in the commitment of a Dht Message MAC signature so that they cannot be changed while in route.

The header fields included in the commitment are:

  • Major version
  • Minor version
  • Destination
  • Message type
  • Message flags
  • Expiry time (if exists)
  • Ephemeral public key (if exists)

How Has This Been Tested?

Rust integration test provided and existing tests updated.

BREAKING CHANGE: Previous message signatures will not be valid

delta1
delta1 previously approved these changes Aug 24, 2021
Copy link
Contributor

@delta1 delta1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, happy to approve with clippy passing

comms/dht/src/inbound/decryption.rs Outdated Show resolved Hide resolved
comms/dht/src/test_utils/makers.rs Show resolved Hide resolved
comms/dht/tests/dht.rs Show resolved Hide resolved
delta1
delta1 previously approved these changes Aug 25, 2021
Copy link
Contributor

@delta1 delta1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@stringhandler stringhandler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to merge this once a WIREMODE update is included

### Breaking Change to comms

This PR includes the relevant DhtHeader fields in the commitment of a Dht Message MAC signature so that they cannot be changed while in route.

The header fields included in the commitment are:
- Major version
- Minor version
- Destination
- Message type
- Message flags
- Expiry time (if exists)
- Ephemeral public key (if exists)
@philipr-za
Copy link
Contributor Author

Happy to merge this once a WIREMODE update is included

Ahh yes you are correct I should have incremented the DHT_MAJOR_VERSION and have updated that.

@philipr-za philipr-za changed the title feat!: Make DhtHeader field non-malleable feat!: make DhtHeader field non-malleable Aug 27, 2021
@stringhandler stringhandler added the P-do_not_merge Process - Not ready for merging label Aug 30, 2021
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck - obviously would be nice to DRY up the challenge construction

aviator-app bot pushed a commit that referenced this pull request Sep 21, 2021
… compatibility (#3372)

Description
---
Block v1 (compatible with weatherwax at all heights):
- Kernel ordering using every kernel field
- Input MR commits to empty serialization of bitmap

Block v2 (Igor, breaking change)
- Kernel ordering (#3193)
- Input MR uses input hashes only without extaneous empty bitmap bytes
  (#3195)

Misc

- Add missing kernel order block validation
- Removed unnecessary transaction body sorting in wallet, it (still) is the responsibility of the GetNewBlockTemplate to assemble a final sorted block body.

Motivation and Context
---
Allow consensus breaking code to be merged without hard forking weatherwax. 
Igor will have to be reset.

To follow in subsequent PR: network breaking changes from DHT header malleability fix (#3243 ) 

How Has This Been Tested?
---
Archival sync weatherwax node from scratch, received propagated blocks
Washing machine between two weatherwax wallets
@aviator-app aviator-app bot closed this in #3377 Sep 22, 2021
aviator-app bot pushed a commit that referenced this pull request Sep 22, 2021
Description
---
- implements DHT protocol versioning allowing the same codebase to be
  used for multiple networks
- DRY dht header signature construction
- Pre-version 2 DHT protocol does not use the entire header in
  signature challenge
- minor DHT builder improvements

Motivation and Context
---
Allow new break protocols to be introduced while old protocols still exist.
Setting the protocol version sets the DHT to speak that version, while still supporting previous versions  

Closes #3243 

How Has This Been Tested?
---

Tested discovery on weatherwax which uses versioned challenge construction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-do_not_merge Process - Not ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants