Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Encoding of uninitalized string property of a contract failed  #5090

@nazarhussain

Description

@nazarhussain

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

For a contract which have a string property but not intialized, the returning value cause an encoding error.

AbiError: Parameter decoding 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.

Expected Behavior

Such scenario should return into empty string.

Steps to Reproduce

The solidity contract.

contract MyContract {
	string private myAttribute;

	function getAttr() public view returns (string memory) {
		return myAttribute;
	}
}

The web3 code.

let contract = new Contract(MyContractAbi);
contract = await contract.deploy().send(....);

await contract.methods.getAttr().call();

The following scenario can also be reproduced with Greeter.sol contract we have.

Web3.js Version

4.x

Environment

No response

Anything Else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions