improvement: tx size includes IsValid field, Haskell omits it
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- blockchain
调研方向
从 TxBuilderImpl.ts 中的 calculateFeeIteratively 开始,跟踪 calculateTransactionSize,然后将其序列化结果与所引用的 Haskell toCBORForSizeComputation 参考实现进行比较。当 fee-size 计算使用不含 IsValid 的三元素交易表示,并且不再包含该字段的 CBOR 开销时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
calculateFeeIteratively serializes the transaction using a 4-element CBOR array (body, witnessSet, isValid, auxiliaryData). The Cardano node computes the fee-relevant size using toCBORForSizeComputation, which omits IsValid and produces a 3-element array.
This results in a tx size ~1 byte larger than the node calculates, causing a fee over-estimate of ~44 lovelace (1 byte × minFeeCoefficient).
Haskell Reference
-- eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Tx.hs
toCBORForSizeComputation AlonzoTx {atBody, atWits, atAuxData} =
encodeListLen 3 -- 3 elements, no IsValid
<> encCBOR atBody
<> encCBOR atWits
<> encodeNullStrictMaybe encCBOR atAuxData
Our Code
// TxBuilderImpl.ts — calculateFeeIteratively
const transaction = new Transaction.Transaction({
body,
witnessSet: fakeWitnessSet,
isValid: true, // included in CBOR, node does not count this
auxiliaryData: ...
})
const size = yield* calculateTransactionSize(transaction)
Impact
~44 lovelace over-charge per transaction. Safe (node accepts fees above minimum) but imprecise.
Fix
Serialize only [body, witnessSet, auxiliaryData] (3-element array) for size computation, or subtract the isValid CBOR overhead (~2 bytes) from the measured size.
- 主要语言
- TypeScript
- 星标
- 22
- 派生
- 31
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 36
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
IntersectMBO/evolution-sdk 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
IntersectMBO/evolution-sdk#601 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
IntersectMBO/evolution-sdk#559 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
IntersectMBO/evolution-sdk#557 ·
维护者通常 1 天内回复
-
dependencies good first issue
难度 1/5 1 小时以内 新手友好度 93/100
IntersectMBO/evolution-sdk#541 ·
维护者通常 1 天内回复
-
bug external-review
难度 2/5 1-3 小时 新手友好度 86/100
IntersectMBO/evolution-sdk#530 ·
维护者通常 1 天内回复
查看 IntersectMBO/evolution-sdk 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
profullstack/ugig.net#601 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
github/codeql-action#4202 ·
维护者通常 1 天内回复
-
agents: formatReport/reportOrigin only importable through an entry that loads every runtime (~1.5 s)未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area:runtime bug
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复