Claiming delegation rewards via the precompile can result in a loss of ZETA rewards due to state synchronization issues
When a ZEVM contract claims Cosmos delegation rewards via the precompile, the received ZETA rewards are not added to the EVM state database. This causes the EVM state to overwrite the Cosmos ZETA balance at commit, resulting in a loss of the claimed ZETA rewards.
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2025-04-zetachain-cross-chain-judging/issues/316
This issue has been acknowledged by the team but won't be fixed at this time.
Found by
berndartmueller
Summary
When claiming Cosmos delegation rewards, both explicitly and implicitly, the ZETA rewards are not added to the EVM statedb of the caller contract. This leads to a loss of ZETA rewards when the EVM state is committed to the Cosmos state.
Root Cause
When withdrawing Cosmos delegation rewards via the claimRewards precompile method by calling c.distributionKeeper.WithdrawDelegationRewards(), ZETA rewards will be skipped from the ZRC20 unlocking process.
However, the received ZETA bank coins are not added to the EVM statedb, which is then out-of-sync with the Cosmos state. And as the EVM state is committed to the Cosmos state at the end of the EVM execution, it will overwrite the ZETA bank balance in the Cosmos state with the EVM state, resulting in a loss of ZETA reward coins.
This is similar to the mitigation in the Stake() precompile method that subtracts the staked ZETA coins from the EVM statedb to ensure that the EVM state is in sync with the Cosmos state and to prevent double-spending.
Internal Pre-conditions
N/A
External Pre-conditions
- A ZEVM contract interacts with the staking precompile
Attack Path
N/A
Impact
The claimed ZETA bank coin rewards are lost.
PoC
- A ZEVM contract delegates ZETA coins to a validator
- After a while, when delegation rewards are accumulated, the contract
- updates its storage variable (so that a state object is added to the EVM statedb). This leads to the ZETA balance at the time of the state change being cached.
- calls the
claimRewardsprecompile method.
- ZETA coin rewards are received in the Cosmos state
- The EVM execution finishes, and the EVM state is committed to the Cosmos state
- The EVM state overwrites the Cosmos ZETA bank balance of the contract with the previously cached balance
- ZETA rewards are lost
Mitigation
Similar to Evmos, explicitly add the claimed ZETA coin rewards to the withdraw address balance in the EVM statedb.
Similarly, this is also required for the stake and unstake precompile functions, as they will implicitly auto-withdraw delegation rewards.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
The claimed ZETA bank coin rewards are lost.
What the attacker needed
A ZEVM contract interacts with the staking precompile
The fix
The issue was acknowledged but won't be fixed at this time; the recommended mitigation is to explicitly add the claimed ZETA coin rewards to the withdraw address balance in the EVM statedb, similar to Evmos.
How it was found
- A ZEVM contract delegates ZETA coins to a validator
- The contract updates its storage variable, caching its ZETA balance in the EVM statedb
- The contract calls the claimRewards precompile method
- ZETA coin rewards are received in the Cosmos state
- The EVM execution finishes and the EVM state is committed to the Cosmos state
- The EVM state overwrites the Cosmos ZETA bank balance with the cached balance, losing the rewards
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract on ZetaChain can earn rewards by delegating tokens. When it claims those rewards, the reward tokens are not properly recorded in the contract's balance on the EVM side. Later, when the EVM state is saved, it overwrites the correct balance with the old one, so the rewards disappear.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.