This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds test_program_reads_from_program_account().
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <solana_sdk.h> | ||
|
||
extern uint64_t entrypoint(const uint8_t *input) { | ||
SolAccountInfo ka[1]; | ||
SolParameters params = (SolParameters){.ka = ka}; | ||
|
||
sol_log(__FILE__); | ||
|
||
if (!sol_deserialize(input, ¶ms, SOL_ARRAY_SIZE(ka))) { | ||
return ERROR_INVALID_ARGUMENT; | ||
} | ||
|
||
char ka_data[] = {0x7F, 0x45, 0x4C, 0x46}; | ||
|
||
sol_assert(params.ka_num == 1); | ||
sol_assert(!sol_memcmp(params.ka[0].data, ka_data, 4)); | ||
sol_assert(params.ka[0].is_signer == false); | ||
sol_assert(params.ka[0].is_writable == false); | ||
sol_assert(params.ka[0].executable == true); | ||
|
||
return SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters