web3swift icon indicating copy to clipboard operation
web3swift copied to clipboard

Return nil on tx.call() (was not there few days ago)

Open TheCodewr opened this issue 6 years ago • 33 comments

when using let tokenBalance = try! tx.call() Xcode returns :

Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array<Any> but found a dictionary instead.", underlyingError: nil))

using 'web3swift', '~> 2.1.2' I tried InfuraRopstenWeb3, InfuraRinkebyWeb3 I tried erc20 get balance and ETH get balance Do you get the same issue ? thank you


update from @skywinder:

So I will be ready to assign this bounty for this fix

Requirements to succeed this bounty:

  • add internal code-check for this error: that user uses public node and send explicit warning, about public node limitation and suggestion to use private node.
  • add documentation instruction how to do this

TheCodewr avatar Feb 11 '20 09:02 TheCodewr

I got the same issue, i did not change anything and it was working nicely a few days ago. I did not yet found any solution, but i'm still looking, let me know if you find anything.

romanmuzikantov avatar Feb 12 '20 11:02 romanmuzikantov

Looks like some changes in Infura protocol. I will check it.

skywinder avatar Feb 13 '20 00:02 skywinder

@skywinder Hey. Any update on this?

iHamzaaK avatar Feb 13 '20 14:02 iHamzaaK

hello, @iHamzaaK . I'm currently busy with other tasks.

btw, worth to mention, we recently found money to support the library from the community. I would be glad to make a bounty for someone, who willing to investigate with this issue.

skywinder avatar Feb 15 '20 17:02 skywinder

@TheCodewr can you provide full code example to debug it?

skywinder avatar Feb 15 '20 17:02 skywinder

Very simple, I was using this exact code https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md It was working fine, until not ...

TheCodewr avatar Feb 15 '20 18:02 TheCodewr

@TheCodewr It may be an Infura problem similar to this. Try something similar on the local dev node

shamatar avatar Feb 15 '20 18:02 shamatar

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 0.045 ETH (12.69 USD @ $282.09/ETH) attached to it as part of the Matter Labs fund.

gitcoinbot avatar Feb 15 '20 18:02 gitcoinbot

I'm investigating, it appears that it is an update to geth-1.9, continuing to look for the best solution, reporting to go-ethereum.

aranhaagency avatar Feb 15 '20 20:02 aranhaagency

thanks, @aranhaagency please, let me know if you find any details, what cause the problem

skywinder avatar Feb 16 '20 10:02 skywinder

I am using version 2.2 and found this problem when send Eth or sned Erc20 token

haizhiwen avatar Feb 16 '20 11:02 haizhiwen

I am using version 2.2 and found this problem when send Eth or sned Erc20 token

2.2 version or what ?

TheCodewr avatar Feb 16 '20 13:02 TheCodewr

I am using version 2.2 and found this problem when send Eth or sned Erc20 token

2.2 version or what ?

2.2.1

haizhiwen avatar Feb 17 '20 01:02 haizhiwen

I did some tests with the infura api and it does not deliver the balance on all requests, not if there is a similar service on the mainet I am researching.

I thought of a solution, if infura answer is null, our api hits the xxXx service which will have a new answer with the correct balance. If there are 3 services we can make a switch case.

that's an idea, I accept suggestions on that too.

aranhaagency avatar Feb 17 '20 14:02 aranhaagency

update on other issue: https://github.com/ethereum/go-ethereum/issues/20685

aranhaagency avatar Feb 17 '20 21:02 aranhaagency

Can I make a balance call through Alchemy's api? was added to the project by this pull here https://github.com/matter-labs/web3swift/pull/193

aranhaagency avatar Feb 17 '20 21:02 aranhaagency

You should be able to instantiate a generic JsonRPCProvider using either https or websocket transport and use it with alchemy

shamatar avatar Feb 17 '20 21:02 shamatar

Perfect, @shamatar thanks!

aranhaagency avatar Feb 17 '20 21:02 aranhaagency

Hi All, So somehow, using same swift 2.2.1 looks like system is back on game again. Now I get the balance value using same code and ropsten, or rinkeby Note that I DID NOT do any change from the date of the disclaim Have a good one

TheCodewr avatar Feb 18 '20 15:02 TheCodewr

The problem is on geth old versions @TheCodewr ?

aranhaagency avatar Feb 18 '20 17:02 aranhaagency

How can we prevent something from breaking our lib, we can make a release system what do you think @skywinder ?

aranhaagency avatar Feb 18 '20 17:02 aranhaagency

Version 2.2.1 All other functions are available, except that the transfer fails, send eth or send erc20 token got that error

haizhiwen avatar Feb 19 '20 02:02 haizhiwen

aaand the same issue is back again .... (no environement changes or code changes on my side)

TheCodewr avatar Feb 19 '20 14:02 TheCodewr

The problem is on geth old versions @TheCodewr ?

I don't know

TheCodewr avatar Feb 19 '20 14:02 TheCodewr

Thanks @TheCodewr in all my apoton searches for geth failure, the behavior is normal by alchmyst

aranhaagency avatar Feb 19 '20 21:02 aranhaagency

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Workers have applied to start work.

These users each claimed they can complete the work by 3 hours from now. Please review their action plans below:

1) baldyash has applied to start work (Funders only: approve worker | reject worker).

Find what's wrong and fix this issue

Learn more on the Gitcoin Issue Details page.

gitcoinbot avatar Mar 16 '20 13:03 gitcoinbot

@TheCodewr hi, could you provide a complete failed case (with addresses)?

Because I've tried it by myself and I am unable to reproduce your problem, also this test passes.

For now, I will close this issue, but feel free to reopen it.

zkToha avatar Mar 16 '20 15:03 zkToha

Same issue... Is there any solution? Who can share, please?

i-Roma avatar Sep 09 '20 17:09 i-Roma

@i-Roma What a "Heisenbug" Can't reproduce it. can you provide nore details?

skywinder avatar Sep 21 '20 07:09 skywinder

Keep in mind that enchantments & pull requests to this repo are eligible for the GitCoin grant program that we received. So if you are willing to contribute - don't hesitate to do this. I will make a bounty (by ETH or Dai) to reward your contribution!

skywinder avatar Sep 21 '20 10:09 skywinder