Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pallets/game/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub mod benches {
PeopleOf::<T>::recognize_personhood(id, Some(key))?;
indiv_pallet_score::Participants::<T>::mutate(who, |p| {
p.as_mut().expect("participant entry exists").recognition =
indiv_pallet_score::Recognition::Recognized(id);
indiv_pallet_score::Recognition::Recognized { id, newly_recognized: false };
});
Ok(id)
}
Expand Down
48 changes: 31 additions & 17 deletions pallets/game/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@
//! invited player is a new, non-recognized account, so the remaining work in dispatch cannot fail
//! and the invite buys a sign-up.
//!
//! ## Airdrop entries of a newly recognized player
//!
//! A player that is not recognized enters the airdrop draws with [`AirdropVrfs::Account`]. A
//! player enters them with either variant from its `register` call in indiv-pallet-score until
//! the game next sets its attendance, and with [`AirdropVrfs::Alias`] in the games after that.
//! The reason is that `register` only queues the member key for a ring, so the player cannot build
//! the ring proof of the alias variant right after it.
//!
//! # Statement store usage
//!
//! All players in the game are given some statement store usage allowance. The player's allowance
Expand Down Expand Up @@ -334,7 +342,7 @@ use indiv_pallet_airdrop::types::{
Airdrop, EventId as AirdropEventId, EventInfo as AirdropEventInfo,
ProductName as AirdropProductName, RegistrationEntry as AirdropRegistrationEntry,
};
use indiv_pallet_score::AccountOrPerson;
use indiv_pallet_score::{AccountOrPerson, Recognition};
use indiv_support::{
credit_trees::AwardCredits,
offchain::{submit_authorized, TX_LONGEVITY},
Expand Down Expand Up @@ -2290,25 +2298,32 @@ pub mod pallet {
}

/// Check the count and the variant of the airdrop VRF entries against the player's
/// `recognized` state.
/// `recognition` in indiv-pallet-score.
///
/// The caller computes `recognized` itself: dispatch after onboarding, the extension
/// before it. Registration for the events is a separate step.
/// The caller reads `recognition` itself: dispatch after onboarding, the extension before
/// it. Registration for the events is a separate step.
pub(crate) fn check_airdrop_shape(
airdrops: &AirdropVrfs<AirdropProofOf<T>>,
who: &AccountOrPerson<T::AccountId>,
recognized: bool,
recognition: Option<&Recognition>,
airdrops_scheduled: u8,
) -> Result<(), AirdropShapeError> {
ensure!(
airdrops.count() == usize::from(airdrops_scheduled),
AirdropShapeError::CountMismatch
);
let recognized = recognition.is_some_and(Recognition::is_recognized);
// A newly recognized player may supply either variant. See the module documentation.
let newly_recognized =
matches!(recognition, Some(Recognition::Recognized { newly_recognized: true, .. }));
match airdrops {
AirdropVrfs::Alias { .. } =>
ensure!(recognized, AirdropShapeError::RecognitionMismatch),
AirdropVrfs::Account(_) => {
ensure!(!recognized, AirdropShapeError::RecognitionMismatch);
ensure!(
!recognized || newly_recognized,
AirdropShapeError::RecognitionMismatch
);
Comment on lines +2323 to +2326

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this lets one person enter a draw twice, once with the account VRF and once as their person with the alias VRF. Here is the runtime test to confirm it:

use super::*;
use indiv_pallet_game::GameSchedule;
use indiv_pallet_score::Recognition;

const MAX_WINNERS: u32 = 4;
const MAX_RING_BUILD_BLOCKS: u32 = 1_000;

fn schedule_one_game(airdrop: bool) -> GameSchedule<<Runtime as pallet_assets::Config>::AssetId, Balance> {
	let now = (pallet_timestamp::Now::<Runtime>::get() / 1000) as u32;
	let schedule = GameSchedule {
		game_play_time: now + IN_BETWEEN_GAMES,
		rounds: 1,
		max_group_size: 3,
		airdrops: if airdrop { game_airdrops(&[0], MAX_WINNERS) } else { Default::default() },
		tenure_claim_window: 0,
	};
	Game::schedule_games(RuntimeOrigin::root(), vec![schedule.clone()]).unwrap();
	schedule
}

/// Bob signs up, reports and wins the game alone.
fn bob_plays(schedule: &GameSchedule<<Runtime as pallet_assets::Config>::AssetId, Balance>) {
	let bob_pair = Sr25519Keyring::Bob.pair();
	advance_until_time(GameTimes::<Runtime>::registration_start(schedule));
	let signup = indiv_pallet_game::Call::<Runtime>::sign_up_with_account {
		identifier_key: [1u8; 65],
		airdrops: None,
	};
	exec_signed(&bob_pair, signup.into());
	advance_until_time(GameTimes::<Runtime>::game_play_time(schedule));
	let report =
		indiv_pallet_game::Call::<Runtime>::report { full_report: vec![BoundedVec::new()].try_into().unwrap() };
	exec_signed_as_score_participant(&bob_pair, report.into());
	advance_until_time(GameTimes::<Runtime>::player_process_end(schedule));
}

fn bob_recognition() -> Recognition {
	indiv_pallet_score::Participants::<Runtime>::get(AccountOrPerson::Account(
		Sr25519Keyring::Bob.to_account_id(),
	))
	.unwrap()
	.recognition
}

/// Bob reaches personhood, calls `Score::register` with `secret`'s member key and waits until
/// the key is in a built ring.
fn bob_registers(secret: &VrfSecret) {
	let bob_pair = Sr25519Keyring::Bob.pair();
	let bob = Sr25519Keyring::Bob.to_account_id();
	Balances::mint_into(&bob, 100 * PlayDepositDefault::get()).unwrap();

	reduce_game_phase_durations();
	bob_plays(&schedule_one_game(false));

	let member = Crypto::member_from_secret(secret);
	let msg = (b"pop register using", &bob).encode();
	let sig = Crypto::sign(secret, &msg[..]).unwrap();
	let register = indiv_pallet_score::Call::<Runtime>::register { key: Some((member.clone(), sig)) };
	exec_signed_as_score_participant(&bob_pair, register.into());

	for _ in 0..MAX_RING_BUILD_BLOCKS {
		let ring_index = indiv_pallet_members::Pallet::<Runtime>::member_status(
			indiv_pallet_people::PEOPLE_MEMBER_IDENTIFIER,
			&member,
		)
		.and_then(|status| status.ring_index());
		if let Some(ring_index) = ring_index {
			if indiv_pallet_members::Root::<Runtime>::get(
				indiv_pallet_people::PEOPLE_MEMBER_IDENTIFIER,
				ring_index,
			)
			.is_some()
			{
				return;
			}
		}
		advance_block();
	}
	panic!("the member key never joined a built ring");
}

/// The person behind `secret` binds an alias account and returns it with a
/// `sign_up_with_alias` call that enters `event_id` with the alias VRF.
fn person_sign_up(secret: &VrfSecret, event_id: [u8; 32]) -> (sr25519::Pair, RuntimeCall) {
	let alias_acc = sr25519::Pair::from_seed(&[50u8; 32]);
	let stmt_acc = sr25519::Pair::from_seed(&[51u8; 32]);
	let set_alias = indiv_pallet_people::Call::<Runtime>::set_alias_account {
		account: pair_to_account_id(&alias_acc),
		call_valid_at: frame_system::Pallet::<Runtime>::block_number(),
	};
	exec_as_alias_with_proof(secret, score_context(), set_alias.into());

	let alias = Crypto::alias_in_context(secret, &score_context()[..]).unwrap();
	let stmt_msg =
		(b"pop:game:stmt_account_for_alias:", alias).using_encoded(sp_io::hashing::blake2_256);
	let sign_up = indiv_pallet_game::Call::<Runtime>::sign_up_with_alias {
		identifier_key: [2u8; 65],
		statement_account: pair_to_account_id(&stmt_acc),
		sig: stmt_acc
			.sign(&indiv_pallet_game::Pallet::<Runtime>::account_signing_payload(&stmt_msg))
			.into(),
		airdrops: Some(build_alias_airdrop_vrfs(
			secret,
			&[event_id],
			RegistrationEntry::Alias { alias },
		)),
	};
	(alias_acc, sign_up.into())
}

#[test]
fn newly_recognized_account_and_its_person_both_enter_one_draw() {
	new_test_ext().execute_with(|| {
		let bob_pair = Sr25519Keyring::Bob.pair();
		let bob = Sr25519Keyring::Bob.to_account_id();
		let secret = Crypto::new_secret([7u8; 32]);
		setup_airdrop_prize_asset(MAX_WINNERS);
		bob_registers(&secret);

		// Game #2 carries the airdrop. Bob has not attended a game since `register`.
		let schedule = schedule_one_game(true);
		let event_id = airdrop_event_id_for(2, 0);
		advance_until_time(GameTimes::<Runtime>::registration_start(&schedule));
		drive_airdrop_to_registering(event_id);
		let (alias_acc, person_sign_up) = person_sign_up(&secret, event_id);
		assert!(matches!(bob_recognition(), Recognition::Recognized { newly_recognized: true, .. }));

		// Bob enters with the account VRF.
		let signup = indiv_pallet_game::Call::<Runtime>::sign_up_with_account {
			identifier_key: [1u8; 65],
			airdrops: Some(build_account_airdrop_vrfs(&bob_pair, &[event_id])),
		};
		exec_signed_as_score_participant(&bob_pair, signup.into());

		// The same human enters again as a person with the alias VRF.
		let outcome = Executive::apply_extrinsic(build_signed_as_alias_with_account_ext(
			&alias_acc,
			person_sign_up,
		))
		.expect("transaction is valid");
		assert_eq!(outcome, Ok(()));

		let entries = indiv_pallet_airdrop::Registrations::<Runtime>::iter_prefix(event_id)
			.map(|(_, entry)| entry)
			.collect::<Vec<_>>();
		let alias = Crypto::alias_in_context(&secret, &score_context()[..]).unwrap();
		assert_eq!(entries.len(), 2);
		assert!(entries.contains(&RegistrationEntry::Account { account_id: bob }));
		assert!(entries.contains(&RegistrationEntry::Alias { alias }));
	});
}

@andrzejSulkowski andrzejSulkowski Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was checking this and this is a pre-existing issue in another order. Somebody reaches personhood, registers with the Account, calls register, and now enters the draw again with the Person path.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what we might do is fn awaits_ring_inclusion(who: PersonalId) -> bool; on the PeopleTrait. As soon as the MemberKey gets queued, we forbid using the AirdropVrfs::Alias path.

This might allow us to keep Participant unchanged (no migration and sdk break).

The open door stays: sign up with the account variant, the key joins a ring, then take a Person(alias) seat, all within one registration phase. But that's already possible on main.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't like the idea so much because the old transaction fails as soon as the person is included which is not predictable. So I submit my transaction, it fails because I just got included and because it failed it consumed my free allowance.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

true. In this case I'd probably just accept the double entering of the draw.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, about the double entering I opened an issue, I don't think it is critical at the moment: #273

ensure!(
matches!(who, AccountOrPerson::Account(_)),
AirdropShapeError::AccountVariantForPerson
Expand Down Expand Up @@ -2947,10 +2962,10 @@ pub mod pallet {
return Ok(());
};

let recognized = indiv_pallet_score::Participants::<T>::get(who)
let recognition = indiv_pallet_score::Participants::<T>::get(who)
.defensive_proof("pallet-game: registering account must be a participant")
.is_some_and(|p| p.recognition.is_recognized());
Self::check_airdrop_shape(&airdrops, who, recognized, airdrops_scheduled)
.map(|p| p.recognition);
Self::check_airdrop_shape(&airdrops, who, recognition.as_ref(), airdrops_scheduled)
.map_err(Error::<T>::from)?;
match airdrops {
AirdropVrfs::Account(vrfs) => {
Expand Down Expand Up @@ -2984,8 +2999,8 @@ pub mod pallet {
/// Validation-only counterpart of [`Self::register_for_airdrop`] for the `GameAsInvited`
/// extension: it dry-runs the per-event registration and rolls the storage back.
///
/// The invite path is the only caller, where the player is a new account. `recognized` is
/// `false` both here, where the participant is not onboarded yet, and in
/// The invite path is the only caller, where the player is a new account. Only the account
/// variant is accepted both here, where the participant is not onboarded yet, and in
/// [`Self::register_for_airdrop`], where a freshly onboarded account is `NotRecognized`.
pub(crate) fn validate_register_for_airdrop(
airdrops: &Option<AirdropVrfs<AirdropProofOf<T>>>,
Expand All @@ -3000,17 +3015,16 @@ pub mod pallet {
return Ok(());
};

let recognized = indiv_pallet_score::Participants::<T>::get(who)
let recognition = indiv_pallet_score::Participants::<T>::get(who)
// When None, it will be onboarded as NotRecognized.
.is_some_and(|p| p.recognition.is_recognized());
.map(|p| p.recognition);

Self::check_airdrop_shape(airdrops, who, recognized, airdrops_scheduled).map_err(
|e| match e {
Self::check_airdrop_shape(airdrops, who, recognition.as_ref(), airdrops_scheduled)
.map_err(|e| match e {
AirdropShapeError::CountMismatch => InvalidAirdropVrfCount,
AirdropShapeError::RecognitionMismatch |
AirdropShapeError::AccountVariantForPerson => InvalidAirdropVrfVariant,
},
)?;
})?;

let res = match airdrops {
AirdropVrfs::Account(vrfs) => {
Expand Down
155 changes: 142 additions & 13 deletions pallets/game/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3642,7 +3642,8 @@ fn kickout_suspends_recognized_player() {
let (key, _sk) = mock_key(1234);
assert_ok!(People::recognize_personhood(id, Some(key)));
indiv_pallet_score::Participants::<Test>::mutate(&player, |p| {
p.as_mut().unwrap().recognition = indiv_pallet_score::Recognition::Recognized(id);
p.as_mut().unwrap().recognition =
indiv_pallet_score::Recognition::Recognized { id, newly_recognized: false };
});
ArchivedPlayers::<Test>::insert(
&player,
Expand Down Expand Up @@ -3686,7 +3687,8 @@ fn offboard_fails_when_suspension_fails() {
// Make ALICE `Recognized` with a personal id that does not belong to any person, so
// the suspension on offboard fails.
indiv_pallet_score::Participants::<Test>::mutate(&alice, |p| {
p.as_mut().unwrap().recognition = indiv_pallet_score::Recognition::Recognized(404);
p.as_mut().unwrap().recognition =
indiv_pallet_score::Recognition::Recognized { id: 404, newly_recognized: false };
});

let err = Game::offboard(RuntimeOrigin::signed(ALICE)).unwrap_err();
Expand All @@ -3703,7 +3705,8 @@ fn kickout_fails_when_suspension_fails() {
// belong to any person, so the suspension on kickout fails.
assert_ok!(indiv_pallet_score::Pallet::<Test>::onboard_for_recognition(&ALICE));
indiv_pallet_score::Participants::<Test>::mutate(&player, |p| {
p.as_mut().unwrap().recognition = indiv_pallet_score::Recognition::Recognized(404);
p.as_mut().unwrap().recognition =
indiv_pallet_score::Recognition::Recognized { id: 404, newly_recognized: false };
});
ArchivedPlayers::<Test>::insert(
&player,
Expand Down Expand Up @@ -5792,8 +5795,10 @@ mod airdrop {
recognition: Recognition,
last_attended_game: Option<u32>,
) {
let reached =
matches!(recognition, Recognition::Recognized(_) | Recognition::ExternallyRecognized,);
let reached = matches!(
recognition,
Recognition::Recognized { .. } | Recognition::ExternallyRecognized
);
indiv_pallet_score::Participants::<Test>::insert(
player,
Participant {
Expand All @@ -5811,6 +5816,49 @@ mod airdrop {
);
}

/// The account variant for the single event `event_id`, with a VRF signature that verifies.
/// Registers a fresh sr25519 key as the public key of `account`.
fn valid_account_proofs(
account: AccountId32,
event_id: indiv_pallet_airdrop::types::EventId,
) -> crate::AirdropVrfs<<verifiable::mock::Mock as verifiable::GenerateVerifiable>::Proof> {
let pair = sr25519::Pair::from_seed(b"valid_account_proofs_seed_______");
register_account_pubkey(account, pair.public());
let signature = pair.vrf_sign(
&indiv_pallet_airdrop::vrf::transcript_for_event(&event_id, &pair.public())
.into_sign_data(),
);
crate::AirdropVrfs::Account(vec![signature].try_into().expect("one entry fits the bound"))
}

/// Make `account` a newly recognized player. The player is archived so that the sign-up skips
/// the onboarding.
fn force_newly_recognized(account: AccountId32) {
force_recognition(
AccountOrPerson::Account(account.clone()),
Recognition::Recognized { id: 0, newly_recognized: true },
);
ArchivedPlayers::<Test>::insert(
AccountOrPerson::Account(account),
ArchivedPlayer::Unkickable { first_game: 0 },
);
}

/// Start a game with one airdrop event open for registration. Returns the event id.
fn new_game_with_open_airdrop() -> indiv_pallet_airdrop::types::EventId {
let schedule = GameSchedule::<u32, u128> {
game_play_time: 10,
rounds: 2,
max_group_size: 3,
airdrops: test_airdrops(1),
tenure_claim_window: 0,
};
assert_ok!(Game::new_game(&schedule));
let event_id = Game::airdrop_event_id(GameIndex::<Test>::get(), 0);
set_event_status(event_id, Status::Registering { total_participants: 0 });
event_id
}

/// Disable the airdrop's prize asset so the next `T::Airdrop::schedule` call
/// returns an error. The game pallet should swallow this error and still
/// create the game.
Expand Down Expand Up @@ -6175,6 +6223,32 @@ mod airdrop {
});
}

#[test]
fn sign_up_accepts_both_variants_for_newly_recognized_player() {
new_test_ext().execute_with(|| {
let event_id = new_game_with_open_airdrop();
force_newly_recognized(ALICE);
force_newly_recognized(BOB);

assert_ok!(Game::sign_up_with_account(
RuntimeOrigin::signed(ALICE),
DEFAULT_IDENTIFIER_KEY,
Some(valid_account_proofs(ALICE, event_id)),
));
assert_ok!(Game::sign_up_with_account(
RuntimeOrigin::signed(BOB),
DEFAULT_IDENTIFIER_KEY,
Some(alias_proofs(1)),
));
let entries =
AirdropRegistrations::<Test>::iter_prefix_values(event_id).collect::<Vec<_>>();
assert_eq!(entries.len(), 2);
for account_id in [ALICE, BOB] {
assert!(entries.contains(&RegistrationEntry::Account { account_id }));
}
});
}

#[test]
fn sign_up_rejects_account_variant_for_recognized_player() {
new_test_ext().execute_with(|| {
Expand All @@ -6188,7 +6262,10 @@ mod airdrop {
assert_ok!(Game::new_game(&schedule));
// Pre-recognized account player: in `Participants` as `Recognized(_)` and in
// `ArchivedPlayers` so the sign-up's onboard step is skipped.
force_recognition(AccountOrPerson::Account(ALICE), Recognition::Recognized(0));
force_recognition(
AccountOrPerson::Account(ALICE),
Recognition::Recognized { id: 0, newly_recognized: false },
);
ArchivedPlayers::<Test>::insert(
AccountOrPerson::Account(ALICE),
ArchivedPlayer::Unkickable { first_game: 0 },
Expand All @@ -6204,6 +6281,33 @@ mod airdrop {
});
}

#[test]
fn validate_register_for_airdrop_follows_the_recognition() {
new_test_ext().execute_with(|| {
let event_id = new_game_with_open_airdrop();
let game_index = GameIndex::<Test>::get();
let who = AccountOrPerson::Account(ALICE);
let account_proofs = Some(valid_account_proofs(ALICE, event_id));
let alias_proofs = Some(alias_proofs(1));

force_newly_recognized(ALICE);
for proofs in [&account_proofs, &alias_proofs] {
assert!(Game::validate_register_for_airdrop(proofs, &who, game_index, 1).is_ok());
}
// The dry runs registered nothing.
assert_eq!(AirdropRegistrations::<Test>::iter_prefix(event_id).count(), 0);

force_recognition(
who.clone(),
Recognition::Recognized { id: 0, newly_recognized: false },
);
assert!(matches!(
Game::validate_register_for_airdrop(&account_proofs, &who, game_index, 1),
Err(CustomError::InvalidAirdropVrfVariant)
));
});
}

#[test]
fn sign_up_participate_failure_rolls_back() {
// If the airdrop pallet rejects the participation, the whole sign-up must roll
Expand Down Expand Up @@ -6400,7 +6504,11 @@ mod airdrop {
#[test]
fn claim_rejects_when_never_attended() {
new_test_ext().execute_with(|| {
force_participant(AccountOrPerson::Account(ALICE), Recognition::Recognized(0), None);
force_participant(
AccountOrPerson::Account(ALICE),
Recognition::Recognized { id: 0, newly_recognized: false },
None,
);
assert_noop!(
Game::claim_airdrop(RuntimeOrigin::signed(ALICE), 1, 0, id_to_account(99)),
Error::<Test>::NotEligibleForAirdrop,
Expand All @@ -6413,7 +6521,11 @@ mod airdrop {
// Eligibility is `last_attended_game == Some(game_index)`. ALICE attended game 5;
// claims for the previous (game 4) and the next (game 6) must both be rejected.
new_test_ext().execute_with(|| {
force_participant(AccountOrPerson::Account(ALICE), Recognition::Recognized(0), Some(5));
force_participant(
AccountOrPerson::Account(ALICE),
Recognition::Recognized { id: 0, newly_recognized: false },
Some(5),
);

// Previous game.
stage_claim_for(4, RegistrationEntry::Account { account_id: ALICE });
Expand Down Expand Up @@ -6487,7 +6599,8 @@ mod airdrop {
let who = AccountOrPerson::Account(ALICE);
assert_ok!(indiv_pallet_score::Pallet::<Test>::set_attendance(&who, true, game_index));
indiv_pallet_score::Participants::<Test>::mutate(&who, |maybe| {
maybe.as_mut().unwrap().recognition = Recognition::Recognized(0);
maybe.as_mut().unwrap().recognition =
Recognition::Recognized { id: 0, newly_recognized: false };
});

// Stage the event as `Claiming` with ALICE as the sole winner, then claim.
Expand Down Expand Up @@ -6525,7 +6638,11 @@ mod airdrop {

// Pre-recognized account player: in `Participants` as `Recognized(_)` and in
// `ArchivedPlayers` so the sign-up's onboard step is skipped.
force_participant(AccountOrPerson::Account(ALICE), Recognition::Recognized(0), None);
force_participant(
AccountOrPerson::Account(ALICE),
Recognition::Recognized { id: 0, newly_recognized: false },
None,
);
ArchivedPlayers::<Test>::insert(
AccountOrPerson::Account(ALICE),
ArchivedPlayer::Unkickable { first_game: 0 },
Expand Down Expand Up @@ -6579,7 +6696,11 @@ mod airdrop {
#[test]
fn claim_forwards_account_registrant() {
new_test_ext().execute_with(|| {
force_participant(AccountOrPerson::Account(ALICE), Recognition::Recognized(0), Some(7));
force_participant(
AccountOrPerson::Account(ALICE),
Recognition::Recognized { id: 0, newly_recognized: false },
Some(7),
);
stage_claim_for(7, RegistrationEntry::Account { account_id: ALICE });
let beneficiary = id_to_account(123);
let prize_amount = test_airdrop_prize().asset_amount;
Expand Down Expand Up @@ -7223,7 +7344,11 @@ mod airdrop {
fn claim_airdrop_selects_event_by_index() {
new_test_ext().execute_with(|| {
let alice_entry = RegistrationEntry::<AccountId32>::Account { account_id: ALICE };
force_participant(AccountOrPerson::Account(ALICE), Recognition::Recognized(0), Some(5));
force_participant(
AccountOrPerson::Account(ALICE),
Recognition::Recognized { id: 0, newly_recognized: false },
Some(5),
);

// Index 0: claimable with a winning entry for ALICE.
stage_claim_for_index(5, 0, alice_entry.clone());
Expand Down Expand Up @@ -7261,7 +7386,11 @@ mod airdrop {
fn claim_each_won_airdrop_separately() {
new_test_ext().execute_with(|| {
let alice_entry = RegistrationEntry::<AccountId32>::Account { account_id: ALICE };
force_participant(AccountOrPerson::Account(ALICE), Recognition::Recognized(0), Some(5));
force_participant(
AccountOrPerson::Account(ALICE),
Recognition::Recognized { id: 0, newly_recognized: false },
Some(5),
);
stage_claim_for_index(5, 0, alice_entry.clone());
stage_claim_for_index(5, 1, alice_entry.clone());

Expand Down
8 changes: 5 additions & 3 deletions pallets/game/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ pub enum AttendanceStatus {
///
/// The variant picks the identity path: if the player is recognized (pallet-score `Recognition`
/// is `Recognized` or `ExternallyRecognized`) then they must provide the alias variant,
/// otherwise they must provide the account variant. The variant holds exactly one entry per
/// scheduled airdrop event of the game, in airdrop-index order: the entry at position `i` is
/// bound to the event id of airdrop index `i` (see `Pallet::airdrop_event_id`).
/// otherwise they must provide the account variant. A newly recognized player (pallet-score
/// `Recognized` with `newly_recognized`) may provide either variant, because their member key may
/// not be in a ring yet. The variant holds exactly one entry per scheduled airdrop event of the
/// game, in airdrop-index order: the entry at position `i` is bound to the event id of airdrop
/// index `i` (see `Pallet::airdrop_event_id`).
#[derive(Encode, Decode, TypeInfo, Debug, Clone, PartialEq, Eq)]
#[scale_info(skip_type_params(P))]
pub enum AirdropVrfs<P> {
Expand Down
Loading