Skip to content

Possible underfunded issues #784

@tcharchian

Description

@tcharchian

Problem

Much of the Gonka system depends on funds being moved in and out of "escrow", which is stored in the types.ModuleName ("inference") account (the "module account"). Payments for inferences are moved here as well as money for rewards. There are also (possibly) movement from or to other module accounts (such as collateral, governance and streamvesting).

There are unlikely but possible scenarios that might result in these account having insufficient funds.

We would like to solve this problem comprehensively rather than piecemeal.

Tasks need to be done in order.

Task 1: Analysis

This means going through and finding every place where payouts might result in insufficient funds, and defining and understanding current behavior when this happens.

Task 2: Important fixes

This means making sure that in each instance of these possible failures that no critical errors will occur. This means (in order of priority):

  1. No possible exploit to gain un-earned funds
  2. No consensus failures (panics during EndBlock, for instance)
  3. No panics during a message transaction (rather, they should return an error for deterministic rollback)

Task 3: Standardize handling

This is fairly open ended, but the end goal is to have the behavior for an unfunded event to be consistent and logical across scenarios and accounts. Principles should be clearly outlined and exceptions that need to conform with the policy should be fixed.

Task 4: Prevent future failures

This is also open ended, but some mechanism should clearly make it so no new behavior will violate the outcome of Task 3. Methods available:

  1. Unit test failures (that may include searching files or using the AST)
  2. Static checks (similar to the current use of forbidigo to prevent calls to panic or Must)
  3. AI guidelines - explicit, reliable AI guidelines that can be added to the ai-review tool gonka-ai/ai-review

Any other method, as long as it serves the purpose, would work.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Needs review

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions