aragon / aragon-cli

CLI for creating and publishing Aragon apps
GNU General Public License v3.0
91 stars 79 forks source link

Provide baseline ABIs bundle with aragonCLI #419

Open 0xGabi opened 5 years ago

0xGabi commented 5 years ago

Problem

When users try to interact with their deployed dao using dao exec or dao act sometimes ABIs of the apps are not available cause artifact.json file aren't propagate through IPFS.

Error displayed:

 ✖ Generating transaction
   → No ABI specified in artifact for <app-address>
   Sending transaction
 ✖ No ABI specified in artifact for <app-address>

Quick fix

Right now a quick fix is to pin the artifact.json manually in some gateway (e.g. IPFS, Aragon node) or use the new command ipfs propagate.

Long term solution

In case ipfs fetch fails, provide user with a baseline ABI bundle with aragonCLI.

sohkai commented 5 years ago

We can use this ABI:

  "abi": [
    {
      "constant": true,
      "inputs": [],
      "name": "hasInitialized",
      "outputs": [
        {
          "name": "",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "_script",
          "type": "bytes"
        }
      ],
      "name": "getEVMScriptExecutor",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "token",
          "type": "address"
        }
      ],
      "name": "allowRecoverability",
      "outputs": [
        {
          "name": "",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "appId",
      "outputs": [
        {
          "name": "",
          "type": "bytes32"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "getInitializationBlock",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": false,
      "inputs": [
        {
          "name": "_token",
          "type": "address"
        }
      ],
      "name": "transferToVault",
      "outputs": [],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "getEVMScriptRegistry",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "kernel",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "isPetrified",
      "outputs": [
        {
          "name": "",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "executor",
          "type": "address"
        },
        {
          "indexed": false,
          "name": "script",
          "type": "bytes"
        },
        {
          "indexed": false,
          "name": "input",
          "type": "bytes"
        },
        {
          "indexed": false,
          "name": "returnData",
          "type": "bytes"
        }
      ],
      "name": "ScriptResult",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "vault",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "token",
          "type": "address"
        },
        {
          "indexed": false,
          "name": "amount",
          "type": "uint256"
        }
      ],
      "name": "RecoverToVault",
      "type": "event"
    },
    {
      "constant": true,
      "inputs": [
        {
          "name": "_sender",
          "type": "address"
        },
        {
          "name": "_role",
          "type": "bytes32"
        },
        {
          "name": "_params",
          "type": "uint256[]"
        }
      ],
      "name": "canPerform",
      "outputs": [
        {
          "name": "",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "getRecoveryVault",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "proxyType",
      "outputs": [
        {
          "name": "proxyTypeId",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "pure",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "isDepositable",
      "outputs": [
        {
          "name": "",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "implementation",
      "outputs": [
        {
          "name": "codeAddr",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "payable": true,
      "stateMutability": "payable",
      "type": "fallback"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "name": "sender",
          "type": "address"
        },
        {
          "indexed": false,
          "name": "value",
          "type": "uint256"
        }
      ],
      "name": "ProxyDeposit",
      "type": "event"
    }
  ]

Which is just AragonApp and AppProxyBase combined without the duplicates. We could also filter out the events, since they're probably not useful.

kernelwhisperer commented 5 years ago

Quick fix

Right now a quick fix is to pin the artifact.json manually in some gateway (e.g. IPFS, Aragon node) or use the new command ipfs propagate.

This doesn't quite work for me, it gets stuck at Fetch the links. The propagate command works best when you have the file pinned locally.

Long term solution

In case ipfs fetch fails, provide user with a baseline ABI bundle with aragonCLI.

Why does bundling AragonApp and AppProxyBase ABIs help in this case? Won't the wrapper still not be able to find the transaction path if let's say I want to call Vault#transfer ? Or do you mean bundle the ABIs of aragon-apps as well?

kernelwhisperer commented 5 years ago

Long term solution

In case ipfs fetch fails, provide user with a baseline ABI bundle with aragonCLI.

This will only work for aragon-apps, we should figure out why the fetching of the artifact fails and instead of bundling ABIs in the @aragon/cli we can probably add more artifacts to aragen-cache.

My suspicion is that our local nodes cannot connect to https://ipfs.eth.aragon.network/ because when I query the gateway, I can get the artifact pretty quickly. E.g.: https://ipfs.eth.aragon.network/ipfs/Qmf4n8SU86dkqep4cjcUG1jGsR9RNmXQToUSMAuUpTtWoS

But when I do ipfs pin add Qmf4n8SU86dkqep4cjcUG1jGsR9RNmXQToUSMAuUpTtWoS, it takes forever.

Possible solutions:

Update: deleting ~/.ipfs/ solves the issue 🤕. It might be something with the repository size or garbage collection..