token-fundraiser: large valid targets cause contribution-limit overflow
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #791 @Bismithblde による — マージされずにクローズ
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- blockchain
調査の方向性
まず programs/fundraiser/src/instructions/contribute.rs:67 を確認してください。ここでは貢献者ごとの上限がオーバーフローしており、その上限がトランザクションと累積貢献のチェックでどのように再利用されるかを調べてください。対象値 u64::MAX / 10 + 1 と u64::MAX について LiteSVM の回帰テストを追加または実行してください。上限ちょうどの貢献が成功し、上限を超える貢献が失敗し、残高と記録された貢献額が正しいことを完了条件とします。
索引モデルが issue の本文から書いたものです。
説明
Problem
The Anchor fundraiser accepts u64 fundraising targets, but calculating the per-contributor 10% limit uses u64 multiplication before division. For a target greater than u64::MAX / 10, target * 10 overflows and contributions panic, even when the contribution is small and the final limit fits in u64.
Reproduction
A Rust LiteSVM integration test creates a six-decimal mint, initializes a fundraiser with a target of u64::MAX / 10 + 1, then contributes 1,000,000 base units (one token).
Initialization succeeds. The contribution fails with attempt to multiply with overflow at programs/fundraiser/src/instructions/contribute.rs:67.
The same issue affects a target of u64::MAX. The existing initialization instruction accepts both values.
Proposed fix
Calculate the percentage once in u128 and reuse it for the per-transaction and cumulative contributor limits. Compare the cumulative contribution in u128 as well. This preserves the 10% policy and integer rounding.
The regression fails against the original program and passes after the fix. It covers both targets, acceptance up to the exact cap, rejection above the cap, and resulting balances and recorded contributions. All three fundraiser integration tests pass locally.
- 主要言語
- Rust
- スター
- 1.4k
- フォーク
- 562
- 平均マージ
- 23時間 5分
- マージ済み PR(30日)
- 19
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
solana-foundation/program-examples のほかの issue
-
Migrate deprecated .accounts() to .accountsPartial() in Anchor tests再び着手できるかも @ankittiwari-04 が 27 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンaccepted
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
solana-foundation/program-examples#747 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
basics/pda-rent-payer: create_new_account has no caller check — worth a note for people copying it?対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
solana-foundation/program-examples#671 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
native/pinocchio examples: deploy script points at program.so, which the build never produces対応中かも @MarkFeder が今日担当しました。 オープンaccepted
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
solana-foundation/program-examples#787 ·
メンテナーはふだん 1 日以内に返信
-
token-2022/cpi-guard: add a Pinocchio version対応中かも @MarkFeder が今日担当しました。 オープンaccepted
難易度 3/5 1〜2日 初心者へのやさしさ 20/100
solana-foundation/program-examples#786 ·
メンテナーはふだん 1 日以内に返信
-
token-2022/memo-transfer: add a Pinocchio version対応中かも @MarkFeder が今日担当しました。 オープンaccepted
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
solana-foundation/program-examples#785 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
solana-foundation/program-examples の issue をすべて見る
似ている issue
-
SPLADE `/embed_sparse` output depends on the other inputs in the batch (candle BertModel / DistilBertModel)対応中かも @0z5a が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
huggingface/text-embeddings-inference#979 ·
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
servo/rust-smallvec#874 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
ci enhancement need-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信