The FertilizerFacet.claimFertilized()
calls the IFertilizer
interface on its beanstalkUpdate()
function in amount
calculation.
However, the Fertilizer
contract does not declare is IFertilizer
in its definition.
The claimFertilized()
calls IFertilizer.beanstalkUpdate()
in uint256 amount = C.fertilizer().beanstalkUpdate(msg.sender, ids, s.bpf);
:
https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/beanstalk/barn/FertilizerFacet.sol#L49-L55
Here is C.fertilizer()
that invokes IFertilizer
interface:
https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/C.sol#L164-L166
and here is C.fertilizer.beanstalkUpdate()
:
https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/interfaces/IFertilizer.sol#L10-L14
However, Fertilizer
contract does not declare is IFertilizer
in its definition:
https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/tokens/Fertilizer/Fertilizer.sol#L20
Though it has the beanstalkUpdate()
implementation:
https://github.com/Cyfrin/2024-04-beanstalk-2/blob/27ff8c87c9164c1fbff054be5f22e56f86cdf127/protocol/contracts/tokens/Fertilizer/Fertilizer.sol#L28-L34
Even if the Fertilizer
contract has a beanStalkUpdate()
function that matches the signature in the IFertilizer
interface, not using is IFertilizer
means the contract is not formally considered an implementation of that interface, which affects enforceability & type compatibility.
The result will cause FertilizerFacet.claimFertilized()
to fail forever as there is no implementation of the IFertilizer.beanstalkUpdate()
resulting in failure to Rinse Rinsable Sprouts earned from Fertilizer
.
Manual Review
The Fertilizer
contract needs to declare that it implements the IFertilizer
interface through is IFertilizer
.
This setup ensures that any contract or external caller interacting with the Fertilizer
contract through the IFertilizer
interface can call the beanStalkUpdate()
function, relying on the concrete implementation provided within the Fertilizer
contract.
https://github.com/Cyfrin/2024-04-beanstalk-2/blob/main/protocol%2Fcontracts%2Fbeanstalk%2Fsun%2FLiquidityWeightFacet.sol#L13-L24
The LiquidityWeightFacet
contract also needs to declare is ILiquidityWeightFacet
so that any other contract that tries to invoke the maxWeight()
function through the interface can do so since the implementation exists.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.