Skip to content

Instantly share code, notes, and snippets.

@mgild
Created September 4, 2025 12:19
Show Gist options
  • Save mgild/d79eb843c2b47cc602b06ae21e00b267 to your computer and use it in GitHub Desktop.
Save mgild/d79eb843c2b47cc602b06ae21e00b267 to your computer and use it in GitHub Desktop.
.section .text
.globl assert_pubkey_eq_ed25519_sysvar_asm
.type assert_pubkey_eq_ed25519_sysvar_asm, @function
assert_pubkey_eq_ed25519_sysvar_asm:
// r1 = pubkey_ptr
// Load and compare first 8 bytes with ED25519_PROGRAM_ID[0]
ldxdw r3, [r1+0]
jne r3, 0xbefb937cd6467d03, fail
// Load and compare second 8 bytes with ED25519_PROGRAM_ID[1]
ldxdw r3, [r1+8]
jne r3, 0xff408d838f42f912, fail
// Load and compare third 8 bytes with ED25519_PROGRAM_ID[2]
ldxdw r3, [r1+16]
jne r3, 0x648af42749747005, fail
// Load and compare fourth 8 bytes with ED25519_PROGRAM_ID[3]
ldxdw r3, [r1+24]
jne r3, 0x000000804470cafc, fail
// All equal - success
exit
fail:
r0 = 1
exit
.size assert_pubkey_eq_ed25519_sysvar_asm, .-assert_pubkey_eq_ed25519_sysvar_asm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment