Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: deployment script #81

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

feat: deployment script #81

wants to merge 14 commits into from

Conversation

Jean-Grimal
Copy link
Contributor

Fixes #54

deployment-script/ConfiguredScript.sol Outdated Show resolved Hide resolved
deployment-script/ConfiguredScript.sol Outdated Show resolved Hide resolved
deployment-script/ConfiguredScript.sol Outdated Show resolved Hide resolved
deployment-script/ConfiguredScript.sol Outdated Show resolved Hide resolved
deployment-script/ConfiguredScript.sol Outdated Show resolved Hide resolved
deployment-script/base/verify.sh Outdated Show resolved Hide resolved
deployment-script/ConfiguredScript.sol Outdated Show resolved Hide resolved
script/base/DeployMorphoTokenBase.sol Outdated Show resolved Hide resolved
script/ethereum/DeployMorphoTokenEthereum.sol Outdated Show resolved Hide resolved
script/base/DeployMorphoTokenBase.sol Show resolved Hide resolved

contract DeployMorphoTokenBase is Script {
address public constant MORPHO_DAO = 0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa;
address public REMOTE_TOKEN;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be set (when the token is deployed on Ethereym)

script/ethereum/DeployMorphoTokenEthereum.sol Outdated Show resolved Hide resolved
Comment on lines 19 to 22
address public implementationAddress;
MorphoTokenOptimism public token;
address public wrapperAddress;
address public newMorphoAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it doesnt' really matter but why are these in "storage"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we create a specific token address like the previous token?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related discussion: #81 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True that they could be memory

Comment on lines +15 to +17
bytes32 public IMPLEMENTATION_SALT;
bytes32 public PROXY_SALT;
bytes32 public WRAPPER_SALT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once set I'll change them to constants

script/base/DeployMorphoTokenBase.sol Outdated Show resolved Hide resolved
script/base/DeployMorphoTokenBase.sol Show resolved Hide resolved
console.log("Deployed token implementation at", implementationAddress);

// Deploy Token proxy
token = MorphoTokenEthereum(address(new ERC1967Proxy{salt: PROXY_SALT}(implementationAddress, hex"")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark as on base

Comment on lines 19 to 22
address public implementationAddress;
MorphoTokenOptimism public token;
address public wrapperAddress;
address public newMorphoAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we create a specific token address like the previous token?

Copy link
Contributor

@MerlinEgalite MerlinEgalite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for deployment we should use via-ir and a the max optimizer run

Copy link
Contributor

@QGarchery QGarchery Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(optional) maybe now we don't even need to have 2 separate folders for base and for ethereum

MerlinEgalite
MerlinEgalite previously approved these changes Nov 4, 2024
/// Contract meant to be the implementation of an ERC1967Proxy at deployment.
contract DeploymentImplementation is UUPSUpgradeable {
/// @inheritdoc UUPSUpgradeable
function _authorizeUpgrade(address) internal override {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be gated? the actions are not atomically batched right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here anybody can upgrade the contract

meaning a MEV bot could upgrade it to a contract whose implementation is not upgradable (and we are blocked)

foundry.toml Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we run tests in the test folder as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not
I prefered to separate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean it would be interesting to check that the deployment script deploys a token that also has the properties that are tested in the test folder. For now it only checks the total supply IIUC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not reviewing the constants of this file yet


vm.stopBroadcast();

return (address(token), wrapper);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the return statement, because those addresses are in storage already (token and wrapper are storage variables), and the tests inherit from this contract

/// @custom:contact security@morpho.org
/// @dev Extension of UUPSUpgradeable.
///
/// Contract meant to be the implementation of an ERC1967Proxy at deployment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe explain why it's useful, to have the same address on many chains

bytes32 public PROXY_SALT;
bytes32 public WRAPPER_SALT;

address constant DEPLOYER = 0x937Ce2d6c488b361825D2DB5e8A70e26d48afEd5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this address ? Maybe document and secure it, so we know it will be available for future deployments (to keep the same address of the token on different chains)

Comment on lines +16 to +17
bytes32 public DEPLOYMENT_IMPLEMENTATION_SALT;
bytes32 public IMPLEMENTATION_SALT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use CREATE2 for the implementation, as we don't care about having a predictable address for the implementation

script/helpers/DeploymentImplementation.sol Outdated Show resolved Hide resolved
script/helpers/DeploymentImplementation.sol Outdated Show resolved Hide resolved
script/helpers/DeploymentImplementation.sol Outdated Show resolved Hide resolved
Co-authored-by: Quentin Garchery <QGarchery@users.noreply.github.com>
Signed-off-by: Merlin Egalite <44097430+MerlinEgalite@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write deployment script
4 participants