refactor: batch updating of asset team#869
refactor: batch updating of asset team#869rflechtner merged 3 commits intobonded-coins-audit-fixesfrom
Conversation
ntn-x2
left a comment
There was a problem hiding this comment.
Makes sense to enforce this within the pallet. This must be mentioned somewhere in the docs tho.
I updated the extrinsic's description, is there any other place where the change should be documented? I don't think we have actual docs for this pallet rn. |
|
No I think that's all there is for now. |
| /// the pool is larger than `currency_count`. | ||
| /// - Other errors depending on the types in the config. | ||
| #[pallet::call_index(1)] | ||
| #[pallet::weight(T::WeightInfo::reset_team())] |
There was a problem hiding this comment.
| #[pallet::weight(T::WeightInfo::reset_team())] | |
| #[pallet::weight(T::WeightInfo::reset_team(currency_count.to_owned()))] |
I'm realising this needs to be changed, but in order for this to work it seems that I'd have to re-run benchmarks? I'll definitely need guidance for that, I have never done this before.
There was a problem hiding this comment.
Yes, that is correct. I think it would make sense to tackle benchmarks in a separate PR tho at the end of all changes, since benchmarking itself has some "fixed costs" which we could lower if we were to batch all changes into one benchmarking operation.
There was a problem hiding this comment.
But in general, what you would need to do, is to pre-populate the storage with as many pools as the theoretical maximum, and then use the range of possible inputs to pass to the extrinsic. You can see an example of it for the create_pool_polynomial benchmark here:
reset_team(N). That should be enough.
There was a problem hiding this comment.
I'm not sure I understand, 701410c already makes changes in line with the snippet you linked to, but I still can't make the change I suggested in #869 (comment) because default_weights.rs has not been updated (the compiler complains that this function takes 0 arguments but 1 argument was supplied). Should I just manually mess around in the default_weights.rs for now until it compiles, even though it's an autogenerated file?
There was a problem hiding this comment.
Just leave the previous weight for now. Once the new benchmarks are run, the pallet will complain that it now requires one parameter, and then you can fill in the result of the benchmarks. Sorry I did not see the commit you previously linked. But yeah, just leave the old weight for the extrinsic. As soon as the new benchmarks are run, the code won't compile and you will update that. As a temporary solution, you COULD also update the weight file, since it will be overwritten anyway upon new benchmarks, but I would not recommend that.
fixes https://github.com/KILTprotocol/ticket/issues/3801
Changes the
reset_teamextrinsic to perform batch updates in order to avoid that asset management teams differ between assets of one pool.Recommended by auditors and desired by our team - see linked ticket.
TBD
Checklist:
array[3]useget(3), ...)