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

Wrapper: add artifacts for aragonPM apps #273

Merged
merged 8 commits into from Apr 26, 2019
@@ -0,0 +1,31 @@
{
"roles": [
{
"id": "CREATE_REPO_ROLE",
"bytes": "0x2a9494d64846c9fdbf0158785aa330d8bc9caf45af27fa0e8898eb4d55adcea6",
"name": "Create repos",
"params": []
}
],
"functions": [
{
"sig": "initialize(address)",
"roles": [],
"notice": "Initialize this APMRegistry instance and set `_registrar` as the ENS subdomain registrar"
},
{
"sig": "newRepo(string,address)",
"roles": [
"CREATE_REPO_ROLE"
],
"notice": "Create new repo in registry with `_name`"
},
{
"sig": "newRepoWithVersion(string,address,uint16[3],address,bytes)",
"roles": [
"CREATE_REPO_ROLE"
],
"notice": "Create new repo in registry with `_name` and publish a first version with contract `_contractAddress` and content `@fromHex(_contentURI)`"
}
]
}
@@ -0,0 +1,57 @@
{
"roles": [
{
"id": "CREATE_NAME_ROLE",
"bytes": "0xf86bc2abe0919ab91ef714b2bec7c148d94f61fdb069b91a6cfe9ecdee1799ba",
"name": "Create subdomains",
"params": []
},
{
"id": "DELETE_NAME_ROLE",
"bytes": "0x03d74c8724218ad4a99859bcb2d846d39999449fd18013dd8d69096627e68622",
"name": "Remove subdomains",
"params": []
},
{
"id": "POINT_ROOTNODE_ROLE",
"bytes": "0x9ecd0e7bddb2e241c41b595a436c4ea4fd33c9fa0caa8056acf084fc3aa3bfbe",
"name": "Point root domain",
"params": []
}
],
"functions": [
{
"sig": "initialize(address,bytes32)",
"roles": [],
"notice": "Initialize this ENSSubdomainRegistrar instance with `_ens` as the root ENS registry and `_rootNode` as the node to allocate subdomains under"
},
{
"sig": "createName(bytes32,address)",
"roles": [
"CREATE_NAME_ROLE"
],
"notice": "Create a new ENS subdomain record for `_label` and assign ownership to `_owner`"
},
{
"sig": "createNameAndPoint(bytes32,address)",
"roles": [
"CREATE_NAME_ROLE"
],
"notice": "Create a new ENS subdomain record for `_label` that resolves to `_target` and is owned by this ENSSubdomainRegistrar"
},
{
"sig": "deleteName(bytes32)",
"roles": [
"DELETE_NAME_ROLE"
],
"notice": "Deregister ENS subdomain record for `_label`"
},
{
"sig": "pointRootNode(address)",
"roles": [
"POINT_ROOTNODE_ROLE"
],
"notice": "Resolve this ENSSubdomainRegistrar's root node to `_target`"
}
]
}
@@ -0,0 +1,24 @@
{
"roles": [
{
"id": "CREATE_VERSION_ROLE",
"bytes": "0x1f56cfecd3595a2e6cc1a7e6cb0b20df84cdbd92eff2fee554e70e4e45a9a7d8",
"name": "Publish versions",
"params": []
}
],
"functions": [
{
"sig": "initialize()",
"roles": [],
"notice": "Initialize this Repo"
},
{
"sig": "newVersion(uint16[3],address,bytes)",
"roles": [
"CREATE_VERSION_ROLE"
],
"notice": "Create new version with contract `_contractAddress` and content `@fromHex(_contentURI)`"
}
]
}
@@ -4,40 +4,72 @@ import { getAbi, getArtifact } from '../../interfaces'

const aragonpmAppId = appName => namehash(`${appName}.aragonpm.eth`)

const APP_MAPPINGS = new Map([
const SYSTEM_APP_MAPPINGS = new Map([
[aragonpmAppId('acl'), 'ACL'],
[aragonpmAppId('evmreg'), 'EVM Script Registry'],
[aragonpmAppId('kernel'), 'Kernel']
])

const APM_APP_MAPPINGS = new Map([
[aragonpmAppId('apm-registry'), 'APM Registry'],
[aragonpmAppId('apm-repo'), 'Repo'],
[aragonpmAppId('apm-enssub'), 'ENS Subdomain Registrar']

This comment has been minimized.

Copy link
@0x6431346e

0x6431346e Apr 6, 2019

Member
Suggested change
[aragonpmAppId('apm-enssub'), 'ENS Subdomain Registrar']
[aragonpmAppId('apm-enssub'), 'ENS Subdomain Registrar'],
[aragonpmAppId('apm-registry.open'), 'APM Registry'],
[aragonpmAppId('apm-repo.open'), 'Repo'],
[aragonpmAppId('apm-enssub.open'), 'ENS Subdomain Registrar']

See aragon/aragon-cli#425 (comment)

This comment has been minimized.

Copy link
@sohkai

sohkai Apr 23, 2019

Member

Hmm, just hooked up the client to try and inspect an aragonPM instance and indeed we do need these overrides :/.

Not sure if we'll be able to do something clever but this might be the easiest way to get compatibility with the current open.aragonpm.eth deployment.

This comment has been minimized.

Copy link
@0x6431346e

0x6431346e Apr 24, 2019

Member

I think this is a justifiable shortcut while we explore how to fix this properly so this contribution doesn't become stale.
I will open an issue and merge this PR with the related ones.

This comment has been minimized.

Copy link
@izqui

izqui Apr 24, 2019

Author Member

These repos are actually set up by APMRegistryFactory here and the appIds are always set to the apm-* repos in the registry.

All registries that are created with this factory will have the same issue. The factory was developed for deploying the root registry and we didn't take this into account.

])

const KERNEL_NAMESPACES = new Map([
[soliditySha3('core'), 'Core'],
[soliditySha3('app'), 'Default apps'],
[soliditySha3('base'), 'App code']
])

function getAragonOsInternalAppInfo (appId) {
const appName = APP_MAPPINGS.get(appId)
function getAppInfo (appId, namespace, mappings) {
const appName = mappings.get(appId)

if (!appName) {
return
}

const abi = getAbi(`aragon/${appName}`)
const artifact = getArtifact(`aragon/${appName}`)
const app = `${namespace}/${appName}`
const abi = getAbi(app)
const artifact = getArtifact(app)

return {
abi,
name: appName,
isAragonOsInternalApp: true,
...artifact
}
}

function getAragonOsInternalAppInfo (appId) {
const appInfo = getAppInfo(appId, 'aragon', SYSTEM_APP_MAPPINGS)

if (!appInfo) {
return
}

return {
isAragonOsInternalApp: true,
This conversation was marked as resolved by sohkai

This comment has been minimized.

Copy link
@sohkai

sohkai Apr 4, 2019

Member

Let's move this to be after the ...appInfo so it's ensured to be set.

...appInfo
}
}

function getAPMAppInfo (appId) {

This comment has been minimized.

Copy link
@izqui

izqui Apr 3, 2019

Author Member

Decided to split it off in two functions so isAragonOsInternalApp is false for aragonPM apps. Alternatively we could add a boolean to the items in APP_MAPPING denoting whether the app is an internal app or not.

const appInfo = getAppInfo(appId, 'apm', APM_APP_MAPPINGS)

if (!appInfo) {
return
}

return {
isAragonOsInternalApp: false,
...appInfo
}
This conversation was marked as resolved by sohkai

This comment has been minimized.

Copy link
@sohkai

sohkai Apr 4, 2019

Member

I think we could simply return getAppInfo(appId, 'apm', APM_APP_MAPPINGS) ; isAragonOsInternalApp doesn't need to always be set.

}

function getKernelNamespace (hash) {
if (KERNEL_NAMESPACES.has(hash)) {
return { name: KERNEL_NAMESPACES.get(hash), hash }
}
}

export { getAragonOsInternalAppInfo, getKernelNamespace }
export { getAragonOsInternalAppInfo, getAPMAppInfo, getKernelNamespace }
This conversation was marked as resolved by sohkai

This comment has been minimized.

Copy link
@0x6431346e

0x6431346e Apr 6, 2019

Member
Suggested change
export { getAragonOsInternalAppInfo, getAPMAppInfo, getKernelNamespace }
export { getAragonOsInternalAppInfo, getApmAppInfo, getKernelNamespace }

Might be worth considering to style APM as Apm in the context of a camel case name, similar to AragonOs

@@ -32,7 +32,7 @@ import {
ANY_ENTITY
} from './utils'

import { getAragonOsInternalAppInfo, getKernelNamespace } from './core/aragonOS'
import { getAragonOsInternalAppInfo, getAPMAppInfo, getKernelNamespace } from './core/aragonOS'

// Templates
import Templates from './templates'
@@ -295,6 +295,7 @@ export default class Aragon {
const applicationInfoCache = new AsyncRequestCache((cacheKey) => {
const [appId, codeAddress] = cacheKey.split('.')
return getAragonOsInternalAppInfo(appId) ||
getAPMAppInfo(appId) ||
this.apm.getLatestVersionForContract(appId, codeAddress)
})

@@ -6,11 +6,17 @@ import abiAragonForwarder from '@aragon/os/abi/IForwarder'
import abiAragonKernel from '@aragon/os/abi/Kernel'
import abiAragonEVMScriptRegistry from '@aragon/os/abi/EVMScriptRegistry'
import abiERC20 from '@aragon/os/abi/ERC20'
import abiAPMRegistry from '@aragon/os/abi/APMRegistry'
import abiAPMRepo from '@aragon/os/abi/Repo'
import abiAPMENSSubdomainRegistrar from '@aragon/os/abi/ENSSubdomainRegistrar'

// Artifacts
import artifactsAragonACL from '../artifacts/aragon/ACL.json'
import artifactsAragonKernel from '../artifacts/aragon/Kernel.json'
import artifactsAragonEVMScriptRegistry from '../artifacts/aragon/EVMScriptRegistry.json'
import artifactsAPMRegistry from '../artifacts/apm/APMRegistry.json'
import artifactsAPMRepo from '../artifacts/apm/Repo.json'
import artifactsAPMENSSubdomainRegistrar from '../artifacts/apm/ENSSubdomainRegistrar.json'

const ABIS = {
'aragon/ACL': abiAragonACL.abi,
@@ -19,13 +25,19 @@ const ABIS = {
'aragon/Forwarder': abiAragonForwarder.abi,
'aragon/Kernel': abiAragonKernel.abi,
'aragon/EVM Script Registry': abiAragonEVMScriptRegistry.abi,
'standard/ERC20': abiERC20.abi
'standard/ERC20': abiERC20.abi,
'apm/APM Registry': abiAPMRegistry.abi,
'apm/Repo': abiAPMRepo.abi,
'apm/ENS Subdomain Registrar': abiAPMENSSubdomainRegistrar.abi
}

const ARTIFACTS = {
'aragon/ACL': artifactsAragonACL,
'aragon/Kernel': artifactsAragonKernel,
'aragon/EVM Script Registry': artifactsAragonEVMScriptRegistry
'aragon/EVM Script Registry': artifactsAragonEVMScriptRegistry,
'apm/APM Registry': artifactsAPMRegistry,
'apm/Repo': artifactsAPMRepo,
'apm/ENS Subdomain Registrar': artifactsAPMENSSubdomainRegistrar
}

export const getAbi = name => ABIS[name] || null
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.