ethereum / remix-desktop

Remix IDE desktop
1.02k stars 264 forks source link

Remix IDE (Desktop) Crashes When Interacting with Contract on Polygon Mumbai #126

Open Innovoeb opened 2 years ago

Innovoeb commented 2 years ago

Unable to read a variable within a smart contract on the Polygon Mumbai network when using the desktop version of Remix IDE. I created a simple contract and deployed it to the Polygon testnet (Mumbai). Within the contract is a method that creates an array of structs and I was able to make this transaction via the desktop IDE:

Polygon Mumbai transaction hash: 0xb86afbbe8613ac1d8ead6dcfbba519a6ad17fa1f9c9fce098a961eeea04b2ebb.

When attempting to retrieve a variable within this contract, the IDE does not return the correct data within the "Deploy and Run Transactions" panel. Also, when I attempt to expand the transaction within the IDE's console the app will crash. I have enclosed a screen recording of the behavior described above. I have deployed this same contract on the Rinkeby network and the desktop IDE performs as expected. Also, I am getting the expected behavior when interacting with the contract via the web IDE. Can someone attempt to recreate this behavior by either using the provided contract address and/or by deploying a different contract on Polygon Mumbai and reading a variable within the desktop application please.

Polygon Mumbai Contract Address: 0x7E372a6e80e8B418951E48dF0f9f125d0B1f0456 Rinkeby Testnet Contract Address: 0x1e5Ccd235B7CC18279D5Cae0967f78d4Ad7282fB screen recording: https://drive.google.com/file/d/1j9VLfu825cPmTtpi0QjqF1-t_wwKJjLH/view?usp=sharing

Contract:

pragma solidity ^0.8.10;

contract ForLoop
{
    mapping(address => string) public dwarfsWallets;

    struct sevenDwarfs
    {
        string name;
        address walletAddress;
        uint256 contributions;
    }
    sevenDwarfs[] public dwarfs; // declare an array of structs
    //uint256 public dwarfsCount;

    function addDwarf(string memory _name) public payable
    {
        // push name and wallet address to the dwarfs array
        dwarfs.push(sevenDwarfs(
            _name,
            msg.sender,
            0 // will enable contributions in seperate method
        ));

        // Mapping: array input = key (should always be unique ex: address) || value = value
        dwarfsWallets[msg.sender] = _name; 
    }

    // loop thru dwarfs[] and return all structs

    // loop through an array and run a conditional
    function dwarfTest() public view returns (bool)
    {
        for (uint256 i = 0; i < dwarfs.length; i++)
        {
            // efficient way to compare string literals
            if (keccak256(bytes(dwarfs[i].name)) == keccak256("Doc") )
            {
                return true;
            }
        }

        return false;
    }

    function deleteDwarf(string memory _name) public 
    {
        for (uint256 i = 0; i < dwarfs.length; i++)
        {
            if ( keccak256(bytes(_name) ) == keccak256(bytes(dwarfs[i].name)) )
            {
                delete dwarfs[i];
            }
        }
    }

}