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)].
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 areAccountId,boolorenumvariants.It typically doesn't make sense to annotate types like
u32ori32as a topic, if those fields can take continuous values that could be anywhere between::MINand::MAX. An example of a case where it doesn't make sense at all to have a topic on the storage field is something likevalue: Balance.We should provide a linter rule that warns developers when they annotate a number primitive with
#[ink(topic)].