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
fix vault rewards module tests #1088
Conversation
fixes boil down to: * using `evm_setNextBlockTimestamp` instead of just `fastForward` within `fastForwardTo`-- ensures exact timestamp is delivered * recognition that `evm_mine` always causse the block timestamp to incraese by 1 second, so we should be able to account for this in the test to get the exact time also btw the refactoring of these tests was not exactly the same as before, which is part of the reason why the tests were failing when they succeeded before
Codecov Report
@@ Coverage Diff @@
## main #1088 +/- ##
=======================================
Coverage 97.12% 97.12%
=======================================
Files 58 58
Lines 1044 1044
Branches 69 69
=======================================
Hits 1014 1014
Misses 30 30
Flags with carried forward coverage won't be shown. Click here to find out more. 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
@@ -21,13 +21,9 @@ export async function fastForward(seconds: number, provider: ethers.providers.Js | |||
} | |||
|
|||
export async function fastForwardTo(time: number, provider: ethers.providers.JsonRpcProvider) { | |||
const now = await getTime(provider); | |||
await provider.send('evm_setNextBlockTimestamp', [time]); |
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.
Nice! didn't know about evm_setNextBlockTimestamp
👏
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.
these docs are very helpful https://book.getfoundry.sh/reference/anvil/?highlight=time#supported-rpc-methods
fixes boil down to:
evm_setNextBlockTimestamp
instead of justfastForward
withinfastForwardTo
-- ensures exact timestamp is deliveredevm_mine
always causse the block timestamp toincraese by 1 second, so we should be able to account for this in the test to get
the exact time
also btw the refactoring of these tests was not exactly the same as
before, which is part of the reason why the tests were failing when they
succeeded before