smartcontractkit / chainlink

node of the decentralized oracle network, bridging on and off-chain computation
https://chain.link
Other
7k stars 1.71k forks source link

[NODE] Get>Uint256[] failing during ethabiencode: type json.Number cannot be converted to decimal.Decimal #7684

Closed ijonas closed 1 year ago

ijonas commented 2 years ago

Description The ethabiencode step is not encoding "an array of numbers" any longer. Instead of encoding an array of uint256, the ethabiencode task throws an error

  ETHABIEncode: while converting argument '_data' from <nil> to uint256[]: type json.Number cannot be converted to decimal.Decimal (1310): bad input for task
  abi: (bytes32 requestId, uint256[] _data)
  data: {"requestId": $(decode_log.requestId), "_data": $(parse)}

This task and the supplied jobspec works fine under version 1.4.1 of the Chainlink node software but fails under 1.8.1.

Basic Information

Job Spec

  type = "directrequest"
  schemaVersion = 1
  name = "TL Get > Uint256[]"
  externalJobID = "a56c23c0-69b4-46a5-bfd3-b5fc91383991"
  maxTaskDuration = "0s"
  contractAddress = "0x188b71C9d27cDeE01B9b0dfF5C1aff62E8D6F434"
  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)"]
      encode_large [type="ethabiencode"
                  abi="(bytes32 requestId, uint256[] _data)"
                  data="{\\"requestId\\": $(decode_log.requestId), \\"_data\\": $(parse)}"
                  ]
      encode_tx  [type="ethabiencode"
                  abi="fulfillOracleRequest2(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes calldata data)"
                  data="{\\"requestId\\": $(decode_log.requestId), \\"payment\\":   $(decode_log.payment), \\"callbackAddress\\": $(decode_log.callbackAddr), \\"callbackFunctionId\\": $(decode_log.callbackFunctionId), \\"expiration\\": $(decode_log.cancelExpiration), \\"data\\": $(encode_large)}"
                  ]

      submit_tx    [type="ethtx" to="0x188b71C9d27cDeE01B9b0dfF5C1aff62E8D6F434" data="$(encode_tx)"]

      decode_log -> decode_cbor -> fetch -> parse  -> encode_large -> encode_tx -> submit_tx
  """

Environment Variables

ADVISORY_LOCK_CHECK_INTERVAL    1s
ADVISORY_LOCK_ID    1027321974924625846
ALLOW_ORIGINS   *
BLOCK_BACKFILL_DEPTH    10
BLOCK_HISTORY_ESTIMATOR_BLOCK_DELAY 0
BLOCK_HISTORY_ESTIMATOR_BLOCK_HISTORY_SIZE  0
BLOCK_HISTORY_ESTIMATOR_TRANSACTION_PERCENTILE  0
BRIDGE_RESPONSE_URL 
CHAINLINK_DEV   false
CHAINLINK_PORT  6688
CHAINLINK_TLS_HOST  
CHAINLINK_TLS_PORT  0
CHAINLINK_TLS_REDIRECT  false
CHAIN_TYPE  
DATABASE_BACKUP_FREQUENCY   1h0m0s
DATABASE_BACKUP_MODE    none
DATABASE_BACKUP_ON_VERSION_UPGRADE  true
DATABASE_LOCKING_MODE   lease
DEFAULT_HTTP_LIMIT  32768
DEFAULT_HTTP_TIMEOUT    15s
ETH_CHAIN_ID    5
ETH_HTTP_URL    
ETH_SECONDARY_URLS  [https://goerli.infura.io/v3/XXX]
ETH_URL wss://goerli.infura.io/ws/v3/XXX
EVM_RPC_ENABLED true
EXPLORER_URL    
FEATURE_EXTERNAL_INITIATORS false
FEATURE_OFFCHAIN_REPORTING  false
FLAGS_CONTRACT_ADDRESS  
FM_DEFAULT_TRANSACTION_QUEUE_DEPTH  1
GAS_ESTIMATOR_MODE  
INSECURE_FAST_SCRYPT    false
JOB_PIPELINE_REAPER_INTERVAL    1h0m0s
JOB_PIPELINE_REAPER_THRESHOLD   24h0m0s
JSON_CONSOLE    true
KEEPER_BASE_FEE_BUFFER_PERCENT  20
KEEPER_CHECK_UPKEEP_GAS_PRICE_FEATURE_ENABLED   false
KEEPER_DEFAULT_TRANSACTION_QUEUE_DEPTH  1
KEEPER_GAS_PRICE_BUFFER_PERCENT 20
KEEPER_GAS_TIP_CAP_BUFFER_PERCENT   20
KEEPER_MAXIMUM_GRACE_PERIOD 100
KEEPER_REGISTRY_CHECK_GAS_OVERHEAD  200000
KEEPER_REGISTRY_PERFORM_GAS_OVERHEAD    150000
KEEPER_REGISTRY_SYNC_INTERVAL   30m0s
KEEPER_REGISTRY_SYNC_UPKEEP_QUEUE_SIZE  10
KEEPER_TURN_FLAG_ENABLED    false
KEEPER_TURN_LOOK_BACK   1000
LEASE_LOCK_DURATION 10s
LEASE_LOCK_REFRESH_INTERVAL 1s
LINK_CONTRACT_ADDRESS   
LOG_FILE_DIR    /chainlink
LOG_FILE_MAX_AGE    0
LOG_FILE_MAX_BACKUPS    1
LOG_FILE_MAX_SIZE   1.02gb
LOG_LEVEL   debug
LOG_SQL false
OCR_DEFAULT_TRANSACTION_QUEUE_DEPTH 1
OCR_TRACE_LOGGING   false
P2PV2_ANNOUNCE_ADDRESSES    []
P2PV2_BOOTSTRAPPERS []
P2PV2_DELTA_DIAL    15s
P2PV2_DELTA_RECONCILE   1m0s
P2PV2_LISTEN_ADDRESSES  []
P2P_BOOTSTRAP_CHECK_INTERVAL    20s
P2P_BOOTSTRAP_PEERS []
P2P_DHT_LOOKUP_INTERVAL 10
P2P_INCOMING_MESSAGE_BUFFER_SIZE    10
P2P_LISTEN_IP   0.0.0.0
P2P_LISTEN_PORT 
P2P_NETWORKING_STACK    V1
P2P_NEW_STREAM_TIMEOUT  10s
P2P_OUTGOING_MESSAGE_BUFFER_SIZE    10
P2P_PEER_ID 
REAPER_EXPIRATION   240h0m0s
ROOT    /chainlink
SECURE_COOKIES  false
SESSION_TIMEOUT 15m0s
SHUTDOWN_GRACE_PERIOD   5s
TELEMETRY_INGRESS_LOGGING   false
TELEMETRY_INGRESS_SERVER_PUB_KEY    
TELEMETRY_INGRESS_URL   
TRIGGER_FALLBACK_DB_POLL_INTERVAL   30s

Steps to Reproduce For a working version use Chainlink v1.4.1. For a failing version use Chainlink v1.8.1.

Call the jobspec provided above with the following Solidity code sample:

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";

/**
 * @notice DO NOT USE THIS CODE IN PRODUCTION. This is an example contract.
 */
contract GetArray2 is ChainlinkClient {
    using Chainlink for Chainlink.Request;

    uint256[] public values;
    uint256 private constant ORACLE_PAYMENT = 0;

    bytes32 constant jobId = "a56c23c069b446a5bfd3b5fc91383991";

    constructor() {
        // GOERLI
        setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB);
        setChainlinkOracle(0x188b71C9d27cDeE01B9b0dfF5C1aff62E8D6F434);
    }

    /**
     * @notice Request variable bytes from the oracle
     */
    function requestValues(string memory _url, string memory _path) public {
        Chainlink.Request memory req = buildChainlinkRequest(
            jobId,
            address(this),
            this.fulfillArray.selector
        );
        req.add("get", _url);
        req.add("path", _path);
        sendOperatorRequest(req, ORACLE_PAYMENT);
    }

    function fulfillArray(bytes32 requestId, uint256[] memory _values)
        public
        recordChainlinkFulfillment(requestId)
    {
        values = _values;
    }
}

Use the following parameters for the requestValues() call:

SovaSlava commented 2 years ago

I've the same issue. But with string[] its work well.

andrejrakic commented 2 years ago

Thanks for raising this issue, @ijonas. Investigating.

vnavascues commented 1 year ago

If it helps I'm exeriencing the same with ethabiencode2 and Chainlink node v1.9.0

spaceh3ad commented 1 year ago

is this resolved? I am having the same issue. My job was working previously and it just started failing with the above mentioned error.

ijonas commented 1 year ago

I think its resolved but not released yet. Keep your eye out for any post-1.9.0 release https://github.com/smartcontractkit/chainlink/releases

Hopefully its included in the next release. We need this badly too.

spaceh3ad commented 1 year ago

I am just very curious how it could happen, since i didn't change anything in my chainlink node. The jobs just started to fail. Any guesses?

spaceh3ad commented 1 year ago

UPDATE: I managed to solve it out with:

String(theUint).valueOf()

in my EA