【发布时间】:2021-11-22 23:08:47
【问题描述】:
我正在开发一个外部适配器,但当我向我的本地链链接节点发出请求时它不工作。我在encode_tx 步骤中有这个错误。
这是错误:ETHABIEncode: while converting argument 'data' from <nil> to bytes32: incorrect length: expected 32, got 32: bad input for task: bad input for task
这是工作规范:
type = "directrequest"
schemaVersion = 1
name = "eth-lottery-job-test4"
contractAddress = "0x1Cc100f9c198d9CD3410263D4Df7FA7C5C30E34F"
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)"]
fetch [type="bridge" name="eth-lottery-test" requestData="{\\"id\\":$(jobSpec.externalJobID), \\"data\\": {\\"username\\":$(decode_cbor.username), \\"password\\":$(decode_cbor.password), \\"winner_ticket\\":$(decode_cbor.winner_ticket), \\"tickets\\":$(decode_cbor.tickets)}}"]
parse [type="jsonparse" path="data,winners" data="$(fetch)"]
encode_data [type="ethabiencode" abi="(uint256[] winners)" data="{ \\"winners\\": $(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="0x1Cc100f9c198d9CD3410263D4Df7FA7C5C30E34F" data="$(encode_tx)"]
decode_log -> decode_cbor -> fetch -> parse -> encode_data -> encode_tx -> submit_tx
"""
我认为问题出在 abi=(uint256[] winners) 的 encode_data 任务中。这是 uint256 数组的正确 abi 吗?
parse 任务的输出是[6,14,25],encode_data 任务的输出是:0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000019
我也认为encode任务结果不正确。
【问题讨论】: