-
Notifications
You must be signed in to change notification settings - Fork 88
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
Loans: Integration with OracleV2 #1658
Conversation
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.
What a PR. Almost 1000 LoC removed!
I would still change the runtime configs/or add additional docs, otherwise good.
parameter_types! { | ||
pub const MaxActiveLoansPerPool: u32 = 300; | ||
pub const MaxRateCount: u32 = MaxActiveLoansPerPool::get(); | ||
pub const MaxCollectionSize: u32 = MaxActiveLoansPerPool::get(); | ||
pub const MaxRateCount: u32 = 300; // See #1024 |
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.
@lemunozm briefly looked at the issue, but why does this now not need to be bound by the maximum number of active loans per pool? Shouldn't that still be the upper limit?
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.
Ahh, I see. I would still set it to MaxActiveLioansperpool
to not misconfigure it accidently, wdyt?
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 forget to comment on that!
As far as I know, MaxRateCount
should be greater than MaxActiveLoansPerPool
. If not, if one pool reaches MaxActiveLoansPerPool,
there are no more rates available for other pools. That's why I maintain the value (by now) but disassociate it from MaxActiveLoansPerPool
.
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've comment this into issue #1024 to track this change
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.
IIRC we restrict the rate to be between 100.00 and 0, so we have a max amount of rates equal to 10001.
What would be the weight of that? Shouldn't we just allow that maximum?
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.
Ohh, I didn't think about that inherent limitation from the rate limitation.
Then, yes, we can use that value if we're sure that computing a pow over 10000 elements does not exceed the block limit. We would need to perform a benchmark first.
I would go with this for another PR, where we first make a benchmark for the worst case. Do you agree? Actually, it can be an update for the #1024 issue.
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.
Idea:
We can even create an utility method for it, which can be called from the runtime as follows:
type MaxCountRate = InterestAccrual::get_max_rate_count(0.25, MAXIMUM_BLOCK_WEIGHT)
returning the exact value to not overpass the 25% of the block limit.
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.
That would be great!! Agreed with all above!
Thanks for your review @mustermeiszer in your free time! |
Description
This PR makes loans to use OracleV2.
Changes and Descriptions
pallet-loans
with the new one.DataFeeder
andDataProvider
from orml traits and simplify loan benchmarkspallet-loans
utilitiesValueProvider
implementation under runtime-benchmarks for pallet-oracle-data-collection in order to set benchmarking states using the feeder. (required for loans or users ofDataRegistry
traits)Migration(we do not have storage in Centrifuge/Altair) 🥳pallet-data-collector
code from database