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

Non-ascii clan name can cause tmm match to fail #721

Closed
Askaholic opened this issue Feb 18, 2021 · 1 comment · Fixed by #722
Closed

Non-ascii clan name can cause tmm match to fail #721

Askaholic opened this issue Feb 18, 2021 · 1 comment · Fixed by #722
Assignees
Labels

Comments

@Askaholic
Copy link
Collaborator

If both players on a team are members of a clan with non-ascii characters in the clan tag, then the game name that gets created will contain non-ascii characters and will be rejected, causing the match to be cancelled.

INFO     Feb 18  21:03:23 Search                         Matched Search(tmm_2v2, [Player(Shinobu, 44898, (2231.63, 96.4996)), Player(FtXCommando, 62213, (2022.73, 121.69))], threshold=0.68, expansion=0.05) with Search(tmm_2v2, [Player(TURBO2, 89695, (2353.8778029868736, 109.35106982969995)), Player(Espeperant, 189718, (2116.247376374932, 88.8876522634832))], threshold=0.74, expansion=0.0)
INFO     Feb 18  21:03:23 Search                         Matched Search(tmm_2v2, [Player(TURBO2, 89695, (2353.8778029868736, 109.35106982969995)), Player(Espeperant, 189718, (2116.247376374932, 88.8876522634832))], threshold=0.74, expansion=0.0) with Search(tmm_2v2, [Player(Shinobu, 44898, (2231.63, 96.4996)), Player(FtXCommando, 62213, (2022.73, 121.69))], threshold=0.68, expansion=0.05)
INFO     Feb 18  21:03:23 PopTimer                       Next tmm2v2 wave happening in 179s
ERROR    Feb 18  21:03:23 LadderService                  Failed to start ladder game!
Traceback (most recent call last):
  File "/code/server/ladder_service.py", line 379, in start_game
    max_players=len(all_players)
  File "/code/server/game_service.py", line 166, in create_game
    game = game_class(**game_args)
  File "/code/server/games/ladder_game.py", line 28, in __init__
    super().__init__(id_, *args, **new_kwargs)
  File "/code/server/games/game.py", line 84, in __init__
    self.name = name
  File "/code/server/games/game.py", line 141, in name
    raise ValueError("Name must be ascii!")
ValueError: Name must be ascii!

Ftx and Shinobu are both in a clan with the tag J¢p.

I think the choices are:

  1. Allow a bypass to the ascii check for internal use.
  2. Only use clan tag if the clan tag is ascii
  3. Remove the ascii check entirely

I think option 1 actually does make sense. If we're already allowing those characters in the clan tag, there's no harm in allowing them in the game name. The ascii enforcement is mostly there to prevent custom lobbies having names in weird encodings that don't render properly on other systems.

@Askaholic Askaholic added the bug label Feb 18, 2021
@Brutus5000
Copy link
Member

Brutus5000 commented Feb 18, 2021

I agree, solution 1 sounds like a valid solution.

@Askaholic Askaholic self-assigned this Feb 19, 2021
Askaholic added a commit that referenced this issue Mar 2, 2021
* Move all strategies to their own file

* Rewrite start_game tests to use hypothesis

Note that test_start_game_with_teams will fail.

* Bypass the ascii check when setting matchmaker game names

Since the name was generated internally, we can trust it to be ok. The 
ascii
check is really meant to prevent encoding errors accross different 
system
configurations and to encourage the use of English titles. Clan names 
will
be guaranteed to be valid utf8, and the rest of the game title will be 
in
English since we created it that way.

* Refactor player_factory to generate connection mocks with spec or autospec

* Update codecov to get statuses to post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants