Skip to content

Conversation

teor2345
Copy link
Member

This PR adds alerts whenever an important account signs an extrinsic or initiates an event.

It also de-duplicates alerts, using this priority order:

  • sudo/sudid
  • large balance transfer
  • force balance transfer
  • important address transfer
  • important address (any other extrinsic or event)

Other alert kinds don't need de-duplication.

This de-duplication covers most of ticket #18, but we still need to combine alerts between an extrinsic and its events. (Currently, extrinsics and events don't participate in alert de-duplication, because the logic is more complicated than a priority order.)

How to review

Commit ca21716 is pure code movement, and should be reviewed separately.

@teor2345 teor2345 self-assigned this Sep 25, 2025
@teor2345 teor2345 added bug Something isn't working enhancement New feature or request labels Sep 25, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Comment @cursor review or bugbot run to trigger another review on this PR

} else {
who.into_iter().next().map(Account::Signer)
}
}
Copy link

Choose a reason for hiding this comment

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

Bug: Event Handling Fails on Multiple Initiators

The EventInfo::initiator_account method uses unreachable!() if an event contains multiple 'who' accounts. This assumes a strict event structure that external blockchain data may not always uphold, potentially causing the alerter to panic and crash. This approach also goes against the codebase's pattern of gracefully handling unexpected blockchain data.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

This is technically true, if the event is being deserialized from an array of tuples. But events are almost always structs, so duplicate names are unlikely to happen in practice:
https://docs.rs/scale-value/0.18.0/scale_value/enum.Composite.html

But just in case I'll fix this over the next few days.

Not a blocker for merging.

clostao
clostao previously approved these changes Sep 25, 2025
Copy link
Member

@clostao clostao left a comment

Choose a reason for hiding this comment

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

LGTM

@teor2345
Copy link
Member Author

Updated with the "multiple who" account fix, time to merge.

@teor2345 teor2345 added this pull request to the merge queue Sep 26, 2025
Merged via the queue into main with commit 8e71792 Sep 26, 2025
18 checks passed
@teor2345 teor2345 deleted the sudo-actions branch September 26, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants