2ceabd9368
* add sysvar and logic for last restart slot
* cleanup
* add test for getting last restart slot from account
* format code
* add some basic rustdoc
* copy+paste error
* feature flag for last_restart_slot
* add to sysvars.md
* updated wording in sysvars.md
* rename sol_get_last_restart_slot_sysvar > sol_get_last_restart_slot
* create sbf C header for sol_get_last_restart_slot
* cleanup imports
* reverted hardened_unpack workaround
* cleanup imports
* cleanup logs + blank lines
* Implementing ui changes for last restart slot, nit
* Some more nit change and implementing the UI for sysvar
* fixing the CI
* Minor clippy fix
* format changes
* changes suggested by mvines and lichtso
* increase timeout in local_cluster test
* fix code format
* use keypair for feature flag from mvines
* delete test.json file
* Revert "increase timeout in local_cluster test"
This reverts commit
|
||
---|---|---|
.. | ||
inc | ||
README.md | ||
sbf.ld | ||
sbf.mk |
README.md
Development
Quick start
To get started create a makefile
containing:
include path/to/sbf.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