spec: rule 3 assumes one enum per contract, which shared error types break
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript
- Lĩnh vực
- documentation
Hướng nghiên cứu
Start by reading SPEC.md rule 3, rule 4, and the reference allocation table. Decide whether shared #[contracterror] enums should be permitted or discouraged, and check prior art from Soroban workspaces as the issue suggests. Update the spec so its rules and allocation table agree; done means it explains the chosen policy and, if relevant, how existing shared enums should migrate.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Which rule
SPEC.md rule 3, "Each contract MUST own exactly one block", and by extension the whole framing that an enum corresponds to a contract.
The layout it does not fit
A workspace with a shared error crate:
contracts/
shared/src/error.rs // pub enum CommonError
token/src/error.rs // pub enum TokenError
router/src/error.rs // pub enum RouterError
CommonError is re-exported and returned by three contracts. Under the current spec it needs a block, but it is not a contract, and a caller receiving one of its codes genuinely cannot tell which contract produced it — which rule 4 exists to prevent.
The reference allocation gestures at this with a 900-999 row labelled "shared / library errors", but the rules never actually say how a shared type is meant to work, so the table and the rules disagree.
The real question
Is a shared error enum acceptable at all?
There is a coherent argument that it is not: if the caller cannot identify the origin, the error is less useful, and the fix is per-contract enums that wrap or duplicate the shared variants. There is an equally coherent argument that duplicating "unauthorized" across six contracts is worse, and that the origin belongs in the transaction data rather than the code.
The spec should pick one and say why. Right now it silently assumes the problem does not exist.
Suggested resolution
Either:
- (a) Explicitly permit shared enums, require them to sit in a designated shared block, and add a note that codes in that block do not identify a contract; or
- (b) Recommend against them, with a short migration sketch for workspaces that already have one.
Whichever is chosen, rule 3 needs rewording from "contract" to "#[contracterror] enum", since that is what the tooling actually keys on.
Good first issue because
This is a documentation and reasoning change, not code. Prior art from a real Soroban workspace that has solved it either way would be the most valuable thing anyone could add here.
- Ngôn ngữ chính
- JavaScript
- Star
- 0
- Fork
- 1
- Merge trung bình
- 14 giờ 38 phút
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codepacct/codepact-conventions
-
enhancement good first issue wave
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
codepacct/codepact-conventions#55 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement wave
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
codepacct/codepact-conventions#54 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue wave
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
codepacct/codepact-conventions#53 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue tests wave
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
codepacct/codepact-conventions#52 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue tests wave
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
codepacct/codepact-conventions#51 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codepacct/codepact-conventions
Issue tương tự
-
bug security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
IbrahimHafez1/loadwise#251 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
erkamyaman/unslop-anything#421 ·
Maintainer thường phản hồi trong vòng 1 ngày