diff --git a/programs/bpf/c/src/noop++/noop++.cc b/programs/bpf/c/src/noop++/noop++.cc index 8b70030eaa8f8c..09e0019df44c9c 100644 --- a/programs/bpf/c/src/noop++/noop++.cc +++ b/programs/bpf/c/src/noop++/noop++.cc @@ -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 -/** - * 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, ¶ms, 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(¶ms); return SUCCESS; } diff --git a/programs/bpf/c/src/noop/noop.c b/programs/bpf/c/src/noop/noop.c index 093499559901aa..cc2f12ca59049d 100644 --- a/programs/bpf/c/src/noop/noop.c +++ b/programs/bpf/c/src/noop/noop.c @@ -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 extern uint64_t entrypoint(const uint8_t *input) { SolAccountInfo ka[1]; SolParameters params = (SolParameters) { .ka = ka }; + if (!sol_deserialize(input, ¶ms, SOL_ARRAY_SIZE(ka))) { return ERROR_INVALID_ARGUMENT; } + return SUCCESS; } diff --git a/programs/bpf/tests/programs.rs b/programs/bpf/tests/programs.rs index 3d891df893ede0..62758ddbc6832d 100644 --- a/programs/bpf/tests/programs.rs +++ b/programs/bpf/tests/programs.rs @@ -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), ]); }