ApeWorX / ape

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
https://apeworx.io
Apache License 2.0
868 stars 133 forks source link

Managing Deployments #530

Closed fubuloubu closed 2 years ago

fubuloubu commented 2 years ago

Overview

Allow specifying final deployments to networks, as well as referencing them.

Currently, we have limited deployment management features from the config file of a project, as well as the project manifests, but for the currently active project we need a way to track and reference deployments to create structured deployment processes (e.g. B depends on A)

This is a test of Linear app integration

Specification

from ape import project  # NOTE: Our local project

# Do deployment of `my_contract = account.deploy(project.MyContract)`
project.track_deployment(my_contract)  # NOTE: Appends to list of deployments for type
# Adds tracking for deployment of `MyContract` type on `networks.active_network`
# NOTE: This only works for our local project (deployments are immutable otherwise)

...

# Reference previous deployment
# NOTE: This works for any project, not just our local one
my_contract = project.deployments(project.MyContract)[-1]

Also add a way to "untrack" a deployment:

project.drop_deployment(my_contract)
# NOTE: This only works for our local project (deployments are immutable otherwise)

Dependencies

EthPM dependencies field

antazoey commented 2 years ago

Yes!!!

antazoey commented 2 years ago

@NotPeopling2day said I can take this one

antazoey commented 2 years ago

Status update!

First, was confused about EIP-2678 so I spent time researching and updating the documentation in ethpm-types: https://github.com/ApeWorX/ethpm-types/pull/40

After I understood more about the schema for deployments, I realized the local deployments cache was very limiting and I may need it to handle more fields, based on how I am trying to implement this work. Thus, I created a PR that does this: https://github.com/ApeWorX/ape/pull/940 and that is where I left off at the end of the sprint on this work.

So we are making good progress but this was a little more complex than I originally thought! But I assume it still won't take too much more effort.

fubuloubu commented 2 years ago

@unparalleled-js as a side note: always keep in mind we can make changes to EIP-2678, we've made a few already even (mostly additions). If any substantive changes need to happen that depart from EIP-2678, we can look at publishing it as a new EIP.