50506 sc insight stakingfacet missing event emission on any unstaking operations

Submitted on Jul 25th 2025 at 14:56:36 UTC by @blackgrease for Attackathon | Plume Network

  • Report ID: #50506

  • Report Type: Smart Contract

  • Report severity: Insight

  • Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/StakingFacet.sol

Summary

The StakingFacet emits events for staking operations (e.g., stake, restake, stakeOnBehalf). However, unstaking operations do not emit the imported Unstaked event. This reduces on-chain transparency and makes it harder to track and monitor unstaking actions.

Description

Affected files: StakingFacet.sol, PlumeEvents.sol

  • Staking actions such as stake, restake, stakeOnBehalf correctly emit events and allow monitoring of staking operations.

  • Unstaking actions do not emit the Unstaked event despite it being imported from PlumeEvents.sol.

Affected unstaking actions:

  • unstake(uint16 validatorId)

  • unstake(uint16 validatorId, uint256 amount)

  • _unstake(uint16 validatorId, uint256 amount)

Example of correct event emission on a staking action:

Impact

This is an Insight under Code Optimizations and Enhancements and Security Best Practices.

Because unstaking operations do not emit an Unstaked event, there is an absence of event logs for those operations. That makes on-chain monitoring and tracking of unstaking actions harder and deviates from common best practices for transparency and observability.

Mitigation

Add an Unstaked event emission in the unstaking logic. The recommended location is inside the internal _unstake function, after the post-unstake cleanup and before returning.

Suggested patch (diff):

Emitting Unstaked in _unstake ensures all entry points that call _unstake will produce the event (both single-argument unstake and the amount-specified overload), keeping on-chain behavior consistent with staking operations.

Proof of Concept

The following snippets demonstrate (1) that Unstaked is imported and (2) that the three unstaking entry points do not emit an Unstaked event. Each snippet includes an @audit-insight marker at the relevant location.

Importing Unstaked from PlumeEvents.sol:

Stepper showing the unstake flows and missing event emissions:

1

unstake(uint16 validatorId)

Note: This external entry point delegates to _unstake and does not itself emit Unstaked.

2

unstake(uint16 validatorId, uint256 amount)

Note: This overload validates the input amount but also delegates to _unstake without emitting Unstaked.

3

_unstake(uint16 validatorId, uint256 amount)

Note: This internal function is the central place to add emit Unstaked(...) so that all callers produce the event.


If you want, I can produce a minimal patch/PR-ready diff to apply this change across the repo (keeping import usage and formatting consistent).

Was this helpful?