Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

RewardAccount: validate header type bits and bech32 prefix

未关闭 适合新手
#456 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
typescript
领域
api

调研方向

从 packages/evolution/src/RewardAccount.ts 中的 FromBech32 和 FromBytes 开始,然后对比 Address.FromBech32 中现有的检查以及 #391 中的相关更改。添加覆盖,拒绝非 reward header 和非 stake 前缀,同时保留有效的 stake 和 stake_test 往返;当这些情况按指定要求解析或失败时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
22
派生
31
平均合并
4 天 6 小时
30 天内合并 PR
27

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

IntersectMBO/evolution-sdk 的其他 Issue

查看 IntersectMBO/evolution-sdk 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。