Skip to content

Move cycles from share service#100

Merged
patnorris merged 6 commits intofutureReleasefrom
moveCyclesFromShareService
Jan 7, 2026
Merged

Move cycles from share service#100
patnorris merged 6 commits intofutureReleasefrom
moveCyclesFromShareService

Conversation

@patnorris
Copy link
Copy Markdown
Contributor

No description provided.

@patnorris patnorris requested a review from icppWorld October 29, 2025 14:31
Comment thread src/mAIner/src/Main.mo Outdated
// Send via system API
D.print("Challenger: sendCyclesToOperatorAdmin - calling system API to send cycles");
let deposit_cycles_args = { canister_id : Principal = Principal.fromText(OPERATOR_WALLET_ADDRESS); };
let _ = ignore IC0.deposit_cycles(deposit_cycles_args);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave it as is, with ignore, but I wanted to highlight we sometimes use await.

Not sure what is best, maybe ignore is best, because we have seen that await IC0.deposit_cycles can silently fail and stop processing the message.

Comment thread src/mAIner/src/Main.mo Outdated
D.print("Challenger: sendCyclesToOperatorAdmin - calling system API to send cycles");
let deposit_cycles_args = { canister_id : Principal = Principal.fromText(OPERATOR_WALLET_ADDRESS); };
let _ = ignore IC0.deposit_cycles(deposit_cycles_args);
D.print("Challenger: sendCyclesToOperatorAdmin - deposit_cycles successful");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But when using ignore, we can not claim yet the deposit_cycles was successful.
Maybe just log explicity: deposit_cycles called with ignore, so we know from looking at the logs what we did.

Comment thread src/mAIner/src/Main.mo Outdated

// Share Service: Move cycles to operator's wallet (e.g. onicai)
stable let OPERATOR_WALLET_ADDRESS : Text = "jh35u-eqaaa-aaaag-abf3a-cai";
stable var cyclesTransactionsStorage : List.List<Types.CyclesTransaction> = List.nil<Types.CyclesTransaction>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably still fine, but this list is growing in every canister.
Shall we plan on adding the cyclesTransactionsStorage to the archiving logic?

Applies to GameState, Challenger, Judge, mAInerCreator, ShareService

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as these are very small entries and there won't be many (as we trigger this manually from time to time), I think it's fine

Comment thread src/mAIner/src/Main.mo Outdated
try {
// Only move cycles if cycles balance is big enough
if (currentCyclesBalance - CYCLES_AMOUNT_TO_OPERATOR < MIN_CYCLES_BALANCE) {
D.print("Challenger: sendCyclesToOperatorAdmin - requested cycles transaction but balance is not big enough: " # debug_show(currentCyclesBalance) # debug_show(msg));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refers to "Challenger"
Several lines here

@patnorris patnorris marked this pull request as ready for review October 31, 2025 10:03
Base automatically changed from releases/mozart to main November 11, 2025 11:53
@patnorris patnorris changed the base branch from main to futureRelease January 7, 2026 14:35
@patnorris patnorris merged commit bbbd60c into futureRelease Jan 7, 2026
@patnorris patnorris deleted the moveCyclesFromShareService branch January 7, 2026 14:36
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.

2 participants