【问题标题】:Chainlink multi-variable responses - results not getting appendedChainlink 多变量响应 - 结果未附加
【发布时间】:2021-08-27 08:12:55
【问题描述】:

我正在尝试在我的本地节点上实现 multi-variable job,但是我发现 3 个结果中只有 1 个被添加到 chainlink_result_collection resultcollect 任务中的数组。我的定义与链接的示例非常相似,主要区别在于使用外部适配器

在我的节点上运行上面的示例smart contract 和规范工作,并给出the following output。记下每次运行后附加到的 chainlink_result_collection 数组。已将输出文件链接到 SO 帖子的 30k 大小限制以下

但是,当我尝试运行我的多变量作业时,我得到以下输出。记下每个 resultcollect 任务之后的 chainlink_result_collection。您可以看到每次它被设置为最新的返回值,而不是像之前的作业输出那样被附加到。所以最后 chainlink_result_collection 数组的长度是 1 而不是 3 个元素

{
"id": "c27b2627-3aeb-4acb-8b84-1e191854b25d",
"jobId": "332118053343434c8d519e4c3a8c3fef",
"result": {
  "data": {
    "result": "0x0000000000000000000000000000000000000000000000020000000000002060",
    "address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
    "dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
    "unixDateTime": "1625097600",
    "functionSelector": "0x4ab0d190",
    "aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
    "__chainlink_result_collection__": [
      "0x0000000000000000000000000000000000000000000000020000000000002060"
    ]
  },
  "error": "insertEthTx failed while constructing EthTx data: number of collectors 2 != number of types in ABI encoding 4"
},
"status": "errored",
"taskRuns": [
  {
    "id": "5b7a842a-c5bb-47bb-86d6-9ffc9a8d6288",
    "result": {
      "data": {
        "address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
        "dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
        "roundAnswer": "36893488147419111519",
        "unixDateTime": "1625097600",
        "functionSelector": "0x4ab0d190",
        "laterRoundAnswer": "36893488147419111520",
        "aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
        "earlierRoundAnswer": "36893488147419111518"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 83,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "historical-price",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.169781+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.169781+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 3
  },
  {
    "id": "ce1394bd-5d9e-4150-8fd2-7d251b69a81d",
    "result": {
      "data": {
        "result": "36893488147419111519"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 84,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "copy",
      "confirmations": null,
      "params": {
        "copyPath": [
          "roundAnswer"
        ]
      },
      "CreatedAt": "2021-08-27T16:16:00.170343+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.170343+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "da32538d-b640-4bcb-8acb-fe9aafa344b0",
    "result": {
      "data": {
        "result": "0x000000000000000000000000000000000000000000000002000000000000205f"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 85,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "ethuint256",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.170885+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.170885+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "372cdf12-8752-492c-9c2d-ff3354d878af",
    "result": {
      "data": {
        "result": "0x000000000000000000000000000000000000000000000002000000000000205f",
        "address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
        "dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
        "unixDateTime": "1625097600",
        "functionSelector": "0x4ab0d190",
        "aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
        "__chainlink_result_collection__": [
          "0x000000000000000000000000000000000000000000000002000000000000205f"
        ]
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 86,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "resultcollect",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.171458+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.171458+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "0c8e18c2-c352-4af0-a282-a19fbcf03c2d",
    "result": {
      "data": {
        "address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
        "dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
        "roundAnswer": "36893488147419111519",
        "unixDateTime": "1625097600",
        "functionSelector": "0x4ab0d190",
        "laterRoundAnswer": "36893488147419111520",
        "aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
        "earlierRoundAnswer": "36893488147419111518"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 87,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "historical-price",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.172138+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.172138+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "48482e08-bed1-4956-8aa8-3ff6f2d9f38d",
    "result": {
      "data": {
        "result": "36893488147419111518"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 88,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "copy",
      "confirmations": null,
      "params": {
        "copyPath": [
          "earlierRoundAnswer"
        ]
      },
      "CreatedAt": "2021-08-27T16:16:00.172638+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.172638+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "825ed16c-b662-4fb2-ac2d-abeee3259cfc",
    "result": {
      "data": {
        "result": "0x000000000000000000000000000000000000000000000002000000000000205e"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 89,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "ethuint256",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.173151+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.173151+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "58ade305-bc91-4542-83b5-8b4e0018eebf",
    "result": {
      "data": {
        "result": "0x000000000000000000000000000000000000000000000002000000000000205e",
        "address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
        "dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
        "unixDateTime": "1625097600",
        "functionSelector": "0x4ab0d190",
        "aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
        "__chainlink_result_collection__": [
          "0x000000000000000000000000000000000000000000000002000000000000205e"
        ]
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 90,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "resultcollect",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.173677+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.173677+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "d7982f84-03be-4f41-a6ad-ee487c84fc6b",
    "result": {
      "data": {
        "address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
        "dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
        "roundAnswer": "36893488147419111519",
        "unixDateTime": "1625097600",
        "functionSelector": "0x4ab0d190",
        "laterRoundAnswer": "36893488147419111520",
        "aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
        "earlierRoundAnswer": "36893488147419111518"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 91,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "historical-price",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.174159+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.174159+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "cf3a1caa-723e-4b2f-ae50-6096007dd02e",
    "result": {
      "data": {
        "result": "36893488147419111520"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 92,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "copy",
      "confirmations": null,
      "params": {
        "copyPath": [
          "laterRoundAnswer"
        ]
      },
      "CreatedAt": "2021-08-27T16:16:00.174617+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.174617+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "53d76d5c-01b2-4e0d-8515-9f1a4901635b",
    "result": {
      "data": {
        "result": "0x0000000000000000000000000000000000000000000000020000000000002060"
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 93,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "ethuint256",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.175071+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.175071+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "1fb908bb-9539-4617-9395-4e5796e214c2",
    "result": {
      "data": {
        "result": "0x0000000000000000000000000000000000000000000000020000000000002060",
        "address": "0xb6EFEcE462EA6118A0A7EC1F2a3c7033b1F82967",
        "dataPrefix": "0xc23231a259fa1d606b3b1f8d31d6b169af467af60dbf0ac4e0014eb49553ccc70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f08086217d2ab6f717fd7a12cd3c53a94efa6761b2cdfe81000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061288b88",
        "unixDateTime": "1625097600",
        "functionSelector": "0x4ab0d190",
        "aggregatorAddress": "0x9326BFA02ADD2366b30bacB125260Af641031331",
        "__chainlink_result_collection__": [
          "0x0000000000000000000000000000000000000000000000020000000000002060"
        ]
      },
      "error": null
    },
    "status": "completed",
    "task": {
      "ID": 94,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "resultcollect",
      "confirmations": null,
      "params": {
      },
      "CreatedAt": "2021-08-27T16:16:00.175515+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.175515+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  },
  {
    "id": "8763850e-80a6-4a1b-af04-aabfb69ff2c9",
    "result": {
      "data": {
      },
      "error": "insertEthTx failed while constructing EthTx data: number of collectors 2 != number of types in ABI encoding 4"
    },
    "status": "errored",
    "task": {
      "ID": 95,
      "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
      "type": "ethtx",
      "confirmations": 1,
      "params": {
        "abiEncoding": [
          "bytes32",
          "uint80",
          "uint80",
          "uint80"
        ]
      },
      "CreatedAt": "2021-08-27T16:16:00.175982+09:30",
      "UpdatedAt": "2021-08-27T16:16:00.175982+09:30",
      "DeletedAt": null
    },
    "minimumConfirmations": 3,
    "confirmations": 1
  }
],
"createdAt": "2021-08-27T16:16:52.308136+09:30",
"finishedAt": "2021-08-27T16:18:59.22246+09:30",
"updatedAt": "2021-08-27T16:18:59.259186+09:30",
"creationHeight": "26956178",
"observedHeight": "26956180",
"payment": "0",
"initiator": {
  "id": 7,
  "jobSpecId": "33211805-3343-434c-8d51-9e4c3a8c3fef",
  "type": "runlog",
  "params": {
    "address": "0xb6efece462ea6118a0a7ec1f2a3c7033b1f82967"
  }
},
"type": "Direct request job run"

}

这是我的工作定义:

{
"name": "multi-word2",
"initiators": [
  {
    "id": 7,
    "jobSpecId": "33211805-3343-434c-8d51-9e4c3a8c3fef",
    "type": "runlog",
    "params": {
      "address": "0xb6efece462ea6118a0a7ec1f2a3c7033b1f82967"
    }
  }
],
"tasks": [
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "historical-price"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "copy",
    "params": {
      "copyPath": [
        "roundAnswer"
      ]
    }
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "ethuint256"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "resultcollect"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "historical-price"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "copy",
    "params": {
      "copyPath": [
        "earlierRoundAnswer"
      ]
    }
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "ethuint256"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "resultcollect"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "historical-price"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "copy",
    "params": {
      "copyPath": [
        "laterRoundAnswer"
      ]
    }
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "ethuint256"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "resultcollect"
  },
  {
    "jobSpecId": "332118053343434c8d519e4c3a8c3fef",
    "type": "ethtx",
    "confirmations": 1,
    "params": {
      "abiEncoding": [
        "bytes32",
        "uint80",
        "uint80",
        "uint80"
      ]
    }
  }
]

}

【问题讨论】:

  • 这里的线索是"error": "insertEthTx failed while constructing EthTx data: number of collectors 2 != number of types in ABI encoding 4"。这项工作只收集 3 个结果中的 1 个(它说 4 个中的 2 个,但 requestId 有点“自动收集”)
  • 你能发布 api 响应吗?
  • api响应:结果:{jobrunid:'c06c906-8219-da4bb64cf0f1',数据:{roundanswer:'36893488147419111519',早期的roundanswer:'36893488147419111518',laterroundanswer:'36893488147419111520'}, result: null, statusCode: 200 } 如果你比较工作示例和我的 json 输出,所有看起来都相似(显然我没有做任何 x 100 或任何东西),除了响应的部分是要附加的到数组
  • 嗯...当您将此作为网络作业进行测试时会发生什么?您看到哪个 resultcollect 失败了吗?您是否考虑过制作这项工作的 toml 版本? (我知道 toml 版本的文档还没有出来……)
  • 我发现问题在于 'chainlink_result_collection' 数组没有从 resultsCollect 传递到外部适配器调用,而是从 resultsCollect 传递到正常的 HTTP Get 任务。我通过创建一个包含 3 个请求(EA、HTTPGET、EA)的作业来验证这一点,并观察到在 HTTPGet 的 resultsCollect 中,数组正确有 2 个值,但是在最终请求 (EA) 中,数组没有传递给 EA 任务,最终结果只是最终 EA 的 1 返回值。将在 GitHub 上为此提出问题

标签: ethereum smartcontracts chainlink


【解决方案1】:

问题在于,'chainlink_result_collection' 数组没有从 resultsCollect 传递到 EA(外部适配器)调用,而是从 resultsCollect 传递到正常的 HTTP Get 任务。我通过创建一个包含 3 个请求(EA、HTTPGET、EA)的作业来验证这一点,并观察到在 HTTPGet 的 resultsCollect 中,数组正确有 2 个值,但是在最终请求 (EA) 中,数组没有传递给 EA 任务,最终结果只是最终 EA 的 1 返回值

Chainlink GitHub 上有一个 open issue

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-04
    • 2012-03-10
    • 2021-11-15
    • 2016-07-06
    • 2015-02-20
    • 2018-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多