首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >面临链接链接作业v2规范的问题

面临链接链接作业v2规范的问题
EN

Ethereum用户
提问于 2021-12-04 06:27:34
回答 1查看 161关注 0票数 0

我运行v1jobs时没有出现任何错误,但是为了支持同一jobID的多台服务器,我不得不转向v2job规范,所有操作都停止了。这是我的V1Job规范。

代码语言:javascript
复制
{
  "initiators": [{"type": "runlog",
      "params": {"address": "0xf6bb26a724655553a5046b62d41e29bb29da1aee"}
      }],
  "tasks": [
    {"type": "twitter-username-verification"},
    {"type": "copy"},
    {"type": "jsonparse"},
    {"type": "resultcollect"},
    {"type": "ethtx",
      "params": {
        "abiEncoding": ["bytes32","bytes"]
      }
    }
  ]
}

这是工作正常,这是我的jobv2规格为同一份工作。

代码语言:javascript
复制
type                             = "directrequest"
schemaVersion          = 1
name                           = "ConversionToV2"
contractAddress        = "0xf6bB26A724655553A5046b62D41e29bB29DA1AeE"
externalJobID            = "855ad288-8a9d-4ab1-a575-dabd631bf084"
observationSource   = """

          decode_log   [type="ethabidecodelog"
                 abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address 
                  callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"
                  data="$(jobRun.logData)"
                  topics="$(jobRun.logTopics)"]
           decode_cbor  [type="cborparse" data="$(decode_log.data)"]
           send_to_bridge [type="bridge" 
                    name="twitter-username-verification" 
                    requestData="{ \\"data\\": { \\"twitter_username\\": $(decode_cbor.twitter_username),  
                     \\"address_bytes\\":  $(decode_cbor.address_bytes)}}"]
          parse       [type="jsonparse" data="$(send_to_bridge)" path="result"]
          encode_data [type="ethabiencode"
                abi="fulfillBytes(bytes32 requestID, bytes data)",
                data="{\\"requestID\\": $(decode_log.requestId),  \\"bytesData\\": $(parse)}"
                ]
         encode_tx   [type="ethabiencode"
                 abi="fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)"
                 data="{\\"requestId\\": $(decode_log.requestId), 
                        \\"payment\\": $(decode_log.payment), 
                        \\"callbackAddress\\": $(decode_log.callbackAddr), 
                        \\"callbackFunctionId\\": $(decode_log.callbackFunctionId), 
                        \\"expiration\\": $(decode_log.cancelExpiration), 
                        \\"data\\": $(encode_data)}"
                 ]
        submit_tx [type="ethtx" to="0xf6bb26a724655553a5046b62d41e29bb29da1aee" data="$(encode_tx)"]
        decode_log -> decode_cbor -> send_to_bridge -> parse -> encode_data -> encode_tx -> submit_tx
"""

当我提交一份从智能合同到这份新工作的工作。这是我在链接节点上遇到的错误。

代码语言:javascript
复制
{
  "outputs": [
    null
  ],
  "errors": [
    "task inputs: too many errors"
  ],
  "inputs": {
    "decode_cbor": {
    },
    "decode_log": {
    },
    "encode_data": {
    },
    "encode_tx": {
    },
    "jobRun": {
      "logAddress": "0xf6bb26a724655553a5046b62d41e29bb29da1aee",
      "logBlockHash": "0x3303e64d515aa986663f5120b1bc465d281a637c31d69d258770f7820e9a2c88",
      "logBlockNumber": 3101011,
      "logData": "AAAAAAAAAAAAAAAAw+zDL+ITBQojbowN4OonA+6pQooCQb1oqu2rqnzpn9aSIMyragy4DzH4PKbbJRlaxxEpuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjhvJvwQAAAAAAAAAAAAAAAAAAw+zDL+IjbowN4OonA+6pQorC+4UjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABhqpN3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQcHR3aXR0ZXJfdXNlcm5hbWVvYW1hZmFuc29mZmljaWFsbWFkZHJlc3NfYnl0ZXNUZ7eZQ8t0oLaN2Jw8nG5j5/kS6GxkcGF0aGZyZXN1bHQAAAAAAAAAAAAAAAAAAAAA",
      "logTopics": [
        "0xd8d7ecc4800d25fa53ce0372f13a416d98907a7ef3d8d3bdd79cf4fe75529c65",
        "0x3835356164323838386139643461623161353735646162643633316266303834"
      ],
      "logTxHash": "0xa7672062ff796b0c1584317e0e6f34788251788cff67958fd88325c6e01c4b69",
      "meta": {
        "oracleRequest": {
          "callbackAddr": "0xc3EcC32FE213050a236e8C0De0EA2703eEA9428A",
          "callbackFunctionId": "0xc2fb8523",
          "cancelExpiration": "1638568823",
          "data": "0x70747769747465725f757365726e616d656f616d6166616e736f6666696369616c6d616464726573735f62797465735467b79943cb74a0b68dd89c3c9c6e63e7f912e86c647061746866726573756c74",
          "dataVersion": "1",
          "payment": "10000000000000000",
          "requestId": "0x0241bd68aaedabaa7ce99fd69220ccab6a0cb80f31f83ca6db25195ac71129b8",
          "requester": "0xc3EcC32FE213050a236e8C0De0EA2703eEA9428A",
          "specId": "0x3835356164323838386139643461623161353735646162643633316266303834"
        }
      }
    },
    "jobSpec": {
      "databaseID": 15,
      "externalJobID": "855ad288-8a9d-4ab1-a575-dabd631bf084",
      "name": "ConversionToV2.1"
    },
    "parse": {
    },
    "send_to_bridge": {
    },
    "submit_tx": {
    }
  },
  "taskRuns": [
    {
      "type": "ethabidecodelog",
      "createdAt": "2021-12-03T21:55:24.710386Z",
      "finishedAt": "2021-12-03T21:55:24.710809Z",
      "output": null,
      "error": "bad ABI specification: [34 79 114 97 99 108 101 82 101 113 117 101 115 116 40 97 100 100 114 101 115 115 32 99 97 108 108 98 97 99 107 65 100 100 114 44 32 98 121 116 101 115 52 32 99 97 108 108 98 97 99 107 70 117 110 99 116 105 111 110 73 100 44 32 32 117 105 110 116 50 53 54 32 99 97 110 99 101 108 69 120 112 105 114 97 116 105 111 110 44 32 32 98 121 116 101 115 32 100 97 116 97 44 10 32 32 32 32 32 32 32 32 117 105 110 116 50 53 54 32 100 97 116 97 86 101 114 115 105 111 110 44 32 117 105 110 116 50 53 54 32 112 97 121 109 101 110 116 44 32 98 121 116 101 115 51 50 32 114 101 113 117 101 115 116 73 100 44 32 97 100 100 114 101 115 115 32 114 101 113 117 101 115 116 101 114 44 32 117 105 110 116 50 53 54 32 115 112 101 99 73 100 41 34]: bad input for task",
      "dotId": "decode_log",
      "status": "errored"
    },
    {
      "type": "cborparse",
      "createdAt": "2021-12-03T21:55:24.710847Z",
      "finishedAt": "2021-12-03T21:55:24.711392Z",
      "output": null,
      "error": "task inputs: too many errors",
      "dotId": "decode_cbor",
      "status": "errored"
    },
    {
      "type": "bridge",
      "createdAt": "2021-12-03T21:55:24.711439Z",
      "finishedAt": "2021-12-03T21:55:24.713997Z",
      "output": null,
      "error": "task inputs: too many errors",
      "dotId": "send_to_bridge",
      "status": "not_run"
    },
    {
      "type": "jsonparse",
      "createdAt": "2021-12-03T21:55:24.714176Z",
      "finishedAt": "2021-12-03T21:55:24.715039Z",
      "output": null,
      "error": "task inputs: too many errors",
      "dotId": "parse",
      "status": "not_run"
    },
    {
      "type": "ethabiencode",
      "createdAt": "2021-12-03T21:55:24.716688Z",
      "finishedAt": "2021-12-03T21:55:24.717419Z",
      "output": null,
      "error": "task inputs: too many errors",
      "dotId": "encode_data",
      "status": "not_run"
    },
    {
      "type": "ethabiencode",
      "createdAt": "2021-12-03T21:55:24.717448Z",
      "finishedAt": "2021-12-03T21:55:24.718028Z",
      "output": null,
      "error": "task inputs: too many errors",
      "dotId": "encode_tx",
      "status": "not_run"
    },
    {
      "type": "ethtx",
      "createdAt": "2021-12-03T21:55:24.718066Z",
      "finishedAt": "2021-12-03T21:55:24.718684Z",
      "output": null,
      "error": "task inputs: too many errors",
      "dotId": "submit_tx",
      "status": "not_run"
    }
  ],
  "createdAt": "2021-12-03T21:55:24.709383Z",
  "finishedAt": "2021-12-03T21:55:24.718719Z",
  "pipelineSpec": {
    "id": 15,
    "dotDagSource": " decode_log [type="ethabidecodelog" abi="OracleRequest(address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, bytes data, uint256 dataVersion, uint256 payment, bytes32 requestId, address requester, uint256 specId)" data="$(jobRun.logData)" topics="$(jobRun.logTopics)"] decode_cbor [type="cborparse" data="$(decode_log.data)"] send_to_bridge [type="bridge" name="twitter-username-verification" requestData="{ \"data\": { \"twitter_username\": $(decode_cbor.twitter_username), \"address_bytes\": $(decode_cbor.address_bytes)}}"] parse [type="jsonparse" data="$(send_to_bridge)" path="result"] encode_data [type="ethabiencode" abi="fulfillBytes(bytes32 requestID, bytes data)", data="{\"requestID\": $(decode_log.requestId), \"bytesData\": $(parse)}" ] encode_tx [type="ethabiencode" abi="fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)" data="{\"requestId\": $(decode_log.requestId), \"payment\": $(decode_log.payment), \"callbackAddress\": $(decode_log.callbackAddr), \"callbackFunctionId\": $(decode_log.callbackFunctionId), \"expiration\": $(decode_log.cancelExpiration), \"data\": $(encode_data)}" ] submit_tx [type="ethtx" to="0xf6bb26a724655553a5046b62d41e29bb29da1aee" data="$(encode_tx)"] decode_log -> decode_cbor -> send_to_bridge -> parse -> encode_data -> encode_tx -> submit_tx "
  },
  "id": "11",
  "jobId": "15",
  "status": "errored",
  "type": "Pipeline job run"
}

这真的很奇怪,因为oracleRequest事件由operator.sol发出,与错误日志中提到的完全相同。请帮帮忙,我已经想了好很长时间了,但还远没有取得任何成功。下面是用于发布作业的契约函数的片段。

代码语言:javascript
复制
Chainlink.Request memory req = buildChainlinkRequest(jobId, address(this), this.fulfillBytes.selector);
        req.add("twitter_username", _twitterUsername);
        req.addBytes("address_bytes", abi.encodePacked(msg.sender));
        req.add("path", "result");

        // req.add("copyPath", "RAW.ETH.USD.LASTMARKET");
        // bytes32  _reqID =  requestOracleData(req, fee);
        bytes32  _reqID =  sendChainlinkRequest(req, fee);

   ............... 
}

function fulfillBytes(bytes32 _requestId, 
                    bytes calldata bytesData) 
                    public 
                    recordChainlinkFulfillment(_requestId) {
   ...........
}
代码语言:javascript
复制
EN

回答 1

Ethereum用户

发布于 2021-12-20 19:27:25

这是工作规范。上面发布的JobSpec中有三个错误。

  1. 所有的任务都应该放在一条线上,不应该分割成多条线。
  2. 在编码数据中,它使用的是requestId而不是requestID。
代码语言:javascript
复制
                abi="fulfillBytes(bytes32 requestID, bytes data)",
  1. 由于它将是从适配器返回的多字响应,节点应该调用的函数应该是fulfillOracleRequest2而不是fulfillOracleRequest。
代码语言:javascript
复制
type = "directrequest"
schemaVersion = 1
name = "Version0.4"
contractAddress = "0x8aD2f78b9E05628C32096DB3575687A9Ee2FCF74"
externalJobID = "1b1fb378-03b3-482c-87d1-47f6f50a5706"
maxTaskDuration = "0s"
observationSource = """
  decode_log   [type="ethabidecodelog" abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4    callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)" data="$(jobRun.logData)" topics="$(jobRun.logTopics)"]
  decode_cbor  [type="cborparse" data="$(decode_log.data)"] send_to_bridge [type="bridge"  name="twitter-username-verification" requestData="{ \\"data\\": {\\"twitter_username\\": $(decode_cbor.twitter_username), \\"address_bytes\\":  $(decode_cbor.address_bytes)}}"]
  parse       [type="jsonparse" data="$(send_to_bridge)" path="result"] 
  encode_data [type="ethabiencode" abi="(bytes32 requestId, bytes memory bytesData)", data="{\\"requestId\\": $(decode_log.requestId),  \\"bytesData\\": $(parse)}"]
  encode_tx   [type="ethabiencode" abi="fulfillOracleRequest2(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration,bytes data)" data="{\\"requestId\\": $(decode_log.requestId), \\"payment\\": $(decode_log.payment), \\"callbackAddress\\": $(decode_log.callbackAddr),\\"callbackFunctionId\\": $(decode_log.callbackFunctionId), \\"expiration\\": $(decode_log.cancelExpiration), \\"data\\": $(encode_data)}"]
  submit_tx [type="ethtx" to="0x8aD2f78b9E05628C32096DB3575687A9Ee2FCF74" data="$(encode_tx)"]
  decode_log -> decode_cbor -> send_to_bridge -> parse -> encode_data -> encode_tx -> submit_tx
"""
票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/114923

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档