Skip to content

Mainer inactivity rules#107

Merged
patnorris merged 9 commits intofutureReleasefrom
mainerInactivityRules
Jan 7, 2026
Merged

Mainer inactivity rules#107
patnorris merged 9 commits intofutureReleasefrom
mainerInactivityRules

Conversation

@patnorris
Copy link
Copy Markdown
Contributor

No description provided.

@patnorris patnorris requested a review from icppWorld November 11, 2025 14:19
@patnorris patnorris changed the base branch from main to futureRelease November 11, 2025 14:23
Comment thread src/mAIner/src/Main.mo
private func handleMainerStatusAfterTopup() : Bool {
switch (mainerStatus) {
case (#Active) { return true; };
case (#Inactive) {
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.

Do we always want to return it back to Active status, or does the cycle balance need to go above the threshold first ?

Else it will just start cycling InActive > Active until next timer trigger > InActive

And the frontend will show all is ok until the next timer trigger while it is not.

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.

Keeping this responsibility on sufficientCyclesToProcessChallenge and thus in one place seems good to me

Comment thread src/mAIner/src/Main.mo Outdated
switch (List.last<Types.MainerStatusEntry>(mainerInactiveEntries)) {
case (null) {}; // Continue
case (?earliestInactiveEntry) {
let mainerInactivityStateGracePeriod : Nat64 = 7 * 24 * 60 * 60 * 1_000_000_000; // 7 days in nanoseconds
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.

What about making this a setting, global to the mAIner module, and make it dependent on the mAIner type?
Right now, we have the types:

  • #ShareAgent
  • #Own

And most likely I will propose to either rename Own or just create another type:

  • #PowerMainer

The main difference between the ShareAgent & PowerMainer will be these settings.

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.

I made it a function that returns a value based on the agent type (getMainerInactivityStateGracePeriod); I think a setting updateable by a controller could be attacked (to get around the rules)

Comment thread src/mAIner/src/Main.mo Outdated
switch (List.last<Types.MainerStatusEntry>(mainerCollapsingEntries)) {
case (null) {}; // Continue
case (?earliestCollapsingEntry) {
let mainerCollapsingStateGracePeriod : Nat64 = 14 * 24 * 60 * 60 * 1_000_000_000; // 14 days in nanoseconds
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.

Same question as above, to make this a mAIner type dependent global setting.

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.

I made it a function that returns a value based on the agent type (getMainerCollapsingStateGracePeriod); I think a setting updateable by a controller could be attacked (to get around the rules)

@patnorris patnorris marked this pull request as ready for review January 7, 2026 14:36
@patnorris patnorris merged commit 5984fb7 into futureRelease Jan 7, 2026
@patnorris patnorris deleted the mainerInactivityRules branch January 7, 2026 14:37
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