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

fix: missing enum variant for StakingOperation. #805

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

raulk
Copy link
Contributor

@raulk raulk commented Mar 16, 2024

Problem

The IPC API module was missing enum variant StakingOperation#SetFederatedPower. The fallback branch of the u8 to enum ended up representing unrecognized ABI values as SetMetadata operations. Consequently, SetFederatedPower commands were being wrongly translated and applied in the subnet gateway as SetMetadata commands.

Solution

Add the missing enum variant and make the conversion typesafe by using try_from. To avoid being pedantic, use num_enum macros. This create was anyway part of the build graph already, so we might as well use it.

Credits

Shoutout to @mikevoronov and @folex from Fluence Labs for finding and reporting this!

Problem

The IPC API module was missing enum variant StakingOperation#SetFederatedPower.
The fallback branch of the u8 to enum ended up representing unrecognized ABI
values as SetMetadata operations. Consequently, SetFederatedPower commands were being
wrongly translated and applied in the subnet gateway as SetMetadata commands.

Solution

Add the missing enum variant and make the conversion typesafe by using try_from.
To avoid being pedantic, use num_enum macros. This create was anyway part of the build
graph already, so we might as well use it.

Credits

Shoutout to @mikevoronov and @folex from Fluence Labs for reporting this!
Copy link

@mikevoronov mikevoronov left a comment

Choose a reason for hiding this comment

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

LGTM

@raulk
Copy link
Contributor Author

raulk commented Mar 16, 2024

Merging this myself, as main is strictly worse off without this fix.

@raulk raulk merged commit e6d39f7 into main Mar 16, 2024
21 checks passed
@raulk raulk deleted the fix/ipc-api-staking-op-incomplete branch March 16, 2024 18:29
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