This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 200
Non-upgradeable deploys, round 2 #1376
Merged
frangio
merged 87 commits into
OpenZeppelin:master
from
frangio:feature/regular-deploys-2
Jan 21, 2020
Merged
Non-upgradeable deploys, round 2 #1376
frangio
merged 87 commits into
OpenZeppelin:master
from
frangio:feature/regular-deploys-2
Jan 21, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spalladino
reviewed
Jan 17, 2020
spalladino
reviewed
Jan 17, 2020
spalladino
reviewed
Jan 17, 2020
spalladino
reviewed
Jan 17, 2020
spalladino
reviewed
Jan 17, 2020
…o feature/regular-deploys-2
This was referenced Jan 17, 2020
This was referenced Jan 17, 2020
…o feature/regular-deploys-2
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supercedes #1240. Fixes #802.
This is quite a large pull request that adds a new
deploy
command that can be used for deploying both upgradeable and "regular" contracts.The new command was built following a different architecture than all the current commands, as an experiment to see how we can refactor the entire commands layer to have better separation of concerns and better maintainability. The idea would be to refactor the rest of the codebase if we agree that this is an improvement.
In the current architecture there are command and script layers. The command layer provides a command's specification and action, and the action handles interactivity very explicitly by making use of the prompts module in the action flow. The script layer is very thin and almost all it does is error handling, and printing to stdout, then delegating to a controller.
The proposed architecture removes the scripts layer, and separates the command layer more explicitly into command specification and action. Interactivity is no longer a concern of the action, instead the command specification provides details for the behavior of each positional argument and option, and when the command is registered in the commander program these details are used to run interactive prompts prior to running the action.
The code for registering a command using this new architecture can be found in the
register-command.ts
file, including also the code for running the interactive prompts based on a command spec. There are no tests for this, but I think I should add a few before merging this.The two parts of the new command are found in
commands/deploy/spec.ts
andcommands/deploy/action.ts
. This separation will allow for optimizing the loading time of the CLI because the dependencies of the action will not be imported unless the command is actually called. There is alsocommands/deploy/index.ts
that provides the glue between the proposed architecture and the current architecture.One of the things that I think should be improved is the naming around
prompt
,Question
, etc., in the args and opts specification. I kind of picked these names quickly and kept them but they're not good.