Make noop a real noop (#12196)

* Make noop a real noop

* nudge
This commit is contained in:
Jack May
2020-09-11 18:49:00 -07:00
committed by GitHub
parent daba17a95c
commit 555252f435
9 changed files with 142 additions and 77 deletions

View File

@ -1,22 +1,13 @@
/**
* @brief Example C-based BPF program that prints out the parameters
* passed to it
* @brief Example C-based BPF noop program
*/
#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, &params, SOL_ARRAY_SIZE(ka))) {
return ERROR_INVALID_ARGUMENT;
}
// Log the provided input parameters. In the case of the no-op
// program, no account keys or input data are expected but real
// programs will have specific requirements so they can do their work.
sol_log_params(&params);
return SUCCESS;
}

View File

@ -0,0 +1,22 @@
/**
* @brief Example C-based BPF sanity rogram that prints out the parameters
* passed to it
*/
#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, &params, SOL_ARRAY_SIZE(ka))) {
return ERROR_INVALID_ARGUMENT;
}
// Log the provided input parameters. In the case of the no-op
// program, no account keys or input data are expected but real
// programs will have specific requirements so they can do their work.
sol_log_params(&params);
return SUCCESS;
}