Skip to content

Create Generic Integration/Smoke Tests #125

@apbendi

Description

@apbendi

We want to create generic integration/smoke tests that can be easily extended and implemented by downstream consumers of the package. This would allow them to quickly gain confidence in the idea that there specific instance of the Staker, which they have assembled and configured for their needs, will work in the context of existing onchain infrastructure.

The tests should exercise most basic Staking operations, including stake, stakeMore, unstake, distributing & claiming rewards, etc...

The tests should include virtual methods that must be implemented by the downstream consumer such that they can return appropriate values, including in a fork network context.

For example, the tests might require the extender to return an appropriate token:

// Must be implemented by the concrete test instance, can return an existing onchain token in a fork context or deploy a fake token for local runs
function _getStakingToken() public virtual returns (IERC20Votes);

// In the setup method
govToken = _getStakingToken();

// similar pattern for the reward token, etc....

The tests should also include virtual methods for deploying & testing different kinds of calculators & notifiers. Different abstract tests can be inherited together to test different would-be configurations of calculators and notifiers.

  • The tests should be able to execute and be useful in a fork-test environment, where a downstream consumer may be testing their Staker instance against existing onchain infrastructure (like tokens, reward mechanisms)
  • The tests should be able to gracefully handle the situation where the reward token and the stake token are the same
  • Should the test take/execute a deployment script from Create Generic Deploy Scripts #124?
    • Maybe the tests & deployment scripts share some configurable base?
    • Or maybe the test calls the deploy script?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions