Skip to content

Game: if forming the groups runs a little late, the whole game and its prize draw are cancelled #260

Open

Description

@mordamax

Severity: high. Every player in the affected game loses it and its prize draw with no way to recover, and #259 shows the cancel can be forced on purpose.

When the chain doesn't finish forming the groups by the deadline before a game starts, it cancels the game for everyone who signed up, and cancels the game's prize draws too. Players sign up, wait at a table where nobody joins, and then get the end-of-game screen. They did nothing wrong; the chain just needed a bit more time.

This happened on previewnet in game 166 (20 Nov 2026, 17:20 UTC): 1,501 players had signed up for a game with a prize draw. Previewnet's People chain makes a block every 6 s, so its 60 s shuffle phase is 10 blocks; forming the groups for 1,501 players needed about 30, was still in its second step when the 60 s ran out, and the game and draw were cancelled. Collator log: game 166: shuffle deadline 1795195170 passed at 1795195176, the shuffle phase is too short (https://previewnet.substrate.dev/logs/2026-11-20/people-collator1.log). The same game on a 2 s-block chain would need about 60 s, so with a 60 s phase it would land right at the deadline.

This doesn't depend on how the game is configured. A longer shuffle phase makes it rarer, but how long forming the groups takes varies with the number of players and with how quickly the chain gets the steps into blocks, and #259 shows the steps can be pushed out on purpose. Whenever the deadline is missed, by any margin, everyone loses the game. With weekly games that is the week's game.

Code: the cancel is in shuffles (

};
let now = T::UnixTime::now();
if now > Duration::from_secs(game.shuffle_deadline.into()) {
// The configured phases leave no room for the steps this shuffle needs, so this is
// an error introduced by an operator (who configured the pallet).
log::error!(
target: LOG_TARGET,
"game {}: shuffle deadline {} passed at {}, the shuffle phase is too short",
game.index,
game.shuffle_deadline,
now.as_secs(),
);
Self::on_game_cancelled(&game, CancelReason::ShuffleDeadlineMissed);
game.state = GameState::Cancelling { step: CancellingStep::Step1DrainShuffle };
Game::<T>::put(game);
return;
) and on_game_cancelled cancels the draws (
pub(crate) fn on_game_cancelled(game: &GameInfo<T::AccountId>, reason: CancelReason) {
for airdrop_index in 0..game.airdrops_scheduled {
let event_id = Self::airdrop_event_id(game.index, airdrop_index);
T::Airdrop::cancel(event_id);
}
Self::deposit_event(Event::<T>::GameCancelled { game_index: game.index, reason });
}
).

Expected: when forming the groups takes longer than planned, the people who signed up still play that game and its prize draw still takes place.

To check: a game whose shuffle runs past its planned end still starts with its players and draws, and players see their co-players instead of the end-of-game screen.

Related: why the shuffle runs late in large games, #262.

Activity

  1. added
    bug
    on Nov 20, 2026
  2. andrzejSulkowski commented on Nov 21, 2026

    @andrzejSulkowski
    Collaborator

    This is a valuable experiment, but expected. Its a well known shortcoming of the game pallet and thats why we need to do a reasonable estimation of players and set a gracious shuffle duration in prod.

    This doesn't depend on how the game is configured. A longer shuffle phase makes it rarer, but how long forming the groups takes varies with the number of players and with how quickly the chain gets the steps into blocks, and #259 shows the steps can be pushed out on purpose.

    issue #259 needs to get closed indeed and there is always a certain chance that we get a sudden spike of 3x players into one game. The idea is to start with good buffered durations, watch the games and adjust through parameter configured values through quick OpenGov referenda. This is a known scalability issue of the current game.

  3. andrzejSulkowski commented on Nov 21, 2026

    @andrzejSulkowski
    Collaborator

    But this is very valuable. I see multiple things which should behave differently. Well done @mordamax! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions