-
Notifications
You must be signed in to change notification settings - Fork 91
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
Pallet pools registry #974
Conversation
@gruberb do we have a timeline to get this merged? |
This will be a bigger change. In the first version, we are aiming to move out the Do you have a pressing issue which requires this change to be done sooner? |
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.
Just a first look at formal stuff. Cargo and license. In general everywhere license on top ^^
Are we planning on bringing this in in this state and iterate over it? |
It depends... the full re-write on bringing So one idea from @offerijns was to have a first step, have the events and the first extrinsics in |
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, I have a few questions, but nothing blocking :)
assert_eq!(pool.parameters.min_epoch_time, SECS_PER_DAY); | ||
assert_eq!(pool.parameters.max_nav_age, SECS_PER_HOUR); | ||
} | ||
// create { |
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 think it would be nice to have a comment explaining why this section is here but commented out, but I'm fine with it as is.
@gruberb I would like to review this before it gets merged. Can I do that today or Monday? |
Sorry, yes, this could be back in Draft. I am currently updating the tests, and then it could be merged. So yeah, Monday/Tuesday is totally fine, hope to get this in by Wednesday next week! |
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.
First pass mostly with a bunch of small naming/comments changes
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.
Left some comments where changes are needed. I would also not bring in the weight changes with this PR. We should have a separate PR for updating the weights of the runtimes. WDYT?
pub pool_admin: PoolAdminRoles, | ||
pub currency_admin: CurrencyAdminRoles, | ||
pub permissioned_asset_holder: PermissionedCurrencyHolders<Now, MinDelay, Moment>, | ||
pub tranche_investor: TrancheInvestors<Now, MinDelay, TrancheId, Moment>, |
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.
Why do we need them public? Not against it, just curious and wondering if we should make it an API with methods on the struct rather than making them public.
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.
It's all because we have cfg-types
and cfg-traits
. Inside cfg-traits
, we depend on cfg-types
. To prevent a circular dependency, we can't rely on cfg-traits
inside cfg-types
. Which moves the impl traits
out of types
and into traits
. We need to test the impl functions
inside traits
.
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 don't know if my answer makes sense. I also don't like, but for how we currently structure everything, it's hard not to make them public (with testing and everything).
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.
At the current commit of main. There is solely a dev dependency that is not even used. I am not sure, where the issue came from. But I think we can agree, that traits
is stand alone and types can depend on traits and implement them.
Yeah, I test ran the weights to see if they are working. Reverted them back to the previous values 👍 |
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
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.
We need to rethink about this restructuring made here. And I have the feeling this is too rushed to bring this in in this state.
pub pool_admin: PoolAdminRoles, | ||
pub currency_admin: CurrencyAdminRoles, | ||
pub permissioned_asset_holder: PermissionedCurrencyHolders<Now, MinDelay, Moment>, | ||
pub tranche_investor: TrancheInvestors<Now, MinDelay, TrancheId, Moment>, |
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.
At the current commit of main. There is solely a dev dependency that is not even used. I am not sure, where the issue came from. But I think we can agree, that traits
is stand alone and types can depend on traits and implement them.
impl TrancheCurrency<PoolId, TrancheId> for TrancheCurrencyT { | ||
fn generate(pool_id: PoolId, tranche_id: TrancheId) -> Self { | ||
Self { | ||
pool_id, | ||
tranche_id, | ||
} | ||
} | ||
|
||
fn of_pool(&self) -> PoolId { | ||
self.pool_id | ||
} | ||
|
||
fn of_tranche(&self) -> TrancheId { | ||
self.tranche_id | ||
} | ||
} | ||
|
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 must not be 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.
The problem started when we moved pub trait PoolMutate<...
into cfg-traits
. This trait depends on TrancheInput
and PoolChanges
. Therefore, we need to depend on cfg-types
inside cfg-traits
.
Self::deposit_event(Event::UpdateRegistered { pool_id }); | ||
|
||
match state { | ||
UpdateState::NoExecution => (), |
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.
When would this happen? And what does this signal?
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.
Well if we do a Result<(UpdateState, PostDispatchInfo), DispatchErrorWithPostInfo>
from fn update()
, we need this. We have three different valid returns in this function, NoExecution
is one of them. We also return this weight if we don't execute (if nothing changed):
Some(T::WeightInfo::update_no_execution(0)).into(),
match T::ModifyPool::execute_update(pool_id) { | ||
Ok(res) => { | ||
Self::deposit_event(Event::UpdateExecuted { pool_id }); | ||
Ok(res) | ||
} | ||
Err(e) => Err(e), | ||
} |
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.
T::ModifyPool::execute_update(pool_id).map(|res| {
Self::deposit_event(Event::UpdateExecuted { pool_id });
res
})
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.
We really want inspect
, but alas it's not stable yet rust-lang/rust#91345
impl<T: Config> | ||
PoolMutate< | ||
T::AccountId, | ||
T::Balance, |
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.
There is an impl
file for trait impls.
Decided that the last changes into |
Closes #956