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

Đang mở
#154 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
15/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
blockchain, security

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
0
Fork
4
Merge trung bình
54 phút
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Yormee-103/PayLoop

Tất cả issue của Yormee-103/PayLoop

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.