chainlink
chainlink copied to clipboard
[NODE] ethtx task fails to parse minConfirmations as uint and string from cborparse
Description
Attempting to set ethtx
minConfirmations
via cborparse
output makes the jobrun error with:
"__typename": "JobRun",
"id": "110",
"allErrors": [
"minConfirmations: strconv.ParseUint: parsing "$(decode_cbor.minConfirmations)": invalid syntax: bad input for task"
],
"createdAt": "2022-05-25T13:15:26.136101Z",
"fatalErrors": [
"minConfirmations: strconv.ParseUint: parsing "$(decode_cbor.minConfirmations)": invalid syntax: bad input for task"
],
No matter whether I send it as uint256
or string
, the error is the same.
Strategy 1 - Passing minConfirmations
as uint256
:
_req.addUint("minConfirmations", uint256(spec.minConfirmations)); // NB: I do have a uint48
Strategy 2 - Passing minConfirmations
as string
:
_req.add("minConfirmations", Strings.toString(spec.minConfirmations)); // NB: I do use OZ Strings library
However, gasLimit
can be passed as uint256
and set via cborparse
output:
req.addUint("gasLimit", uint256(gasLimit));
Basic Information
Reproduced with Chainlink Node v1.2.0 and v1.4.1
Environment Variables
Not relevant
Steps to Reproduce
The hard way is implementing a consumer contract that sends minConfirmations
. I haven't tried it using a webhook
job though (I remember breaking an old node version attempting to make an ethtx
via webhook
job).
Thanks!
I have been able to replicate this. Marking this as Investigating
.
Summary:
- Confirmed that I reproduced the reported error with the following
ETH Tx
configuration, where minConfirmations is parsed from the request data.
submit_tx [type="ethtx" to="0x1CCcE43b66a90310af77ee7364aBecf77381d1c8" data="$(encode_tx)" minConfirmations="$(decode_cbor.minConfirmations)"]
and the smart contract's request builder:
uint48 public minConfirmations = 2;
...
...
function requestEthereumPrice(address _oracle, string memory _jobId) public onlyOwner {
....
....
req.addUint("minConfirmations", uint256(minConfirmations));
}
- in the Job's TOML, when writing the
ETH Tx
task, we need to hardcode the minConfirmations within quotes as below. (The GUI's TOML validator complains if there are no quotes - it's invalid input.)
submit_tx [type="ethtx" to="0x1CCcE43b66a90310af77ee7364aBecf77381d1c8" data="$(encode_tx)" minConfirmations="2"]
Initial conclusion
This minConfirmations
parameter should be configurable in the TOML as per the docs and the node shouldn't force a hardcoded value in the Job's spec.
Full TOML Job Spec to repro issue is here. submit_tx
has the minConfirmations="$(decode_cbor.minConfirmations)
that seems to be the problem.
type = "directrequest"
schemaVersion = 1
name = "Get > Uint256-github"
externalJobID = "56949249-4237-4eee-b9fd-84f25cea0850"
maxTaskDuration = "0s"
contractAddress = "0x1CCcE43b66a90310af77ee7364aBecf77381d1c8"
minIncomingConfirmations = 0
minContractPaymentLinkJuels = "0"
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="http" method=GET url="$(decode_cbor.get)"]
parse [type="jsonparse" path="$(decode_cbor.path)" data="$(fetch)"]
multiply [type="multiply" input="$(parse)" times=100]
encode_data [type="ethabiencode" abi="(uint256 value)" data="{ \\"value\\": $(multiply) }"]
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="0x1CCcE43b66a90310af77ee7364aBecf77381d1c8" data="$(encode_tx)" minConfirmations="$(decode_cbor.minConfirmations)"]
decode_log -> decode_cbor -> fetch -> parse -> multiply -> encode_data -> encode_tx -> submit_tx
"""
Hi @zeuslawyer any progress on this? Thanks