Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

swap-fees: free-mint path grants 199 steps for 100 paid (allotment 11,940,000 ms vs 6,000,000 expected)

オープン
#720 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
docker, go
領域
backend, testing

調査の方向性

Start by running the named test, test_swap_fees.py::TestSwapFees::test_fee_mint_payments_do_not_break_the_free_mint_path, in tests/cloud-lab and compare it with an isolated run. Then inspect the allotment calculation in src/upstream_session_manager/ and the kind-1022 event emission in src/merchant/; first establish whether the event represents a per-payment grant or a session total. Done means the product behavior is confirmed and the test passes with the free-mint allotment matching that behavior.

索引モデルが issue の本文から書いたものです。

説明

Summary

test_swap_fees.py::TestSwapFees::test_fee_mint_payments_do_not_break_the_free_mint_path fails on current main: a 100-step payment on the FREE mint is granted 11,940,000 ms of allotment — exactly 199 steps — where the test demands 100 × 60,000 = 6,000,000. The anomaly is in the generous direction (customer receives ~2× what was paid for). Funds-adjacent: allotment accounting is wrong somewhere.

Severity: S2 candidate. 4 of 5 fee tests in the same file pass; only the free-mint-path check fails.

Verified on

  • Commit: 68ad5144ab09cb4723d8f3f655cbba1ac7ea9de5 (main, 2026-10-07)
  • Lane: tests/cloud-lab docker lab, client pytest run

Evidence (verbatim)

>       assert allotment == 100 * 60000, (
E       AssertionError: Free-mint allotment 11940000 should equal the full 100 steps (6000000): {'p': ['c6:a5:b8:02:91:1e'], 'device-identifier': ['mac', 'c6:a5:b8:02:91:1e'], 'allotment': ['11940000'], 'metric': ['milliseconds'], 'start-time': ['1791388848']}
E       assert 11940000 == (100 * 60000)
test_swap_fees.py:301: AssertionError
FAILED test_swap_fees.py::TestSwapFees::test_fee_mint_payments_do_not_break_the_free_mint_path
1 failed, 4 passed in 3.41s

Note 11,940,000 == 199 × 60,000 exactly.

Reproduce

git clone https://github.com/OpenTollGate/tollgate-module-basic-go && cd tollgate-module-basic-go
git checkout 68ad5144ab09cb4723d8f3f655cbba1ac7ea9de5
cd tests/cloud-lab
export TG_GO_VERSION="$(jq -r '.go.version' ../../packaging/build-inputs.json)"
docker compose up -d          # builds mint, mint-fees (100 ppk) and upstream
docker compose run --rm client -q test_swap_fees.py ; echo EXIT=$?   # or -sv for full output

Expected: 5/5 pass. Actual: 4 passed, 1 failed with the allotment assertion above.

Docker-29 caveat: if the client image fails to build (failed to parse stage name "golang:-bookworm"), apply the Dockerfile.client ARG fix from the companion issue first.

Troubleshooting guide

  1. First hypothesis — test isolation / accumulation: the paying client in the failing test is c6:a5:b8:02:91:1e. Check whether earlier tests in the same session reuse that MAC and whether allotment in the session event is a per-payment grant or a session TOTAL (renewal accumulation). 199 = 100 + 99 is suspiciously close to "this payment plus an earlier 99-step grant".
    • Repro A (isolation): run only the one test — docker compose run --rm client -q test_swap_fees.py::TestSwapFees::test_fee_mint_payments_do_not_break_the_free_mint_path — if it passes alone, the bug is state leakage between tests (shared MAC, wallet not reset, or the session renewal math accumulating across payments).
    • Repro B (unit seam): the allotment math lives in src/upstream_session_manager/ (usage trackers, renewal thresholds) and src/merchant/ (session event emission). Look at where the kind-1022 event's allotment tag is computed for a SECOND payment by the same MAC.
  2. Second hypothesis — fee-path contamination of the free path: the test's premise is that paying the free mint while the wallet ALSO knows the 100-ppk fee mint must not change the free grant. If the fee-resolution logic (per #440/#447-era work) applies a fee-derived step count or renewal top-up to the free path, you'd see inflated grants. Compare the wallet's credited amount for the free-mint token before/after the fee-mint tests ran.
  3. What 99 would mean: if an earlier test granted 99 steps (or a renewal added 99), find the emitter of that grant and why the free-path payment sees it merged.

Fix hints

  • If accumulation-by-design: the session event should either report per-payment allotment or the test should assert on the delta — but get the PRODUCT answer first: is allotment specified as total-session or per-payment? The wire spec (OpenTollGate/tollgate) is the authority.
  • If leakage: reset the client MAC between tests or drain the session in the fixture.

References

  • Lane docs: tests/cloud-lab/README.md (tg-mint-fees, swap-fee expectations)
  • Fee-math history: #409 (below-swap-fee pre-check), #440/#447 (fee error classification)
主要言語
Go
スター
12
フォーク
14
平均マージ
1日 6時間
マージ済み PR(30日)
217

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenTollGate/tollgate-module-basic-go のほかの issue

OpenTollGate/tollgate-module-basic-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。