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

getPastEvents failing to decode empty data #1916

Closed
andrewheadricke opened this issue Sep 4, 2018 · 68 comments · Fixed by #2106
Closed

getPastEvents failing to decode empty data #1916

andrewheadricke opened this issue Sep 4, 2018 · 68 comments · Fixed by #2106
Assignees
Labels
Bug Addressing a bug

Comments

@andrewheadricke
Copy link

I'm trying out web3 v1.0.0-beta.36 and having some trouble with pulling events from a contract.

The events do not return any data, and getPastEvents is throwing this error:

Error: Returned values aren't valid, did it run Out of Gas?

The same action works in web3 0.20.7 no problem.

Is it possible a bug in decoding of empty event data 0x may have slipped through the cracks?

@Boehrner
Copy link
Contributor

Boehrner commented Sep 5, 2018

Probably same issue here.

Error: Returned values aren't valid, did it run Out of Gas?

TestCode:

contract = new web3.eth.Contract(abi,address);    

contract.events.TestEvent(()=>{
}).on('data', function(event){
 console.log(event);
}).on('error', function(error){
 console.log(error);
});

Did work in beta.35 throws error in beta.26 althougt not in the error handler.

@goodstemy
Copy link

Same problem on web3 beta.35 and beta.36

@pstuermlinger
Copy link

pstuermlinger commented Sep 5, 2018

I'm running into the same issue with 1.0.0-beta.36 and MetaMask provider.

Edit: Error occurs in web3-eth-abi index.js:226. The bytes parameter has a value of 0x and outputs === [].

As a workaround I uncommented that error throwing line. I can't see any negative side effects so far. The event is accessable and my DAPP works as intended. It's just that weirdo in between.

Here's an example transaction causing web3 to break: https://rinkeby.etherscan.io/tx/0x2f943ce121c47624fc00b7829bf5d8cae26c1fe97365c250063d7da6d9a1f6df

The according solidity event:
event Release(uint256 indexed id, address indexed owner);
Provisioned values: (8, msg.sender)

@lutianzhou001
Copy link

Probably same issue here.

Error: Returned values aren't valid, did it run Out of Gas?

TestCode:

contract = new web3.eth.Contract(abi,address);    

contract.events.TestEvent(()=>{
}).on('data', function(event){
 console.log(event);
}).on('error', function(error){
 console.log(error);
});

Did work in beta.35 throws error in beta.26 althougt not in the error handler.

have u solved it yet? I have met the same problem

@andrewheadricke
Copy link
Author

The comment previous to yours mentions how to fix it.

@ghost
Copy link

ghost commented Sep 15, 2018

Got the same issue.
the version of web3: 1.0.0-beta.33;
the detail code:

const Web3 = require("web3");

let web3 = new Web3(
  new Web3.providers.WebsocketProvider("wss://rinkeby.infura.io/ws")
);

const ABI = [...];
const addrC = '0x...';
const testC = new web3.eth.Contract(ABI,addrC);

testC.getPastEvents("Log", { fromBlock: 0, toBlock: "latest" }, function(
  error,
  events
) {
  if (error) {
    console.log(error);
  } else {
    console.log(events);
  }
});

the output:

Error: Returned values aren't valid, did it run Out of Gas?
    at ABICoder.decodeParameters (C:\Users\userName\Desktop\web3-1\node_modules\web3-eth-abi\src\index.js:226:15)
    at ABICoder.decodeLog (C:\Users\userName\Desktop\web3-1\node_modules\web3-eth-abi\src\index.js:283:52)
    at Object.Contract._decodeEventABI (C:\Users\userName\Desktop\web3-1\node_modules\web3-eth-contract\src\index.js:377:31)
    at C:\Users\userName\Desktop\web3-1\node_modules\web3-core-method\src\index.js:160:57
    at Array.map (<anonymous>)
    at Method.formatOutput (C:\Users\userName\Desktop\web3-1\node_modules\web3-core-method\src\index.js:159:23)
    at sendTxCallback (C:\Users\userName\Desktop\web3-1\node_modules\web3-core-method\src\index.js:473:33)
    at Object.<anonymous> (C:\Users\userName\Desktop\web3-1\node_modules\web3-core-requestmanager\src\index.js:147:9)
    at C:\Users\userName\Desktop\web3-1\node_modules\web3-providers-ws\src\index.js:121:44
    at Array.forEach (<anonymous>)
    at W3CWebSocket.WebsocketProvider.connection.onmessage (C:\Users\userName\Desktop\web3-1\node_modules\web3-providers-ws\src\index.js:98:36)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (C:\Users\userName\Desktop\web3-1\node_modules\yaeti\lib\EventTarget.js:107:17)
    at W3CWebSocket.onMessage (C:\Users\userName\Desktop\web3-1\node_modules\websocket\lib\W3CWebSocket.js:234:14)
    at WebSocketConnection.<anonymous> (C:\Users\userName\Desktop\web3-1\node_modules\websocket\lib\W3CWebSocket.js:205:19)
    at WebSocketConnection.emit (events.js:182:13)
    at WebSocketConnection.processFrame (C:\Users\userName\Desktop\web3-1\node_modules\websocket\lib\WebSocketConnection.js:552:26)
    at C:\Users\userName\Desktop\web3-1\node_modules\websocket\lib\WebSocketConnection.js:321:40
    at process._tickCallback (internal/process/next_tick.js:61:11)

@12548
Copy link

12548 commented Sep 17, 2018

Same problem on beta.36

@exogenesick
Copy link

exogenesick commented Sep 19, 2018

It looks like given error:

Error: Returned values aren't valid, did it run Out of Gas?

only occures when event definition which You want to read/download using getPastEvents method has every parameter field marked as indexed.

Transfer event definition from ERC-721:

  event Transfer(
    address indexed _from,
    address indexed _to,
    uint256 indexed _tokenId
  );

Use getPastEvents to read Transfer events will fail due to such error. This also means that You custom events build in Your contracts will also fails.

I tested events with mixed fields (2 x indexed, 2 x not indexed) and it works fine for me.
Seems like we have to wait for patch or propose one.

@AC0DEM0NK3Y
Copy link

AC0DEM0NK3Y commented Sep 27, 2018

This seems to be an issue many are hitting including myself. Just attempting to go back through the versions to try and see where this may have started.

Can confirm this was introduced in v1.0.0-beta.36 in my case, specifying v1.0.0-beta.35 exactly and re-running brings up events as expected rather than the "Error: Returned values aren't valid, did it run Out of Gas?".

@nezzard
Copy link

nezzard commented Sep 28, 2018

[email protected] works fine

@csmartinsfct
Copy link

Same issue. Downgrading to beta 35 worked for as well.

@nivida
Copy link
Contributor

nivida commented Sep 28, 2018

Thanks for submitting this issue I will fix that in the next build.

@csmartinsfct
Copy link

The issue isn't specific to handling empty data, it fails for me when data is supposed to be returned as well. Just to make that clear :)

@yzhang1994
Copy link

same issue

@moskalyk
Copy link

moskalyk commented Oct 4, 2018

I get the same issue using web3.eth.ens.getMultihash on the version 36 and 35. Any advice? I can confirm that there would be nothing returned (as previously 'web3.eth.ens.setMultihash' was never set on this ENS address. Thanks.

yarrumretep pushed a commit to yarrumretep/web3_1916 that referenced this issue Oct 5, 2018
@yarrumretep
Copy link

Added simple project that demonstrates this issue. It happens also when the event has only indexed values - hence no data.

https://github.com/yarrumretep/web3_1916

My fix:

patch-package
--- a/node_modules/web3-eth-abi/src/index.js
+++ b/node_modules/web3-eth-abi/src/index.js
@@ -280,7 +280,7 @@ ABICoder.prototype.decodeLog = function (inputs, data, topics) {
 
 
     var nonIndexedData = data;
-    var notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : [];
+    var notIndexedParams = (nonIndexedData && nonIndexedData !== '0x') ? this.decodeParameters(notIndexedInputs, nonIndexedData) : [];
 
     var returnValue = new Result();
     returnValue.__length__ = 0;

@AleG94
Copy link

AleG94 commented Oct 6, 2018

Any ETA for the next build?

@Deelux
Copy link

Deelux commented Oct 7, 2018

I got the same error. The weird things is all worked fine, untill suddenly it gave me that error.
Downgrading to 1.0.0-beta.35 gives me this error:
Couldn't decode uint256 from ABI: 0x

@yarrumretep how do we implement your fix?
I changed the proposed data in the index.js file.
The errror is still there.

Update:
I think this error has to do with MetaMask. I was running some tests and it turns out I don't have the error when I run my browser in private mode. Then when I removed MetaMask, all worked fine again.
Hope this helps @nivida .

@masterial
Copy link

1.0.0-beta.35 also solves it for me. Fix this.

@0xdantrinh
Copy link

1.0.0-beta.35 also solves it for me. Fix this.

Bump

@rafialhamd
Copy link

rafialhamd commented Oct 10, 2018

Had the same error with version 1.0.
But, in my case I'm not dealing with events... but, calling a getter method that would return an int value which is zero ('0').

Error: Returned values aren't valid, did it run Out of Gas?

Rinkeby testnet:

        web3 = new Web3(web3.currentProvider);
        var address = "0xc6482382047fb50e8e7b4658425c9756b28f995c";
        var abi = [
                    ...
                    ];
        contract = new web3.eth.Contract(abi, address);
        contract.methods.getCounter().call().then((result) => {
            console.log(result);
        }).catch(function(err){
            console.log('err...\n'+err);
        });

Switched to version web3.js 1.0.0-beta.35.
But, this time the error is different:

Error: Couldn't decode from ABI: 0x.

Any idea?

@Veniamin
Copy link

I had error "Error: Couldn't decode from ABI: 0x." when call get request with wrong contract address

@rafialhamd
Copy link

@Veniamin Thank You!

You made my day :-)

I was using 'account address', instead of 'contract address' :-P

@mryellow
Copy link

1.0.0-beta.35 also solves it for me. Fix this.

Experiencing this with 1.0.0-beta.36 when reading Zepplin's new Transfer event which now has all parameters set to indexed.

@0xferit
Copy link

0xferit commented Oct 23, 2018

Using 1.0.0-beta36, having this issue, this fix works.

felixcrazzolara added a commit to RSchwan/Bloodchain that referenced this issue Feb 14, 2019
@AdhikariNaveen
Copy link

Downgrading to beta 33 bring me more trouble than solution

For the first campaign in the same address, I was able to get the requests and manipulate on the same, however, while I created another campaign this error started to pop up whenever I try to click on the get request button.
"dependencies": {
"fs-extra": "^7.0.1",
"ganache-cli": "^6.3.0",
"mocha": "^5.2.0",
"next": "^4.1.4",
"next-routes": "^1.4.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.85.0",
"solc": "^0.4.25",
"truffle-hdwallet-provider": "0.0.3",
"web3": "^1.0.0-beta.37"

@nivida
Copy link
Contributor

nivida commented Feb 18, 2019

@DiePlease This means this error still occurs in the latest version? It shouldn't because I've tested it and it worked. 🤔

@SpasiboKojima
Copy link

SpasiboKojima commented Feb 21, 2019

@DiePlease This means this error still occurs in the latest version? It shouldn't because I've tested it and it worked. thinking

I confirm, faced that issue with beta 46, nothing helped so far and I had to deprecate the events causing this.

@AdhikariNaveen
Copy link

@nivida I am still facing the same issue

@andrewheadricke
Copy link
Author

andrewheadricke commented Feb 22, 2019

The 4th comment (6 months ago) for this issue mentions how to fix it, comment out one line. I made this change months ago and have not had an issue since. So not sure why this issue still remains unresolved.

@asadhayat1068
Copy link

New version is using Promises,
I was getting the same error and then following code work for me.
z4contract.methods.name().call() .then((result) => { console.log(result); });

@EddieOne
Copy link

EddieOne commented Mar 6, 2019

promises don't work quite the same in a for loop as await/async. This bug is so annoying though.

@mallapurbharat
Copy link

facing the same issue in [email protected]. However, code works fine without any problems? Can I ignore this error?


Uncaught (in promise) Error: Returned values aren't valid, did it run Out of Gas?
    at ABICoder.../../../.nvm/versions/node/v8.15.1/lib/node_modules/embark/node_modules/web3-eth-abi/src/index.js.ABICoder.decodeParameters (index.js:226)
    at Contract.../../../.nvm/versions/node/v8.15.1/lib/node_modules/embark/node_modules/web3-eth-contract/src/index.js.Contract._decodeMethodReturn (index.js:465)
    at Method.outputFormatter (index.js:818)
    at Method.../../../.nvm/versions/node/v8.15.1/lib/node_modules/embark/node_modules/web3-core-method/src/index.js.Method.formatOutput (index.js:163)
    at sendTxCallback (index.js:473)
    at Object.<anonymous> (index.js:147)
    at index.js:121
    at Array.forEach (<anonymous>)
    at WebSocket.WebsocketProvider.connection.onmessage (index.js:98)

@mjdietzx
Copy link

also seeing this bug in [email protected]

@ManoloAlvarezForo
Copy link

ManoloAlvarezForo commented Mar 26, 2019

Same issue executing "contract.methods.name().call() .then((result) => { console.log(result); });"

I noticed in this method
in web3-eth-abi

before in a method bytes is "0x" then
if (response.length >= 2) {
response = response.slice(2);
}
so bytes now is = "" then is sending to:
.....
key: "decodeParameters",
value: function decodeParameters(outputs, bytes) {
if (outputs.length > 0 && (!bytes || bytes === '0x' || bytes === '0X')) {
throw new Error("Returned values aren't valid, did it run Out of Gas?");
}
....

bytes = "" so always return "Returned values aren't valid, did it run Out of Gas?"

@mcplums
Copy link

mcplums commented Mar 29, 2019

I'm having the same error when doing truffle migrate. But ONLY when using Ganache GUI, not when using Ganache CLI. Does this imply the problem is not in fact with web3?

I tried downgrading web2 to 35 (from 37) like others suggested but it didn't make a difference.

@nivida
Copy link
Contributor

nivida commented Mar 30, 2019

This got fixed with the PR #2608 and will be released asap.

@exody16
Copy link

exody16 commented Jun 5, 2019

Same error on web3:1.0.0-beta.37 - Resolved by downgrading the solc from 0.5.9 to 0.5.3.

@wangjunbao2018
Copy link

Same error on Web3.js v1.0.0-beta.37

@kunaltawatia
Copy link

@wangjunbao2018

Same error on Web3.js v1.0.0-beta.37

Resolved by downgrading the solc compiler version to 0.5.1+commit.c8a2cb62

@tomxucnxa
Copy link

tomxucnxa commented Oct 4, 2019

Same error when call methods.mymethods().call():
web3 version: 1.2.1
Error msg: Error: Returned values aren't valid, did it run Out of Gas?

But it works by downgrading the solc compiler version to 0.5.1+commit.c8a2cb62
Thanks to @kunaltawatia

@ghost
Copy link

ghost commented Mar 5, 2020

I'm experiencing the same problem by running:

contract.methods.balanceOf('0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1').call()

directly in truffle console where contract = new web3.eth.Contract(JSON.parse(abi), '0x6b175474e89094c44da98b954eedeac495271d0f') (DAI)

Truffle v5.1.13 (core: 5.1.13)
Solidity - 0.5.1 (solc-js)
Node v10.14.1
Web3.js v1.2.1

Using a Geth node (Ethereum Grid) and ganache-cli --fork http://localhost:8545

That simple call() above returns:

Error: Returned values aren't valid, did it run Out of Gas?

@cgewecke
Copy link
Collaborator

cgewecke commented Mar 5, 2020

@0xether There might be a problem with the ABI you're passing in.

Just tried this call using Web3 1.2.6 and the ABI published to etherscan, here.

  const web3 = new Web3('https://mainnet.infura.io/v3/<INFURA_ID>');
  const abi = [{"inputs":[{"internalType":"uint256","name":"chainId_","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":true,"internalType":"address","name":"guy","type":"address"},{"indexed":false,"internalType":"uint256","name":"wad","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":true,"inputs":[{"indexed":true,"internalType":"bytes4","name":"sig","type":"bytes4"},{"indexed":true,"internalType":"address","name":"usr","type":"address"},{"indexed":true,"internalType":"bytes32","name":"arg1","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"arg2","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"LogNote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":true,"internalType":"address","name":"dst","type":"address"},{"indexed":false,"internalType":"uint256","name":"wad","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"usr","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"usr","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"usr","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"move","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"bool","name":"allowed","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"usr","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"pull","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"usr","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"push","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"wad","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}];
  const contract = new web3.eth.Contract(abi, '0x6b175474e89094c44da98b954eedeac495271d0f');
  const balance = await contract.methods.balanceOf('0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1').call();
  console.log('balanceOf --> ' + balance);

..outputs

balanceOf --> 0

@nogo10
Copy link

nogo10 commented May 23, 2020

Same error when using solidity version ^0.6.0;
I noticed that some of solc 0.6.x breaking changes involves ABI: "ABI: Remove the deprecated constant and payable fields." and "The type field is now required and no longer specified to default to function."

I did a dump of my ABI from upgrade to 0.6.x (below) and similar dump from 0.5.x: Constant is deprecated maybe that's the problem (?)

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"Update","type":"uint256"}],"name":"NewData","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldRelayHub","type":"address"},{"indexed":true,"internalType":"address","name":"newRelayHub","type":"address"}],"name":"RelayHubChanged","type":"event"},{"inputs":[],"name":"getHubAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"context","type":"bytes"},{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"actualCharge","type":"uint256"},{"internalType":"bytes32","name":"preRetVal","type":"bytes32"}],"name":"postRelayedCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"context","type":"bytes"}],"name":"preRelayedCall","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"relayHubVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relay","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes","name":"encodedFunction","type":"bytes"},{"internalType":"uint256","name":"transactionFee","type":"uint256"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"approvalData","type":"bytes"},{"internalType":"uint256","name":"maxPossibleCharge","type":"uint256"}],"name":"acceptRelayedCall","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"}]

@jyot53
Copy link

jyot53 commented Jul 31, 2021

index.js:297 Uncaught (in promise) Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced. at ABICoder.push../node_modules/web3-eth-abi/lib/index.js.ABICoder.decodeParametersWith (index.js:297) at ABICoder.push../node_modules/web3-eth-abi/lib/index.js.ABICoder.decodeParameters (index.js:284) at Contract.push../node_modules/web3-eth-contract/lib/index.js.Contract._decodeMethodReturn (index.js:469) at Method.outputFormatter (index.js:759) at Method.push../node_modules/web3-core-method/lib/index.js.Method.formatOutput (index.js:146) at sendTxCallback (index.js:522) at cb (util.js:689) at Item.push../node_modules/process/browser.js.Item.run (browser.js:153) at drainQueue (browser.js:123)

I am facing same error :- solc 0.7.1

const loadWeb3 = async () => {
if (window.ethereum) {
window.web3 = new Web3(window.ethereum);
await window.ethereum.enable();
}else if(window.web3){
window.web3 = new Web3(window.web3.currentProvider);
}
else {
window.alert(
"Non-Ethereum browser detected. You should consider trying MetaMask!"
);
}
};

const loadBlockchainData = async () => {
// const web3 = new Web3(window.ethereum);
const web3 = window.web3;
const accounts = await web3.eth.getAccounts();

if (accounts.length === 0) {
  alert("No accounts found!!!");
  return;
}
setCurrentAccount(accounts[0]);
const networkId = await web3.eth.net.getId();
const election = new web3.eth.Contract(Electionabi.abi, "0x4b62f0869344Bbd2Caf348f1715B85876c66bBa1");
const candidate1 = await election.methods.candidates(1).call();
console.log(candidate1);

please help me to solve this error!!!

@yslaz
Copy link

yslaz commented Aug 30, 2021

Good day. I present the same problem using "web3": "^ 1.5.2" and "solc": "^ 0.8.7-fixed"
I have downgraded the versions to "web3": "^ 1.2.1" and "solc": "^ 0.5.1". But it remains the same.

Grateful for any help.

@dsgriffin
Copy link

still not fixed in latest release

@arthurwolf
Copy link

I am having the exact same issue.

Is there anything I can do? It is really blocking...

Any workaround, even ugly? Code I can modify etc?

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

Successfully merging a pull request may close this issue.