smartcontractkit / chainlink

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

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

Open borisovdev opened 1 year ago

borisovdev commented 1 year ago

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

Steps to Reproduce

QingyangKong commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@QingyangKong Hello. Have any updates?

borisovdev commented 1 year ago

@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.