Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit f3d7a4b

Browse files
chfastaxic
authored andcommitted
Move scratchpad type definition to evmc_result
1 parent 20fff46 commit f3d7a4b

2 files changed

Lines changed: 18 additions & 20 deletions

File tree

include/evmc/evmc.h

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -336,24 +336,6 @@ struct evmc_result;
336336
*/
337337
typedef void (*evmc_release_result_fn)(const struct evmc_result* result);
338338

339-
union evmc_result_scratchpad
340-
{
341-
342-
/**
343-
* Reserved data that MAY be used by a evmc_result object creator.
344-
*
345-
* This reserved 4 bytes together with 20 bytes from create_address form
346-
* 24 bytes of memory called "optional data" within evmc_result struct
347-
* to be optionally used by the evmc_result object creator.
348-
*
349-
* @see evmc_result_optional_data, evmc_get_optional_data().
350-
*
351-
* Also extends the size of the evmc_result to 64 bytes (full cache line).
352-
*/
353-
uint8_t bytes[64];
354-
355-
void* pointer;
356-
};
357339

358340
/** The EVM code execution result. */
359341
struct evmc_result
@@ -421,7 +403,23 @@ struct evmc_result
421403
*/
422404
evmc_address create_address;
423405

424-
union evmc_result_scratchpad scratchpad;
406+
union scratchpad
407+
{
408+
/**
409+
* Reserved data that MAY be used by a evmc_result object creator.
410+
*
411+
* This reserved 4 bytes together with 20 bytes from create_address form
412+
* 24 bytes of memory called "optional data" within evmc_result struct
413+
* to be optionally used by the evmc_result object creator.
414+
*
415+
* @see evmc_result_optional_data, evmc_get_optional_data().
416+
*
417+
* Also extends the size of the evmc_result to 64 bytes (full cache line).
418+
*/
419+
uint8_t bytes[32];
420+
421+
void* pointer;
422+
} scratchpad;
425423
};
426424

427425

test/unittests/test_helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static_assert(sizeof(evmc_call_kind) == sizeof(int),
2222
static_assert(sizeof(evmc_revision) == sizeof(int), "Enum `evmc_revision` is not the size of int");
2323

2424

25-
static_assert(offsetof(evmc_result, scratchpad) % alignof(void*) == 0,
25+
static_assert(offsetof(evmc_result, scratchpad) % 8 == 0,
2626
"evmc_result's scratchpad not properly aligned");
2727

2828
TEST(helpers, release_result)

0 commit comments

Comments
 (0)