I'm facing some issue with test cases, I wrote some simple function in my smart contract as following:

function Create ( 
    bytes32 _a,
    address _b,
    string _c,
    address[] _d,
    uint256[] _e,

) public pure returns(bool){
    return true;

And here is the test case:

describe("Unit Test For Create Method", () => {
    it("first test case", async () => {
        const estimateGas = await Instance.Create.estimateGas(a, b, c, d, e);

while running test case, it's giving an error Error: VM Exception while processing transaction: out of gas

If I remove any single parameter, it starts working.. so, I assume there is an issue with number of arguments..any help?

Edit: I have defined variable globally:

contract('Unit Test for smart contract', function(){
        b = web3.eth.accounts[1],
        c = "fileHash",
        d = ['s1','s2'],
        e = [0,1,2],

        // test case here

1 Answer 1


After digging deeply, I found the exact cause of that error.

I was passing 36 bytes to the _a variable, wheres actual _a defined with bytes32 datatype.

In order to solve this issue, modified id to 32 bytes.


use web3 js:

id = web3.sha3("XVXIJLO-9XNQ-ZQWF-OLAF-E14L09FHZALQ");

Hope this will help to others!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.