Consensys / quorum

A permissioned implementation of Ethereum supporting data privacy
https://www.goquorum.com/
GNU Lesser General Public License v3.0
4.68k stars 1.29k forks source link

How to remove invalid transaction with "contract creation code storage out of gas" error #1198

Closed kigawas closed 2 years ago

kigawas commented 3 years ago

Every time deploying a contract to Node A (port 22000), Node B (port 22001) was also trying to execute some previous deployment but failed with "contract creation code storage out of gas" error. But Node A still succeeded, so there's no actual harm.

Contract Code

// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract Migrations {
    uint256 public last_completed_migration;
    address public owner;

    modifier restricted() {
        if (msg.sender == owner) _;
    }

    constructor() {
        owner = msg.sender;
    }

    function setCompleted(uint256 completed) public restricted {
        last_completed_migration = completed;
    }

    function upgrade(address new_address) public restricted {
        Migrations upgraded = Migrations(new_address);
        upgraded.setCompleted(last_completed_migration);
    }
}

Deployed with Remix IDE.

System information

Official docker container.

$ docker exec -it 85959869334f71cd1d6c9c2e4f930296896cb08bd1ff867a163a3d1164dcabec /bin/sh
/ # geth version
Geth
Version: 1.9.7-stable
Git Commit: a21e1d44cb4da8eaaf66dedb3ae16118db0cb7ef
Quorum Version: 21.1.0
Architecture: amd64
Protocol Versions: [64 63]
Network Id: 1337
Go Version: go1.15.5
Operating System: linux
GOPATH=
GOROOT=/usr/local/go

Two nodes with istanbul BFT.

Expected behaviour

Actual behaviour

image

Steps to reproduce the behaviour

It's very subtle. Not sure how to reproduce.

Backtrace

No backtrace, just logs.

nmvalera commented 3 years ago

@kigawas This seems to be related to the way the contract is compiled and not the node itself.

Can you make sure that you use the same Solidity pragma and solc version when compiling?

kigawas commented 3 years ago

@kigawas This seems to be related to the way the contract is compiled and not the node itself.

Can you make sure that you use the same Solidity pragma and solc version when compiling?

It happened when there are some failed contract deployment transactions on one node. Looks like not really related with solidity or solc, but related with the way to dispose of failed transactions.

A probable way to reproduce is to create contract deployment transactions with wrong nonce.

nmvalera commented 3 years ago

@kigawas Thanks.

A probable way to reproduce is to create contract deployment transactions with wrong nonce.

If sending a transaction with the wrong nonce we should get either "nonce too low" errors or see transactions pending forever.

If you are sure you are compiling the contract correctly (with compatible solc version and pragma). Then can you make sure that the gas limit set on the deployment transaction is high enough? Thanks!

kigawas commented 3 years ago

@kigawas Thanks.

A probable way to reproduce is to create contract deployment transactions with wrong nonce.

If sending a transaction with the wrong nonce we should get either "nonce too low" errors or see transactions pending forever.

If you are sure you are compiling the contract correctly (with compatible solc version and pragma). Then can you make sure that the gas limit set on the deployment transaction is high enough? Thanks!

I don't think it's related with gas limit. My contracts are very simple ones (Box or Migration stuff you can find everywhere).

antonydenyer commented 2 years ago

Is there any chance you could post your genesis.json for me?

kigawas commented 2 years ago

Is there any chance you could post your genesis.json for me?

Nothing special. Just used quorum wizard to generate

baptiste-b-pegasys commented 2 years ago

I tested it with quick quick dev start and the contract, seems OK image

achraf17 commented 2 years ago

closing this for now as unable to reproduce. Feel free to reopen.