Allow proposers to commit their own travel
Verify and publish checkpoint container / container (push) Successful in 11m23s

This commit is contained in:
Quintine committed 2026-11-16 15:10:17 +11:00
1 parent 235696263a
commit 13c337a24a
11 files changed
+456 -27

No files matched your search

+11 -11
View File
@@ -24,14 +24,15 @@ export type PublicDealAdditionalPayment = {
};
export const MAX_ADDITIONAL_DEAL_PAYMENTS = 12;
export const MAX_ADDITIONAL_IMMEDIATE_DEAL_PAYMENTS = 12;
/** One invited recipient commits to one native action (or its absence).
* Old two-party records identify that recipient through `to`. */
/** One participant commits to one native action (or its absence).
* Old two-party records identify the recipient through `to`. */
export type PublicDealTravel = {
kind: 'ship' | 'move';
territory: string;
minimum: number;
answer: boolean;
/** Present only in a multi-party term; the selected recipient accepts last. */
/** Explicit in a group term or when a pair names its traveler. An invited
* traveler accepts last; the proposer already consents by making the offer. */
actor?: string;
/** Absent on existing terms: their original offer turn is the due turn. */
dueTurn?: number;
@@ -148,7 +149,7 @@ export function parsePublicDealPayment(value: unknown, parties: readonly string[
amount: value.amount, dueTurn: value.dueTurn };
}
/** Parse an exact travel claim; the multi-party actor is validated against the deal. */
/** Parse an exact travel claim; any explicit actor is validated against the deal. */
export function parsePublicDealTravel(value: unknown): PublicDealTravel {
const keys = object(value) ? Object.keys(value).sort().join(',') : '';
requireDeal(object(value) && (keys === 'answer,kind,minimum,territory' ||
@@ -212,13 +213,12 @@ export function validatePublicDeals(value: unknown, players: readonly PublicDeal
const travel = parsePublicDealTravel(deal.travel);
requireDeal(travel.dueTurn === undefined || travel.dueTurn >= (deal.turn as number),
'Choose a travel turn no earlier than the offer turn.');
requireDeal(multi
? !!travel.actor && travel.actor !== deal.from && parties.includes(travel.actor)
: !Object.hasOwn(travel, 'actor'),
'Choose an invited traveler and an optional bribe between participants.');
// The actor's final acceptance is checked privately. An unfinished offer
// cannot already contain that vote, even after a decline or withdrawal.
if (multi && deal.status !== 'active' && deal.status !== 'released')
requireDeal(multi ? !!travel.actor && parties.includes(travel.actor)
: !travel.actor || parties.includes(travel.actor),
'Choose a deal participant as traveler and an optional bribe between participants.');
// An invited actor's final acceptance is checked privately. The proposer
// has already consented by making the offer and remains in its votes.
if (multi && travel.actor !== deal.from && deal.status !== 'active' && deal.status !== 'released')
requireDeal(!(deal.acceptVotes as string[]).includes(travel.actor!),
'The committed traveler accepts after all other invited participants.');
}