IntersectMBO / IntersectMBO/evolution-sdk
bug: maxRefScriptSizePerTx limit is 200,000 bytes instead of 204,800
- Ngôn ngữ chính
- TypeScript
- Star
- 22
- Fork
- 30
- Merge trung bình
- 13 giờ
- Pull request đã merge (30 ngày)
- 14
Mô tả
## Summary
`calculateReferenceScriptFee` in `TxBuilderImpl.ts` rejects transactions whose total reference script size exceeds 200,000 bytes. The correct Conway-era hard cap is **204,800 bytes** (200 × 1024 = 200 KiB).
Transactions with total reference script sizes between **200,001 and 204,800 bytes** are incorrectly rejected by the SDK but would be accepted by the node.
## Root Cause
```ts
// current (wrong)
if (totalScriptSize > 200_000) {
```
The Cardano Conway ledger hardcodes the limit as `200 * 1024`:
```haskell
ppMaxRefScriptSizePerTxG = L.to . const $ 200 * 1024 -- 204,800 bytes
```
Source: `ConwayEraPParams` instance in [`eras/conway/impl/src/Cardano/Ledger/Conway/PParams.hs`](https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/src/Cardano/Ledger/Conway/PParams.hs). Documented in [ADR-009](https://github.com/IntersectMBO/cardano-ledger/blob/master/docs/adr/2024-08-14_009-refscripts-fee-change.md).
Note: these become proper protocol parameters in Dijkstra era (`ppMaxRefScriptSizePerTxL`).
## Fix
```ts
if (totalScriptSize > 204_800) {
// maxRefScriptSizePerTx: 200 * 1024 = 204,800 bytes (200 KiB)
// Hardcoded in Conway era, becomes a protocol parameter in Dijkstra era.
```
## Affected File
`packages/evolution/src/sdk/builders/TxBuilderImpl.ts` — `calculateReferenceScriptFee`
Hướng dẫn đóng góp
Hướng nghiên cứu
Mở packages/evolution/src/sdk/builders/TxBuilderImpl.ts và kiểm tra calculateReferenceScriptFee cùng phép so sánh 200,000 byte hiện tại. Thay đổi giới hạn thời Conway thành 204,800 byte (200 KiB), sau đó xác minh rằng các tổng có kích thước đến 204,800 byte được chấp nhận, còn các tổng lớn hơn bị từ chối.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- blockchain
- Loại issue
- Lỗi
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 58/100