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

Heuristics tests are altered to panic with multiple results #4252

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Lazark0x
Copy link
Member

Resolves #4246

@Lazark0x Lazark0x added the A0-pleasereview PR is ready to be reviewed by the team label Sep 24, 2024
@Lazark0x Lazark0x linked an issue Sep 24, 2024 that may be closed by this pull request
@Lazark0x Lazark0x self-assigned this Oct 1, 2024
pub parachain_read_heuristic: CostOf<GearPagesAmount>,
}

impl<T: pallet_gear::Config> From<MemoryWeights<T>> for PagesCosts {

Choose a reason for hiding this comment

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

btw we already have gear_core::costs::LazyPagesCosts. mb reuse it here?

impl<T: Config> From<MemoryWeights<T>> for LazyPagesCosts {

Choose a reason for hiding this comment

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

we could add the missing fields (from MemoryWeights<T>) to gear_core::costs::LazyPagesCosts and reuse that for both gtest and these checks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

That way LazyPagesCosts become not actually costs of lazy pages. wdyt @grishasobol ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think we need a more generic name for the structure? @breathx

};
}

let expectations = vec![
Copy link
Member

Choose a reason for hiding this comment

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

It'd be great also to have some check of missing variants

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, added checks for the number of fields to be checked

@breathx breathx added the A3-gotissues PR occurred to have issues after the review label Nov 4, 2024
@breathx breathx removed the A0-pleasereview PR is ready to be reviewed by the team label Nov 5, 2024
@Lazark0x Lazark0x added A0-pleasereview PR is ready to be reviewed by the team and removed A3-gotissues PR occurred to have issues after the review labels Nov 5, 2024
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

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

lgtm, Im only aware of naming for lazy pages costs, waiting for additional opinions here

use sp_runtime::AccountId32;

#[cfg(feature = "dev")]
use frame_support::traits::StorageInstance;
Copy link
Member

Choose a reason for hiding this comment

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

pls move everything into module. runtime/vara/tests is general testing module. so all "utils" like `WeightExpectation' should be somewhere else. keep here tests only

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview PR is ready to be reviewed by the team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor(tests): Improve UX of runtime heuristics tests
3 participants