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 @@ -146,6 +146,8 @@ namespace HeraVM {
146146 HERA_DEBUG << " useGas " << gas << " \n " ;
147147
148148 takeGas (gas);
149+ // FIXME: this may overflow
150+ takeGas (gas * memory.size () / GasSchedule::memoryPageSize * GasSchedule::memoryCostPerPage);
149151
150152 return Literal ();
151153 }
Original file line number Diff line number Diff line change @@ -113,9 +113,13 @@ struct EthereumInterface : ShellExternalInterface {
113113 evm_message const & msg;
114114 std::vector<uint8_t > lastReturnData;
115115 ExecutionResult & result;
116+
116117};
117118
118119struct GasSchedule {
120+ static constexpr unsigned memoryPageSize = 65536 ;
121+ static constexpr unsigned memoryCostPerPage = 1 ;
122+
119123 static constexpr unsigned storageLoad = 200 ;
120124 static constexpr unsigned storageStoreCreate = 20000 ;
121125 static constexpr unsigned storageStoreChange = 5000 ;
You can’t perform that action at this time.
0 commit comments