File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,8 @@ string toHex(evmc_uint256be const& value) {
198198 HERA_DEBUG << " useGas " << gas << " \n " ;
199199
200200 takeGas (gas);
201+ // FIXME: this may overflow
202+ takeGas (gas * memory.size () / GasSchedule::memoryPageSize * GasSchedule::memoryCostPerPage);
201203
202204 return Literal ();
203205 }
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