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

Aperta
#154 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
15/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
0
Fork
4
Merge medio
54m
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Yormee-103/PayLoop

Tutte le issue di Yormee-103/PayLoop

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.