{"action":"created","issue":{"url":"https://api.github.com/repos/trufflesuite/truffle/issues/1012","repository_url":"https://api.github.com/repos/trufflesuite/truffle","labels_url":"https://api.github.com/repos/trufflesuite/truffle/issues/1012/labels{/name}","comments_url":"https://api.github.com/repos/trufflesuite/truffle/issues/1012/comments","events_url":"https://api.github.com/repos/trufflesuite/truffle/issues/1012/events","html_url":"https://github.com/trufflesuite/truffle/issues/1012","id":332500620,"node_id":"MDU6SXNzdWUzMzI1MDA2MjA=","number":1012,"title":"Non deterministic gas usage of the same function on truffle development server","user":{"login":"boorac","id":25860364,"node_id":"MDQ6VXNlcjI1ODYwMzY0","avatar_url":"https://avatars3.githubusercontent.com/u/25860364?v=4","gravatar_id":"","url":"https://api.github.com/users/boorac","html_url":"https://github.com/boorac","followers_url":"https://api.github.com/users/boorac/followers","following_url":"https://api.github.com/users/boorac/following{/other_user}","gists_url":"https://api.github.com/users/boorac/gists{/gist_id}","starred_url":"https://api.github.com/users/boorac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boorac/subscriptions","organizations_url":"https://api.github.com/users/boorac/orgs","repos_url":"https://api.github.com/users/boorac/repos","events_url":"https://api.github.com/users/boorac/events{/privacy}","received_events_url":"https://api.github.com/users/boorac/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-06-14T17:46:21Z","updated_at":"2018-06-21T20:21:08Z","closed_at":"2018-06-21T20:21:08Z","author_association":"NONE","body":"# Environment\r\n\r\n\r\n```Truffle v4.1.8 \r\nnode 10.0.0\r\npragma solidity ^0.4.21;\r\n```\r\n\r\n# Issue\r\nI'm calling the `claimRefund` function on my smart contract using metamask. When calling the function with **37081** gas limit at **20 gwei** gas price, the transaction spends **36924** gas and gets reverted with EVM Revert.\r\n\r\nIf I change params to **58080** gas limit at **20 gwei** gas price, the transaction passes spending **24721** gas.\r\n\r\nThe code is shown below:\r\n\r\n   \r\n\r\n       /**\r\n       * @param investor Investor address\r\n       */\r\n      function refund(address investor) public {\r\n        require(state == State.Refunding);\r\n        uint256 depositedValue = deposited[investor];\r\n        deposited[investor] = 0;\r\n        investor.transfer(depositedValue);\r\n        emit Refunded(investor, depositedValue);\r\n      }\r\n      }\r\n\r\n\r\n      function claimRefund() public {\r\n        require(isFinalized);\r\n        require(!goalReached());\r\n\r\n        vault.refund(msg.sender);\r\n      }\r\n\r\n# Question\r\nHow is it possible that the same call results in a different gas spent amount? Also, how can a function fail after spending more gas and pass after spending less gas?"},"comment":{"url":"https://api.github.com/repos/trufflesuite/truffle/issues/comments/399230141","html_url":"https://github.com/trufflesuite/truffle/issues/1012#issuecomment-399230141","issue_url":"https://api.github.com/repos/trufflesuite/truffle/issues/1012","id":399230141,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTIzMDE0MQ==","user":{"login":"cgewecke","id":7332026,"node_id":"MDQ6VXNlcjczMzIwMjY=","avatar_url":"https://avatars0.githubusercontent.com/u/7332026?v=4","gravatar_id":"","url":"https://api.github.com/users/cgewecke","html_url":"https://github.com/cgewecke","followers_url":"https://api.github.com/users/cgewecke/followers","following_url":"https://api.github.com/users/cgewecke/following{/other_user}","gists_url":"https://api.github.com/users/cgewecke/gists{/gist_id}","starred_url":"https://api.github.com/users/cgewecke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgewecke/subscriptions","organizations_url":"https://api.github.com/users/cgewecke/orgs","repos_url":"https://api.github.com/users/cgewecke/repos","events_url":"https://api.github.com/users/cgewecke/events{/privacy}","received_events_url":"https://api.github.com/users/cgewecke/received_events","type":"User","site_admin":false},"created_at":"2018-06-21T20:21:07Z","updated_at":"2018-06-21T20:21:07Z","author_association":"CONTRIBUTOR","body":"@boorac I'm going close here and we'll track this over at [ganache-core 26](https://github.com/trufflesuite/ganache-core/issues/26)"}}
{"actor":{"display_login":"cgewecke"}}