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

Use BoundedVec's #55

Merged
merged 5 commits into from
Feb 23, 2024
Merged

Use BoundedVec's #55

merged 5 commits into from
Feb 23, 2024

Conversation

benoitdevos
Copy link
Contributor

Content

  • Enforce that all storage match MaxEncodedLen - essentially by replacing Vec with BoundedVec.
  • Enable compilation without #[pallet::without_storage_info].
  • Config has been completed with possibility to choose an actual bound for each BoundedVec.

⚠️ Attention points

  • A migration is provided for info - it fails to complete within 2 sec and therefore should not be wired in the node.
  • The configurable type MaxLocMetadata, MaxLocFiles and MaxLocLinks do require to implement TypeInfo (in the mock and the node, which is quite unusual). There is likely a cleaner way to achieve the same result (use another type ?).
parameter_types! {
	#[derive(TypeInfo)]
	pub const MaxLocMetadata: u32 = 50;
	#[derive(TypeInfo)]
	pub const MaxLocFiles: u32 = 50;
	#[derive(TypeInfo)]
	pub const MaxLocLinks: u32 = 50;
	...
} 

Out-of-scope

  • IdentityLocLocsMap and OtherAccountLocsMap seem to be useless, as well as some other maps. The removal of those useless maps is out of the scope of the present PR, so they were updated to use BoundedVec - but not fully tested against overflow condition.
  • The actual migration will be provided in a distinct PR.

logion-network/logion-internal#488

Copy link
Contributor

@gdethier gdethier left a comment

Choose a reason for hiding this comment

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

Great job, thanks!

@benoitdevos benoitdevos merged commit 796976a into main Feb 23, 2024
1 check passed
@benoitdevos benoitdevos deleted the feature/bounded-vec branch February 23, 2024 08:46
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