Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

UPLC: Flat decoding accepts a byte string whose filler ends mid-byte

Đang mở Phù hợp với người mới
#694 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
79/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại UPLC.ts, ở decodeByteString (dòng 510) và _skipByte (dòng 461), sau đó so sánh với kiểm tra ranh giới byte được mô tả trong Plutus Decoder/Prim.hs (dòng 443). Khi phần đệm kết thúc giữa một byte, hãy để quá trình giải mã ném ra UPLCError; xác minh rằng đầu vào hex đã cho bị từ chối trong khi các chuỗi byte hợp lệ vẫn được giải mã.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

UPLC.fromFlatHex("01010048a0354001") decodes to the byte string constant aa, and UPLC.toFlatHex writes it back as 010100488101aa0001. Plutus rejects the input.

In those bytes, the type list ends at bit 2 of the byte a0. The filler before the byte string is a single 1 bit, so it ends at bit 3 of that byte, and the chunk length and data that follow start mid-byte. decodeByteString (UPLC.ts:510) calls _skipByte (UPLC.ts:461), which reads bits until a 1 and never checks that it stopped on a byte boundary, then reads the chunks unaligned. Plutus reads the same filler (dFiller, PlutusCore/Flat/Decoder/Strict.hs:301-304) and then fails in getChunksInfo unless the position is byte aligned (Decoder/Prim.hs:443, badEncoding endPtr s "usedBits /= 0", at plutus 1.72.0.0).

Every byte string goes through this path: ByteString, String and Data constants, and with #667 the keys of Value constants. Only hand-made or corrupted input triggers it, and the ledger rejects such a script. The effect is that decoding and re-encoding changes the script bytes, and so its hash, where it should fail.

decodeByteString should throw a UPLCError when the filler does not end on a byte boundary.

Ngôn ngữ chính
TypeScript
Star
22
Fork
35
Merge trung bình
19 giờ 9 phút
Pull request đã merge (30 ngày)
65

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của IntersectMBO/evolution-sdk

Tất cả issue của IntersectMBO/evolution-sdk

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.