Skip to content

Regenerate GameState declarations for notifyMainerTopUp and guard official_topup against the new minimum - #204

Open
icppWorld wants to merge 2 commits into
masterfrom
feat/notify-mainer-topup
Open

Regenerate GameState declarations for notifyMainerTopUp and guard official_topup against the new minimum#204
icppWorld wants to merge 2 commits into
masterfrom
feat/notify-mainer-topup

Conversation

@icppWorld

@icppWorld icppWorld commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Why

Companion to onicai/PoAIW#163, which adds notifyMainerTopUp to GameState. Merge that one first — this PR only carries what lives in this repo.

What

Regenerated GameState declarations (dfx generate game_state_canister). The interface diff is three added service lines and zero new type definitions:

  • notifyMainerTopUp and resolveMainerByPrefixAdmin — from PoAIW#163
  • isCallerMainerOwnedBynot from this work. It was added to GameState in PoAIW 50109b4 (the remove mAIner owners as canister controllers change), but the declarations in this repo were never regenerated at the time, so they sat one method behind until now. Nothing consumed it — no caller exists in the frontend or scripts — which is why the gap was invisible. Additive and harmless; running dfx generate in CI would keep the two repos in step automatically.

scripts/official_topup.py — guarded against the new protocol minimum. GameState now rejects unauthenticated top-ups below 0.09 ICP, and this script pays first and redeems second, so an undersized payment would strand ICP as a paid-but-unredeemable block — landing in the script's own "PAID but redeem FAILED" branch.

  • ICP_GRANULARITY 0.05 → 0.1. It is also the smallest auto-sized payment (icp_needed_for floors at it), so at 0.05 a small shortfall would have sized a payment the protocol then refuses.
  • A pre-transfer guard rejecting any e8s < 9_000_000, naming the minimum, so a manual --icp below it fails before any funds move.

This matters most in exactly the situation the script exists for: rescuing a mAIner whose upgrade failed, where the direct deposit_cycles route burns 90% of the top-up.

Verification

The declarations were regenerated and diffed; the interface change is purely additive. The script changes are covered by the end-to-end suite in PoAIW#163, which drives pay_topup.py against a local replica with a real ICP ledger.

Nothing here was run against a mainnet network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant