2

We are running a GoQuorum 27.7 network. In Remix with 'default' as the EVM version, when running the function SELFBALANCE it gives the error: invalid opcode: SELFBALANCE . However, when manually choosing "petersburg" as the EVM version, it works fine.

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

contract TestCalls {

    uint256 public XYSTORED = 0;

    function setBalance() external returns(uint256) {
            XYSTORED = address(this).balance;
            return XYSTORED;
    }

    function withdawlCIC() external {
        payable(msg.sender).transfer(XYSTORED);
        XYSTORED = address(this).balance;
    }

    function emergencyWithdrawl() external {
        payable(msg.sender).transfer(XYSTORED);
    }

    function ViewXXBalance() external view returns(uint256 balance) {
        balance = address(this).balance;
    }
    
}

What is the approach to allow let it work without having to choose "petersburg" every time a contract with this function is deployed? It is a QBFT network.

 "config": {
                "chainId": 1234,
                "homesteadBlock": 0,
                "eip150Block": 0,
                "eip150Hash": "0x0000000000000000000000000000000000000000000000>
                "eip155Block": 0,
                "eip158Block": 0,
                "byzantiumBlock": 0,
                "constantinopleBlock": 0,
..........

I tried adding the following transitions to Genesis. The issue persisted:

"transitions": [{
                                "block": 54074,
                                "istanbulBlock": true
                        },
                        {
                                "block": 547122,
                                "petersburgBlock": true
                        }]

To run a function in Remix to retrieve the self balance.

Naren Murali
  • 19,250
  • 3
  • 27
  • 54
ShadiAyoub
  • 21
  • 1

0 Answers0