0

I have deployed a PoA network using Hyperledger Besu and I'm using Remix in order to code a very simple smart contract.

Here is the smart contract code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.8;

contract management {
    address [] public addressArray;                           // List of accounts agents
    constructor( ) public {
        addressArray.push (0x5170147D2e73C876Ab19dA687fBBC0fDD7d5C24B);
        addressArray.push (0x81537B2D16C0107E4E5368a96C34CddE631f6574);
        addressArray.push (0x3A1efCfF3C76BF5a4EF07264C7b13097f3111d8e);
        addressArray.push (0x4048cA94C733470FD968C849Df0BD61C4d472550);
        addressArray.push (0xa021Fbd79c01419F1867058597713D25fEb0cC91);
        addressArray.push (0x4637EC7fe8C8Eb7Dd6B5B087070B99b4c4b86137);
    }
    
    function removeAgent () public {
        
        addressArray.pop();
        
    }
    
    function addAgent (address _newAddress) public {
        addressArray.push(_newAddress);
    }
}

When I deploy the smart contract, I can access to array elements and I can use addAgent method, but if I try to send the transaction of removeAgent method, I get this error on Remix:

transact to management.removeAgent errored: Error: Returned error: Intrinsic gas exceeds gas limit

I have tried to use a large number of gas (6000000000), but the error persists. If I comment the addressArray.pop() code line, I can use the method.

So, what's the problem with addressArray.pop()? Any idea?

  • Can you try changing "EVM version" to "byzantium" in the Remix's compiler setting? Perhaps solc uses an opcode that is not implemented in besu yet. – Ismael Jun 18 at 16:36
  • @Ismael thank you for your answer. I just tried all the EVM version with the same result. – manumonti Jun 18 at 21:38
  • Is the array empty? I'd check besu logs for some error. The solidity code seems correct. I'd say it is something with besu, perhaps you can try asking besu developers. – Ismael Jun 19 at 5:50
  • @Ismael no, the array is not empty since is filled in constructor method. An update: if I use addressArray.pop() on constructor (after the last push()), then pop works (array Length is 5 then). So, the problem is using array.pop() in a function... – manumonti Jun 19 at 9:04
1

Finally, as @Ismael said, it seems to be a problem with Besu. I updated from version 1.4.4 to 1.5.0 and now it's working properly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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