lines 1-4
Constants for the byte offsets we will read
.equ INSTRUCTION_DATA_LEN, 0x0008.equ INSTRUCTION_DATA, 0x0010.equ CLOCK_BUF_SIZE, 40.equ CLOCK_SLOT_OFF, 0Every guard starts the same way: name the byte offsets we are about to read, then load them by name. No struct definitions, no parser library, just numbers.
Why 8 and 16? The runtime hands every program one big block of bytes (r1 points at the start of it). For a program that declares ZERO accounts, that block starts with two u64 header fields: account count first (always 0 here), then instruction data length, then the instruction data itself. Each u64 is 8 bytes. So the length sits at byte 8 (0x0008) and the data starts at byte 16 (0x0010). That is the entire reason for those two numbers.
Other Shield guards have very different-looking offsets (0x2868, 0x2870, 0x2910). Same fields, just shoved further along because declaring accounts inserts a chunk of per-account info between the header and your ix data. slot_deadline declares no accounts, so nothing gets inserted, and the offsets stay tiny.
Why 40 for CLOCK_BUF_SIZE? The Clock sysvar (Solana's runtime struct of timing data) serializes to exactly 40 bytes: slot (u64) + epoch_start_timestamp (i64) + epoch (u64) + leader_schedule_epoch (u64) + unix_timestamp (i64). Five fields of 8 bytes each = 40. We need a 40-byte buffer to receive a copy of it.
Why CLOCK_SLOT_OFF = 0? slot is the first field of the Clock struct above, so it sits at byte 0 of whatever buffer the syscall fills.