Bera_Module fails to stake in BGTStaker due to missing Boost integration
Bera_Module calls BGTStaker::stake and BGTStaker::withdraw directly, but those functions are gated by an onlyBGT modifier. Staking into BGTStaker must go through the BGT token's queueBoost / activateBoost flow, which the module does not implement, so BGT staking always reverts.
Description
D2's Berachain integration includes Bera_Module::bera_bgt_stake and Bera_Module::bera_bgt_withdraw, which attempt to call BGTStaker::stake and BGTStaker::withdraw directly. Both target functions are restricted by the onlyBGT modifier, which only allows the BGT token contract itself to call them:
/// @dev Throws if called by any account other than BGT contract.modifier onlyBGT() {if (msg.sender != address(stakeToken)) NotBGT.selector.revertWith();_;}function stake(address account, uint256 amount) external onlyBGT {_stake(account, amount);}
To actually stake in BGTStaker, a user must go through the BGT token's boost flow:
- Call
BGT::queueBoostandBGT::activateBoostto boost a validator. - Call
BGT::queueDropBoostandBGT::dropBoostto exit the boost.
The strategy never calls these functions. Therefore every call to bera_bgt_stake or bera_bgt_withdraw hits the onlyBGT check and reverts.
Impact
- The protocol cannot earn $BGT rewards from
BGTStakeras intended. - To access these rewards the strategy must integrate with the boost functionality of the BGT token rather than calling
BGTStakerdirectly. - Missed staking incentives reduce the protocol's overall earnings on Berachain.
Recommendation
Re-implement the BGT staking path using the boost flow on the BGT token: queue and activate a boost on the targeted validator, then later queue and drop the boost to exit. Update the module's external surface and integration tests to validate against the public Berachain reference implementations.
Resolution
D2: Fixed in 11c9407.
Cyfrin: Verified.