From 79b2f9f410b13b9ad548f565ad661eb2ae6d4e34 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Tue, 10 Feb 2026 18:53:16 +0700 Subject: [PATCH] feat(hooks): add consensus entropy definitions to hook headers Add dice/random externs, TOO_LITTLE_ENTROPY error code, sfEntropyCount field code, and ttCONSENSUS_ENTROPY transaction type to hook SDK headers. --- hook/error.h | 1 + hook/extern.h | 6 ++++++ hook/sfcodes.h | 1 + hook/tts.h | 1 + 4 files changed, 9 insertions(+) diff --git a/hook/error.h b/hook/error.h index 63e0c03bb..52e59405a 100644 --- a/hook/error.h +++ b/hook/error.h @@ -47,5 +47,6 @@ #define MEM_OVERLAP -43 #define TOO_MANY_STATE_MODIFICATIONS -44 #define TOO_MANY_NAMESPACES -45 +#define TOO_LITTLE_ENTROPY -46 #define HOOK_ERROR_CODES #endif //HOOK_ERROR_CODES diff --git a/hook/extern.h b/hook/extern.h index ee34af6ff..01aff6612 100644 --- a/hook/extern.h +++ b/hook/extern.h @@ -329,5 +329,11 @@ meta_slot(uint32_t slot_no); extern int64_t xpop_slot(uint32_t slot_no_tx, uint32_t slot_no_meta); +extern int64_t +dice(uint32_t sides); + +extern int64_t +random(uint32_t write_ptr, uint32_t write_len); + #define HOOK_EXTERN #endif // HOOK_EXTERN diff --git a/hook/sfcodes.h b/hook/sfcodes.h index 8c7bc48f4..5db88dc17 100644 --- a/hook/sfcodes.h +++ b/hook/sfcodes.h @@ -16,6 +16,7 @@ #define sfHookExecutionIndex ((1U << 16U) + 19U) #define sfHookApiVersion ((1U << 16U) + 20U) #define sfHookStateScale ((1U << 16U) + 21U) +#define sfEntropyCount ((1U << 16U) + 99U) #define sfNetworkID ((2U << 16U) + 1U) #define sfFlags ((2U << 16U) + 2U) #define sfSourceTag ((2U << 16U) + 3U) diff --git a/hook/tts.h b/hook/tts.h index bd03b0399..b2377b06b 100644 --- a/hook/tts.h +++ b/hook/tts.h @@ -47,3 +47,4 @@ #define ttUNL_MODIFY 102 #define ttEMIT_FAILURE 103 #define ttUNL_REPORT 104 +#define ttCONSENSUS_ENTROPY 105