You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Upgrade function calls Contract.Migrate() to upgrade the contract. Contract.Migrate() migrates everything in the persistent storage of the current contract to the new contract when executed. For Migrate() method, it will only transfer the contract storages when the target contract has not been deployed yet.
Specifically, one can frontrun the deployment of the new contract so the migration won’t transfer the storages to the new contract. Though what an attacker can do still depends on the new contract, this might not be the operator’s expectation.
Recommendation
Check whether the contract already exists before calling Contract.Migrate().
The text was updated successfully, but these errors were encountered:
Description
There is a lack of sanity check in the
Upgrade()
method of FlamingoSwapRouterContract which might lead to unwanted behaviour.The
Upgrade
function callsContract.Migrate()
to upgrade the contract.Contract.Migrate()
migrates everything in the persistent storage of the current contract to the new contract when executed. ForMigrate()
method, it will only transfer the contract storages when the target contract has not been deployed yet.Specifically, one can frontrun the deployment of the new contract so the migration won’t transfer the storages to the new contract. Though what an attacker can do still depends on the new contract, this might not be the operator’s expectation.
Recommendation
Check whether the contract already exists before calling
Contract.Migrate()
.The text was updated successfully, but these errors were encountered: