bug(ui): a taken table name passes validation and is quoted a price, then fails on chain with a raw error

Abierto
#674 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
blockchain, typescript

Línea de trabajo

Start with src/utils/tableName.ts and trace the create-table form’s current validation, pricing, submission, and chain-error handling. Review block52/pokerchain#374 and its query.proto changes before implementing availability checks; done means taken, available, failed, unknown, and race outcomes are handled, with tests covering those states and a readable rejection message.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Follow-up to #562 (which is still open although its code shipped in #592 + #595). Chain side: block52/pokerchain#374.

What happens today

A player types a table name that someone already owns. The UI:

  1. validates it against charset and length — passes
  2. quotes the price — "8 characters × $0.10 = $0.80"
  3. accepts the submit
  4. the chain rejects the tx with a raw Cosmos error: table name "friday-night" is already taken

src/utils/tableName.ts mirrors the chain's charset, length and per-character fee exactly — #595 did that part well — but it knows nothing about uniqueness. A grep across src/ for already taken, nameAvailable or isNameTaken returns nothing.

Why this is a bug and not a missing nice-to-have

#562's own acceptance criteria say:

  • Submit is blocked (with reason) when balance < buy-in + name cost, or when the name violates charset/length rules.

Uniqueness is a third validation rule that the chain added after that ticket was written — #562's open question 1 proposed "start non-unique (keyed by tableId)", and the chain shipped global uniqueness instead. So the UI is enforcing two of the three rules the chain enforces, and the one it misses is the only one that cannot be worked out locally. The result is the exact failure mode that criterion exists to prevent: a confident price quote, then a raw chain error.

Blocked on the chain

The UI cannot fix this alone — there is currently no query to ask. GameNames is write-only from outside the chain: 20 RPCs in query.proto and none resolves a name. block52/pokerchain#374 proposes NameAvailable and GameByName.

This issue should be picked up after #374 lands. What can be done ahead of it is listed below.

Acceptance

Once block52/pokerchain#374 is available:

  • The create-table form checks name availability (debounced, on the normalized name) and shows a clear taken/available state
  • Submit is blocked with a reason when the name is taken — never a price quote for a name that cannot be bought
  • Loading, error and unknown are three different states: if the availability query fails we say so and allow submit (the chain remains the authority), rather than silently claiming the name is free
  • The chain's rejection is still handled gracefully as a race — two creators can pass the check and one must lose
  • Tests over taken, available, query-failed, and the race

Independent of #374:

  • Map the chain's table name %q is already taken rejection to a readable message instead of a raw Cosmos error
  • If block52/pokerchain#375 settles as "permanent", say so at the point of payment — a name that is irrevocable should not be sold without telling the buyer

While we are here

#562 is open although every line of its code has shipped (#592, #595 merged; #593 and pokerchain#337 closed). Its six open questions were all answered unilaterally by the chain and never written back — one of them, uniqueness, contradicts the ticket. I have left a comment on #562 recording the answers; it should be closable once this issue and #374 carry the remaining work.

Lenguaje dominante
TypeScript
Estrellas
2
Forks
5
Merge medio
23 h 37 min
PR fusionados (30 d)
96

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de block52/ui

Todos los issues de block52/ui

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.