-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sean Young <[email protected]>
- Loading branch information
Showing
16 changed files
with
283 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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,35 @@ | ||
/** | ||
* @brief return data Syscall test | ||
*/ | ||
#include <solana_sdk.h> | ||
|
||
#define DATA "the quick brown fox jumps over the lazy dog" | ||
|
||
extern uint64_t entrypoint(const uint8_t *input) { | ||
uint8_t buf[1024]; | ||
|
||
// There should be no return data on entry | ||
uint64_t ret = sol_get_return_data(NULL, 0); | ||
|
||
sol_assert(ret == 0); | ||
|
||
// set some return data | ||
sol_set_return_data((const uint8_t*)DATA, sizeof(DATA)); | ||
|
||
// try getting a subset | ||
ret = sol_get_return_data(buf, 4); | ||
|
||
sol_assert(ret == sizeof(DATA)); | ||
|
||
sol_assert(!sol_memcmp(buf, "the ", 4)); | ||
|
||
// try getting the whole thing | ||
ret = sol_get_return_data(buf, sizeof(buf)); | ||
|
||
sol_assert(ret == sizeof(DATA)); | ||
|
||
sol_assert(!sol_memcmp(buf, (const uint8_t*)DATA, sizeof(DATA))); | ||
|
||
// done | ||
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
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
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
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
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
Oops, something went wrong.