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

Mixnet: Packet delay in mix node #49

Merged
merged 4 commits into from
Jan 23, 2024
Merged

Mixnet: Packet delay in mix node #49

merged 4 commits into from
Jan 23, 2024

Conversation

youngjoon-lee
Copy link
Contributor

This PR covers the specification of packet delay in mix nodes: https://www.notion.so/Mixnet-Specification-807b624444a54a4b88afa1cc80e100c2?pvs=4#15ccbb03a44f42658ea67a33527ecea2.

In summary,
assuming that the packet receiving rate of a mix node follows a Poisson distribution $\lambda$, the mix node should be implementation to approximate a M/M/∞ queue with packet delays that follow an exponential distribution $\mu$. With this setup, the packet emission rate of a mix node must be $\lambda$, and the mean number of packets being processed by a mix node at any time must be $\lambda/\mu$.
A unit test checks these properties.

@youngjoon-lee youngjoon-lee added the enhancement New feature or request label Jan 15, 2024
@youngjoon-lee youngjoon-lee self-assigned this Jan 15, 2024
Comment on lines +51 to +65
def start(
self,
delay_rate_per_min: int,
inbound_socket: PacketQueue,
outbound_socket: PacketPayloadQueue,
) -> MixNodeRunner:
thread = MixNodeRunner(
self.encryption_private_key,
delay_rate_per_min,
inbound_socket,
outbound_socket,
)
thread.daemon = True
thread.start()
return thread
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: could this be async instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can use async, but I'm thinking if it would be not readable for someone who is not familar with async programming.

Also in previous PRs I remember to see some async code, we should choose one style

I haven't used async code in this repo. But, let me translate this into async. If it doesn't look complicated, we can go with async because it's much easier to approximate M/M/∞ queue using async rather than sync.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't used async code in this repo. But, hm, let me translate this into async. If it doesn't look complicated, we can go with async because it's much easier to approximate M/M/∞ queue using async rather than sync.

It is not necessary!, we can go ahead with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but after opening subsequent PRs #50 and #51, now I have a feeling that async code would be even simpler. I'll try it and open a separate PR soon. So, I hope this and subsequent PRs are reviewed and merged independently.

Copy link
Collaborator

@danielSanchezQ danielSanchezQ left a comment

Choose a reason for hiding this comment

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

I think in general is ok. I would change the use of threads by async code instead. Also in previous PRs I remember to see some async code, we should choose one style. But it is up to you.

@youngjoon-lee youngjoon-lee merged commit d963d6c into master Jan 23, 2024
1 check passed
@youngjoon-lee youngjoon-lee deleted the mixnode-delay branch February 5, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants