* ci: use versioned cargo wrapper for crate ordering (cherry picked from commit554002b73c
) * ci: nvidia persistence mode isn't a hard requirement (cherry picked from commitf213e48067
) * sdk: ensure `ld` can find criterion when running BPF tests (cherry picked from commit7ee39fcb0f
) * ci: give localnet nodes a more time to startup (cherry picked from commit278a241db3
) * ci: add downstream build wrapper (cherry picked from commit761e324982
) * ci: add wrapper script for running ci locally Linux only for now (cherry picked from commit0bc38153ca
) Co-authored-by: Trent Nelson <trent@solana.com>
Development
Quick start
To get started create a makefile
containing:
include path/to/bpf.mk
and src/program.c
containing:
#include <solana_sdk.h>
bool entrypoint(const uint8_t *input) {
SolKeyedAccount ka[1];
uint8_t *data;
uint64_t data_len;
if (!sol_deserialize(buf, ka, SOL_ARRAY_SIZE(ka), NULL, &data, &data_len)) {
return false;
}
print_params(1, ka, data, data_len);
return true;
}
Then run make
to build out/program.o
.
Run make help
for more details.
Unit tests
Built-in support for unit testing is provided by the
Criterion test framework.
To get started create the file test/example.c
containing:
#include <criterion/criterion.h>
#include "../src/program.c"
Test(test_suite_name, test_case_name) {
cr_assert(true);
}
Then run make test
.
Limitations
- Programs must be fully contained within a single .c file
- No libc is available but
solana_sdk.h
provides a minimal set of primitives