Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

WIP: Refactor aragen #105

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

WIP: Refactor aragen #105

wants to merge 4 commits into from

Conversation

0xGabi
Copy link
Contributor

@0xGabi 0xGabi commented Apr 28, 2020

This PR is a WIP to refactor how we handle the devchain creation using the new tooling that was developed for the buidler-aragon plugin.

@0xGabi 0xGabi changed the title Refactor aragen WIP: Refactor aragen May 1, 2020
Copy link

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

Really good job overall! I think this is a big improvement from the previous process. After making sure the methodology in scripts/repos works in a CI environment I think it looks great and won't propose any major changes.

About the IPFS cache, I would compile a list of IPFS hashes as you get them in scripts/repos/index and store them in an artifact. Then after installing aragen if the user wants to have all the content in a local IPFS node just call a pre-made script that uses that list of IPFS hashes to pin them to the local node. To speed this process the script or command could also connect the local node to a known public Aragon IPFS node that is sure to have those files available

@@ -37,7 +37,7 @@ module.exports = async (
await logDeploy(factory, { verbose })
const receipt = await factory.newENS(owner)

const ensAddr = receipt.logs.filter(l => l.event == 'DeployENS')[0].args.ens
const ensAddr = receipt.logs.filter((l) => l.event == 'DeployENS')[0].args.ens
Copy link

Choose a reason for hiding this comment

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

To reduce the diff, create a .prettierrc which sets the parameters in order to prevent unnecessary changes. In this case, arrowParens: "avoid"

https://prettier.io/docs/en/options.html#arrow-function-parentheses

@@ -0,0 +1,23 @@
import net from 'net'

export const isPortTaken = async (port, opts) => {
Copy link

Choose a reason for hiding this comment

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

Would it be better to use https://www.npmjs.com/package/tcp-port-used ? While there's value in not depending on useless dependencies, a non-trivial like this one reduces the amount of code to maintain going forward.

@@ -0,0 +1,115 @@
const getAccounts = require('@aragon/os/scripts/helpers/get-accounts')
Copy link

Choose a reason for hiding this comment

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

This file is missing its extension ".js". Is it a duplicate of index.js?

@@ -0,0 +1,17 @@
{
Copy link

Choose a reason for hiding this comment

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

Is this package.json is meant to be here? Same for the yarn.lock in the same dir

} = require('./apm')
const { readJson } = require('./utils')

const ensAddress = '0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1'
Copy link

Choose a reason for hiding this comment

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

I would recommend moving any specific param to a file in the root dir that contains all this kind of data in a single place for better visibility and maintainability.

@@ -0,0 +1,40 @@
{
Copy link

Choose a reason for hiding this comment

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

I would recommend moving this file to a higher directory with a self-descriptive name Aragon Apps Fetched For Aragen. It could be turned into .js that exports JSON so it can include a nice long comment on top explaining its purpose and methodology

Open a PR to add your app aragen's CI, etc

const history = await etherscanProvider.getHistory(contractAddress, 0)
const deployTx = history[0]

log('Deploying Repo...')
Copy link

Choose a reason for hiding this comment

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

Log the name of repo being deployed

from: owner,
to: txData.to,
data: encodePublishVersionTxData(txData),
gas: 4712388,
Copy link

Choose a reason for hiding this comment

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

Declare a variable in the top as "veryBigGasAmout" or something similar to prevent using magic numbers

: hex
}

main()
Copy link

Choose a reason for hiding this comment

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

I would split the logic from the script that actually calls it. Maybe move all the logic to "deployAragonApps" and keep index as just something that imports and executes with the necessary parameters: testnet URL, app list, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants