EBIP-8: Enroot BDV Rounding

Committed: May 13, 2023


Beanstalk Community Multisig

Emergency Process Note

Per the process outlined in the BCM Emergency Response Procedures, the BCM can take swift action to protect Beanstalk in the event of a bug or security vulnerability.


The enrootDeposit(s) functions increment Seeds based on the BDV of the total amount Enrooted instead of the sum of BDV of the amount Enrooted in each individual Season. This causes a slight discrepancy between the total Seeds that a Farmer has and the amount of BDV they have deposited for each token.

Removing an Unripe Deposit can cause a BDV rounding error due to the way that Beanstalk computes the BDV using legacy Silo Deposits. Any function that removes a Unripe Deposit could potentially have this rounding error.

The enrootDeposit(s) functions do not have the payable modifier. This implies that farm functions using Ether cannot access the enrootDeposit(s) functions.


The combination of problems (1) and (2) have led to a total discrepancy of 0.026151784 Stalk and 0.048628 Seeds.


Increment the total Seeds based on the sum of the BDV of each Enrooted Deposit in enrootDeposit.

When removing an Unripe Deposit from the legacy Silo storage reference, remove the whole legacy Deposit and redeposit any excess in the regular Silo storage reference instead of leaving it in the legacy Deposit storage.

Add the payable modifer to the enrootDeposit(s) functions.

All fixes were reviewed by Halborn.

Contract Changes

Silo Facet

The following SiloFacets have been removed from Beanstalk:

The following SiloFacet has been added to Beanstalk:

SiloFacet Function Changes

Name Selector Action Type New Functionality
approveDeposit 0x1302afc2 Replace Call
balanceOfEarnedBeans 0x3e465a2e Replace View
balanceOfEarnedSeeds 0x602aa123 Replace View
balanceOfEarnedStalk 0x341b94d5 Replace View
balanceOfGrownStalk 0x249564aa Replace View
balanceOfPlenty 0x896651e8 Replace View
balanceOfRainRoots 0x69fbad94 Replace View
balanceOfRoots 0xba39dc02 Replace View
balanceOfSeeds 0x4916bc72 Replace View
balanceOfSop 0xa7bf680f Replace View
balanceOfStalk 0x8eeae310 Replace View
claimPlenty 0x45947ba9 Replace Call
claimWithdrawal 0x488e94dc Replace Call
claimWithdrawals 0x764a9874 Replace Call
decreaseDepositAllowance 0xd9ee1269 Replace Call
deposit 0xf19ed6be Replace Call
depositAllowance 0x2a6a8ef5 Replace View
depositPermitDomainSeparator 0x8966e0ff Replace View
depositPermitNonces 0x843bc425 Replace View
enrootDeposit 0xd5d2ea8c Replace View
enrootDeposits 0x83b9e85d Replace View
getDeposit 0x8a6a7eb4 Replace View
getTotalDeposited 0x0c9c31bd Replace View
getTotalWithdrawn 0xb1c7a20f Replace View
getWithdrawal 0xe23c96a4 Replace View
increaseDepositAllowance 0x5793e485 Replace Call
lastSeasonOfPlenty 0xbe6547d2 Replace View
lastUpdate 0xcb03fb1e Replace View
permitDeposit 0x120b5702 Replace Call
permitDeposits 0xd5770dc7 Replace Call
plant 0x779b3c5c Replace Call
tokenSettings 0xe923e8d4 Replace View
totalEarnedBeans 0xfd9de166 Replace View
totalRoots 0x46544166 Replace View
totalSeeds 0xd8bd0d9d Replace View
totalStalk 0x7b52fadf Replace View
transferDeposit 0x9e32d261 Replace Call
transferDeposits 0x0d2615b1 Replace Call
update 0x1c1b8772 Replace Call
withdrawDeposit 0x7af9a0ce Replace Call
withdrawDeposits 0xb189d9c8 Replace Call
withdrawFreeze 0x55926690 Replace View

SiloFacet Event Changes


Convert Facet

The following ConvertFacet has been removed from Beanstalk:

The following ConvertFacet has been added to Beanstalk:

ConvertFacet Function Changes

Name Selector Action Type New Functionality
convert 0x3b2a1b28 Replace Call
getAmountOut 0x4aa06652 Replace View
getMaxAmountIn 0x24dd285c Replace View

ConvertFacet Event Changes



Immediately upon commitment by the BCM, which has already happened.