Wenn ich eine einfache Funktion mit dem Typ internal kennzeichne, gibt remix eine unendliche Gasschätzungswarnung aus. Ohne diesen Typ ist alles in Ordnung. Bitte, weißt du warum?
function half(uint a) { uint b = a/2; //... }
-> Gasschätzung für "half(uint256)": "230"
function half(uint a) internal { uint b = a/2; //... }
-> Gasschätzung für "half(uint256)": "infinite"
Gibt es noch etwas anderes in der Funktion, weil ich dieses Problem in Remix nicht hatte.
pragma solidity ^0.4.19;
contract StackEthereumTholoz {
function start(uint _int) public pure returns (uint) {
return half(_int);
}
function half(uint _a) internal pure returns (uint) {
uint b = _a/2;
return b;
}
}
Erdgas: 72
Wenn also ein Vertrag tatsächlich nicht verwendet wird, kann Remix basierend auf Ihrem Code (und minimalem Beispielcode) internal
die Gaskosten nicht wirklich berechnen. Es wird automatisch als Standardwert auf unendlich gesetzt.
pragma solidity ^0.4.19; contract Infinite { function half(uint a) internal{ uint b = a/2; } }
Selbst wenn ich reines hinzufüge, wird immer wieder eine unendliche Gasschätzung ausgelöst
Benutzer19510
Tholoz