Skip to content

fix: Add check for own address in SwitchReporter#1002

Draft
SillyZir wants to merge 1 commit intotellor-io:mainfrom
SillyZir:auto-fix/991
Draft

fix: Add check for own address in SwitchReporter#1002
SillyZir wants to merge 1 commit intotellor-io:mainfrom
SillyZir:auto-fix/991

Conversation

@SillyZir
Copy link
Copy Markdown

@SillyZir SillyZir commented Apr 3, 2026

Summary

Added a validation check in SwitchReporter to prevent a reporter from switching to their own address, which previously caused the reporter to be incorrectly removed from the Reporter store.

Fixes #991

Problem

When a reporter called SwitchReporter with their own address as the destination (self-to-self switch), the function would proceed without error but remove the reporter from the store entirely, effectively deleting their registration instead of blocking the invalid operation.

Solution

Added an early validation check in types/global.go that compares the caller's address against the target address and returns an errors.New error if they match, blocking the self-switch before any store mutations occur. The "cosmossdk.io/math" and sdk imports were reordered, and the "errors" package was added to support the new validation.

Impact

This prevents reporters from accidentally or intentionally deregistering themselves through a self-referential switch, preserving data integrity in the Reporter store and closing a potential griefing vector.

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.

Add check for own address in SwitchReporter

1 participant