Declarative CBOR schema via annotations (CborId)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- backend
Research direction
Start in CBOR.ts by reading the proposed CborId annotation types and codec engine design, then inspect the existing FromCDDL and CDDLSchema implementations for TransactionBody, TransactionWitnessSet, and Transaction. Done means converting all applicable modules, covering Tag-258 sets, redeemer map/array duality, nested maps, optional fields, and encoding preservation while maintaining backward compatibility.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 22
- Forks
- 31
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from IntersectMBO/evolution-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
IntersectMBO/evolution-sdk#579 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
IntersectMBO/evolution-sdk#559 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
IntersectMBO/evolution-sdk#557 ·
Maintainers usually reply within 1 day
-
dependencies good first issue
Difficulty 1/5 Under an hour Newbie friendliness 93/100
IntersectMBO/evolution-sdk#541 ·
Maintainers usually reply within 1 day
-
bug external-review
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
IntersectMBO/evolution-sdk#530 ·
Maintainers usually reply within 1 day
All issues in IntersectMBO/evolution-sdk
Similar issues
-
bug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sleeyax/paseo-plugins#112 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
rossoctl/serverless-harness#428 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
typesense/typesense-js#376 ·
-
ready sonnet zone:app
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
wheresrhys/totf#1103 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
prime-radiant-inc/evener#3726 ·
Maintainers usually reply within 1 day