0

I'm trying to implement @robhitchens CRUD storage pattern in solidity, and I'm getting infinate gas costs when I import the library. Not sure where to go from here.

one of them:

Gas requirement of function HitchensUnorderedKeySet.exists(bytes32) high: infinite. If the gas requirement of a function is higher than the block gas limit, it cannot be executed.

pragma solidity ^0.5.1;

import "https://github.com/rob-Hitchens/UnorderedKeySet/blob/master/contracts/HitchensUnorderedKeySet.sol";

contract Filter {

    using HitchensUnorderedKeySetLib for HitchensUnorderedKeySetLib.Set;
    HitchensUnorderedKeySetLib.Set filterSet;

    struct FilterStruct {
        string name;
        string tag;
    }


    mapping(bytes32 => FilterStruct) public filters;

    event LogNewFilter(address sender, bytes32 key, string Filternamename);

    function newFilter(bytes32 key, string memory name) public {
        filterSet.insert(key);
        FilterStruct storage f = filters[key];
        f.name = name;


        emit LogNewFilter(msg.sender, key, name);
    }

}

1 Answer 1

1

This "warning" relates to the 'require' conditions that may not be 'true'. It can be safely ignored. Experiment with 'require' in a simple setting to see what I mean.

Hopefully the Remix team will find a way to make the warning more useful, with fewer false positives.

Hope it helps.

P.s. You can silence the high/infinite gas warning in Remix.

5
  • Hi Rob, thanks very much for your help. When I deploy the contract in remix no functions appear to interact with, any idea why this is? Based on your response it seems unrelated to the unlimited gas warning. Jul 3, 2019 at 15:48
  • seems to be stuck on "creation of Filter pending..." Jul 3, 2019 at 15:54
  • From just eyeballing your contract, I don't think it's related to the contract either. Make sure you are using the JavaScript VM and not Injected Web3 unless you know what you are doing. I think it is waiting for a response from a non-existant node. Jul 3, 2019 at 16:39
  • Using JavaScript VM, tried both Http and Https remix addresses, and different browsers. the contract and the imported contracts wont deploy, all just hang on "pending.." Jul 3, 2019 at 22:25
  • I replicated it. I suspect there are multiple quirks with Remix today. Change this line to take github out of the picture (copy local, always a good idea). import "./HitchensUnorderedKeySet.sol";, then comment out the nukeset() function from the library. I found the problem persists if either of those steps isn't taken. I know of no reason why either step should be necessary but the IDE is updated frequently and stuff happens from time to time. Jul 3, 2019 at 23:52

Your Answer

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

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