Declarative CBOR schema via annotations (CborId)
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu trong CBOR.ts bằng cách đọc các kiểu chú thích CborId được đề xuất và thiết kế của codec engine, sau đó kiểm tra các triển khai FromCDDL và CDDLSchema hiện có cho TransactionBody, TransactionWitnessSet và Transaction. Hoàn thành nghĩa là chuyển đổi tất cả các module áp dụng được, bao quát các tập Tag-258, tính hai dạng map/array của redeemer, các map lồng nhau, các trường tùy chọn và việc bảo toàn encoding, đồng thời duy trì khả năng tương thích ngược.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Replace hand-written FromCDDL transforms with declarative schema annotations that describe CBOR wire format directly on Effect Schema types.
Motivation
Currently each module (TransactionBody, TransactionWitnessSet, Transaction, etc.) has:
- A
CDDLSchema(intermediate CBOR AST type) - A
FromCDDLtransform (hand-written 200-500 line encode/decode) - A
FromCBORBytesthat composesFromByteswithFromCDDL
This creates a two-hop pipeline (Uint8Array → CBOR AST → domain) with a validation boundary that clones objects and strips Symbol metadata (e.g. kEncoding for encoding preservation).
Proposal
A CborId Symbol annotation on Effect Schemas that carries CBOR layout metadata:
const CborId = Symbol.for("evolution/CborId")
const Address = Schema.Uint8ArrayFromSelf.annotations({
[CborId]: { tag: 259 }
})
const Value = Schema.Struct({
coin: Schema.BigIntFromSelf,
multiasset: Schema.optional(MultiAsset),
}).annotations({
[CborId]: { encoding: "array", fieldOrder: ["coin", "multiasset"] }
})
const TransactionOutput = Schema.Struct({
address: Address,
value: Value,
datum: Schema.optional(Datum),
scriptRef: Schema.optional(ScriptRef),
}).annotations({
[CborId]: { encoding: "map", keys: { address: 0n, value: 1n, datum: 2n, scriptRef: 3n } }
})
A generic CBOR codec engine reads [CborId] annotations to:
- Map struct fields to integer-keyed CBOR map entries or positional array slots
- Wrap values in CBOR tags (e.g.
#6.258for sets) - Handle optional fields (omit from map when undefined)
- Thread
kEncodingpreservation metadata automatically
Benefits
- Eliminates
FromCDDL— no hand-written encode/decode per module - Eliminates
CDDLSchema— domain schema IS the codec schema, no intermediate type - Encoding preservation is free — single transform boundary, no clone/Symbol stripping
- Self-documenting — annotations describe the wire format directly
- Less code — TransactionBody goes from ~500 lines of transform to ~25 lines of annotated schema
Scope
- Build
CborIdannotation types and codec engine in CBOR.ts (~200-400 lines) - Convert all modules with FromCDDL transforms to use annotated schemas
- Handle edge cases: Tag-258 sets, redeemer map/array duality, nested maps, etc.
- Maintain backward compatibility with existing domain types
Context
Discovered during CBOR encoding preservation work. The immediate fix (replacing MapFromSelf/Tuple CDDLSchemas with non-cloning Schema.declare) unblocks encoding preservation. This issue tracks the larger architectural improvement.
- Ngôn ngữ chính
- TypeScript
- Star
- 22
- Fork
- 33
- Merge trung bình
- 2 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 39
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 IntersectMBO/evolution-sdk
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
IntersectMBO/evolution-sdk#601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
IntersectMBO/evolution-sdk#559 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
IntersectMBO/evolution-sdk#557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
IntersectMBO/evolution-sdk#541 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug external-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
IntersectMBO/evolution-sdk#530 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của IntersectMBO/evolution-sdk
Issue tương tự
-
ble-needs-fable-review bug mobile priority:P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ColeMurray/background-agents#2305 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug from-studio
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
esengine/DeepSeek-Reasonix#12355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
oblien/openship#1086 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày