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

Mix Transport Implementation: Progress and Challenges #7

Open
wants to merge 65 commits into
base: poc/mix-connection
Choose a base branch
from

Conversation

AkshayaMani
Copy link
Collaborator

This PR introduces some updates to the Mix transport implementation. However, there are some unique challenges posed by the Mix transport.

Implemented Changes

  • Updated switch creation with full multiaddress, including /mix/.
  • Modified MixnetTransportAdapter to listen and dial on full addresses.

Key Challenges

  • Unlike other transports, the Mix transport establishes only a logical connection (no real physical connection) when dialing a destination.
  • Mix nodes are randomly selected per message at send time. This differs from establishing fixed routes at connection time.
  • Modifying the write function of the logical connection to dial a mix node would require using the MixnetTransportAdapter's dial function. This approach risks creating undesirable tight coupling between transport and connection layers.
  • Need to implement embedding the destination address in the Sphinx packet.

Next Steps

  • Given these challenges, we may need to reconsider our approach to integrating Mix Transport.
  • Need some inputs on how to best address these issues while maintaining the integrity and flexibility of the libp2p framework.

Still have errors with dial
- Use generic upgrade
- Changes to muxer not required
- Removed physical connection
- Added logical connection
- Added mixDialer to forward message through the mix network
- Changed to logical connections at dial time
- Introduced mixDialer for per-message routing through the mix network
- Integrated Sphinx packet creation
- Refined accept method to process incoming Sphinx packets
@AkshayaMani
Copy link
Collaborator Author

Significant progress has been made in the Mix transport implementation, addressing many of the initial challenges outlined in the previous discussion. Here’s a detailed update since last week:

Implemented Changes

Logical Connection Establishment

  • Introduced MixnetLogicalConnection to represent the logical connection created at dial time

Message Routing and Sphinx Integration

  • Developed mixDialer within MixnetTransportAdapter for per-message routing, ensuring that we maintain a clear separation between the connection and transport layers
  • Integrated Sphinx packet creation
  • Enhanced acceptWithMixnet to process incoming Sphinx packets

Generic Upgrades and Error Handling

  • Removed unnecessary files (anon_muxer.nim, muxer.nim, upgrade.nim)
  • Updated poc_ping to utilize generic upgrade
  • Improved error handling in functions like multiAddrToBytes
  • Added utility function unpadMessage with corresponding tests

Key Challenges Addressed

  • Implemented logical connection for the Mix transport while maintaining libp2p framework compatibility
  • Achieved per-message routing with mixDialer, effectively avoiding tight coupling between transport and connection layers

Next Steps

  • Develop custom connection type for physical connections at exit nodes
  • Conduct end-to-end testing of one-way ping functionality
  • Incorporate Single-Use Reply Blocks (SURBs) into Sphinx packet creation for Ping response

@AkshayaMani
Copy link
Collaborator Author

Since last week, the following changes have been implemented:

  • Fixed mixDialer Call: Resolved issues with the mixDialer invocation in MixLogicalConnection.

  • Removed mixDialer Field: Eliminated the mixDialer callback field from MixnetTransportAdapter and passed it as a parameter to MixLogicalConnection.

  • Implemented MixPhysicalConnection: For the message handling at the exit.

  • Enhanced Error Handling in sendThroughMixnet:

    • Added checks for insufficient nodes (less than L).
    • Implemented handling for potential divide-by-zero error in cryptoRandomInt.
  • Adapted ping_poc for Generic Node Count:

    • Corrected the switch creation process to ensure all necessary files are written before switches are instantiated.
    • Included logic to properly stop switches and clean up node info folders.

Next Steps

  • Review PR #10: Ensure that the proposed changes align with the proposed changes on custom upgrade bellow.

  • Implement Custom Upgrade: To handle and pass the end protocol codec to sendThroughMixnet, as well as from the previous hop to the exit. This will ensure proper end protocol handling.

  • Complete Accept with Mixnet: Wrap connection and return MixPhysicalConnection.

  • Test End-to-End Functionality of Ping without Response

These next steps will help complete the transport and test it end-to-end.

- To interface with the end protocol handlers
- Updated to reflect mix-mix connection, having both read and write functions
- Added optional multiaddress and peer address for initialization
AkshayaMani and others added 30 commits December 6, 2024 13:30
Implement Mix Message Type with Protocol
Co-authored-by: richΛrd <[email protected]>
- `results` to return error
- `chronicles` for logging
- `results` to return error
- `chronicles` for logging
Error Handling and Code Quality Improvements
Error Handling and Code Quality Improvements - Part 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants