Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

WIP: Refactor aragen#105

Draft
0xGabi wants to merge 4 commits into
aragon:masterfrom
0xGabi:refactor-aragen
Draft

WIP: Refactor aragen#105
0xGabi wants to merge 4 commits into
aragon:masterfrom
0xGabi:refactor-aragen

Conversation

@0xGabi

@0xGabi 0xGabi commented Apr 28, 2020

Copy link
Copy Markdown
Contributor

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

@dapplion dapplion left a comment

Copy link
Copy Markdown

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

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
Copy Markdown

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
Copy Markdown

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.

Comment thread scripts/repos/index
@@ -0,0 +1,115 @@
const getAccounts = require('@aragon/os/scripts/helpers/get-accounts')

Copy link
Copy Markdown

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
Copy Markdown

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

Comment thread scripts/repos/index.js
} = require('./apm')
const { readJson } = require('./utils')

const ensAddress = '0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1'

Copy link
Copy Markdown

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.

Comment thread scripts/repos/apm.json
@@ -0,0 +1,40 @@
{

Copy link
Copy Markdown

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

Comment thread scripts/repos/index.js
const history = await etherscanProvider.getHistory(contractAddress, 0)
const deployTx = history[0]

log('Deploying Repo...')

Copy link
Copy Markdown

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

Comment thread scripts/repos/index.js
from: owner,
to: txData.to,
data: encodePublishVersionTxData(txData),
gas: 4712388,

Copy link
Copy Markdown

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

Comment thread scripts/repos/index.js
: hex
}

main()

Copy link
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants