Expand and update instruction count tests (#16522)

This commit is contained in:
Jack May 2021-04-13 16:23:42 -07:00 committed by GitHub
parent f7eadd9d70
commit 74f58376f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 14 deletions

View File

@ -1,27 +1,16 @@
/**
* @brief Example C++-based BPF program that prints out the parameters
* @brief Example C++ based BPF program that prints out the parameters
* passed to it
*/
#include <solana_sdk.h>
/**
* Custom error for when input serialization fails
*/
#define INVALID_INPUT 1
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

@ -1,13 +1,16 @@
/**
* @brief Example C-based BPF noop program
* @brief Example C based BPF program 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 };
if (!sol_deserialize(input, &params, SOL_ARRAY_SIZE(ka))) {
return ERROR_INVALID_ARGUMENT;
}
return SUCCESS;
}

View File

@ -1223,12 +1223,15 @@ fn assert_instruction_count() {
#[cfg(feature = "bpf_c")]
{
programs.extend_from_slice(&[
("alloc", 1137),
("bpf_to_bpf", 13),
("multiple_static", 8),
("noop", 45),
("noop++", 45),
("relative_call", 10),
("sanity", 175),
("sanity++", 177),
("sha256", 348),
("struct_pass", 8),
("struct_ret", 22),
]);
@ -1238,14 +1241,18 @@ fn assert_instruction_count() {
programs.extend_from_slice(&[
("solana_bpf_rust_128bit", 572),
("solana_bpf_rust_alloc", 8906),
("solana_bpf_rust_custom_heap", 516),
("solana_bpf_rust_dep_crate", 2),
("solana_bpf_rust_external_spend", 498),
("solana_bpf_rust_iter", 724),
("solana_bpf_rust_many_args", 237),
("solana_bpf_rust_mem", 2297),
("solana_bpf_rust_noop", 472),
("solana_bpf_rust_param_passing", 46),
("solana_bpf_rust_rand", 475),
("solana_bpf_rust_ristretto", 19220),
("solana_bpf_rust_sanity", 901),
("solana_bpf_rust_sanity", 869),
("solana_bpf_rust_sha256", 10830),
]);
}