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

RewardAccount: validate header type bits and bech32 prefix

Đang mở Phù hợp với người mới
#456 1 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
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu trong packages/evolution/src/RewardAccount.ts tại FromBech32 và FromBytes, sau đó so sánh các kiểm tra hiện có trong Address.FromBech32 và những thay đổi liên quan từ #391. Bổ sung coverage để từ chối các header không phải reward và các prefix không phải stake, đồng thời giữ nguyên các round trip hợp lệ của stake và stake_test; được xem là hoàn thành khi các trường hợp này được parse hoặc thất bại theo đúng đặc tả.

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

Mô tả

enhancement external-review

Summary

RewardAccount parsing is looser than Address parsing for the same class of input. RewardAccount.FromBech32 does not check the bech32 human-readable prefix, and RewardAccount.FromBytes does not validate the CIP-19 header type nibble. As a result, a non-stake prefix and a non-reward header type can still parse into a RewardAccount. This is the RewardAccount-side counterpart to #391, which added the equivalent checks on Address / EnterpriseAddress / BaseAddress.

Affected

  • packages/evolution/src/RewardAccount.ts — FromBech32 (prefix not checked)
  • packages/evolution/src/RewardAccount.ts — FromBytes (header type nibble not validated)

Fix

  • FromBytes: require the header type to be a reward type (14/15); reject others.
  • FromBech32: require the prefix to be stake / stake_test and to agree with the header networkId.

Mirror the checks already present in Address.FromBech32.

Test

Add coverage asserting that a non-reward header and a non-stake prefix both fail to parse as a RewardAccount, and that valid stake / stake_test inputs still round-trip.

Ngôn ngữ chính
TypeScript
Star
22
Fork
31
Merge trung bình
4 ngày 6 giờ
Pull request đã merge (30 ngày)
27

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.