File tree 2 files changed +6
-0
lines changed
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) {
198
198
HERA_DEBUG << " useGas " << gas << " \n " ;
199
199
200
200
takeGas (gas);
201
+ // FIXME: this may overflow
202
+ takeGas (gas * memory.size () / GasSchedule::memoryPageSize * GasSchedule::memoryCostPerPage);
201
203
202
204
return Literal ();
203
205
}
Original file line number Diff line number Diff line change @@ -99,9 +99,13 @@ struct EthereumInterface : ShellExternalInterface {
99
99
evmc_message const & msg;
100
100
std::vector<uint8_t > lastReturnData;
101
101
ExecutionResult & result;
102
+
102
103
};
103
104
104
105
struct GasSchedule {
106
+ static constexpr unsigned memoryPageSize = 65536 ;
107
+ static constexpr unsigned memoryCostPerPage = 1 ;
108
+
105
109
static constexpr unsigned storageLoad = 200 ;
106
110
static constexpr unsigned storageStoreCreate = 20000 ;
107
111
static constexpr unsigned storageStoreChange = 5000 ;
You can’t perform that action at this time.
0 commit comments