From 3bf199bd9f9165385f4dc51c3880dfa7d334d91f Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:13:37 +0900 Subject: [PATCH 1/4] Mixnet: Deprecate old spec --- {mixnet => deprecated/mixnet-v1}/README.md | 0 {mixnet => deprecated/mixnet-v1}/__init__.py | 0 {mixnet => deprecated/mixnet-v1}/bls.py | 0 {mixnet => deprecated/mixnet-v1}/client.py | 0 {mixnet => deprecated/mixnet-v1}/config.py | 0 {mixnet => deprecated/mixnet-v1}/fisheryates.py | 0 {mixnet => deprecated/mixnet-v1}/mixnet.py | 0 {mixnet => deprecated/mixnet-v1}/node.py | 0 {mixnet => deprecated/mixnet-v1}/packet.py | 0 {mixnet => deprecated/mixnet-v1}/poisson.py | 0 {mixnet => deprecated/mixnet-v1}/structure.png | Bin {mixnet => deprecated/mixnet-v1}/test_client.py | 0 .../mixnet-v1}/test_fisheryates.py | 0 {mixnet => deprecated/mixnet-v1}/test_mixnet.py | 0 {mixnet => deprecated/mixnet-v1}/test_node.py | 0 {mixnet => deprecated/mixnet-v1}/test_packet.py | 0 {mixnet => deprecated/mixnet-v1}/test_utils.py | 0 {mixnet => deprecated/mixnet-v1}/utils.py | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename {mixnet => deprecated/mixnet-v1}/README.md (100%) rename {mixnet => deprecated/mixnet-v1}/__init__.py (100%) rename {mixnet => deprecated/mixnet-v1}/bls.py (100%) rename {mixnet => deprecated/mixnet-v1}/client.py (100%) rename {mixnet => deprecated/mixnet-v1}/config.py (100%) rename {mixnet => deprecated/mixnet-v1}/fisheryates.py (100%) rename {mixnet => deprecated/mixnet-v1}/mixnet.py (100%) rename {mixnet => deprecated/mixnet-v1}/node.py (100%) rename {mixnet => deprecated/mixnet-v1}/packet.py (100%) rename {mixnet => deprecated/mixnet-v1}/poisson.py (100%) rename {mixnet => deprecated/mixnet-v1}/structure.png (100%) rename {mixnet => deprecated/mixnet-v1}/test_client.py (100%) rename {mixnet => deprecated/mixnet-v1}/test_fisheryates.py (100%) rename {mixnet => deprecated/mixnet-v1}/test_mixnet.py (100%) rename {mixnet => deprecated/mixnet-v1}/test_node.py (100%) rename {mixnet => deprecated/mixnet-v1}/test_packet.py (100%) rename {mixnet => deprecated/mixnet-v1}/test_utils.py (100%) rename {mixnet => deprecated/mixnet-v1}/utils.py (100%) diff --git a/mixnet/README.md b/deprecated/mixnet-v1/README.md similarity index 100% rename from mixnet/README.md rename to deprecated/mixnet-v1/README.md diff --git a/mixnet/__init__.py b/deprecated/mixnet-v1/__init__.py similarity index 100% rename from mixnet/__init__.py rename to deprecated/mixnet-v1/__init__.py diff --git a/mixnet/bls.py b/deprecated/mixnet-v1/bls.py similarity index 100% rename from mixnet/bls.py rename to deprecated/mixnet-v1/bls.py diff --git a/mixnet/client.py b/deprecated/mixnet-v1/client.py similarity index 100% rename from mixnet/client.py rename to deprecated/mixnet-v1/client.py diff --git a/mixnet/config.py b/deprecated/mixnet-v1/config.py similarity index 100% rename from mixnet/config.py rename to deprecated/mixnet-v1/config.py diff --git a/mixnet/fisheryates.py b/deprecated/mixnet-v1/fisheryates.py similarity index 100% rename from mixnet/fisheryates.py rename to deprecated/mixnet-v1/fisheryates.py diff --git a/mixnet/mixnet.py b/deprecated/mixnet-v1/mixnet.py similarity index 100% rename from mixnet/mixnet.py rename to deprecated/mixnet-v1/mixnet.py diff --git a/mixnet/node.py b/deprecated/mixnet-v1/node.py similarity index 100% rename from mixnet/node.py rename to deprecated/mixnet-v1/node.py diff --git a/mixnet/packet.py b/deprecated/mixnet-v1/packet.py similarity index 100% rename from mixnet/packet.py rename to deprecated/mixnet-v1/packet.py diff --git a/mixnet/poisson.py b/deprecated/mixnet-v1/poisson.py similarity index 100% rename from mixnet/poisson.py rename to deprecated/mixnet-v1/poisson.py diff --git a/mixnet/structure.png b/deprecated/mixnet-v1/structure.png similarity index 100% rename from mixnet/structure.png rename to deprecated/mixnet-v1/structure.png diff --git a/mixnet/test_client.py b/deprecated/mixnet-v1/test_client.py similarity index 100% rename from mixnet/test_client.py rename to deprecated/mixnet-v1/test_client.py diff --git a/mixnet/test_fisheryates.py b/deprecated/mixnet-v1/test_fisheryates.py similarity index 100% rename from mixnet/test_fisheryates.py rename to deprecated/mixnet-v1/test_fisheryates.py diff --git a/mixnet/test_mixnet.py b/deprecated/mixnet-v1/test_mixnet.py similarity index 100% rename from mixnet/test_mixnet.py rename to deprecated/mixnet-v1/test_mixnet.py diff --git a/mixnet/test_node.py b/deprecated/mixnet-v1/test_node.py similarity index 100% rename from mixnet/test_node.py rename to deprecated/mixnet-v1/test_node.py diff --git a/mixnet/test_packet.py b/deprecated/mixnet-v1/test_packet.py similarity index 100% rename from mixnet/test_packet.py rename to deprecated/mixnet-v1/test_packet.py diff --git a/mixnet/test_utils.py b/deprecated/mixnet-v1/test_utils.py similarity index 100% rename from mixnet/test_utils.py rename to deprecated/mixnet-v1/test_utils.py diff --git a/mixnet/utils.py b/deprecated/mixnet-v1/utils.py similarity index 100% rename from mixnet/utils.py rename to deprecated/mixnet-v1/utils.py From bf41a367d0d598e555b79f20b0db7857cc42c838 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:37:06 +0900 Subject: [PATCH 2/4] update import paths and add __init__.py to make it testable --- deprecated/{mixnet-v1 => }/__init__.py | 0 deprecated/{mixnet-v1 => mixnet_v1}/README.md | 0 deprecated/mixnet_v1/__init__.py | 0 deprecated/{mixnet-v1 => mixnet_v1}/bls.py | 2 +- deprecated/{mixnet-v1 => mixnet_v1}/client.py | 8 ++++---- deprecated/{mixnet-v1 => mixnet_v1}/config.py | 4 ++-- deprecated/{mixnet-v1 => mixnet_v1}/fisheryates.py | 0 deprecated/{mixnet-v1 => mixnet_v1}/mixnet.py | 10 +++++++--- deprecated/{mixnet-v1 => mixnet_v1}/node.py | 4 ++-- deprecated/{mixnet-v1 => mixnet_v1}/packet.py | 2 +- deprecated/{mixnet-v1 => mixnet_v1}/poisson.py | 0 deprecated/{mixnet-v1 => mixnet_v1}/structure.png | Bin deprecated/{mixnet-v1 => mixnet_v1}/test_client.py | 8 ++++---- .../{mixnet-v1 => mixnet_v1}/test_fisheryates.py | 2 +- deprecated/{mixnet-v1 => mixnet_v1}/test_mixnet.py | 4 ++-- deprecated/{mixnet-v1 => mixnet_v1}/test_node.py | 8 ++++---- deprecated/{mixnet-v1 => mixnet_v1}/test_packet.py | 8 ++++---- deprecated/{mixnet-v1 => mixnet_v1}/test_utils.py | 10 +++++----- deprecated/{mixnet-v1 => mixnet_v1}/utils.py | 0 19 files changed, 37 insertions(+), 33 deletions(-) rename deprecated/{mixnet-v1 => }/__init__.py (100%) rename deprecated/{mixnet-v1 => mixnet_v1}/README.md (100%) create mode 100644 deprecated/mixnet_v1/__init__.py rename deprecated/{mixnet-v1 => mixnet_v1}/bls.py (82%) rename deprecated/{mixnet-v1 => mixnet_v1}/client.py (94%) rename deprecated/{mixnet-v1 => mixnet_v1}/config.py (96%) rename deprecated/{mixnet-v1 => mixnet_v1}/fisheryates.py (100%) rename deprecated/{mixnet-v1 => mixnet_v1}/mixnet.py (89%) rename deprecated/{mixnet-v1 => mixnet_v1}/node.py (96%) rename deprecated/{mixnet-v1 => mixnet_v1}/packet.py (98%) rename deprecated/{mixnet-v1 => mixnet_v1}/poisson.py (100%) rename deprecated/{mixnet-v1 => mixnet_v1}/structure.png (100%) rename deprecated/{mixnet-v1 => mixnet_v1}/test_client.py (86%) rename deprecated/{mixnet-v1 => mixnet_v1}/test_fisheryates.py (91%) rename deprecated/{mixnet-v1 => mixnet_v1}/test_mixnet.py (83%) rename deprecated/{mixnet-v1 => mixnet_v1}/test_node.py (94%) rename deprecated/{mixnet-v1 => mixnet_v1}/test_packet.py (92%) rename deprecated/{mixnet-v1 => mixnet_v1}/test_utils.py (88%) rename deprecated/{mixnet-v1 => mixnet_v1}/utils.py (100%) diff --git a/deprecated/mixnet-v1/__init__.py b/deprecated/__init__.py similarity index 100% rename from deprecated/mixnet-v1/__init__.py rename to deprecated/__init__.py diff --git a/deprecated/mixnet-v1/README.md b/deprecated/mixnet_v1/README.md similarity index 100% rename from deprecated/mixnet-v1/README.md rename to deprecated/mixnet_v1/README.md diff --git a/deprecated/mixnet_v1/__init__.py b/deprecated/mixnet_v1/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/deprecated/mixnet-v1/bls.py b/deprecated/mixnet_v1/bls.py similarity index 82% rename from deprecated/mixnet-v1/bls.py rename to deprecated/mixnet_v1/bls.py index a4278b08..44c79a37 100644 --- a/deprecated/mixnet-v1/bls.py +++ b/deprecated/mixnet_v1/bls.py @@ -2,7 +2,7 @@ import blspy -from mixnet.utils import random_bytes +from deprecated.mixnet_v1.utils import random_bytes BlsPrivateKey: TypeAlias = blspy.PrivateKey BlsPublicKey: TypeAlias = blspy.G1Element diff --git a/deprecated/mixnet-v1/client.py b/deprecated/mixnet_v1/client.py similarity index 94% rename from deprecated/mixnet-v1/client.py rename to deprecated/mixnet_v1/client.py index 8d21cf3c..c9549809 100644 --- a/deprecated/mixnet-v1/client.py +++ b/deprecated/mixnet_v1/client.py @@ -4,10 +4,10 @@ from contextlib import suppress from typing import Self -from mixnet.config import MixClientConfig, MixnetTopology -from mixnet.node import PacketQueue -from mixnet.packet import PacketBuilder -from mixnet.poisson import poisson_interval_sec +from deprecated.mixnet_v1.config import MixClientConfig, MixnetTopology +from deprecated.mixnet_v1.node import PacketQueue +from deprecated.mixnet_v1.packet import PacketBuilder +from deprecated.mixnet_v1.poisson import poisson_interval_sec class MixClient: diff --git a/deprecated/mixnet-v1/config.py b/deprecated/mixnet_v1/config.py similarity index 96% rename from deprecated/mixnet-v1/config.py rename to deprecated/mixnet_v1/config.py index 5b1a2d10..642500e9 100644 --- a/deprecated/mixnet-v1/config.py +++ b/deprecated/mixnet_v1/config.py @@ -10,8 +10,8 @@ ) from pysphinx.node import Node -from mixnet.bls import BlsPrivateKey, BlsPublicKey -from mixnet.fisheryates import FisherYates +from deprecated.mixnet_v1.bls import BlsPrivateKey, BlsPublicKey +from deprecated.mixnet_v1.fisheryates import FisherYates @dataclass diff --git a/deprecated/mixnet-v1/fisheryates.py b/deprecated/mixnet_v1/fisheryates.py similarity index 100% rename from deprecated/mixnet-v1/fisheryates.py rename to deprecated/mixnet_v1/fisheryates.py diff --git a/deprecated/mixnet-v1/mixnet.py b/deprecated/mixnet_v1/mixnet.py similarity index 89% rename from deprecated/mixnet-v1/mixnet.py rename to deprecated/mixnet_v1/mixnet.py index dedc9efd..10588236 100644 --- a/deprecated/mixnet-v1/mixnet.py +++ b/deprecated/mixnet_v1/mixnet.py @@ -4,9 +4,13 @@ from contextlib import suppress from typing import Self, TypeAlias -from mixnet.client import MixClient -from mixnet.config import MixnetConfig, MixnetTopology, MixnetTopologyConfig -from mixnet.node import MixNode +from deprecated.mixnet_v1.client import MixClient +from deprecated.mixnet_v1.config import ( + MixnetConfig, + MixnetTopology, + MixnetTopologyConfig, +) +from deprecated.mixnet_v1.node import MixNode EntropyQueue: TypeAlias = "asyncio.Queue[bytes]" diff --git a/deprecated/mixnet-v1/node.py b/deprecated/mixnet_v1/node.py similarity index 96% rename from deprecated/mixnet-v1/node.py rename to deprecated/mixnet_v1/node.py index 8ab4b77c..aa20a64f 100644 --- a/deprecated/mixnet-v1/node.py +++ b/deprecated/mixnet_v1/node.py @@ -15,8 +15,8 @@ UnknownHeaderTypeError, ) -from mixnet.config import MixNodeConfig, NodeAddress -from mixnet.poisson import poisson_interval_sec +from deprecated.mixnet_v1.config import MixNodeConfig, NodeAddress +from deprecated.mixnet_v1.poisson import poisson_interval_sec PacketQueue: TypeAlias = "asyncio.Queue[Tuple[NodeAddress, SphinxPacket]]" PacketPayloadQueue: TypeAlias = ( diff --git a/deprecated/mixnet-v1/packet.py b/deprecated/mixnet_v1/packet.py similarity index 98% rename from deprecated/mixnet-v1/packet.py rename to deprecated/mixnet_v1/packet.py index 71fe6878..6ecf262a 100644 --- a/deprecated/mixnet-v1/packet.py +++ b/deprecated/mixnet_v1/packet.py @@ -9,7 +9,7 @@ from pysphinx.payload import Payload from pysphinx.sphinx import SphinxPacket -from mixnet.config import MixnetTopology, MixNodeInfo +from deprecated.mixnet_v1.config import MixnetTopology, MixNodeInfo class MessageFlag(Enum): diff --git a/deprecated/mixnet-v1/poisson.py b/deprecated/mixnet_v1/poisson.py similarity index 100% rename from deprecated/mixnet-v1/poisson.py rename to deprecated/mixnet_v1/poisson.py diff --git a/deprecated/mixnet-v1/structure.png b/deprecated/mixnet_v1/structure.png similarity index 100% rename from deprecated/mixnet-v1/structure.png rename to deprecated/mixnet_v1/structure.png diff --git a/deprecated/mixnet-v1/test_client.py b/deprecated/mixnet_v1/test_client.py similarity index 86% rename from deprecated/mixnet-v1/test_client.py rename to deprecated/mixnet_v1/test_client.py index 43274662..fff7b31e 100644 --- a/deprecated/mixnet-v1/test_client.py +++ b/deprecated/mixnet_v1/test_client.py @@ -3,13 +3,13 @@ import numpy -from mixnet.client import MixClient -from mixnet.poisson import poisson_mean_interval_sec -from mixnet.test_utils import ( +from deprecated.mixnet_v1.client import MixClient +from deprecated.mixnet_v1.poisson import poisson_mean_interval_sec +from deprecated.mixnet_v1.test_utils import ( init_mixnet_config, with_test_timeout, ) -from mixnet.utils import random_bytes +from deprecated.mixnet_v1.utils import random_bytes class TestMixClient(IsolatedAsyncioTestCase): diff --git a/deprecated/mixnet-v1/test_fisheryates.py b/deprecated/mixnet_v1/test_fisheryates.py similarity index 91% rename from deprecated/mixnet-v1/test_fisheryates.py rename to deprecated/mixnet_v1/test_fisheryates.py index a32554c6..1d9a605a 100644 --- a/deprecated/mixnet-v1/test_fisheryates.py +++ b/deprecated/mixnet_v1/test_fisheryates.py @@ -1,6 +1,6 @@ from unittest import TestCase -from mixnet.fisheryates import FisherYates +from deprecated.mixnet_v1.fisheryates import FisherYates class TestFisherYates(TestCase): diff --git a/deprecated/mixnet-v1/test_mixnet.py b/deprecated/mixnet_v1/test_mixnet.py similarity index 83% rename from deprecated/mixnet-v1/test_mixnet.py rename to deprecated/mixnet_v1/test_mixnet.py index 9a0e4cb1..fde95bfa 100644 --- a/deprecated/mixnet-v1/test_mixnet.py +++ b/deprecated/mixnet_v1/test_mixnet.py @@ -1,8 +1,8 @@ import asyncio from unittest import IsolatedAsyncioTestCase -from mixnet.mixnet import Mixnet -from mixnet.test_utils import init_mixnet_config +from deprecated.mixnet_v1.mixnet import Mixnet +from deprecated.mixnet_v1.test_utils import init_mixnet_config class TestMixnet(IsolatedAsyncioTestCase): diff --git a/deprecated/mixnet-v1/test_node.py b/deprecated/mixnet_v1/test_node.py similarity index 94% rename from deprecated/mixnet-v1/test_node.py rename to deprecated/mixnet_v1/test_node.py index 26ab0c7b..a26c9b11 100644 --- a/deprecated/mixnet-v1/test_node.py +++ b/deprecated/mixnet_v1/test_node.py @@ -5,10 +5,10 @@ import numpy from pysphinx.sphinx import SphinxPacket -from mixnet.node import MixNode, NodeAddress, PacketQueue -from mixnet.packet import PacketBuilder -from mixnet.poisson import poisson_interval_sec, poisson_mean_interval_sec -from mixnet.test_utils import ( +from deprecated.mixnet_v1.node import MixNode, NodeAddress, PacketQueue +from deprecated.mixnet_v1.packet import PacketBuilder +from deprecated.mixnet_v1.poisson import poisson_interval_sec, poisson_mean_interval_sec +from deprecated.mixnet_v1.test_utils import ( init_mixnet_config, with_test_timeout, ) diff --git a/deprecated/mixnet-v1/test_packet.py b/deprecated/mixnet_v1/test_packet.py similarity index 92% rename from deprecated/mixnet-v1/test_packet.py rename to deprecated/mixnet_v1/test_packet.py index d1d517a6..64322df7 100644 --- a/deprecated/mixnet-v1/test_packet.py +++ b/deprecated/mixnet_v1/test_packet.py @@ -3,15 +3,15 @@ from pysphinx.sphinx import ProcessedFinalHopPacket, SphinxPacket -from mixnet.config import MixNodeInfo -from mixnet.packet import ( +from deprecated.mixnet_v1.config import MixNodeInfo +from deprecated.mixnet_v1.packet import ( Fragment, MessageFlag, MessageReconstructor, PacketBuilder, ) -from mixnet.test_utils import init_mixnet_config -from mixnet.utils import random_bytes +from deprecated.mixnet_v1.test_utils import init_mixnet_config +from deprecated.mixnet_v1.utils import random_bytes class TestPacket(TestCase): diff --git a/deprecated/mixnet-v1/test_utils.py b/deprecated/mixnet_v1/test_utils.py similarity index 88% rename from deprecated/mixnet-v1/test_utils.py rename to deprecated/mixnet_v1/test_utils.py index e3ba2607..89426cce 100644 --- a/deprecated/mixnet-v1/test_utils.py +++ b/deprecated/mixnet_v1/test_utils.py @@ -2,17 +2,17 @@ from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey -from mixnet.bls import generate_bls -from mixnet.config import ( +from deprecated.mixnet_v1.bls import generate_bls +from deprecated.mixnet_v1.config import ( MixClientConfig, - MixNodeConfig, MixnetConfig, - MixNodeInfo, MixnetTopology, MixnetTopologyConfig, MixnetTopologySize, + MixNodeConfig, + MixNodeInfo, ) -from mixnet.utils import random_bytes +from deprecated.mixnet_v1.utils import random_bytes def with_test_timeout(t): diff --git a/deprecated/mixnet-v1/utils.py b/deprecated/mixnet_v1/utils.py similarity index 100% rename from deprecated/mixnet-v1/utils.py rename to deprecated/mixnet_v1/utils.py From 1b4a8609ba30fb45fe222371743744641cc69e56 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:23:51 +0900 Subject: [PATCH 3/4] use relative imports --- deprecated/mixnet_v1/bls.py | 2 +- deprecated/mixnet_v1/client.py | 8 ++++---- deprecated/mixnet_v1/config.py | 4 ++-- deprecated/mixnet_v1/mixnet.py | 6 +++--- deprecated/mixnet_v1/node.py | 4 ++-- deprecated/mixnet_v1/packet.py | 2 +- deprecated/mixnet_v1/test_client.py | 8 ++++---- deprecated/mixnet_v1/test_fisheryates.py | 2 +- deprecated/mixnet_v1/test_mixnet.py | 4 ++-- deprecated/mixnet_v1/test_node.py | 8 ++++---- deprecated/mixnet_v1/test_packet.py | 8 ++++---- deprecated/mixnet_v1/test_utils.py | 6 +++--- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/deprecated/mixnet_v1/bls.py b/deprecated/mixnet_v1/bls.py index 44c79a37..249d1ce0 100644 --- a/deprecated/mixnet_v1/bls.py +++ b/deprecated/mixnet_v1/bls.py @@ -2,7 +2,7 @@ import blspy -from deprecated.mixnet_v1.utils import random_bytes +from .utils import random_bytes BlsPrivateKey: TypeAlias = blspy.PrivateKey BlsPublicKey: TypeAlias = blspy.G1Element diff --git a/deprecated/mixnet_v1/client.py b/deprecated/mixnet_v1/client.py index c9549809..ea2891d5 100644 --- a/deprecated/mixnet_v1/client.py +++ b/deprecated/mixnet_v1/client.py @@ -4,10 +4,10 @@ from contextlib import suppress from typing import Self -from deprecated.mixnet_v1.config import MixClientConfig, MixnetTopology -from deprecated.mixnet_v1.node import PacketQueue -from deprecated.mixnet_v1.packet import PacketBuilder -from deprecated.mixnet_v1.poisson import poisson_interval_sec +from .config import MixClientConfig, MixnetTopology +from .node import PacketQueue +from .packet import PacketBuilder +from .poisson import poisson_interval_sec class MixClient: diff --git a/deprecated/mixnet_v1/config.py b/deprecated/mixnet_v1/config.py index 642500e9..67a12e82 100644 --- a/deprecated/mixnet_v1/config.py +++ b/deprecated/mixnet_v1/config.py @@ -10,8 +10,8 @@ ) from pysphinx.node import Node -from deprecated.mixnet_v1.bls import BlsPrivateKey, BlsPublicKey -from deprecated.mixnet_v1.fisheryates import FisherYates +from .bls import BlsPrivateKey, BlsPublicKey +from .fisheryates import FisherYates @dataclass diff --git a/deprecated/mixnet_v1/mixnet.py b/deprecated/mixnet_v1/mixnet.py index 10588236..3746121d 100644 --- a/deprecated/mixnet_v1/mixnet.py +++ b/deprecated/mixnet_v1/mixnet.py @@ -4,13 +4,13 @@ from contextlib import suppress from typing import Self, TypeAlias -from deprecated.mixnet_v1.client import MixClient -from deprecated.mixnet_v1.config import ( +from .client import MixClient +from .config import ( MixnetConfig, MixnetTopology, MixnetTopologyConfig, ) -from deprecated.mixnet_v1.node import MixNode +from .node import MixNode EntropyQueue: TypeAlias = "asyncio.Queue[bytes]" diff --git a/deprecated/mixnet_v1/node.py b/deprecated/mixnet_v1/node.py index aa20a64f..af8ff67b 100644 --- a/deprecated/mixnet_v1/node.py +++ b/deprecated/mixnet_v1/node.py @@ -15,8 +15,8 @@ UnknownHeaderTypeError, ) -from deprecated.mixnet_v1.config import MixNodeConfig, NodeAddress -from deprecated.mixnet_v1.poisson import poisson_interval_sec +from .config import MixNodeConfig, NodeAddress +from .poisson import poisson_interval_sec PacketQueue: TypeAlias = "asyncio.Queue[Tuple[NodeAddress, SphinxPacket]]" PacketPayloadQueue: TypeAlias = ( diff --git a/deprecated/mixnet_v1/packet.py b/deprecated/mixnet_v1/packet.py index 6ecf262a..b76c59c3 100644 --- a/deprecated/mixnet_v1/packet.py +++ b/deprecated/mixnet_v1/packet.py @@ -9,7 +9,7 @@ from pysphinx.payload import Payload from pysphinx.sphinx import SphinxPacket -from deprecated.mixnet_v1.config import MixnetTopology, MixNodeInfo +from .config import MixnetTopology, MixNodeInfo class MessageFlag(Enum): diff --git a/deprecated/mixnet_v1/test_client.py b/deprecated/mixnet_v1/test_client.py index fff7b31e..f6a783d5 100644 --- a/deprecated/mixnet_v1/test_client.py +++ b/deprecated/mixnet_v1/test_client.py @@ -3,13 +3,13 @@ import numpy -from deprecated.mixnet_v1.client import MixClient -from deprecated.mixnet_v1.poisson import poisson_mean_interval_sec -from deprecated.mixnet_v1.test_utils import ( +from .client import MixClient +from .poisson import poisson_mean_interval_sec +from .test_utils import ( init_mixnet_config, with_test_timeout, ) -from deprecated.mixnet_v1.utils import random_bytes +from .utils import random_bytes class TestMixClient(IsolatedAsyncioTestCase): diff --git a/deprecated/mixnet_v1/test_fisheryates.py b/deprecated/mixnet_v1/test_fisheryates.py index 1d9a605a..fab94269 100644 --- a/deprecated/mixnet_v1/test_fisheryates.py +++ b/deprecated/mixnet_v1/test_fisheryates.py @@ -1,6 +1,6 @@ from unittest import TestCase -from deprecated.mixnet_v1.fisheryates import FisherYates +from .fisheryates import FisherYates class TestFisherYates(TestCase): diff --git a/deprecated/mixnet_v1/test_mixnet.py b/deprecated/mixnet_v1/test_mixnet.py index fde95bfa..bce581ca 100644 --- a/deprecated/mixnet_v1/test_mixnet.py +++ b/deprecated/mixnet_v1/test_mixnet.py @@ -1,8 +1,8 @@ import asyncio from unittest import IsolatedAsyncioTestCase -from deprecated.mixnet_v1.mixnet import Mixnet -from deprecated.mixnet_v1.test_utils import init_mixnet_config +from .mixnet import Mixnet +from .test_utils import init_mixnet_config class TestMixnet(IsolatedAsyncioTestCase): diff --git a/deprecated/mixnet_v1/test_node.py b/deprecated/mixnet_v1/test_node.py index a26c9b11..17a0afa1 100644 --- a/deprecated/mixnet_v1/test_node.py +++ b/deprecated/mixnet_v1/test_node.py @@ -5,10 +5,10 @@ import numpy from pysphinx.sphinx import SphinxPacket -from deprecated.mixnet_v1.node import MixNode, NodeAddress, PacketQueue -from deprecated.mixnet_v1.packet import PacketBuilder -from deprecated.mixnet_v1.poisson import poisson_interval_sec, poisson_mean_interval_sec -from deprecated.mixnet_v1.test_utils import ( +from .node import MixNode, NodeAddress, PacketQueue +from .packet import PacketBuilder +from .poisson import poisson_interval_sec, poisson_mean_interval_sec +from .test_utils import ( init_mixnet_config, with_test_timeout, ) diff --git a/deprecated/mixnet_v1/test_packet.py b/deprecated/mixnet_v1/test_packet.py index 64322df7..9549fb7f 100644 --- a/deprecated/mixnet_v1/test_packet.py +++ b/deprecated/mixnet_v1/test_packet.py @@ -3,15 +3,15 @@ from pysphinx.sphinx import ProcessedFinalHopPacket, SphinxPacket -from deprecated.mixnet_v1.config import MixNodeInfo -from deprecated.mixnet_v1.packet import ( +from .config import MixNodeInfo +from .packet import ( Fragment, MessageFlag, MessageReconstructor, PacketBuilder, ) -from deprecated.mixnet_v1.test_utils import init_mixnet_config -from deprecated.mixnet_v1.utils import random_bytes +from .test_utils import init_mixnet_config +from .utils import random_bytes class TestPacket(TestCase): diff --git a/deprecated/mixnet_v1/test_utils.py b/deprecated/mixnet_v1/test_utils.py index 89426cce..80d58294 100644 --- a/deprecated/mixnet_v1/test_utils.py +++ b/deprecated/mixnet_v1/test_utils.py @@ -2,8 +2,8 @@ from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey -from deprecated.mixnet_v1.bls import generate_bls -from deprecated.mixnet_v1.config import ( +from .bls import generate_bls +from .config import ( MixClientConfig, MixnetConfig, MixnetTopology, @@ -12,7 +12,7 @@ MixNodeConfig, MixNodeInfo, ) -from deprecated.mixnet_v1.utils import random_bytes +from .utils import random_bytes def with_test_timeout(t): From 0e834e0d05ba2c31dd823af7c82e9de7ba69e2c8 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:26:12 +0900 Subject: [PATCH 4/4] revert import path changes --- deprecated/__init__.py | 0 deprecated/mixnet_v1/bls.py | 2 +- deprecated/mixnet_v1/client.py | 8 ++++---- deprecated/mixnet_v1/config.py | 4 ++-- deprecated/mixnet_v1/mixnet.py | 10 +++------- deprecated/mixnet_v1/node.py | 4 ++-- deprecated/mixnet_v1/packet.py | 2 +- deprecated/mixnet_v1/test_client.py | 8 ++++---- deprecated/mixnet_v1/test_fisheryates.py | 2 +- deprecated/mixnet_v1/test_mixnet.py | 4 ++-- deprecated/mixnet_v1/test_node.py | 8 ++++---- deprecated/mixnet_v1/test_packet.py | 8 ++++---- deprecated/mixnet_v1/test_utils.py | 10 +++++----- 13 files changed, 33 insertions(+), 37 deletions(-) delete mode 100644 deprecated/__init__.py diff --git a/deprecated/__init__.py b/deprecated/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/deprecated/mixnet_v1/bls.py b/deprecated/mixnet_v1/bls.py index 249d1ce0..a4278b08 100644 --- a/deprecated/mixnet_v1/bls.py +++ b/deprecated/mixnet_v1/bls.py @@ -2,7 +2,7 @@ import blspy -from .utils import random_bytes +from mixnet.utils import random_bytes BlsPrivateKey: TypeAlias = blspy.PrivateKey BlsPublicKey: TypeAlias = blspy.G1Element diff --git a/deprecated/mixnet_v1/client.py b/deprecated/mixnet_v1/client.py index ea2891d5..8d21cf3c 100644 --- a/deprecated/mixnet_v1/client.py +++ b/deprecated/mixnet_v1/client.py @@ -4,10 +4,10 @@ from contextlib import suppress from typing import Self -from .config import MixClientConfig, MixnetTopology -from .node import PacketQueue -from .packet import PacketBuilder -from .poisson import poisson_interval_sec +from mixnet.config import MixClientConfig, MixnetTopology +from mixnet.node import PacketQueue +from mixnet.packet import PacketBuilder +from mixnet.poisson import poisson_interval_sec class MixClient: diff --git a/deprecated/mixnet_v1/config.py b/deprecated/mixnet_v1/config.py index 67a12e82..5b1a2d10 100644 --- a/deprecated/mixnet_v1/config.py +++ b/deprecated/mixnet_v1/config.py @@ -10,8 +10,8 @@ ) from pysphinx.node import Node -from .bls import BlsPrivateKey, BlsPublicKey -from .fisheryates import FisherYates +from mixnet.bls import BlsPrivateKey, BlsPublicKey +from mixnet.fisheryates import FisherYates @dataclass diff --git a/deprecated/mixnet_v1/mixnet.py b/deprecated/mixnet_v1/mixnet.py index 3746121d..dedc9efd 100644 --- a/deprecated/mixnet_v1/mixnet.py +++ b/deprecated/mixnet_v1/mixnet.py @@ -4,13 +4,9 @@ from contextlib import suppress from typing import Self, TypeAlias -from .client import MixClient -from .config import ( - MixnetConfig, - MixnetTopology, - MixnetTopologyConfig, -) -from .node import MixNode +from mixnet.client import MixClient +from mixnet.config import MixnetConfig, MixnetTopology, MixnetTopologyConfig +from mixnet.node import MixNode EntropyQueue: TypeAlias = "asyncio.Queue[bytes]" diff --git a/deprecated/mixnet_v1/node.py b/deprecated/mixnet_v1/node.py index af8ff67b..8ab4b77c 100644 --- a/deprecated/mixnet_v1/node.py +++ b/deprecated/mixnet_v1/node.py @@ -15,8 +15,8 @@ UnknownHeaderTypeError, ) -from .config import MixNodeConfig, NodeAddress -from .poisson import poisson_interval_sec +from mixnet.config import MixNodeConfig, NodeAddress +from mixnet.poisson import poisson_interval_sec PacketQueue: TypeAlias = "asyncio.Queue[Tuple[NodeAddress, SphinxPacket]]" PacketPayloadQueue: TypeAlias = ( diff --git a/deprecated/mixnet_v1/packet.py b/deprecated/mixnet_v1/packet.py index b76c59c3..71fe6878 100644 --- a/deprecated/mixnet_v1/packet.py +++ b/deprecated/mixnet_v1/packet.py @@ -9,7 +9,7 @@ from pysphinx.payload import Payload from pysphinx.sphinx import SphinxPacket -from .config import MixnetTopology, MixNodeInfo +from mixnet.config import MixnetTopology, MixNodeInfo class MessageFlag(Enum): diff --git a/deprecated/mixnet_v1/test_client.py b/deprecated/mixnet_v1/test_client.py index f6a783d5..43274662 100644 --- a/deprecated/mixnet_v1/test_client.py +++ b/deprecated/mixnet_v1/test_client.py @@ -3,13 +3,13 @@ import numpy -from .client import MixClient -from .poisson import poisson_mean_interval_sec -from .test_utils import ( +from mixnet.client import MixClient +from mixnet.poisson import poisson_mean_interval_sec +from mixnet.test_utils import ( init_mixnet_config, with_test_timeout, ) -from .utils import random_bytes +from mixnet.utils import random_bytes class TestMixClient(IsolatedAsyncioTestCase): diff --git a/deprecated/mixnet_v1/test_fisheryates.py b/deprecated/mixnet_v1/test_fisheryates.py index fab94269..a32554c6 100644 --- a/deprecated/mixnet_v1/test_fisheryates.py +++ b/deprecated/mixnet_v1/test_fisheryates.py @@ -1,6 +1,6 @@ from unittest import TestCase -from .fisheryates import FisherYates +from mixnet.fisheryates import FisherYates class TestFisherYates(TestCase): diff --git a/deprecated/mixnet_v1/test_mixnet.py b/deprecated/mixnet_v1/test_mixnet.py index bce581ca..9a0e4cb1 100644 --- a/deprecated/mixnet_v1/test_mixnet.py +++ b/deprecated/mixnet_v1/test_mixnet.py @@ -1,8 +1,8 @@ import asyncio from unittest import IsolatedAsyncioTestCase -from .mixnet import Mixnet -from .test_utils import init_mixnet_config +from mixnet.mixnet import Mixnet +from mixnet.test_utils import init_mixnet_config class TestMixnet(IsolatedAsyncioTestCase): diff --git a/deprecated/mixnet_v1/test_node.py b/deprecated/mixnet_v1/test_node.py index 17a0afa1..26ab0c7b 100644 --- a/deprecated/mixnet_v1/test_node.py +++ b/deprecated/mixnet_v1/test_node.py @@ -5,10 +5,10 @@ import numpy from pysphinx.sphinx import SphinxPacket -from .node import MixNode, NodeAddress, PacketQueue -from .packet import PacketBuilder -from .poisson import poisson_interval_sec, poisson_mean_interval_sec -from .test_utils import ( +from mixnet.node import MixNode, NodeAddress, PacketQueue +from mixnet.packet import PacketBuilder +from mixnet.poisson import poisson_interval_sec, poisson_mean_interval_sec +from mixnet.test_utils import ( init_mixnet_config, with_test_timeout, ) diff --git a/deprecated/mixnet_v1/test_packet.py b/deprecated/mixnet_v1/test_packet.py index 9549fb7f..d1d517a6 100644 --- a/deprecated/mixnet_v1/test_packet.py +++ b/deprecated/mixnet_v1/test_packet.py @@ -3,15 +3,15 @@ from pysphinx.sphinx import ProcessedFinalHopPacket, SphinxPacket -from .config import MixNodeInfo -from .packet import ( +from mixnet.config import MixNodeInfo +from mixnet.packet import ( Fragment, MessageFlag, MessageReconstructor, PacketBuilder, ) -from .test_utils import init_mixnet_config -from .utils import random_bytes +from mixnet.test_utils import init_mixnet_config +from mixnet.utils import random_bytes class TestPacket(TestCase): diff --git a/deprecated/mixnet_v1/test_utils.py b/deprecated/mixnet_v1/test_utils.py index 80d58294..e3ba2607 100644 --- a/deprecated/mixnet_v1/test_utils.py +++ b/deprecated/mixnet_v1/test_utils.py @@ -2,17 +2,17 @@ from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey -from .bls import generate_bls -from .config import ( +from mixnet.bls import generate_bls +from mixnet.config import ( MixClientConfig, + MixNodeConfig, MixnetConfig, + MixNodeInfo, MixnetTopology, MixnetTopologyConfig, MixnetTopologySize, - MixNodeConfig, - MixNodeInfo, ) -from .utils import random_bytes +from mixnet.utils import random_bytes def with_test_timeout(t):