File tree 2 files changed +9
-22
lines changed
2 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ class ExecutionState
236
236
// / Get initcode by its hash from transaction initcodes.
237
237
// /
238
238
// / Returns empty bytes_view if no such initcode was found.
239
- [[nodiscard]] bytes_view get_tx_initcode_by_hash (const evmc_bytes32& hash) noexcept
239
+ [[nodiscard]] TransactionInitcode get_tx_initcode_by_hash (const evmc_bytes32& hash) noexcept
240
240
{
241
241
if (!m_initcodes.has_value ())
242
242
{
@@ -251,26 +251,13 @@ class ExecutionState
251
251
}
252
252
253
253
const auto it = m_initcodes->find (hash);
254
- return it != m_initcodes->end () ? it->second .code : bytes_view{};
255
- }
256
-
257
- // / Get validity of initcode from transaction initcodes by its hash.
258
- // /
259
- // / Returns std::nullopt if no such initcode was validated yet.
260
- [[nodiscard]] std::optional<bool > get_initcode_validity (const evmc_bytes32& hash) noexcept
261
- {
262
- if (!m_initcodes.has_value ())
263
- return std::nullopt;
264
-
265
- const auto it = m_initcodes->find (hash);
266
- return (it != m_initcodes->end () ? it->second .is_valid : std::nullopt);
254
+ return it != m_initcodes->end () ? it->second : TransactionInitcode{};
267
255
}
268
256
269
257
// / Set validity of initcode from transaction initcodes.
270
258
void set_initcode_validity (const evmc_bytes32& hash, bool is_valid)
271
259
{
272
- if (!m_initcodes.has_value ())
273
- return ;
260
+ assert (m_initcodes.has_value ());
274
261
275
262
(*m_initcodes)[hash].is_valid = is_valid;
276
263
}
Original file line number Diff line number Diff line change @@ -424,16 +424,16 @@ Result create_eof_impl(
424
424
}
425
425
else
426
426
{
427
- initcontainer = state.get_tx_initcode_by_hash (initcode_hash);
428
- // In case initcode was not found, empty bytes_view was returned.
427
+ const auto tx_initcode = state.get_tx_initcode_by_hash (initcode_hash);
428
+ // In case initcode was not found, empty tx_initcode.data was returned.
429
429
// Transaction initcodes are not allowed to be empty.
430
- if (initcontainer .empty ())
430
+ if (tx_initcode. code .empty ())
431
431
return {EVMC_SUCCESS, gas_left}; // "Light" failure
432
+ initcontainer = tx_initcode.code ;
432
433
433
- const auto validity = state.get_initcode_validity (initcode_hash);
434
434
bool is_valid = false ;
435
- if (validity .has_value ())
436
- is_valid = *validity ;
435
+ if (tx_initcode. is_valid .has_value ())
436
+ is_valid = *tx_initcode. is_valid ;
437
437
else
438
438
{
439
439
const auto error_subcont =
You can’t perform that action at this time.
0 commit comments