Loading
Refactor IsOperationalMimir to constants package
🔎 Visual review off090ce59: explainer, review flags and prompts to ask an AI about the change
Move the logic that classifies a mimir as operational or economic out of the keeper and into the constants package, where the mimir definitions live. The classification rules are unchanged: they are copied over as they were.
Changes:
- Move
IsOperationalMimirfromKVStore(keeper/v1/keeper_mimir.go) to a package-level function inconstants/mimir_strings.go - Remove
IsOperationalMimirfrom theKeeperMimirinterface and from theKVStoreDummyimplementation. The dummy had its own simplified version that only checked HALT, PAUSE and EVMDIRECTERC20INBOUND. Tests now always use the real classification. - Update the callers (
MimirHandler.handleandPurgeOperationalNodeMimirs) to callconstants.IsOperationalMimirdirectly - Update the existing keeper, handler and adv-swap-queue tests to call
constants.IsOperationalMimir. They no longer need to set up a keeper or manager. - Add unit tests in
constants/mimir_strings_test.go. They cover every exact match, both economic exceptions, every partial-match pattern and the SLIPMINBPS suffix, plus case-insensitivity and edge cases.
Benefits:
- Centralized mimir classification logic
- Better separation of concerns, since the classification is a pure function of the key and needs no store access
- Single source of truth for operational/economic determination, with no separate simplified copy in the dummy keeper
- Easier maintenance and clearer code organization
Edited by Huginn Ai