File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,6 +203,8 @@ string toHex(evmc_uint256be const& value) {
203203 HERA_DEBUG << " useGas " << gas << " \n " ;
204204
205205 takeGas (gas);
206+ // FIXME: this may overflow
207+ takeGas (gas * memory.size () / GasSchedule::memoryPageSize * GasSchedule::memoryCostPerPage);
206208
207209 return Literal ();
208210 }
Original file line number Diff line number Diff line change @@ -99,9 +99,13 @@ struct EthereumInterface : ShellExternalInterface {
9999 evmc_message const & msg;
100100 std::vector<uint8_t > lastReturnData;
101101 ExecutionResult & result;
102+
102103};
103104
104105struct GasSchedule {
106+ static constexpr unsigned memoryPageSize = 65536 ;
107+ static constexpr unsigned memoryCostPerPage = 1 ;
108+
105109 static constexpr unsigned storageLoad = 200 ;
106110 static constexpr unsigned storageStoreCreate = 20000 ;
107111 static constexpr unsigned storageStoreChange = 5000 ;
You can’t perform that action at this time.
0 commit comments