Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NODE] ETHABIEncode: type json.Number cannot be converted to decimal.Decimal #8504

Open
borisovdev opened this issue Feb 21, 2023 · 6 comments

Comments

@borisovdev
Copy link

Description
When trying to convert an array of json.Number to decimal.Decimal using the pipeline task type "ethabiencode", to then pass the array decimal.Decimal as an argument to a fulfill function of type uint256[], an error occurs:

ETHABIEncode: while converting argument '_data' from <nil> to uint256[]: type json.Number cannot be converted to decimal.Decimal: bad input for task

This error occurs both on floating point and integer numbers
Attaching a screenshot of the job error run from our Chainlink node
jobrun_error_screenshot

Archive with client-example.sol, jobspec.toml: chainlink-issue-ETHABIEncode-type-json.Number-cannot-be-converted-to-decimal.Decimal.zip

Environment

  • Network - Polygon Mumbai.
  • Chainlink Node (Docker Hub) - v1.10.0
  • gas limit - 500000

Steps to Reproduce

  • Place jobspec.toml on the Chainlink Node. Change contractAddress and submit_tx.to to your operator's contract address if necessary
  • Load the contract client-example.sol to Polygon Mumbai. If necessary, change setChainlinkOracle to your operator's contract address
  • Fund deployed client-example.sol contract with 0.75 LINK
  • Call the function requestArray("https://raw.githubusercontent.com/oraclelabs-link/chainlink-node-public-jobs/master/example-data/numbers.json", "data,prices,otherPrices") on the client-example.sol contract
  • Look at the output from the job run on the chainlink node
@QingyangKong
Copy link
Collaborator

QingyangKong commented Feb 28, 2023

Hi @borisovdev , I notice you are trying to fetch an array in the returned json. For now, array is not a supported data type in Any Api. If you want to get multiple values through a request, can you try to make a request for a multi-variable response? please check more details about contract here and toml file here.

Or you can make a request for a large response. Please check the contract here and toml file here.

@borisovdev
Copy link
Author

Hi, @QingyangKong, thanks for the reply.
I think that your statement "For now, array is not a supported data type..." is not quite correct, because we have a working example of using bytes[] data type in jobspec without any problems (https://github.com/oraclespace/chainlink-node-public-jobs/tree/master/polygon-mumbai/HTTP%20Get%20%3E%20Bytes%5B%5D)
I am also aware that version 1.1.1 supported the described jobspec format with uint256[] and executed it without errors. That's the reason why I opened the issue.
What do you think, is it still a problem as a result of functionality update or a deliberate decision to get rid of this format support (but bytes[] works though)?

@QingyangKong
Copy link
Collaborator

Hi @borisovdev , thank you for raising this. I will check if unint256[] is supported in version 1.1.1 and talk with the engineering team.

@lum1nat0r
Copy link

Hi @borisovdev , I notice you are trying to fetch an array in the returned json. For now, array is not a supported data type in Any Api. If you want to get multiple values through a request, can you try to make a request for a multi-variable response? please check more details about contract here and toml file here.

Or you can make a request for a large response. Please check the contract here and toml file here.

Hi together!

I have the exact same problem as you described OP. Your response @QingyangKong doesn't focus on the core of the problem, because even if we use Multi-Variable responses, the flexible data-structre (array) still can't be passed back to the smart contract, since it's not compatible.

I guess there is no solution to this problem right now, am I right?

@borisovdev
Copy link
Author

@QingyangKong Hello. Have any updates?

@borisovdev
Copy link
Author

@QingyangKong Update from us: Number Deserialization works correctly on 1.4.1. Colleagues tell us that the failure was after 1.5
Please tag and call the developer for comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants