Skip to content

Linter: Warn when number primitive annotated with #[ink(topic)] #1436

@cmichi

Description

@cmichi

The #[ink(topic)] annotation enables third party tooling to filter for "topics" ‒ discrete events for which it makes sense to filter. Typical examples where this can make sense are AccountId, bool or enum variants.

It typically doesn't make sense to annotate types like u32 or i32 as a topic, if those fields can take continuous values that could be anywhere between ::MIN and ::MAX. An example of a case where it doesn't make sense at all to have a topic on the storage field is something like value: Balance.

We should provide a linter rule that warns developers when they annotate a number primitive with #[ink(topic)].

Metadata

Metadata

Assignees

Labels

A-linterIssue regarding the ink! linter.B-feature-requestA request for a new feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions