Contract: initialise atomically with a constructor instead of a separate `initialize` call

Abierto
#154 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
15/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start with the initialize function and its state writes in contracts/invoice/src/lib.rs, then the cannot_initialize_twice test in contracts/invoice/src/test.rs. Deployment steps live in contracts/DEPLOYMENT.md. Done means admin and payment token are set at deploy time through a Soroban constructor, initialize is removed or deprecated, the tests cover both, and the docs show the new command. The issue needs maintainer sign-off and a batched redeploy, so confirm the approach before coding.

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

Descripción

contract difficulty: advanced needs-discussion security

Difficulty: Advanced

Problem

Deployment and initialize are two separate transactions. Between them, anyone can call initialize on the fresh instance with their own admin and payment token, taking over the deployment.

Why it matters

For a contract meant to hold real payment flows, the deployment procedure should not have a window where it can be hijacked.

Scope of work

Use Soroban's __constructor so the admin and payment token are set during deployment, remove or deprecate initialize, update tests (cannot_initialize_twice) and update contracts/DEPLOYMENT.md and the CLI examples.

Expected outcome

A deployment cannot be initialised by anyone but the deployer.

Acceptance criteria

  • Constructor sets the same state initialize did.
  • Tests cover the constructor and the removal or deprecation of initialize.
  • Deployment docs show the new command.

Relevant files

  • contracts/invoice/src/lib.rs, contracts/invoice/src/test.rs, contracts/DEPLOYMENT.md

Dependencies

ABI and deployment-procedure change; batch with other contract changes in one redeploy.

Maintainer discussion needed?

Yes.

Lenguaje dominante
TypeScript
Estrellas
0
Forks
4
Merge medio
54 min
PR fusionados (30 d)
6

Preparar el entorno

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 Yormee-103/PayLoop

Todos los issues de Yormee-103/PayLoop

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.