swap-fees: free-mint path grants 199 steps for 100 paid (allotment 11,940,000 ms vs 6,000,000 expected)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
調査の方向性
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-labdocker 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
- 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 whetherallotmentin 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) andsrc/merchant/(session event emission). Look at where the kind-1022 event'sallotmenttag is computed for a SECOND payment by the same MAC.
- Repro A (isolation): run only the one test —
- 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.
- 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
allotmentspecified 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenTollGate/tollgate-module-basic-go のほかの issue
-
go-battery needs an ndsctl on PATH: TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow fails on bare hosts (passes with stub)対応中かも @Amperstrand が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenTollGate/tollgate-module-basic-go#726 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
rebrand-literal-gutter: uhttpd section-vocabulary check trips on a COMMENT (uhttpd.luci in 92-tollgate-admin-setup:178)対応中かも @Amperstrand が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenTollGate/tollgate-module-basic-go#723 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
OpenTollGate/tollgate-module-basic-go#768 ·
メンテナーはふだん 1 日以内に返信
-
Four drift fences for tests/contract/ (+ test.yml clean-container lane + pre-commit wiring)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
OpenTollGate/tollgate-module-basic-go#767 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
OpenTollGate/tollgate-module-basic-go#763 ·
メンテナーはふだん 1 日以内に返信
OpenTollGate/tollgate-module-basic-go の issue をすべて見る
似ている issue
-
enhancement exporter/awss3 needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
open-telemetry/opentelemetry-collector-contrib#51905 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area/docs theme/validation
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
a11y P1-significant
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[correctness][missing-coverage][sort] Strict uniqueness checks lack numeric-key equivalence coverageオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
infiniflow/ragflow#20625 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信