-
Notifications
You must be signed in to change notification settings - Fork 7
Feature/modular testing natspec #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/modular testing natspec #150
Conversation
alexkeating
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start, left a few comments!
| /// Simulates calling notify function on MintRewardNotifier. | ||
| /// @title MintRewardNotifierTestBase | ||
| /// @author [ScopeLift](https://scopelift.co) | ||
| /// @notice Base contract for testing `MintRewardNotifier` functionality. Extends `StakerTestBase` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// @notice Base contract for testing `MintRewardNotifier` functionality. Extends `StakerTestBase` | |
| /// @notice Base contract for testing a staker contract with a single mint reward notifier. Extends `StakerTestBase` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a0cac50
Modified other test base comments as well.
| /// @title MintRewardNotifierTestBase | ||
| /// @author [ScopeLift](https://scopelift.co) | ||
| /// @notice Base contract for testing `MintRewardNotifier` functionality. Extends `StakerTestBase` | ||
| /// and provides the necessary setup for the `notify` on `MintRewardNotifier`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// and provides the necessary setup for the `notify` on `MintRewardNotifier`. | |
| /// and implements the necessary notifying a reward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the English phrasing here, so I went with implements the reward notification logic in a0cac50. What do you think?
| /// @notice Base contract for testing `MintRewardNotifier` functionality. Extends `StakerTestBase` | ||
| /// and provides the necessary setup for the `notify` on `MintRewardNotifier`. | ||
| /// @dev This contract is designed to be used in conjunction with the deployment scripts in | ||
| /// `src/script/notifiers/DeployMintRewardNotifier.sol`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't need to use our deployment scripts. They can have their own, but they need to make sure the test contract sets a mintRewardNotifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a0cac50
src/test/StakerTestBase.sol
Outdated
| /// @notice This abstract contract provides a common foundation and essential helper functions for | ||
| /// constructing modular integration tests. It is designed to be inherited by test suites that | ||
| /// verify the functionality of Staker contracts, various reward notifiers and earning power | ||
| /// calculators. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add an example here of what this inheritance will look like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added example here a0cac50, open to feedback!
src/test/StandardTestSuite.sol
Outdated
| /// This includes tests for single and multiple depositors staking and earning rewards | ||
| /// over various timeframes and reward periods. | ||
| /// @dev Inherit this contract to test the fundamental staking and reward accrual logic of a Staker | ||
| /// implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be more specific here which staking logic. It doesn't need to be exhaustive but it may be good to indicate in scenarios of single, multiple stakers, multiple periods etc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also think about this for the other test examples as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more descriptions for all bases in a0cac50
src/test/StandardTestSuite.sol
Outdated
| /// calculated earned rewards. | ||
| /// @param _depositor The address of the staker. | ||
| /// @param _amount The amount of stake tokens to deposit. | ||
| /// @param _delegatee The address to delegate voting power to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
| /// @param _delegatee The address to delegate voting power to. | |
| /// @param _delegatee The address with the stake's voting power. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed all instances of _delegatee in a0cac50
| /// used in conjunction with the deployment scripts in | ||
| /// @notice Base contract for testing `TransferRewardNotifier` functionality. Extends | ||
| /// `StakerTestBase` | ||
| /// and provides the necessary setup for `notify` on `TransferRewardNotifier`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird wrapping here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a0cac50
| /// `StakerTestBase` | ||
| /// and provides the necessary setup for `notify` on `TransferRewardNotifier`. | ||
| /// @dev This contract is designed to be used in conjunction with the deployment scripts in | ||
| /// `src/script/notifiers/DeployTransferRewardNotifier.sol`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add more detail here
…ewardBase, AlterClaimerBase, AlterDelegateeBase to remaining TestBase tests
a0cac50 to
7d33b4b
Compare
…TestBase and DeployStakedBinaryEligibilityOracleEarningPowerCalculatorTestBase
|
Given that |
|
Coverage after merging feature/modular-testing-natspec into feature/modular-testing will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--------- Co-authored-by: Alexander Keating <keating.dev@protonmail.com> Add modular testing natspec (#150) * Add modular testing natspec
--------- Co-authored-by: Alexander Keating <keating.dev@protonmail.com> Add modular testing natspec (#150) * Add modular testing natspec
Fix natspec and remove
setUpinStakerTestBasesetUpinStakerTestBaseand inheriting contracts