Skip to content

Use current managers in unversioned/current tests

fishtail requested to merge fishtail/update_tests_current_managers into develop

Resolves #1715 (closed)

This PR updates tests in unversioned files to use the current versions of managers. Several tests were using outdated managers, meaning they were not testing the current behavior that is live on thornodes. Older/versioned managers should still be OK to use in versioned tests or archive tests where old behavior needs to be tested to preserve node sync integrity. A linter has been added to ensure these changes are maintained.

Summary of Changes

Here's a quick summary of the sources of discrepancies where they arose when switching to newer managers.

  • newSlasherV{75,92} -> newSlasherVCUR
    • RUNE is no longer slashed. This reduced the overall slash amount in tests that included RUNE in the transaction.
    • The code path to compute slashing amounts was cosolidated between the older verisons and the current version. RUNE drops out due to an empty pool, which is expected. The new logic also checks the vault for the asset being considered. In the original tests, the code would zero out the stolenAssetValue here because mock vaults were not setup. This PR adds funds to the vaults for the asset being used in tests so that this logic can continue as expected.
    • RuneReimbursementForAssetWithdrawal was replaced with AssetValueInRune, which uses a slightly different approach to computing the RUNE value of any asset, affecting the test constants.
    • These changes explain the changes in constants in the tests.
  • newGasMgrV{81,94} -> newGasMgrVCUR
    • Many tests could simply remove setting up a gas manager without affecting the test. If this was the case, the manager was removed. Otherwise, constants were updated to reflect GasFee changing from 112500 to 75000.
  • newValidatorMgrV95 -> newValidatorMgrVCUR
    • Tests passed without modification
  • newSwapQv58 -> newSwapQueueVCUR
    • Tests passed without modification
  • Misc cleanups
    • Some test checks were changed to use c.Check(obtained, DeepEquals, expected) pattern to simplify the line and improve readability.
  • Linter
    • A go binary linter was added to check the codebase for calls for versioned managers in unversioned tests. This PR should make the linter pass.

Replaces !3405 (closed)

Merge request reports

Loading