-
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.
This consists of: - syscalls - passing return data from invoked to invoker - printing to stable log - rust and C SDK changes
- Loading branch information
Showing
23 changed files
with
495 additions
and
36 deletions.
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,40 @@ | ||
/** | ||
* @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]; | ||
SolPubkey me; | ||
|
||
// There should be no return data on entry | ||
int64_t ret = sol_get_return_data(NULL, 0, NULL); | ||
|
||
sol_assert(ret == -1); | ||
|
||
// set some return data | ||
sol_set_return_data((const uint8_t*)DATA, sizeof(DATA)); | ||
|
||
// ensure the length is correct | ||
ret = sol_get_return_data(NULL, 0, &me); | ||
sol_assert(ret == sizeof(DATA)); | ||
|
||
// try getting a subset | ||
ret = sol_get_return_data(buf, 4, &me); | ||
|
||
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), &me); | ||
|
||
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.