Commit Graph

80 Commits

Author SHA1 Message Date
Pierre 8a20e7f8de
sdk: fix broken C examples (#33701)
fix C broken example
2023-10-16 23:53:03 +02:00
vadorovsky bea062b1e6
Add alt_bn128 syscall tests (and fix related issues) (#31436)
* Fix C headers (the name of the syscall was incorrect).
* Add C SBF tests using the alt_bn128 syscall.
* Fix the Rust SBF program:
  * Do not use serde and array-bytes, provide test cases as byte arrays
    directly.
  * Use the `custom_heap_default` macro.
  * Replace `bpf` with `sbf` in the crate name.
* Execute both previously existing Rust tests and new C tests in
  `programs/sbf/tests`, so they are actually tested on CI.
2023-05-22 14:05:10 -07:00
Dmitri Makarov ec4f33b024
Fix SDK C makefile setting the correct path to clang headers (#30378) 2023-02-17 06:53:45 -08:00
valiksinev 5f7fea100a
Big integer modular exponentiation (EIP-198) (#28503)
* big_mod_exp impl

* fix programs/sbf/Cargo.lock

* ComputeBudget impl

* update compute_budget

* compute_budget update

* fix build

* fix tests

* fix cargo clippy

* fix clippy

* fix bpf_loader dependency sorting

* fix sorting

* fix merge from master

* fix cargo fmt

* fix C-tests

* fix cargo fmt

* comments apply

* fix programs/sbf/Cargo.lock

* update compude_budget cost

* remove whitespaces

* fix cargo fmt

Co-authored-by: sinev-valentine <sinev-valentine@yandex.ru>
2023-01-20 18:42:37 +09:00
ananas-block afc3fee937
added alt_bn syscalls (#27961)
* added alt_bn128_syscalls

* increased regression build redundancy to > 10
2022-11-21 17:43:06 +01:00
bji 6dc7cd0845
Fixed warnings caused by redefined macros. Also fixed sol_memcpy to … (#28378)
Fixed warnings caused by redefined macros.  Also fixed sol_memcpy to have
the same signature as memcpy.
2022-11-20 03:42:17 +00:00
Justin Starry b9700244b5
Increase transaction account lock limit from 64 to 128 (#27242)
* Increase transaction account lock limit from 64 to 256

* fix bpf test

* Reduce lock limit from 256 to 128
2022-09-15 13:50:14 -04:00
Dmitri Makarov 776a47bd83 Bump sbf-tools version to v1.29 2022-08-07 22:11:57 +00:00
Dmitri Makarov 8db5a6a4f2 Copy changes made to a generated header file to its source 2022-07-30 10:38:53 -07:00
Justin Starry 2335f6908a
Loosen CPI restrictions and charge compute for ix data len (#26653)
* Loosen CPI restrictions and charge compute for ix data len

* Address feedback

* use explicit casting

* more feedback
2022-07-24 20:20:16 +02:00
Dmitri Makarov 8bc8f77820 Sync return_data.inc and add a warning about modifying generated header files 2022-07-19 20:03:05 -07:00
Richard Patel 4163dc181e
sdk/bpf/c: fix sol_get_return_data signature (#26525) 2022-07-19 09:30:29 +02:00
bji 61fd9288ba
Fix sol_memset to return the correct value. (#26598) 2022-07-14 17:27:02 +01:00
Jack May 851958f77a
Disallow deployment of deprecated _sol_alloc_free syscall (#25179) 2022-05-20 13:19:41 -07:00
Dmitri Makarov 3c70220142 Remove obsolete string C header input file
string.h doesn't contain any syscall declarations that need to be
processed by the gen-headers C header file generating utility.
2022-05-13 10:37:25 -07:00
Jack May 8902a66b20
Revert "Disallow deployment of deprecated _sol_alloc_free syscall (#24986)" (#25170)
This reverts commit 8f1d4c1665.
2022-05-12 17:58:17 -05:00
Jack May 8f1d4c1665
Disallow deployment of deprecated _sol_alloc_free syscall (#24986)
* Disallow deployment of deprecated _sol_alloc_free syscall

* remove cli argument
2022-05-11 05:22:49 +00:00
Dmitri Makarov 66366615bb Generate syscall headers 2022-05-05 19:50:54 -07:00
Dmitri Makarov 6bf58572ca Update llvm include path in C toolchain makefile 2022-04-19 21:38:36 -07:00
Dmitri Makarov f58ebff44e Update C toolchain linker script to match the rust toolchain script 2022-04-18 17:35:38 -07:00
HaoranYi 0b7d0476c8
fix a typo (#24070) 2022-04-01 15:16:51 -07:00
Jon Cinque 923720f529
SDK: Add stdlib.h include to pull in `abort()` (#21700) 2021-12-08 17:00:16 +01:00
Dmitri Makarov 4287bf6b8b
Bump bpf-tools to v1.18 (#20991)
- added newlib standard C library to clang toolchain
- fixed BPF backend bug that accidentally deleted code, issue #20538
2021-10-26 22:51:44 +00:00
Sean Young d714cf659c Proposal: log binary data for Solidity
The program_id is not needed on "Program return data: " because it
always preceeded by the program invoke message, so no need to repeat
the program id. Also rename this to "Program return: " since "data"
is redundant.
2021-09-22 07:59:06 +01:00
Sean Young 098585234d Add return data implementation
This consists of:
 - syscalls
 - passing return data from invoked to invoker
 - printing to stable log
 - rust and C SDK changes
2021-09-10 14:25:54 +01:00
Jack May 04c0c608a3
Split solana_sdk.h (#19172) 2021-08-13 09:49:24 -07:00
s-medvedev 1f288ce527
Add ecrecover syscall (#17720)
Co-authored-by: Anton Lisanin <lisanin.anton@gmail.com>
2021-07-07 13:15:14 -07:00
Trent Nelson 7ee39fcb0f sdk: ensure `ld` can find criterion when running BPF tests 2021-06-24 22:14:54 -06:00
Dmitri Makarov 361c1bdd57
Fix file permissions (#17910) 2021-06-12 02:03:32 +00:00
Arthur Greef 28fdfed1ba
Blake3 syscall (#17358) 2021-06-08 11:04:10 -07:00
Dmitri Makarov 6f193bf357 Add separate rules to generate dependencies files for C BPF build 2021-06-08 05:34:40 -07:00
Dmitri Makarov 47861fc373 Bump BPF tools to v1.9 2021-06-03 17:06:49 -07:00
Dmitri Makarov 2316ddb90a
Revert bpf-tools to version 1.8 because of a codegen bug suspicion (#17568) 2021-05-28 09:36:46 +00:00
Dmitri Makarov 3ae4806dae
Fix missing builtins in C programs linking with compiler_builtins (#17475) 2021-05-25 17:11:02 +00:00
Christian Machacek 8758e9ed82
Remove const qualifier from syscall out-parameters (#17382) 2021-05-21 12:09:22 -07:00
Dmitri Makarov ab871ed4b7 Bump bpf-tools version to 1.8 2021-05-18 08:10:57 +02:00
Christian Machacek e02b4e1192
Fix a bug in input deserialization in the C SDK (#17217)
When the input contains more accounts than the user has requested to be deserialized, and one of the excess ones is a dup, the input pointer is not adjusted correctly.

Compare the lines added by this commit to line 401: "input += 7; // padding". Since the input data layout does not depend on the number of accounts the user wants to deserialize, this adjustment by 7 bytes must happen in both branches.
2021-05-14 16:41:55 -06:00
Jack May 8eb05d6ed4
Add Keccak256 syscall and sdk support (#16498) 2021-05-10 16:16:58 -07:00
Jack May 82fb6712e7
fix c program deploy help (#17152) 2021-05-10 15:38:01 -07:00
Christian Machacek ff95e2aaa6 Add a make target to run the readelf utility on a compiled program
The readelf utility (already shipped with the solana tools) shows meta-information about ELF files, such as symbol tables. It is useful for investigating "unresolved symbol" errors that crop up at runtime.

This commit also fixes the objdump flags (two dashes are required and there is no "color" option) as well as a few typos.
2021-05-08 18:49:14 -07:00
Christian Machacek 6927d0c77e
Fix syscalls in the C SDK failing at runtime when compiled as C++ (#17124)
Some syscalls are wrongly declared "static" in solana_sdk.h, which makes clang++ assume they are local to the compilation unit. It therefore ignores the extern "C" {} block and mangles their names. While that doesn't break C++ compilation, the syscall fails at runtime with something along the lines of "ELF error: Unresolved symbol (_ZL26sol_create_program_addressPK13SolSignerSeediPK9SolPubkeyS4_)".
2021-05-08 16:31:50 +00:00
Dmitri Makarov db3bca7edd
Add llvm feature option to compile for Solana BPF target (#16495) 2021-04-13 07:20:18 +00:00
Dmitri Makarov c5a5d7457e
Bump bpf-tools to v1.1 (#15776) 2021-03-10 18:13:38 +01:00
Jack May 48785b507b
Bump Rust-BPF to v1.46 (#15273) 2021-02-18 11:30:08 -08:00
Jack May bba1b49663
Generate keypair file for c program deployment (#15080)
* Generate keypair file for c program deployment

* Build and use solana-keygen in test-stable-perf
2021-02-04 13:56:12 -08:00
Jack May ab98c1f2d4
Add try_find_program_address syscall (#14118) 2020-12-15 08:15:01 -08:00
Jack May e390c8cb7f
Add stubs and heap region definitions (#13521)
* Add stubs and heap region definitions

* nudge
2020-11-11 05:50:16 +00:00
Jack May 9ca8e98525
Add printf declaration (#13514) 2020-11-10 23:40:48 +00:00
Jack May 23c558510a
add missing c logging stubs (#13511) 2020-11-10 22:19:54 +00:00
Michael Vines 66e51a7363 Add sol_log_compute_units syscall 2020-10-29 21:45:24 -07:00