From c0410bd068962410ad5a2a9a4345d95f7d4824c7 Mon Sep 17 00:00:00 2001 From: Charlie Date: Wed, 21 Aug 2024 17:53:48 +0100 Subject: [PATCH 1/6] chore: bump dependencies --- .env | 2 +- poetry.lock | 99 ++------------------------------------------------ pyproject.toml | 4 +- 3 files changed, 7 insertions(+), 98 deletions(-) diff --git a/.env b/.env index 710a32325..8dfe28bf0 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -VEGA_SIM_VEGA_TAG=0da1f2aba7fa15e8919727484ab728a46d6cf259 +VEGA_SIM_VEGA_TAG=feature/referral-set-improvements VEGA_SIM_CONSOLE_TAG=develop VEGA_DEFAULT_KEY_NAME='Key 1' VEGA_SIM_NETWORKS_INTERNAL_TAG=main diff --git a/poetry.lock b/poetry.lock index 05f9423c1..12590459f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2938,66 +2938,6 @@ files = [ [package.extras] diagrams = ["jinja2", "railroad-diagrams"] -[[package]] -name = "pyqt6" -version = "6.7.0" -description = "Python bindings for the Qt cross platform application toolkit" -optional = false -python-versions = ">=3.8" -files = [ - {file = "PyQt6-6.7.0-cp38-abi3-macosx_10_14_universal2.whl", hash = "sha256:919ffb01020ece42209228bf94b4f2c156a6b77cc5a69a90a05e358b0333750b"}, - {file = "PyQt6-6.7.0-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:e294f025f94493ee12b66efd6893fab309c9063172bb8a5b184f84dfc1ebcc49"}, - {file = "PyQt6-6.7.0-cp38-abi3-win_amd64.whl", hash = "sha256:9d8865fb6357dba032002c4554a9648e88f2b4706c929cc51fba58edafad91fc"}, - {file = "PyQt6-6.7.0.tar.gz", hash = "sha256:3d31b2c59dc378ee26e16586d9469842483588142fc377280aad22aaf2fa6235"}, -] - -[package.dependencies] -PyQt6-Qt6 = ">=6.7.0,<6.8.0" -PyQt6-sip = ">=13.6,<14" - -[[package]] -name = "pyqt6-qt6" -version = "6.7.1" -description = "The subset of a Qt installation needed by PyQt6." -optional = false -python-versions = "*" -files = [ - {file = "PyQt6_Qt6-6.7.1-py3-none-macosx_10_14_x86_64.whl", hash = "sha256:29622b5dd38740b4b6962e0c88d082d08fa10b64542ef5d911b04214aad70150"}, - {file = "PyQt6_Qt6-6.7.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:fbcfe66a57199c6a26542b8b9b2f2ee59d974db36293de335a1251f24c4fe917"}, - {file = "PyQt6_Qt6-6.7.1-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:9fbab2a96d72d77d16021e259ef86a1a3c87adb0e7eebcc92df0d39f3fdf7e27"}, - {file = "PyQt6_Qt6-6.7.1-py3-none-win_amd64.whl", hash = "sha256:590a2f30d15892b5259e6a17ecc0a755675b1b49f553d964e195e90094b44120"}, -] - -[[package]] -name = "pyqt6-sip" -version = "13.6.0" -description = "The sip module support for PyQt6" -optional = false -python-versions = ">=3.7" -files = [ - {file = "PyQt6_sip-13.6.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d6b5f699aaed0ac1fcd23e8fbca70d8a77965831b7c1ce474b81b1678817a49d"}, - {file = "PyQt6_sip-13.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:8c282062125eea5baf830c6998587d98c50be7c3a817a057fb95fef647184012"}, - {file = "PyQt6_sip-13.6.0-cp310-cp310-win32.whl", hash = "sha256:fa759b6339ff7e25f9afe2a6b651b775f0a36bcb3f5fa85e81a90d3b033c83f4"}, - {file = "PyQt6_sip-13.6.0-cp310-cp310-win_amd64.whl", hash = "sha256:8f9df9f7ccd8a9f0f1d36948c686f03ce1a1281543a3e636b7b7d5e086e1a436"}, - {file = "PyQt6_sip-13.6.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5b9c6b6f9cfccb48cbb78a59603145a698fb4ffd176764d7083e5bf47631d8df"}, - {file = "PyQt6_sip-13.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:86a7b67c64436e32bffa9c28c9f21bf14a9faa54991520b12c3f6f435f24df7f"}, - {file = "PyQt6_sip-13.6.0-cp311-cp311-win32.whl", hash = "sha256:58f68a48400e0b3d1ccb18090090299bad26e3aed7ccb7057c65887b79b8aeea"}, - {file = "PyQt6_sip-13.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:0dfd22cfedd87e96f9d51e0778ca2ba3dc0be83e424e9e0f98f6994d8d9c90f0"}, - {file = "PyQt6_sip-13.6.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:3bf03e130fbfd75c9c06e687b86ba375410c7a9e835e4e03285889e61dd4b0c4"}, - {file = "PyQt6_sip-13.6.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:43fb8551796030aae3d66d6e35e277494071ec6172cd182c9569ab7db268a2f5"}, - {file = "PyQt6_sip-13.6.0-cp312-cp312-win32.whl", hash = "sha256:13885361ca2cb2f5085d50359ba61b3fabd41b139fb58f37332acbe631ef2357"}, - {file = "PyQt6_sip-13.6.0-cp312-cp312-win_amd64.whl", hash = "sha256:24441032a29791e82beb7dfd76878339058def0e97fdb7c1cea517f3a0e6e96b"}, - {file = "PyQt6_sip-13.6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3075d8b325382750829e6cde6971c943352309d35768a4d4da0587459606d562"}, - {file = "PyQt6_sip-13.6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:a6ce80bc24618d8a41be8ca51ad9f10e8bc4296dd90ab2809573df30a23ae0e5"}, - {file = "PyQt6_sip-13.6.0-cp38-cp38-win32.whl", hash = "sha256:fa7b10af7488efc5e53b41dd42c0f421bde6c2865a107af7ae259aff9d841da9"}, - {file = "PyQt6_sip-13.6.0-cp38-cp38-win_amd64.whl", hash = "sha256:9adf672f9114687533a74d5c2d4c03a9a929ad5ad9c3e88098a7da1a440ab916"}, - {file = "PyQt6_sip-13.6.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:98bf954103b087162fa63b3a78f30b0b63da22fd6450b610ec1b851dbb798228"}, - {file = "PyQt6_sip-13.6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:39854dba35f8e5a4288da26ecb5f40b4c5ec1932efffb3f49d5ea435a7f37fb3"}, - {file = "PyQt6_sip-13.6.0-cp39-cp39-win32.whl", hash = "sha256:747f6ca44af81777a2c696bd501bc4815a53ec6fc94d4e25830e10bc1391f8ab"}, - {file = "PyQt6_sip-13.6.0-cp39-cp39-win_amd64.whl", hash = "sha256:33ea771fe777eb0d1a2c3ef35bcc3f7a286eb3ff09cd5b2fdd3d87d1f392d7e8"}, - {file = "PyQt6_sip-13.6.0.tar.gz", hash = "sha256:2486e1588071943d4f6657ba09096dc9fffd2322ad2c30041e78ea3f037b5778"}, -] - [[package]] name = "pytest" version = "7.4.4" @@ -3151,7 +3091,7 @@ files = [ name = "pyyaml" version = "6.0.1" description = "YAML parser and emitter for Python" -optional = false +optional = true python-versions = ">=3.6" files = [ {file = "PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a"}, @@ -4105,39 +4045,8 @@ pytest = "*" [package.source] type = "git" url = "https://github.com/vegaprotocol/vega-python-protos" -reference = "develop" -resolved_reference = "9036fceba570eb9430cf71c24fd250acea91b352" - -[[package]] -name = "vegapy" -version = "0.1.0" -description = "" -optional = false -python-versions = "^3.9,<3.12" -files = [] -develop = false - -[package.dependencies] -black = "^24.2.0" -grpcio = "^1.59.3" -grpcio-tools = "^1.59.3" -jinja2 = "^3.1.2" -matplotlib = "^3.8.2" -pandas = "^2.1.4" -protobuf = "^4.25.1" -protoc-gen-openapiv2 = "^0.0.1" -pyqt6 = "^6.6.1" -pytest = "^7.4.3" -pyyaml = "^6.0.1" -requests = "^2.31.0" -toml = "^0.10.2" -vega_python_protos = {git = "https://github.com/vegaprotocol/vega-python-protos", branch = "develop"} - -[package.source] -type = "git" -url = "https://github.com/cdummett/vegapy/" -reference = "develop" -resolved_reference = "3251c1d5f632ccecab44e8fa97f9b543ec5eee88" +reference = "feat/set-proto-updates" +resolved_reference = "804e5240d2a857108f9517f573d41990bb294341" [[package]] name = "wcwidth" @@ -4308,4 +4217,4 @@ profile = ["pytest-profiling", "snakeviz"] [metadata] lock-version = "2.0" python-versions = "^3.10,<3.12" -content-hash = "c8916c7da7651d11416c6b355547bcd4e0a50d937a1af26707cfbf96c2e3f146" +content-hash = "d7b84f162dc00bf4f5e8c8211559aa9abd6337036435397f21cde202eab01f5b" diff --git a/pyproject.toml b/pyproject.toml index 75bc5b1b4..922c5a781 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ pettingzoo = {version = "*", optional = true} numba = {version = "^0.57.1", optional = true} tianshou = {version = "*", optional = true} protofuzz = { git = "https://github.com/trailofbits/protofuzz", branch="master" } -vega_python_protos = {git = "https://github.com/vegaprotocol/vega-python-protos", branch="develop" } +vega_python_protos = {git = "https://github.com/vegaprotocol/vega-python-protos", branch="feat/set-proto-updates" } [tool.poetry.group.dev.dependencies] black = "*" @@ -53,7 +53,7 @@ Jinja2 = "*" nbmake = "*" matplotlib = "*" pytest-xdist = "*" -vegapy = {git = "https://github.com/cdummett/vegapy/", branch="develop"} +# vegapy = {git = "https://github.com/cdummett/vegapy/", branch="develop"} [build-system] From 9ee0a4a49054726004a4cc2b47b396d6da550d57 Mon Sep 17 00:00:00 2001 From: Charlie Date: Wed, 21 Aug 2024 17:54:04 +0100 Subject: [PATCH 2/6] feat: update methods --- vega_sim/api/trading.py | 9 ++++++++- vega_sim/service.py | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/vega_sim/api/trading.py b/vega_sim/api/trading.py index fd1f5751f..534271928 100644 --- a/vega_sim/api/trading.py +++ b/vega_sim/api/trading.py @@ -712,6 +712,7 @@ def create_referral_set( avatar_url: Optional[str] = None, closed: Optional[bool] = None, wallet_name: Optional[str] = None, + do_not_create_referral_set: bool = False, ): if any(arg is not None for arg in [name, team_url, avatar_url, closed]): is_team = True @@ -719,6 +720,7 @@ def create_referral_set( is_team = False command = vega_protos.commands.v1.commands.CreateReferralSet( is_team=is_team, + do_not_create_referral_set=do_not_create_referral_set, ) if is_team: if (name is None) or (closed is None): @@ -777,10 +779,15 @@ def update_referral_set( def apply_referral_code( - wallet: Wallet, key_name: str, id: str, wallet_name: Optional[str] = None + wallet: Wallet, + key_name: str, + id: str, + wallet_name: Optional[str] = None, + do_not_join_team: bool = False, ): command = vega_protos.commands.v1.commands.ApplyReferralCode( id=id, + do_not_join_team=do_not_join_team, ) wallet.submit_transaction( transaction=command, diff --git a/vega_sim/service.py b/vega_sim/service.py index 183c25176..33b8a66b6 100644 --- a/vega_sim/service.py +++ b/vega_sim/service.py @@ -3523,6 +3523,7 @@ def create_referral_set( avatar_url: Optional[str] = None, closed: Optional[bool] = None, wallet_name: Optional[str] = None, + do_not_create_referral_set: bool = False, ): trading.create_referral_set( wallet=self.wallet, @@ -3532,6 +3533,7 @@ def create_referral_set( team_url=team_url, avatar_url=avatar_url, closed=closed, + do_not_create_referral_set=do_not_create_referral_set, ) def update_referral_set( @@ -3554,10 +3556,18 @@ def update_referral_set( ) def apply_referral_code( - self, key_name: str, id: str, wallet_name: Optional[str] = None + self, + key_name: str, + id: str, + wallet_name: Optional[str] = None, + do_not_join_team: bool = False, ): trading.apply_referral_code( - wallet=self.wallet, key_name=key_name, id=id, wallet_name=wallet_name + wallet=self.wallet, + key_name=key_name, + id=id, + wallet_name=wallet_name, + do_not_join_team=do_not_join_team, ) def list_referral_sets( From 95e51c6d24e71f0c8ad88782a74b1c839546fe7b Mon Sep 17 00:00:00 2001 From: Charlie Date: Wed, 21 Aug 2024 17:54:10 +0100 Subject: [PATCH 3/6] feat: update tests --- tests/integration/test_sets.py | 309 +++++++++++++++++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 tests/integration/test_sets.py diff --git a/tests/integration/test_sets.py b/tests/integration/test_sets.py new file mode 100644 index 000000000..0be543017 --- /dev/null +++ b/tests/integration/test_sets.py @@ -0,0 +1,309 @@ +""" +Test Cases + +- a party can create a referral set without creating a team +- a party can create a team without creating a referral set +- a party can create a referral set and create a team + +- a party who has applied a referral code, but could not join a team + - cannot create their own referral set + - can create their own team + +- a party who has applied a referral code, and joined the team + - cannot create their own referral set + - can create their own team + +- a party who has applied a referral code, and optionally not joined the team + - cannot create their own referral set + - can create their own team +""" + +import pytest + +from vega_sim.null_service import VegaServiceNull +from tests.integration.utils.fixtures import ( + vega_service, +) + + +PARTY_A = "a" +PARTY_B = "b" +PARTY_C = "c" + + +def next_epoch(vega: VegaServiceNull): + forwards = 0 + epoch_seq = vega.statistics().epoch_seq + while epoch_seq == vega.statistics().epoch_seq: + vega.wait_fn(1) + forwards += 1 + if forwards > 2 * 10 * 60: + raise Exception( + "Epoch not started after forwarding the duration of two epochs." + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + + +@pytest.mark.integration +def test_party_can_create_a_referral_set_without_creating_a_team( + vega_service: VegaServiceNull, +): + vega = vega_service + vega.create_key(PARTY_A) + vega.wait_fn(1) + vega.wait_for_total_catchup() + vega.create_referral_set( + PARTY_A, + do_not_create_referral_set=False, + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + teams = vega.list_teams() + assert len(sets) == 1 + assert len(teams) == 0 + assert list(sets.values())[0].referrer == vega.wallet.public_key(PARTY_A) + + +@pytest.mark.integration +def test_party_can_create_a_team_without_creating_a_referral_set( + vega_service: VegaServiceNull, +): + vega = vega_service + vega.create_key(PARTY_A) + vega.wait_fn(1) + vega.wait_for_total_catchup() + vega.create_referral_set( + PARTY_A, + do_not_create_referral_set=True, + name="team_a", + team_url="url_a", + avatar_url="avatar_a", + closed=False, + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + teams = vega.list_teams() + assert len(sets) == 0 + assert len(teams) == 1 + assert list(teams.values())[0].referrer == vega.wallet.public_key(PARTY_A) + + +@pytest.mark.integration +def test_party_can_create_a_referral_set_and_create_a_team( + vega_service: VegaServiceNull, +): + vega = vega_service + vega.create_key(PARTY_A) + vega.wait_fn(1) + vega.wait_for_total_catchup() + vega.create_referral_set( + PARTY_A, + do_not_create_referral_set=False, + name="team_a", + team_url="url_a", + avatar_url="avatar_a", + closed=False, + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + teams = vega.list_teams() + assert len(sets) == 1 + assert len(teams) == 1 + assert list(sets.values())[0].referrer == vega.wallet.public_key(PARTY_A) + assert list(teams.values())[0].referrer == vega.wallet.public_key(PARTY_A) + + +@pytest.mark.integration +def test_party_who_applied_referral_code_and_who_could_not_join_team( + vega_service: VegaServiceNull, +): + vega = vega_service + + vega.create_key(PARTY_A) + vega.create_key(PARTY_B) + + vega.create_referral_set(PARTY_A) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + teams = vega.list_teams() + assert len(sets) == 1 + assert len(teams) == 0 + set_a_id = list(sets.keys())[0] + + vega.apply_referral_code(PARTY_B, set_a_id) + vega.wait_fn(1) + vega.wait_for_total_catchup() + set_a_referees = vega.list_referral_set_referees(referral_set_id=set_a_id) + assert vega.wallet.public_key(PARTY_B) in [ + referee.referee for referee in set_a_referees[set_a_id].values() + ] + + # Party B cannot create their own referral set + vega.create_referral_set(PARTY_B) + vega.wait_fn(1) + sets = vega.list_referral_sets() + assert len(vega.list_referral_sets()) == 1 + assert all( + [set.referrer != vega.wallet.public_key(PARTY_B) for set in sets.values()] + ) + + # Party B can create their own team + vega.create_referral_set( + PARTY_B, + do_not_create_referral_set=True, + name="team_b", + team_url="url_b", + avatar_url="avatar_b", + closed=False, + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + assert len(vega.list_referral_sets()) == 1 + assert all( + [set.referrer != vega.wallet.public_key(PARTY_B) for set in sets.values()] + ) + teams = vega.list_teams() + assert len(teams) == 1 + assert any( + [team.referrer == vega.wallet.public_key(PARTY_B) for team in teams.values()] + ) + + +@pytest.mark.integration +def test_party_who_applied_referral_code_and_who_joined_the_team( + vega_service: VegaServiceNull, +): + vega = vega_service + + vega.create_key(PARTY_A) + vega.create_key(PARTY_B) + + vega.create_referral_set( + PARTY_A, name="team_a", team_url="url_a", avatar_url="avatar_a", closed=False + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + teams = vega.list_teams() + assert len(sets) == 1 + assert len(teams) == 1 + set_a_id = list(sets.keys())[0] + team_a_id = list(teams.keys())[0] + + vega.apply_referral_code(PARTY_B, set_a_id) + vega.wait_fn(1) + vega.wait_for_total_catchup() + set_a_referees = vega.list_referral_set_referees(referral_set_id=set_a_id) + team_a_members = vega.list_team_referees(team_id=team_a_id) + assert vega.wallet.public_key(PARTY_B) in [ + referee.referee for referee in set_a_referees[set_a_id].values() + ] + assert vega.wallet.public_key(PARTY_B) in [ + member.referee for member in team_a_members + ] + + # Party B cannot create their own referral set + vega.create_referral_set(PARTY_B) + vega.wait_fn(1) + sets = vega.list_referral_sets() + assert len(vega.list_referral_sets()) == 1 + assert all( + [set.referrer != vega.wallet.public_key(PARTY_B) for set in sets.values()] + ) + + # Party B can create their own team + vega.create_referral_set( + PARTY_B, + do_not_create_referral_set=True, + name="team_b", + team_url="url_b", + avatar_url="avatar_b", + closed=False, + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + assert len(vega.list_referral_sets()) == 1 + assert all( + [set.referrer != vega.wallet.public_key(PARTY_B) for set in sets.values()] + ) + teams = vega.list_teams() + assert len(teams) == 1 + next_epoch(vega) + teams = vega.list_teams() + vega.wait_for_total_catchup() + assert len(teams) == 2 + assert any( + [team.referrer == vega.wallet.public_key(PARTY_B) for team in teams.values()] + ) + + +@pytest.mark.integration +def test_party_who_applied_referral_code_and_who_optionally_did_not_join_the_team( + vega_service: VegaServiceNull, +): + vega = vega_service + + vega.create_key(PARTY_A) + vega.create_key(PARTY_B) + + vega.create_referral_set( + PARTY_A, name="team_a", team_url="url_a", avatar_url="avatar_a", closed=False + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + teams = vega.list_teams() + assert len(sets) == 1 + assert len(teams) == 1 + set_a_id = list(sets.keys())[0] + team_a_id = list(teams.keys())[0] + + vega.apply_referral_code(PARTY_B, set_a_id, do_not_join_team=True) + vega.wait_fn(1) + vega.wait_for_total_catchup() + set_a_referees = vega.list_referral_set_referees(referral_set_id=set_a_id) + team_a_members = vega.list_team_referees(team_id=team_a_id) + assert vega.wallet.public_key(PARTY_B) in [ + referee.referee for referee in set_a_referees[set_a_id].values() + ] + assert vega.wallet.public_key(PARTY_B) not in [ + member.referee for member in team_a_members + ] + + # Party B cannot create their own referral set + vega.create_referral_set(PARTY_B) + vega.wait_fn(1) + sets = vega.list_referral_sets() + assert len(vega.list_referral_sets()) == 1 + assert all( + [set.referrer != vega.wallet.public_key(PARTY_B) for set in sets.values()] + ) + + # Party B can create their own team + vega.create_referral_set( + PARTY_B, + do_not_create_referral_set=True, + name="team_b", + team_url="url_b", + avatar_url="avatar_b", + closed=False, + ) + vega.wait_fn(1) + vega.wait_for_total_catchup() + sets = vega.list_referral_sets() + assert len(vega.list_referral_sets()) == 1 + assert all( + [set.referrer != vega.wallet.public_key(PARTY_B) for set in sets.values()] + ) + teams = vega.list_teams() + assert len(teams) == 2 + assert any( + [team.referrer == vega.wallet.public_key(PARTY_B) for team in teams.values()] + ) From 5223709289ec94039103e97df07d4c3de3c5d249 Mon Sep 17 00:00:00 2001 From: Charlie Date: Fri, 23 Aug 2024 14:08:57 +0100 Subject: [PATCH 4/6] chore: bump dependencies --- .env | 2 +- Jenkinsfile | 2 +- poetry.lock | 103 +++++++++++++++++++++++++++++++++++++++++++++++-- pyproject.toml | 4 +- 4 files changed, 103 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 8dfe28bf0..e3c5ba3b8 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -VEGA_SIM_VEGA_TAG=feature/referral-set-improvements +VEGA_SIM_VEGA_TAG=v0.78.0-preview.4 VEGA_SIM_CONSOLE_TAG=develop VEGA_DEFAULT_KEY_NAME='Key 1' VEGA_SIM_NETWORKS_INTERNAL_TAG=main diff --git a/Jenkinsfile b/Jenkinsfile index d2965513e..5a0ca8dca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { disableConcurrentBuilds(abortPrevious: true) } parameters { - string( name: 'VEGA_VERSION', defaultValue: '0da1f2aba7fa15e8919727484ab728a46d6cf259', + string( name: 'VEGA_VERSION', defaultValue: 'v0.78.0-preview.4', description: 'Git branch, tag or hash of the vegaprotocol/vega repository') string( name: 'VEGACAPSULE_VERSION', defaultValue: 'main', description: 'Git branch, tag or hash of the vegaprotocol/vegacapsule repository') diff --git a/poetry.lock b/poetry.lock index 12590459f..106e5554f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2938,6 +2938,70 @@ files = [ [package.extras] diagrams = ["jinja2", "railroad-diagrams"] +[[package]] +name = "pyqt6" +version = "6.7.1" +description = "Python bindings for the Qt cross platform application toolkit" +optional = false +python-versions = ">=3.8" +files = [ + {file = "PyQt6-6.7.1-1-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:7f397f4b38b23b5588eb2c0933510deb953d96b1f0323a916c4839c2a66ccccc"}, + {file = "PyQt6-6.7.1-1-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:c2f202b7941aa74e5c7e1463a6f27d9131dbc1e6cabe85571d7364f5b3de7397"}, + {file = "PyQt6-6.7.1-cp38-abi3-macosx_11_0_universal2.whl", hash = "sha256:f053378e3aef6248fa612c8afddda17f942fb63f9fe8a9aeb2a6b6b4cbb0eba9"}, + {file = "PyQt6-6.7.1-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:0adb7914c732ad1dee46d9cec838a98cb2b11bc38cc3b7b36fbd8701ae64bf47"}, + {file = "PyQt6-6.7.1-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:2d771fa0981514cb1ee937633dfa64f14caa902707d9afffab66677f3a73e3da"}, + {file = "PyQt6-6.7.1-cp38-abi3-win_amd64.whl", hash = "sha256:fa3954698233fe286a8afc477b84d8517f0788eb46b74da69d3ccc0170d3714c"}, + {file = "PyQt6-6.7.1.tar.gz", hash = "sha256:3672a82ccd3a62e99ab200a13903421e2928e399fda25ced98d140313ad59cb9"}, +] + +[package.dependencies] +PyQt6-Qt6 = ">=6.7.0,<6.8.0" +PyQt6-sip = ">=13.8,<14" + +[[package]] +name = "pyqt6-qt6" +version = "6.7.2" +description = "The subset of a Qt installation needed by PyQt6." +optional = false +python-versions = "*" +files = [ + {file = "PyQt6_Qt6-6.7.2-py3-none-macosx_10_14_x86_64.whl", hash = "sha256:065415589219a2f364aba29d6a98920bb32810286301acbfa157e522d30369e3"}, + {file = "PyQt6_Qt6-6.7.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7f817efa86a0e8eda9152c85b73405463fbf3266299090f32bbb2266da540ead"}, + {file = "PyQt6_Qt6-6.7.2-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:05f2c7d195d316d9e678a92ecac0252a24ed175bd2444cc6077441807d756580"}, + {file = "PyQt6_Qt6-6.7.2-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:fc93945eaef4536d68bd53566535efcbe78a7c05c2a533790a8fd022bac8bfaa"}, + {file = "PyQt6_Qt6-6.7.2-py3-none-win_amd64.whl", hash = "sha256:b2d7e5ddb1b9764cd60f1d730fa7bf7a1f0f61b2630967c81761d3d0a5a8a2e0"}, +] + +[[package]] +name = "pyqt6-sip" +version = "13.8.0" +description = "The sip module support for PyQt6" +optional = false +python-versions = ">=3.8" +files = [ + {file = "PyQt6_sip-13.8.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cedd554c643e54c4c2e12b5874781a87441a1b405acf3650a4a2e1df42aae231"}, + {file = "PyQt6_sip-13.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f57275b5af774529f9838adcfb58869ba3ebdaf805daea113bb0697a96a3f3cb"}, + {file = "PyQt6_sip-13.8.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:835ed22eab977f75fd77e60d4ff308a1fa794b1d0c04849311f36d2a080cdf3b"}, + {file = "PyQt6_sip-13.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d8b22a6850917c68ce83fc152a8b606ecb2efaaeed35be53110468885d6cdd9d"}, + {file = "PyQt6_sip-13.8.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:b203b6fbae4a8f2d27f35b7df46200057033d9ecd9134bcf30e3eab66d43572c"}, + {file = "PyQt6_sip-13.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:beaddc1ec96b342f4e239702f91802706a80cb403166c2da318cec4ad8b790cb"}, + {file = "PyQt6_sip-13.8.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:a5c086b7c9c7996ea9b7522646cc24eebbf3591ec9dd38f65c0a3fdb0dbeaac7"}, + {file = "PyQt6_sip-13.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:dd168667addf01f8a4b0fa7755323e43e4cd12ca4bade558c61f713a5d48ba1a"}, + {file = "PyQt6_sip-13.8.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:33d9b399fc9c9dc99496266842b0fb2735d924604774e97cf9b555667cc0fc59"}, + {file = "PyQt6_sip-13.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:056af69d1d8d28d5968066ec5da908afd82fc0be07b67cf2b84b9f02228416ce"}, + {file = "PyQt6_sip-13.8.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:08dd81037a2864982ece2bf9891f3bf4558e247034e112993ea1a3fe239458cb"}, + {file = "PyQt6_sip-13.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:fbb249b82c53180f1420571ece5dc24fea1188ba435923edd055599dffe7abfb"}, + {file = "PyQt6_sip-13.8.0-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:6bce6bc5870d9e87efe5338b1ee4a7b9d7d26cdd16a79a5757d80b6f25e71edc"}, + {file = "PyQt6_sip-13.8.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd81144b0770084e8005d3a121c9382e6f9bc8d0bb320dd618718ffe5090e0e6"}, + {file = "PyQt6_sip-13.8.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:755beb5d271d081e56618fb30342cdd901464f721450495cb7cb0212764da89e"}, + {file = "PyQt6_sip-13.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:7a0bbc0918eab5b6351735d40cf22cbfa5aa2476b55e0d5fe881aeed7d871c29"}, + {file = "PyQt6_sip-13.8.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7f84c472afdc7d316ff683f63129350d645ef82d9b3fd75a609b08472d1f7291"}, + {file = "PyQt6_sip-13.8.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b1bf29e95f10a8a00819dac804ca7e5eba5fc1769adcd74c837c11477bf81954"}, + {file = "PyQt6_sip-13.8.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:9ea9223c94906efd68148f12ae45b51a21d67e86704225ddc92bce9c54e4d93c"}, + {file = "PyQt6_sip-13.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:2559afa68825d08de09d71c42f3b6ad839dcc30f91e7c6d0785e07830d5541a5"}, + {file = "PyQt6_sip-13.8.0.tar.gz", hash = "sha256:2f74cf3d6d9cab5152bd9f49d570b2dfb87553ebb5c4919abfde27f5b9fd69d4"}, +] + [[package]] name = "pytest" version = "7.4.4" @@ -3091,7 +3155,7 @@ files = [ name = "pyyaml" version = "6.0.1" description = "YAML parser and emitter for Python" -optional = true +optional = false python-versions = ">=3.6" files = [ {file = "PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a"}, @@ -4045,8 +4109,39 @@ pytest = "*" [package.source] type = "git" url = "https://github.com/vegaprotocol/vega-python-protos" -reference = "feat/set-proto-updates" -resolved_reference = "804e5240d2a857108f9517f573d41990bb294341" +reference = "develop" +resolved_reference = "19ccb1c97e5f1d7f2676e89fbb7a814d6172f311" + +[[package]] +name = "vegapy" +version = "0.1.0" +description = "" +optional = false +python-versions = "^3.9,<3.12" +files = [] +develop = false + +[package.dependencies] +black = "^24.2.0" +grpcio = "^1.59.3" +grpcio-tools = "^1.59.3" +jinja2 = "^3.1.2" +matplotlib = "^3.8.2" +pandas = "^2.1.4" +protobuf = "^4.25.1" +protoc-gen-openapiv2 = "^0.0.1" +pyqt6 = "^6.6.1" +pytest = "^7.4.3" +pyyaml = "^6.0.1" +requests = "^2.31.0" +toml = "^0.10.2" +vega_python_protos = {git = "https://github.com/vegaprotocol/vega-python-protos", branch = "develop"} + +[package.source] +type = "git" +url = "https://github.com/cdummett/vegapy/" +reference = "develop" +resolved_reference = "048a05e186aa33afa881298031e8fe58a9289559" [[package]] name = "wcwidth" @@ -4217,4 +4312,4 @@ profile = ["pytest-profiling", "snakeviz"] [metadata] lock-version = "2.0" python-versions = "^3.10,<3.12" -content-hash = "d7b84f162dc00bf4f5e8c8211559aa9abd6337036435397f21cde202eab01f5b" +content-hash = "c8916c7da7651d11416c6b355547bcd4e0a50d937a1af26707cfbf96c2e3f146" diff --git a/pyproject.toml b/pyproject.toml index 922c5a781..75bc5b1b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ pettingzoo = {version = "*", optional = true} numba = {version = "^0.57.1", optional = true} tianshou = {version = "*", optional = true} protofuzz = { git = "https://github.com/trailofbits/protofuzz", branch="master" } -vega_python_protos = {git = "https://github.com/vegaprotocol/vega-python-protos", branch="feat/set-proto-updates" } +vega_python_protos = {git = "https://github.com/vegaprotocol/vega-python-protos", branch="develop" } [tool.poetry.group.dev.dependencies] black = "*" @@ -53,7 +53,7 @@ Jinja2 = "*" nbmake = "*" matplotlib = "*" pytest-xdist = "*" -# vegapy = {git = "https://github.com/cdummett/vegapy/", branch="develop"} +vegapy = {git = "https://github.com/cdummett/vegapy/", branch="develop"} [build-system] From d906ab0cf3ad381034b21be4a3f3342d0a112f4c Mon Sep 17 00:00:00 2001 From: Charlie Date: Fri, 23 Aug 2024 14:09:10 +0100 Subject: [PATCH 5/6] fix: update tests --- tests/integration/test_sets.py | 8 -------- vega_sim/service.py | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/integration/test_sets.py b/tests/integration/test_sets.py index 0be543017..d0a74b745 100644 --- a/tests/integration/test_sets.py +++ b/tests/integration/test_sets.py @@ -229,15 +229,7 @@ def test_party_who_applied_referral_code_and_who_joined_the_team( vega.wait_fn(1) vega.wait_for_total_catchup() sets = vega.list_referral_sets() - assert len(vega.list_referral_sets()) == 1 - assert all( - [set.referrer != vega.wallet.public_key(PARTY_B) for set in sets.values()] - ) teams = vega.list_teams() - assert len(teams) == 1 - next_epoch(vega) - teams = vega.list_teams() - vega.wait_for_total_catchup() assert len(teams) == 2 assert any( [team.referrer == vega.wallet.public_key(PARTY_B) for team in teams.values()] diff --git a/vega_sim/service.py b/vega_sim/service.py index 33b8a66b6..9f3e97ac6 100644 --- a/vega_sim/service.py +++ b/vega_sim/service.py @@ -3570,6 +3570,14 @@ def apply_referral_code( do_not_join_team=do_not_join_team, ) + def join_team(self, key_name: str, id: str, wallet_name: Optional[str] = None): + self.wallet.submit_transaction( + transaction=vega_protos.commands.v1.commands.JoinTeam(id=id), + key_name=key_name, + transaction_type="join_team", + wallet_name=wallet_name, + ) + def list_referral_sets( self, referral_set_id: Optional[str] = None, From 0616a8a8197d69e7dc33b2144cba6276b3011d7e Mon Sep 17 00:00:00 2001 From: Charlie Date: Fri, 23 Aug 2024 14:12:25 +0100 Subject: [PATCH 6/6] chore: update requirements --- requirements-dev.txt | 10 +++++----- requirements-learning.txt | 10 +++++----- requirements.txt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 795a2ce1f..131931bf3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -67,9 +67,9 @@ pyflakes==3.2.0 ; python_version >= "3.10" and python_version < "3.12" pygments==2.18.0 ; python_version >= "3.10" and python_version < "3.12" pynacl==1.5.0 ; python_version >= "3.10" and python_version < "3.12" pyparsing==3.1.2 ; python_version >= "3.10" and python_version < "3.12" -pyqt6-qt6==6.7.1 ; python_version >= "3.10" and python_version < "3.12" -pyqt6-sip==13.6.0 ; python_version >= "3.10" and python_version < "3.12" -pyqt6==6.7.0 ; python_version >= "3.10" and python_version < "3.12" +pyqt6-qt6==6.7.2 ; python_version >= "3.10" and python_version < "3.12" +pyqt6-sip==13.8.0 ; python_version >= "3.10" and python_version < "3.12" +pyqt6==6.7.1 ; python_version >= "3.10" and python_version < "3.12" pytest-xdist==3.6.1 ; python_version >= "3.10" and python_version < "3.12" pytest==7.4.4 ; python_version >= "3.10" and python_version < "3.12" python-dateutil==2.9.0.post0 ; python_version >= "3.10" and python_version < "3.12" @@ -94,8 +94,8 @@ traitlets==5.14.3 ; python_version >= "3.10" and python_version < "3.12" typing-extensions==4.12.2 ; python_version >= "3.10" and python_version < "3.12" tzdata==2024.1 ; python_version >= "3.10" and python_version < "3.12" urllib3==2.2.1 ; python_version >= "3.10" and python_version < "3.12" -vega-python-protos @ git+https://github.com/vegaprotocol/vega-python-protos@63bfaf1a33c2ac8ef8abff837df19dd7c09289ef ; python_version >= "3.10" and python_version < "3.12" -vegapy @ git+https://github.com/cdummett/vegapy/@0b85f479ea99736e317d93415901a36a9e4f5bab ; python_version >= "3.10" and python_version < "3.12" +vega-python-protos @ git+https://github.com/vegaprotocol/vega-python-protos@19ccb1c97e5f1d7f2676e89fbb7a814d6172f311 ; python_version >= "3.10" and python_version < "3.12" +vegapy @ git+https://github.com/cdummett/vegapy/@048a05e186aa33afa881298031e8fe58a9289559 ; python_version >= "3.10" and python_version < "3.12" wcwidth==0.2.13 ; python_version >= "3.10" and python_version < "3.12" websocket-client==1.8.0 ; python_version >= "3.10" and python_version < "3.12" wrapt==1.16.0 ; python_version >= "3.10" and python_version < "3.12" diff --git a/requirements-learning.txt b/requirements-learning.txt index a633b11e0..94381702c 100644 --- a/requirements-learning.txt +++ b/requirements-learning.txt @@ -94,9 +94,9 @@ pyflakes==3.2.0 ; python_version >= "3.10" and python_version < "3.12" pygments==2.18.0 ; python_version >= "3.10" and python_version < "3.12" pynacl==1.5.0 ; python_version >= "3.10" and python_version < "3.12" pyparsing==3.1.2 ; python_version >= "3.10" and python_version < "3.12" -pyqt6-qt6==6.7.1 ; python_version >= "3.10" and python_version < "3.12" -pyqt6-sip==13.6.0 ; python_version >= "3.10" and python_version < "3.12" -pyqt6==6.7.0 ; python_version >= "3.10" and python_version < "3.12" +pyqt6-qt6==6.7.2 ; python_version >= "3.10" and python_version < "3.12" +pyqt6-sip==13.8.0 ; python_version >= "3.10" and python_version < "3.12" +pyqt6==6.7.1 ; python_version >= "3.10" and python_version < "3.12" pytest-xdist==3.6.1 ; python_version >= "3.10" and python_version < "3.12" pytest==7.4.4 ; python_version >= "3.10" and python_version < "3.12" python-dateutil==2.9.0.post0 ; python_version >= "3.10" and python_version < "3.12" @@ -130,8 +130,8 @@ triton==2.3.1 ; platform_system == "Linux" and platform_machine == "x86_64" and typing-extensions==4.12.2 ; python_version >= "3.10" and python_version < "3.12" tzdata==2024.1 ; python_version >= "3.10" and python_version < "3.12" urllib3==2.2.1 ; python_version >= "3.10" and python_version < "3.12" -vega-python-protos @ git+https://github.com/vegaprotocol/vega-python-protos@63bfaf1a33c2ac8ef8abff837df19dd7c09289ef ; python_version >= "3.10" and python_version < "3.12" -vegapy @ git+https://github.com/cdummett/vegapy/@0b85f479ea99736e317d93415901a36a9e4f5bab ; python_version >= "3.10" and python_version < "3.12" +vega-python-protos @ git+https://github.com/vegaprotocol/vega-python-protos@19ccb1c97e5f1d7f2676e89fbb7a814d6172f311 ; python_version >= "3.10" and python_version < "3.12" +vegapy @ git+https://github.com/cdummett/vegapy/@048a05e186aa33afa881298031e8fe58a9289559 ; python_version >= "3.10" and python_version < "3.12" wcwidth==0.2.13 ; python_version >= "3.10" and python_version < "3.12" websocket-client==1.8.0 ; python_version >= "3.10" and python_version < "3.12" werkzeug==3.0.3 ; python_version >= "3.10" and python_version < "3.12" diff --git a/requirements.txt b/requirements.txt index 36a2403ea..2910ff817 100644 --- a/requirements.txt +++ b/requirements.txt @@ -51,6 +51,6 @@ tomli==2.0.1 ; python_version >= "3.10" and python_version < "3.11" typing-extensions==4.12.2 ; python_version >= "3.10" and python_version < "3.11" tzdata==2024.1 ; python_version >= "3.10" and python_version < "3.12" urllib3==2.2.1 ; python_version >= "3.10" and python_version < "3.12" -vega-python-protos @ git+https://github.com/vegaprotocol/vega-python-protos@63bfaf1a33c2ac8ef8abff837df19dd7c09289ef ; python_version >= "3.10" and python_version < "3.12" +vega-python-protos @ git+https://github.com/vegaprotocol/vega-python-protos@19ccb1c97e5f1d7f2676e89fbb7a814d6172f311 ; python_version >= "3.10" and python_version < "3.12" websocket-client==1.8.0 ; python_version >= "3.10" and python_version < "3.12" wrapt==1.16.0 ; python_version >= "3.10" and python_version < "3.12"