-
Notifications
You must be signed in to change notification settings - Fork 66
Feature: Update all capital pool unit tests to use ethers instead of truffle/web3 #584
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: Update all capital pool unit tests to use ethers instead of truffle/web3 #584
Conversation
const PoolAddressParamType = { | ||
swapOperator: hex('SWP_OP'), | ||
priceFeedOracle: hex('PRC_FEED'), | ||
swapOperator: hex('SWP_OP'.padEnd(8, '\0')), |
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.
This was reverting without the 0 padding. I wasn't sure if the other ones were ok, so I added it to the others also.
98c88af
to
f165501
Compare
contracts/modules/capital/Pool.sol
Outdated
|
||
// Transfer cover assets. Start from 1 (0 is ETH) | ||
uint coverAssetsCount = coverAssets.length; | ||
uint coverAssetsCount = coverAssets.length; // substract 1 as ETH is skiped |
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.
typo skiped -> skipped
Also you are starting with an index of 1 below so it seems to me you shouldn't substract for ETH to be skipped. and you actually don't so the comment is misleading
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.
Oh nice catch! Yup that comment didn't get deleted from the old code. Will fix that today.
} | ||
|
||
|
||
constructor ( |
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 constructor is quite complex now.
It deserves its own unit test at this point
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.
Yea I agree on this point. I wanted to update to ethers before writing the tests though, so maybe I will add them to the PR this is merged into?
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.
oh yeah sure where it make sense
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.
let's do this in the other PR right
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.
small change requests, mainly to add a dedicated constructor unit test
d72e2ba
to
e12a1d0
Compare
e12a1d0
to
7473aaf
Compare
const { firstActiveTrancheId, maxTranche } = await getTranches(daysToSeconds(0), DEFAULT_GRACE_PERIOD); | ||
|
||
const tranches = Array(maxTranche - firstActiveTrancheId + 1) | ||
const tranches = Array(maxTranche - firstActiveTrancheId) |
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.
Not sure why this broke during this PR, but the StakingPool was reverting on this test when using 8 tranches. The js variable firstActiveTrancheId
isn't the current firstActiveTrancheId in the contract, but is the first one available for this deposit, relative to period
and gracePeriod
. It was iterating past the max active tranches for this reason.
@@ -0,0 +1,45 @@ | |||
// Used for generic compiler inserted panics. | |||
const COMPILER = 0x00; |
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.
assuming these were not defined anywhere in ethers
great work on having them 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.
LGTM good cleanup
some minor comment
Context
No ticket number for this one.
Changes proposed in this pull request
I noticed the pool unit tests were still using truffle/web3 so I updated them before writing more tests in the upgrade-capital-pool PR
Test plan
No tests were added
Checklist
Review
When reviewing a PR, please indicate intention in comments using the following emojis: