Skip to content
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 token properties and nesting weights #1007

Merged
merged 13 commits into from
Oct 13, 2023

Conversation

mrshiposha
Copy link
Contributor

No description provided.

primitives/common/src/constants.rs Outdated Show resolved Hide resolved
<SelfWeightOf<T>>::set_token_properties(amount)
write_token_properties_total_weight::<T, _>([amount].into_iter(), |amount| {
<SelfWeightOf<T>>::load_token_properties()
+ <PalletStructure<T>>::find_parent_weight(MAX_NESTING_BUDGET)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так делать некорректно, поскольку в common интерфейсы нам попадает уже budget, так было бы правильно если бы мы его тут (в common интерфейсе) конструировали

Copy link
Member

@CertainLach CertainLach Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Возможно имеет смысл бюджет сделать generic, чтобы было более понятно какие веса нужно для каких бюджетов использовать, и чтобы нельзя было его использовать не в тех местах?

enum NestingKind {}

dyn Budget<NestingKind>

И будет по коду логично что у нас для инициализации Budget<NestingKind> нужно в weight забрать nesting_weight(N)

@mrshiposha mrshiposha force-pushed the fix/token-properties-benchmarks branch from b270b77 to 85147ac Compare October 10, 2023 16:17
@mrshiposha mrshiposha changed the title Fix/token properties benchmarks Fix token properties and nesting weights Oct 10, 2023
@mrshiposha mrshiposha force-pushed the fix/token-properties-benchmarks branch from 87f24e8 to 2ba6495 Compare October 11, 2023 14:09
@mrshiposha mrshiposha force-pushed the fix/token-properties-benchmarks branch from 2d2a945 to a46c1bd Compare October 13, 2023 10:39
@mrshiposha mrshiposha marked this pull request as ready for review October 13, 2023 10:40
pallets/nonfungible/src/common.rs Outdated Show resolved Hide resolved
pallets/refungible/src/common.rs Outdated Show resolved Hide resolved
@@ -158,6 +130,16 @@ impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
}
}

pub(crate) fn mint_with_props_weight<T: Config>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может вообще заинлайнить этот метод?) В nonfungible тоже

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется мне что для эфира будет читабельнее вместо CommonWeights везде использовать газомер...
Но допустим пока так.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Минтинг refungible намного лучше выглядел бы через бюджеты

@CertainLach CertainLach merged commit 71be677 into develop Oct 13, 2023
11 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants