Add a codec preset that follows the ledger encoder
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- blockchain
调研方向
Start with the CBOR default options named in the issue, CBOR.CML_DEFAULT_OPTIONS and CBOR.TX_DEFAULT_OPTIONS.ledger, and see how they set map and set ordering and length encoding. The ledger rules being matched (encodeMap, encodeSet, the 23-entry threshold) live in cardano-ledger, not this repo. Done means the regression test cases (unsorted inputs, multiple policies, more than 23 inputs or assets) encode byte-identically to cardano-cli build-raw output. The default switch is a separate, later change that needs its own release note.
由索引模型根据 Issue 内容生成。
描述
Summary
No codec preset writes a transaction the way the ledger encoder and cardano-cli do. CBOR.CML_DEFAULT_OPTIONS, the transaction default, keeps map keys and set items in insertion order and always writes definite lengths. The ledger sorts them and switches to indefinite lengths above 23 entries.
Evidence
cardano-ledger libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Encoding/Encoder.hs:
encodeMap(L395-400) folds the map in key order and usesvariableMapLenEncoding: definite up to 23 entries, indefinite above (L426-436,lengthThreshold = 23).encodeSet(L472-483) writes tag 258, the items in order, with the same rule throughvariableListLenEncoding(L457-460).
cardano-cli 10.5.1 conway transaction build-raw, with 25 inputs given in descending order and one output holding two policies given in descending order:
| cardano-cli | CML_DEFAULT_OPTIONS |
|
|---|---|---|
| Inputs | sorted, d90102 9f ... ff |
as given, d90102 9819 ... |
| Policies in the output | sorted | as given |
Proposal
- Add a preset that follows this layout, named after what it follows. The 23-entry rule needs a new encoder setting, since today a preset is either always definite or always indefinite.
- Check that each key type sorts the same way as the ledger's
Ordinstance before relying on byte order. - Move
CBOR.TX_DEFAULT_OPTIONS.ledgerto the new preset in a later release. This changes the bytes of every transaction the builder makes, so it needs devnet proof and its own release note.
Regression test
Build transactions with unsorted inputs, several policies per output, more than 23 inputs and more than 23 assets. Encoded with the new preset, each is byte-identical to cardano-cli build-raw output for the same transaction.
- 主要语言
- TypeScript
- 星标
- 22
- 派生
- 35
- 平均合并
- 20 小时 8 分钟
- 30 天内合并 PR
- 56
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
IntersectMBO/evolution-sdk 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
IntersectMBO/evolution-sdk#559 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
IntersectMBO/evolution-sdk#557 ·
维护者通常 1 天内回复
-
dependabot: remove stale @types/bip39 entries可能已有人在做 @Kshot3000 于 5 天前认领。 未关闭dependencies good first issue
难度 1/5 1 小时以内 新手友好度 93/100
IntersectMBO/evolution-sdk#541 ·
维护者通常 1 天内回复
-
txBuilder: committee cert redeemers are never resolved to a certificate index可能已有人在做 @Kshot3000 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
IntersectMBO/evolution-sdk#518 ·
维护者通常 1 天内回复
-
RewardAccount: validate header type bits and bech32 prefix可能已有人在做 @Kshot3000 于 5 天前认领。 未关闭enhancement external-review
难度 2/5 1-3 小时 新手友好度 84/100
IntersectMBO/evolution-sdk#456 · 1 条评论 ·
维护者通常 1 天内回复
查看 IntersectMBO/evolution-sdk 的全部 Issue
相似的 Issue
-
area: repo priority: P2 type: bug
难度 2/5 1-3 小时 新手友好度 76/100
appandflow/stim#4107 · 1 条评论 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1-3 小时 新手友好度 60/100
lingdojo/kana-dojo#32859 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
code-quality refactoring
难度 2/5 1-3 小时 新手友好度 78/100
github/gh-aw-firewall#10364 ·
维护者通常 1 天内回复
-
Merge the duplicate kaffir_corn record into sorghum可能已有人在做 @Crypto-Shroom 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
Crypto-Shroom/Bird-Feed-Calculator#322 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
drizzle-team/drizzle-orm#6552 ·
维护者通常 2 天内回复