Compare commits

...

668 Commits

Author SHA1 Message Date
Matt Witherspoon 69599db279 Merge pull request #388 from heifner/deferred_transaction
Move deferred transaction into deferred_transaction.hpp
2025-08-28 14:41:32 -04:00
kevin Heifner d81cb903ad Removed outdated comment 2025-08-27 09:06:53 -05:00
kevin Heifner 06a3c518fe Move deferred transaction into deferred_transaction.hpp 2025-08-27 08:20:04 -05:00
Matt Witherspoon 7a2c49262f Merge pull request #383 from AntelopeIO/jsoncons_fix_main
[4.1 -> main] fix compile on recent clang versions
2025-07-31 13:06:56 -04:00
Matt Witherspoon 7479f2be35 Merge remote-tracking branch 'origin/release/4.1' into HEAD 2025-07-31 10:40:17 -04:00
Matt Witherspoon acfb0a7cc2 Merge pull request #382 from AntelopeIO/jsoncons_fix_41
[4.1.1] fix compile on recent clang versions
2025-07-31 10:39:43 -04:00
Matt Witherspoon d658c90b6d fix compile on recent clang versions (at least 20 but maybe 18/19 too) 2025-07-30 23:06:24 -04:00
Lin Huang 2ae2708fd8 Merge pull request #379 from AntelopeIO/unhide_cust_entry
Update cdt-llvm to take in customized sync call entry function export fix and add tests for it
2025-07-28 11:14:45 -04:00
Lin Huang 36f2da87c3 Update to use main of cdt-llvm which includes cdt-lld which has customized sync call entry function export fix 2025-07-28 11:02:52 -04:00
Lin Huang fef5731b58 Update to use cdt-llvm unhide_cust_entry branch for missing export of customized sync call entry function fix 2025-07-27 18:29:29 -04:00
Lin Huang 92945e4572 Add tests for customized sync call entry function 2025-07-27 18:23:52 -04:00
Lin Huang c32f4e4f7a Merge pull request #377 from AntelopeIO/update_latest_llvm
[5.0.0-dev2] Attempt 2: Update to use main branches of cdt-clang and cdt-lld
2025-07-25 17:15:21 -04:00
Lin Huang c8535689e2 Update to use latest cdt-llvm (including latest cdt-clang and cdt-lld) 2025-07-25 17:03:11 -04:00
Lin Huang 8b76fa3f7c Merge pull request #373 from AntelopeIO/merge_from_4_1
[4.1 -> main] Merge type_check fix used by action_wrapper
2025-07-24 09:01:27 -04:00
Lin Huang a762ebdbab Resolve merging conflicts 2025-07-23 15:26:40 -04:00
Lin Huang d244ead4d8 Merge remote-tracking branch 'origin/release/4.1' into merge_from_4_1 2025-07-23 15:22:49 -04:00
Lin Huang 4153ba41f7 Merge pull request #372 from AntelopeIO/fix_bool_in_action_wrapper
[4.1.0] Fix action_wrapper failure if its first argument is a bool
2025-07-23 14:51:27 -04:00
Lin Huang 62f04bd94d Merge pull request #369 from AntelopeIO/is_sync_call
[5.0.0-dev] Add `is_sync_call()` to `eosio::contract` class
2025-07-22 11:07:25 -04:00
Lin Huang d607a92712 Revert back the change for allowing private deriving from eosio::contract 2025-07-22 08:12:13 -04:00
Lin Huang 425fc6c3c2 Add a missing () 2025-07-22 07:58:24 -04:00
Lin Huang 00cb315396 Allow a contract derives from eosio::contract privately 2025-07-22 07:46:50 -04:00
Lin Huang a53fc34ce3 Fix action_wrapper fails to compile if it contains bool as the first argument due to ambiguity of partial specializations of is_same<bool,U> and is_same<T,bool> 2025-07-21 17:54:33 -04:00
Lin Huang a294a08ab7 Make separate_cpp_hpp derive publicly from eosio::contract such that set_exec_type() can be used 2025-07-21 15:46:46 -04:00
Lin Huang bad7b81900 Do not use unnecessary and expensivestd::optional for _exec_type 2025-07-21 15:41:39 -04:00
Lin Huang db42ab457f Use set_exec_type() to explicitly set a contract's execution type (action or call) to prevent accidental errors by contract authors 2025-07-21 15:08:17 -04:00
Lin Huang b086797420 Add tests for is_sync_call() 2025-07-18 15:54:51 -04:00
Lin Huang 09b234bf35 Update sync_call_addr_book_callee for new eosio::contract constructor 2025-07-18 15:44:45 -04:00
Lin Huang b9f47e0119 Add is_sync_call() to eosio::contract class 2025-07-18 15:44:00 -04:00
Lin Huang fb6ad1be16 Merge pull request #367 from AntelopeIO/bump_to_5_0_0_dev
Bump CDT to v5.0.0-dev1
2025-07-16 11:11:54 -04:00
Lin Huang 01fa60da98 Bump CDT to v5.0.0-dev1 2025-07-16 09:48:32 -04:00
Lin Huang 9e72ac27eb Merge pull request #366 from AntelopeIO/sync_call
SC: [sync_call --> main] merge from sync_call branch for dev-preview-1 release
2025-07-15 18:29:26 -04:00
Lin Huang 9e811a371f Merge pull request #365 from AntelopeIO/merge_main_july_14
SC: [5.0 --> sync_call] Merge from main
2025-07-15 17:42:48 -04:00
Lin Huang 6606549ca4 Update spring-dev target to release/2.0 2025-07-15 16:57:23 -04:00
Lin Huang c74f115754 Fix a problem that attempts to merge non-exsiting sync call ABI sections 2025-07-15 16:52:41 -04:00
Lin Huang cdd38e2843 Fix a missing merging error 2025-07-14 22:48:35 -04:00
Lin Huang 06c541cece Update toolchain tests not to use --abi-version option any more as it is disabled 2025-07-14 21:51:43 -04:00
Lin Huang 664f4d624b Use the new versioning scheme for sync calls and Resolve merge conflicts 2025-07-14 21:49:53 -04:00
Lin Huang b38155045a Merge remote-tracking branch 'origin/main' into merge_main_july_14 2025-07-14 16:34:36 -04:00
Lin Huang f26edc8627 Merge pull request #363 from AntelopeIO/consolidate_abi
SC: Consolidate all sync call related fields into a single call section in ABI and allow a function to be tagged both as an action and a call
2025-07-14 16:22:24 -04:00
Lin Huang 4c56554cdf update tests for a function tagged both as an action and a call 2025-07-13 23:15:42 -04:00
Lin Huang ecb339bb64 Consolidate all sync call related fields into a single call section in ABI and allow a function to be tagged both as an action and a call 2025-07-13 23:14:20 -04:00
Lin Huang 3793b76ac5 Merge pull request #362 from AntelopeIO/long_names
SC: Support long sync call function names
2025-07-11 13:58:34 -04:00
Lin Huang c7ce2a9de6 Update to use latest llvm 2025-07-11 13:40:43 -04:00
Lin Huang c4ea7b7c3f More changes for identifier to hash_id 2025-07-11 13:38:52 -04:00
Lin Huang 3c95130678 Rename identifier to hash_id 2025-07-11 10:52:21 -04:00
Lin Huang c214b8d68c Merge branch 'sync_call' into long_names 2025-07-09 18:35:57 -04:00
Lin Huang ac6952d6d5 Merge pull request #353 from AntelopeIO/call_abi
SC: Generate `call` and `call_results` sections in ABI files for sync calls and bump ABI version to `1.3`
2025-07-09 17:00:01 -04:00
Lin Huang e4b134ddef Merge branch 'sync_call' into call_abi 2025-07-09 16:49:35 -04:00
Lin Huang 6053155040 Merge pull request #350 from AntelopeIO/sync_call_entry_func
SC: Implement generating sync_call entry function
2025-07-09 16:44:04 -04:00
Lin Huang 0367525f76 Merge pull request #351 from AntelopeIO/call_wrapper
SC: Implement call wrapper to simplify making sync calls
2025-07-09 11:08:35 -04:00
Gregory Popovitch fdfc1908c3 Merge pull request #358 from AntelopeIO/gh_338
Add test for array/fixed size array support in action data and action return value.
2025-07-09 10:18:39 -04:00
Lin Huang 04367180e9 Update toolchain abi test for new id field 2025-07-08 21:29:05 -04:00
Lin Huang a8705b701b Generate id field in call section in ABI 2025-07-08 21:13:06 -04:00
Lin Huang 647b82a089 Increase max length of identifiers from 32 to 128 2025-07-08 17:46:21 -04:00
Lin Huang b8b927822e Update sync_call_params_num_tests for using identifier 2025-07-08 17:24:36 -04:00
Lin Huang 9ff9017aa4 Update sync_call_params_type_tests to use new identifer 2025-07-08 16:29:28 -04:00
Lin Huang 37abd4be39 Point lon_names at cdt-llvm submodule which point long_names at tools/lld submodule 2025-07-08 16:16:31 -04:00
Lin Huang 4d84c74e64 Update tests to use long sync call function names 2025-07-08 15:04:10 -04:00
Lin Huang b27ae09d6a Support long sync call function names 2025-07-08 15:03:30 -04:00
Lin Huang 02c01a150e Update cdt-llvm submodule to point to long_names of tools/lld 2025-07-08 15:02:44 -04:00
Lin Huang 86f0e0e745 Merge branch 'sync_call_entry_func' into call_wrapper 2025-07-08 08:07:06 -04:00
Lin Huang b146e8efa4 Merge branch 'sync_call' into sync_call_entry_func 2025-07-07 21:27:27 -04:00
Lin Huang e97e16a371 Merge pull request #349 from AntelopeIO/call_attribute
SC: Generate sync call dispatcher
2025-07-07 20:57:57 -04:00
Lin Huang 60902e9e38 Remove a missed eosio::action tag in a test contract 2025-07-07 10:50:36 -04:00
Lin Huang eac3929865 Merge branch 'call_wrapper' into call_abi 2025-07-07 10:04:28 -04:00
Lin Huang 7bdb80e33f Add tests for verifying methods are not allowed both as an action and a call 2025-07-07 08:22:03 -04:00
Lin Huang 2e0a036574 Do not allow a method to be tagged both as an action and a call 2025-07-07 08:20:05 -04:00
Lin Huang c3223aefe2 Use matched Spring branch return_status for CICD 2025-07-06 15:15:13 -04:00
Lin Huang dcd84c4da0 Merge branch 'call_wrapper' into call_abi 2025-07-06 14:24:08 -04:00
Lin Huang 96fb93bb38 Merge branch 'sync_call_entry_func' into call_wrapper 2025-07-06 14:04:04 -04:00
Lin Huang d25324cf8a Point CICD Spring target to the matching branch and remove an obsolete test which will be tested in another way in future PRs 2025-07-06 09:21:55 -04:00
Lin Huang 28083257c0 fix merging error 2025-07-06 09:19:25 -04:00
Gregory Popovitch 0b8f5fea25 Merge pull request #360 from AntelopeIO/gh_355
Generate minimal supported version of ABIs
2025-07-03 18:45:32 -04:00
greg7mdp 74b8ab8764 Add comment 2025-07-03 09:56:00 -04:00
greg7mdp bc2420a3cf Make abi base version 1.2 and increase to 1.3 when bitset used, add tests. 2025-07-02 12:13:15 -04:00
greg7mdp 28bc1bfb88 First pass at generating minimal abi version numbers. 2025-07-01 14:58:33 -04:00
Lin Huang 697ab13a68 Update CICD Spring target branch to sync_call 2025-06-27 15:15:40 -04:00
Lin Huang 5937050834 Resolve merge conflicts from call_attribute 2025-06-27 15:07:58 -04:00
Lin Huang 21133bba37 Update expected sync call ABI file for toolchain-tester's abigen-pass test 2025-06-27 13:13:12 -04:00
greg7mdp 64cbbd29a4 Whitespace change 2025-06-26 10:48:42 -04:00
greg7mdp 204dcf0baf Merge branch 'main' of github.com:AntelopeIO/cdt into gh_338 2025-06-26 07:59:31 -04:00
Gregory Popovitch ff10448ae8 Merge pull request #359 from AntelopeIO/no_throw
Should not use `throw` in contracts.
2025-06-25 16:49:58 -04:00
greg7mdp 58559f7915 Use Spring's release/2.0 branch for integration tests. 2025-06-25 16:14:34 -04:00
greg7mdp dc19551940 Don't set the abi either if bitset not present 2025-06-25 12:07:20 -04:00
greg7mdp b9b3c70b1e can't std::is_class a type that doesn't exist 2025-06-25 11:53:03 -04:00
greg7mdp 9e43412631 Enable test only if fc::bitset is defined (Spring 2.0+) 2025-06-25 10:55:57 -04:00
greg7mdp 733be5fde5 Add test foir using bitset in contract. 2025-06-19 10:40:12 -04:00
greg7mdp 4e833dec5d Should not use throw in contracts. 2025-06-18 15:21:48 -04:00
greg7mdp d697c579ee cleanup array_tests.cpp and add action. 2025-06-18 15:10:05 -04:00
greg7mdp 259f42785f Add more array tests. 2025-06-16 14:56:29 -04:00
greg7mdp 00f721cbc8 Add test for fixed size array action call. 2025-06-16 09:54:39 -04:00
greg7mdp 5f70b45944 Add retrieval functions for array_test contract. 2025-06-16 09:30:38 -04:00
Lin Huang 814c16f979 Merge branch 'sync_call' into call_attribute 2025-06-12 07:41:54 -04:00
Lin Huang 07c2fec73c Merge pull request #346 from AntelopeIO/sync_call_host_funcs
SC: Implement new sync call host functions
2025-06-12 07:35:36 -04:00
Gregory Popovitch 1631a59471 Merge pull request #352 from AntelopeIO/gh_337
Add `bitset` support in abi.
2025-06-05 10:43:03 -04:00
Lin Huang 47554ec338 Add call_data_header definition to ABI structs and header field to each sync call struct 2025-06-02 21:31:20 -04:00
Lin Huang e34e8f83c2 Use proper variable names 2025-06-02 19:50:16 -04:00
Lin Huang bc5974f2a0 Add tests for complex parameter passing (a mix of structs and integer) 2025-05-31 14:12:56 -04:00
Lin Huang 7ce35739b4 Match host function returning -2 for non-existent sync call entry point 2025-05-28 15:28:02 -04:00
Lin Huang 2ba236cdd5 Initialize abi field in acct_and_code 2025-05-28 14:15:50 -04:00
Lin Huang 6bfccfde76 Remove unneeded code for validating previous declaration match 2025-05-28 10:57:03 -04:00
Lin Huang 6abb8dbb26 Update cdt-llvm to pickup generate sync call entry point function only when one is not provided 2025-05-26 16:17:57 -04:00
Lin Huang e1227b7767 Add a comment why function name type in call_data_header is uint64_t, not eosio::name 2025-05-23 15:44:38 -04:00
Lin Huang a3ad5f6f78 Change spring-dev branch back to sync_call from the temporary return_status branch 2025-05-23 15:35:37 -04:00
Lin Huang d51ad33ef5 Use eosio::name instead of uint64_t for receiver in host function call; it is much cleanner 2025-05-23 15:20:42 -04:00
Lin Huang 91b4b00ebe Use orig_ret_type explicitly to make sure return value optimization is used 2025-05-23 14:57:28 -04:00
Lin Huang 0acd966180 Clarify the comment about why free() is not called 2025-05-23 14:44:41 -04:00
Lin Huang 090c99fd66 Use std::forward_as_tuple instead of std::make_tuple to avoid making a copy 2025-05-23 14:43:06 -04:00
Lin Huang aa16dcd65a Use enum class instead of plain enum to define enums 2025-05-23 14:41:19 -04:00
Lin Huang 061efae475 Update unknown function and invalid header tests to accommodate new error code values 2025-05-23 08:26:52 -04:00
Lin Huang aea6188d15 Bump cdt-llvm version to pick up entry point return status constants 2025-05-22 22:06:04 -04:00
Lin Huang d7fa594cc3 Bring llvm to latest 2025-05-22 18:09:53 -04:00
Lin Huang 1df88ab31c Add test to verify new sync call section is generated in ABI version 1.3 2025-05-22 11:14:52 -04:00
Lin Huang 438cc150ae Update existing ABI tests by setting the ABI version to 1.2 which is what expected ABI files were generated 2025-05-22 11:13:47 -04:00
Lin Huang b6a42b47fc Add sync call section in ABI file and bump ABI version to 1.3 2025-05-22 11:12:04 -04:00
greg7mdp cbf17eb10c Unify bitset.hpp implementation with the one in Spring. 2025-05-21 15:51:51 -04:00
Lin Huang 58bd4c0ad5 Add toolchain tests for the validation of arguments types and numbers by call_wrapper 2025-05-21 08:37:05 -04:00
Lin Huang 8af48755a0 Return std::optional for support_mode::no_op calls; add comprehensive tests 2025-05-20 14:20:48 -04:00
Lin Huang 4848fb2423 Rename execution_mode to access_mode, and on_call_not_supported_mode to support_mode for simplicity 2025-05-20 08:17:53 -04:00
greg7mdp 5f76c082c0 Update comment and add num_blocks() api. 2025-05-19 15:31:02 -04:00
greg7mdp 6e8d8b2653 Remove whitespace. 2025-05-19 14:24:29 -04:00
greg7mdp 24639d6aa6 Remove unneeded include and header guards. 2025-05-19 14:23:16 -04:00
greg7mdp 13ce859c98 Remove whitespace. 2025-05-19 11:19:31 -04:00
greg7mdp 566563f3f3 Add include guards in print.hpp
The cmake build have the same file included twice with different paths:

```
/home/greg/github/enf/cdt/build_clang18_debug/bin/cdt-cpp -D_LIBCPP_BUILDING_LIBRARY -I/home/greg/github/enf/cdt/libraries/libc/cdt-musl/include -I/home/greg/github/enf/cdt/libraries/libc/cdt-musl/src/internal -I/home/greg/github/enf/cdt/libraries/libc/cdt-musl/src/crypt -I/home/greg/github/enf/cdt/libraries/libc/cdt-musl/arch/eos -I/home/greg/github/enf/cdt/libraries/libc++/cdt-libcxx/include -I/home/greg/github/enf/cdt/libraries -O3 -Wall -no-missing-ricardian-clause -g -g -std=gnu++17 -MD -MT eosiolib/CMakeFiles/eosio.dir/eosiolib.cpp.obj -MF eosiolib/CMakeFiles/eosio.dir/eosiolib.cpp.obj.d -o eosiolib/CMakeFiles/eosio.dir/eosiolib.cpp.obj -c /home/greg/github/enf/cdt/libraries/eosiolib/eosiolib.cpp
In file included from /home/greg/github/enf/cdt/libraries/eosiolib/eosiolib.cpp:3:
In file included from /home/greg/github/enf/cdt/libraries/eosiolib/contracts/eosio/system.hpp:9:
In file included from /home/greg/github/enf/cdt/libraries/eosiolib/contracts/eosio/../../core/eosio/name.hpp:9:
In file included from /home/greg/github/enf/cdt/libraries/eosiolib/core/eosio/reflect.hpp:3:
In file included from /home/greg/github/enf/cdt/build_clang18_debug/bin/../include/bluegrass/meta/refl.hpp:11:
/home/greg/github/enf/cdt/build_clang18_debug/bin/../include/eosiolib/core/eosio/print.hpp:78:16: error: redefinition of 'printhex'
   inline void printhex( const void* ptr, uint32_t size) {
               ^
/home/greg/github/enf/cdt/libraries/eosiolib/core/eosio/print.hpp:78:16: note: previous definition is here
   inline void printhex( const void* ptr, uint32_t size) {
               ^
```
2025-05-19 11:11:59 -04:00
greg7mdp df4a8c2fb9 Add bitset.hpp include to datastream.hpp. 2025-05-19 10:56:34 -04:00
greg7mdp dd6ffaa864 cleanup bitset.hpp. 2025-05-19 10:55:43 -04:00
Lin Huang 79d466e089 Add type checks for arguments 2025-05-17 13:29:54 -04:00
Lin Huang de416fd0e8 Point antelope-spring-dev to return_status branch temporarily 2025-05-16 19:45:27 -04:00
Lin Huang 7cab68c568 Bump cdt-llvm 2025-05-16 19:42:17 -04:00
Lin Huang ca6f0a1aee Bump llvm submodule to call_wrapper 2025-05-16 19:35:45 -04:00
Lin Huang e798246586 Implement data header and validate it 2025-05-16 18:45:21 -04:00
Lin Huang 797d5aa714 Merge branch 'sync_call_entry_func' into call_wrapper 2025-05-14 18:30:43 -04:00
Lin Huang 755ddc5d54 Refactor call_warpper
- Remove unnecessary call class
- Make C++ call host function simply invoke C version
- Make call_wrapper constructor take only one argument (receiver); all
  others are template parameters
- Make call_wrapper handle high level logic
2025-05-14 18:24:07 -04:00
Lin Huang bc1f595e7a Update cdt-llvm submodule to the head of sync_call_entry_func 2025-05-14 16:53:53 -04:00
Lin Huang ecd7c0ec88 Merge branch 'call_attribute' into sync_call_entry_func 2025-05-14 16:13:13 -04:00
Lin Huang 13e3b3be27 Update cdt-llvm submodule to latest call_dispatcher one more try 2025-05-14 09:07:50 -04:00
Lin Huang f654409858 Bump cdt-llvm submodule to branch call_dispatcher 2025-05-13 19:57:55 -04:00
Lin Huang 0aaf6a233e Bump cdt-llm submodule to branch call_dispatcher 2025-05-13 17:44:56 -04:00
Lin Huang b35845994b Add tests for updating and reading from tables using sync calls and read-only enforcement 2025-05-13 15:29:03 -04:00
Lin Huang 676233a28e Use set_call_return_value from C linkage 2025-05-13 11:47:45 -04:00
Lin Huang de050b2959 Automatically derive return type of sync call functions in wrapper 2025-05-13 08:16:18 -04:00
Lin Huang 67b646c730 Add const back to members 2025-05-12 15:00:25 -04:00
Lin Huang 7454073875 Change parameter names of test function sum 2025-05-12 13:24:37 -04:00
Lin Huang f45496e454 Use execution_mode and on_call_not_supported_mode enums instead of bools for read_only and behavior when sync call is not supported by receiver 2025-05-12 13:23:19 -04:00
Lin Huang 1c9cd27993 tests/integration/call_tests.cpp 2025-05-12 10:35:22 -04:00
Lin Huang d3cac6a644 Implement call wrapper to simplify making sync calls 2025-05-12 10:34:31 -04:00
Lin Huang 34576751fc Add a test for contracts containing only one function marked as sync call 2025-05-09 09:11:28 -04:00
Lin Huang bb66029001 Use meaningful names instead of single letter names in the generated code 2025-05-09 08:47:32 -04:00
Lin Huang 10e896741a Remove unused declaration of get_call_data in the generated call dispatcher 2025-05-09 08:36:57 -04:00
Lin Huang 20a036c4cc Call get_call_data only once to get function name and arguments 2025-05-08 21:23:07 -04:00
Lin Huang f669a1ec67 Add a test for calling an non-existing function 2025-05-08 14:38:00 -04:00
Lin Huang 2bd39eb47f Add a test for functions tagged as both action and call 2025-05-08 11:43:01 -04:00
Lin Huang 6d16938419 Add a test for passing multiple parameters 2025-05-08 11:19:01 -04:00
greg7mdp 939b0cf024 Add bitset support 2025-05-08 11:05:25 -04:00
Lin Huang 9bc60ad125 Add a test for calling a void function 2025-05-08 10:26:57 -04:00
Lin Huang b540567a2d Remove the sync call function such that the contract does not support sync calls 2025-05-08 10:18:07 -04:00
Lin Huang e278557637 Merge remote-tracking branch 'origin/call_attribute' into sync_call_entry_func 2025-05-07 21:38:08 -04:00
Lin Huang 2b114e75f4 Correct parameter passing test 2025-05-07 21:31:41 -04:00
Lin Huang 9b4d922c73 Skip function name in payload before retrieving parameters 2025-05-07 21:31:15 -04:00
Lin Huang d793d443ac Add tests for parameter passing and returning result 2025-05-07 20:11:59 -04:00
Lin Huang a12e6df843 Implement generating sync_call entry point function 2025-05-07 20:10:20 -04:00
Lin Huang 8abaf40454 Add a method tagged by sync call 2025-05-06 08:18:01 -04:00
Lin Huang 582f38a64d Merge branch 'sync_call_host_funcs' into call_attribute 2025-05-05 14:10:08 -04:00
Lin Huang 34a71155ef Generate sync call dispatcher 2025-05-05 13:21:28 -04:00
Lin Huang 617bfe6330 Fix a typo in a comment 2025-05-05 08:48:14 -04:00
Lin Huang cfec3f1446 Rename no_op_if_receiver_no_support_sync_call to no_op_if_receiver_not_support_sync_call 2025-05-03 18:21:30 -04:00
Lin Huang f27981b4f7 Add tests for no_op_if_receiver_not_support_sync_call 2025-05-03 18:17:58 -04:00
Lin Huang 89099625e9 Pass read_only and no_op_if_receiver_no_support_sync_call to call constructor; enforce no_op_if_receiver_no_support_sync_call 2025-05-03 18:17:20 -04:00
Lin Huang b307b2ed0d Remove unneeded default constructor because of const members 2025-05-02 20:57:26 -04:00
Lin Huang 2853bc1d0a Remove unnecessary includes and add const to members of call class 2025-05-01 15:34:52 -04:00
Lin Huang b0b2e8e3d1 Improve the comments 2025-05-01 15:17:51 -04:00
Lin Huang 1dcd1923a6 Remove incorrect changes 2025-05-01 07:54:30 -04:00
Lin Huang fde97b1563 Point CICD Spring branch to sync_call 2025-04-30 15:40:15 -04:00
Lin Huang fa72f82451 Add an integration test for calls 2025-04-30 15:39:42 -04:00
Lin Huang 21fa60dab0 Add a test contrac for sync calls 2025-04-30 15:39:10 -04:00
Lin Huang b97d5631de Rename existing call() in intrinsics with exec() to avoid conflicts with new host function call() 2025-04-30 15:38:06 -04:00
Lin Huang defff56bda Defines the new host functions in various files 2025-04-30 15:36:55 -04:00
Lin Huang f3380facc0 Merge pull request #335 from AntelopeIO/fix_deserialize
Fix missing reset when deserializing std::optional if serialized value is empty
2025-01-16 08:16:21 -05:00
Lin Huang 53e4574517 Fix missing reset when deserializing std::optional if serialized value is empty 2025-01-15 17:18:33 -05:00
Eric Passmore a0e7748412 Merge pull request #316 from AntelopeIO/merge-official-4.1-release
Merge official 4.1 release
2024-09-04 10:59:13 -04:00
Eric Passmore 5acda86dd9 merge offical 4.1 release into main 2024-09-04 07:41:44 -07:00
Eric Passmore 7028e80f44 Merge pull request #315 from AntelopeIO/official-4.1.0
[4.1] Official CDT Release v4.1.0
2024-09-04 10:35:05 -04:00
Eric Passmore 551179192c version bump v4.1.0 2024-09-03 11:32:04 -07:00
Eric Passmore 98f94f634e Merge pull request #314 from AntelopeIO/merge-release-4.1.0-rc3
[4.1 -> main] Merge release 4.1.0 rc3 into Main
2024-08-22 13:53:57 -07:00
Eric Passmore e211d6a154 Merge branch 'release/4.1' into merge-release-4.1.0-rc3 2024-08-22 12:08:46 -07:00
Eric Passmore b4a95f95c2 Merge pull request #313 from AntelopeIO/release-bump-v4.1.0-rc3
Bump cmake to v4.1.0-rc3
2024-08-22 12:06:50 -07:00
Eric Passmore 376cb89a68 merged version bump to v4.1.0-rc3 while keeping CMake for main at vnext 2024-08-22 12:06:19 -07:00
Matt Witherspoon c19cde4daf Merge pull request #312 from AntelopeIO/pr309_main_merge
[4.1 -> main] disable CFL Alias Analysis by default; fixes known cases of indeterministic build output
2024-08-22 15:02:26 -04:00
Matt Witherspoon e7473c3e9a Merge pull request #311 from AntelopeIO/pr308_main_merge
[4.1 -> main] Removed leftover printhex statement in crypto_bls_ext::bls_base64url_to_type
2024-08-22 15:02:19 -04:00
Matt Witherspoon f1feb03207 Merge pull request #310 from AntelopeIO/pr302_main_merge
[4.1 -> main] Bump 4.1 branch to rc2
2024-08-22 15:02:13 -04:00
Eric Passmore 14684af1c1 bump cmake to v4.1.0-rc3 2024-08-22 12:01:39 -07:00
Matt Witherspoon f2f23f9b84 Merge commit 'f2e8e9209c502c2789fd04e9735f37ee5e369f4a' into HEAD 2024-08-22 14:49:53 -04:00
Matt Witherspoon dbdfa5f00c Merge commit '9c5c88cc85ead9fcb74d970e9fea4c39bd556814' into HEAD 2024-08-22 14:49:21 -04:00
Matt Witherspoon b1cfa305bc Merge commit 'b2c7d0d' into HEAD 2024-08-22 14:48:50 -04:00
Matt Witherspoon f2e8e9209c Merge pull request #309 from AntelopeIO/disable_cffaa_default_41
[4.1] disable CFL Alias Analysis by default; fixes known cases of indeterministic build output
2024-08-22 14:46:59 -04:00
Matt Witherspoon 29f4232238 change docs for no-cfl-aa removal 2024-08-22 13:51:16 -04:00
Matt Witherspoon bec0d6cac9 remove now removed -fno-cfl-aa from test builds 2024-08-22 13:51:14 -04:00
Matt Witherspoon 387c2b8624 disable CFL Alias Analysis by default 2024-08-22 13:51:12 -04:00
Eric Passmore 9c5c88cc85 Merge pull request #308 from systemzax/release/4.1
Removed leftover printhex statement in crypto_bls_ext::bls_base64url_to_type
2024-08-22 10:23:02 -07:00
Guillaume Babin-Tremblay 76de7e8b9a Update crypto_bls_ext.hpp 2024-08-22 06:59:42 -06:00
Eric Passmore b2c7d0deed Merge pull request #302 from AntelopeIO/ehp/bump-4.1-branch-to-rc2
Bump 4.1 branch to rc2
2024-08-16 17:07:14 -07:00
Eric Passmore 6b98462d0d Merge pull request #303 from AntelopeIO/ehp/merge-4.1-rc2-bump
[4.1 -> main] Merge 4.1-rc2 version bump commit and reset version
2024-08-16 17:07:05 -07:00
Eric Passmore 6d4f93229c merged in 4.1 rc2 version bump 2024-08-16 14:28:12 -07:00
Eric Passmore afdcd5269f merge version bump commit and reset version 2024-08-16 14:24:46 -07:00
Eric Passmore 6ffc9c985a bump 4.1 branch to rc2 2024-08-16 14:22:16 -07:00
Kevin Heifner 18b09ddccb Merge pull request #301 from AntelopeIO/reanme_instant_finality_extension_main
[4.1 -> main] instant_finality_extension renamed to finality_extension
2024-08-16 15:43:57 -05:00
Kevin Heifner b949569188 Merge remote-tracking branch 'origin/release/4.1' into reanme_instant_finality_extension_main 2024-08-16 15:31:18 -05:00
Kevin Heifner 293ee7a4b0 Merge pull request #299 from AntelopeIO/reanme_instant_finality_extension_4.1
[4.1] instant_finality_extension renamed to finality_extension
2024-08-16 15:30:12 -05:00
Kevin Heifner 8a164d06bf instant_finality_extension renamed to finality_extension 2024-08-16 15:20:10 -05:00
Kevin Heifner d660810d2e Merge pull request #298 from AntelopeIO/reanme_instant_finality_extension
instant_finality_extension renamed to finality_extension
2024-07-15 07:55:31 -05:00
Kevin Heifner bc90b7170a instant_finality_extension renamed to finality_extension 2024-07-15 07:26:52 -05:00
Matt Witherspoon f228975712 Merge pull request #297 from AntelopeIO/ci_action_version_update
[4.1 -> main] update various CI workflow action versions; meeting new requirement of asset-artifact-download-action
2024-07-01 15:08:33 -04:00
Matt Witherspoon cf6988a803 Merge remote-tracking branch 'origin/release/4.1' into HEAD 2024-07-01 14:35:38 -04:00
Matt Witherspoon 65ac0987a4 Merge pull request #296 from AntelopeIO/ci_action_version_update_41
[4.1] update various CI workflow action versions; meeting new requirement of `asset-artifact-download-action`
2024-07-01 14:35:27 -04:00
Matt Witherspoon 93ddaaa5e3 update various CI workflow action versions 2024-07-01 11:55:51 -04:00
Matt Witherspoon db51a8ee38 Merge pull request #295 from AntelopeIO/remove_security_group
remove security group headers & host function definitions
2024-06-26 16:10:38 -04:00
Matt Witherspoon 40681c7283 remove security group stuff 2024-06-25 11:53:46 -04:00
Matt Witherspoon 12df4cc329 Merge pull request #294 from PocelowannyNebescami/refactor/singleton
Marking appropriate methods of singleton as const
2024-06-24 13:45:22 -04:00
Sergey a88c7b8f56 Appropriate methods were marked as const 2024-06-20 13:15:58 +03:00
Matt Witherspoon 775d671e1e Merge pull request #293 from AntelopeIO/antelope-spring-dev.deb
[4.1 -> main] use `antelope-spring-dev.deb` instead of `spring-dev.deb`; fix finality test
2024-06-14 20:39:14 -04:00
Matt Witherspoon c250347804 keep README's package link at 4.0.1 until 4.1.0 is released 2024-06-14 20:12:07 -04:00
Matt Witherspoon a50e3a43a7 Merge remote-tracking branch 'origin/release/4.1' into HEAD 2024-06-14 20:08:01 -04:00
Matt Witherspoon 83a594dfbe Merge pull request #292 from AntelopeIO/antelope-spring-dev.deb_41
[4.1] use `antelope-spring-dev.deb` instead of `spring-dev.deb`
2024-06-14 20:07:47 -04:00
Lin Huang 0b2c5eb909 Update instant_finality_tests to match Spring's change of instant_finality_extension format and make the tests less flaky 2024-06-14 17:57:10 -04:00
Matt Witherspoon 698c54c00e use antelope-spring-dev.deb 2024-06-14 15:42:15 -04:00
Eric Passmore cceffd7275 Merge pull request #282 from AntelopeIO/ehp/v4.1_README
[4.1] updated artifact download links
2024-05-06 13:39:03 -07:00
Matt Witherspoon 9ecdca0f08 Merge pull request #289 from AntelopeIO/ubuntu24_main
[4.1 -> main] add ubuntu 24.04 to CI
2024-05-06 16:35:50 -04:00
Eric Passmore 198b32e962 Merge remote-tracking branch 'origin/release/4.1' into ehp/v4.1_README 2024-05-06 12:52:25 -07:00
Matt Witherspoon 6ba64dacb5 Merge pull request #288 from AntelopeIO/ubuntu20_pkg_main
[4.1 -> main] upload ubuntu20 .deb package
2024-05-06 15:19:55 -04:00
Matt Witherspoon 6da162abea Merge pull request #287 from AntelopeIO/merge_update-c-set-finalizers_main
[4.1 -> main] Update c interface of set_finalizers
2024-05-06 15:19:44 -04:00
Matt Witherspoon da7e87ad9e Merge remote-tracking branch 'origin/release/4.1' into HEAD 2024-05-06 15:16:05 -04:00
Matt Witherspoon 44321e257d Merge pull request #286 from AntelopeIO/ubuntu24_41
[4.1] add ubuntu 24.04 to CI
2024-05-06 15:15:56 -04:00
Eric Passmore c71fc70d07 Merge branch 'release/4.1' into ehp/v4.1_README 2024-05-06 12:03:55 -07:00
Matt Witherspoon d803deac88 Merge remote-tracking branch 'origin/release/4.1' into HEAD 2024-05-06 14:48:50 -04:00
Matt Witherspoon e97603726a Merge pull request #285 from AntelopeIO/ubuntu20_pkg_41
[4.1] upload ubuntu20 .deb package
2024-05-06 14:48:38 -04:00
Matt Witherspoon 13f21ef100 Merge remote-tracking branch 'origin/release/4.1' into HEAD 2024-05-06 14:45:03 -04:00
Matt Witherspoon c646d38e98 Merge pull request #284 from AntelopeIO/downmerge_update-c-set-finalizers_41
[4.1] pick from main: Update c interface of set_finalizers
2024-05-06 14:44:52 -04:00
Matt Witherspoon 0ab129eb93 ubuntu24 build 2024-05-06 14:39:54 -04:00
Matt Witherspoon f5e7976a9d upload ubuntu20 package 2024-05-06 14:37:05 -04:00
Kevin Heifner a95b1d4936 Update c interface of set_finalizers 2024-05-06 14:21:18 -04:00
Eric Passmore a306d507f1 corrected version fixed dangling rc1 reference 2024-05-06 10:33:17 -07:00
Eric Passmore bdba2fa7ce updated artifact download links 2024-05-06 09:59:16 -07:00
Eric Passmore 904b177890 Merge pull request #279 from AntelopeIO/ehp/spring-release-version-bump
Version Bump of CDT after Spring-CDT release
2024-05-02 19:56:09 -07:00
Kevin Heifner 582244a233 Merge branch 'main' into ehp/spring-release-version-bump 2024-05-02 14:06:21 -05:00
Kevin Heifner 3cd6a4a4e7 Merge pull request #280 from AntelopeIO/update-c-set-finalizers
Update C interface of set_finalizers
2024-05-02 14:05:59 -05:00
Kevin Heifner c538d947a5 Update c interface of set_finalizers 2024-05-02 13:15:03 -05:00
Eric Passmore e40b7d35eb version bump next version after spring release 2024-05-02 11:10:20 -07:00
Eric Passmore 7ef58b4c65 version bump supporting Savanna and Spring release 2024-05-02 11:07:16 -07:00
Kevin Heifner 2912af0a9d Merge pull request #278 from AntelopeIO/set-finalizers-format
set_finalizers host function now takes a packed format
2024-05-02 08:13:04 -05:00
Kevin Heifner 99600bb8d6 Add comment 2024-05-02 08:12:40 -05:00
Kevin Heifner baa3f58cc4 Merge pull request #277 from AntelopeIO/GH-276-spring
Use spring instead of leap for integration tests
2024-05-02 08:11:24 -05:00
Kevin Heifner 01b3b6e7da GH-276 Update comment 2024-05-02 08:10:56 -05:00
Kevin Heifner e610d1b14e Update for set_finalizers host function now takes a packed format 2024-05-01 19:52:20 -05:00
Kevin Heifner 7906f2a2fb GH-276 Use spring instead of leap for integration tests 2024-05-01 17:55:33 -05:00
Kevin Heifner 7719029931 GH-276 Use spring instead of leap for integration tests 2024-05-01 17:45:26 -05:00
Areg Hayrapetian 4911e5fc0b Merge pull request #255 from AntelopeIO/hotstuff_integration
Hotstuff integration
2024-04-30 14:42:44 -07:00
Lin Huang 4eee901c29 Merge pull request #275 from AntelopeIO/add_inline_specifier
IF: Add missing inline specifier to several methonds in crypto_bls_ext.hpp
2024-04-01 16:31:08 -04:00
Lin Huang 921e850e65 Add missing inline specifier to several methonds in crypto_bls_ext.hpp 2024-04-01 13:33:20 -04:00
Lin Huang dc1019e410 Merge pull request #272 from AntelopeIO/bls_base64url_support
IF: Change BLS library to use Base64 URL encoding/decoding; update Base64 library to match Leap's
2024-03-11 18:13:17 -04:00
Lin Huang 5763afdb48 Merge remote-tracking branch 'origin/main' into bls_base64url_support 2024-03-11 17:37:43 -04:00
Lin Huang 26414ada06 Adapt BLS and instant_finality tests to base64 URL 2024-03-11 13:10:42 -04:00
Lin Huang 75eb06ea03 change BLS library to use base64 URL for encoding and decoding 2024-03-11 12:35:59 -04:00
Lin Huang 28794f472e add tests to verify base64url_decode reject invalid chars and update existing tests 2024-03-11 10:55:34 -04:00
Lin Huang 42c0a9d158 Do not allow base64 chars (+, /, and =) when decoding base64url, to match with Leap base64url decode behavior 2024-03-10 21:32:14 -04:00
Lin Huang b067f1c76b do not append trailing = to base64url encoding 2024-03-10 19:13:04 -04:00
Eric Passmore 26289ffcaa Merge pull request #270 from AntelopeIO/ehp/gh-269-use-ubuntu22-leap-dev
Updated Build&Test to use ubuntu22 leap
2024-02-20 07:43:08 -08:00
Eric Passmore 0d42f9bc77 specify os version in leap dev download file 2024-02-16 19:04:19 -08:00
Eric Passmore b8b9318784 specify os version in leap dev download file 2024-02-16 19:03:47 -08:00
Eric Passmore fd49c7b08c updated build&test to use ubuntu22 leap 2024-02-15 08:55:56 -08:00
Eric Passmore 6906563d89 Merge pull request #262 from AntelopeIO/ehp/gh-260-revert-db-index-op-names
Revert Alias of Multi-Index Operations
2024-01-16 17:47:10 -08:00
Matt Witherspoon b9e8265d5b Merge pull request #265 from AntelopeIO/export_wasm_memory
export wasm memory
2024-01-12 21:08:43 +00:00
Matt Witherspoon 6cda379dc3 Merge pull request #256 from dougbutner/main
UPDATE Link to latest patch of CDT (4.0.1)
2024-01-09 19:47:16 +00:00
Matt Witherspoon 3b07180665 export wasm memory 2024-01-08 20:44:19 -05:00
Eric Passmore d31c73a65b Revert "Add insert, remove and update methods to multi_index (and index)"
This reverts commit 94ca0508dd.
2023-12-20 18:25:02 -08:00
Eric Passmore 47e1b5175a Revert "Get rid of const obj for new modify() method."
This reverts commit 2b0fd5c55b.
2023-12-20 18:24:57 -08:00
Eric Passmore 5634784cd0 Revert "Update tests to cover both const and non-const version of remove()"
This reverts commit a1aae5f8d2.
2023-12-20 18:24:47 -08:00
Eric Passmore 589faab1d0 Reverts operations to multi-index that created alias for existing operations
This reverts commit 65f928fcde.
2023-12-20 18:22:55 -08:00
Kevin Heifner b1eacc8b9f Merge pull request #259 from AntelopeIO/GH-257-set-finalizers-types-rename
IF: Rename set_finalizers types to match `eosio.bios` and `leap` names
2023-12-19 21:52:59 -06:00
Kevin Heifner e87d621b0c GH-257 Update with valid public key 2023-12-19 16:22:11 -06:00
Kevin Heifner da082d4d47 GH-257 Use public_key instead of public_key_g1. Update tests. 2023-12-19 15:26:51 -06:00
Kevin Heifner d572004e4d GH-257 Rename set_finalizers types to match eosio.bios and leap names 2023-12-19 14:53:02 -06:00
Douglas James Butner a2e3f3f240 UPDATE Link to latest patch of CDT (4.0.1) 2023-12-13 12:22:48 -05:00
Kevin Heifner 98e09b9ffa Merge branch 'main' into hotstuff_integration 2023-12-11 16:27:18 -06:00
Lin Huang 4c47d241b8 Merge pull request #218 from AntelopeIO/set_finalizers_hf
IF: add set_finalizers host function
2023-12-11 11:15:45 -05:00
Lin Huang 7eeaba0761 change finalazer_set to finalazer_policy in ia couple of comments 2023-12-10 09:34:34 -05:00
Lin Huang a532a6dec4 rename files and tests from set_finalizers to instant_finality 2023-12-08 21:29:56 -05:00
Lin Huang c82af4eb22 update tests to use finalizer_policy 2023-12-08 08:30:44 -05:00
Lin Huang f43d6efc79 change abi_finalizer_set to abi_finalizer_policy 2023-12-07 21:11:09 -05:00
Lin Huang 8ab3b6b5b3 update set_finalizers_tests.cpp to include finalizer_policy.hpp 2023-12-07 20:21:39 -05:00
Lin Huang 30786faac5 rename finalizer_set.hpp -> finalizer_policy.hpp 2023-12-07 16:54:17 -05:00
Lin Huang cb73eae845 Update set_finalizers_tests
* Fixed breaking strict-aliasing rules
* Added public key check
2023-12-07 16:33:09 -05:00
Lin Huang 5e504d3e62 Fix set_finalizers_tests
* Use BOOST_REQUIRE_EQUAL and BOOST_REQUIRE; existing BOOST_ASSERT does
  not run during tests
* Update to Leap changes of proposed_finalizer_set to  proposed_finalizer_policy
2023-12-07 16:04:19 -05:00
Lin Huang 290e80681a fix a compile error due to type alias bls_g1_affine changed to bls_g1 2023-12-07 11:01:42 -05:00
Lin Huang 5641111004 Merge branch 'hotstuff_integration' into set_finalizers_hf 2023-12-07 09:55:26 -05:00
Kevin Heifner 1c151b52f7 Merge pull request #254 from AntelopeIO/GH-253-bls-n0
Return -1 on n==0 for bls_g1_weighted_sum, bls_g2_weighted_sum, and bls_pairing
2023-12-06 11:26:15 -06:00
Kevin Heifner f9331b180d GH-253 Return -1 on n==0 for bls_g1_weighted_sum, bls_g2_weighted_sum, and bls_pairing. Add return_code type. 2023-12-06 07:49:05 -06:00
Kevin Heifner c90795ee12 Merge pull request #221 from AntelopeIO/bls_public_key_serialization
base64 and proof of possession verify functionality added
2023-12-06 07:29:05 -06:00
Kevin Heifner 5bdd337b61 GH-215 Add test for bls_signature_verify 2023-12-05 14:15:33 -06:00
Kevin Heifner 6e8e98a949 GH-215 fix check message 2023-12-05 13:48:16 -06:00
Kevin Heifner 3588c2c3c7 GH-215 Add a bls_signature_verify method 2023-12-05 13:46:32 -06:00
Kevin Heifner 8cdc0f4596 GH-215 Use affine non-montgomery form for proof of possesion 2023-12-05 12:52:05 -06:00
Kevin Heifner b124284d13 Merge remote-tracking branch 'origin/hotstuff_integration' into bls_public_key_serialization 2023-12-04 08:29:29 -06:00
Kevin Heifner 122ff0807c Merge pull request #252 from AntelopeIO/GH-251-bls-host-functions
Add new BLS host function support and switch to affine
2023-12-02 13:17:36 -06:00
Kevin Heifner 34c7f69913 GH-251 Correctly handle num==0 2023-12-01 16:41:07 -06:00
Kevin Heifner 6beeb6c92c GH-251 Simplify GT_ONE declaration 2023-12-01 16:26:08 -06:00
Kevin Heifner c076567d0e GH-251 Use size() instead of sizeof 2023-12-01 16:22:42 -06:00
Kevin Heifner 677e739462 GH-251 Add comment on how public key and signature strings were created 2023-12-01 16:03:00 -06:00
Kevin Heifner 260c2a27e1 GH-251 Add comments on how values created 2023-12-01 15:43:37 -06:00
Kevin Heifner 481d28a54d GH-251 Add new BLS host function support and switch to affine little-endian format 2023-12-01 15:12:14 -06:00
Matt Witherspoon e537352ed9 Merge pull request #248 from AntelopeIO/releaseyaml
[4.0 -> main] on release, upload .deb as release asset automatically
2023-11-07 12:19:38 -05:00
Matt Witherspoon df382e485c Merge remote-tracking branch 'origin/release/4.0' into HEAD 2023-11-07 09:46:01 -05:00
Matt Witherspoon 21b4ab66d8 Merge pull request #247 from AntelopeIO/release_4x
[4.0] on release, upload .deb as release asset automatically
2023-11-07 09:45:42 -05:00
Matt Witherspoon dd0887c4d1 on release, upload .deb as release asset automatically 2023-11-06 15:07:56 -05:00
dimas1185 71366defce Merge pull request #242 from AntelopeIO/devint 2023-10-26 09:50:43 -04:00
Dmytro Sydorchenko 4d2931fd01 Merge branch 'main' into devint 2023-10-13 14:23:53 -04:00
dimas1185 26f8d67140 Merge pull request #241 from AntelopeIO/fix-release
remove rc1 from bugfix release
2023-10-10 16:21:52 -04:00
Dmytro Sydorchenko 62b283dcd4 remove rc1 from bugfix release 2023-10-10 16:11:16 -04:00
dimas1185 bbf155a3fd Merge pull request #240 from AntelopeIO/bump-version-4.0.1 2023-10-05 22:09:59 -04:00
dimas1185 e8d0a5f126 Merge pull request #238 from AntelopeIO/antler-proj-removal 2023-10-05 22:09:41 -04:00
Dmytro Sydorchenko e91f4a3668 bump version to 4.0.1 2023-10-05 16:59:54 -04:00
Dmytro Sydorchenko 2a91ea6db1 get back additional sym links in tarball 2023-10-05 12:12:22 -04:00
Dmytro Sydorchenko 71ae8429c0 resolving wrong revert 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 4b8bf0e70c restore wrongly reverted files 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko cedbfd251a restore ubuntu20 docker file from main 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 1f125fb952 fix revert errors 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko b9b450d1dc fix revert 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 3dcf7ed99f correct revert 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko e2d8f970e7 resolve incorrect revert 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko a11caaa048 Revert "add antler-proj to cdt"
This reverts commit 9736614860.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 149f82ce0c Revert "fix build after adding antler-proj"
This reverts commit 87184a2103.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 58c38a800b Revert "install step fix"
This reverts commit 32614bf8a9.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 6c4b3d2785 Revert "fix build & test step"
This reverts commit a78788f1e6.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko e9abfab888 Revert "fixing build & test step"
This reverts commit 5f505262c0.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko a080e7dbf3 Revert "fix build & test step: adding boost"
This reverts commit cb02ee55fd.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko fb399831e8 reverting antler-proj 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 8efbcedfbd Revert "updates to allow for building and proper generation of packages"
This reverts commit be71fb0557.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 72936e8ee5 Revert "update cicd"
This reverts commit 88d1569a93.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 523a88f298 Revert "remove libcurl4-openssl"
This reverts commit 92116ada5e.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 5e7a14c81a reverting antler-proj 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 1206eeff1b Revert "fixing ubuntu 22 build"
This reverts commit b1fd200aa8.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 8f700ae16f Revert "ubuntu 18 build fix"
This reverts commit 1a8b4d7c04.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko af509ad5a8 reverting antler-proj 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 3b832e3446 revert 2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko ffe38960f0 Revert "revert back cturtle changes"
This reverts commit 772926c08b.
2023-10-05 12:07:24 -04:00
Dmytro Sydorchenko 03a0bfb134 revert 2023-10-05 12:07:24 -04:00
dimas1185 02ce20a39f Merge pull request #232 from AntelopeIO/abi_fixes
Abi fixes
2023-10-05 11:58:23 -04:00
dimas1185 9dc1399558 Merge pull request #237 from AntelopeIO/antler-run-removal
Antler run removal
2023-10-05 11:58:05 -04:00
Dmytro Sydorchenko cb2f358cc3 Revert "empty antler-run with eos-vm and eosiolib linked"
This reverts commit e7bc222c14.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 53ae153e40 Revert "fix ubuntu 18 & 20 build"
This reverts commit 37f7e3659d.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko a4cc74a03b Revert "fixing ubuntu 18 & 20 builds"
This reverts commit b7a0f32424.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 0077409967 Revert "fix ubuntu 18 & 20 build"
This reverts commit 90506ff790.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko ad73c5ac26 Revert "fix ubuntu 18 build"
This reverts commit 204b16eb7b.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 48a208723b Revert "gcc 7 build fix"
This reverts commit f926d59c47.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko f1c2a006e6 Revert "eos-vm submodule ssh -> https for build server"
This reverts commit 4c7d1bea9a.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 68f52e5ac4 Revert "Revert "gcc 7 build fix""
This reverts commit c47cb0f884.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko b8d6048720 Revert "#94 concerns addressed"
This reverts commit 226f497563.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 5d76c9eea2 Revert "native library shared object support"
This reverts commit 23659dce80.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 390f6b0744 Revert "native library support of shared object"
This reverts commit 0a53b4a263.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 17f5b20f2c Revert "reverting exceptions to jumps"
This reverts commit ea20dd01ce.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko d9d869a58d Revert "support of longjmp frpm shared object"
This reverts commit d1d41aa5f7.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko bd6b0f2f8c Revert "cdt-ld shared-object support added"
This reverts commit 4d0173410a.
2023-10-03 19:51:44 -04:00
Dmytro Sydorchenko 61a12d290f Revert "added shared object option to CDTMacros"
This reverts commit 7efd2580d1.
2023-10-03 19:51:24 -04:00
dimas1185 359f483b68 Merge pull request #231 from AntelopeIO/remove-antler-run
Remove antler run
2023-09-27 16:04:21 -04:00
dimas1185 3dcdca1a27 Merge branch 'main' into remove-antler-run 2023-09-27 15:54:02 -04:00
Matt Witherspoon dae43fd8f4 Merge pull request #235 from AntelopeIO/remove_callable_v_workaround
[4.0 -> main] merge up #233: remove `is_callable_v<>` workaround
2023-09-26 17:16:16 -04:00
Matt Witherspoon 89bb917359 Merge remote-tracking branch 'origin/release/4.0' into HEAD 2023-09-26 15:37:26 -04:00
Matt Witherspoon 46b336c18a Merge pull request #229 from AntelopeIO/macos
[4.0 -> main] fix `-fnative` linking on macOS
2023-09-25 19:11:59 -04:00
Matt Witherspoon f7f3c75e0f Merge pull request #233 from AntelopeIO/remove_callable_v_workaround_40x
[4.0] remove `is_callable_v<>` workaround, fixing build on latest clang
2023-09-25 17:25:42 -04:00
Eric Passmore f897dc7b82 Merge pull request #207 from AntelopeIO/ehp/gh-205-future-dir
Roadmap Doc for public consumption
2023-09-25 14:06:47 -07:00
Matt Witherspoon 19a68c64d7 remove is_callable_v<> workaround 2023-09-25 16:41:57 -04:00
Dmytro Sydorchenko 74043a60e0 fixing integration tests 2023-09-22 14:43:54 -04:00
Dmytro Sydorchenko f86e7a871f improve abi generation 2023-09-22 14:43:54 -04:00
Dmytro Sydorchenko cc01e61e24 error->warning if contract class is not found + refactor 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 9abb751666 #201 reivew concerns addressed 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 0d5973bc7e fix CDT_INTERNAL_ERROR macro 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 17eda8f7b4 change error macro to throw error 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko c06d246620 cicd revert ubuntu 22 to LTS 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 819821766c seg fault fix 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 284a2a2183 fixing seg fault in release build 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 042ad02d46 trying to fix seg fault + logs 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko ae4c0831cf trying to fix seg fault 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 62cfd439d3 fix build seg fault 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 82268f48bd more checks to deal with seg fault 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko f489493ebb trying to fix build seg fault 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko e7df516c7b try to fix crash in tests 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko c172872429 update cicd ubuntu 20.04->20.10 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 8f48c1357e singleton tests extension 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko 93907938d5 redesign of abigen for multi_index and singleton 2023-09-22 14:41:51 -04:00
Dmytro Sydorchenko c6218401a4 handle correctly included contracts types 2023-09-22 14:41:51 -04:00
dimas1185 bf7fe2e3e5 Merge pull request #226 from AntelopeIO/fix-ref-contracts 2023-09-22 12:03:00 -04:00
Dmytro Sydorchenko 181595fd38 #221 review concerns addressed 2023-09-21 22:33:54 -04:00
Dmytro Sydorchenko 977d18802a Revert "empty antler-run with eos-vm and eosiolib linked"
This reverts commit e7bc222c14.
2023-09-20 23:06:23 -04:00
Dmytro Sydorchenko 70928133ee Revert "fix ubuntu 18 & 20 build"
This reverts commit 37f7e3659d.
2023-09-20 23:02:55 -04:00
Dmytro Sydorchenko 734da3fd79 Revert "fixing ubuntu 18 & 20 builds"
This reverts commit b7a0f32424.
2023-09-20 23:02:52 -04:00
Dmytro Sydorchenko 00a8c47ef7 Revert "fix ubuntu 18 & 20 build"
This reverts commit 90506ff790.
2023-09-20 23:02:49 -04:00
Dmytro Sydorchenko c09fcff613 Revert "fix ubuntu 18 build"
This reverts commit 204b16eb7b.
2023-09-20 23:02:45 -04:00
Dmytro Sydorchenko bb32acc377 Revert "gcc 7 build fix"
This reverts commit f926d59c47.
2023-09-20 23:02:41 -04:00
Dmytro Sydorchenko f8b654855d Revert "eos-vm submodule ssh -> https for build server"
This reverts commit 4c7d1bea9a.
2023-09-20 23:00:31 -04:00
Dmytro Sydorchenko eff46f2020 Revert "Revert "gcc 7 build fix""
This reverts commit c47cb0f884.
2023-09-20 22:58:54 -04:00
Dmytro Sydorchenko 2c8868e46a Revert "#94 concerns addressed"
This reverts commit 226f497563.
2023-09-20 22:58:26 -04:00
Dmytro Sydorchenko 7e2efdafda Revert "native library shared object support"
This reverts commit 23659dce80.
2023-09-20 22:57:50 -04:00
Dmytro Sydorchenko 59bb425a25 Revert "native library support of shared object"
This reverts commit 0a53b4a263.
2023-09-20 22:57:08 -04:00
Dmytro Sydorchenko e2d7bfbf79 Revert "reverting exceptions to jumps"
This reverts commit ea20dd01ce.
2023-09-20 22:56:39 -04:00
Dmytro Sydorchenko ea06f6cc82 Revert "support of longjmp frpm shared object"
This reverts commit d1d41aa5f7.
2023-09-20 22:56:05 -04:00
Dmytro Sydorchenko 87672eedb5 Revert "cdt-ld shared-object support added"
This reverts commit 4d0173410a.
2023-09-20 22:50:28 -04:00
Dmytro Sydorchenko 4b6430ed3a Revert "added shared object option to CDTMacros"
This reverts commit 7efd2580d1.
2023-09-20 22:49:50 -04:00
Matt Witherspoon f6ef88a7d8 Merge remote-tracking branch 'origin/release/4.0' into macos 2023-09-20 13:42:41 -04:00
Matt Witherspoon d97027842c Merge pull request #223 from AntelopeIO/macos_4x
[4.0] fix `-fnative` linking on macOS
2023-09-20 13:42:19 -04:00
Matt Witherspoon c3af527450 Merge pull request #228 from AntelopeIO/llvm_python_find_package
[4.0 -> main] migrate to find_package(Python) for cmake 3.27+
2023-09-19 18:57:37 -04:00
Matt Witherspoon 6683402357 Merge pull request #227 from AntelopeIO/basic_string_fix_to_main
[4.0 -> main] add explicit overloads
2023-09-19 18:57:26 -04:00
Eric Passmore 6b55a4f119 spelling error 2023-09-19 15:13:05 -07:00
Eric Passmore f88520b2f1 updated wording on LLVM 2023-09-19 15:09:45 -07:00
Matt Witherspoon b1d9be8ada tweaks to variable names 2023-09-19 17:04:04 -04:00
Matt Witherspoon 88b1dac112 Merge remote-tracking branch 'origin/release/4.0' into HEAD 2023-09-19 17:00:46 -04:00
Matt Witherspoon e2303c042f Merge commit 'd2f7b3cae217774f6f46e3a99edbdbfc429bb176' into HEAD 2023-09-19 16:56:38 -04:00
Matt Witherspoon 8245ce6ffd Merge pull request #224 from AntelopeIO/llvm_python_find_package_4x
[4.0] migrate to `find_package(Python)` for cmake 3.27+
2023-09-19 16:50:04 -04:00
Dmytro Sydorchenko d6721b2d66 fixing integration tests 2023-09-19 00:00:38 -04:00
Dmytro Sydorchenko 93f6a186aa improve abi generation 2023-09-18 22:43:57 -04:00
Matt Witherspoon b19b83e2a1 bump cdt-llvm submodule to HEAD of main with find_package(Python) 2023-09-18 10:45:26 -04:00
Matt Witherspoon 4a6c0b54b8 bump cdt-llvm submodule to HEAD of branch with find_package(Python) 2023-09-15 22:21:15 -04:00
Dmytro Sydorchenko 6f637b05cb #221 concerns addressed 2023-09-15 20:40:09 -04:00
Dmytro Sydorchenko 8d6265dd98 use abi_serializer instead of structure definition 2023-09-15 19:44:46 -04:00
Matt Witherspoon 04d7173075 fix -fnative linking on macos 2023-09-14 22:25:19 -04:00
Dmytro Sydorchenko 1dc5b7d8d6 key type switched to affine 2023-09-14 16:43:51 -04:00
Dmytro Sydorchenko 2a2db21d0a base64, bls pop verify 2023-09-12 20:10:22 -04:00
Dmytro Sydorchenko 3e233826c0 partialy #218 review concerns addressed 2023-09-11 17:30:39 -04:00
Eric Passmore 938204c5c7 clarified C++ 20 support for contract language 2023-09-08 17:47:27 -07:00
Eric Passmore 824cf1f410 updated with c++ 20 2023-09-08 17:43:39 -07:00
Dmytro Sydorchenko 17b6b4dcc9 fix after leap branch update 2023-09-07 16:13:18 -04:00
Dmytro Sydorchenko 409e5b2f31 correct leap-dev branch 2023-09-07 14:01:20 -04:00
dimas1185 5f1ad6f6e7 Merge branch 'hotstuff_integration' into set_finalizers_hf 2023-09-06 17:11:50 -04:00
Peter Oschwald 492d92373e Remove unneeded token with v3. 2023-09-06 17:10:24 -04:00
Peter Oschwald 5a0664705c Make leap-dev download target configurable.
Use defaults.json to specify default location/target to attempt to downlaod the leap-dev package from. Allow dynamic configuration through workflow_dispatch input in github.
2023-09-06 17:10:24 -04:00
Dmytro Sydorchenko 6f61e69554 leap main -> hotstuff_integration 2023-09-06 16:53:26 -04:00
Dmytro Sydorchenko 01d06ab650 added set_finalizers host function 2023-09-06 16:47:45 -04:00
Peter Oschwald 4673b4524a Merge pull request #217 from AntelopeIO/cicd-override-leap-dev-target
Make leap-dev download target configurable.
2023-09-05 19:01:20 -05:00
Peter Oschwald 116c6ba28d Remove unneeded token with v3. 2023-09-05 18:49:39 -05:00
Peter Oschwald 2601d3e2a5 Make leap-dev download target configurable.
Use defaults.json to specify default location/target to attempt to downlaod the leap-dev package from. Allow dynamic configuration through workflow_dispatch input in github.
2023-09-05 17:17:13 -05:00
dimas1185 d87749e732 Merge pull request #211 from AntelopeIO/bls_integration
Bls integration
2023-08-28 18:41:24 -04:00
Dmytro Sydorchenko 14351e0d84 #211 concerns addressed 2023-08-25 15:58:48 -04:00
Dmytro Sydorchenko 0f0a02c314 unit tests fix 2023-08-24 23:13:34 -04:00
Dmytro Sydorchenko 7b55d92177 refactoring 2023-08-24 22:16:57 -04:00
Eric Passmore a46c482228 Merge pull request #214 from AntelopeIO/ehp/gh-18-remove-ubunutu18-builds
remove ubuntu18 from builds (artifact switched to unbuntu20)
2023-08-24 07:31:40 -07:00
Eric Passmore 1219fe772e removed ubuntu18 dockerfile 2023-08-23 15:25:50 -07:00
Eric Passmore c27e69e49b added ubuntu20 artifact upload 2023-08-23 14:22:08 -07:00
Eric Passmore 8160de1e9a remove ubuntu18 from builds 2023-08-22 15:53:43 -07:00
Dmytro Sydorchenko 9a1164b487 leap: 4.0 -> main 2023-08-21 17:48:15 -04:00
Eric Passmore 3777db3212 init roadmap 2023-08-10 17:32:23 -07:00
dimas1185 0056647020 Merge pull request #201 from AntelopeIO/extend-abi-non-contract
Redesign abi generation for multi_index and singleton
2023-07-28 14:01:47 -04:00
Dmytro Sydorchenko b2386d9ff3 empty commit to address gh issue 2023-07-27 17:23:28 -04:00
Dmytro Sydorchenko 6e98fda59f error->warning if contract class is not found + refactor 2023-07-27 16:07:02 -04:00
Dmytro Sydorchenko 8f467812bc #201 reivew concerns addressed 2023-07-27 15:21:45 -04:00
Dmytro Sydorchenko 34ad214294 fix CDT_INTERNAL_ERROR macro 2023-07-27 13:17:17 -04:00
Dmytro Sydorchenko 6c78f0ae61 change error macro to throw error 2023-07-26 17:26:59 -04:00
Dmytro Sydorchenko 73662c240a cicd revert ubuntu 22 to LTS 2023-07-24 14:52:59 -04:00
Dmytro Sydorchenko 19749dd297 seg fault fix 2023-07-21 12:07:32 -04:00
Dmytro Sydorchenko 208274a8f6 fixing seg fault in release build 2023-07-21 11:13:26 -04:00
Dmytro Sydorchenko dc8d62c5c7 trying to fix seg fault + logs 2023-07-19 22:29:40 -04:00
Dmytro Sydorchenko b2d6f0b18d trying to fix seg fault 2023-07-19 21:22:18 -04:00
Dmytro Sydorchenko c1eca818a9 fix build seg fault 2023-07-19 17:10:22 -04:00
Dmytro Sydorchenko 9e3d4a0a72 more checks to deal with seg fault 2023-07-19 13:38:52 -04:00
Dmytro Sydorchenko e644e75d3e trying to fix build seg fault 2023-07-19 13:17:59 -04:00
Dmytro Sydorchenko 0a747a936d try to fix crash in tests 2023-07-18 22:22:42 -04:00
Areg Hayrapetian b540790b05 Merge pull request #154 from mschoenebeck/main
BLS12-381 Crypto Primitives
2023-07-18 11:18:19 -07:00
Dmytro Sydorchenko 134a7cd141 update cicd ubuntu 20.04->20.10 2023-07-18 00:37:50 -04:00
Dmytro Sydorchenko 482de2c29e singleton tests extension 2023-07-17 23:41:06 -04:00
Dmytro Sydorchenko 19b3b249aa redesign of abigen for multi_index and singleton 2023-07-17 23:27:35 -04:00
Dmytro Sydorchenko 459fa3226d handle correctly included contracts types 2023-07-10 16:20:10 -04:00
mschoenebeck 3f701e2ea9 better fp2 type 2023-06-30 14:29:38 -05:00
mschoenebeck 8a18e7a976 Merge branch 'main' of https://github.com/AntelopeIO/cdt 2023-06-30 10:38:20 -05:00
mschoenebeck 9d1424dfcf added bls types to enforce correct operand sizes 2023-06-30 10:18:46 -05:00
mschoenebeck 7a6dfcb4a5 added bls integration tests 2023-06-30 08:42:30 -05:00
dimas1185 b5d71e23d6 Merge pull request #195 from dapp-protocols/update-catch2
[Meta-Refl] Update catch2 to v2.13.10
2023-06-29 13:29:27 -04:00
dimas1185 d2f7b3cae2 Merge pull request #191 from AntelopeIO/larryk85/basic_string_fix
add explicit overloads
2023-06-28 23:18:12 -04:00
mschoenebeck 21a82212b3 don't throw but propagate error back to smart contract to be handled there 2023-06-27 19:32:22 -05:00
mikelik 2838fe7641 Merge pull request #194 from AntelopeIO/mikelik/clang-fix
compile with clang-16
2023-06-22 04:07:53 +02:00
Nathaniel baa6147ee3 [Meta-Refl] Update catch2 to v2.13.10
The version of catch2 in use is old enough to fail compiles on updated
Linux operating systems. Update to latest version in v2.0 series to
fix builds.

[Ref: https://github.com/catchorg/Catch2/issues/2421]
2023-06-17 13:21:36 -05:00
Michal Lesiak 7b058b424a Add llvm on ubuntu22 2023-06-16 16:10:37 +02:00
Michal Lesiak 6ed17a2b10 Replace is_callable_v with is_invocable 2023-06-16 13:56:59 +02:00
mschoenebeck 2975faaca2 update according to leap update 2023-06-07 18:15:35 -05:00
Bucky Kittinger c1c2f2be8f add explicit overloads 2023-06-07 17:06:48 -04:00
mschoenebeck 9142b6929f Merge branch 'main' of https://github.com/AntelopeIO/cdt 2023-06-07 16:02:15 -05:00
mschoenebeck 5a97108c6e removed bls types leftovers 2023-06-06 12:53:35 -05:00
Matt Witherspoon 78ced4c9ef Merge pull request #183 from AntelopeIO/stable-main
Stable main
2023-05-31 17:39:10 -04:00
Matt Witherspoon df628a1409 Merge pull request #187 from AntelopeIO/integration_tests_ci_main
[4.0 -> main] merge up #172 (CI integration tests), #182 (4.0 stable bump?)
2023-05-31 17:30:01 -04:00
Matt Witherspoon 44379dc422 Merge remote-tracking branch 'origin/release/4.0' into integration_tests_ci_main 2023-05-24 14:47:20 -04:00
Matt Witherspoon 09611db7ad Merge pull request #172 from AntelopeIO/integration_tests_ci
[4.0] run integration tests in CI with libtester from leap-dev.deb
2023-05-24 14:37:08 -04:00
mschoenebeck 80ef3056dc fixed submodule 2023-05-24 06:28:13 -05:00
mschoenebeck e2bec04986 synced with Antelope/main 2023-05-24 06:19:51 -05:00
mschoenebeck f778277931 sync with branch 'main' of https://github.com/AntelopeIO/cdt 2023-05-24 06:15:26 -05:00
mschoenebeck 861a86e500 removed bls types 2023-05-24 06:01:23 -05:00
Bucky Kittinger ca030252d9 Merge pull request #182 from AntelopeIO/4.0-stable
4.0-rc1 to stable
2023-05-23 11:41:05 -04:00
Alexander Molchevsky aa6efda41d Merge pull request #181 from AntelopeIO/crypto_api_update_proposal
Proposal: Update description of the crypto API to make it more user friendly
2023-05-23 17:17:27 +03:00
Bucky Kittinger 17cfeb8787 merge 2023-05-22 19:14:44 -04:00
Bucky Kittinger 64ee044632 revert antler-proj 2023-05-22 19:14:17 -04:00
Alexander Molchevsky 5b06bd3451 Apply suggestions from code review
a few grammatical changes were made

Co-authored-by: Scott B <Scott@TheBaileyFamily.org>
2023-05-23 00:06:53 +03:00
Bucky Kittinger c2eb13a427 Update build.yaml 2023-05-22 14:57:10 -04:00
Bucky Kittinger 8671ca2677 Merge branch '4.0-stable' into stable-main 2023-05-22 14:10:47 -04:00
Bucky Kittinger 360ce588a2 bump version 2023-05-22 14:10:12 -04:00
Dmytro Sydorchenko 86c38b5d28 #174 concerns addressed 2023-05-22 14:08:41 -04:00
Dmytro Sydorchenko 78e2b702a4 fix endian.h ending 2023-05-22 14:08:35 -04:00
Dmytro Sydorchenko 2e22f4742c fix warning in endian.h 2023-05-22 14:08:27 -04:00
Dmytro Sydorchenko a399d87d35 update 2023-05-22 14:04:55 -04:00
Bucky Kittinger 338cf85c17 update 2023-05-22 14:00:49 -04:00
Dmytro Sydorchenko 79797d4449 fix antler-proj ubuntu 18 build 2023-05-22 13:58:07 -04:00
Dmytro Sydorchenko 9d5531fb95 fix integration tests 2023-05-22 13:57:46 -04:00
Dmytro Sydorchenko d858a415f3 fixing abi for singleton with non-table type 2023-05-22 13:57:39 -04:00
Alexander Molchevsky a7fa7519b6 Updated after review 2023-05-19 21:48:41 +03:00
Alexander Molchevsky 4bae47bf94 Description of the Crypto API was updated 2023-05-19 08:06:44 +03:00
dimas1185 e3ef75c352 Merge pull request #178 from AntelopeIO/fix-abi-singleton
fixing abi for singleton with non-table type
2023-05-18 17:47:25 -04:00
mikelik 8a6bfbde42 Merge pull request #179 from AntelopeIO/mikelik/crud
Add insert, remove and update methods to multi_index (and index)
2023-05-18 16:23:59 +02:00
Michal Lesiak 65f928fcde Code review improvements 2023-05-18 15:04:57 +02:00
Michal Lesiak a1aae5f8d2 Update tests to cover both const and non-const version of remove() 2023-05-18 15:04:57 +02:00
Michal Lesiak 2b0fd5c55b Get rid of const obj for new modify() method. 2023-05-18 15:04:57 +02:00
Michal Lesiak 94ca0508dd Add insert, remove and update methods to multi_index (and index) 2023-05-18 15:04:57 +02:00
Dmytro Sydorchenko 46c13e9e9d fix integration tests 2023-05-17 17:34:17 -04:00
Alexander Molchevsky 5683746983 Merge pull request #180 from AntelopeIO/revert_new_cdt-abidiff
Revert "Added an implementation of a new cdt-abidiff"
2023-05-17 17:44:58 +03:00
Alexander Molchevsky 5931b591c5 Revert "Added an implementation of a new cdt-abidiff"
This reverts commit 20890cd510.
2023-05-17 15:08:49 +03:00
Dmytro Sydorchenko 23510b2d3c fixing abi for singleton with non-table type 2023-05-15 21:57:27 -04:00
dimas1185 aa0904a420 Merge pull request #177 from AntelopeIO/endian-warning-fix
Endian.h warning fix
2023-05-11 10:02:24 -04:00
Dmytro Sydorchenko 9a7e23f8f4 fix antler-proj ubuntu 18 build 2023-05-10 19:55:37 -04:00
mikelik 99e80b1b9a Merge pull request #158 from AntelopeIO/ehp/GH-157-doc-fix-clang-tidy
Doc Fix: Update Readme to install dep clang-tidy
2023-05-09 10:44:10 +02:00
dimas1185 34ccbaf915 Merge pull request #173 from AntelopeIO/endian-warning-fix
fix warning in endian.h
2023-05-08 21:11:42 -04:00
Dmytro Sydorchenko e38eef334d #174 concerns addressed 2023-05-08 20:57:45 -04:00
Dmytro Sydorchenko 1010b703af fix endian.h ending 2023-05-05 14:11:17 -04:00
Bucky Kittinger dba60dfb3c Merge branch 'release/4.0' into integration_tests_ci 2023-05-04 14:15:02 -04:00
Bucky Kittinger 2632fb1b0b Merge branch 'release/4.0' into endian-warning-fix 2023-05-04 14:14:36 -04:00
Alexander Molchevsky 23a78365b1 Merge pull request #171 from AntelopeIO/crypto_ext_doc_upd
The crypto extensions documentation updated
2023-05-04 15:56:08 +03:00
Bucky Kittinger bfb1edb40b Merge pull request #174 from AntelopeIO/larryk85/version_bump
version bump
2023-05-04 08:45:47 -04:00
Bucky Kittinger 567106266a update antler-proj submodulde 2023-05-04 08:22:52 -04:00
Bucky Kittinger f9a08ebfd4 Update README.md 2023-05-03 23:33:16 -04:00
Bucky Kittinger 84754fed3c version bump 2023-05-03 22:55:48 -04:00
Bucky Kittinger dc230529fd Merge branch 'main' into integration_tests_ci 2023-05-03 22:53:51 -04:00
Bucky Kittinger 5fe3166773 Merge branch 'main' into crypto_ext_doc_upd 2023-05-03 22:53:01 -04:00
Dmytro Sydorchenko d26cefa1f6 fix warning in endian.h 2023-05-03 22:25:44 -04:00
dimas1185 822ab27793 Merge pull request #170 from AntelopeIO/bump-leap-ver
leap 4.0 compatibility
2023-05-03 20:11:00 -04:00
Matt Witherspoon 146541f724 run integration tests in CI with libtester from leap-dev.deb 2023-05-03 19:24:54 -04:00
Alexander Molchevsky 19d33cca18 The crypto extensions documentation was reviewed and updated 2023-05-03 13:47:40 +03:00
Dmytro Sydorchenko fd8857c599 leap 4.0 compatibility 2023-05-02 20:07:57 -04:00
Matt Witherspoon 3619fc42cd Merge pull request #160 from AntelopeIO/remove_Runtime.h
remove unused `Runtime.h` include now removed in libtester's main
2023-05-01 14:59:48 -04:00
Matt Witherspoon 841315f9fd remove unused Runtime.h include now removed in libtester's main 2023-05-01 14:26:33 -04:00
Eric Passmore be7b70ccae note to install dep clang-tidy 2023-05-01 07:08:35 -07:00
mikelik a6d743aca8 Merge pull request #129 from AntelopeIO/patch/readme-deb-typo-fix
Fix readme typos for deb installation
2023-04-24 16:20:01 +02:00
Alexander Molchevsky 54c2a8b0ee Merge pull request #151 from AntelopeIO/abidiff_objdump_manpages
Abidiff objdump manpages
2023-04-24 17:11:05 +03:00
mschoenebeck c82a076e38 added bls12-381 crypto primitives 2023-04-22 08:39:49 -05:00
mikelik 06f0b13a86 Merge pull request #149 from AntelopeIO/mikelik/docs_troubleshooting_map
Add new troubleshooting section for generating abi for maps
2023-04-21 10:19:37 +02:00
mikelik e328ca8b15 Update docs/08_troubleshooting/index.md
code review rephrase

Co-authored-by: Scott B <Scott@TheBaileyFamily.org>
2023-04-21 09:53:00 +02:00
dimas1185 d5db46785c Merge pull request #146 from AntelopeIO/multi-index-fix
multi_index bugfix after migration from boost + tests
2023-04-20 17:49:53 -04:00
Alexander Molchevsky f48c430486 Updated after review 2023-04-19 00:13:07 +03:00
Scott B 090313bf50 Merge pull request #152 from AntelopeIO/sbailey/gitignore_more_builds
Added additional build and editor files.
2023-04-18 14:48:58 -05:00
Scott Bailey 8ae841d10b Added additional build and editor files. 2023-04-18 10:32:43 -05:00
Alexander Molchevsky bb076ec700 Wrong file was deleted 2023-04-18 15:20:58 +03:00
Alexander Molchevsky abecf721bf A name tag updated 2023-04-18 15:17:57 +03:00
Alexander Molchevsky 52263dbb78 Added new man pages for cdt-abidiff and cdt-objdump 2023-04-18 15:10:22 +03:00
Alexander Molchevsky 64746cfab7 Merge pull request #144 from AntelopeIO/cdt-ld_man_page
cdt-ld man page created
2023-04-18 15:06:33 +03:00
Alexander Molchevsky 77dfd8fda3 Merge pull request #145 from AntelopeIO/cdt-cc_man_page
cdt-cc man page created
2023-04-18 15:06:11 +03:00
Michal Lesiak c625b1bdd7 Add new troubleshooting section for backward incompatible change in accessing std::map from CDT 3.0.1 2023-04-17 15:26:34 +02:00
Alexander Molchevsky 20890cd510 Added an implementation of a new cdt-abidiff 2023-04-17 14:18:55 +03:00
Alexander Molchevsky 968f4a7822 The headers changed 2023-04-17 13:51:27 +03:00
Alexander Molchevsky 452ebb1dd4 The headers changed 2023-04-17 13:36:48 +03:00
Dmytro Sydorchenko e77c18e74a multi_index bugfix after migration from boost + tests 2023-04-14 20:04:59 -04:00
Alexander Molchevsky 3780ad2e6c cdt-cc man page created 2023-04-14 17:39:47 +03:00
Alexander Molchevsky 5a0e481e9b cdt-ld man page created 2023-04-14 17:26:34 +03:00
Alexander Molchevsky ab285eb34f Merge pull request #139 from AntelopeIO/man_pages
cdt-cpp man page added
2023-04-13 21:22:59 +03:00
Alexander Molchevsky ef0139b059 cdt-cpp man page updated after review 2023-04-13 16:57:12 +03:00
Alexander Molchevsky 1bd27a8494 cdt-cpp man page updated after review 2023-04-13 14:48:34 +03:00
Alexander Molchevsky 655f4565d0 cdt-cpp man page updated after review 2023-04-13 14:48:06 +03:00
Alexander Molchevsky ed378d905d cdt-cpp man page added 2023-04-12 17:54:51 +03:00
dimas1185 ac772cf0d8 Merge pull request #136 from AntelopeIO/cdt-init-fix 2023-04-11 21:50:18 -04:00
Dmytro Sydorchenko b5a319d5a5 fix cdt-init. see #60 2023-04-11 19:42:41 -04:00
dimas1185 d55ed814a6 Merge pull request #114 from AntelopeIO/add-antler-proj 2023-04-10 15:04:51 -04:00
Dmytro Sydorchenko 745cbdd53c add comment for commented out antler-run 2023-04-07 12:42:00 -04:00
Nathan James 4b60b49fd1 Fix readme typos for deb installation 2023-04-07 02:40:55 +03:00
Dmytro Sydorchenko 5e43caad78 cturtle update 2023-04-06 16:54:22 -04:00
Dmytro Sydorchenko e06b9f3335 ubuntu 18 build fix 2023-04-06 16:24:05 -04:00
Dmytro Sydorchenko 772926c08b revert back cturtle changes 2023-04-06 16:15:37 -04:00
Dmytro Sydorchenko 6510dd2719 adding custom cmake to ubuntu 18 build 2023-04-06 16:01:31 -04:00
Luis Paris 42a53d2597 Merge pull request #128 from AntelopeIO/fix-devrel#204
[3.1 -> main] Fix broken links in cdt repo
2023-04-06 12:34:08 -04:00
Luis 262b0f4875 fix url to license file 3.1 to main :doc 2023-04-06 12:11:03 -04:00
Luis e1f20450b7 Merge remote-tracking branch 'origin/release/3.1' into fix-devrel#204 2023-04-06 12:06:39 -04:00
mikelik 84a514fbda Merge pull request #125 from AntelopeIO/mikelik/singleton_fix
Fix getting wrong name of the table for singleton
2023-04-06 09:54:05 +02:00
Dmytro Sydorchenko 043dfa49ab ubuntu 18 build fix 2023-04-05 17:39:01 -04:00
Dmytro Sydorchenko 1a8b4d7c04 ubuntu 18 build fix 2023-04-05 15:01:07 -04:00
Michal Lesiak f32275b6b0 Fix getting wrong name of the table for singleton 2023-04-05 14:10:05 +02:00
Dmytro Sydorchenko b1fd200aa8 fixing ubuntu 22 build 2023-04-04 22:40:54 -04:00
Dmytro Sydorchenko b6220fbcea antler-proj updated 2023-04-04 22:32:37 -04:00
Matt Witherspoon 369119d15c Merge pull request #115 from AntelopeIO/filename_fixes
Fix some issues when building EOSIO contracts
2023-04-04 19:27:27 -07:00
Matt Witherspoon 9b1eb59964 use antelope not eosio for temp file prefix 2023-04-04 18:56:18 -04:00
Bucky Kittinger 92116ada5e remove libcurl4-openssl 2023-03-27 07:35:49 -04:00
Bucky Kittinger 88d1569a93 update cicd 2023-03-27 05:45:53 -04:00
Bucky Kittinger be71fb0557 updates to allow for building and proper generation of packages 2023-03-27 05:06:43 -04:00
Bucky Kittinger 4027ddf7f2 Merge branch 'main' into add-antler-proj 2023-03-24 16:24:49 -04:00
Bucky Kittinger 5f8f201baa Merge pull request #117 from AntelopeIO/sbailey/additional_extended_asset_operators
Add extended_asset operators and unit tests.
2023-03-24 16:23:31 -04:00
Bucky Kittinger 1de734ccf5 Merge pull request #118 from AntelopeIO/mikelik/basic_string
Handle basic_string in datastream serializing/deserializing
2023-03-24 16:21:16 -04:00
Michal Lesiak da5547d016 Add back ds.read/write with bug fix. 2023-03-24 15:46:34 +01:00
Michal Lesiak 11abb4c503 Revert changes with datastream.write/read which do not handle correctly wide characters.
Add unit tests for 2 byte wchar_t.
2023-03-24 15:46:34 +01:00
Michal Lesiak 9abf293289 Code review fix - change from for loop to datastrem::write/read 2023-03-24 15:46:34 +01:00
Michal Lesiak b3803df627 Handle basic_string in datastream serializing/deserializing 2023-03-24 15:46:34 +01:00
Luis Paris f7c6ef3434 Merge pull request #120 from AntelopeIO/fix-devrel#204-main
[3.1 -> main] altering version rc1 -> no suffix; Fix wrong 3.0 version, use latest instead
2023-03-23 18:53:56 -04:00
Scott Bailey 84d75fe0d0 Use consts for asset values in extended_asset test. 2023-03-23 16:20:19 -05:00
Luis 58a2ec51a8 Merge remote-tracking branch 'origin/release/3.1' into fix-devrel#204-main 2023-03-23 17:03:55 -04:00
Scott Bailey 3f606115d6 Add extended_asset operators and tests. 2023-03-21 17:25:52 -05:00
Scott B d89ea1d66a Merge pull request #100 from dapp-protocols/fix-abigen-templates
Resolve #99: Fix abigen with int expression template arguments
2023-03-20 09:27:13 -05:00
Scott B 3d14a671f7 Merge pull request #98 from dapp-protocols/fix-name-pk
Resolve #97: Allow `name` typed primary keys
2023-03-20 09:25:54 -05:00
Nathaniel 8dfff37a7b Ref #99: Add test
This test fails without the fix to issue #99, and passes with it.
The failure is a bit odd -- it doesn't fail because cdt-cpp crashes;
rather, it fails because the crashed cdt-cpp did not output an abi
file and therefore it cannot match the golden record... But hey, it
does test the issue, just rather indirectly. =)
2023-03-20 01:10:34 -05:00
Nathaniel Hourt 0b0c1c6fa9 Update tools/include/eosio/gen.hpp
Add braces

Co-authored-by: Scott B <Scott@TheBaileyFamily.org>
2023-03-20 01:10:34 -05:00
Nathaniel 92fae514ba Fix abigen with int expression template arguments
In my contracts, I use several template arguments which are expressions
which resolve to integral values (such as an eosio::name) but are
not literal integer values. This works great in my contracts, but
causes abigen to fail.

Fix abigen in cases where a template argument is an expression that
resolves to an integer, but isn't an integer literal.
2023-03-20 01:10:34 -05:00
Nathaniel faa9747a09 Ref #97/#98: Add unit test
Create a unit test for a table with a name primary key. The new test
fails to build before the commits in PReq #98, but passes when those
commits are included.
2023-03-19 19:07:48 -05:00
Nathaniel 9e8385bae4 Ref #98: Shorten primary_key_cast to to_raw_pk 2023-03-19 18:35:54 -05:00
Nathaniel cbb579d5b8 Fix build: add missing scope resolution 2023-03-19 18:29:02 -05:00
Nathaniel 3485d33798 Work around build issue
I'm not sure why this build failure occurs... It seems to me that the
requisite `auto` should be resolvable by the time the table is used,
but since it seems it is not, we give the compiler a hint to nudge it
to the right answer.

Using fancier syntax to make my problems go away =)
2023-03-18 22:53:08 -05:00
Nathaniel e6977a1cca [Name PK] Update accessors to allow name PK 2023-03-18 22:53:08 -05:00
Nathaniel b61ef08930 Allow multi_index pk to be a name 2023-03-18 22:53:08 -05:00
Matt Witherspoon 7909340966 Merge pull request #109 from dapp-protocols/issue-88
Resolve #88
2023-03-18 20:08:43 -07:00
Bucky Kittinger e7e19bb928 update ref 2023-03-16 21:49:17 -04:00
Steven Watanabe aeb707b16b Fix default output file. 2023-03-14 23:17:47 -04:00
Steven Watanabe 61bace3d3e Use proper temporary file names to avoid races. 2023-03-14 23:17:30 -04:00
Steven Watanabe b0dae1a2dd Fix dependency output. 2023-03-14 23:17:15 -04:00
Dmytro Sydorchenko cb02ee55fd fix build & test step: adding boost 2023-03-14 21:27:09 -04:00
Dmytro Sydorchenko 5f505262c0 fixing build & test step 2023-03-14 21:13:41 -04:00
Dmytro Sydorchenko a78788f1e6 fix build & test step 2023-03-14 20:58:08 -04:00
Dmytro Sydorchenko 32614bf8a9 install step fix 2023-03-14 20:50:34 -04:00
Dmytro Sydorchenko 87184a2103 fix build after adding antler-proj 2023-03-14 20:32:28 -04:00
Dmytro Sydorchenko 9736614860 add antler-proj to cdt 2023-03-14 20:23:31 -04:00
Nathaniel 887b129bde Ref #88 Review updates: check retval of intrinsic
Ensure the buffer was adequately large for the response and if not,
allocate sufficient space and call intrinsic again.
2023-03-13 21:26:55 -05:00
Matt Witherspoon 7c2c7e8c1d Merge pull request #113 from guilledk/fix_crypto_ext_inline
Resolve #110: Add missing inline declaration on blake2_f intrinsics helper
2023-03-07 19:00:59 -08:00
Matt Witherspoon 77308b625f Merge pull request #104 from YaroShkvorets/patch-1
Fix error message in division operator
2023-03-07 19:00:37 -08:00
Yaro Shkvorets bc52b103d8 Merge branch 'main' into patch-1 2023-03-07 21:44:20 -05:00
Guillermo Rodriguez 728f72c629 Add inline to blake2_f intrinsics 2023-03-07 14:21:22 -03:00
dimas1185 c4384f4bc5 Merge pull request #108 from AntelopeIO/remove-boost
Remove boost from eosiolib and native libraries
2023-03-03 19:08:48 -05:00
Nathaniel f7b206fe62 Resolve #88: Testing for get_code_hash 2023-02-26 13:40:16 -06:00
Nathaniel f78cbaa22d Ref #88: Implement wrapper for get_code_hash 2023-02-26 13:40:16 -06:00
Dmytro Sydorchenko cf2f1e9b3b build fix 2023-02-25 10:12:37 -05:00
Dmytro Sydorchenko caab530867 boost removed from eosiolib and native library 2023-02-24 22:04:57 -05:00
Lin Huang fb549b6cc3 Merge pull request #91 from AntelopeIO/crypto_ext_doc
add a new document explaining crypto extensions
2023-02-16 09:43:11 -05:00
dimas1185 950e7415a6 Merge pull request #94 from AntelopeIO/antler-run-base
Empty antler-run with eos-vm and eosiolib linked
2023-02-13 14:42:35 -05:00
YaroShkvorets 12c33d23fe fix test 2023-02-12 00:28:38 -05:00
Yaro Shkvorets b69b408df6 Fix division operator error 2023-02-11 15:58:17 -05:00
Dmytro Sydorchenko d1d41aa5f7 support of longjmp frpm shared object 2023-02-10 20:01:12 -05:00
Dmytro Sydorchenko ea20dd01ce reverting exceptions to jumps 2023-02-10 19:25:54 -05:00
Dmytro Sydorchenko 0a53b4a263 native library support of shared object 2023-02-09 16:52:01 -05:00
Dmytro Sydorchenko 23659dce80 native library shared object support 2023-02-09 16:22:37 -05:00
Dmytro Sydorchenko 226f497563 #94 concerns addressed 2023-02-03 13:45:49 -05:00
Dmytro Sydorchenko c47cb0f884 Revert "gcc 7 build fix"
This reverts commit f926d59c47.
2023-01-26 13:09:01 -05:00
Dmytro Sydorchenko 4c7d1bea9a eos-vm submodule ssh -> https for build server 2023-01-26 12:53:28 -05:00
Dmytro Sydorchenko 0c2e01dd6a update gcc for ubuntu 18 2023-01-25 17:45:38 -05:00
Dmytro Sydorchenko f926d59c47 gcc 7 build fix 2023-01-24 20:36:46 -05:00
Dmytro Sydorchenko 204b16eb7b fix ubuntu 18 build 2023-01-24 19:47:49 -05:00
Dmytro Sydorchenko 90506ff790 fix ubuntu 18 & 20 build 2023-01-24 18:56:51 -05:00
Dmytro Sydorchenko b7a0f32424 fixing ubuntu 18 & 20 builds 2023-01-24 18:47:49 -05:00
Dmytro Sydorchenko 37f7e3659d fix ubuntu 18 & 20 build 2023-01-24 17:28:50 -05:00
Dmytro Sydorchenko e7bc222c14 empty antler-run with eos-vm and eosiolib linked 2023-01-24 15:32:05 -05:00
dimas1185 a59ad639ba Merge pull request #87 from AntelopeIO/add-shared-object
add shared object option to CDTMacros
2023-01-23 18:04:45 -05:00
Dmytro Sydorchenko 18d575b43f removed duplication of rope_tests and policy to suppress this error 2023-01-23 16:43:46 -05:00
Lin Huang 5e6101d76d minor format corrections 2022-12-28 16:27:30 -05:00
Lin Huang fbded53d2c add a new document explaining new crypto extensions 2022-12-28 15:20:18 -05:00
Dmytro Sydorchenko 4d0173410a cdt-ld shared-object support added 2022-12-15 18:21:53 -05:00
Dmytro Sydorchenko 7efd2580d1 added shared object option to CDTMacros 2022-12-14 20:12:11 -05:00
dimas1185 ea6d926c3d Merge pull request #72 from AntelopeIO/integration-tests-fix
Enable integration tests
2022-11-18 20:18:49 -05:00
Dmytro Sydorchenko 912c7aecf4 enable integration tests 2022-11-18 20:10:28 -05:00
mikelik c010d6fae2 Merge pull request #59 from AntelopeIO/mikelik/debug_fix
Add possibility to build CDT in debug mode
2022-11-10 14:13:57 +01:00
mikelik 7444ccba96 Merge pull request #54 from AntelopeIO/output_stream_overflow
Replaced char array in output_stream to std::string to avoid buffer overflow
2022-11-09 16:24:47 +01:00
Michal Lesiak bb3f98593c Adressed code review.
Added unit test for get and push.
2022-11-09 11:45:11 +01:00
Michal Lesiak 463575dfc8 Change char array to string in output_stream to add possibility to extend buffer. 2022-11-09 08:50:44 +01:00
Michal Lesiak a4fc1ad89a Add overflow check to output_stream. Buffer in output_stream (std_out and std_err) is capped at 2048.
Trying to add more data to output_stream will be silently ignored.
Add unit tests for overflow.
2022-11-09 08:50:44 +01:00
Michal Lesiak 09c2ecad04 Do not change CMAKE_BUILD_TYPE if provided, which allows to build project in Debug mode. Only LLVM is needed in Release - otherwise unit tests are failing because of assertion failure. 2022-11-08 14:58:44 +01:00
Lin Huang 796bde2dfa Merge pull request #58 from AntelopeIO/merge_3_1_rc1_version_bump_to_main
[3.1->main] Merge 3.1.0 rc1 version bump to main
2022-11-07 16:18:06 -05:00
Lin Huang 7b241e846b Restore main version number to 3.2.0-dev 2022-11-07 16:01:37 -05:00
159 changed files with 11009 additions and 887 deletions
+6
View File
@@ -0,0 +1,6 @@
{
"antelope-spring-dev":{
"target":"release/2.0",
"prerelease":false
}
}
-11
View File
@@ -1,11 +0,0 @@
{
"ubuntu18": {
"dockerfile": ".cicd/platforms/ubuntu18.Dockerfile"
},
"ubuntu20": {
"dockerfile": ".cicd/platforms/ubuntu20.Dockerfile"
},
"ubuntu22": {
"dockerfile": ".cicd/platforms/ubuntu22.Dockerfile"
}
}
-18
View File
@@ -1,18 +0,0 @@
FROM ubuntu:bionic
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
curl \
ninja-build \
software-properties-common \
zlib1g-dev
RUN add-apt-repository ppa:git-core/ppa && apt update && apt install -y git
RUN curl -L https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz | tar zx && \
cd Python* && \
./configure --enable-optimizations --prefix=/usr && \
make -j$(nproc) install && \
cd .. && \
rm -rf Python*
+4 -1
View File
@@ -5,4 +5,7 @@ RUN apt-get update && apt-get upgrade -y && \
cmake \
git \
ninja-build \
python3
python3 \
pkg-config \
libboost-all-dev \
libcurl4-gnutls-dev
+23
View File
@@ -0,0 +1,23 @@
FROM ubuntu:jammy
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
wget \
git \
ninja-build \
python3 \
pkg-config \
libboost-all-dev \
libcurl4-gnutls-dev \
lsb-release \
software-properties-common \
gnupg \
clang-tidy
RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 16
ENV CC=clang-16
ENV CXX=clang++-16
+5 -1
View File
@@ -5,4 +5,8 @@ RUN apt-get update && apt-get upgrade -y && \
cmake \
git \
ninja-build \
python3
python3 \
pkg-config \
libboost-all-dev \
libcurl4-gnutls-dev \
clang-tidy
+12
View File
@@ -0,0 +1,12 @@
FROM ubuntu:noble
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
git \
ninja-build \
python3 \
pkg-config \
libboost-all-dev \
libcurl4-gnutls-dev \
clang-tidy
+69 -45
View File
@@ -7,6 +7,17 @@ on:
- "release/*"
pull_request:
workflow_dispatch:
inputs:
override-antelope-spring-dev:
description: Override antelope-spring-dev target
type: string
override-antelope-spring-dev-prerelease:
type: choice
description: Override antelope-spring-dev prelease
options:
- default
- true
- false
permissions:
packages: write
@@ -17,72 +28,85 @@ defaults:
shell: bash
jobs:
d:
name: Discover Platforms
platform-cache:
name: Platform Cache
uses: AntelopeIO/platform-cache-workflow/.github/workflows/platformcache.yaml@v1
permissions:
packages: write
contents: read
with:
runs-on: '["self-hosted", "enf-x86-beefy"]'
platform-files: .cicd/platforms
versions:
name: Determine Versions
runs-on: ubuntu-latest
outputs:
missing-platforms: ${{steps.discover.outputs.missing-platforms}}
p: ${{steps.discover.outputs.platforms}}
antelope-spring-dev-target: ${{steps.versions.outputs.antelope-spring-dev-target}}
antelope-spring-dev-prerelease: ${{steps.versions.outputs.antelope-spring-dev-prerelease}}
steps:
- name: Discover Platforms
id: discover
uses: AntelopeIO/discover-platforms-action@v1
with:
platform-file: .cicd/platforms.json
password: ${{secrets.GITHUB_TOKEN}}
package-name: builders
build-platforms:
name: Build Platforms
needs: d
if: needs.d.outputs.missing-platforms != '[]'
strategy:
fail-fast: false
matrix:
platform: ${{fromJSON(needs.d.outputs.missing-platforms)}}
runs-on: ["self-hosted", "enf-x86-beefy"]
steps:
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}}
- name: Setup versions from input or defaults
id: versions
env:
GH_TOKEN: ${{github.token}}
run: |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url))
echo antelope-spring-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".target') >> $GITHUB_OUTPUT
echo antelope-spring-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".prerelease') >> $GITHUB_OUTPUT
if [[ "${{inputs.override-antelope-spring-dev}}" != "" ]]; then
echo antelope-spring-dev-target=${{inputs.override-antelope-spring-dev}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-antelope-spring-dev-prerelease}}" == +(true|false) ]]; then
echo antelope-spring-dev-prerelease=${{inputs.override-antelope-spring-dev-prerelease}} >> $GITHUB_OUTPUT
fi
Build:
name: Build & Test
needs: [d, build-platforms]
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped')
needs: [platform-cache, versions]
strategy:
fail-fast: false
matrix:
platform: [ubuntu18, ubuntu20, ubuntu22]
platform: [ubuntu20, ubuntu22, ubuntu22-llvm, ubuntu24]
runs-on: ["self-hosted", "enf-x86-beefy"]
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download antelope-spring-dev.deb (Ubuntu 22 only)
if: matrix.platform == 'ubuntu22'
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: spring
file: 'antelope-spring-dev.*ubuntu22\.04_amd64.deb'
target: '${{needs.versions.outputs.antelope-spring-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.antelope-spring-dev-prerelease)}}
artifact-name: antelope-spring-dev-ubuntu22-amd64
container-package: antelope-spring-experimental-binaries
- name: Install antelope-spring-dev.deb (Ubuntu 22 only)
if: matrix.platform == 'ubuntu22'
run: |
apt-get update && apt-get upgrade -y
apt install -y ./antelope-spring-dev*.deb
rm ./antelope-spring-dev*.deb
- name: Build & Test
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
ninja
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(nproc)
cd tests
ctest -j $(nproc) --output-on-failure
- name: Package (Ubuntu 18 only)
if: matrix.platform == 'ubuntu18'
- name: Package (Ubuntu 20 only)
if: matrix.platform == 'ubuntu20'
run: |
cd build/packages
bash generate_package.sh deb ubuntu amd64
- name: Upload (Ubuntu 18 only)
if: matrix.platform == 'ubuntu18'
uses: actions/upload-artifact@v3
- name: Upload (Ubuntu 20 only)
if: matrix.platform == 'ubuntu20'
uses: actions/upload-artifact@v4
with:
name: cdt_ubuntu_package_amd64
path: build/packages/cdt*amd64.deb
+33
View File
@@ -0,0 +1,33 @@
name: Upload Release .deb
on:
release:
types: [published]
jobs:
eb:
name: Upload Release .deb
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
actions: read
steps:
- name: Get cdt.deb
id: getter
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}}
file: cdt_.*_amd64.deb
target: ${{github.sha}}
artifact-name: cdt_ubuntu_package_amd64
wait-for-exact-target: true
- run: |
curl -LsSf \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{github.token}}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
--data-binary "@${{steps.getter.outputs.downloaded-file}}" \
"https://uploads.github.com/repos/${{github.repository}}/releases/${{github.event.release.id}}/assets?name=${{steps.getter.outputs.downloaded-file}}"
+2 -1
View File
@@ -35,7 +35,7 @@
.DS_Store
# Build
build/*
[Bb]uild*/
cmake-build-debug/
examples/multi_index_example/build
examples/hello/build
@@ -49,3 +49,4 @@ __pycache__/
*.vim
.idea/
.ccls-cache/
CMakeLists.txt.user
+8 -4
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.5...4.0)
# Sanity check our source directory to make sure that we are not trying to
# generate an in-source build, and to make
@@ -13,10 +13,10 @@ endif()
project(cdt)
set(VERSION_MAJOR 3)
set(VERSION_MINOR 1)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION_SUFFIX "")
set(VERSION_SUFFIX "dev1")
if (VERSION_SUFFIX)
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
@@ -31,6 +31,10 @@ option(ENABLE_TESTS "enable building tests" ON)
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if(NOT TOOLS_BUILD_TYPE)
set(TOOLS_BUILD_TYPE "Release")
endif()
+18 -10
View File
@@ -15,8 +15,8 @@ CDT currently supports Linux x86_64 Debian packages. Visit the [release page](ht
Download the appropriate version of the Debian package and then install it. To download and install the latest version, run the following:
```sh
wget https://github.com/AntelopeIO/cdt/releases/download/v3.1.0/cdt_3.1.0-amd64.deb
sudo apt install ./cdt_3.1.0-amd64.deb
wget https://github.com/AntelopeIO/cdt/releases/download/v4.1.0/cdt_4.1.0_amd64.deb
sudo apt install ./cdt_4.1.0_amd64.deb
```
### Debian package uninstall
@@ -28,9 +28,9 @@ sudo apt remove cdt
## Building from source
Recent Ubuntu LTS releases are the only Linux distributions that we fully support. Other Linux distros and other POSIX operating systems (such as macOS) are tended to on a best-effort basis and may not be full featured.
Recent Ubuntu LTS releases are the only Linux distributions that we fully support. Other Linux distros and other POSIX operating systems (such as macOS) are tended to on a best-effort basis and may not be full featured.
The instructions below assume that you are building on Ubuntu 20.04.
The instructions below assume that you are building on Ubuntu 20.04.
### Install dependencies
@@ -38,6 +38,7 @@ The instructions below assume that you are building on Ubuntu 20.04.
apt-get update && apt-get install \
build-essential \
clang \
clang-tidy \
cmake \
git \
libxml2-dev \
@@ -53,19 +54,19 @@ python3 -m pip install pygments
### Allowing integration tests to build
Integration tests require access to a build of [Leap](https://github.com/AntelopeIO/leap), a C++ implementation of the Antelope protocol. Simply installing Leap from a binary package will not be sufficient.
Integration tests require access to a build of [Spring](https://github.com/AntelopeIO/spring), a C++ implementation of the Antelope protocol. Simply installing Spring from a binary package will not be sufficient.
If you do not wish to build Leap, you can continue with building CDT but without building the integration tests. Otherwise, follow the instructions below before running `cmake`.
If you do not wish to build Spring, you can continue with building CDT but without building the integration tests. Otherwise, follow the instructions below before running `cmake`.
First, ensure that Leap has been built from source (see Leap's [README](https://github.com/AntelopeIO/leap#building-from-source) for details) and identify the build path, e.g. `/path/to/leap/build/`.
First, ensure that Spring has been built from source (see Spring's [README](https://github.com/AntelopeIO/spring#building-from-source) for details) and identify the build path, e.g. `/path/to/spring/build/`.
Then, execute the following command in the same terminal session that you will use to build CDT:
```sh
export leap_DIR=/path/to/leap/build/lib/cmake/leap
export spring_DIR=/path/to/spring/build/lib/cmake/spring
```
Now you can continue with the steps to build CDT as described. When you run `cmake` make sure that it does not report `leap package not found`. If it does, this means CDT was not able to find a build of Leap at the specified path in `leap_DIR` and will therefore continue without building the integration tests.
Now you can continue with the steps to build CDT as described. When you run `cmake` make sure that it does not report `spring package not found`. If it does, this means CDT was not able to find a build of Spring at the specified path in `spring_DIR` and will therefore continue without building the integration tests.
### ccache
@@ -92,6 +93,13 @@ The binaries will be located at in the `build/bin` directory. You can export the
If you would prefer to install CDT globally, see the section [Install CDT](#install-cdt) below.
#### Build CDT in debug mode
To build CDT in debug mode (with debug symbols) you need to add the following flags to cmake command:
```sh
cmake -DCMAKE_BUILD_TYPE="Debug" -DTOOLS_BUILD_TYPE="Debug" -DLIBS_BUILD_TYPE="Debug" ..
```
### Run tests
#### Run unit tests
@@ -128,7 +136,7 @@ Installing CDT globally on your system will install the following tools in a loc
* cdt-strip
* eosio-pp
* eosio-wasm2wast
* eosio-wast2wasm
* eosio-wast2wasm
It will also install CMake files for CDT accessible within a `cmake/cdt` directory located within your system's `lib` directory.
#### Manual installation
+1 -1
View File
@@ -47,7 +47,7 @@ compiler options:
-finline-hint-functions - Inline functions which are (explicitly or implicitly) marked inline
-fmerge-all-constants - Allow merging of constants
-fnative - Compile and link for x86-64
-fno-cfl-aa - Disable CFL Alias Analysis
-fcfl-aa - Enable CFL Alias Analysis
-fno-elide-constructors - Disable C++ copy constructor elision
-fno-lto - Disable LTO
-fno-post-pass - Don't run post processing pass
+1 -1
View File
@@ -49,7 +49,7 @@ compiler options:
-finline-hint-functions - Inline functions which are (explicitly or implicitly) marked inline
-fmerge-all-constants - Allow merging of constants
-fnative - Compile and link for x86-64
-fno-cfl-aa - Disable CFL Alias Analysis
-cfl-aa - Enable CFL Alias Analysis
-fno-elide-constructors - Disable C++ copy constructor elision
-fno-lto - Disable LTO
-fno-post-pass - Don't run post processing pass
+1 -1
View File
@@ -21,7 +21,7 @@ ld options:
-L=<string> - Add directory to library search path
-fasm - Assemble file for x86-64
-fnative - Compile and link for x86-64
-fno-cfl-aa - Disable CFL Alias Analysis
-fcfl-aa - Enable CFL Alias Analysis
-fno-lto - Disable LTO
-fno-post-pass - Don't run post processing pass
-fno-stack-first - Don't set the stack first in memory
+194
View File
@@ -0,0 +1,194 @@
---
content_title: Crypto Extensions API
---
Antelope blockchain implements cryptographic functions for operations on points on elliptic curves, computing hashes
of big integers, big integer modular exponentiation, and other operations useful for implementing
cryptographic algorithms in your contracts.
In order to use the Crypto Extensions API you need to activate a protocol feature `CRYPTO_PRIMITIVES`
in `nodeos`. To do this you should call the following command in your command line:
`"cleos push action eosio activate ["6bcb40a24e49c26d0a60513b6aeb8551d264e4717f306b81a37a5afb3b47cedc"] -p eosio@active"`
And you need to include in the source code of your contract the following header: [crypto_ext.hpp](https://github.com/AntelopeIO/cdt/blob/main/libraries/eosiolib/core/eosio/crypto_ext.hpp)
The header declares following basic plain C functions which implement the core functionality:
## Plain C API
- `int32_t alt_bn128_add( const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* result, uint32_t result_len )`
Perform addition operation on the elliptic curve `alt_bn128`, store the result in `result`, and return `0` if success otherwise `-1`
- `int32_t alt_bn128_mul( const char* g1, uint32_t g1_len, const char* scalar, uint32_t scalar_len, char* result, uint32_t result_len )`
Perform scalar multiplication operation on the elliptic curve `alt_bn128`
- `int32_t alt_bn128_pair( const char* pairs, uint32_t pairs_len )`
Perform Optimal-Ate pairing check elliptic curve `alt_bn128`, and return `0` if `true` and successful, `1` if `false`, otherwise `-1`
- `int32_t mod_exp( const char* base, uint32_t base_len, const char* exp, uint32_t exp_len, const char* mod, uint32_t mod_len, char* result, uint32_t result_len )`
Calculate `( BASE^EXP ) % MOD`, store in `result`, and return `0` if successful, otherwise `-1`
- `int32_t blake2_f( uint32_t rounds, const char* state, uint32_t state_len, const char* msg, uint32_t msg_len, const char* t0_offset, uint32_t t0_len, const char* t1_offset, uint32_t t1_len, int32_t final, char* result, uint32_t result_len)`
Implement BLAKE2 compression function `F`. Return `0` if success otherwise `-1`
- `eosio::checksum256 sha3(const char* data, uint32_t length)`
Return hash of `data` using `SHA3 NIST`
- `void assert_sha3(const char* data, uint32_t length, const eosio::checksum256& hash)`
Test if the SHA3 hash generated from data matches the provided digest
- `eosio::checksum256 keccak(const char* data, uint32_t length)`
Return hash of `data` using `SHA3 Keccak`
- `void assert_keccak(const char* data, uint32_t length, const eosio::checksum256& hash)
Test if the SHA3 keccak hash generated from data matches the provided digest
- `int32_t k1_recover( const char* sig, uint32_t sig_len, const char* dig, uint32_t dig_len, char* pub, uint32_t pub_len )`
Calculates the uncompressed public key used for a given signature on a given digest. Return `0` if success otherwise `-1`
Also, the header contains a set of handy C++ wrappers to simplify the contracts code.
## C++ API
`ec_point` type was added to represent `G1` and `G2` points on the elliptic curve.
`ec_point_view` type was added to provide a read-only interface for access to `G1` and `G2` points data.
### Data Types
```c++
// Abstracts mutable G1 and G2 points
template <std::size_t Size = 32>
struct ec_point {
std::vector<char> x; // x coordinate
std::vector<char> y; // y coordinate
// Construct from two coordinates represented by big integers
ec_point(std::vector<char>& x_, std::vector<char>& y_);
// Construct from a serialized point
ec_point(std::vector<char>& p);
// Return a serialized point containing only x and y
std::vector<char> serialized() const;
};
// Abstracts read-only G1 and G2 points
template <std::size_t Size = 32>
struct ec_point_view {
const char* x;
const char* y;
// Number of bytes in each of x and y
uint32_t size;
// Construct from two coordinates. Their sizes must be equal
ec_point_view(const char* x_, uint32_t x_size, const char* y_, uint32_t y_size);
// Construct from a serialized point
ec_point_view(const std::vector<char>& p);
// Construct a point view from a point
ec_point_view(const ec_point<Size>& p);
// Return serialized point containing only x and y
std::vector<char> serialized() const;
};
// Big integer.
using bigint = std::vector<char>;
```
### Methods
- Addition operation on the elliptic curve `alt_bn128`
```c++
template <typename T>
g1_point alt_bn128_add( const T& op1, const T& op2 )
```
- Scalar multiplication operation on the elliptic curve `alt_bn128`
```c++
template <typename T>
g1_point alt_bn128_mul( const T& g1, const bigint& scalar)
```
- Optimal-Ate pairing check elliptic curve `alt_bn128`
```c++
template <typename G1_T, typename G2_T>
int32_t alt_bn128_pair( const std::vector<std::pair<G1_T, G2_T>>& pairs )
```
- Big integer modular exponentiation returns `( BASE^EXP ) % MOD`
```c++
int32_t mod_exp( const bigint& base, const bigint& exp, const bigint& mod, bigint& result )
```
Please take a look into a [crypto_ext.hpp](https://github.com/AntelopeIO/cdt/blob/main/libraries/eosiolib/core/eosio/crypto_ext.hpp)
header file, it contains more wrappers and helper functions which may be useful in your code.
### Examples
- `alt_bn128_add`
```c++
std::vector<char> x1, y1, x2, y2; // Declare coordinates for points on an elliptic curve
// Create the points on the curve
eosio::g1_point point1 {x1, y1};
eosio::g1_point point2 {x2, y2};
// Add two points and get a third point on the curve as result
auto result = eosio::alt_bn128_add(point1, point2);
// Do the same addition but with g1_point_view data types
eosio::g1_point_view point_view1 {x1.data(), x1.size(), y1.data(), y1.size()};
eosio::g1_point_view point_view2 {x2.data(), x2.size(), y2.data(), y2.size()};
result = eosio::alt_bn128_add(point_view1, point_view2);
```
- `alt_bn128_mul`
```c++
// Declare coordinates for a point on an elliptic curve and a big integer
std::vector<char> x, y, scalar;
eosio::bigint s {scalar};
// Create the point object with given coordinates
eosio::g1_point g1_point {x, y};
// Multiply the point with a big integer and get a point on the curve as result
auto result = eosio::alt_bn128_mul(g1_point, s);
// Do the same multiplication but with g1_point_view data type
eosio::g1_point_view g1_view {x.data(), x.size(), y.data(), y.size()};
result = eosio::alt_bn128_mul(g1_view, s);
```
- `alt_bn128_pair`
```c++
// Declare coordinates for the pairs of points on an elliptic curve
std::vector<char> g1_a_x, g1_a_y, g2_a_x, g2_a_y, g1_b_x, g1_b_y, g2_b_x, g2_b_y;
// Create the point object by given coordinates
// First pair
eosio::g1_point g1_a {g1_a_x, g1_a_y};
eosio::g2_point g2_a {g2_a_x, g2_a_y};
// Second pair
eosio::g1_point g1_b {g1_b_x, g1_b_y};
eosio::g2_point g2_b {g2_b_x, g2_b_y};
// Create the pairs object
std::vector<std::pair<eosio::g1_point, eosio::g2_point>> pairs { {g1_a, g2_a}, {g1_b, g2_b} };
// Perform the pairing check
// Return:
// -1 if there is an error
// 1 if the points not in a target group
// 0 if the points in a target group
auto result = eosio::alt_bn128_pair(pairs);
// Do the same pairing check but with g1_point_view and g2_point_view data types
eosio::g1_point_view g1_view_a {g1_a_x.data(), g1_a_x.size(), g1_a_y.data(), g1_a_y.size()};
eosio::g2_point_view g2_view_a {g2_a_x.data(), g2_a_x.size(), g2_a_y.data(), g2_a_y.size()};
eosio::g1_point_view g1_view_b {g1_b_x.data(), g1_b_x.size(), g1_b_y.data(), g1_b_y.size()};
eosio::g2_point_view g2_view_b {g2_b_x.data(), g2_b_x.size(), g2_b_y.data(), g2_b_y.size()};
std::vector<std::pair<eosio::g1_point_view, eosio::g2_point_view>> view_pairs { {g1_a, g2_a}, {g1_b, g2_b} };
result = eosio::alt_bn128_pair(view_pairs);
```
- `mod_exp`
```c++
// Declare big integer variables for the base, the exponent and the modulo
std::vector<char> base, exp, modulo;
eosio::bigint base_val {base};
eosio::bigint exp_val {exp};
eosio::bigint modulo_val {modulo};
// Declare and init a big integer variable for the result of exponentiation
eosio::bigint result( modulo.size(), '\0' );
// Perform the exponentiation
// return -1 if there is an error otherwise 0
auto rc = eosio::mod_exp(base_val, exp_val, modulo_val, result);
```
@@ -35,7 +35,7 @@ Start with an empty ABI, for exemplification we will work based on the `eosio.to
An ABI enables any client or interface to interpret and even generate a GUI for your contract. For this to work consistently, describe the custom types that are used as a parameter in any public action or struct that needs to be described in the ABI.
[[info | Built-in Types]]
| Antelope implements a number of custom built-ins. Built-in types don't need to be described in an ABI file. If you would like to familiarize yourself with Antelope's built-ins, they are defined [here](https://github.com/AntelopeIO/leap/blob/6817911900a088c60f91563995cf482d6b380b2d/libraries/chain/abi_serializer.cpp#L88-L129)
| Antelope implements a number of custom built-ins. Built-in types don't need to be described in an ABI file. If you would like to familiarize yourself with Antelope's built-ins, they are defined [here](https://github.com/AntelopeIO/spring/blob/5a3550a6fec4c1865e8aca07aa97693f720afe72/libraries/chain/abi_serializer.cpp#L92-L130)
```json
+36
View File
@@ -165,3 +165,39 @@ assertion failure with message: system contract must first be initialized
The failure is stating that `eosio.system` `init` action was not called yet. The `init` action is implemented by the `void init(uint64_t, symbol)` function. The first parameter is the version, this should always be `0` for now, until a new version of `init` will be created that handles more information.
The second parameter is the system's symbol (i.e. for main net this is `EOS`). If you followed the [BIOS Boot Sequence](https://docs.eosnetwork.com/docs/latest/tutorials/bios-boot-sequence) tutorial and created a system with the default symbol `SYS` then `SYS` shall be used as the system's symbol in the `init` action. It is whatever symbol you as the chain creator want to use in your `Antelope` based blockchain.
## Backward incompatible change in generating abi for maps
In CDT version 3.0.1, there has been breaking ABI change in std::map. The change is as follows:
Old Version (CDT 3.0.0 or earlier):
```
"fields": [
{
"name": "key",
"type": "<map first type>"
},
{
"name": "value",
"type": "<map second type>"
}
]
```
New Version (CDT 3.0.1 and above):
```
"fields": [
{
"name": "first",
"type": "<map first type>"
},
{
"name": "second",
"type": "<map second type>"
}
]
```
As a result, if you are using code based on CDT 3.0.0 or earlier, you may encounter errors when upgrading to CDT 3.0.1 and above.
An example error message could be: `Error: missing pair_uint64_bytes.first (type=uint64)`.
To resolve this issue, you need to update your code to use `first` and `second` to access the elements of `std::map`, instead of the old `key` and `value` identifiers.
+1 -1
View File
@@ -35,7 +35,7 @@ An ABI enables any client or interface to interpret and even generate an GUI for
[[info]]
|Built-in Types
Antelope implements a number of custom built-ins. Built-in types don't need to be described in an ABI file. If you would like to familiarize yourself with Antelope's built-ins, they are defined [here](https://github.com/AntelopeIO/leap/blob/6817911900a088c60f91563995cf482d6b380b2d/libraries/chain/abi_serializer.cpp#L88-L129).
Antelope implements a number of custom built-ins. Built-in types don't need to be described in an ABI file. If you would like to familiarize yourself with Antelope's built-ins, they are defined [here](https://github.com/AntelopeIO/spring/blob/5a3550a6fec4c1865e8aca07aa97693f720afe72/libraries/chain/abi_serializer.cpp#L92-L130).
Using **eosio.token** as an example, the only type that requires a description in the ABI file is `account_name`. The ABI uses "new_type_name" to describe explicit types, in this case `account_name`, and `account_name` is an alias of `name` type.
+1 -1
View File
@@ -10,4 +10,4 @@ If you are upgrading to CDT version 3.0 or later from version 1.8.1 (or earlier)
## License
[MIT](https://github.com/AntelopeIO/cdt/blob/release/3.1/LICENSE)
[MIT](https://github.com/AntelopeIO/cdt/blob/main/LICENSE)
+22
View File
@@ -0,0 +1,22 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "CDT\-ABIDIFF" "1" "April 18 2023" "AntelopeIO" "Contract Development Toolkit (CDT)"
.hy
.SH NAME
.PP
cdt\-abidiff \- A tool for comparison of two CDT ABI files.
.SH SYNOPSIS
.PP
\f[C]cdt\-abidiff <file1.abi> <file2.abi>\f[R]
.SH DESCRIPTION
.PP
\f[B]cdt\-abidiff\f[R] To report differences with cdt\-abidiff, you only
need to pass the two ABI file names as command line arguments.
.SH BUGS
.PP
Please submit bug reports online at
https://github.com/AntelopeIO/cdt/issues
.SH SEE ALSO
.PP
For more details consult the full documentation and sources
https://github.com/AntelopeIO/cdt
+26
View File
@@ -0,0 +1,26 @@
---
title: CDT-ABIDIFF
section: 1
header: Contract Development Toolkit (CDT)
footer: AntelopeIO
date: April 18 2023
---
# NAME
cdt-abidiff - A tool for comparison of two CDT ABI files.
# SYNOPSIS
`cdt-abidiff <file1.abi> <file2.abi>`
# DESCRIPTION
**cdt-abidiff** To report differences with cdt-abidiff, you only need to pass the two ABI file names as command line arguments.
# BUGS
Please submit bug reports online at https://github.com/AntelopeIO/cdt/issues
# SEE ALSO
For more details consult the full documentation and sources https://github.com/AntelopeIO/cdt
+676
View File
@@ -0,0 +1,676 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "CDT\-CC" "1" "April 14, 2023" "AntelopeIO" "Contract Development Toolkit (CDT)"
.hy
.SH NAME
.PP
cdt\-cc \- Antelope smart contract C to WebAssembly compiler
.SH SYNOPSIS
.PP
\f[C]cdt\-cc [options] <input file>\f[R]
.SH DESCRIPTION
.PP
\f[B]cdt\-cc\f[R] Is a C compiler which converts C smart contract code
to WebAssemply for execution in Antelope block chain virtual machines.
.SH OPTIONS
.PP
\f[B]\f[CB]\-C\f[B]\f[R]
.IP
.nf
\f[C]
Include comments in preprocessed output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-CC\f[B]\f[R]
.IP
.nf
\f[C]
Include comments from within macros in preprocessed output
\f[R]
.fi
.PP
\f[B]\f[CB]\-D=<name definition>\f[B]\f[R]
.IP
.nf
\f[C]
Define <macro> to <value> (or 1 if <value> omitted)
\f[R]
.fi
.PP
\f[B]\f[CB]\-U=<name>\f[B]\f[R]
.IP
.nf
\f[C]
Undefine any previous definition of name, either built in or defined with a \-D option
\f[R]
.fi
.PP
\f[B]\f[CB]\-E\f[B]\f[R]
.IP
.nf
\f[C]
Only run the preprocessor
\f[R]
.fi
.PP
\f[B]\f[CB]\-I=<dir>\f[B]\f[R]
.IP
.nf
\f[C]
Add directory to include search path
\f[R]
.fi
.PP
\f[B]\f[CB]\-L=<dir>\f[B]\f[R]
.IP
.nf
\f[C]
Add directory to library search path
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MF=<file>\f[B]\f[R]
.IP
.nf
\f[C]
Write depfile output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MD\f[B]\f[R]
.IP
.nf
\f[C]
Write depfile containing user and system headers
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MMD\f[B]\f[R]
.IP
.nf
\f[C]
Like \-MD except mention only user header files, not system header files.
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MT=<target>\f[B]\f[R]
.IP
.nf
\f[C]
Specify name of main file output in depfile
\f[R]
.fi
.PP
\f[B]\f[CB]\-O=<optimization_level>\f[B]\f[R]
.IP
.nf
\f[C]
Optimization level s, 0\-3
\f[R]
.fi
.PP
\f[B]\f[CB]\-R=<dir>\f[B]\f[R]
.IP
.nf
\f[C]
Add the directory dir to the list of directories to be searched for resource files
\f[R]
.fi
.PP
\f[B]\f[CB]\-S\f[B]\f[R]
.IP
.nf
\f[C]
Only run preprocess and compilation steps
\f[R]
.fi
.PP
\f[B]\f[CB]\-W=<warning_name>\f[B]\f[R]
.IP
.nf
\f[C]
Enable the specified warning.
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-abi\-version=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Which ABI version to generate
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-abigen\f[B]\f[R]
.IP
.nf
\f[C]
Generate ABI
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-abigen_output=<string>\f[B]\f[R]
.IP
.nf
\f[C]
ABIGEN output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-allow\-names\f[B]\f[R]
.IP
.nf
\f[C]
Allow creation of name section
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-allow\-sse\f[B]\f[R]
.IP
.nf
\f[C]
Should not be used, except for build libc
\f[R]
.fi
.PP
\f[B]\f[CB]\-c\f[B]\f[R]
.IP
.nf
\f[C]
Only run preprocess, compile, and assemble steps
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-contract=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Contract name
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-dD\f[B]\f[R]
.IP
.nf
\f[C]
Print macro definitions in \-E mode in addition to normal output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-dI\f[B]\f[R]
.IP
.nf
\f[C]
Print include directives in \-E mode in addition to normal output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-dM\f[B]\f[R]
.IP
.nf
\f[C]
Print macro definitions in \-E mode instead to normal output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-disable\-symbolication\f[B]\f[R]
.IP
.nf
\f[C]
Disable symbolizing crash backtraces.
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-emit\-ast\f[B]\f[R]
.IP
.nf
\f[C]
Emit Clang AST files for source inputs
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-emit\-ir\f[B]\f[R]
.IP
.nf
\f[C]
Emit llvm ir
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-emit\-llvm\f[B]\f[R]
.IP
.nf
\f[C]
Use the LLVM representation for assembler and object files
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-eosio\-pp\-dir=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the directory for eosio\-pp
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fPIC\f[B]\f[R]
.IP
.nf
\f[C]
Generate position independent code. This option is used for shared libraries
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fasm\f[B]\f[R]
.IP
.nf
\f[C]
Assemble file for x86\-64
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fcolor\-diagnostics\f[B]\f[R]
.IP
.nf
\f[C]
Use colors in diagnostics
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-finline\-functions\f[B]\f[R]
.IP
.nf
\f[C]
Inline suitable functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-finline\-hint\-functions\f[B]\f[R]
.IP
.nf
\f[C]
Inline functions which are (explicitly or implicitly) marked inline
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fmerge\-all\-constants\f[B]\f[R]
.IP
.nf
\f[C]
Allow merging of constants
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fnative\f[B]\f[R]
.IP
.nf
\f[C]
Compile and link for x86\-64
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-cfl\-aa\f[B]\f[R]
.IP
.nf
\f[C]
Disable CFL Alias Analysis
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-elide\-constructors\f[B]\f[R]
.IP
.nf
\f[C]
Disable C++ copy constructor elision
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-lto\f[B]\f[R]
.IP
.nf
\f[C]
Disable LTO
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-post\-pass\f[B]\f[R]
.IP
.nf
\f[C]
Don\[aq]t run post processing pass
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-stack\-first\f[B]\f[R]
.IP
.nf
\f[C]
Don\[aq]t set the stack first in memory
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\-client\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\-server\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstack\-protector\f[B]\f[R]
.IP
.nf
\f[C]
Enable stack protectors for functions potentially vulnerable to stack smashing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstack\-protector\-all\f[B]\f[R]
.IP
.nf
\f[C]
Force the usage of stack protectors for all functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstack\-protector\-strong\f[B]\f[R]
.IP
.nf
\f[C]
Use a strong heuristic to apply stack protectors to functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstrict\-enums\f[B]\f[R]
.IP
.nf
\f[C]
Enable optimizations based on the strict definition of an enum\[aq]s value range
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstrict\-return\f[B]\f[R]
.IP
.nf
\f[C]
Always treat control flow paths that fall off the end of a non\-void function as unreachable
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstrict\-vtable\-pointers\f[B]\f[R]
.IP
.nf
\f[C]
Enable optimizations based on the strict rules for overwriting polymorphic C++ objects
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fuse\-main\f[B]\f[R]
.IP
.nf
\f[C]
Use main as entry
\f[R]
.fi
.PP
\f[B]\f[CB]\-h\f[B]\f[R]
.IP
.nf
\f[C]
Alias for \-\-help
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\f[B]\f[R]
.IP
.nf
\f[C]
Display available options (\-\-help\-hidden for more)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\-hidden\f[B]\f[R]
.IP
.nf
\f[C]
Display all available options
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\-list\f[B]\f[R]
.IP
.nf
\f[C]
Display list of available options (\-\-help\-list\-hidden for more)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\-list\-hidden\f[B]\f[R]
.IP
.nf
\f[C]
Display list of all available options
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-imports=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the file for cdt.imports
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-include=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Include file before parsing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-isysroot=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the system root directory (usually /)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-isystem=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Add directory to SYSTEM include search path
\f[R]
.fi
.PP
\f[B]\f[CB]\-l=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Root name of library to link
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-lto\-opt=<string>\f[B]\f[R]
.IP
.nf
\f[C]
LTO Optimization level (O0\-O3)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-mllvm=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Pass arguments to llvm
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-no\-abigen\f[B]\f[R]
.IP
.nf
\f[C]
Disable ABI file generation
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-no\-missing\-ricardian\-clause\f[B]\f[R]
.IP
.nf
\f[C]
Disable warnings for missing Ricardian clauses
\f[R]
.fi
.PP
\f[B]\f[CB]\-o=<file>\f[B]\f[R]
.IP
.nf
\f[C]
Write output to <file>
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-only\-export=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Export only this symbol
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-print\-all\-options\f[B]\f[R]
.IP
.nf
\f[C]
Print all option values after command line parsing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-print\-options\f[B]\f[R]
.IP
.nf
\f[C]
Print non\-default options after command line parsing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-shared\f[B]\f[R]
.IP
.nf
\f[C]
Make shared object native library
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stack\-canary\f[B]\f[R]
.IP
.nf
\f[C]
Stack canary for non stack first layouts
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stack\-size=<int>\f[B]\f[R]
.IP
.nf
\f[C]
Specifies the maximum stack size for the contract. Defaults to 8192 bytes
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-sysroot=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the system root directory
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-use\-freeing\-malloc\f[B]\f[R]
.IP
.nf
\f[C]
Set the malloc implementation to the old freeing malloc
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-use\-rt\f[B]\f[R]
.IP
.nf
\f[C]
Use software compiler\-rt
\f[R]
.fi
.PP
\f[B]\f[CB]\-v\f[B]\f[R]
.IP
.nf
\f[C]
Show commands to run and use verbose output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-version\f[B]\f[R]
.IP
.nf
\f[C]
Display the version of this program
\f[R]
.fi
.PP
\f[B]\f[CB]\-w\f[B]\f[R]
.IP
.nf
\f[C]
Suppress all warnings
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-warn\-action\-read\-only\f[B]\f[R]
.IP
.nf
\f[C]
Issue a warning if a read\-only action uses a write API and continue compilation
\f[R]
.fi
.SH BUGS
.PP
Please submit bug reports online at
https://github.com/AntelopeIO/cdt/issues
.SH SEE ALSO
.PP
For more details consult the full documentation and sources
https://github.com/AntelopeIO/cdt
+351
View File
@@ -0,0 +1,351 @@
---
title: CDT-CC
section: 1
header: Contract Development Toolkit (CDT)
footer: AntelopeIO
date: April 14, 2023
---
# NAME
cdt-cc - Antelope smart contract C to WebAssembly compiler
# SYNOPSIS
`cdt-cc [options] <input file>`
# DESCRIPTION
**cdt-cc** Is a C compiler which converts C smart contract code to WebAssemply for
execution in Antelope block chain virtual machines.
# OPTIONS
**`-C`**
Include comments in preprocessed output
**`--CC`**
Include comments from within macros in preprocessed output
**`-D=<name definition>`**
Define <macro> to <value> (or 1 if <value> omitted)
**`-U=<name>`**
Undefine any previous definition of name, either built in or defined with a -D option
**`-E`**
Only run the preprocessor
**`-I=<dir>`**
Add directory to include search path
**`-L=<dir>`**
Add directory to library search path
**`--MF=<file>`**
Write depfile output
**`--MD`**
Write depfile containing user and system headers
**`--MMD`**
Like -MD except mention only user header files, not system header files.
**`--MT=<target>`**
Specify name of main file output in depfile
**`-O=<optimization_level>`**
Optimization level s, 0-3
**`-R=<dir>`**
Add the directory dir to the list of directories to be searched for resource files
**`-S`**
Only run preprocess and compilation steps
**`-W=<warning_name>`**
Enable the specified warning.
**`--abi-version=<string>`**
Which ABI version to generate
**`--abigen`**
Generate ABI
**`--abigen_output=<string>`**
ABIGEN output
**`--allow-names`**
Allow creation of name section
**`--allow-sse`**
Should not be used, except for build libc
**`-c`**
Only run preprocess, compile, and assemble steps
**`--contract=<string>`**
Contract name
**`--dD`**
Print macro definitions in -E mode in addition to normal output
**`--dI`**
Print include directives in -E mode in addition to normal output
**`--dM`**
Print macro definitions in -E mode instead to normal output
**`--disable-symbolication`**
Disable symbolizing crash backtraces.
**`--emit-ast`**
Emit Clang AST files for source inputs
**`--emit-ir`**
Emit llvm ir
**`--emit-llvm`**
Use the LLVM representation for assembler and object files
**`--eosio-pp-dir=<string>`**
Set the directory for eosio-pp
**`--fPIC`**
Generate position independent code. This option is used for shared libraries
**`--fasm`**
Assemble file for x86-64
**`--fcolor-diagnostics`**
Use colors in diagnostics
**`--finline-functions`**
Inline suitable functions
**`--finline-hint-functions`**
Inline functions which are (explicitly or implicitly) marked inline
**`--fmerge-all-constants`**
Allow merging of constants
**`--fnative`**
Compile and link for x86-64
**`--fcfl-aa`**
Enable CFL Alias Analysis
**`--fno-elide-constructors`**
Disable C++ copy constructor elision
**`--fno-lto`**
Disable LTO
**`--fno-post-pass`**
Don't run post processing pass
**`--fno-stack-first`**
Don't set the stack first in memory
**`--fquery`**
Produce binaries for wasmql
**`--fquery-client`**
Produce binaries for wasmql
**`--fquery-server`**
Produce binaries for wasmql
**`--fstack-protector`**
Enable stack protectors for functions potentially vulnerable to stack smashing
**`--fstack-protector-all`**
Force the usage of stack protectors for all functions
**`--fstack-protector-strong`**
Use a strong heuristic to apply stack protectors to functions
**`--fstrict-enums`**
Enable optimizations based on the strict definition of an enum's value range
**`--fstrict-return`**
Always treat control flow paths that fall off the end of a non-void function as unreachable
**`--fstrict-vtable-pointers`**
Enable optimizations based on the strict rules for overwriting polymorphic C++ objects
**`--fuse-main`**
Use main as entry
**`-h`**
Alias for --help
**`--help`**
Display available options (--help-hidden for more)
**`--help-hidden`**
Display all available options
**`--help-list`**
Display list of available options (--help-list-hidden for more)
**`--help-list-hidden`**
Display list of all available options
**`--imports=<string>`**
Set the file for cdt.imports
**`--include=<string>`**
Include file before parsing
**`--isysroot=<string>`**
Set the system root directory (usually /)
**`--isystem=<string>`**
Add directory to SYSTEM include search path
**`-l=<string>`**
Root name of library to link
**`--lto-opt=<string>`**
LTO Optimization level (O0-O3)
**`--mllvm=<string>`**
Pass arguments to llvm
**`--no-abigen`**
Disable ABI file generation
**`--no-missing-ricardian-clause`**
Disable warnings for missing Ricardian clauses
**`-o=<file>`**
Write output to <file>
**`--only-export=<string>`**
Export only this symbol
**`--print-all-options`**
Print all option values after command line parsing
**`--print-options`**
Print non-default options after command line parsing
**`--shared`**
Make shared object native library
**`--stack-canary`**
Stack canary for non stack first layouts
**`--stack-size=<int>`**
Specifies the maximum stack size for the contract. Defaults to 8192 bytes
**`--sysroot=<string>`**
Set the system root directory
**`--use-freeing-malloc`**
Set the malloc implementation to the old freeing malloc
**`--use-rt`**
Use software compiler-rt
**`-v`**
Show commands to run and use verbose output
**`--version`**
Display the version of this program
**`-w`**
Suppress all warnings
**`--warn-action-read-only`**
Issue a warning if a read-only action uses a write API and continue compilation
# BUGS
Please submit bug reports online at https://github.com/AntelopeIO/cdt/issues
# SEE ALSO
For more details consult the full documentation and sources https://github.com/AntelopeIO/cdt
+850
View File
@@ -0,0 +1,850 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "CDT\-CPP" "1" "April 08, 2023" "AntelopeIO" "Contract Development Toolkit (CDT)"
.hy
.SH NAME
.PP
cdt\-cpp \- Antelope smart contract C++ to WebAssembly compiler
.SH SYNOPSIS
.PP
\f[C]cdt\-cpp [options] <input file>\f[R]
.SH DESCRIPTION
.PP
\f[B]cdt\-cpp\f[R] Is a C++ compiler which converts C++ smart contract
code to WebAssemply for execution in Antelope block chain virtual
machines.
.SH OPTIONS
.PP
\f[B]\f[CB]\-C\f[B]\f[R]
.IP
.nf
\f[C]
Include comments in preprocessed output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-CC\f[B]\f[R]
.IP
.nf
\f[C]
Include comments from within macros in preprocessed output
\f[R]
.fi
.PP
\f[B]\f[CB]\-D=<name definition>\f[B]\f[R]
.IP
.nf
\f[C]
Define <macro> to <value> (or 1 if <value> omitted)
\f[R]
.fi
.PP
\f[B]\f[CB]\-U=<name>\f[B]\f[R]
.IP
.nf
\f[C]
Undefine any previous definition of name, either built in or defined with a \-D option
\f[R]
.fi
.PP
\f[B]\f[CB]\-E\f[B]\f[R]
.IP
.nf
\f[C]
Only run the preprocessor
\f[R]
.fi
.PP
\f[B]\f[CB]\-I=<dir>\f[B]\f[R]
.IP
.nf
\f[C]
Add directory to include search path
\f[R]
.fi
.PP
\f[B]\f[CB]\-L=<dir>\f[B]\f[R]
.IP
.nf
\f[C]
Add directory to library search path
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MF=<file>\f[B]\f[R]
.IP
.nf
\f[C]
Write depfile output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MD\f[B]\f[R]
.IP
.nf
\f[C]
Write depfile containing user and system headers
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MMD\f[B]\f[R]
.IP
.nf
\f[C]
Like \-MD except mention only user header files, not system header files.
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-MT=<target>\f[B]\f[R]
.IP
.nf
\f[C]
Specify name of main file output in depfile
\f[R]
.fi
.PP
\f[B]\f[CB]\-O=<optimization_level>\f[B]\f[R]
.IP
.nf
\f[C]
Optimization level s, 0\-3
\f[R]
.fi
.PP
\f[B]\f[CB]\-R=<dir>\f[B]\f[R]
.IP
.nf
\f[C]
Add the directory dir to the list of directories to be searched for resource files
\f[R]
.fi
.PP
\f[B]\f[CB]\-S\f[B]\f[R]
.IP
.nf
\f[C]
Only run preprocess and compilation steps
\f[R]
.fi
.PP
\f[B]\f[CB]\-W=<warning_name>\f[B]\f[R]
.IP
.nf
\f[C]
Enable the specified warning.
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-abi\-version=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Which ABI version to generate
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-abigen\f[B]\f[R]
.IP
.nf
\f[C]
Generate ABI
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-abigen_output=<string>\f[B]\f[R]
.IP
.nf
\f[C]
ABIGEN output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-allow\-names\f[B]\f[R]
.IP
.nf
\f[C]
Allow creation of name section
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-allow\-sse\f[B]\f[R]
.IP
.nf
\f[C]
Should not be used, except for building libc
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-as\-secure\-log\-file\-name=<value>\f[B]\f[R]
.IP
.nf
\f[C]
As secure log file name (initialized from AS_SECURE_LOG_FILE env variable)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-asm\-macro\-max\-nesting\-depth=<uint>\f[B]\f[R]
.IP
.nf
\f[C]
The maximum nesting depth allowed for assembly macros
\f[R]
.fi
.PP
\f[B]\f[CB]\-c\f[B]\f[R]
.IP
.nf
\f[C]
Only run preprocess, compile, and assemble steps
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-color\f[B]\f[R]
.IP
.nf
\f[C]
Use colors in output (default=autodetect)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-contract=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Contract name
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-dD\f[B]\f[R]
.IP
.nf
\f[C]
Print macro definitions in \-E mode in addition to normal output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-dI\f[B]\f[R]
.IP
.nf
\f[C]
Print include directives in \-E mode in addition to normal output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-dM\f[B]\f[R]
.IP
.nf
\f[C]
Print macro definitions in \-E mode instead to normal output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-disable\-symbolication\f[B]\f[R]
.IP
.nf
\f[C]
Disable symbolizing crash backtraces.
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-emit\-ast\f[B]\f[R]
.IP
.nf
\f[C]
Emit Clang AST files for source inputs
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-emit\-ir\f[B]\f[R]
.IP
.nf
\f[C]
Emit llvm ir
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-emit\-llvm\f[B]\f[R]
.IP
.nf
\f[C]
Use the LLVM representation for assembler and object files
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-eosio\-pp\-dir=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the directory for eosio\-pp
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fPIC\f[B]\f[R]
.IP
.nf
\f[C]
Generate position independent code. This option is used for shared libraries
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-faligned\-allocation\f[B]\f[R]
.IP
.nf
\f[C]
Enable C++17 aligned allocation functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fasm\f[B]\f[R]
.IP
.nf
\f[C]
Assemble file for x86\-64
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fcolor\-diagnostics\f[B]\f[R]
.IP
.nf
\f[C]
Use colors in diagnostics
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fcoroutine\-ts\f[B]\f[R]
.IP
.nf
\f[C]
Enable support for the C++ Coroutines TS
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-finline\-functions\f[B]\f[R]
.IP
.nf
\f[C]
Inline suitable functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-finline\-hint\-functions\f[B]\f[R]
.IP
.nf
\f[C]
Inline functions which are (explicitly or implicitly) marked inline
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fmerge\-all\-constants\f[B]\f[R]
.IP
.nf
\f[C]
Allow merging of constants
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fnative\f[B]\f[R]
.IP
.nf
\f[C]
Compile and link for x86\-64
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-cfl\-aa\f[B]\f[R]
.IP
.nf
\f[C]
Disable CFL Alias Analysis
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-elide\-constructors\f[B]\f[R]
.IP
.nf
\f[C]
Disable C++ copy constructor elision
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-lto\f[B]\f[R]
.IP
.nf
\f[C]
Disable LTO
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-post\-pass\f[B]\f[R]
.IP
.nf
\f[C]
Don\[aq]t run post processing pass
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-stack\-first\f[B]\f[R]
.IP
.nf
\f[C]
Don\[aq]t set the stack first in memory
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\-client\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\-server\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstack\-protector\f[B]\f[R]
.IP
.nf
\f[C]
Enable stack protectors for functions potentially vulnerable to stack smashing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstack\-protector\-all\f[B]\f[R]
.IP
.nf
\f[C]
Force the usage of stack protectors for all functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstack\-protector\-strong\f[B]\f[R]
.IP
.nf
\f[C]
Use a strong heuristic to apply stack protectors to functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstrict\-enums\f[B]\f[R]
.IP
.nf
\f[C]
Enable optimizations based on the strict definition of an enum\[aq]s value range
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstrict\-return\f[B]\f[R]
.IP
.nf
\f[C]
Always treat control flow paths that fall off the end of a non\-void function as unreachable
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fstrict\-vtable\-pointers\f[B]\f[R]
.IP
.nf
\f[C]
Enable optimizations based on the strict rules for overwriting polymorphic C++ objects
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fuse\-main\f[B]\f[R]
.IP
.nf
\f[C]
Use main as entry
\f[R]
.fi
.PP
\f[B]\f[CB]\-h\f[B]\f[R]
.IP
.nf
\f[C]
Alias for \-\-help
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\f[B]\f[R]
.IP
.nf
\f[C]
Display available options (\-\-help\-hidden for more)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\-hidden\f[B]\f[R]
.IP
.nf
\f[C]
Display all available options
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\-list\f[B]\f[R]
.IP
.nf
\f[C]
Display list of available options (\-\-help\-list\-hidden for more)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\-list\-hidden\f[B]\f[R]
.IP
.nf
\f[C]
Display list of all available options
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-imports=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the file for cdt.imports
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-include=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Include file before parsing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-info\-output\-file=<filename>\f[B]\f[R]
.IP
.nf
\f[C]
File to append \-stats and \-timer output to
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-isysroot=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the system root directory (usually /)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-isystem=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Add directory to SYSTEM include search path
\f[R]
.fi
.PP
\f[B]\f[CB]\-l=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Root name of library to link
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-lto\-opt=<string>\f[B]\f[R]
.IP
.nf
\f[C]
LTO Optimization level (O0\-O3)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-mllvm=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Pass arguments to llvm
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-no\-abigen\f[B]\f[R]
.IP
.nf
\f[C]
Disable ABI file generation
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-no\-missing\-ricardian\-clause\f[B]\f[R]
.IP
.nf
\f[C]
Disable warnings for missing Ricardian clauses
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-non\-global\-value\-max\-name\-size=<uint>\f[B]\f[R]
.IP
.nf
\f[C]
Maximum size for the name of non\-global values
\f[R]
.fi
.PP
\f[B]\f[CB]\-o=<file>\f[B]\f[R]
.IP
.nf
\f[C]
Write output to <file>
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-only\-export=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Export only this symbol
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-opt\-bisect\-limit=<int>\f[B]\f[R]
.IP
.nf
\f[C]
Maximum optimization to perform
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-pass\-remarks=<pattern>\f[B]\f[R]
.IP
.nf
\f[C]
Enable optimization remarks from passes whose name match the given regular expression
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-pass\-remarks\-analysis=<pattern>\f[B]\f[R]
.IP
.nf
\f[C]
Enable optimization analysis remarks from passes whose name match the given regular expression
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-pass\-remarks\-missed=<pattern>\f[B]\f[R]
.IP
.nf
\f[C]
Enable missed optimization remarks from passes whose name match the given regular expression
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-print\-all\-options\f[B]\f[R]
.IP
.nf
\f[C]
Print all option values after command line parsing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-print\-options\f[B]\f[R]
.IP
.nf
\f[C]
Print non\-default options after command line parsing
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-remarks\-yaml\-string\-table\f[B]\f[R]
.IP
.nf
\f[C]
Enable the usage of a string table with YAML remarks
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-rng\-seed=<seed>\f[B]\f[R]
.IP
.nf
\f[C]
Seed for the random number generator
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-shared\f[B]\f[R]
.IP
.nf
\f[C]
Make shared object native library
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stack\-canary\f[B]\f[R]
.IP
.nf
\f[C]
Stack canary for non stack first layouts
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stack\-size=<int>\f[B]\f[R]
.IP
.nf
\f[C]
Specifies the maximum stack size for the contract. Defaults to 8192 bytes
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-static\-func\-full\-module\-prefix\f[B]\f[R]
.IP
.nf
\f[C]
Use full module build paths in the profile counter names for static functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-static\-func\-strip\-dirname\-prefix=<uint>\f[B]\f[R]
.IP
.nf
\f[C]
Strip specified level of directory name from source path in the profile counter name for static functions
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stats\f[B]\f[R]
.IP
.nf
\f[C]
Enable statistics output from program (available with Asserts)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stats\-json\f[B]\f[R]
.IP
.nf
\f[C]
Display statistics as json data
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-std=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Language standard to compile for
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-switch\-inst\-prof\-update\-wrapper\-strict\f[B]\f[R]
.IP
.nf
\f[C]
Assert that prof branch_weights metadata is valid when creating an instance of SwitchInstProfUpdateWrapper
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-sysroot=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Set the system root directory
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-time\-trace\-granularity=<uint>\f[B]\f[R]
.IP
.nf
\f[C]
Minimum time granularity (in microseconds) traced by time profiler
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-track\-memory\f[B]\f[R]
.IP
.nf
\f[C]
Enable \-time\-passes memory tracking (this may be slow)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-use\-dbg\-addr\f[B]\f[R]
.IP
.nf
\f[C]
Use llvm.dbg.addr for all local variables
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-use\-freeing\-malloc\f[B]\f[R]
.IP
.nf
\f[C]
Set the malloc implementation to the old freeing malloc
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-use\-rt\f[B]\f[R]
.IP
.nf
\f[C]
Use software compiler\-rt
\f[R]
.fi
.PP
\f[B]\f[CB]\-v\f[B]\f[R]
.IP
.nf
\f[C]
Show commands to run and use verbose output
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-version\f[B]\f[R]
.IP
.nf
\f[C]
Display the version of this program
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-view\-background\f[B]\f[R]
.IP
.nf
\f[C]
Execute graph viewer in the background. Creates tmp file litter
\f[R]
.fi
.PP
\f[B]\f[CB]\-w\f[B]\f[R]
.IP
.nf
\f[C]
Suppress all warnings
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-warn\-action\-read\-only\f[B]\f[R]
.IP
.nf
\f[C]
Issue a warning if a read\-only action uses a write API and continue compilation
\f[R]
.fi
.SH BUGS
.PP
Please submit bug reports online at
https://github.com/AntelopeIO/cdt/issues
.SH SEE ALSO
.PP
For more details consult the full documentation and sources
https://github.com/AntelopeIO/cdt
+443
View File
@@ -0,0 +1,443 @@
---
title: CDT-CPP
section: 1
header: Contract Development Toolkit (CDT)
footer: AntelopeIO
date: April 08, 2023
---
# NAME
cdt-cpp - Antelope smart contract C++ to WebAssembly compiler
# SYNOPSIS
`cdt-cpp [options] <input file>`
# DESCRIPTION
**cdt-cpp** Is a C++ compiler which converts C++ smart contract code to WebAssemply for
execution in Antelope block chain virtual machines.
# OPTIONS
**`-C`**
Include comments in preprocessed output
**`--CC`**
Include comments from within macros in preprocessed output
**`-D=<name definition>`**
Define <macro> to <value> (or 1 if <value> omitted)
**`-U=<name>`**
Undefine any previous definition of name, either built in or defined with a -D option
**`-E`**
Only run the preprocessor
**`-I=<dir>`**
Add directory to include search path
**`-L=<dir>`**
Add directory to library search path
**`--MF=<file>`**
Write depfile output
**`--MD`**
Write depfile containing user and system headers
**`--MMD`**
Like -MD except mention only user header files, not system header files.
**`--MT=<target>`**
Specify name of main file output in depfile
**`-O=<optimization_level>`**
Optimization level s, 0-3
**`-R=<dir>`**
Add the directory dir to the list of directories to be searched for resource files
**`-S`**
Only run preprocess and compilation steps
**`-W=<warning_name>`**
Enable the specified warning.
**`--abi-version=<string>`**
Which ABI version to generate
**`--abigen`**
Generate ABI
**`--abigen_output=<string>`**
ABIGEN output
**`--allow-names`**
Allow creation of name section
**`--allow-sse`**
Should not be used, except for building libc
**`--as-secure-log-file-name=<value>`**
As secure log file name (initialized from AS_SECURE_LOG_FILE env variable)
**`--asm-macro-max-nesting-depth=<uint>`**
The maximum nesting depth allowed for assembly macros
**`-c`**
Only run preprocess, compile, and assemble steps
**`--color`**
Use colors in output (default=autodetect)
**`--contract=<string>`**
Contract name
**`--dD`**
Print macro definitions in -E mode in addition to normal output
**`--dI`**
Print include directives in -E mode in addition to normal output
**`--dM`**
Print macro definitions in -E mode instead to normal output
**`--disable-symbolication`**
Disable symbolizing crash backtraces.
**`--emit-ast`**
Emit Clang AST files for source inputs
**`--emit-ir`**
Emit llvm ir
**`--emit-llvm`**
Use the LLVM representation for assembler and object files
**`--eosio-pp-dir=<string>`**
Set the directory for eosio-pp
**`--fPIC`**
Generate position independent code. This option is used for shared libraries
**`--faligned-allocation`**
Enable C++17 aligned allocation functions
**`--fasm`**
Assemble file for x86-64
**`--fcolor-diagnostics`**
Use colors in diagnostics
**`--fcoroutine-ts`**
Enable support for the C++ Coroutines TS
**`--finline-functions`**
Inline suitable functions
**`--finline-hint-functions`**
Inline functions which are (explicitly or implicitly) marked inline
**`--fmerge-all-constants`**
Allow merging of constants
**`--fnative`**
Compile and link for x86-64
**`--fcfl-aa`**
Enable CFL Alias Analysis
**`--fno-elide-constructors`**
Disable C++ copy constructor elision
**`--fno-lto`**
Disable LTO
**`--fno-post-pass`**
Don't run post processing pass
**`--fno-stack-first`**
Don't set the stack first in memory
**`--fquery`**
Produce binaries for wasmql
**`--fquery-client`**
Produce binaries for wasmql
**`--fquery-server`**
Produce binaries for wasmql
**`--fstack-protector`**
Enable stack protectors for functions potentially vulnerable to stack smashing
**`--fstack-protector-all`**
Force the usage of stack protectors for all functions
**`--fstack-protector-strong`**
Use a strong heuristic to apply stack protectors to functions
**`--fstrict-enums`**
Enable optimizations based on the strict definition of an enum's value range
**`--fstrict-return`**
Always treat control flow paths that fall off the end of a non-void function as unreachable
**`--fstrict-vtable-pointers`**
Enable optimizations based on the strict rules for overwriting polymorphic C++ objects
**`--fuse-main`**
Use main as entry
**`-h`**
Alias for --help
**`--help`**
Display available options (--help-hidden for more)
**`--help-hidden`**
Display all available options
**`--help-list`**
Display list of available options (--help-list-hidden for more)
**`--help-list-hidden`**
Display list of all available options
**`--imports=<string>`**
Set the file for cdt.imports
**`--include=<string>`**
Include file before parsing
**`--info-output-file=<filename>`**
File to append -stats and -timer output to
**`--isysroot=<string>`**
Set the system root directory (usually /)
**`--isystem=<string>`**
Add directory to SYSTEM include search path
**`-l=<string>`**
Root name of library to link
**`--lto-opt=<string>`**
LTO Optimization level (O0-O3)
**`--mllvm=<string>`**
Pass arguments to llvm
**`--no-abigen`**
Disable ABI file generation
**`--no-missing-ricardian-clause`**
Disable warnings for missing Ricardian clauses
**`--non-global-value-max-name-size=<uint>`**
Maximum size for the name of non-global values
**`-o=<file>`**
Write output to <file>
**`--only-export=<string>`**
Export only this symbol
**`--opt-bisect-limit=<int>`**
Maximum optimization to perform
**`--pass-remarks=<pattern>`**
Enable optimization remarks from passes whose name match the given regular expression
**`--pass-remarks-analysis=<pattern>`**
Enable optimization analysis remarks from passes whose name match the given regular expression
**`--pass-remarks-missed=<pattern>`**
Enable missed optimization remarks from passes whose name match the given regular expression
**`--print-all-options`**
Print all option values after command line parsing
**`--print-options`**
Print non-default options after command line parsing
**`--remarks-yaml-string-table`**
Enable the usage of a string table with YAML remarks
**`--rng-seed=<seed>`**
Seed for the random number generator
**`--shared`**
Make shared object native library
**`--stack-canary`**
Stack canary for non stack first layouts
**`--stack-size=<int>`**
Specifies the maximum stack size for the contract. Defaults to 8192 bytes
**`--static-func-full-module-prefix`**
Use full module build paths in the profile counter names for static functions
**`--static-func-strip-dirname-prefix=<uint>`**
Strip specified level of directory name from source path in the profile counter name for static functions
**`--stats`**
Enable statistics output from program (available with Asserts)
**`--stats-json`**
Display statistics as json data
**`--std=<string>`**
Language standard to compile for
**`--switch-inst-prof-update-wrapper-strict`**
Assert that prof branch_weights metadata is valid when creating an instance of SwitchInstProfUpdateWrapper
**`--sysroot=<string>`**
Set the system root directory
**`--time-trace-granularity=<uint>`**
Minimum time granularity (in microseconds) traced by time profiler
**`--track-memory`**
Enable -time-passes memory tracking (this may be slow)
**`--use-dbg-addr`**
Use llvm.dbg.addr for all local variables
**`--use-freeing-malloc`**
Set the malloc implementation to the old freeing malloc
**`--use-rt`**
Use software compiler-rt
**`-v`**
Show commands to run and use verbose output
**`--version`**
Display the version of this program
**`--view-background`**
Execute graph viewer in the background. Creates tmp file litter
**`-w`**
Suppress all warnings
**`--warn-action-read-only`**
Issue a warning if a read-only action uses a write API and continue compilation
# BUGS
Please submit bug reports online at https://github.com/AntelopeIO/cdt/issues
# SEE ALSO
For more details consult the full documentation and sources https://github.com/AntelopeIO/cdt
+215
View File
@@ -0,0 +1,215 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "CDT\-LD" "1" "April 14, 2023" "AntelopeIO" "Contract Development Toolkit (CDT)"
.hy
.SH NAME
.PP
cdt\-ld \- Antelope smart contract WebAssembly linker
.SH SYNOPSIS
.PP
\f[C]cdt\-ld [options] <input file>\f[R]
.SH DESCRIPTION
.PP
\f[B]cdt\-ld\f[R] Is a compiled smart contract linker which creates
WebAssemply code for execution in Antelope block chain virtual machines.
.SH OPTIONS
.PP
\f[B]\f[CB]\-L=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Add directory to library search path
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-abi\-version=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Which ABI version to generate
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-allow\-names\f[B]\f[R]
.IP
.nf
\f[C]
Allows name section to be created
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fasm\f[B]\f[R]
.IP
.nf
\f[C]
Assemble file for x86\-64
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fnative\f[B]\f[R]
.IP
.nf
\f[C]
Compile and link for x86\-64
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-cfl\-aa\f[B]\f[R]
.IP
.nf
\f[C]
Disable CFL Alias Analysis
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-lto\f[B]\f[R]
.IP
.nf
\f[C]
Disable LTO
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-post\-pass\f[B]\f[R]
.IP
.nf
\f[C]
Don\[aq]t run post processing pass
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fno\-stack\-first\f[B]\f[R]
.IP
.nf
\f[C]
Don\[aq]t set the stack first in memory
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\-client\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fquery\-server\f[B]\f[R]
.IP
.nf
\f[C]
Produce binaries for wasmql
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-fuse\-main\f[B]\f[R]
.IP
.nf
\f[C]
Use main as entry
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-help\f[B]\f[R]
.IP
.nf
\f[C]
Display available options (\-\-help\-hidden for more)
\f[R]
.fi
.PP
\f[B]\f[CB]\-l=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Root name of library to link
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-lto\-opt=<string>\f[B]\f[R]
.IP
.nf
\f[C]
LTO Optimization level (O0\-O3)
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-mllvm=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Pass arguments to llvm
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-no\-abigen\f[B]\f[R]
.IP
.nf
\f[C]
Disable ABI file generation
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-no\-missing\-ricardian\-clause\f[B]\f[R]
.IP
.nf
\f[C]
Disable warnings for missing Ricardian clauses
\f[R]
.fi
.PP
\f[B]\f[CB]\-o=<string>\f[B]\f[R]
.IP
.nf
\f[C]
Write output to <file>
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-shared\f[B]\f[R]
.IP
.nf
\f[C]
Make shared object native library
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stack\-canary\f[B]\f[R]
.IP
.nf
\f[C]
Stack canary for non stack first layouts
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-stack\-size=<int>\f[B]\f[R]
.IP
.nf
\f[C]
Specifies the maximum stack size for the contract. Defaults to 8192 bytes
\f[R]
.fi
.PP
\f[B]\f[CB]\-\-version\f[B]\f[R]
.IP
.nf
\f[C]
Display the version of this program
\f[R]
.fi
.SH BUGS
.PP
Please submit bug reports online at
https://github.com/AntelopeIO/cdt/issues
.SH SEE ALSO
.PP
For more details consult the full documentation and sources
https://github.com/AntelopeIO/cdt
+127
View File
@@ -0,0 +1,127 @@
---
title: CDT-LD
section: 1
header: Contract Development Toolkit (CDT)
footer: AntelopeIO
date: April 14, 2023
---
# NAME
cdt-ld - Antelope smart contract WebAssembly linker
# SYNOPSIS
`cdt-ld [options] <input file>`
# DESCRIPTION
**cdt-ld** Is a compiled smart contract linker which creates WebAssemply code for
execution in Antelope block chain virtual machines.
# OPTIONS
**`-L=<string>`**
Add directory to library search path
**`--abi-version=<string>`**
Which ABI version to generate
**`--allow-names`**
Allows name section to be created
**`--fasm`**
Assemble file for x86-64
**`--fnative`**
Compile and link for x86-64
**`--fcfl-aa`**
Enable CFL Alias Analysis
**`--fno-lto`**
Disable LTO
**`--fno-post-pass`**
Don't run post processing pass
**`--fno-stack-first`**
Don't set the stack first in memory
**`--fquery`**
Produce binaries for wasmql
**`--fquery-client`**
Produce binaries for wasmql
**`--fquery-server`**
Produce binaries for wasmql
**`--fuse-main`**
Use main as entry
**`--help`**
Display available options (--help-hidden for more)
**`-l=<string>`**
Root name of library to link
**`--lto-opt=<string>`**
LTO Optimization level (O0-O3)
**`--mllvm=<string>`**
Pass arguments to llvm
**`--no-abigen`**
Disable ABI file generation
**`--no-missing-ricardian-clause`**
Disable warnings for missing Ricardian clauses
**`-o=<string>`**
Write output to <file>
**`--shared`**
Make shared object native library
**`--stack-canary`**
Stack canary for non stack first layouts
**`--stack-size=<int>`**
Specifies the maximum stack size for the contract. Defaults to 8192 bytes
**`--version`**
Display the version of this program
# BUGS
Please submit bug reports online at https://github.com/AntelopeIO/cdt/issues
# SEE ALSO
For more details consult the full documentation and sources https://github.com/AntelopeIO/cdt
+263
View File
@@ -0,0 +1,263 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "CDT\-OBJDUMP" "1" "April 18, 2023" "AntelopeIO" "Contract Development Toolkit (CDT)"
.hy
.SH NAME
.PP
cdt\-objdump \- manual page for cdt\-objdump
.SH DESCRIPTION
.PP
cdt\-objdump is a CDT object file dumper
.SH SYNOPSIS
.PP
cdt\-objdump [options] <input object files>
.SH OPTIONS
.PP
Generic Options:
.PP
\f[B]\-\-help\f[R] \- Display available options
(\f[B]\-\-help\-hidden\f[R] for more)
.PP
\f[B]\-\-help\-list\f[R] \- Display list of available options
(\f[B]\-\-help\-list\-hidden\f[R] for more)
.PP
\f[B]\-\-version\f[R] \- Display the version of this program
.PP
cdt\-objdump MachO Specific Options:
.PP
\f[B]\-\-arch=\f[R]<string> \- architecture(s) from a Mach\-O file to
dump
.PP
\f[B]\-\-archive\-member\-offsets\f[R] \- Print the offset to each
archive member for Mach\-O archives (requires \f[B]\-\-macho\f[R] and
\f[B]\-archive\-headers\f[R])
.PP
\f[B]\-\-bind\f[R] \- Display mach\-o binding info
.PP
\f[B]\-\-data\-in\-code\f[R] \- Print the data in code table for Mach\-O
objects (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-dis\-symname=\f[R]<string> \- disassemble just this
symbol\[aq]s instructions (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-dsym=\f[R]<string> \- Use .dSYM file for debug info
.PP
\f[B]\-\-dylib\-id\f[R] \- Print the shared library\[aq]s id for the
dylib Mach\-O file (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-dylibs\-used\f[R] \- Print the shared libraries used for linked
Mach\-O files (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-exports\-trie\f[R] \- Display mach\-o exported symbols
.PP
\f[B]\-\-full\-leading\-addr\f[R] \- Print full leading address
.PP
\f[B]\-g\f[R] \- Print line information from debug info if available
.PP
\f[B]\-\-indirect\-symbols\f[R] \- Print indirect symbol table for
Mach\-O objects (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-info\-plist\f[R] \- Print the info plist section as strings for
Mach\-O objects (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-lazy\-bind\f[R] \- Display mach\-o lazy binding info
.PP
\f[B]\-\-link\-opt\-hints\f[R] \- Print the linker optimization hints
for Mach\-O objects (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-no\-leading\-headers\f[R] \- Print no leading headers
.PP
\f[B]\-\-no\-symbolic\-operands\f[R] \- do not symbolic operands when
disassembling (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-non\-verbose\f[R] \- Print the info for Mach\-O objects in
non\-verbose or numeric form (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-objc\-meta\-data\f[R] \- Print the Objective\-C runtime meta
data for Mach\-O files (requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-private\-header\f[R] \- Display only the first format specific
file header
.PP
\f[B]\-\-rebase\f[R] \- Display mach\-o rebasing info
.PP
\f[B]\-\-universal\-headers\f[R] \- Print Mach\-O universal headers
(requires \f[B]\-\-macho\f[R])
.PP
\f[B]\-\-weak\-bind\f[R] \- Display mach\-o weak binding info
.PP
cdt\-objdump Options:
.PP
\f[B]\-C\f[R] \- Alias for \f[B]\-\-demangle\f[R]
.PP
\f[B]\-D\f[R] \- Alias for \f[B]\-\-disassemble\-all\f[R]
.PP
\f[B]\-M\f[R] \- Alias for \f[B]\-\-disassembler\-options\f[R]
.PP
\f[B]\-R\f[R] \- Alias for \f[B]\-\-dynamic\-reloc\f[R]
.PP
\f[B]\-S\f[R] \- Alias for \f[B]\-\-source\f[R]
.PP
\f[B]\-T\f[R] \- Alias for \f[B]\-\-dynamic\-syms\f[R]
.PP
\f[B]\-a\f[R] \- Alias for \f[B]\-\-archive\-headers\f[R]
.PP
\f[B]\-\-adjust\-vma=\f[R]<offset> \- Increase the displayed address by
the specified offset
.PP
\f[B]\-\-all\-headers\f[R] \- Display all available header information
.PP
\f[B]\-\-arch\-name=\f[R]<string> \- Target arch to disassemble for, see
\f[B]\-version\f[R] for available targets
.PP
\f[B]\-\-archive\-headers\f[R] \- Display archive header information
.PP
\f[B]\-d\f[R] \- Alias for \f[B]\-\-disassemble\f[R]
.PP
\f[B]\-\-debug\-vars\f[R] \- Print the locations (in registers or
memory) of source\-level variables alongside disassembly
.PP
\f[B]\-\-debug\-vars=\f[R]<value> \- Print the locations (in registers
or memory) of source\-level variables alongside disassembly
.TP
.B =<empty>
\- unicode
.TP
.B =unicode
\- unicode
.TP
.B =ascii
\- unicode
.PP
\f[B]\-\-debug\-vars\-indent=\f[R]<int> \- Distance to indent the
source\-level variable display, relative to the start of the disassembly
.PP
\f[B]\-\-demangle\f[R] \- Demangle symbols names
.PP
\f[B]\-\-disassemble\f[R] \- Display assembler mnemonics for the machine
instructions
.PP
\f[B]\-\-disassemble\-all\f[R] \- Display assembler mnemonics for the
machine instructions
.PP
\f[B]\-\-disassemble\-symbols=\f[R]<string> \- List of symbols to
disassemble.
Accept demangled names when \f[B]\-\-demangle\f[R] is specified,
otherwise accept mangled names
.PP
\f[B]\-\-disassemble\-zeroes\f[R] \- Do not skip blocks of zeroes when
disassembling
.PP
\f[B]\-\-disassembler\-options=\f[R]<options> \- Pass target specific
disassembler options
.PP
\f[B]\-\-dwarf=\f[R]<value> \- Dump of dwarf debug sections:
.TP
.B =frames
\- .debug_frame
.PP
\f[B]\-\-dynamic\-reloc\f[R] \- Display the dynamic relocation entries
in the file
.PP
\f[B]\-\-dynamic\-syms\f[R] \- Display the contents of the dynamic
symbol table
.PP
\f[B]\-f\f[R] \- Alias for \f[B]\-\-file\-headers\f[R]
.PP
\f[B]\-\-fault\-map\-section\f[R] \- Display contents of faultmap
section
.PP
\f[B]\-\-file\-headers\f[R] \- Display the contents of the overall file
header
.PP
\f[B]\-\-full\-contents\f[R] \- Display the content of each section
.PP
\f[B]\-h\f[R] \- Alias for \f[B]\-\-section\-headers\f[R]
.PP
\f[B]\-\-headers\f[R] \- Alias for \f[B]\-\-section\-headers\f[R]
.PP
\f[B]\-j\f[R] \- Alias for \f[B]\-\-section\f[R]
.PP
\f[B]\-l\f[R] \- Alias for \f[B]\-\-line\-numbers\f[R]
.PP
\f[B]\-\-line\-numbers\f[R] \- Display source line numbers with
disassembly.
Implies disassemble object
.PP
\f[B]\-m\f[R] \- Alias for \f[B]\-\-macho\f[R]
.PP
\f[B]\-\-macho\f[R] \- Use MachO specific object file parser
.PP
\f[B]\-\-mattr=\f[R]<a1,+a2,\-a3,...> \- Target specific attributes
.PP
\f[B]\-\-mcpu=\f[R]<cpu\-name> \- Target a specific cpu type
(\f[B]\-mcpu\f[R]=\f[I]help\f[R] for details)
.PP
\f[B]\-\-no\-leading\-addr\f[R] \- Print no leading address
.PP
\f[B]\-\-no\-show\-raw\-insn\f[R] \- When disassembling instructions, do
not print the instruction bytes.
.PP
\f[B]\-p\f[R] \- Alias for \f[B]\-\-private\-headers\f[R]
.PP
\f[B]\-\-print\-imm\-hex\f[R] \- Use hex format for immediate values
.PP
\f[B]\-\-private\-headers\f[R] \- Display format specific file headers
.PP
\f[B]\-r\f[R] \- Alias for \f[B]\-\-reloc\f[R]
.PP
\f[B]\-\-raw\-clang\-ast\f[R] \- Dump the raw binary contents of the
clang AST section
.PP
\f[B]\-\-reloc\f[R] \- Display the relocation entries in the file
.PP
\f[B]\-s\f[R] \- Alias for \f[B]\-\-full\-contents\f[R]
.PP
\f[B]\-\-section=\f[R]<string> \- Operate on the specified sections
only.
With \f[B]\-\-macho\f[R] dump segment,section
.PP
\f[B]\-\-section\-headers\f[R] \- Display summaries of the headers for
each section.
.PP
\f[B]\-\-show\-lma\f[R] \- Display LMA column when dumping ELF section
headers
.PP
\f[B]\-\-source\f[R] \- Display source inlined with disassembly.
Implies disassemble object
.PP
\f[B]\-\-start\-address=\f[R]<address> \- Disassemble beginning at
address
.PP
\f[B]\-\-stop\-address=\f[R]<address> \- Stop disassembly at address
.PP
\f[B]\-\-symbol\-description\f[R] \- Add symbol description for
disassembly.
This option is for XCOFF files only
.PP
\f[B]\-\-syms\f[R] \- Display the symbol table
.PP
\f[B]\-t\f[R] \- Alias for \f[B]\-\-syms\f[R]
.PP
\f[B]\-\-triple=\f[R]<string> \- Target triple to disassemble for, see
\f[B]\-version\f[R] for available targets
.PP
\f[B]\-u\f[R] \- Alias for \f[B]\-\-unwind\-info\f[R]
.PP
\f[B]\-\-unwind\-info\f[R] \- Display unwind information
.PP
\f[B]\-\-wide\f[R] \- Ignored for compatibility with GNU objdump
.PP
\f[B]\-x\f[R] \- Alias for \f[B]\-\-all\-headers\f[R]
.PP
\f[B]\-z\f[R] \- Alias for \f[B]\-\-disassemble\-zeroes\f[R]
.PP
Pass \[at]FILE as argument to read options from FILE.
.SH BUGS
.PP
Please submit bug reports online at
https://github.com/AntelopeIO/cdt/issues
.SH SEE ALSO
.PP
For more details consult the full documentation and sources
https://github.com/AntelopeIO/cdt
+262
View File
@@ -0,0 +1,262 @@
---
date: April 18, 2023
section: 1
title: 'CDT-OBJDUMP'
footer: AntelopeIO
header: Contract Development Toolkit (CDT)
---
# NAME
cdt-objdump - manual page for cdt-objdump
# DESCRIPTION
cdt-objdump is a CDT object file dumper
# SYNOPSIS
cdt-objdump \[options\] \<input object files\>
# OPTIONS
Generic Options:
**\--help** - Display available options (**\--help-hidden** for more)
**\--help-list** - Display list of available options
(**\--help-list-hidden** for more)
**\--version** - Display the version of this program
cdt-objdump MachO Specific Options:
**\--arch=**\<string\> - architecture(s) from a Mach-O file to dump
**\--archive-member-offsets** - Print the offset to each archive member
for Mach-O archives (requires **\--macho** and **-archive-headers**)
**\--bind** - Display mach-o binding info
**\--data-in-code** - Print the data in code table for Mach-O objects
(requires **\--macho**)
**\--dis-symname=**\<string\> - disassemble just this symbol\'s
instructions (requires **\--macho**)
**\--dsym=**\<string\> - Use .dSYM file for debug info
**\--dylib-id** - Print the shared library\'s id for the dylib Mach-O
file (requires **\--macho**)
**\--dylibs-used** - Print the shared libraries used for linked Mach-O
files (requires **\--macho**)
**\--exports-trie** - Display mach-o exported symbols
**\--full-leading-addr** - Print full leading address
**-g** - Print line information from debug info if available
**\--indirect-symbols** - Print indirect symbol table for Mach-O objects
(requires **\--macho**)
**\--info-plist** - Print the info plist section as strings for Mach-O
objects (requires **\--macho**)
**\--lazy-bind** - Display mach-o lazy binding info
**\--link-opt-hints** - Print the linker optimization hints for Mach-O
objects (requires **\--macho**)
**\--no-leading-headers** - Print no leading headers
**\--no-symbolic-operands** - do not symbolic operands when
disassembling (requires **\--macho**)
**\--non-verbose** - Print the info for Mach-O objects in non-verbose or
numeric form (requires **\--macho**)
**\--objc-meta-data** - Print the Objective-C runtime meta data for
Mach-O files (requires **\--macho**)
**\--private-header** - Display only the first format specific file
header
**\--rebase** - Display mach-o rebasing info
**\--universal-headers** - Print Mach-O universal headers (requires
**\--macho**)
**\--weak-bind** - Display mach-o weak binding info
cdt-objdump Options:
**-C** - Alias for **\--demangle**
**-D** - Alias for **\--disassemble-all**
**-M** - Alias for **\--disassembler-options**
**-R** - Alias for **\--dynamic-reloc**
**-S** - Alias for **\--source**
**-T** - Alias for **\--dynamic-syms**
**-a** - Alias for **\--archive-headers**
**\--adjust-vma=**\<offset\> - Increase the displayed address by the
specified offset
**\--all-headers** - Display all available header information
**\--arch-name=**\<string\> - Target arch to disassemble for, see
**-version** for available targets
**\--archive-headers** - Display archive header information
**-d** - Alias for **\--disassemble**
**\--debug-vars** - Print the locations (in registers or memory) of
source-level variables alongside disassembly
**\--debug-vars=**\<value\> - Print the locations (in registers or
memory) of source-level variables alongside disassembly
=\<empty\>
: \- unicode
=unicode
: \- unicode
=ascii
: \- unicode
**\--debug-vars-indent=**\<int\> - Distance to indent the source-level
variable display, relative to the start of the disassembly
**\--demangle** - Demangle symbols names
**\--disassemble** - Display assembler mnemonics for the machine
instructions
**\--disassemble-all** - Display assembler mnemonics for the machine
instructions
**\--disassemble-symbols=**\<string\> - List of symbols to disassemble.
Accept demangled names when **\--demangle** is specified, otherwise
accept mangled names
**\--disassemble-zeroes** - Do not skip blocks of zeroes when
disassembling
**\--disassembler-options=**\<options\> - Pass target specific
disassembler options
**\--dwarf=**\<value\> - Dump of dwarf debug sections:
=frames
: \- .debug\_frame
**\--dynamic-reloc** - Display the dynamic relocation entries in the
file
**\--dynamic-syms** - Display the contents of the dynamic symbol table
**-f** - Alias for **\--file-headers**
**\--fault-map-section** - Display contents of faultmap section
**\--file-headers** - Display the contents of the overall file header
**\--full-contents** - Display the content of each section
**-h** - Alias for **\--section-headers**
**\--headers** - Alias for **\--section-headers**
**-j** - Alias for **\--section**
**-l** - Alias for **\--line-numbers**
**\--line-numbers** - Display source line numbers with disassembly.
Implies disassemble object
**-m** - Alias for **\--macho**
**\--macho** - Use MachO specific object file parser
**\--mattr=**\<a1,+a2,-a3,\...\> - Target specific attributes
**\--mcpu=**\<cpu-name\> - Target a specific cpu type (**-mcpu**=*help*
for details)
**\--no-leading-addr** - Print no leading address
**\--no-show-raw-insn** - When disassembling instructions, do not print
the instruction bytes.
**-p** - Alias for **\--private-headers**
**\--print-imm-hex** - Use hex format for immediate values
**\--private-headers** - Display format specific file headers
**-r** - Alias for **\--reloc**
**\--raw-clang-ast** - Dump the raw binary contents of the clang AST
section
**\--reloc** - Display the relocation entries in the file
**-s** - Alias for **\--full-contents**
**\--section=**\<string\> - Operate on the specified sections only. With
**\--macho** dump segment,section
**\--section-headers** - Display summaries of the headers for each
section.
**\--show-lma** - Display LMA column when dumping ELF section headers
**\--source** - Display source inlined with disassembly. Implies
disassemble object
**\--start-address=**\<address\> - Disassemble beginning at address
**\--stop-address=**\<address\> - Stop disassembly at address
**\--symbol-description** - Add symbol description for disassembly. This
option is for XCOFF files only
**\--syms** - Display the symbol table
**-t** - Alias for **\--syms**
**\--triple=**\<string\> - Target triple to disassemble for, see
**-version** for available targets
**-u** - Alias for **\--unwind-info**
**\--unwind-info** - Display unwind information
**\--wide** - Ignored for compatibility with GNU objdump
**-x** - Alias for **\--all-headers**
**-z** - Alias for **\--disassemble-zeroes**
Pass \@FILE as argument to read options from FILE.
# BUGS
Please submit bug reports online at https://github.com/AntelopeIO/cdt/issues
# SEE ALSO
For more details consult the full documentation and sources https://github.com/AntelopeIO/cdt
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
for file in cdt-*.1.md; do
pandoc "$file" -s -t man -o "${file%.md}"
done
+21
View File
@@ -0,0 +1,21 @@
# Roadmap for CDT
## Summary Milestone 5
Top priority is clean-up of the code and optimizing for support. Target Date for Milestone 5 is May/June 2024.
- Remove AntlerProj repos from build and archive AntlerProj
- Move to C++20 - allow contracts to compile C++20
- Vanilla Clang/LLVM
- Upgrade to LLVM
## Antler
We lack the resources to complete the Antler project and support it going forward. Removing dependencies will simplify the build process and simplify things.
## Move to C++20
Allow contracts to compile C++20. In addition to the benefits from the latest language features. Currently, ENF maintains an additional fork of one of our upstream dependencies for EOS EVM simply to get around the fact that the upstream assumes C++20 but we cannot build C++20 code in our contracts.
## Vanilla Clang/LLVM
Try eosio extension free llvm and if it works with no issues then remove extensions to Clang/LLVM. The hope we will enable us to use Vanilla versions of the packages. This will allow us to use the latest, and will lead to improvements in functionality and performance.
## Upgrade to LLVM 16
Upgrade to the latest
+9 -3
View File
@@ -5,8 +5,15 @@ project(cdt_libraries)
list(APPEND CMAKE_MODULE_PATH ${CDT_BIN})
include(CDTMacros)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall -no-missing-ricardian-clause")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -no-missing-ricardian-clause")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS ON)
@@ -14,7 +21,6 @@ set(CMAKE_CXX_EXTENSIONS ON)
add_subdirectory(libc)
add_subdirectory(libc++)
add_subdirectory(eosiolib)
add_subdirectory(boost)
add_subdirectory(rt)
if (ENABLE_NATIVE_COMPILER)
+3 -2
View File
@@ -4,6 +4,7 @@ file(GLOB HEADERS "*.hpp"
add_library(eosio
eosiolib.cpp
crypto.cpp
base64.cpp
${HEADERS})
add_library(eosio_malloc
@@ -27,8 +28,7 @@ target_include_directories(eosio PUBLIC
${CMAKE_SOURCE_DIR}/libc/cdt-musl/src/crypt
${CMAKE_SOURCE_DIR}/libc/cdt-musl/arch/eos
${CMAKE_SOURCE_DIR}/libc++/cdt-libcxx/include
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/boost/include)
${CMAKE_SOURCE_DIR})
target_link_libraries( eosio c c++ )
add_custom_command( TARGET eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio> ${BASE_BINARY_DIR}/lib )
@@ -41,6 +41,7 @@ if (ENABLE_NATIVE_COMPILER)
eosiolib.cpp
crypto.cpp
malloc.cpp
base64.cpp
${HEADERS})
add_dependencies( native_eosio eosio )
+189
View File
@@ -0,0 +1,189 @@
#include "core/eosio/base64.hpp"
namespace eosio::detail {
unsigned int pos_of_char(const unsigned char chr, bool url) {
// Return the position of chr within base64_encode()
constexpr unsigned char from_base64_chars[2][256] = {
{ // for base64
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
},
{ // for base64url
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 63,
64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
}};
auto c = from_base64_chars[url][chr];
eosio::check(c != 64, "encountered non-base64 character");
return c;
}
std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, bool url) {
const size_t len_encoded = (in_len +2) / 3 * 4;
const unsigned char trailing_char = '=';
// Includes performance improvement from unmerged PR: https://github.com/ReneNyffenegger/cpp-base64/pull/27
// Depending on the url parameter in base64_chars, one of
// two sets of base64 characters needs to be chosen.
// They differ in their last two characters.
const char* base64_chars[2] = {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"+/",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"-_"};
// Choose set of base64 characters. They differ
// for the last two positions, depending on the url
// parameter.
// A bool (as is the parameter url) is guaranteed
// to evaluate to either 0 or 1 in C++ therefore,
// the correct character set is chosen by subscripting
// base64_chars with url.
const char* base64_chars_ = base64_chars[url];
std::string ret;
ret.reserve(len_encoded);
unsigned int pos = 0;
while (pos < in_len) {
ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0xfc) >> 2]);
if (pos+1 < in_len) {
ret.push_back(base64_chars_[((bytes_to_encode[pos + 0] & 0x03) << 4) + ((bytes_to_encode[pos + 1] & 0xf0) >> 4)]);
if (pos+2 < in_len) {
ret.push_back(base64_chars_[((bytes_to_encode[pos + 1] & 0x0f) << 2) + ((bytes_to_encode[pos + 2] & 0xc0) >> 6)]);
ret.push_back(base64_chars_[ bytes_to_encode[pos + 2] & 0x3f]);
}
else {
ret.push_back(base64_chars_[(bytes_to_encode[pos + 1] & 0x0f) << 2]);
if (!url) ret.push_back(trailing_char);
}
}
else {
ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0x03) << 4]);
if (!url) ret.push_back(trailing_char);
if (!url) ret.push_back(trailing_char);
}
pos += 3;
}
return ret;
}
std::string base64_decode(std::string_view encoded_string, bool remove_linebreaks, bool url) {
if (encoded_string.empty()) return std::string{};
if (remove_linebreaks) {
std::string copy(encoded_string);
copy.erase(std::remove(copy.begin(), copy.end(), '\n'), copy.end());
return base64_decode(copy, false, url);
}
size_t length_of_string = encoded_string.length();
size_t pos = 0;
//
// The approximate length (bytes) of the decoded string might be one or
// two bytes smaller, depending on the amount of trailing equal signs
// in the encoded string. This approximation is needed to reserve
// enough space in the string to be returned.
//
size_t approx_length_of_decoded_string = length_of_string / 4 * 3;
std::string ret;
ret.reserve(approx_length_of_decoded_string);
while (pos < length_of_string) {
//
// Iterate over encoded input string in chunks. The size of all
// chunks except the last one is 4 bytes.
//
// The last chunk might be padded with equal signs or dots
// in order to make it 4 bytes in size as well, but this
// is not required as per RFC 2045.
//
// All chunks except the last one produce three output bytes.
//
// The last chunk produces at least one and up to three bytes.
//
eosio::check(pos+1 < length_of_string, "wrong encoded string size");
size_t pos_of_char_1 = pos_of_char(encoded_string.at(pos+1), url);
//
// Emit the first output byte that is produced in each chunk:
//
ret.push_back(static_cast<std::string::value_type>( ( (pos_of_char(encoded_string.at(pos+0), url) ) << 2 ) + ( (pos_of_char_1 & 0x30 ) >> 4)));
if ( ( pos + 2 < length_of_string ) && // Check for data that is not padded with equal signs (which is allowed by RFC 2045)
encoded_string.at(pos+2) != '=' &&
encoded_string.at(pos+2) != '.' // accept URL-safe base 64 strings, too, so check for '.' also.
)
{
//
// Emit a chunk's second byte (which might not be produced in the last chunk).
//
unsigned int pos_of_char_2 = pos_of_char(encoded_string.at(pos+2), url);
ret.push_back(static_cast<std::string::value_type>( (( pos_of_char_1 & 0x0f) << 4) + (( pos_of_char_2 & 0x3c) >> 2)));
if ( ( pos + 3 < length_of_string ) &&
encoded_string.at(pos+3) != '=' &&
encoded_string.at(pos+3) != '.'
)
{
//
// Emit a chunk's third byte (which might not be produced in the last chunk).
//
ret.push_back(static_cast<std::string::value_type>( ( (pos_of_char_2 & 0x03 ) << 6 ) + pos_of_char(encoded_string.at(pos+3), url)));
}
}
pos += 4;
}
return ret;
}
}//eosio::detail
+10
View File
@@ -168,6 +168,16 @@ uint64_t publication_time( void );
__attribute__((eosio_wasm_import))
capi_name current_receiver( void );
/**
* Get the hash of the code currently published on the given account
* @param account Name of the account to hash the code of
* @param struct_version Version specifying the desired format of the returned struct
* @param result_buffer Buffer wherein the result should be written
* @param buffer_size Size in bytes of result_buffer
*/
__attribute__((eosio_wasm_import))
uint32_t get_code_hash( uint64_t account, uint32_t struct_version, char* result_buffer, size_t buffer_size );
/**
* Set the action return value which will be included in the action_receipt
* @brief Set the action return value
+65
View File
@@ -0,0 +1,65 @@
#pragma once
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup call_c Call C API
* @ingroup c_api
* @brief Defines API for querying call object and making a sync call
*/
/**
* Make a sync call in the context of this call's parent action or parent call
*
* @param receiver - the name of the account that the sync call is made to
* @param flags - flags (bits) representing blockchain level requirements about
* the call. Currently LSB bit indicates read-only. All other bits
* are reserved to be 0
* @param data - the data of the sync call, which may include function name, arguments, and other information
* @return -1 if the receiver contract does not have sync call entry point or the entry point's signature is invalid, otherwise
* @return the number of bytes of the return value of the call. If the function is `void`, return `0`
*
*/
__attribute__((eosio_wasm_import))
int64_t call(capi_name receiver, uint64_t flags, const char* data, size_t data_size);
/**
* Copy up to `len` bytes of the return value of the most recent call to `mem`,
* in the context of this call's parent action or parent call
*
* @brief Copy the return value of the most recent call to the specified location
* @param mem - a pointer where up to `len` bytes of the return value will be copied
* @param len - length of the return value to be copied
* @return the number of bytes of the return value that can be retrieved (the number of total bytes of return value)
*/
__attribute__((eosio_wasm_import))
uint32_t get_call_return_value( void* mem, uint32_t len );
/**
* Copy up to `len` bytes of the current call data to `mem`
*
* @brief Copy current call data to the specified location
* @param mem - a pointer where up to `len` bytes of the current call data will be copied
* @param len - length of the current call data to be copied
* @return the number of bytes of the data that can be retrieved (the number of total bytes of the data)
*/
__attribute__((eosio_wasm_import))
uint32_t get_call_data( void* mem, uint32_t len );
/**
* Set the return value from `mem` with `len` bytes. This is to be retrieved by parent action
* or parent call using `get_call_return_value`
*
* @brief Copy the return value from the specified location
* @param mem - a pointer where `len` bytes of the return value will be copied from
*/
__attribute__((eosio_wasm_import))
void set_call_return_value( void* mem, uint32_t len );
#ifdef __cplusplus
}
#endif
/// @} call
@@ -0,0 +1,40 @@
#pragma once
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((eosio_wasm_import))
int32_t bls_g1_add(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g2_add(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g1_weighted_sum(const char* points, uint32_t points_len, const char* scalars, uint32_t scalars_len, uint32_t n, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g2_weighted_sum(const char* points, uint32_t points_len, const char* scalars, uint32_t scalars_len, uint32_t n, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_pairing(const char* g1_points, uint32_t g1_points_len, const char* g2_points, uint32_t g2_points_len, uint32_t n, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g1_map(const char* e, uint32_t e_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g2_map(const char* e, uint32_t e_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_fp_mod(const char* s, uint32_t s_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_fp_mul(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_fp_exp(const char* base, uint32_t base_len, const char* exp, uint32_t exp_len, char* res, uint32_t res_len);
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,27 @@
#pragma once
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup instant_finality_c Instant_finality C API
* @ingroup c_api
* @brief Defines %C Instant_finality API
*/
/**
* Submits a finalizer policy change to Instant Finality
*
* @param packed_finalizer_format - format of the finalizer_policy object, currently only supports 0
* @param data - pointer finalizer_policy object packed as bytes
* @param len - size of packed finalazer_policy object
* @pre `data` is a valid pointer to a range of memory at least `len` bytes long that contains packed abi_finalizer_policy data
* abi_finalizer_policy structure is defined in instant_finality.hpp
*/
__attribute__((eosio_wasm_import))
void set_finalizers( uint64_t packed_finalizer_format, const char* data, uint32_t len );
#ifdef __cplusplus
}
#endif
@@ -1,56 +0,0 @@
#pragma once
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Propose new participants to the security group.
*
* @param data - the buffer containing the packed participants.
* @param datalen - size of the packed participants
* @pre `data` is a valid pointer to a range of memory at least `datalen` bytes long that contains packed participants data
*
* @return -1 if proposing a new security group was unsuccessful, otherwise returns 0.
*/
__attribute__((eosio_wasm_import))
int64_t add_security_group_participants(const char* data, uint32_t datalen);
/**
* Propose to remove participants from the security group.
*
* @param data - the buffer containing the packed participants.
* @param datalen - size of the packed participants
* @pre `data` is a valid pointer to a range of memory at least `datalen` bytes long that contains packed participants data
*
* @return -1 if proposing a new security group was unsuccessful, otherwise returns 0.
*/
__attribute__((eosio_wasm_import))
int64_t remove_security_group_participants(const char* data, uint32_t datalen);
/**
* Check if the specified accounts are all in the active security group.
*
* @param data - the buffer containing the packed participants.
* @param datalen - size of the packed participants
*
* @return Returns true if the specified accounts are all in the active security group.
*/
__attribute__((eosio_wasm_import))
bool in_active_security_group(const char* data, uint32_t datalen);
/**
* Gets the active security group
*
* @param[out] data - the output buffer containing the packed security group.
* @param datalen - size of the `data` buffer
*
* @return Returns the size required in the buffer (if the buffer is too small, nothing is written).
*
*/
__attribute__((eosio_wasm_import))
uint32_t get_active_security_group(char* data, uint32_t datalen);
#ifdef __cplusplus
}
#endif
+63 -87
View File
@@ -4,18 +4,15 @@
*/
#pragma once
#include <cstdlib>
#include <type_traits>
#include "detail.hpp"
#include "../../core/eosio/serialize.hpp"
#include "../../core/eosio/datastream.hpp"
#include "../../core/eosio/name.hpp"
#include "../../core/eosio/ignore.hpp"
#include "../../core/eosio/fixed_bytes.hpp"
#include "../../core/eosio/time.hpp"
#include <boost/preprocessor/variadic/size.hpp>
#include <boost/preprocessor/variadic/to_tuple.hpp>
#include <boost/preprocessor/tuple/enum.hpp>
#include <boost/preprocessor/facilities/overload.hpp>
namespace eosio {
namespace internal_use_do_not_use {
@@ -52,9 +49,23 @@ namespace eosio {
__attribute__((eosio_wasm_import))
uint64_t current_receiver();
__attribute__((eosio_wasm_import))
uint32_t get_code_hash( uint64_t account, uint32_t struct_version, char* result_buffer, size_t buffer_size );
}
};
struct code_hash_result {
unsigned_int struct_version;
uint64_t code_sequence;
checksum256 code_hash;
uint8_t vm_type;
uint8_t vm_version;
CDT_REFLECT(struct_version, code_sequence, code_hash, vm_type, vm_version);
EOSLIB_SERIALIZE(code_hash_result, (struct_version)(code_sequence)(code_hash)(vm_type)(vm_version));
};
/**
* @defgroup action Action
* @ingroup contracts
@@ -150,6 +161,50 @@ namespace eosio {
return name{internal_use_do_not_use::current_receiver()};
}
/**
* Get the hash of the code currently published on the given account
* @param account Name of the account to hash the code of
* @param full_result Optional: If a full result struct is desired, a pointer to the struct to populate
* @return The SHA256 hash of the specified account's code
*/
inline checksum256 get_code_hash( name account, code_hash_result* full_result = nullptr ) {
if (full_result == nullptr)
full_result = (code_hash_result*)alloca(sizeof(code_hash_result));
constexpr size_t max_stack_buffer_size = 50;
// Packed size of this struct will virtually always be less than the struct size; always less after padding
auto struct_buffer_size = sizeof(code_hash_result);
char* struct_buffer = (char*)alloca(struct_buffer_size);
using VersionType = decltype(code_hash_result::struct_version);
const VersionType STRUCT_VERSION = 0;
auto response_size =
internal_use_do_not_use::get_code_hash(account.value, STRUCT_VERSION, struct_buffer, struct_buffer_size);
// Safety check: in this case, response size should never exceed our buffer, but just in case...
bool buffer_on_heap = false;
if (response_size > struct_buffer_size) {
// Slow path: allocate an adequate buffer and try again
// No need to deallocate struct_buffer since it was alloca'd
if (response_size > max_stack_buffer_size) {
struct_buffer = (char*)malloc(response_size);
buffer_on_heap = true;
} else {
struct_buffer = (char*)alloca(response_size);
}
internal_use_do_not_use::get_code_hash(account.value, STRUCT_VERSION, struct_buffer, struct_buffer_size);
}
check(unpack<VersionType>(struct_buffer, struct_buffer_size) == STRUCT_VERSION,
"Hypervisor returned unexpected code hash struct version");
unpack(*full_result, struct_buffer, struct_buffer_size);
// If struct_buffer is heap allocated, we must free it
if (buffer_on_heap)
free(struct_buffer);
return full_result->code_hash;
}
/**
* Copy up to length bytes of current action data to the specified location
*
@@ -354,84 +409,6 @@ namespace eosio {
};
namespace detail {
/// @cond INTERNAL
template <typename T>
struct unwrap { typedef T type; };
template <typename T>
struct unwrap<ignore<T>> { typedef T type; };
template <typename R, typename Act, typename... Args>
auto get_args(R(Act::*p)(Args...)) {
return std::tuple<std::decay_t<typename unwrap<Args>::type>...>{};
}
template <typename R, typename Act, typename... Args>
auto get_args_nounwrap(R(Act::*p)(Args...)) {
return std::tuple<std::decay_t<Args>...>{};
}
template <auto Action>
using deduced = decltype(get_args(Action));
template <auto Action>
using deduced_nounwrap = decltype(get_args_nounwrap(Action));
template <typename T>
struct convert { typedef T type; };
template <>
struct convert<const char*> { typedef std::string type; };
template <>
struct convert<char*> { typedef std::string type; };
template <typename T, typename U>
struct is_same { static constexpr bool value = std::is_convertible<T,U>::value; };
template <typename U>
struct is_same<bool,U> { static constexpr bool value = std::is_integral<U>::value; };
template <typename T>
struct is_same<T,bool> { static constexpr bool value = std::is_integral<T>::value; };
template <size_t N, size_t I, auto Arg, auto... Args>
struct get_nth_impl { static constexpr auto value = get_nth_impl<N,I+1,Args...>::value; };
template <size_t N, auto Arg, auto... Args>
struct get_nth_impl<N, N, Arg, Args...> { static constexpr auto value = Arg; };
template <size_t N, auto... Args>
struct get_nth { static constexpr auto value = get_nth_impl<N,0,Args...>::value; };
template <auto Action, size_t I, typename T, typename... Rest>
struct check_types {
static_assert(detail::is_same<typename convert<T>::type, typename convert<typename std::tuple_element<I, deduced<Action>>::type>::type>::value);
using type = check_types<Action, I+1, Rest...>;
static constexpr bool value = true;
};
template <auto Action, size_t I, typename T>
struct check_types<Action, I, T> {
static_assert(detail::is_same<typename convert<T>::type, typename convert<typename std::tuple_element<I, deduced<Action>>::type>::type>::value);
static constexpr bool value = true;
};
template <auto Action, typename... Ts>
constexpr bool type_check() {
static_assert(sizeof...(Ts) == std::tuple_size<deduced<Action>>::value);
if constexpr (sizeof...(Ts) != 0)
return check_types<Action, 0, Ts...>::value;
return true;
}
/// @endcond
}
/**
* Wrapper for an action object.
*
@@ -570,7 +547,7 @@ namespace eosio {
#define INLINE_ACTION_SENDER2( CONTRACT_CLASS, NAME )\
INLINE_ACTION_SENDER3( CONTRACT_CLASS, NAME, ::eosio::name(#NAME) )
#define INLINE_ACTION_SENDER(...) BOOST_PP_OVERLOAD(INLINE_ACTION_SENDER,__VA_ARGS__)(__VA_ARGS__)
#define INLINE_ACTION_SENDER(...) BLUEGRASS_META_OVERLOAD(INLINE_ACTION_SENDER,__VA_ARGS__)(__VA_ARGS__)
/**
* Send an inline-action from inside a contract.
@@ -599,5 +576,4 @@ INLINE_ACTION_SENDER3( CONTRACT_CLASS, NAME, ::eosio::name(#NAME) )
*/
#define SEND_INLINE_ACTION( CONTRACT, NAME, ... )\
INLINE_ACTION_SENDER(std::decay_t<decltype(CONTRACT)>, NAME)( (CONTRACT).get_self(),\
BOOST_PP_TUPLE_ENUM(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), BOOST_PP_VARIADIC_TO_TUPLE(__VA_ARGS__)) );
INLINE_ACTION_SENDER(std::decay_t<decltype(CONTRACT)>, NAME)( (CONTRACT).get_self(),__VA_ARGS__)
+158
View File
@@ -0,0 +1,158 @@
/**
* @file
*/
#pragma once
#include <cstdlib>
#include <type_traits>
#include "detail.hpp"
#include "../../core/eosio/serialize.hpp"
#include "../../core/eosio/datastream.hpp"
#include "../../core/eosio/name.hpp"
#include "../../core/eosio/hash_id.hpp"
namespace eosio {
namespace internal_use_do_not_use {
extern "C" {
__attribute__((eosio_wasm_import))
int64_t call(uint64_t receiver, uint64_t flags, const char* data, size_t data_size);
__attribute__((eosio_wasm_import))
uint32_t get_call_return_value( void* mem, uint32_t len );
__attribute__((eosio_wasm_import))
uint32_t get_call_data( void* mem, uint32_t len );
__attribute__((eosio_wasm_import))
void set_call_return_value( void* mem, uint32_t len );
}
};
/**
* @defgroup call call
* @ingroup contracts
* @brief Defines type-safe C++ wrappers for querying call and sending call
* @note There are some methods from the @ref call that can be used directly from C++
*/
inline int64_t call(eosio::name receiver, uint64_t flags, const char* data, size_t data_size) {
return internal_use_do_not_use::call(receiver.value, flags, data, data_size);
}
inline uint32_t get_call_return_value( void* mem, uint32_t len ) {
return internal_use_do_not_use::get_call_return_value(mem, len);
}
inline uint32_t get_call_data( void* mem, uint32_t len ) {
return internal_use_do_not_use::get_call_data(mem, len);
}
inline void set_call_return_value( void* mem, uint32_t len ) {
internal_use_do_not_use::set_call_return_value(mem, len);
}
// Indicate whether a sync call is read_write or read_only. Default is read_write
enum class access_mode { read_write = 0, read_only = 1 };
// Indicate the action to take if the receiver does not support sync calls.
// Default is abort_op
enum class support_mode { abort_op = 0, no_op = 1 };
// For a void function, when support_mode is set to no_op, the call_wrapper.
// returns `std::optional<void_call>`. If the optional has no value, it indicates
// the call was op-op; if the optional has a value of `void_call`, the call
// executed successfully.
struct void_call {
};
struct call_data_header {
uint32_t version = 0;
uint64_t func_name = 0; // At WASM level, function name is a short ID of uint64_t.
EOSLIB_SERIALIZE(call_data_header, (version)(func_name))
};
/**
* Wrapper for simplifying making a sync call
*
* @brief Used to wrap a particular sync call to simplify the process of other contracts making sync calls to the "wrapped" call.
* Example:
* @code
* // defined by contract writer of the sync call functions
* using get_func = call_wrapper<"get"_i, &callee::get>;
* // usage by different contract writer
* get_func{"callee"_n}();
* // or
* get_func get{"callee"_n};
* get();
* @endcode
*/
template <eosio::hash_id::raw Func_Name, auto Func_Ref, access_mode Access_Mode=access_mode::read_write, support_mode Support_Mode = support_mode::abort_op>
struct call_wrapper {
template <typename Receiver>
constexpr call_wrapper(Receiver&& receiver)
: receiver(std::forward<Receiver>(receiver))
{}
static constexpr eosio::hash_id function_name = eosio::hash_id(Func_Name);
eosio::name receiver {};
using orig_ret_type = typename detail::function_traits<decltype(Func_Ref)>::return_type;
using return_type = std::conditional_t<
Support_Mode == support_mode::abort_op,// if Support_Mode is abort_op
orig_ret_type, // use the original return type
std::conditional_t< // else
std::is_void<orig_ret_type>::value, // original return type is void
std::optional<void_call>, // use optional of empty struct
std::optional<orig_ret_type> // use optional of original return type
>
>;
template <typename... Args>
return_type operator()(Args&&... args)const {
static_assert(detail::type_check<Func_Ref, Args...>());
uint64_t flags = 0x00;
if constexpr (Access_Mode == access_mode::read_only) {
flags = 0x01;
}
call_data_header header{ .version = 0,
.func_name = function_name.id };
const std::vector<char> data{ pack(std::forward_as_tuple(header, detail::deduced<Func_Ref>{std::forward<Args>(args)...})) };
auto ret_val_size = internal_use_do_not_use::call(receiver.value, flags, data.data(), data.size());
if (ret_val_size < 0) { // the receiver does not support sync calls
if constexpr (Support_Mode == support_mode::abort_op) {
check(false, "receiver does not support sync call but support_mode is set to abort_op");
} else {
return std::nullopt;
}
}
// The sync call has been executed by the receiver
if constexpr (std::is_void<return_type>::value) {
return;
} else {
if constexpr (Support_Mode == support_mode::no_op && std::is_void<orig_ret_type>::value) {
return void_call{};
} else {
constexpr size_t max_stack_buffer_size = 512;
char* buffer = (char*)(max_stack_buffer_size < ret_val_size ? malloc(ret_val_size) : alloca(ret_val_size)); // intentionally no `free()` is called. the memory will be freed at the end of callers wasm execution.
internal_use_do_not_use::get_call_return_value(buffer, ret_val_size);
orig_ret_type ret_val = unpack<orig_ret_type>(buffer, ret_val_size);
if constexpr (Support_Mode == support_mode::no_op) {
return std::make_optional(ret_val);
} else {
return ret_val;
}
}
}
}
};
} // namespace eosio
@@ -29,6 +29,12 @@ namespace eosio {
*/
class contract {
public:
enum class exec_type_t : uint8_t {
action,
call,
unknown
};
/**
* Construct a new contract given the contract name
*
@@ -75,7 +81,27 @@ class contract {
*/
inline const datastream<const char*>& get_datastream()const { return _ds; }
/**
* Whether this contract is for a sync call
*
* @return bool - Whether this contract is for a sync call
*/
inline bool is_sync_call()const {
check(_exec_type != exec_type_t::unknown, "too early to call is_sync_call(). _exec_type has not been set yet");
return (_exec_type == exec_type_t::call);
}
/**
* Set the exectution type.
*
* @param type - The exectution type to be set.
*/
inline void set_exec_type(exec_type_t type) {
_exec_type = type;
}
protected:
/**
* The name of the account this contract is deployed on.
*/
@@ -90,5 +116,10 @@ class contract {
* The datastream for this contract
*/
datastream<const char*> _ds = datastream<const char*>(nullptr, 0);
/**
* The execution type: action or sync call
*/
exec_type_t _exec_type = exec_type_t::unknown;
};
}
@@ -0,0 +1,138 @@
/**
* @file
* @copyright defined in eos/LICENSE
*/
#pragma once
#include "system.hpp"
#include "transaction.hpp"
#include "../../core/eosio/serialize.hpp"
#include <vector>
namespace eosio {
namespace internal_use_do_not_use {
extern "C" {
__attribute__((eosio_wasm_import))
void send_deferred(const uint128_t&, uint64_t, const char*, size_t, uint32_t);
__attribute__((eosio_wasm_import))
int cancel_deferred(const uint128_t&);
}
}
/**
* @defgroup deferred_transaction Transaction
* @ingroup contracts
* @brief Type-safe C++ wrappers for transaction C API
*
* deferred_transaction is no longer supported on Vaulta. This class is provided to
* support legacy test contracts that use deferred transactions.
*
* @details An inline message allows one contract to send another contract a message
* which is processed immediately after the current message's processing
* ends such that the success or failure of the parent transaction is
* dependent on the success of the message. If an inline message fails in
* processing then the whole tree of transactions and actions rooted in the
* block will me marked as failing and none of effects on the database will
* persist.
*
* Inline actions and Deferred transactions must adhere to the permissions
* available to the parent transaction or, in the future, delegated to the
* contract account for future use.
*
* @note There are some methods from the @ref transactioncapi that can be used directly from C++
*/
/**
* Class transaction contains the actions, context_free_actions and extensions type for a transaction
*
* @ingroup transaction
*/
class deferred_transaction : public transaction {
public:
/**
* Construct a new deferred_transaction with an expiration of now + 60 seconds.
*/
deferred_transaction(time_point_sec exp = time_point_sec(current_time_point()) + 60) : transaction( exp ) {}
/**
* Sends this transaction, packs the transaction then sends it as a deferred transaction
*
* @details Writes the symbol_code as a string to the provided char buffer
* @param sender_id - ID of sender
* @param payer - Account paying for RAM
* @param replace_existing - Defaults to false, if this is `0`/false then if the provided sender_id is already in use by an in-flight transaction from this contract, which will be a failing assert. If `1` then transaction will atomically cancel/replace the inflight transaction
*/
void send(const uint128_t& sender_id, name payer, bool replace_existing = false) const {
auto serialize = pack(*static_cast<const transaction*>(this));
internal_use_do_not_use::send_deferred(sender_id, payer.value, serialize.data(), serialize.size(), replace_existing);
}
};
/**
* Struct onerror contains and sender id and packed transaction
*
* @ingroup transaction
*/
struct onerror {
uint128_t sender_id;
std::vector<char> sent_trx;
/**
* from_current_action unpacks and returns a onerror struct
*
* @ingroup transaction
*/
static onerror from_current_action() {
return unpack_action_data<onerror>();
}
/**
* Unpacks and returns a transaction
*/
transaction unpack_sent_trx() const {
return unpack<transaction>(sent_trx);
}
EOSLIB_SERIALIZE( onerror, (sender_id)(sent_trx) )
};
/**
* Send a deferred transaction
*
* @ingroup transaction
* @param sender_id - Account name of the sender of this deferred transaction
* @param payer - Account name responsible for paying the RAM for this deferred transaction
* @param serialized_transaction - The packed transaction to be deferred
* @param size - The size of the packed transaction, required for persistence.
* @param replace - If true, will replace an existing transaction.
*/
inline void send_deferred(const uint128_t& sender_id, name payer, const char* serialized_transaction, size_t size, bool replace = false) {
internal_use_do_not_use::send_deferred(sender_id, payer.value, serialized_transaction, size, replace);
}
/**
* Cancels a deferred transaction.
*
* @ingroup transaction
* @param sender_id - The id of the sender
*
* @pre The deferred transaction ID exists.
* @pre The deferred transaction ID has not yet been published.
* @post Deferred transaction canceled.
*
* @return 1 if transaction was canceled, 0 if transaction was not found
*
* Example:
*
* @code
* id = 0xffffffffffffffff
* cancel_deferred( id );
* @endcode
*/
inline int cancel_deferred(const uint128_t& sender_id) {
return internal_use_do_not_use::cancel_deferred(sender_id);
}
}
@@ -0,0 +1,99 @@
#pragma once
#include "../../core/eosio/ignore.hpp"
namespace eosio { namespace detail {
/// @cond INTERNAL
template <typename T>
struct unwrap { typedef T type; };
template <typename T>
struct unwrap<ignore<T>> { typedef T type; };
template <typename R, typename Act, typename... Args>
auto get_args(R(Act::*p)(Args...)) {
return std::tuple<std::decay_t<typename unwrap<Args>::type>...>{};
}
template <typename R, typename Act, typename... Args>
auto get_args_nounwrap(R(Act::*p)(Args...)) {
return std::tuple<std::decay_t<Args>...>{};
}
template <auto Function>
using deduced = decltype(get_args(Function));
template <auto Function>
using deduced_nounwrap = decltype(get_args_nounwrap(Function));
template <typename T>
struct convert { typedef T type; };
template <>
struct convert<const char*> { typedef std::string type; };
template <>
struct convert<char*> { typedef std::string type; };
template <typename T, typename U>
struct is_same { static constexpr bool value = std::is_convertible<T,U>::value; };
template <typename U>
struct is_same<bool,U> { static constexpr bool value = std::is_integral<U>::value; };
template <typename T>
struct is_same<T,bool> { static constexpr bool value = std::is_integral<T>::value; };
// Full specialization to resolve ambiguity introduced by partial specializations
// of is_same<bool,U> and is_same<T,bool>
template <>
struct is_same<bool, bool> { static constexpr bool value = true; };
template <size_t N, size_t I, auto Arg, auto... Args>
struct get_nth_impl { static constexpr auto value = get_nth_impl<N,I+1,Args...>::value; };
template <size_t N, auto Arg, auto... Args>
struct get_nth_impl<N, N, Arg, Args...> { static constexpr auto value = Arg; };
template <size_t N, auto... Args>
struct get_nth { static constexpr auto value = get_nth_impl<N,0,Args...>::value; };
template <auto Function, size_t I, typename T, typename... Rest>
struct check_types {
static_assert(detail::is_same<typename convert<T>::type, typename convert<typename std::tuple_element<I, deduced<Function>>::type>::type>::value);
using type = check_types<Function, I+1, Rest...>;
static constexpr bool value = true;
};
template <auto Function, size_t I, typename T>
struct check_types<Function, I, T> {
static_assert(detail::is_same<typename convert<T>::type, typename convert<typename std::tuple_element<I, deduced<Function>>::type>::type>::value);
static constexpr bool value = true;
};
template <auto Function, typename... Ts>
constexpr bool type_check() {
static_assert(sizeof...(Ts) == std::tuple_size<deduced<Function>>::value);
if constexpr (sizeof...(Ts) != 0)
return check_types<Function, 0, Ts...>::value;
return true;
}
// For non-function-pointers (function_traits is undefined)
template <typename T>
struct function_traits;
// For non-const member function
template <typename Class, typename Ret, typename... Args>
struct function_traits<Ret (Class::*)(Args...)> {
using return_type = Ret;
};
// For const member function
template <typename Class, typename Ret, typename... Args>
struct function_traits<Ret (Class::*)(Args...) const> {
using return_type = Ret;
};
/// @endcond
}} // eosio detail
@@ -1,10 +1,8 @@
#pragma once
#include "action.hpp"
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/include/std_tuple.hpp>
#include <boost/mp11/tuple.hpp>
#include <bluegrass/meta/preprocessor.hpp>
#include <tuple>
namespace eosio {
@@ -85,7 +83,7 @@ namespace eosio {
((&inst)->*func)( a... );
};
boost::mp11::tuple_apply( f2, args );
std::apply( f2, args );
if ( max_stack_buffer_size < size ) {
free(buffer);
}
@@ -95,14 +93,14 @@ namespace eosio {
/// @cond INTERNAL
// Helper macro for EOSIO_DISPATCH_INTERNAL
#define EOSIO_DISPATCH_INTERNAL( r, OP, elem ) \
case eosio::name( BOOST_PP_STRINGIZE(elem) ).value: \
#define EOSIO_DISPATCH_INTERNAL( OP, elem ) \
case eosio::name( BLUEGRASS_META_STRINGIZE(elem) ).value: \
eosio::execute_action( eosio::name(receiver), eosio::name(code), &OP::elem ); \
break;
// Helper macro for EOSIO_DISPATCH
#define EOSIO_DISPATCH_HELPER( TYPE, MEMBERS ) \
BOOST_PP_SEQ_FOR_EACH( EOSIO_DISPATCH_INTERNAL, TYPE, MEMBERS )
BLUEGRASS_META_FOREACH_SEQ( EOSIO_DISPATCH_INTERNAL, TYPE, MEMBERS )
/// @endcond
@@ -0,0 +1,51 @@
#pragma once
#include "../../capi/eosio/types.h"
#include "../../core/eosio/crypto_bls_ext.hpp"
#include <string>
#include <vector>
/**
* @defgroup instant_finality Instant_finality
* @ingroup instant_finality
* @ingroup contracts
* @brief Defines C++ Instant Finality API
*/
namespace eosio {
namespace internal_use_do_not_use {
extern "C" {
__attribute__((eosio_wasm_import))
void set_finalizers( uint64_t packed_finalizer_format, const char* data, uint32_t len );
} // extern "C"
} //internal_use_do_not_use
struct finalizer_authority {
std::string description;
uint64_t weight = 0; // weight that this finalizer's vote has for meeting threshold
std::vector<char> public_key; // Affine little endian non-montgomery g1
EOSLIB_SERIALIZE(finalizer_authority, (description)(weight)(public_key));
};
struct finalizer_policy {
uint64_t threshold = 0;
std::vector<finalizer_authority> finalizers;
EOSLIB_SERIALIZE(finalizer_policy, (threshold)(finalizers));
};
/**
* Submits a finalizer policy change to Instant Finality
*
* @param finalizer_policy - finalizer policy to be set
*/
inline void set_finalizers( const finalizer_policy& finalizer_policy ) {
for (const auto& finalizer : finalizer_policy.finalizers)
eosio::check(finalizer.public_key.size() == sizeof(bls_g1), "public key has a wrong size" );
auto packed = eosio::pack(finalizer_policy);
// 0 is packed format, currently only 0 is supported
internal_use_do_not_use::set_finalizers(0, packed.data(), packed.size());
}
} //eosio
@@ -9,9 +9,10 @@
#include "../../core/eosio/serialize.hpp"
#include "../../core/eosio/fixed_bytes.hpp"
#include <bluegrass/meta/for_each.hpp>
#include <vector>
#include <tuple>
#include <boost/hana.hpp>
#include <functional>
#include <utility>
#include <type_traits>
@@ -303,8 +304,6 @@ struct secondary_key_traits<TYPE> {\
namespace _multi_index_detail {
namespace hana = boost::hana;
template<typename T>
struct secondary_index_db_functions;
@@ -335,6 +334,10 @@ namespace _multi_index_detail {
static constexpr eosio::fixed_bytes<32> true_lowest() { return eosio::fixed_bytes<32>(); }
};
template<typename PK>
inline uint64_t to_raw_key(PK pk) { return pk; }
inline uint64_t to_raw_key(eosio::name pk) { return pk.value; }
}
/**
@@ -342,7 +345,7 @@ namespace _multi_index_detail {
*
* @ingroup multiindex
* @tparam IndexName - is the name of the index. The name must be provided as an EOSIO base32 encoded 64-bit integer and must conform to the EOSIO naming requirements of a maximum of 13 characters, the first twelve from the lowercase characters a-z, digits 1-5, and ".", and if there is a 13th character, it is restricted to lowercase characters a-p and ".".
* @tparam Extractor - is a function call operator that takes a const reference to the table object type and returns either a secondary key type or a reference to a secondary key type. It is recommended to use the `eosio::const_mem_fun` template, which is a type alias to the `boost::multi_index::const_mem_fun`. See the documentation for the Boost `const_mem_fun` key extractor for more details.
* @tparam Extractor - is a function call operator that takes a const reference to the table object type and returns either a secondary key type or a reference to a secondary key type. It is recommended to use the `eosio::const_mem_fun` template.
*
* Example:
*
@@ -436,6 +439,8 @@ class multi_index
{
private:
static_assert( std::is_same_v<decltype(_multi_index_detail::to_raw_key(std::declval<T>().primary_key())), uint64_t>,
"Primary key must be uint64_t or name" );
static_assert( sizeof...(Indices) <= 16, "multi_index only supports a maximum of 16 secondary indices" );
constexpr static bool validate_table_name( name n ) {
@@ -748,6 +753,8 @@ class multi_index
static auto extract_secondary_key(const T& obj) { return secondary_extractor_type()(obj); }
// used only for type deduction
constexpr index() : _multidx(nullptr) { }
private:
friend class multi_index;
@@ -759,32 +766,37 @@ class multi_index
template<uint64_t I>
struct intc { enum e{ value = I }; operator uint64_t()const{ return I; } };
enum index_cv { const_index = 0, mutable_index = 1 };
static constexpr auto transform_indices( ) {
using namespace _multi_index_detail;
template<std::size_t Num, typename... Values>
class make_index_tuple {
typedef decltype( hana::zip_shortest(
hana::make_tuple( intc<0>(), intc<1>(), intc<2>(), intc<3>(), intc<4>(), intc<5>(),
intc<6>(), intc<7>(), intc<8>(), intc<9>(), intc<10>(), intc<11>(),
intc<12>(), intc<13>(), intc<14>(), intc<15>() ),
hana::tuple<Indices...>() ) ) indices_input_type;
template <std::size_t... Seq>
static constexpr auto get_type(std::index_sequence<Seq...>) {
return std::make_tuple(std::make_tuple(index<eosio::name::raw(static_cast<uint64_t>(Values::index_name)),
typename Values::secondary_extractor_type,
intc<Seq>::e::value, const_index>{},
index<eosio::name::raw(static_cast<uint64_t>(Values::index_name)),
typename Values::secondary_extractor_type,
intc<Seq>::e::value, mutable_index>{})...);
}
public:
using type = decltype( get_type(std::make_index_sequence<Num>{}) );
};
return hana::transform( indices_input_type(), [&]( auto&& idx ){
typedef typename std::decay<decltype(hana::at_c<0>(idx))>::type num_type;
typedef typename std::decay<decltype(hana::at_c<1>(idx))>::type idx_type;
return hana::make_tuple( hana::type_c<index<eosio::name::raw(static_cast<uint64_t>(idx_type::index_name)),
typename idx_type::secondary_extractor_type,
num_type::e::value, false> >,
hana::type_c<index<eosio::name::raw(static_cast<uint64_t>(idx_type::index_name)),
typename idx_type::secondary_extractor_type,
num_type::e::value, true> > );
});
}
typedef decltype( multi_index::transform_indices() ) indices_type;
indices_type _indices;
using indices_type = typename make_index_tuple<sizeof... (Indices), Indices...>::type;
class make_extractor_tuple {
template <typename Obj, typename IndicesType, std::size_t... Seq>
static constexpr auto extractor_tuple(IndicesType, const Obj& obj, std::index_sequence<Seq...>) {
return std::make_tuple(std::tuple_element_t<const_index, std::tuple_element_t<Seq, IndicesType>>::extract_secondary_key(obj)...);
}
public:
template <typename Obj, typename IndicesType>
static constexpr auto get_extractor_tuple(IndicesType, const Obj& obj) {
return extractor_tuple(IndicesType{}, obj, std::make_index_sequence<std::tuple_size_v<IndicesType>>{});
}
};
const item& load_object_by_primary_iterator( int32_t itr )const {
using namespace _multi_index_detail;
@@ -810,15 +822,14 @@ class multi_index
ds >> val;
i.__primary_itr = itr;
hana::for_each( _indices, [&]( auto& idx ) {
typedef typename decltype(+hana::at_c<1>(idx))::type index_type;
bluegrass::meta::for_each(indices_type{}, [&](auto idx){
typedef std::tuple_element_t<const_index, decltype(idx)> index_type;
i.__iters[ index_type::number() ] = -1;
});
});
const item* ptr = itm.get();
auto pk = itm->primary_key();
auto pk = _multi_index_detail::to_raw_key(itm->primary_key());
auto pitr = itm->__primary_itr;
_items_vector.emplace_back( std::move(itm), pk, pitr );
@@ -850,7 +861,7 @@ class multi_index
* - `Indices` is a list of up to 16 secondary indices.
* - Each must be a default constructable class or struct
* - Each must have a function call operator that takes a const reference to the table object type and returns either a secondary key type or a reference to a secondary key type
* - It is recommended to use the eosio::const_mem_fun template, which is a type alias to the boost::multi_index::const_mem_fun. See the documentation for the Boost const_mem_fun key extractor for more details.
* - It is recommended to use the eosio::const_mem_fun template
*
* Example:
*
@@ -1266,8 +1277,10 @@ class multi_index
* EOSIO_DISPATCH( addressbook, (myaction) )
* @endcode
*/
const_iterator lower_bound( uint64_t primary )const {
auto itr = internal_use_do_not_use::db_lowerbound_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary );
template<typename PK>
const_iterator lower_bound( PK primary )const {
uint64_t primary_int = _multi_index_detail::to_raw_key(primary);
auto itr = internal_use_do_not_use::db_lowerbound_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary_int );
if( itr < 0 ) return end();
const auto& obj = load_object_by_primary_iterator( itr );
return {this, &obj};
@@ -1310,8 +1323,10 @@ class multi_index
* EOSIO_DISPATCH( addressbook, (myaction) )
* @endcode
*/
const_iterator upper_bound( uint64_t primary )const {
auto itr = internal_use_do_not_use::db_upperbound_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary );
template<typename PK>
const_iterator upper_bound( PK primary )const {
uint64_t primary_int = _multi_index_detail::to_raw_key(primary);
auto itr = internal_use_do_not_use::db_upperbound_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary_int );
if( itr < 0 ) return end();
const auto& obj = load_object_by_primary_iterator( itr );
return {this, &obj};
@@ -1412,13 +1427,13 @@ class multi_index
auto get_index() {
using namespace _multi_index_detail;
auto res = hana::find_if( _indices, []( auto&& in ) {
return std::integral_constant<bool, static_cast<uint64_t>(std::decay<typename decltype(+hana::at_c<0>(in))::type>::type::index_name) == static_cast<uint64_t>(IndexName)>();
constexpr uint64_t index_num = bluegrass::meta::for_each(indices_type{}, [](auto idx){
return std::tuple_element_t<const_index, decltype(idx)>::index_name == static_cast<uint64_t>(IndexName);
});
static_assert( res != hana::nothing, "name provided is not the name of any secondary index within multi_index" );
static_assert( index_num < sizeof...(Indices), "name provided is not the name of any secondary index within multi_index" );
return typename decltype(+hana::at_c<0>(res.value()))::type(this);
return std::tuple_element_t<const_index, std::tuple_element_t<index_num, indices_type>>(this);
}
/**
@@ -1463,13 +1478,13 @@ class multi_index
auto get_index()const {
using namespace _multi_index_detail;
auto res = hana::find_if( _indices, []( auto&& in ) {
return std::integral_constant<bool, static_cast<uint64_t>(std::decay<typename decltype(+hana::at_c<1>(in))::type>::type::index_name) == static_cast<uint64_t>(IndexName)>();
constexpr uint64_t index_num = bluegrass::meta::for_each(indices_type{}, [](auto idx){
return std::tuple_element_t<mutable_index, decltype(idx)>::index_name == static_cast<uint64_t>(IndexName);
});
static_assert( res != hana::nothing, "name provided is not the name of any secondary index within multi_index" );
static_assert( index_num < sizeof...(Indices), "name provided is not the name of any secondary index within multi_index" );
return typename decltype(+hana::at_c<1>(res.value()))::type(this);
return std::tuple_element_t<mutable_index, std::tuple_element_t<index_num, indices_type>>(this);
}
/**
@@ -1571,7 +1586,7 @@ class multi_index
datastream<char*> ds( (char*)buffer, size );
ds << obj;
auto pk = obj.primary_key();
uint64_t pk = _multi_index_detail::to_raw_key(obj.primary_key());
i.__primary_itr = internal_use_do_not_use::db_store_i64( _scope, static_cast<uint64_t>(TableName), payer.value, pk, buffer, size );
@@ -1582,15 +1597,15 @@ class multi_index
if( pk >= _next_primary_key )
_next_primary_key = (pk >= no_available_primary_key) ? no_available_primary_key : (pk + 1);
hana::for_each( _indices, [&]( auto& idx ) {
typedef typename decltype(+hana::at_c<0>(idx))::type index_type;
bluegrass::meta::for_each(indices_type{}, [&](auto idx){
typedef std::tuple_element_t<const_index, decltype(idx)> index_type;
i.__iters[index_type::number()] = secondary_index_db_functions<typename index_type::secondary_key_type>::db_idx_store( _scope, index_type::name(), payer.value, obj.primary_key(), index_type::extract_secondary_key(obj) );
i.__iters[index_type::number()] = secondary_index_db_functions<typename index_type::secondary_key_type>::db_idx_store( _scope, index_type::name(), payer.value, obj.primary_key(), index_type::extract_secondary_key(obj) );
});
});
const item* ptr = itm.get();
auto pk = itm->primary_key();
auto pk = _multi_index_detail::to_raw_key(itm->primary_key());
auto pitr = itm->__primary_itr;
_items_vector.emplace_back( std::move(itm), pk, pitr );
@@ -1695,18 +1710,14 @@ class multi_index
auto& mutableitem = const_cast<item&>(objitem);
eosio::check( _code == current_receiver(), "cannot modify objects in table of another contract" ); // Quick fix for mutating db using multi_index that shouldn't allow mutation. Real fix can come in RC2.
auto secondary_keys = hana::transform( _indices, [&]( auto&& idx ) {
typedef typename decltype(+hana::at_c<0>(idx))::type index_type;
auto secondary_keys = make_extractor_tuple::get_extractor_tuple(indices_type{}, obj);
return index_type::extract_secondary_key( obj );
});
auto pk = obj.primary_key();
uint64_t pk = _multi_index_detail::to_raw_key(obj.primary_key());
auto& mutableobj = const_cast<T&>(obj); // Do not forget the auto& otherwise it would make a copy and thus not update at all.
updater( mutableobj );
eosio::check( pk == obj.primary_key(), "updater cannot change primary key when modifying an object" );
eosio::check( pk == _multi_index_detail::to_raw_key(obj.primary_key()), "updater cannot change primary key when modifying an object" );
size_t size = pack_size( obj );
//using malloc/free here potentially is not exception-safe, although WASM doesn't support exceptions
@@ -1724,11 +1735,10 @@ class multi_index
if( pk >= _next_primary_key )
_next_primary_key = (pk >= no_available_primary_key) ? no_available_primary_key : (pk + 1);
hana::for_each( _indices, [&]( auto& idx ) {
typedef typename decltype(+hana::at_c<0>(idx))::type index_type;
bluegrass::meta::for_each(indices_type{}, [&](auto idx){
typedef std::tuple_element_t<const_index, decltype(idx)> index_type;
auto secondary = index_type::extract_secondary_key( obj );
if( memcmp( &hana::at_c<index_type::index_number>(secondary_keys), &secondary, sizeof(secondary) ) != 0 ) {
if( memcmp( &std::get<index_type::index_number>(secondary_keys), &secondary, sizeof(secondary) ) != 0 ) {
auto indexitr = mutableitem.__iters[index_type::number()];
if( indexitr < 0 ) {
@@ -1739,7 +1749,7 @@ class multi_index
secondary_index_db_functions<typename index_type::secondary_key_type>::db_idx_update( indexitr, payer.value, secondary );
}
});
} );
}
/**
@@ -1774,7 +1784,8 @@ class multi_index
* The most common mistake is when the local variable is defined as auto
* typename, instead it should be of type auto& or decltype(auto).
*/
const T& get( uint64_t primary, const char* error_msg = "unable to find key" )const {
template<typename PK>
const T& get( PK primary, const char* error_msg = "unable to find key" )const {
auto result = find( primary );
eosio::check( result != cend(), error_msg );
return *result;
@@ -1803,14 +1814,16 @@ class multi_index
* EOSIO_DISPATCH( addressbook, (myaction) )
* @endcode
*/
const_iterator find( uint64_t primary )const {
template<typename PK>
const_iterator find( PK primary )const {
auto itr2 = std::find_if(_items_vector.rbegin(), _items_vector.rend(), [&](const item_ptr& ptr) {
return ptr._item->primary_key() == primary;
});
if( itr2 != _items_vector.rend() )
return iterator_to(*(itr2->_item));
auto itr = internal_use_do_not_use::db_find_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary );
uint64_t primary_int = _multi_index_detail::to_raw_key(primary);
auto itr = internal_use_do_not_use::db_find_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary_int );
if( itr < 0 ) return end();
const item& i = load_object_by_primary_iterator( itr );
@@ -1826,14 +1839,16 @@ class multi_index
* @return An iterator to the found object which has a primary key equal to `primary` OR throws an exception if an object with primary key `primary` is not found.
*/
const_iterator require_find( uint64_t primary, const char* error_msg = "unable to find key" )const {
template<typename PK>
const_iterator require_find( PK primary, const char* error_msg = "unable to find key" )const {
auto itr2 = std::find_if(_items_vector.rbegin(), _items_vector.rend(), [&](const item_ptr& ptr) {
return ptr._item->primary_key() == primary;
});
if( itr2 != _items_vector.rend() )
return iterator_to(*(itr2->_item));
auto itr = internal_use_do_not_use::db_find_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary );
uint64_t primary_int = _multi_index_detail::to_raw_key(primary);
auto itr = internal_use_do_not_use::db_find_i64( _code.value, _scope, static_cast<uint64_t>(TableName), primary_int );
eosio::check( itr >= 0, error_msg );
const item& i = load_object_by_primary_iterator( itr );
@@ -1935,8 +1950,8 @@ class multi_index
internal_use_do_not_use::db_remove_i64( objitem.__primary_itr );
hana::for_each( _indices, [&]( auto& idx ) {
typedef typename decltype(+hana::at_c<0>(idx))::type index_type;
bluegrass::meta::for_each(indices_type{}, [&](auto idx){
typedef std::tuple_element_t<const_index, decltype(idx)> index_type;
auto i = objitem.__iters[index_type::number()];
if( i < 0 ) {
@@ -1,86 +0,0 @@
#pragma once
#include <set>
#include "../../core/eosio/name.hpp"
#include "../../core/eosio/serialize.hpp"
namespace eosio {
namespace internal_use_do_not_use {
extern "C" {
__attribute__((eosio_wasm_import)) int64_t add_security_group_participants(const char* data, uint32_t datalen);
__attribute__((eosio_wasm_import)) int64_t remove_security_group_participants(const char* data, uint32_t datalen);
__attribute__((eosio_wasm_import)) bool in_active_security_group(const char* data, uint32_t datalen);
__attribute__((eosio_wasm_import)) uint32_t get_active_security_group(char* data, uint32_t datalen);
}
} // namespace internal_use_do_not_use
/**
* @defgroup security_group Security Group
* @ingroup contracts
* @brief Defines C++ security group API
*/
struct security_group {
uint32_t version;
std::set<name> participants;
CDT_REFLECT(version, participants);
};
/**
* Propose new participants to the security group.
*
* @ingroup security_group
* @param participants - the participants.
*
* @return -1 if proposing a new security group was unsuccessful, otherwise returns 0.
*/
inline int64_t add_security_group_participants(const std::set<name>& participants) {
auto packed_participants = eosio::pack( participants );
return internal_use_do_not_use::add_security_group_participants( packed_participants.data(), packed_participants.size() );
}
/**
* Propose to remove participants from the security group.
* @ingroup security_group
* @param participants - the participants.
* @return -1 if proposing a new security group was unsuccessful, otherwise returns 0.
*/
inline int64_t remove_security_group_participants(const std::set<name>& participants){
auto packed_participants = eosio::pack( participants );
return internal_use_do_not_use::remove_security_group_participants( packed_participants.data(), packed_participants.size() );
}
/**
* Check if the specified accounts are all in the active security group.
*
* @ingroup security_group
* @param participants - the participants.
*
* @return Returns true if the specified accounts are all in the active security group.
*/
inline bool in_active_security_group(const std::set<name>& participants){
auto packed_participants = eosio::pack( participants );
return internal_use_do_not_use::in_active_security_group( packed_participants.data(), packed_participants.size() );
}
/**
* Gets the active security group
*
* @ingroup security_group
* @param[out] packed_security_group - the buffer containing the packed security_group.
*
* @return Returns the size required in the buffer (if the buffer is too small, nothing is written).
*
*/
inline security_group get_active_security_group() {
size_t buffer_size = internal_use_do_not_use::get_active_security_group(0, 0);
std::vector<char> buffer(buffer_size);
internal_use_do_not_use::get_active_security_group(buffer.data(), buffer_size);
return eosio::unpack<security_group>(buffer);
}
} // namespace eosio
@@ -62,7 +62,7 @@ namespace eosio {
* @return true - if exists
* @return false - otherwise
*/
bool exists() {
bool exists() const {
return _t.find( pk_value ) != _t.end();
}
@@ -72,7 +72,7 @@ namespace eosio {
* @brief Get the value stored inside the singleton table
* @return T - The value stored
*/
T get() {
T get() const {
auto itr = _t.find( pk_value );
eosio::check( itr != _t.end(), "singleton does not exist" );
return itr->value;
@@ -84,7 +84,7 @@ namespace eosio {
* @param def - The default value to be returned in case the data doesn't exist
* @return T - The value stored
*/
T get_or_default( const T& def = T() ) {
T get_or_default( const T& def = T() ) const {
auto itr = _t.find( pk_value );
return itr != _t.end() ? itr->value : def;
}
@@ -13,12 +13,6 @@
namespace eosio {
namespace internal_use_do_not_use {
extern "C" {
__attribute__((eosio_wasm_import))
void send_deferred(const uint128_t&, uint64_t, const char*, size_t, uint32_t);
__attribute__((eosio_wasm_import))
int cancel_deferred(const uint128_t&);
__attribute__((eosio_wasm_import))
size_t read_transaction(char*, size_t);
@@ -47,17 +41,7 @@ namespace eosio {
* @ingroup contracts
* @brief Type-safe C++ wrappers for transaction C API
*
* @details An inline message allows one contract to send another contract a message
* which is processed immediately after the current message's processing
* ends such that the success or failure of the parent transaction is
* dependent on the success of the message. If an inline message fails in
* processing then the whole tree of transactions and actions rooted in the
* block will me marked as failing and none of effects on the database will
* persist.
*
* Inline actions and Deferred transactions must adhere to the permissions
* available to the parent transaction or, in the future, delegated to the
* contract account for future use.
* @details See action for the ability to send an inline action.
*
* @note There are some methods from the @ref transactioncapi that can be used directly from C++
*/
@@ -83,17 +67,17 @@ namespace eosio {
public:
/**
* Construct a new transaction_header with an expiration of now + 60 seconds.
* Construct a new transaction_header
*
* @brief Construct a new transaction_header object initialising the transaction header expiration to now + 60 seconds
* @brief Construct a new transaction_header object
*/
transaction_header( time_point_sec exp = time_point_sec(current_time_point()) + 60)
transaction_header( time_point_sec exp = time_point_sec{} )
:expiration(exp)
{}
time_point_sec expiration;
uint16_t ref_block_num;
uint32_t ref_block_prefix;
uint16_t ref_block_num = 0UL;
uint32_t ref_block_prefix = 0UL;
unsigned_int max_net_usage_words = 0UL; /// number of 8 byte words this transaction can serialize into after compressions
uint8_t max_cpu_usage_ms = 0UL; /// number of CPU usage units to bill transaction for
unsigned_int delay_sec = 0UL; /// number of seconds to delay transaction, default: 0
@@ -110,22 +94,9 @@ namespace eosio {
public:
/**
* Construct a new transaction with an expiration of now + 60 seconds.
* Construct a new transaction
*/
transaction(time_point_sec exp = time_point_sec(current_time_point()) + 60) : transaction_header( exp ) {}
/**
* Sends this transaction, packs the transaction then sends it as a deferred transaction
*
* @details Writes the symbol_code as a string to the provided char buffer
* @param sender_id - ID of sender
* @param payer - Account paying for RAM
* @param replace_existing - Defaults to false, if this is `0`/false then if the provided sender_id is already in use by an in-flight transaction from this contract, which will be a failing assert. If `1` then transaction will atomically cancel/replace the inflight transaction
*/
void send(const uint128_t& sender_id, name payer, bool replace_existing = false) const {
auto serialize = pack(*this);
internal_use_do_not_use::send_deferred(sender_id, payer.value, serialize.data(), serialize.size(), replace_existing);
}
transaction(time_point_sec exp = time_point_sec{}) : transaction_header( exp ) {}
std::vector<action> context_free_actions;
std::vector<action> actions;
@@ -134,47 +105,6 @@ namespace eosio {
EOSLIB_SERIALIZE_DERIVED( transaction, transaction_header, (context_free_actions)(actions)(transaction_extensions) )
};
/**
* Struct onerror contains and sender id and packed transaction
*
* @ingroup transaction
*/
struct onerror {
uint128_t sender_id;
std::vector<char> sent_trx;
/**
* from_current_action unpacks and returns a onerror struct
*
* @ingroup transaction
*/
static onerror from_current_action() {
return unpack_action_data<onerror>();
}
/**
* Unpacks and returns a transaction
*/
transaction unpack_sent_trx() const {
return unpack<transaction>(sent_trx);
}
EOSLIB_SERIALIZE( onerror, (sender_id)(sent_trx) )
};
/**
* Send a deferred transaction
*
* @ingroup transaction
* @param sender_id - Account name of the sender of this deferred transaction
* @param payer - Account name responsible for paying the RAM for this deferred transaction
* @param serialized_transaction - The packed transaction to be deferred
* @param size - The size of the packed transaction, required for persistence.
* @param replace - If true, will replace an existing transaction.
*/
inline void send_deferred(const uint128_t& sender_id, name payer, const char* serialized_transaction, size_t size, bool replace = false) {
internal_use_do_not_use::send_deferred(sender_id, payer.value, serialized_transaction, size, replace);
}
/**
* Retrieve the indicated action from the active transaction.
*
@@ -204,29 +134,6 @@ namespace eosio {
return internal_use_do_not_use::read_transaction( ptr, sz );
}
/**
* Cancels a deferred transaction.
*
* @ingroup transaction
* @param sender_id - The id of the sender
*
* @pre The deferred transaction ID exists.
* @pre The deferred transaction ID has not yet been published.
* @post Deferred transaction canceled.
*
* @return 1 if transaction was canceled, 0 if transaction was not found
*
* Example:
*
* @code
* id = 0xffffffffffffffff
* cancel_deferred( id );
* @endcode
*/
inline int cancel_deferred(const uint128_t& sender_id) {
return internal_use_do_not_use::cancel_deferred(sender_id);
}
/**
* Gets the size of the currently executing transaction.
*
+44 -5
View File
@@ -231,7 +231,7 @@ namespace eosio {
*/
friend int64_t operator/( const asset& a, const asset& b ) {
eosio::check( b.amount != 0, "divide by zero" );
eosio::check( a.symbol == b.symbol, "comparison of assets with different symbols is not allowed" );
eosio::check( a.symbol == b.symbol, "attempt to divide assets with different symbol" );
return a.amount / b.amount;
}
@@ -462,30 +462,69 @@ namespace eosio {
return a;
}
/// Multiplication operator.
extended_asset& operator*=( int64_t b ) {
quantity *= b;
return *this;
}
/// Multiplication operator.
friend extended_asset operator*( const extended_asset& a, int64_t b ) {
return {a.quantity * b, a.contract};
}
/// Multiplication operator.
friend extended_asset operator*( int64_t a, const extended_asset& b ) {
return {a * b.quantity, b.contract};
}
/// Division operator. Follows format of 'int64_t operator/( const asset& a, const asset& b )'.
friend int64_t operator/( const extended_asset& a, const extended_asset& b ) {
eosio::check( a.contract == b.contract, "type mismatch" );
return a.quantity / b.quantity;
}
/// Division operator.
extended_asset& operator/=( int64_t b ) {
quantity /= b;
return *this;
}
/// Division operator.
friend extended_asset operator/( const extended_asset& a, int64_t b ) {
return {a.quantity / b, a.contract};
}
/// Less than operator
friend bool operator<( const extended_asset& a, const extended_asset& b ) {
eosio::check( a.contract == b.contract, "type mismatch" );
return a.quantity < b.quantity;
}
/// Greater than operator
friend bool operator>( const extended_asset& a, const extended_asset& b ) {
eosio::check( a.contract == b.contract, "type mismatch" );
return a.quantity > b.quantity;
}
/// Comparison operator
/// Equality operator
friend bool operator==( const extended_asset& a, const extended_asset& b ) {
return std::tie(a.quantity, a.contract) == std::tie(b.quantity, b.contract);
}
/// Comparison operator
/// Inequality operator
friend bool operator!=( const extended_asset& a, const extended_asset& b ) {
return std::tie(a.quantity, a.contract) != std::tie(b.quantity, b.contract);
}
/// Comparison operator
/// Less than or equal operator
friend bool operator<=( const extended_asset& a, const extended_asset& b ) {
eosio::check( a.contract == b.contract, "type mismatch" );
return a.quantity <= b.quantity;
}
/// Comparison operator
/// Greater than or equal operator
friend bool operator>=( const extended_asset& a, const extended_asset& b ) {
eosio::check( a.contract == b.contract, "type mismatch" );
return a.quantity >= b.quantity;
+59
View File
@@ -0,0 +1,59 @@
/*
base64 encoding and decoding with C++.
More information at
https://renenyffenegger.ch/notes/development/Base64/Encoding-and-decoding-base-64-with-cpp
https://github.com/ReneNyffenegger/cpp-base64
Version: 2.rc.09 (release candidate)
Copyright (C) 2004-2017, 2020-2022 René Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
claim that you wrote the original source code. If you use this source code
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original source code.
3. This notice may not be removed or altered from any source distribution.
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
#include "check.hpp"
#include <algorithm>
#include <string_view>
namespace eosio {
namespace detail {
std::string base64_encode(unsigned char const*, size_t len, bool url = false);
std::string base64_decode(std::string_view s, bool remove_linebreaks = false, bool url = false);
} // detail namespace
inline std::string base64_encode(std::string_view enc) {
return detail::base64_encode(reinterpret_cast<const unsigned char*>(enc.data()), enc.size(), false);
}
inline std::string base64_decode(std::string_view encoded_string) {
return detail::base64_decode(encoded_string, false);
}
inline std::string base64url_encode(std::string_view enc) {
return detail::base64_encode(reinterpret_cast<const unsigned char*>(enc.data()), enc.size(), true);
}
inline std::string base64url_decode(std::string_view encoded_string) {
return detail::base64_decode(encoded_string, true, true);
}
} // namespace eosio
+225
View File
@@ -0,0 +1,225 @@
#pragma once
#include "serialize.hpp"
#include "print.hpp"
#include "check.hpp"
#include "varint.hpp"
#include <vector>
namespace eosio {
// -------------------------------------------------------------------------------
// see https://github.com/AntelopeIO/spring/wiki/ABI-1.3:-bitset-type
// -------------------------------------------------------------------------------
// stores a bitset in a std::vector<uint8_t>
//
// - bits 0-7 in first byte, 8-15 in second, ...
// - least significant bit of byte 0 is bit 0 of bitset.
// - unused bits must be zero.
// ---------------------------------------------------------------------------------
struct bitset {
using buffer_type = std::vector<uint8_t>;
using size_type = uint32_t;
static constexpr size_type bits_per_block = 8;
static constexpr size_type npos = static_cast<size_type>(-1);
static constexpr size_type calc_num_blocks(size_type num_bits) {
return (num_bits + bits_per_block - 1) / bits_per_block;
}
static size_type block_index(size_type pos) noexcept { return pos / bits_per_block; }
static uint8_t bit_index(size_type pos) noexcept { return static_cast<uint8_t>(pos % bits_per_block); }
static uint8_t bit_mask(size_type pos) noexcept { return uint8_t(1) << bit_index(pos); }
size_type size() const { return m_num_bits; }
size_type num_blocks() const {
assert(m_bits.size() == calc_num_blocks(m_num_bits));
return m_bits.size();
}
void resize(size_type num_bits) {
m_bits.resize(calc_num_blocks(num_bits), 0);
m_num_bits = num_bits;
zero_unused_bits();
}
void set(size_type pos) {
assert(pos < m_num_bits);
m_bits[block_index(pos)] |= bit_mask(pos);
}
void clear(size_type pos) {
assert(pos < m_num_bits);
m_bits[block_index(pos)] &= ~bit_mask(pos);
}
bool test(size_type pos) const {
return (*this)[pos];
}
bool operator[](size_type pos) const {
assert(pos < m_num_bits);
return !!(m_bits[block_index(pos)] & bit_mask(pos));
}
void flip(size_type pos) {
assert(pos < m_num_bits);
if (test(pos))
clear(pos);
else
set(pos);
}
void flip() {
for (auto& byte : m_bits)
byte = ~byte;
zero_unused_bits();
}
bool all() const {
auto sz = size();
for (size_t i=0; i<sz; ++i)
if (!test(i))
return false;
return true;
}
bool none() const {
for (auto& byte : m_bits)
if (byte)
return false;
return true;
}
void zero_all_bits() {
for (auto& byte : m_bits)
byte = 0;
}
bitset operator|=(const bitset& o) {
assert(size() == o.size());
for (size_t i=0; i<m_bits.size(); ++i)
m_bits[i] |= o.m_bits[i];
return *this;
}
void zero_unused_bits() {
assert (m_bits.size() == calc_num_blocks(m_num_bits));
// if != 0 this is the number of bits used in the last block
const size_type extra_bits = bit_index(size());
if (extra_bits != 0)
m_bits.back() &= (uint8_t(1) << extra_bits) - 1;
}
bool unused_bits_zeroed() const {
// if != 0 this is the number of bits used in the last block
const size_type extra_bits = bit_index(size());
return extra_bits == 0 || (m_bits.back() & ~((uint8_t(1) << extra_bits) - 1)) == 0;
}
friend auto operator<(const bitset& a, const bitset& b) {
return std::tuple(a.m_num_bits, a.m_bits) < std::tuple(b.m_num_bits, b.m_bits);
}
friend bool operator==(const bitset& a, const bitset& b) {
return std::tuple(a.m_num_bits, a.m_bits) == std::tuple(b.m_num_bits, b.m_bits);
}
uint8_t& byte(size_t i) {
assert(i < m_bits.size());
return m_bits[i];
}
const uint8_t& byte(size_t i) const {
assert(i < m_bits.size());
return m_bits[i];
}
std::string to_string() const {
std::string res;
res.resize(size());
size_t idx = 0;
for (auto i = size(); i-- > 0;)
res[idx++] = (*this)[i] ? '1' : '0';
return res;
}
static bitset from_string(std::string_view s) {
bitset bs;
auto num_bits = s.size();
bs.resize(num_bits);
for (size_t i = 0; i < num_bits; ++i) {
switch (s[i]) {
case '0':
break; // nothing to do, all bits initially 0
case '1':
bs.set(num_bits - i - 1); // high bitset indexes come first in the JSON representation
break;
default:
eosio::check(false, "unexpected character in bitset string representation");
break;
}
}
assert(bs.unused_bits_zeroed());
return bs;
}
void print() const {
auto s = to_string();
if (!s.empty())
printl(s.data(), s.size());
}
// binary representation
// ---------------------
// The bitset first encodes the number of bits it contains as a varint, then encodes
// (size+8-1)/8 bytes into the stream. The first byte represents bits 0-7, the next 8-15,
// and so on; i.e. LSB first.
// Within a byte, the least significant bit stores the smaller bitset index.
// Unused bits should be written as 0.
//
// This matches the storage scheme of bitset above
// ---------------------------------------------------------------------------------------
template <typename DataStream>
friend DataStream& operator>>(DataStream& stream, bitset& obj) {
unsigned_int num_bits(0);
stream >> num_bits;
obj.resize(num_bits.value);
if (obj.size() > 0) {
auto num_blocks = bitset::calc_num_blocks(obj.size());
for (size_t i = 0; i < num_blocks; ++i)
stream >> obj.byte(i);
obj.zero_unused_bits();
assert(obj.unused_bits_zeroed());
}
return stream;
}
template <typename DataStream>
friend DataStream& operator<<(DataStream& stream, const bitset& obj) {
unsigned_int num_bits(obj.size());
stream << num_bits;
if (obj.size() > 0) {
auto num_blocks = bitset::calc_num_blocks(obj.size());
assert(num_blocks >= 1);
for (size_t i = 0; i < num_blocks; ++i)
stream << obj.byte(i);
}
return stream;
}
private:
size_type m_num_bits{0}; // members order matters for comparison operators
buffer_type m_bits; // must be after `m_num_bits`
};
constexpr const char* get_type_name(bitset*) { return "bitset"; }
} // namespace eosio
+9
View File
@@ -22,6 +22,15 @@ namespace eosio {
}
}
/**
* Return codes returned by host functions
*/
enum return_code : int32_t {
failure = -1,
success = 0
};
/**
* @defgroup system System
* @ingroup core
@@ -0,0 +1,502 @@
#pragma once
#include "crypto.hpp"
#include "fixed_bytes.hpp"
#include "varint.hpp"
#include "serialize.hpp"
#include "base64.hpp"
#include <array>
#include <vector>
#include <span>
namespace bls12_381 {
class sha256 {
public:
sha256(): m_blocklen(0), m_bitlen(0) {
m_state[0] = 0x6a09e667;
m_state[1] = 0xbb67ae85;
m_state[2] = 0x3c6ef372;
m_state[3] = 0xa54ff53a;
m_state[4] = 0x510e527f;
m_state[5] = 0x9b05688c;
m_state[6] = 0x1f83d9ab;
m_state[7] = 0x5be0cd19;
}
void update(const uint8_t * data, size_t length) {
for(size_t i = 0 ; i < length ; i++) {
m_data[m_blocklen++] = data[i];
if (m_blocklen == 64) {
transform();
// End of the block
m_bitlen += 512;
m_blocklen = 0;
}
}
}
inline void update(const char* data, size_t length) {
update(reinterpret_cast<const uint8_t*>(data), length);
}
inline void update(const std::string &data) {
update(reinterpret_cast<const char*>(data.data()), data.size());
}
std::array<uint8_t, 32> digest() {
std::array<uint8_t, 32> hash;
pad();
revert(hash);
return hash;
}
void digest(uint8_t* dst) {
std::array<uint8_t, 32>* phash = reinterpret_cast<std::array<uint8_t, 32>*>(dst);
pad();
revert(*phash);
}
//static string toString(const array<uint8_t, 32>& digest);
private:
uint8_t m_data[64];
uint32_t m_blocklen;
uint64_t m_bitlen;
uint32_t m_state[8]; //A, B, C, D, E, F, G, H
static constexpr std::array<uint32_t, 64> K = {
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,
0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,
0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,
0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,
0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,
0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,
0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,
0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,
0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
};
static uint32_t rotr(uint32_t x, uint32_t n) {
return (x >> n) | (x << (32 - n));
}
static uint32_t choose(uint32_t e, uint32_t f, uint32_t g) {
return (e & f) ^ (~e & g);
}
static uint32_t majority(uint32_t a, uint32_t b, uint32_t c) {
return (a & (b | c)) | (b & c);
}
static uint32_t sig0(uint32_t x) {
return sha256::rotr(x, 7) ^ sha256::rotr(x, 18) ^ (x >> 3);
}
static uint32_t sig1(uint32_t x) {
return sha256::rotr(x, 17) ^ sha256::rotr(x, 19) ^ (x >> 10);
}
void transform() {
uint32_t maj, xorA, ch, xorE, sum, newA, newE, m[64];
uint32_t state[8];
for(uint8_t i = 0, j = 0; i < 16; i++, j += 4) {
// Split data in 32 bit blocks for the 16 first words
m[i] = (m_data[j] << 24) | (m_data[j + 1] << 16) | (m_data[j + 2] << 8) | (m_data[j + 3]);
}
for(uint8_t k = 16 ; k < 64; k++) {
// Remaining 48 blocks
m[k] = sha256::sig1(m[k - 2]) + m[k - 7] + sha256::sig0(m[k - 15]) + m[k - 16];
}
for(uint8_t i = 0 ; i < 8 ; i++) {
state[i] = m_state[i];
}
for(uint8_t i = 0; i < 64; i++) {
maj = sha256::majority(state[0], state[1], state[2]);
xorA = sha256::rotr(state[0], 2) ^ sha256::rotr(state[0], 13) ^ sha256::rotr(state[0], 22);
ch = choose(state[4], state[5], state[6]);
xorE = sha256::rotr(state[4], 6) ^ sha256::rotr(state[4], 11) ^ sha256::rotr(state[4], 25);
sum = m[i] + K[i] + state[7] + ch + xorE;
newA = xorA + maj + sum;
newE = state[3] + sum;
state[7] = state[6];
state[6] = state[5];
state[5] = state[4];
state[4] = newE;
state[3] = state[2];
state[2] = state[1];
state[1] = state[0];
state[0] = newA;
}
for(uint8_t i = 0 ; i < 8 ; i++) {
m_state[i] += state[i];
}
}
void pad() {
uint64_t i = m_blocklen;
uint8_t end = m_blocklen < 56 ? 56 : 64;
m_data[i++] = 0x80; // Append a bit 1
while(i < end) {
m_data[i++] = 0x00; // Pad with zeros
}
if(m_blocklen >= 56) {
transform();
memset(m_data, 0, 56);
}
// Append to the padding the total message's length in bits and transform.
m_bitlen += m_blocklen * 8;
m_data[63] = m_bitlen;
m_data[62] = m_bitlen >> 8;
m_data[61] = m_bitlen >> 16;
m_data[60] = m_bitlen >> 24;
m_data[59] = m_bitlen >> 32;
m_data[58] = m_bitlen >> 40;
m_data[57] = m_bitlen >> 48;
m_data[56] = m_bitlen >> 56;
transform();
}
void revert(std::array<uint8_t, 32>& hash) {
// SHA uses big endian byte ordering
// Revert all bytes
for(uint8_t i = 0 ; i < 4 ; i++) {
for(uint8_t j = 0 ; j < 8 ; j++) {
hash[i + (j * 4)] = (m_state[j] >> (24 - i * 8)) & 0x000000ff;
}
}
}
};
} // namespace bls12_381
namespace eosio {
namespace internal_use_do_not_use {
extern "C" {
__attribute__((eosio_wasm_import))
int32_t bls_g1_add(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g2_add(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g1_weighted_sum(const char* points, uint32_t points_len, const char* scalars, uint32_t scalars_len, uint32_t n, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g2_weighted_sum(const char* points, uint32_t points_len, const char* scalars, uint32_t scalars_len, uint32_t n, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_pairing(const char* g1_points, uint32_t g1_points_len, const char* g2_points, uint32_t g2_points_len, uint32_t n, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g1_map(const char* e, uint32_t e_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_g2_map(const char* e, uint32_t e_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_fp_mod(const char* s, uint32_t s_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_fp_mul(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len);
__attribute__((eosio_wasm_import))
int32_t bls_fp_exp(const char* base, uint32_t base_len, const char* exp, uint32_t exp_len, char* res, uint32_t res_len);
}
}
using bls_scalar = std::array<char, 32>;
using bls_fp = std::array<char, 48>;
using bls_s = std::array<char, 64>;
using bls_fp2 = std::array<bls_fp, 2>;
using bls_g1 = std::array<char, 96>; // affine little-endian
using bls_g2 = std::array<char, 192>; // affine little-endian
using bls_gt = std::array<char, 576>; // group fp12
inline int32_t bls_g1_add(const bls_g1& op1, const bls_g1& op2, bls_g1& res) {
return internal_use_do_not_use::bls_g1_add(
op1.data(), op1.size(),
op2.data(), op2.size(),
res.data(), res.size()
);
}
inline int32_t bls_g2_add(const bls_g2& op1, const bls_g2& op2, bls_g2& res) {
return internal_use_do_not_use::bls_g2_add(
op1.data(), op1.size(),
op2.data(), op2.size(),
res.data(), res.size()
);
}
inline int32_t bls_g1_weighted_sum(const bls_g1 g1_points[], const bls_scalar scalars[], uint32_t num, bls_g1& res) {
if (num == 0)
return return_code::failure;
return internal_use_do_not_use::bls_g1_weighted_sum(
g1_points[0].data(), num * g1_points[0].size(),
scalars[0].data(), num * scalars[0].size(),
num,
res.data(), res.size()
);
}
inline int32_t bls_g2_weighted_sum(const bls_g2 g2_points[], const bls_scalar scalars[], uint32_t num, bls_g2& res) {
if (num == 0)
return return_code::failure;
return internal_use_do_not_use::bls_g2_weighted_sum(
g2_points[0].data(), num * g2_points[0].size(),
scalars[0].data(), num * scalars[0].size(),
num,
res.data(), res.size()
);
}
inline int32_t bls_pairing(const bls_g1 g1_points[], const bls_g2 g2_points[], const uint32_t num, bls_gt& res) {
if (num == 0)
return return_code::failure;
return internal_use_do_not_use::bls_pairing(
g1_points[0].data(), num * g1_points[0].size(),
g2_points[0].data(), num * g2_points[0].size(),
num,
res.data(), res.size()
);
}
inline int32_t bls_g1_map(const bls_fp& e, bls_g1& res) {
return internal_use_do_not_use::bls_g1_map(
e.data(), e.size(),
res.data(), res.size()
);
}
inline int32_t bls_g2_map(const bls_fp2& e, bls_g2& res) {
return internal_use_do_not_use::bls_g2_map(
e[0].data(), 2 * e[0].size(),
res.data(), res.size()
);
}
inline int32_t bls_fp_mod(const bls_s& s, bls_fp& res) {
return internal_use_do_not_use::bls_fp_mod(
s.data(), s.size(),
res.data(), res.size()
);
}
inline int32_t bls_fp_mul(const bls_fp& op1, const bls_fp& op2, bls_fp& res) {
return internal_use_do_not_use::bls_fp_mul(
op1.data(), op1.size(),
op2.data(), op2.size(),
res.data(), res.size()
);
}
inline int32_t bls_fp_exp(const bls_fp& base, const bls_s& exp, bls_fp& res) {
return internal_use_do_not_use::bls_fp_exp(
base.data(), base.size(),
exp.data(), exp.size(),
res.data(), res.size()
);
}
namespace detail {
const inline std::string bls_public_key_prefix = "PUB_BLS_";
constexpr inline uint32_t bls_checksum_size = sizeof(uint32_t);
const inline std::string bls_signature_prefix = "SIG_BLS_";
template<typename T, const std::string& Prefix>
std::string bls_type_to_base64url(const T& g1) {
std::array<char, sizeof(T) + bls_checksum_size> g1_with_checksum;
auto it = std::copy(g1.begin(), g1.end(), g1_with_checksum.begin());
auto csum = ripemd160(g1.data(), g1.size()).extract_as_byte_array();
std::copy(reinterpret_cast<const char*>(csum.data()),
reinterpret_cast<const char*>(csum.data())+bls_checksum_size,
it);
return Prefix + eosio::base64url_encode({g1_with_checksum.data(), g1_with_checksum.size()});
}
template<typename T, const std::string& Prefix>
T bls_base64url_to_type(const char* data, size_t size) {
eosio::check(size > Prefix.size(), "encoded base64 key is too short");
eosio::check(0 == memcmp(data, Prefix.data(), Prefix.size()), "base64 encoded type must begin from corresponding prefix");
std::string decoded = eosio::base64url_decode({data+Prefix.size(), size - Prefix.size()});
T ret;
eosio::check(decoded.size() == ret.size() + bls_checksum_size, "decoded size " + std::to_string(decoded.size()) +
" doesn't match structure size " + std::to_string(ret.size()) +
" + checksum " + std::to_string(bls_checksum_size));
auto it = decoded.end();
std::advance(it, -bls_checksum_size);
std::copy(decoded.begin(), it, ret.begin());
auto csum = ripemd160(ret.data(), ret.size()).extract_as_byte_array();
eosio::check(0 == memcmp(&*it, csum.data(), bls_checksum_size), "checksum of structure doesn't match");
return ret;
}
const inline std::string CIPHERSUITE_ID = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_"; // basic DST
const inline std::string POP_CIPHERSUITE_ID = "BLS_POP_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_"; // proof of possession DST
// g1::one().negate().toAffineBytesLE(), 96 bytes
const inline std::vector<uint8_t> G1_ONE_NEG = {0xbb, 0xc6, 0x22, 0xdb, 0xa, 0xf0, 0x3a, 0xfb, 0xef, 0x1a, 0x7a, 0xf9,
0x3f, 0xe8, 0x55, 0x6c, 0x58, 0xac, 0x1b, 0x17, 0x3f, 0x3a, 0x4e, 0xa1,
0x5, 0xb9, 0x74, 0x97, 0x4f, 0x8c, 0x68, 0xc3, 0xf, 0xac, 0xa9, 0x4f,
0x8c, 0x63, 0x95, 0x26, 0x94, 0xd7, 0x97, 0x31, 0xa7, 0xd3, 0xf1, 0x17,
0xca, 0xc2, 0x39, 0xb9, 0xd6, 0xdc, 0x54, 0xad, 0x1b, 0x75, 0xcb, 0xe,
0xba, 0x38, 0x6f, 0x4e, 0x36, 0x42, 0xac, 0xca, 0xd5, 0xb9, 0x55, 0x66,
0xc9, 0x7, 0xb5, 0x1d, 0xef, 0x6a, 0x81, 0x67, 0xf2, 0x21, 0x2e, 0xcf,
0xc8, 0x76, 0x7d, 0xaa, 0xa8, 0x45, 0xd5, 0x55, 0x68, 0x1d, 0x4d, 0x11};
// fp12::one().toBytesLE(), 576 bytes
const inline std::vector<uint8_t> GT_ONE = []{ std::vector<uint8_t> r(576, 0); r[0] = 1; return r; }();
// Construct an extensible-output function based on SHA256
inline void xmd_sh256(
char *buf,
int buf_len,
const char *in,
int in_len,
const char *dst,
int dst_len
) {
const unsigned int SHA256HashSize = 32;
const unsigned int SHA256_Message_Block_Size = 64;
const unsigned ell = (buf_len + SHA256HashSize - 1) / SHA256HashSize;
if (buf_len < 0 || ell > 255 || dst_len > 255) {
return;
}
const uint8_t Z_pad[SHA256_Message_Block_Size] = { 0, };
const uint8_t l_i_b_0_str[] = {
static_cast<uint8_t>(buf_len >> 8),
static_cast<uint8_t>(buf_len & 0xff),
0,
static_cast<uint8_t>(dst_len)
};
const uint8_t *dstlen_str = l_i_b_0_str + 3;
uint8_t b_0[SHA256HashSize];
bls12_381::sha256 sha;
sha.update(Z_pad, SHA256_Message_Block_Size);
sha.update(in, in_len);
sha.update(l_i_b_0_str, 3);
sha.update(dst, dst_len);
sha.update(dstlen_str, 1);
sha.digest(b_0);
uint8_t b_i[SHA256HashSize + 1] = { 0, };
for (unsigned i = 1; i <= ell; ++i) {
for (unsigned j = 0; j < SHA256HashSize; ++j) {
b_i[j] = b_0[j] ^ b_i[j];
}
b_i[SHA256HashSize] = i;
bls12_381::sha256 s;
s.update(b_i, SHA256HashSize + 1);
s.update(dst, dst_len);
s.update(dstlen_str, 1);
s.digest(b_i);
const int rem_after = buf_len - i * SHA256HashSize;
const int copy_len = SHA256HashSize + (rem_after < 0 ? rem_after : 0);
memcpy(buf + (i - 1) * SHA256HashSize, b_i, copy_len);
}
}
inline bls_s scalar_fromBE(const bls_s& in) {
bls_s out;
constexpr size_t last_index = sizeof(out) - 1;
for(size_t i = 0; i <= last_index; ++i)
{
out[i] = in[last_index - i];
}
return out;
}
inline void g2_fromMessage(std::span<const char> msg, const std::string& dst, bls_g2& res) {
std::array<bls_s, 4> buf;
xmd_sh256(buf.data()->data(), sizeof(buf), msg.data(), msg.size(), dst.data(), dst.length());
bls_s k;
bls_fp2 t;
bls_g2 p, q;
k = scalar_fromBE(buf[0]);
bls_fp_mod(k, t[0]);
k = scalar_fromBE(buf[1]);
bls_fp_mod(k, t[1]);
bls_g2_map(t, p);
k = scalar_fromBE(buf[2]);
bls_fp_mod(k, t[0]);
k = scalar_fromBE(buf[3]);
bls_fp_mod(k, t[1]);
bls_g2_map(t, q);
bls_g2_add(p, q, res);
}
} // namespace detail
inline std::string encode_g1_to_bls_public_key(const bls_g1& g1) {
return detail::bls_type_to_base64url<bls_g1, detail::bls_public_key_prefix>(g1);
}
inline bls_g1 decode_bls_public_key_to_g1(std::string_view public_key) {
return detail::bls_base64url_to_type<bls_g1, detail::bls_public_key_prefix>(public_key.data(), public_key.size());
}
inline std::string encode_g2_to_bls_signature(const bls_g2& g2) {
return detail::bls_type_to_base64url<bls_g2, detail::bls_signature_prefix>(g2);
}
inline bls_g2 decode_bls_signature_to_g2(std::string_view public_key) {
return detail::bls_base64url_to_type<bls_g2, detail::bls_signature_prefix>(public_key.data(), public_key.size());
}
// pubkey and signature are assumed to be in RAW affine little-endian bytes
inline bool bls_pop_verify(const bls_g1& pubkey, const bls_g2& signature_proof) {
using namespace detail;
bls_g1 g1_points[2] = {0};
bls_g2 g2_points[2] = {0};
std::memcpy(g1_points[0].data(), G1_ONE_NEG.data(), G1_ONE_NEG.size());
std::memcpy(g2_points[0].data(), signature_proof.data(), signature_proof.size());
std::memcpy(g1_points[1].data(), pubkey.data(), pubkey.size());
g2_fromMessage(pubkey, POP_CIPHERSUITE_ID, g2_points[1]);
bls_gt r;
bls_pairing(g1_points, g2_points, 2, r);
return 0 == std::memcmp(r.data(), GT_ONE.data(), GT_ONE.size());
}
// pubkey and signature are assumed to be in RAW affine little-endian bytes
inline bool bls_signature_verify(const bls_g1& pubkey, const bls_g2& signature_proof, const std::string& msg) {
bls_g1 g1_points[2];
bls_g2 g2_points[2];
std::memcpy(g1_points[0].data(), detail::G1_ONE_NEG.data(), detail::G1_ONE_NEG.size());
std::memcpy(g2_points[0].data(), signature_proof.data(), signature_proof.size());
std::memcpy(g1_points[1].data(), pubkey.data(), pubkey.size());
detail::g2_fromMessage(msg, detail::CIPHERSUITE_ID, g2_points[1]);
bls_gt r;
bls_pairing(g1_points, g2_points, 2, r);
return 0 == std::memcmp(r.data(), detail::GT_ONE.data(), detail::GT_ONE.size());
}
}
+5 -5
View File
@@ -224,7 +224,7 @@ namespace eosio {
inline int32_t alt_bn128_add( const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* result, uint32_t result_len ) {
return internal_use_do_not_use::alt_bn128_add( op1, op1_len, op2, op2_len, result, result_len);
}
/**
* Scalar multiplication operation on the elliptic curve `alt_bn128`
*
@@ -257,7 +257,7 @@ namespace eosio {
inline int32_t alt_bn128_mul( const char* g1, uint32_t g1_len, const char* scalar, uint32_t scalar_len, char* result, uint32_t result_len ) {
return internal_use_do_not_use::alt_bn128_mul( g1, g1_len, scalar, scalar_len, result, result_len );
}
/**
* Optimal-Ate pairing check elliptic curve `alt_bn128`
*
@@ -343,7 +343,7 @@ namespace eosio {
* @param result - the result of the compression
* @return -1 if there is an error otherwise 0
*/
int32_t blake2_f( uint32_t rounds, const std::vector<char>& state, const std::vector<char>& msg, const std::vector<char>& t0_offset, const std::vector<char>& t1_offset, bool final, std::vector<char>& result) {
inline int32_t blake2_f( uint32_t rounds, const std::vector<char>& state, const std::vector<char>& msg, const std::vector<char>& t0_offset, const std::vector<char>& t1_offset, bool final, std::vector<char>& result) {
eosio::check( result.size() >= blake2f_result_size, "blake2_f result parameter's size must be >= 64" );
return internal_use_do_not_use::blake2_f( rounds, state.data(), state.size(), msg.data(), msg.size(), t0_offset.data(), t0_offset.size(), t1_offset.data(), t1_offset.size(), final, result.data(), result.size());
}
@@ -367,11 +367,11 @@ namespace eosio {
* @param result_len - size of result
* @return -1 if there is an error otherwise 0
*/
int32_t blake2_f( uint32_t rounds, const char* state, uint32_t state_len, const char* msg, uint32_t msg_len,
inline int32_t blake2_f( uint32_t rounds, const char* state, uint32_t state_len, const char* msg, uint32_t msg_len,
const char* t0_offset, uint32_t t0_len, const char* t1_offset, uint32_t t1_len, int32_t final, char* result, uint32_t result_len) {
return internal_use_do_not_use::blake2_f( rounds, state, state_len, msg, msg_len, t0_offset, t0_len, t1_offset, t1_len, final, result, result_len);
}
/**
* Hashes `data` using `sha3`
*
+79 -13
View File
@@ -5,6 +5,7 @@
#pragma once
#include "check.hpp"
#include "varint.hpp"
#include <bluegrass/meta/for_each.hpp>
#include <list>
#include <queue>
@@ -16,13 +17,7 @@
#include <optional>
#include <variant>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/include/for_each.hpp>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/include/std_tuple.hpp>
#include <boost/mp11/tuple.hpp>
#include <boost/pfr.hpp>
#include <string.h>
namespace eosio {
@@ -64,7 +59,7 @@ class datastream {
* @param s - the number of bytes to read
* @return true
*/
inline bool read( char* d, size_t s ) {
inline bool read( void* d, size_t s ) {
eosio::check( size_t(_end - _pos) >= (size_t)s, "datastream attempted to read past the end" );
memcpy( d, _pos, s );
_pos += s;
@@ -461,7 +456,7 @@ inline datastream<Stream>& operator>>(datastream<Stream>& ds, std::optional<T>&
T val;
ds >> val;
opt = val;
}
} else { opt.reset(); }
return ds;
}
@@ -770,6 +765,77 @@ datastream<Stream>& operator >> ( datastream<Stream>& ds, std::vector<T>& v ) {
return ds;
}
/**
* Serialize a basic_string<T>
*
* @param ds - The stream to write
* @param s - The value to serialize
* @tparam Stream - Type of datastream buffer
* @tparam T - Type of the object contained in the basic_string
* @return datastream<Stream>& - Reference to the datastream
*/
template<typename Stream, typename T>
datastream<Stream>& operator << ( datastream<Stream>& ds, const std::basic_string<T>& s ) {
ds << unsigned_int(s.size());
if (s.size())
ds.write(s.data(), s.size()*sizeof(T));
return ds;
}
/**
* Deserialize a basic_string<T>
*
* @param ds - The stream to read
* @param s - The destination for deserialized value
* @tparam Stream - Type of datastream buffer
* @tparam T - Type of the object contained in the basic_string
* @return datastream<Stream>& - Reference to the datastream
*/
template<typename Stream, typename T>
datastream<Stream>& operator >> ( datastream<Stream>& ds, std::basic_string<T>& s ) {
unsigned_int v;
ds >> v;
s.resize(v.value);
ds.read(s.data(), s.size()*sizeof(T));
return ds;
}
/**
* Serialize a basic_string<uint8_t>
*
* @param ds - The stream to write
* @param s - The value to serialize
* @tparam Stream - Type of datastream buffer
* @tparam T - Type of the object contained in the basic_string
* @return datastream<Stream>& - Reference to the datastream
*/
template<typename Stream>
datastream<Stream>& operator << ( datastream<Stream>& ds, const std::basic_string<uint8_t>& s ) {
ds << unsigned_int(s.size());
if (s.size())
ds.write(s.data(), s.size());
return ds;
}
/**
* Deserialize a basic_string<uint8_t>
*
* @param ds - The stream to read
* @param s - The destination for deserialized value
* @tparam Stream - Type of datastream buffer
* @tparam T - Type of the object contained in the basic_string
* @return datastream<Stream>& - Reference to the datastream
*/
template<typename Stream>
datastream<Stream>& operator >> ( datastream<Stream>& ds, std::basic_string<uint8_t>& s ) {
unsigned_int v;
ds >> v;
s.resize(v.value);
ds.read(s.data(), s.size());
return ds;
}
/**
* Serialize a set
*
@@ -864,7 +930,7 @@ datastream<Stream>& operator >> ( datastream<Stream>& ds, std::map<K,V>& m ) {
*/
template<typename Stream, typename... Args>
datastream<Stream>& operator<<( datastream<Stream>& ds, const std::tuple<Args...>& t ) {
boost::fusion::for_each( t, [&]( const auto& i ) {
bluegrass::meta::for_each( t, [&]( const auto& i ) {
ds << i;
});
return ds;
@@ -881,7 +947,7 @@ datastream<Stream>& operator<<( datastream<Stream>& ds, const std::tuple<Args...
*/
template<typename Stream, typename... Args>
datastream<Stream>& operator>>( datastream<Stream>& ds, std::tuple<Args...>& t ) {
boost::fusion::for_each( t, [&]( auto& i ) {
bluegrass::meta::for_each( t, [&]( auto& i ) {
ds >> i;
});
return ds;
@@ -898,7 +964,7 @@ datastream<Stream>& operator>>( datastream<Stream>& ds, std::tuple<Args...>& t )
*/
template<typename DataStream, typename T, std::enable_if_t<std::is_class<T>::value && _datastream_detail::is_datastream<DataStream>::value>* = nullptr>
DataStream& operator<<( DataStream& ds, const T& v ) {
boost::pfr::for_each_field(v, [&](const auto& field) {
bluegrass::meta::for_each_field(v, [&](const auto& field) {
ds << field;
});
return ds;
@@ -915,7 +981,7 @@ DataStream& operator<<( DataStream& ds, const T& v ) {
*/
template<typename DataStream, typename T, std::enable_if_t<std::is_class<T>::value && _datastream_detail::is_datastream<DataStream>::value>* = nullptr>
DataStream& operator>>( DataStream& ds, T& v ) {
boost::pfr::for_each_field(v, [&](auto& field) {
bluegrass::meta::for_each_field(v, [&](auto& field) {
ds >> field;
});
return ds;
+73
View File
@@ -0,0 +1,73 @@
#pragma once
#include "check.hpp"
#include "serialize.hpp"
#include "reflect.hpp"
#include <string_view>
namespace eosio {
struct hash_id {
public:
static constexpr uint32_t max_length = 128;
enum class raw : uint64_t {};
constexpr explicit hash_id( hash_id::raw r )
:id(static_cast<uint64_t>(r)) {}
constexpr hash_id() : id(0) {}
constexpr explicit hash_id( std::string_view s )
: id(djbh_hash(s))
{
validate(s);
}
constexpr void validate(std::string_view str) {
if (str.empty()) {
eosio::check(false, "string cannot be empty to be an hash_id");
}
if (str.length() > max_length) {
eosio::check(false, "string is too long be a valid hash_id. must be less than or equal to " + std::to_string(max_length));
}
// cannot use std::isalpha in constexpr function
if (! ((str[0] >= 'A' && str[0] <= 'Z') || (str[0] >= 'a' && str[0] <= 'z') || str[0] == '_') ) {
eosio::check(false, "string must start with a letter or _ to be a valid hash_id.");
}
for (char c : str.substr(1)) {
// cannot use std::isalnum in constexpr function
if (! ((str[0] >= 'A' && str[0] <= 'Z') || (str[0] >= 'a' && str[0] <= 'z') || (str[0] >= '0' && str[0] <= '9') || str[0] == '_') ) {
eosio::check(false, "string contains a character " + std::string{c} + " that is not a letter, number, or _");
}
}
}
static constexpr uint64_t djbh_hash(std::string_view s) {
uint64_t hash = 5381;
for (char c : s) {
hash = ((hash << 5) + hash) + static_cast<uint8_t>(c); // hash * 33 + c
}
return hash;
}
constexpr operator raw()const { return raw(id); }
uint64_t id = 0;
CDT_REFLECT(id);
EOSLIB_SERIALIZE( hash_id, (id) )
}; /// namespace hash_id
} /// namespace eosio
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template"
template <typename T, T... Str>
inline constexpr eosio::hash_id operator""_i() {
constexpr auto x = eosio::hash_id{std::string_view{eosio::detail::to_const_char_arr<Str...>::value, sizeof...(Str)}};
return x;
}
#pragma clang diagnostic pop
+6 -10
View File
@@ -1,10 +1,6 @@
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <bluegrass/meta/preprocessor.hpp>
#define EOSLIB_REFLECT_MEMBER_OP( r, OP, elem ) \
#define EOSLIB_REFLECT_MEMBER_OP( OP, elem ) \
OP t.elem
/**
@@ -23,11 +19,11 @@
#define EOSLIB_SERIALIZE( TYPE, MEMBERS ) \
template<typename DataStream> \
friend DataStream& operator << ( DataStream& ds, const TYPE& t ){ \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\
return ds BLUEGRASS_META_FOREACH_SEQ( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\
}\
template<typename DataStream> \
friend DataStream& operator >> ( DataStream& ds, TYPE& t ){ \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\
return ds BLUEGRASS_META_FOREACH_SEQ( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\
}
/**
@@ -43,10 +39,10 @@
template<typename DataStream> \
friend DataStream& operator << ( DataStream& ds, const TYPE& t ){ \
ds << static_cast<const BASE&>(t); \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\
return ds BLUEGRASS_META_FOREACH_SEQ( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\
}\
template<typename DataStream> \
friend DataStream& operator >> ( DataStream& ds, TYPE& t ){ \
ds >> static_cast<BASE&>(t); \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\
return ds BLUEGRASS_META_FOREACH_SEQ( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\
}
-1
View File
@@ -9,7 +9,6 @@ FOREACH(FN ${SRC_FILENAMES})
ENDFOREACH(FN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-everything")
set(CMAKE_BUILD_TYPE "Release")
add_library(c++
${SRC_FILES})
-1
View File
@@ -17,7 +17,6 @@ file(GLOB THREAD_SOURCES "cdt-musl/src/thread/*.c") #only for __lock __unlock
set(INTERNAL_SOURCES cdt-musl/src/internal/floatscan.c cdt-musl/src/internal/intscan.c cdt-musl/src/internal/shgetc.c cdt-musl/src/internal/libc.c)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-everything -allow-sse")
set(CMAKE_BUILD_TYPE "Release")
if(__APPLE)
add_definitions(-D__APPLE__)
@@ -0,0 +1,912 @@
#pragma once
#include <tuple>
#include <type_traits>
#include "function_traits.hpp"
namespace bluegrass { namespace meta {
namespace detail {
template <std::size_t Index>
using size_t_ = std::integral_constant<std::size_t, Index >;
///////////////////// Structure that can be converted to reference to anything
struct ubiq_constructor {
std::size_t ignore;
template <class Type> constexpr operator Type&() const noexcept; // Undefined, allows initialization of reference fields (T& and const T&)
};
///////////////////// Structure that can be converted to reference to anything except reference to T
template <class T>
struct ubiq_constructor_except {
template <class Type> constexpr operator std::enable_if_t<!std::is_same<T, Type>::value, Type&> () const noexcept; // Undefined
};
///////////////////// Hand-made is_aggregate_initializable_n<T> trait
// `std::is_constructible<T, ubiq_constructor_except<T>>` consumes a lot of time, so we made a separate lazy trait for it.
template <std::size_t N, class T> struct is_single_field_and_aggregate_initializable: std::false_type {};
template <class T> struct is_single_field_and_aggregate_initializable<1, T>: std::integral_constant<
bool, !std::is_constructible<T, ubiq_constructor_except<T>>::value
> {};
// Hand-made is_aggregate<T> trait:
// Aggregates could be constructed from `decltype(ubiq_constructor{I})...` but report that there's no constructor from `decltype(ubiq_constructor{I})...`
// Special case for N == 1: `std::is_constructible<T, ubiq_constructor>` returns true if N == 1 and T is copy/move constructible.
template <class T, std::size_t N>
struct is_aggregate_initializable_n {
template <std::size_t ...I>
static constexpr bool is_not_constructible_n(std::index_sequence<I...>) noexcept {
return !std::is_constructible<T, decltype(ubiq_constructor{I})...>::value
|| is_single_field_and_aggregate_initializable<N, T>::value
;
}
static constexpr bool value =
std::is_empty<T>::value
|| std::is_fundamental<T>::value
|| is_not_constructible_n(std::make_index_sequence<N>{})
;
};
///////////////////// Helper for SFINAE on fields count
template <class T, std::size_t... I>
constexpr auto enable_if_constructible_helper(std::index_sequence<I...>) noexcept
-> typename std::add_pointer<decltype(T{ ubiq_constructor{I}... })>::type;
template <class T, std::size_t N, class /*Enable*/ = decltype( enable_if_constructible_helper<T>(std::make_index_sequence<N>()) ) >
using enable_if_constructible_helper_t = std::size_t;
///////////////////// Non greedy fields count search. Templates instantiation depth is log(sizeof(T)), templates instantiation count is log(sizeof(T)).
template <class T, std::size_t N>
constexpr std::size_t detect_fields_count(size_t_<N>, size_t_<N>, long) noexcept {
return N;
}
template <class T, std::size_t Begin, std::size_t Middle>
constexpr std::size_t detect_fields_count(size_t_<Begin>, size_t_<Middle>, int) noexcept;
template <class T, std::size_t Begin, std::size_t Middle>
constexpr auto detect_fields_count(size_t_<Begin>, size_t_<Middle>, long) noexcept
-> enable_if_constructible_helper_t<T, Middle>
{
using next_t = size_t_<Middle + (Middle - Begin + 1) / 2>;
return detect_fields_count<T>(size_t_<Middle>{}, next_t{}, 1L);
}
template <class T, std::size_t Begin, std::size_t Middle>
constexpr std::size_t detect_fields_count(size_t_<Begin>, size_t_<Middle>, int) noexcept {
using next_t = size_t_<(Begin + Middle) / 2>;
return detect_fields_count<T>(size_t_<Begin>{}, next_t{}, 1L);
}
///////////////////// Greedy search. Templates instantiation depth is log(sizeof(T)), templates instantiation count is log(sizeof(T))*T in worst case.
template <class T, std::size_t N>
constexpr auto detect_fields_count_greedy_remember(size_t_<N>, long) noexcept
-> enable_if_constructible_helper_t<T, N>
{
return N;
}
template <class T, std::size_t N>
constexpr std::size_t detect_fields_count_greedy_remember(size_t_<N>, int) noexcept {
return 0;
}
template <class T, std::size_t N>
constexpr std::size_t detect_fields_count_greedy(size_t_<N>, size_t_<N>) noexcept {
return detect_fields_count_greedy_remember<T>(size_t_<N>{}, 1L);
}
template <class T, std::size_t Begin, std::size_t Last>
constexpr std::size_t detect_fields_count_greedy(size_t_<Begin>, size_t_<Last>) noexcept {
constexpr std::size_t middle = Begin + (Last - Begin) / 2;
constexpr std::size_t fields_count_big = detect_fields_count_greedy<T>(size_t_<middle + 1>{}, size_t_<Last>{});
constexpr std::size_t fields_count_small = detect_fields_count_greedy<T>(size_t_<Begin>{}, size_t_<fields_count_big ? Begin : middle>{});
return fields_count_big ? fields_count_big : fields_count_small;
}
///////////////////// Choosing between greedy and non greedy search.
template <class T, std::size_t N>
constexpr auto detect_fields_count_dispatch(size_t_<N>, long) noexcept
-> decltype(sizeof(T{}))
{
return detect_fields_count<T>(size_t_<0>{}, size_t_<N / 2 + 1>{}, 1L);
}
template <class T, std::size_t N>
constexpr std::size_t detect_fields_count_dispatch(size_t_<N>, int) noexcept {
// T is not default aggregate initialzable. It means that at least one of the members is not default constructible,
// so we have to check all the aggregate initializations for T up to N parameters and return the bigest succeeded
// (we can not use binary search for detecting fields count).
return detect_fields_count_greedy<T>(size_t_<0>{}, size_t_<N>{});
}
///////////////////// Returns non-flattened fields count
template <class T>
constexpr std::size_t fields_count() noexcept {
using type = std::remove_cv_t<T>;
static_assert(
!std::is_reference<type>::value,
"Attempt to get fields count on a reference. This is not allowed because that could hide an issue and different library users expect different behavior in that case."
);
static_assert(
std::is_copy_constructible<std::remove_all_extents_t<type>>::value,
"Type and each field in the type must be copy constructible."
);
static_assert(
!std::is_polymorphic<type>::value,
"Type must have no virtual function, because otherwise it is not aggregate initializable."
);
#ifdef __cpp_lib_is_aggregate
static_assert(
std::is_aggregate<type>::value // Does not return `true` for build in types.
|| std::is_standard_layout<type>::value, // Does not return `true` for structs that have non standard layout members.
"Type must be aggregate initializable."
);
#endif
constexpr std::size_t max_fields_count = (sizeof(type) * 8); // We multiply by 8 because we may have bitfields in T
constexpr std::size_t result = detect_fields_count_dispatch<type>(size_t_<max_fields_count>{}, 1L);
static_assert(
is_aggregate_initializable_n<type, result>::value,
"Types with user specified constructors (non-aggregate initializable types) are not supported."
);
static_assert(
result != 0 || std::is_empty<type>::value || std::is_fundamental<type>::value || std::is_reference<type>::value,
"Something went wrong. Please report this issue to the github along with the structure you're reflecting."
);
return result;
}
namespace sequence_tuple {
template <std::size_t N, class T>
struct base_from_member {
T value;
};
template <class I, class ...Tail>
struct tuple_base;
template <std::size_t... I, class ...Tail>
struct tuple_base< std::index_sequence<I...>, Tail... >
: base_from_member<I , Tail>...
{
static constexpr std::size_t size_v = sizeof...(I);
// We do not use `noexcept` in the following functions, because if user forget to put one then clang will issue an error:
// "error: exception specification of explicitly defaulted default constructor does not match the calculated one".
constexpr tuple_base() = default;
constexpr tuple_base(tuple_base&&) = default;
constexpr tuple_base(const tuple_base&) = default;
constexpr tuple_base(Tail... v) noexcept
: base_from_member<I, Tail>{ v }...
{}
};
template <>
struct tuple_base<std::index_sequence<> > {
static constexpr std::size_t size_v = 0;
};
template <std::size_t N, class T>
constexpr T& get_impl(base_from_member<N, T>& t) noexcept {
return t.value;
}
template <std::size_t N, class T>
constexpr const T& get_impl(const base_from_member<N, T>& t) noexcept {
return t.value;
}
template <std::size_t N, class T>
constexpr volatile T& get_impl(volatile base_from_member<N, T>& t) noexcept {
return t.value;
}
template <std::size_t N, class T>
constexpr const volatile T& get_impl(const volatile base_from_member<N, T>& t) noexcept {
return t.value;
}
template <std::size_t N, class T>
constexpr T&& get_impl(base_from_member<N, T>&& t) noexcept {
return std::forward<T>(t.value);
}
template <class ...Values>
struct tuple: tuple_base<
std::make_index_sequence<sizeof...(Values)>,
Values...>
{
using tuple_base<
std::make_index_sequence<sizeof...(Values)>,
Values...
>::tuple_base;
};
template <std::size_t N, class ...T>
constexpr decltype(auto) get(tuple<T...>& t) noexcept {
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
return get_impl<N>(t);
}
template <std::size_t N, class ...T>
constexpr decltype(auto) get(const tuple<T...>& t) noexcept {
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
return get_impl<N>(t);
}
template <std::size_t N, class ...T>
constexpr decltype(auto) get(const volatile tuple<T...>& t) noexcept {
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
return get_impl<N>(t);
}
template <std::size_t N, class ...T>
constexpr decltype(auto) get(volatile tuple<T...>& t) noexcept {
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
return get_impl<N>(t);
}
template <std::size_t N, class ...T>
constexpr decltype(auto) get(tuple<T...>&& t) noexcept {
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
return get_impl<N>(std::move(t));
}
template <std::size_t I, class T>
using tuple_element = std::remove_reference< decltype(
detail::sequence_tuple::get<I>( std::declval<T>() )
) >;
} //sequence_tuple
template <class... Args>
constexpr auto make_tuple_of_references(Args&&... args) noexcept {
return sequence_tuple::tuple<Args&...>{ args... };
}
template <class T>
constexpr auto tie_as_tuple(T&, size_t_<0>) noexcept {
return sequence_tuple::tuple<>{};
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<1>, std::enable_if_t<std::is_class< std::remove_cv_t<T> >::value>* = 0) noexcept {
auto& [a] = val;
return make_tuple_of_references(a);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<1>, std::enable_if_t<!std::is_class< std::remove_cv_t<T> >::value>* = 0) noexcept {
return make_tuple_of_references( val );
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<2>) noexcept {
auto& [a,b] = val;
return make_tuple_of_references(a,b);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<3>) noexcept {
auto& [a,b,c] = val;
return make_tuple_of_references(a,b,c);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<4>) noexcept {
auto& [a,b,c,d] = val;
return make_tuple_of_references(a,b,c,d);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<5>) noexcept {
auto& [a,b,c,d,e] = val;
return make_tuple_of_references(a,b,c,d,e);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<6>) noexcept {
auto& [a,b,c,d,e,f] = val;
return make_tuple_of_references(a,b,c,d,e,f);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<7>) noexcept {
auto& [a,b,c,d,e,f,g] = val;
return make_tuple_of_references(a,b,c,d,e,f,g);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<8>) noexcept {
auto& [a,b,c,d,e,f,g,h] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<9>) noexcept {
auto& [a,b,c,d,e,f,g,h,j] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<10>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<11>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<12>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<13>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<14>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<15>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<16>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<17>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<18>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<19>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<20>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<21>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<22>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<23>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<24>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<25>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<26>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<27>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<28>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<29>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<30>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<31>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<32>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<33>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<34>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<35>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<36>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<37>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<38>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<39>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<40>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<41>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<42>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<43>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<44>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<45>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<46>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<47>) noexcept {
auto& [a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z] = val;
return make_tuple_of_references(a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<48>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<49>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<50>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<51>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<52>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<53>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<54>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<55>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<56>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<57>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<58>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<59>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<60>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<61>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<62>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap,aq
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap,aq
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<63>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap,aq,ar
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap,aq,ar
);
}
template <class T>
constexpr auto tie_as_tuple(T& val, size_t_<64>) noexcept {
auto& [
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap,aq,ar,as
] = val;
return make_tuple_of_references(
a,b,c,d,e,f,g,h,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,U,V,W,X,Y,Z,
aa,ab,ac,ad,ae,af,ag,ah,aj,ak,al,am,an,ap,aq,ar,as
);
}
template <class T>
constexpr auto tie_as_tuple(T& val) noexcept {
typedef size_t_<fields_count<T>()> fields_count_tag;
return detail::tie_as_tuple(val, fields_count_tag{});
}
template <class T, class F, std::size_t... I>
void for_each_field_dispatcher(T& t, F&& f, std::index_sequence<I...>) {
std::forward<F>(f)(
detail::tie_as_tuple(t)
);
}
template <class T, class F, class I, class = decltype(std::declval<F>()(std::declval<T>(), I{}))>
void for_each_field_impl_apply(T&& v, F&& f, I i, long) {
std::forward<F>(f)(std::forward<T>(v), i);
}
template <class T, class F, class I>
void for_each_field_impl_apply(T&& v, F&& f, I /*i*/, int) {
std::forward<F>(f)(std::forward<T>(v));
}
template <class T, class F, std::size_t... I>
void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::false_type /*move_values*/) {
const int v[] = {(
for_each_field_impl_apply(sequence_tuple::get<I>(t), std::forward<F>(f), size_t_<I>{}, 1L),
0
)...};
(void)v;
}
template <class T, class F, std::size_t... I>
void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::true_type /*move_values*/) {
const int v[] = {(
for_each_field_impl_apply(sequence_tuple::get<I>(std::move(t)), std::forward<F>(f), size_t_<I>{}, 1L),
0
)...};
(void)v;
}
} //detail
/// Calls `func` for each field of a `value`. Copied from boost library
///
/// \b Requires: C++17 or \constexprinit{C++14 constexpr aggregate intializable type}.
///
/// \param func must have one of the following signatures:
/// * any_return_type func(U&& field) // field of value is perfect forwarded to function
/// * any_return_type func(U&& field, std::size_t i)
/// * any_return_type func(U&& value, I i) // Here I is an `std::integral_constant<size_t, field_index>`
///
/// \param value To each field of this variable will be the `func` applied.
///
/// \rcast14
///
/// \b Example:
/// \code
/// struct my_struct { int i, short s; };
/// int sum = 0;
/// for_each_field(my_struct{20, 22}, [&sum](const auto& field) { sum += field; });
/// assert(sum == 42);
/// \endcode
template <class T, class F>
void for_each_field(T&& value, F&& func) {
constexpr std::size_t fields_count_val = detail::fields_count<std::remove_reference_t<T>>();
detail::for_each_field_dispatcher(
value,
[f = std::forward<F>(func), fields_count_val](auto&& t) mutable {
detail::for_each_field_impl(
t,
std::forward<F>(f),
std::make_index_sequence<fields_count_val>{},
std::is_rvalue_reference<T&&>{}
);
},
std::make_index_sequence<fields_count_val>{}
);
}
template <size_t I = 0, template<typename...> typename Tuple, typename Fn, typename... Ts>
constexpr size_t for_each_impl(Tuple<Ts...>& tup, Fn fn) {
if constexpr(I < sizeof...(Ts)) {
using result_t = decltype(fn(std::get<I>(tup)));
if constexpr (std::is_same_v<void, result_t>) {
fn(std::get<I>(tup));
}
else {
if (fn(std::get<I>(tup)))
return I;
}
return for_each_impl<I + 1>(tup, fn);
}
return I;
}
/// @brief iterates over tuple elements
/// @tparam Fn functor called on each element. If it returns value convertible to true
/// then for_each stops processing more elements and returns index of element
/// if function returns void or false it continues iterating until it reaches the end
/// @tparam Tuple<...> tuple type
/// @param t tuple
/// @param f functor
/// @return index of last processed element or size of tuple (if all elements were iterated)
template <typename Fn, typename Tuple>
constexpr inline auto for_each( Tuple& t, Fn f ) {
return for_each_impl(t, f);
}
template<typename Fn, typename Tuple>
constexpr inline auto for_each( const Tuple& t, Fn f ) {
return for_each_impl(const_cast<Tuple&>(t), f);
}
}} // bluegrass::meta
@@ -65,11 +65,6 @@ namespace bluegrass { namespace meta {
template <typename T>
constexpr bool pass_type() { return true; }
template <typename>
constexpr bool is_callable_impl(...) {
return false;
}
template <typename T>
struct wrapper_t {
using type = T;
@@ -81,9 +76,6 @@ namespace bluegrass { namespace meta {
inline constexpr U&& make_dependent(U&& u) { return static_cast<U&&>(u); }
}
template <auto FN>
inline constexpr static bool is_callable_v = BLUEGRASS_HAS_MEMBER(AUTO_PARAM_WORKAROUND(FN), operator());
template <typename F>
constexpr bool is_callable(F&& fn) { return BLUEGRASS_HAS_MEMBER(fn, operator()); }
@@ -111,7 +103,7 @@ namespace bluegrass { namespace meta {
std::tuple<std::conditional_t<Decay, std::decay_t<Args>, Args>...>>;
template <bool Decay, typename F>
constexpr auto get_types(F&& fn) {
if constexpr (is_callable_v<decltype(fn)>)
if constexpr (is_callable(fn))
return get_types<Decay>(&F::operator());
else
return get_types<Decay>(fn);
@@ -153,7 +145,7 @@ namespace bluegrass { namespace meta {
constexpr auto parameters_from_impl(R(Cls::*)(Args...)const &&) -> pack_from_t<N, Args...>;
template <std::size_t N, typename F>
constexpr auto parameters_from_impl(F&& fn) {
if constexpr (is_callable_v<decltype(fn)>)
if constexpr (is_callable(fn))
return parameters_from_impl<N>(&F::operator());
else
return parameters_from_impl<N>(fn);
@@ -1,9 +1,123 @@
#pragma once
#define BLUEGRASS_META_EXPAND(X) X
#define BLUEGRASS_META_STRINGIZE(text) BLUEGRASS_META_STRINGIZE_I(text)
#define BLUEGRASS_META_STRINGIZE_I(text) #text
#define BLUEGRASS_META_CAT(a, b) BLUEGRASS_META_CAT_I(a, b)
#define BLUEGRASS_META_CAT_I(a, b) a ## b
#define BLUEGRASS_META_EXPAND(x) BLUEGRASS_META_EXPAND_I(x)
#define BLUEGRASS_META_EXPAND_I(x) x
#define BLUEGRASS_META_GET_NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, NAME, ...) NAME
#define BLUEGRASS_META_SEQ_SIZE(seq) BLUEGRASS_META_SEQ_SIZE_I(seq)
#define BLUEGRASS_META_SEQ_SIZE_I(seq) BLUEGRASS_META_CAT(BLUEGRASS_META_SEQ_SIZE_, BLUEGRASS_META_SEQ_SIZE_0 seq)
# define BLUEGRASS_META_SEQ_SIZE_0(_) BLUEGRASS_META_SEQ_SIZE_1
# define BLUEGRASS_META_SEQ_SIZE_1(_) BLUEGRASS_META_SEQ_SIZE_2
# define BLUEGRASS_META_SEQ_SIZE_2(_) BLUEGRASS_META_SEQ_SIZE_3
# define BLUEGRASS_META_SEQ_SIZE_3(_) BLUEGRASS_META_SEQ_SIZE_4
# define BLUEGRASS_META_SEQ_SIZE_4(_) BLUEGRASS_META_SEQ_SIZE_5
# define BLUEGRASS_META_SEQ_SIZE_5(_) BLUEGRASS_META_SEQ_SIZE_6
# define BLUEGRASS_META_SEQ_SIZE_6(_) BLUEGRASS_META_SEQ_SIZE_7
# define BLUEGRASS_META_SEQ_SIZE_7(_) BLUEGRASS_META_SEQ_SIZE_8
# define BLUEGRASS_META_SEQ_SIZE_8(_) BLUEGRASS_META_SEQ_SIZE_9
# define BLUEGRASS_META_SEQ_SIZE_9(_) BLUEGRASS_META_SEQ_SIZE_10
# define BLUEGRASS_META_SEQ_SIZE_10(_) BLUEGRASS_META_SEQ_SIZE_11
# define BLUEGRASS_META_SEQ_SIZE_11(_) BLUEGRASS_META_SEQ_SIZE_12
# define BLUEGRASS_META_SEQ_SIZE_12(_) BLUEGRASS_META_SEQ_SIZE_13
# define BLUEGRASS_META_SEQ_SIZE_13(_) BLUEGRASS_META_SEQ_SIZE_14
# define BLUEGRASS_META_SEQ_SIZE_14(_) BLUEGRASS_META_SEQ_SIZE_15
# define BLUEGRASS_META_SEQ_SIZE_15(_) BLUEGRASS_META_SEQ_SIZE_16
# define BLUEGRASS_META_SEQ_SIZE_16(_) BLUEGRASS_META_SEQ_SIZE_17
# define BLUEGRASS_META_SEQ_SIZE_17(_) BLUEGRASS_META_SEQ_SIZE_18
# define BLUEGRASS_META_SEQ_SIZE_18(_) BLUEGRASS_META_SEQ_SIZE_19
# define BLUEGRASS_META_SEQ_SIZE_19(_) BLUEGRASS_META_SEQ_SIZE_20
# define BLUEGRASS_META_SEQ_SIZE_20(_) BLUEGRASS_META_SEQ_SIZE_21
# define BLUEGRASS_META_SEQ_SIZE_21(_) BLUEGRASS_META_SEQ_SIZE_22
# define BLUEGRASS_META_SEQ_SIZE_22(_) BLUEGRASS_META_SEQ_SIZE_23
# define BLUEGRASS_META_SEQ_SIZE_23(_) BLUEGRASS_META_SEQ_SIZE_24
# define BLUEGRASS_META_SEQ_SIZE_24(_) BLUEGRASS_META_SEQ_SIZE_25
# define BLUEGRASS_META_SEQ_SIZE_25(_) BLUEGRASS_META_SEQ_SIZE_26
# define BLUEGRASS_META_SEQ_SIZE_26(_) BLUEGRASS_META_SEQ_SIZE_27
# define BLUEGRASS_META_SEQ_SIZE_27(_) BLUEGRASS_META_SEQ_SIZE_28
# define BLUEGRASS_META_SEQ_SIZE_28(_) BLUEGRASS_META_SEQ_SIZE_29
# define BLUEGRASS_META_SEQ_SIZE_29(_) BLUEGRASS_META_SEQ_SIZE_30
# define BLUEGRASS_META_SEQ_SIZE_30(_) BLUEGRASS_META_SEQ_SIZE_31
# define BLUEGRASS_META_SEQ_SIZE_31(_) BLUEGRASS_META_SEQ_SIZE_32
# define BLUEGRASS_META_SEQ_SIZE_32(_) BLUEGRASS_META_SEQ_SIZE_33
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_0 0
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_1 1
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_2 2
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_3 3
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_4 4
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_5 5
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_6 6
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_7 7
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_8 8
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_9 9
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_10 10
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_11 11
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_12 12
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_13 13
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_14 14
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_15 15
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_16 16
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_17 17
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_18 18
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_19 19
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_20 20
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_21 21
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_22 22
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_23 23
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_24 24
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_25 25
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_26 26
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_27 27
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_28 28
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_29 29
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_30 30
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_31 31
# define BLUEGRASS_META_SEQ_SIZE_BLUEGRASS_META_SEQ_SIZE_32 32
#define BLUEGRASS_META_SEQ_ENUM(seq) BLUEGRASS_META_SEQ_ENUM_I(seq)
#define BLUEGRASS_META_SEQ_ENUM_I(seq) BLUEGRASS_META_CAT(BLUEGRASS_META_SEQ_ENUM_, BLUEGRASS_META_SEQ_SIZE(seq)) seq
# define BLUEGRASS_META_SEQ_ENUM_1(x) x
# define BLUEGRASS_META_SEQ_ENUM_2(x) x, BLUEGRASS_META_SEQ_ENUM_1
# define BLUEGRASS_META_SEQ_ENUM_3(x) x, BLUEGRASS_META_SEQ_ENUM_2
# define BLUEGRASS_META_SEQ_ENUM_4(x) x, BLUEGRASS_META_SEQ_ENUM_3
# define BLUEGRASS_META_SEQ_ENUM_5(x) x, BLUEGRASS_META_SEQ_ENUM_4
# define BLUEGRASS_META_SEQ_ENUM_6(x) x, BLUEGRASS_META_SEQ_ENUM_5
# define BLUEGRASS_META_SEQ_ENUM_7(x) x, BLUEGRASS_META_SEQ_ENUM_6
# define BLUEGRASS_META_SEQ_ENUM_8(x) x, BLUEGRASS_META_SEQ_ENUM_7
# define BLUEGRASS_META_SEQ_ENUM_9(x) x, BLUEGRASS_META_SEQ_ENUM_8
# define BLUEGRASS_META_SEQ_ENUM_10(x) x, BLUEGRASS_META_SEQ_ENUM_9
# define BLUEGRASS_META_SEQ_ENUM_11(x) x, BLUEGRASS_META_SEQ_ENUM_10
# define BLUEGRASS_META_SEQ_ENUM_12(x) x, BLUEGRASS_META_SEQ_ENUM_11
# define BLUEGRASS_META_SEQ_ENUM_13(x) x, BLUEGRASS_META_SEQ_ENUM_12
# define BLUEGRASS_META_SEQ_ENUM_14(x) x, BLUEGRASS_META_SEQ_ENUM_13
# define BLUEGRASS_META_SEQ_ENUM_15(x) x, BLUEGRASS_META_SEQ_ENUM_14
# define BLUEGRASS_META_SEQ_ENUM_16(x) x, BLUEGRASS_META_SEQ_ENUM_15
# define BLUEGRASS_META_SEQ_ENUM_17(x) x, BLUEGRASS_META_SEQ_ENUM_16
# define BLUEGRASS_META_SEQ_ENUM_18(x) x, BLUEGRASS_META_SEQ_ENUM_17
# define BLUEGRASS_META_SEQ_ENUM_19(x) x, BLUEGRASS_META_SEQ_ENUM_18
# define BLUEGRASS_META_SEQ_ENUM_20(x) x, BLUEGRASS_META_SEQ_ENUM_19
# define BLUEGRASS_META_SEQ_ENUM_21(x) x, BLUEGRASS_META_SEQ_ENUM_20
# define BLUEGRASS_META_SEQ_ENUM_22(x) x, BLUEGRASS_META_SEQ_ENUM_21
# define BLUEGRASS_META_SEQ_ENUM_23(x) x, BLUEGRASS_META_SEQ_ENUM_22
# define BLUEGRASS_META_SEQ_ENUM_24(x) x, BLUEGRASS_META_SEQ_ENUM_23
# define BLUEGRASS_META_SEQ_ENUM_25(x) x, BLUEGRASS_META_SEQ_ENUM_24
# define BLUEGRASS_META_SEQ_ENUM_26(x) x, BLUEGRASS_META_SEQ_ENUM_25
# define BLUEGRASS_META_SEQ_ENUM_27(x) x, BLUEGRASS_META_SEQ_ENUM_26
# define BLUEGRASS_META_SEQ_ENUM_28(x) x, BLUEGRASS_META_SEQ_ENUM_27
# define BLUEGRASS_META_SEQ_ENUM_29(x) x, BLUEGRASS_META_SEQ_ENUM_28
# define BLUEGRASS_META_SEQ_ENUM_30(x) x, BLUEGRASS_META_SEQ_ENUM_29
# define BLUEGRASS_META_SEQ_ENUM_31(x) x, BLUEGRASS_META_SEQ_ENUM_30
# define BLUEGRASS_META_SEQ_ENUM_32(x) x, BLUEGRASS_META_SEQ_ENUM_31
#define BLUEGRASS_META_FE0(MAC, ...)
#define BLUEGRASS_META_FE1(MAC, A, B) MAC(A, B)
#define BLUEGRASS_META_FE2(MAC, A, B, ...) MAC(A, B) BLUEGRASS_META_FE1(MAC, A, ##__VA_ARGS__)
@@ -73,6 +187,20 @@
BLUEGRASS_META_GET_NTH_ARG("ignored", ##__VA_ARGS__, \
BLUEGRASS_META_FE32,BLUEGRASS_META_FE31,BLUEGRASS_META_FE30,BLUEGRASS_META_FE29,BLUEGRASS_META_FE28,BLUEGRASS_META_FE27,BLUEGRASS_META_FE26,BLUEGRASS_META_FE25,BLUEGRASS_META_FE24,BLUEGRASS_META_FE23,BLUEGRASS_META_FE22,BLUEGRASS_META_FE21,BLUEGRASS_META_FE20,BLUEGRASS_META_FE19,BLUEGRASS_META_FE18,BLUEGRASS_META_FE17,BLUEGRASS_META_FE16,BLUEGRASS_META_FE15,BLUEGRASS_META_FE14,BLUEGRASS_META_FE13,BLUEGRASS_META_FE12,BLUEGRASS_META_FE11,BLUEGRASS_META_FE10,BLUEGRASS_META_FE9,BLUEGRASS_META_FE8,BLUEGRASS_META_FE7,BLUEGRASS_META_FE6,BLUEGRASS_META_FE5,BLUEGRASS_META_FE4,BLUEGRASS_META_FE3,BLUEGRASS_META_FE2,BLUEGRASS_META_FE1,BLUEGRASS_META_FE0)(MAC, D, ##__VA_ARGS__)
#define BLUEGRASS_META_FOREACH_SEQ_ARGS(MAC, D, SEQ) \
(MAC, D, BLUEGRASS_META_SEQ_ENUM(SEQ))
#define BLUEGRASS_META_GET_NTH_ARG_SEQ_ARGS(...) \
("ignored", BLUEGRASS_META_SEQ_ENUM(__VA_ARGS__), BLUEGRASS_META_FE32,BLUEGRASS_META_FE31,BLUEGRASS_META_FE30,BLUEGRASS_META_FE29,BLUEGRASS_META_FE28,BLUEGRASS_META_FE27,BLUEGRASS_META_FE26,BLUEGRASS_META_FE25,BLUEGRASS_META_FE24,BLUEGRASS_META_FE23,BLUEGRASS_META_FE22,BLUEGRASS_META_FE21,BLUEGRASS_META_FE20,BLUEGRASS_META_FE19,BLUEGRASS_META_FE18,BLUEGRASS_META_FE17,BLUEGRASS_META_FE16,BLUEGRASS_META_FE15,BLUEGRASS_META_FE14,BLUEGRASS_META_FE13,BLUEGRASS_META_FE12,BLUEGRASS_META_FE11,BLUEGRASS_META_FE10,BLUEGRASS_META_FE9,BLUEGRASS_META_FE8,BLUEGRASS_META_FE7,BLUEGRASS_META_FE6,BLUEGRASS_META_FE5,BLUEGRASS_META_FE4,BLUEGRASS_META_FE3,BLUEGRASS_META_FE2,BLUEGRASS_META_FE1,BLUEGRASS_META_FE0)
#define BLUEGRASS_META_FOREACH_SEQ(MAC, D, ...) \
BLUEGRASS_META_EXPAND(BLUEGRASS_META_EXPAND(BLUEGRASS_META_GET_NTH_ARG BLUEGRASS_META_GET_NTH_ARG_SEQ_ARGS(__VA_ARGS__)) BLUEGRASS_META_FOREACH_SEQ_ARGS(MAC, D, ##__VA_ARGS__))
#define BLUEGRASS_META_FOREACH(MAC, D, ...) \
BLUEGRASS_META_GET_NTH_ARG("ignored", ##__VA_ARGS__, \
BLUEGRASS_META_FE_COMMA32,BLUEGRASS_META_FE_COMMA31,BLUEGRASS_META_FE_COMMA30,BLUEGRASS_META_FE_COMMA29,BLUEGRASS_META_FE_COMMA28,BLUEGRASS_META_FE_COMMA27,BLUEGRASS_META_FE_COMMA26,BLUEGRASS_META_FE_COMMA25,BLUEGRASS_META_FE_COMMA24,BLUEGRASS_META_FE_COMMA23,BLUEGRASS_META_FE_COMMA22,BLUEGRASS_META_FE_COMMA21,BLUEGRASS_META_FE_COMMA20,BLUEGRASS_META_FE_COMMA19,BLUEGRASS_META_FE_COMMA18,BLUEGRASS_META_FE_COMMA17,BLUEGRASS_META_FE_COMMA16,BLUEGRASS_META_FE_COMMA15,BLUEGRASS_META_FE_COMMA14,BLUEGRASS_META_FE_COMMA13,BLUEGRASS_META_FE_COMMA12,BLUEGRASS_META_FE_COMMA11,BLUEGRASS_META_FE_COMMA10,BLUEGRASS_META_FE_COMMA9,BLUEGRASS_META_FE_COMMA8,BLUEGRASS_META_FE_COMMA7,BLUEGRASS_META_FE_COMMA6,BLUEGRASS_META_FE_COMMA5,BLUEGRASS_META_FE_COMMA4,BLUEGRASS_META_FE_COMMA3,BLUEGRASS_META_FE_COMMA2,BLUEGRASS_META_FE1,BLUEGRASS_META_FE0)(MAC, D, ##__VA_ARGS__)
#define BLUEGRASS_META_ARGS_NUM(...) \
BLUEGRASS_META_GET_NTH_ARG(__VA_ARGS__, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,)
#define BLUEGRASS_META_OVERLOAD(MAC, ...) \
BLUEGRASS_META_CAT(MAC,BLUEGRASS_META_ARGS_NUM(__VA_ARGS__))
@@ -16,7 +16,7 @@ if (NOT ${found_project})
ExternalProject_Add(
catch2_external_proj
GIT_REPOSITORY "https://github.com/catchorg/Catch2"
GIT_TAG "v2.12.2"
GIT_TAG "v2.13.10"
SOURCE_DIR @CATCH2_DIRECTORY@/catch2
BINARY_DIR @CATCH2_DIRECTORY@/catch2
BUILD_ALWAYS 0
+193 -143
View File
@@ -17,334 +17,346 @@
using namespace eosio::native;
extern "C" {
void get_resource_limits( capi_name account, int64_t* ram_bytes, int64_t* net_weight, int64_t* cpu_weight ) {
return intrinsics::get().call<intrinsics::get_resource_limits>(account, ram_bytes, net_weight, cpu_weight);
return intrinsics::get().exec<intrinsics::get_resource_limits>(account, ram_bytes, net_weight, cpu_weight);
}
void set_resource_limits( capi_name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight ) {
return intrinsics::get().call<intrinsics::set_resource_limits>(account, ram_bytes, net_weight, cpu_weight);
return intrinsics::get().exec<intrinsics::set_resource_limits>(account, ram_bytes, net_weight, cpu_weight);
}
int64_t set_proposed_producers( char *producer_data, uint32_t producer_data_size ) {
return intrinsics::get().call<intrinsics::set_proposed_producers>(producer_data, producer_data_size);
return intrinsics::get().exec<intrinsics::set_proposed_producers>(producer_data, producer_data_size);
}
int64_t set_proposed_producers_ex( uint64_t producer_data_format, char *producer_data, uint32_t producer_data_size ) {
return intrinsics::get().call<intrinsics::set_proposed_producers_ex>(producer_data_format, producer_data, producer_data_size);
return intrinsics::get().exec<intrinsics::set_proposed_producers_ex>(producer_data_format, producer_data, producer_data_size);
}
uint32_t get_blockchain_parameters_packed( char* data, uint32_t datalen ) {
return intrinsics::get().call<intrinsics::get_blockchain_parameters_packed>(data, datalen);
return intrinsics::get().exec<intrinsics::get_blockchain_parameters_packed>(data, datalen);
}
void set_blockchain_parameters_packed( char* data, uint32_t datalen ) {
return intrinsics::get().call<intrinsics::set_blockchain_parameters_packed>(data, datalen);
return intrinsics::get().exec<intrinsics::set_blockchain_parameters_packed>(data, datalen);
}
bool is_privileged( capi_name account ) {
return intrinsics::get().call<intrinsics::is_privileged>(account);
return intrinsics::get().exec<intrinsics::is_privileged>(account);
}
void set_privileged( capi_name account, bool is_priv ) {
return intrinsics::get().call<intrinsics::set_privileged>(account, is_priv);
return intrinsics::get().exec<intrinsics::set_privileged>(account, is_priv);
}
bool is_feature_activated( const capi_checksum256* feature_digest ) {
return intrinsics::get().call<intrinsics::is_feature_activated>(feature_digest);
return intrinsics::get().exec<intrinsics::is_feature_activated>(feature_digest);
}
void preactivate_feature( const capi_checksum256* feature_digest ) {
return intrinsics::get().call<intrinsics::preactivate_feature>(feature_digest);
return intrinsics::get().exec<intrinsics::preactivate_feature>(feature_digest);
}
uint32_t get_active_producers( capi_name* producers, uint32_t datalen ) {
return intrinsics::get().call<intrinsics::get_active_producers>(producers, datalen);
return intrinsics::get().exec<intrinsics::get_active_producers>(producers, datalen);
}
int32_t db_idx64_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint64_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx64_store>(scope, table, payer, id, secondary);
return intrinsics::get().exec<intrinsics::db_idx64_store>(scope, table, payer, id, secondary);
}
void db_idx64_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx64_remove>(iterator);
return intrinsics::get().exec<intrinsics::db_idx64_remove>(iterator);
}
void db_idx64_update(int32_t iterator, capi_name payer, const uint64_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx64_update>(iterator, payer, secondary);
return intrinsics::get().exec<intrinsics::db_idx64_update>(iterator, payer, secondary);
}
int32_t db_idx64_find_primary(capi_name code, uint64_t scope, capi_name table, uint64_t* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx64_find_primary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx64_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx64_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint64_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_find_secondary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx64_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx64_lowerbound(capi_name code, uint64_t scope, capi_name table, uint64_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_lowerbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx64_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx64_upperbound(capi_name code, uint64_t scope, capi_name table, uint64_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_upperbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx64_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx64_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx64_end>(code, scope, table);
return intrinsics::get().exec<intrinsics::db_idx64_end>(code, scope, table);
}
int32_t db_idx64_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_next>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx64_next>(iterator, primary);
}
int32_t db_idx64_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx64_previous>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx64_previous>(iterator, primary);
}
int32_t db_idx128_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint128_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx128_store>(scope, table, payer, id, secondary);
return intrinsics::get().exec<intrinsics::db_idx128_store>(scope, table, payer, id, secondary);
}
void db_idx128_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx128_remove>(iterator);
return intrinsics::get().exec<intrinsics::db_idx128_remove>(iterator);
}
void db_idx128_update(int32_t iterator, capi_name payer, const uint128_t* secondary) {
return intrinsics::get().call<intrinsics::db_idx128_update>(iterator, payer, secondary);
return intrinsics::get().exec<intrinsics::db_idx128_update>(iterator, payer, secondary);
}
int32_t db_idx128_find_primary(capi_name code, uint64_t scope, capi_name table, uint128_t* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx128_find_primary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx128_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx128_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint128_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_find_secondary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx128_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx128_lowerbound(capi_name code, uint64_t scope, capi_name table, uint128_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_lowerbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx128_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx128_upperbound(capi_name code, uint64_t scope, capi_name table, uint128_t* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_upperbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx128_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx128_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx128_end>(code, scope, table);
return intrinsics::get().exec<intrinsics::db_idx128_end>(code, scope, table);
}
int32_t db_idx128_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_next>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx128_next>(iterator, primary);
}
int32_t db_idx128_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx128_previous>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx128_previous>(iterator, primary);
}
int32_t db_idx256_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const uint128_t* data, uint32_t datalen) {
return intrinsics::get().call<intrinsics::db_idx256_store>(scope, table, payer, id, data, datalen);
return intrinsics::get().exec<intrinsics::db_idx256_store>(scope, table, payer, id, data, datalen);
}
void db_idx256_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx256_remove>(iterator);
return intrinsics::get().exec<intrinsics::db_idx256_remove>(iterator);
}
void db_idx256_update(int32_t iterator, capi_name payer, const uint128_t* data, uint32_t datalen) {
return intrinsics::get().call<intrinsics::db_idx256_update>(iterator, payer, data, datalen);
return intrinsics::get().exec<intrinsics::db_idx256_update>(iterator, payer, data, datalen);
}
int32_t db_idx256_find_primary(capi_name code, uint64_t scope, capi_name table, uint128_t* data, uint32_t datalen, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx256_find_primary>(code, scope, table, data, datalen, primary);
return intrinsics::get().exec<intrinsics::db_idx256_find_primary>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_find_secondary(capi_name code, uint64_t scope, capi_name table, const uint128_t* data, uint32_t datalen, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_find_secondary>(code, scope, table, data, datalen, primary);
return intrinsics::get().exec<intrinsics::db_idx256_find_secondary>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_lowerbound(capi_name code, uint64_t scope, capi_name table, uint128_t* data, uint32_t datalen, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_lowerbound>(code, scope, table, data, datalen, primary);
return intrinsics::get().exec<intrinsics::db_idx256_lowerbound>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_upperbound(capi_name code, uint64_t scope, capi_name table, uint128_t* data, uint32_t datalen, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_upperbound>(code, scope, table, data, datalen, primary);
return intrinsics::get().exec<intrinsics::db_idx256_upperbound>(code, scope, table, data, datalen, primary);
}
int32_t db_idx256_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx256_end>(code, scope, table);
return intrinsics::get().exec<intrinsics::db_idx256_end>(code, scope, table);
}
int32_t db_idx256_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_next>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx256_next>(iterator, primary);
}
int32_t db_idx256_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx256_previous>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx256_previous>(iterator, primary);
}
int32_t db_idx_double_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_double_store>(scope, table, payer, id, secondary);
return intrinsics::get().exec<intrinsics::db_idx_double_store>(scope, table, payer, id, secondary);
}
void db_idx_double_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx_double_remove>(iterator);
return intrinsics::get().exec<intrinsics::db_idx_double_remove>(iterator);
}
void db_idx_double_update(int32_t iterator, capi_name payer, const double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_double_update>(iterator, payer, secondary);
return intrinsics::get().exec<intrinsics::db_idx_double_update>(iterator, payer, secondary);
}
int32_t db_idx_double_find_primary(capi_name code, uint64_t scope, capi_name table, double* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx_double_find_primary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_double_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_find_secondary(capi_name code, uint64_t scope, capi_name table, const double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_find_secondary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_double_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_lowerbound(capi_name code, uint64_t scope, capi_name table, double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_lowerbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_double_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_upperbound(capi_name code, uint64_t scope, capi_name table, double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_upperbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_double_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_double_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx_double_end>(code, scope, table);
return intrinsics::get().exec<intrinsics::db_idx_double_end>(code, scope, table);
}
int32_t db_idx_double_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_next>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx_double_next>(iterator, primary);
}
int32_t db_idx_double_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_double_previous>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx_double_previous>(iterator, primary);
}
int32_t db_idx_long_double_store(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const long double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_store>(scope, table, payer, id, secondary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_store>(scope, table, payer, id, secondary);
}
void db_idx_long_double_remove(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_idx_long_double_remove>(iterator);
return intrinsics::get().exec<intrinsics::db_idx_long_double_remove>(iterator);
}
void db_idx_long_double_update(int32_t iterator, capi_name payer, const long double* secondary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_update>(iterator, payer, secondary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_update>(iterator, payer, secondary);
}
int32_t db_idx_long_double_find_primary(capi_name code, uint64_t scope, capi_name table, long double* secondary, uint64_t primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_find_primary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_find_primary>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_find_secondary(capi_name code, uint64_t scope, capi_name table, const long double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_find_secondary>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_find_secondary>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_lowerbound(capi_name code, uint64_t scope, capi_name table, long double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_lowerbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_lowerbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_upperbound(capi_name code, uint64_t scope, capi_name table, long double* secondary, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_upperbound>(code, scope, table, secondary, primary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_upperbound>(code, scope, table, secondary, primary);
}
int32_t db_idx_long_double_end(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_idx_long_double_end>(code, scope, table);
return intrinsics::get().exec<intrinsics::db_idx_long_double_end>(code, scope, table);
}
int32_t db_idx_long_double_next(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_next>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_next>(iterator, primary);
}
int32_t db_idx_long_double_previous(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_idx_long_double_previous>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_idx_long_double_previous>(iterator, primary);
}
int32_t db_store_i64(uint64_t scope, capi_name table, capi_name payer, uint64_t id, const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::db_store_i64>(scope, table, payer, id, data, len);
return intrinsics::get().exec<intrinsics::db_store_i64>(scope, table, payer, id, data, len);
}
void db_update_i64(int32_t iterator, capi_name payer, const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::db_update_i64>(iterator, payer, data, len);
return intrinsics::get().exec<intrinsics::db_update_i64>(iterator, payer, data, len);
}
void db_remove_i64(int32_t iterator) {
return intrinsics::get().call<intrinsics::db_remove_i64>(iterator);
return intrinsics::get().exec<intrinsics::db_remove_i64>(iterator);
}
int32_t db_get_i64(int32_t iterator, const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::db_get_i64>(iterator, data, len);
return intrinsics::get().exec<intrinsics::db_get_i64>(iterator, data, len);
}
int32_t db_next_i64(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_next_i64>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_next_i64>(iterator, primary);
}
int32_t db_previous_i64(int32_t iterator, uint64_t* primary) {
return intrinsics::get().call<intrinsics::db_previous_i64>(iterator, primary);
return intrinsics::get().exec<intrinsics::db_previous_i64>(iterator, primary);
}
int32_t db_find_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id) {
return intrinsics::get().call<intrinsics::db_find_i64>(code, scope, table, id);
return intrinsics::get().exec<intrinsics::db_find_i64>(code, scope, table, id);
}
int32_t db_lowerbound_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id) {
return intrinsics::get().call<intrinsics::db_lowerbound_i64>(code, scope, table, id);
return intrinsics::get().exec<intrinsics::db_lowerbound_i64>(code, scope, table, id);
}
int32_t db_upperbound_i64(capi_name code, uint64_t scope, capi_name table, uint64_t id) {
return intrinsics::get().call<intrinsics::db_upperbound_i64>(code, scope, table, id);
return intrinsics::get().exec<intrinsics::db_upperbound_i64>(code, scope, table, id);
}
int32_t db_end_i64(capi_name code, uint64_t scope, capi_name table) {
return intrinsics::get().call<intrinsics::db_end_i64>(code, scope, table);
return intrinsics::get().exec<intrinsics::db_end_i64>(code, scope, table);
}
void assert_recover_key( const capi_checksum256* digest, const char* sig, size_t siglen, const char* pub, size_t publen ) {
return intrinsics::get().call<intrinsics::assert_recover_key>(digest, sig, siglen, pub, publen);
return intrinsics::get().exec<intrinsics::assert_recover_key>(digest, sig, siglen, pub, publen);
}
int recover_key( const capi_checksum256* digest, const char* sig, size_t siglen, char* pub, size_t publen ) {
return intrinsics::get().call<intrinsics::recover_key>(digest, sig, siglen, pub, publen);
return intrinsics::get().exec<intrinsics::recover_key>(digest, sig, siglen, pub, publen);
}
void assert_sha256( const char* data, uint32_t length, const capi_checksum256* hash ) {
return intrinsics::get().call<intrinsics::assert_sha256>(data, length, hash);
return intrinsics::get().exec<intrinsics::assert_sha256>(data, length, hash);
}
void assert_sha1( const char* data, uint32_t length, const capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::assert_sha1>(data, length, hash);
return intrinsics::get().exec<intrinsics::assert_sha1>(data, length, hash);
}
void assert_sha512( const char* data, uint32_t length, const capi_checksum512* hash ) {
return intrinsics::get().call<intrinsics::assert_sha512>(data, length, hash);
return intrinsics::get().exec<intrinsics::assert_sha512>(data, length, hash);
}
void assert_ripemd160( const char* data, uint32_t length, const capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::assert_ripemd160>(data, length, hash);
return intrinsics::get().exec<intrinsics::assert_ripemd160>(data, length, hash);
}
void sha256( const char* data, uint32_t length, capi_checksum256* hash ) {
return intrinsics::get().call<intrinsics::sha256>(data, length, hash);
return intrinsics::get().exec<intrinsics::sha256>(data, length, hash);
}
void sha1( const char* data, uint32_t length, capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::sha1>(data, length, hash);
return intrinsics::get().exec<intrinsics::sha1>(data, length, hash);
}
void sha512( const char* data, uint32_t length, capi_checksum512* hash ) {
return intrinsics::get().call<intrinsics::sha512>(data, length, hash);
return intrinsics::get().exec<intrinsics::sha512>(data, length, hash);
}
void ripemd160( const char* data, uint32_t length, capi_checksum160* hash ) {
return intrinsics::get().call<intrinsics::ripemd160>(data, length, hash);
return intrinsics::get().exec<intrinsics::ripemd160>(data, length, hash);
}
int32_t check_transaction_authorization( const char* trx_data, uint32_t trx_size,
const char* pubkeys_data, uint32_t pubkeys_size,
const char* perms_data, uint32_t perms_size
) {
return intrinsics::get().call<intrinsics::check_transaction_authorization>(trx_data, trx_size, pubkeys_data, pubkeys_size, perms_data, perms_size);
return intrinsics::get().exec<intrinsics::check_transaction_authorization>(trx_data, trx_size, pubkeys_data, pubkeys_size, perms_data, perms_size);
}
int32_t check_permission_authorization( capi_name account, capi_name permission,
const char* pubkeys_data, uint32_t pubkeys_size,
const char* perms_data, uint32_t perms_size, uint64_t delay_us
) {
return intrinsics::get().call<intrinsics::check_permission_authorization>(account, permission, pubkeys_data, pubkeys_size, perms_data, perms_size, delay_us);
return intrinsics::get().exec<intrinsics::check_permission_authorization>(account, permission, pubkeys_data, pubkeys_size, perms_data, perms_size, delay_us);
}
int64_t get_permission_last_used( capi_name account, capi_name permission ) {
return intrinsics::get().call<intrinsics::get_permission_last_used>(account, permission);
return intrinsics::get().exec<intrinsics::get_permission_last_used>(account, permission);
}
int64_t get_account_creation_time( capi_name account ) {
return intrinsics::get().call<intrinsics::get_account_creation_time>(account);
return intrinsics::get().exec<intrinsics::get_account_creation_time>(account);
}
uint64_t current_time() {
return intrinsics::get().call<intrinsics::current_time>();
return intrinsics::get().exec<intrinsics::current_time>();
}
uint64_t publication_time() {
return intrinsics::get().call<intrinsics::publication_time>();
return intrinsics::get().exec<intrinsics::publication_time>();
}
uint32_t read_action_data( void* msg, uint32_t len ) {
return intrinsics::get().call<intrinsics::read_action_data>(msg, len);
return intrinsics::get().exec<intrinsics::read_action_data>(msg, len);
}
uint32_t action_data_size() {
return intrinsics::get().call<intrinsics::action_data_size>();
return intrinsics::get().exec<intrinsics::action_data_size>();
}
capi_name current_receiver() {
return intrinsics::get().call<intrinsics::current_receiver>();
return intrinsics::get().exec<intrinsics::current_receiver>();
}
void set_action_return_value( void* rv, size_t len ) {
intrinsics::get().call<intrinsics::set_action_return_value>(rv, len);
intrinsics::get().exec<intrinsics::set_action_return_value>(rv, len);
}
void require_recipient( capi_name name ) {
return intrinsics::get().call<intrinsics::require_recipient>(name);
return intrinsics::get().exec<intrinsics::require_recipient>(name);
}
void require_auth( capi_name name ) {
return intrinsics::get().call<intrinsics::require_auth>(name);
return intrinsics::get().exec<intrinsics::require_auth>(name);
}
void require_auth2( capi_name name, capi_name permission ) {
return intrinsics::get().call<intrinsics::require_auth2>(name, permission);
return intrinsics::get().exec<intrinsics::require_auth2>(name, permission);
}
bool has_auth( capi_name name ) {
return intrinsics::get().call<intrinsics::has_auth>(name);
return intrinsics::get().exec<intrinsics::has_auth>(name);
}
bool is_account( capi_name name ) {
return intrinsics::get().call<intrinsics::is_account>(name);
return intrinsics::get().exec<intrinsics::is_account>(name);
}
size_t read_transaction(char *buffer, size_t size) {
return intrinsics::get().call<intrinsics::read_transaction>(buffer, size);
return intrinsics::get().exec<intrinsics::read_transaction>(buffer, size);
}
size_t transaction_size() {
return intrinsics::get().call<intrinsics::transaction_size>();
return intrinsics::get().exec<intrinsics::transaction_size>();
}
uint32_t expiration() {
return intrinsics::get().call<intrinsics::expiration>();
return intrinsics::get().exec<intrinsics::expiration>();
}
int tapos_block_prefix() {
return intrinsics::get().call<intrinsics::tapos_block_prefix>();
return intrinsics::get().exec<intrinsics::tapos_block_prefix>();
}
int tapos_block_num() {
return intrinsics::get().call<intrinsics::tapos_block_num>();
return intrinsics::get().exec<intrinsics::tapos_block_num>();
}
int get_action( uint32_t type, uint32_t index, char* buff, size_t size ) {
return intrinsics::get().call<intrinsics::get_action>(type, index, buff, size);
return intrinsics::get().exec<intrinsics::get_action>(type, index, buff, size);
}
void send_inline(char *serialized_action, size_t size) {
return intrinsics::get().call<intrinsics::send_inline>(serialized_action, size);
return intrinsics::get().exec<intrinsics::send_inline>(serialized_action, size);
}
void send_context_free_inline(char *serialized_action, size_t size) {
return intrinsics::get().call<intrinsics::send_context_free_inline>(serialized_action, size);
return intrinsics::get().exec<intrinsics::send_context_free_inline>(serialized_action, size);
}
void send_deferred(const uint128_t* sender_id, capi_name payer, const char *serialized_transaction, size_t size, uint32_t replace_existing) {
return intrinsics::get().call<intrinsics::send_deferred>(sender_id, payer, serialized_transaction, size, replace_existing);
return intrinsics::get().exec<intrinsics::send_deferred>(sender_id, payer, serialized_transaction, size, replace_existing);
}
int cancel_deferred(const uint128_t* sender_id) {
return intrinsics::get().call<intrinsics::cancel_deferred>(sender_id);
return intrinsics::get().exec<intrinsics::cancel_deferred>(sender_id);
}
int get_context_free_data( uint32_t index, char* buff, size_t size ) {
return intrinsics::get().call<intrinsics::get_context_free_data>(index, buff, size);
return intrinsics::get().exec<intrinsics::get_context_free_data>(index, buff, size);
}
capi_name get_sender() {
return intrinsics::get().call<intrinsics::get_sender>();
return intrinsics::get().exec<intrinsics::get_sender>();
}
int64_t call(capi_name receiver, uint64_t flags, const char* data, size_t data_size) {
return intrinsics::get().exec<intrinsics::call>(receiver, flags, data, data_size);
}
uint32_t get_call_return_value(void* mem, uint32_t len) {
return intrinsics::get().exec<intrinsics::get_call_return_value>(mem, len);
}
uint32_t get_call_data(void* mem, uint32_t len) {
return intrinsics::get().exec<intrinsics::get_call_data>(mem, len);
}
void set_call_return_value(void* mem, uint32_t len) {
return intrinsics::get().exec<intrinsics::set_call_return_value>(mem, len);
}
// softfloat
@@ -786,47 +798,47 @@ extern "C" {
}
void prints_l(const char* cstr, uint32_t len) {
return intrinsics::get().call<intrinsics::prints_l>(cstr, len);
return intrinsics::get().exec<intrinsics::prints_l>(cstr, len);
}
void prints(const char* cstr) {
return intrinsics::get().call<intrinsics::prints>(cstr);
return intrinsics::get().exec<intrinsics::prints>(cstr);
}
void printi(int64_t value) {
return intrinsics::get().call<intrinsics::printi>(value);
return intrinsics::get().exec<intrinsics::printi>(value);
}
void printui(uint64_t value) {
return intrinsics::get().call<intrinsics::printui>(value);
return intrinsics::get().exec<intrinsics::printui>(value);
}
void printi128(const int128_t* value) {
return intrinsics::get().call<intrinsics::printi128>(value);
return intrinsics::get().exec<intrinsics::printi128>(value);
}
void printui128(const uint128_t* value) {
return intrinsics::get().call<intrinsics::printui128>(value);
return intrinsics::get().exec<intrinsics::printui128>(value);
}
void printsf(float value) {
return intrinsics::get().call<intrinsics::printsf>(value);
return intrinsics::get().exec<intrinsics::printsf>(value);
}
void printdf(double value) {
return intrinsics::get().call<intrinsics::printdf>(value);
return intrinsics::get().exec<intrinsics::printdf>(value);
}
void printqf(const long double* value) {
return intrinsics::get().call<intrinsics::printqf>(value);
return intrinsics::get().exec<intrinsics::printqf>(value);
}
void printn(uint64_t nm) {
return intrinsics::get().call<intrinsics::printn>(nm);
return intrinsics::get().exec<intrinsics::printn>(nm);
}
void printhex(const void* data, uint32_t len) {
return intrinsics::get().call<intrinsics::printhex>(data, len);
return intrinsics::get().exec<intrinsics::printhex>(data, len);
}
void* memset ( void* ptr, int value, size_t num ) {
@@ -890,49 +902,87 @@ extern "C" {
}
#pragma clang diagnostic pop
int64_t add_security_group_participants(const char* data, uint32_t datalen) {
return intrinsics::get().call<intrinsics::add_security_group_participants>(data, datalen);
void set_finalizers(uint64_t packed_finalizer_format, const char* data, uint32_t len) {
intrinsics::get().exec<intrinsics::set_finalizers>(packed_finalizer_format, data, len);
}
int64_t remove_security_group_participants(const char* data, uint32_t datalen){
return intrinsics::get().call<intrinsics::remove_security_group_participants>(data, datalen);
}
bool in_active_security_group(const char* data, uint32_t datalen){
return intrinsics::get().call<intrinsics::in_active_security_group>(data, datalen);
}
uint32_t get_active_security_group(char* data, uint32_t datalen){
return intrinsics::get().call<intrinsics::get_active_security_group>(data, datalen);
}
}
} // extern "C"
int32_t blake2_f( uint32_t rounds, const char* state, uint32_t state_len, const char* msg, uint32_t msg_len,
const char* t0_offset, uint32_t t0_len, const char* t1_offset, uint32_t t1_len, int32_t final, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::blake2_f>(rounds, state, state_len, msg, msg_len, t0_offset, t0_len, t1_offset, t1_len, final, result, result_len);
return intrinsics::get().exec<intrinsics::blake2_f>(rounds, state, state_len, msg, msg_len, t0_offset, t0_len, t1_offset, t1_len, final, result, result_len);
}
int32_t k1_recover( const char* sig, uint32_t sig_len, const char* dig, uint32_t dig_len, char* pub, uint32_t pub_len) {
return intrinsics::get().call<intrinsics::k1_recover>(sig, sig_len, dig, dig_len, pub, pub_len);
return intrinsics::get().exec<intrinsics::k1_recover>(sig, sig_len, dig, dig_len, pub, pub_len);
}
int32_t alt_bn128_add( const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::alt_bn128_add>(op1, op1_len, op2, op2_len, result, result_len);
return intrinsics::get().exec<intrinsics::alt_bn128_add>(op1, op1_len, op2, op2_len, result, result_len);
}
int32_t alt_bn128_mul( const char* g1, uint32_t g1_len, const char* scalar, uint32_t scalar_len, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::alt_bn128_mul>(g1, g1_len, scalar, scalar_len, result, result_len);
return intrinsics::get().exec<intrinsics::alt_bn128_mul>(g1, g1_len, scalar, scalar_len, result, result_len);
}
int32_t alt_bn128_pair( const char* pairs, uint32_t pairs_len) {
return intrinsics::get().call<intrinsics::alt_bn128_pair>(pairs, pairs_len);
return intrinsics::get().exec<intrinsics::alt_bn128_pair>(pairs, pairs_len);
}
int32_t mod_exp( const char* base, uint32_t base_len, const char* exp, uint32_t exp_len, const char* mod, uint32_t mod_len, char* result, uint32_t result_len) {
return intrinsics::get().call<intrinsics::mod_exp>(base, base_len, exp, exp_len, mod, mod_len, result, result_len);
return intrinsics::get().exec<intrinsics::mod_exp>(base, base_len, exp, exp_len, mod, mod_len, result, result_len);
}
void sha3( const char* data, uint32_t data_len, char* hash, uint32_t hash_len, int32_t keccak ) {
intrinsics::get().call<intrinsics::sha3>(data, data_len, hash, hash_len, keccak);
}
intrinsics::get().exec<intrinsics::sha3>(data, data_len, hash, hash_len, keccak);
}
int32_t bls_g1_add(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_g1_add>(op1, op1_len, op2, op2_len, res, res_len);
}
int32_t bls_g2_add(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_g2_add>(op1, op1_len, op2, op2_len, res, res_len);
}
int32_t bls_g1_weighted_sum(const char* points, uint32_t points_len, const char* scalars, uint32_t scalars_len, uint32_t n, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_g1_weighted_sum>(points, points_len, scalars, scalars_len, n, res, res_len);
}
int32_t bls_g2_weighted_sum(const char* points, uint32_t points_len, const char* scalars, uint32_t scalars_len, uint32_t n, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_g2_weighted_sum>(points, points_len, scalars, scalars_len, n, res, res_len);
}
int32_t bls_pairing(const char* g1_points, uint32_t g1_points_len, const char* g2_points, uint32_t g2_points_len, uint32_t n, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_pairing>(g1_points, g1_points_len, g1_points, g1_points_len, n, res, res_len);
}
int32_t bls_g1_map(const char* e, uint32_t e_len, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_g1_map>(e, e_len, res, res_len);
}
int32_t bls_g2_map(const char* e, uint32_t e_len, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_g2_map>(e, e_len, res, res_len);
}
int32_t bls_fp_mod(const char* s, uint32_t s_len, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_fp_mod>(s, s_len, res, res_len);
}
int32_t bls_fp_mul(const char* op1, uint32_t op1_len, const char* op2, uint32_t op2_len, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_fp_mul>(op1, op1_len, op2, op2_len, res, res_len);
}
int32_t bls_fp_exp(const char* base, uint32_t base_len, const char* exp, uint32_t exp_len, char* res, uint32_t res_len)
{
return intrinsics::get().exec<intrinsics::bls_fp_exp>(base, base_len, exp, exp_len, res, res_len);
}
+13 -7
View File
@@ -1,19 +1,25 @@
#pragma once
#include <setjmp.h>
#include <string>
namespace eosio { namespace cdt {
enum output_stream_kind {
std_out,
std_err,
none
};
struct output_stream {
char output[1024*2];
size_t index = 0;
std::string to_string()const { return std::string((const char*)output, index); }
const char* get()const { return output; }
void push(char c) { output[index++] = c; }
void clear() { index = 0; }
class output_stream {
static constexpr size_t initial_size = 1024 * 4;
std::string output;
public:
output_stream() { output.reserve(initial_size); }
const std::string& to_string() const { return output; }
const char* get() const { return output.c_str(); }
size_t index() const { return output.size(); }
void push(char c) { output.push_back(c); }
void clear() { output.clear(); }
};
}} //ns eosio::cdt
+1 -1
View File
@@ -24,7 +24,7 @@ namespace eosio { namespace native {
};
template <intrinsic_name IN, typename... Args>
auto call(Args... args) -> decltype(std::get<IN>(intrinsics::get().funcs)(args...)) {
auto exec(Args... args) -> decltype(std::get<IN>(intrinsics::get().funcs)(args...)) {
return std::get<IN>(intrinsics::get().funcs)(args...);
}
@@ -4,16 +4,19 @@
#include <eosio/chain.h>
#include <eosio/crypto.h>
#include <eosio/crypto_ext.h>
#include <eosio/crypto_bls_ext.h>
#include <eosio/db.h>
#include <eosio/instant_finality.h>
#include <eosio/call.h>
#include <eosio/permission.h>
#include <eosio/print.h>
#include <eosio/privileged.h>
#include <eosio/system.h>
#include <eosio/transaction.h>
#include <eosio/types.h>
#include <eosio/security_group.h>
#include <type_traits>
#include <functional>
namespace eosio { namespace native {
template <typename... Args, size_t... Is>
@@ -161,19 +164,28 @@ intrinsic_macro(cancel_deferred) \
intrinsic_macro(get_context_free_data) \
intrinsic_macro(get_sender) \
intrinsic_macro(set_action_return_value) \
intrinsic_macro(add_security_group_participants) \
intrinsic_macro(remove_security_group_participants) \
intrinsic_macro(in_active_security_group) \
intrinsic_macro(get_active_security_group) \
intrinsic_macro(blake2_f) \
intrinsic_macro(sha3) \
intrinsic_macro(k1_recover) \
intrinsic_macro(alt_bn128_add) \
intrinsic_macro(alt_bn128_mul) \
intrinsic_macro(alt_bn128_pair) \
intrinsic_macro(mod_exp)
intrinsic_macro(mod_exp) \
intrinsic_macro(bls_g1_add) \
intrinsic_macro(bls_g2_add) \
intrinsic_macro(bls_g1_weighted_sum) \
intrinsic_macro(bls_g2_weighted_sum) \
intrinsic_macro(bls_pairing) \
intrinsic_macro(bls_g1_map) \
intrinsic_macro(bls_g2_map) \
intrinsic_macro(bls_fp_mod) \
intrinsic_macro(bls_fp_mul) \
intrinsic_macro(bls_fp_exp) \
intrinsic_macro(set_finalizers) \
intrinsic_macro(call) \
intrinsic_macro(get_call_return_value) \
intrinsic_macro(get_call_data) \
intrinsic_macro(set_call_return_value)
#define CREATE_ENUM(name) \
name,
+2 -2
View File
@@ -51,7 +51,7 @@ template <size_t N, typename F, typename... Args>
inline bool expect_assert(bool check, const std::string& li, const char (&expected)[N], F&& func, Args... args) {
return expect_assert(check, li,
[&](const std::string& s) {
return std_err.index == N-1 &&
return std_err.index() == N-1 &&
memcmp(expected, s.c_str(), N-1) == 0; }, func, args...);
}
@@ -75,7 +75,7 @@ template <size_t N, typename F, typename... Args>
inline bool expect_print(bool check, const std::string& li, const char (&expected)[N], F&& func, Args... args) {
return expect_print(check, li,
[&](const std::string& s) {
return std_out.index == N-1 &&
return std_out.index() == N-1 &&
memcmp(expected, s.c_str(), N-1) == 0; }, func, args...);
}
+1 -2
View File
@@ -14,7 +14,7 @@ macro (target_ricardian_directory TARGET DIR)
file(GLOB contracts ${DIR}/*.contracts.md ${DIR}/*.clauses.md)
get_target_property(contract_sources ${TARGET} SOURCES)
if(contracts)
set_source_files_properties(${contract_sources} PROPERTIES OBJECT_DEPENDS ${contracts})
set_source_files_properties(${contract_sources} PROPERTIES OBJECT_DEPENDS "${contracts}")
endif()
endmacro()
@@ -24,7 +24,6 @@ macro (add_native_library TARGET)
endmacro()
macro (add_native_executable TARGET)
cmake_policy(SET CMP0002 OLD)
add_executable( ${TARGET} ${ARGN} )
target_compile_options( ${TARGET} PUBLIC -fnative )
set_target_properties( ${TARGET} PROPERTIES LINK_FLAGS "-fnative" SUFFIX "" )
+5 -6
View File
@@ -6,7 +6,7 @@ ExternalProject_Add(
CDTWasmTests
SOURCE_DIR "${CMAKE_SOURCE_DIR}/tests/unit"
BINARY_DIR "${CMAKE_BINARY_DIR}/tests/unit"
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/lib/cmake/cdt/CDTWasmToolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCDT_BIN=${CMAKE_BINARY_DIR}/lib/cmake/cdt/ -DBASE_BINARY_DIR=${CMAKE_BINARY_DIR} -D__APPLE=${APPLE} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/lib/cmake/cdt/CDTWasmToolchain.cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCDT_BIN=${CMAKE_BINARY_DIR}/lib/cmake/cdt/ -DBASE_BINARY_DIR=${CMAKE_BINARY_DIR} -D__APPLE=${APPLE} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
UPDATE_COMMAND ""
PATCH_COMMAND ""
TEST_COMMAND ""
@@ -16,12 +16,11 @@ ExternalProject_Add(
)
find_package(leap QUIET)
find_package(spring QUIET)
if (leap_FOUND)
if (spring_FOUND)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(TEST_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release")
else()
set(TEST_BUILD_TYPE ${CMAKE_BUILD_TYPE})
endif()
@@ -33,7 +32,7 @@ if (leap_FOUND)
CDTIntegrationTests
SOURCE_DIR "${CMAKE_SOURCE_DIR}/tests/integration"
BINARY_DIR "${CMAKE_BINARY_DIR}/tests/integration"
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${TEST_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_FRAMEWORK_PATH=${TEST_FRAMEWORK_PATH} -DCMAKE_MODULE_PATH=${TEST_MODULE_PATH} -Deosio_DIR=${eosio_DIR} -DLLVM_DIR=${LLVM_DIR} -DBOOST_ROOT=${BOOST_ROOT}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${TEST_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_FRAMEWORK_PATH=${TEST_FRAMEWORK_PATH} -DCMAKE_MODULE_PATH=${TEST_MODULE_PATH} -Dspring_DIR=${spring_DIR} -Deosio_DIR=${eosio_DIR} -DLLVM_DIR=${LLVM_DIR} -DBOOST_ROOT=${BOOST_ROOT}
UPDATE_COMMAND ""
PATCH_COMMAND ""
TEST_COMMAND ""
@@ -41,5 +40,5 @@ if (leap_FOUND)
BUILD_ALWAYS 1
)
else()
message(STATUS "leap package not found, skipping building integration tests")
message(STATUS "spring package not found, skipping building integration tests")
endif()
+1 -1
View File
@@ -5,7 +5,7 @@ include(GNUInstallDirs)
set(LLVM_BINDIR ${CMAKE_BINARY_DIR}/cdt-llvm)
ExternalProject_Add(
CDTTools
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DVERSION_FULL=${VERSION_FULL} -DLLVM_SRCDIR=${CMAKE_SOURCE_DIR}/cdt-llvm -DLLVM_BINDIR=${LLVM_BINDIR} -DLLVM_DIR=${LLVM_BINDIR}/lib/cmake/llvm -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} -DVERSION_MAJOR=${VERSION_MAJOR} -DVERSION_MINOR=${VERSION_MINOR} -DVERSION_PATCH=${VERSION_PATCH} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DVERSION_FULL=${VERSION_FULL} -DLLVM_SRCDIR=${CMAKE_SOURCE_DIR}/cdt-llvm -DLLVM_BINDIR=${LLVM_BINDIR} -DLLVM_DIR=${LLVM_BINDIR}/lib/cmake/llvm -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} -DVERSION_MAJOR=${VERSION_MAJOR} -DVERSION_MINOR=${VERSION_MINOR} -DVERSION_PATCH=${VERSION_PATCH} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
SOURCE_DIR "${CMAKE_SOURCE_DIR}/tools"
BINARY_DIR "${CMAKE_BINARY_DIR}/tools"
+1
View File
@@ -19,6 +19,7 @@ NAME="${PROJECT}_${VERSION_NO_SUFFIX}-${RELEASE}_${ARCH}"
mkdir -p ${PROJECT}/DEBIAN
echo "Package: ${PROJECT}
Version: ${VERSION_NO_SUFFIX}-${RELEASE}
Depends: libcurl4-gnutls-dev
Section: devel
Priority: optional
Architecture: ${ARCH}
+2
View File
@@ -64,6 +64,8 @@ create_symlink eosio-pp eosio-pp
create_symlink cdt-init cdt-init
create_symlink eosio-wasm2wast eosio-wasm2wast
create_symlink eosio-wast2wasm eosio-wast2wasm
create_symlink eosio-wasm2wast cdt-wasm2wast
create_symlink eosio-wast2wasm cdt-wast2wasm
create_symlink cdt-ar cdt-ar
create_symlink cdt-abidiff cdt-abidiff
create_symlink cdt-nm cdt-nm
+4 -2
View File
@@ -4,7 +4,9 @@ macro(add_unit_test TEST_NAME)
endmacro()
add_unit_test( asset_tests )
add_unit_test( base64_tests )
add_unit_test( binary_extension_tests )
add_unit_test( crt_tests )
add_unit_test( crypto_tests )
add_unit_test( crypto_ext_tests )
add_unit_test( datastream_tests )
@@ -20,14 +22,14 @@ add_unit_test( system_tests )
add_unit_test( time_tests )
add_unit_test( varint_tests )
add_test( NAME toolchain_tests COMMAND ${CMAKE_BINARY_DIR}/tools/toolchain-tester/toolchain-tester ${CMAKE_SOURCE_DIR}/tests/toolchain --cdt ${CMAKE_BINARY_DIR}/bin )
add_test( NAME toolchain_tests COMMAND ${CMAKE_BINARY_DIR}/tools/toolchain-tester/toolchain-tester ${CMAKE_SOURCE_DIR}/tests/toolchain --cdt ${CMAKE_BINARY_DIR}/bin --verbose )
set_property(TEST toolchain_tests PROPERTY LABELS toolchain_tests)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/unit/version_tests.sh ${CMAKE_BINARY_DIR}/tests/unit/version_tests.sh COPYONLY)
add_test(NAME version_tests COMMAND ${CMAKE_BINARY_DIR}/tests/unit/version_tests.sh "${VERSION_FULL}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST version_tests PROPERTY LABELS unit_tests)
if (eosio_FOUND)
if (spring_FOUND)
add_test(integration_tests ${CMAKE_BINARY_DIR}/tests/integration/integration_tests)
set_property(TEST integration_tests PROPERTY LABELS integration_tests)
endif()
+6 -6
View File
@@ -1,10 +1,10 @@
cmake_minimum_required( VERSION 3.5 )
set(EOSIO_VERSION_MIN "3.1")
set(EOSIO_VERSION_SOFT_MAX "3.1")
set(EOSIO_VERSION_MIN "1.0")
set(EOSIO_VERSION_SOFT_MAX "5.0")
#set(EOSIO_VERSION_HARD_MAX "")
find_package(leap)
find_package(spring)
find_path(GMP_INCLUDE_DIR NAMES gmp.h)
find_library(GMP_LIBRARY gmp)
@@ -17,11 +17,11 @@ EOSIO_CHECK_VERSION(VERSION_OUTPUT "${EOSIO_VERSION}"
"${EOSIO_VERSION_HARD_MAX}"
VERSION_MATCH_ERROR_MSG)
if(VERSION_OUTPUT STREQUAL "MATCH")
message(STATUS "Using Leap version ${EOSIO_VERSION}")
message(STATUS "Using Spring version ${EOSIO_VERSION}")
elseif(VERSION_OUTPUT STREQUAL "WARN")
message(WARNING "Using Leap version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Leap version ${EOSIO_VERSION_SOFT_MAX}.x")
message(WARNING "Using Spring version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Spring version ${EOSIO_VERSION_SOFT_MAX}.x")
else() # INVALID OR MISMATCH
message(FATAL_ERROR "Found Leap version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Leap version ${EOSIO_VERSION_SOFT_MAX}.x")
message(FATAL_ERROR "Found Spring version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Spring version ${EOSIO_VERSION_SOFT_MAX}.x")
endif(VERSION_OUTPUT STREQUAL "MATCH")
@@ -2,8 +2,6 @@
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <Runtime/Runtime.h>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
+97
View File
@@ -0,0 +1,97 @@
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
using namespace eosio;
using namespace eosio::testing;
using namespace eosio::chain;
using namespace eosio::testing;
using namespace fc;
using mvo = fc::mutable_variant_object;
BOOST_AUTO_TEST_SUITE(array_tests)
BOOST_FIXTURE_TEST_CASE( std_array_param, tester ) try {
/* ----------- testpa action tests --------------------------------------------------
[[eosio::action]]
void testpa(std::array<int,4> input){
std::array<int,4> arr = input;
for(int i = 0; i < 4; ++i){
eosio::cout << arr[i] << " ";
}
eosio::cout << "\n";
}
-------------------------------------------------------------------------------------- */
create_accounts( { "test"_n } );
produce_block();
set_code( "test"_n, contracts::array_tests_wasm() );
set_abi( "test"_n, contracts::array_tests_abi().data() );
produce_blocks();
auto trace = push_action("test"_n, "testpa"_n, "test"_n, mvo()("input", {1,2,3,4}));
auto& con = trace->action_traces[0].console;
BOOST_REQUIRE_EQUAL(con, std::string("1 2 3 4 \n"));
produce_block();
// size should be correct
// ----------------------
BOOST_CHECK_EXCEPTION( push_action("test"_n, "testpa"_n, "test"_n, mvo()("input", {1,2,3})),
pack_exception,
fc_exception_message_starts_with("Incorrect number of values provided (4) for fixed-size (3) array type"));
produce_block();
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( std_array_return_value, tester ) try {
/* ----------- testre action tests --------------------------------------------------
[[eosio::action]]
std::array<int,4> testre(std::array<int,4> input){
std::array<int,4> arr = input;
for(auto & v : arr) v += 1;
return arr;
}
-------------------------------------------------------------------------------------- */
create_accounts( { "test"_n } );
produce_block();
set_code( "test"_n, contracts::array_tests_wasm() );
set_abi( "test"_n, contracts::array_tests_abi().data() );
produce_blocks();
auto trace = push_action("test"_n, "testre"_n, "test"_n, mvo()("input", {1, 2, 3, 4}));
auto& rv = trace->action_traces[0].return_value;
auto actual = fc::raw::unpack<std::array<int, 4>>(rv);
auto expected = std::array<int, 4>{2, 3, 4, 5};
BOOST_REQUIRE(actual == expected);
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( std_vector_return_value, tester ) try {
/* ----------- testrev action tests --------------------------------------------------
[[eosio::action]]
std::vector<int> testrev(std::vector<int> input){
std::vector<int> vec = input;
for(auto & v : vec) v += 1;
return vec;
}
-------------------------------------------------------------------------------------- */
create_accounts( { "test"_n } );
produce_block();
set_code( "test"_n, contracts::array_tests_wasm() );
set_abi( "test"_n, contracts::array_tests_abi().data() );
produce_blocks();
auto trace = push_action("test"_n, "testrev"_n, "test"_n, mvo()("input", {1, 2, 3, 4}));
auto& rv = trace->action_traces[0].return_value;
auto actual = fc::raw::unpack<std::vector<int>>(rv);
auto expected = std::vector<int>{2, 3, 4, 5};
BOOST_REQUIRE(actual == expected);
} FC_LOG_AND_RETHROW()
BOOST_AUTO_TEST_SUITE_END()
+47
View File
@@ -0,0 +1,47 @@
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
#include "test_utils.hpp"
using namespace eosio;
using namespace eosio::testing;
using namespace eosio::chain;
using namespace eosio::testing;
using namespace fc;
using mvo = fc::mutable_variant_object;
BOOST_AUTO_TEST_SUITE(bitset_tests)
BOOST_FIXTURE_TEST_CASE( bitset_test, tester ) try {
create_accounts( { "test"_n } );
produce_block();
set_code( "test"_n, contracts::simple_wasm() );
set_abi( "test"_n, contracts::simple_abi().data() );
produce_blocks();
auto trx_trace = push_action("test"_n, "testbs"_n, "test"_n, mvo()("b", "0010"));
auto& act_trace = trx_trace->action_traces[0];
BOOST_REQUIRE_EQUAL(fc::raw::unpack<fc::bitset>(act_trace.return_value), fc::bitset{"1101"});
{
// because contract `simple_tests.cpp` uses the `bitset` type, the abi version should be 1.3 or greater
auto abi_version = extract_version_from_json_abi(contracts::simple_abi());
BOOST_REQUIRE(abi_version.is_valid());
BOOST_REQUIRE_LT(version_t(1,2), abi_version);
}
{
// check that abi version of minimal contract is still 1.2.
auto abi_version = extract_version_from_json_abi(contracts::malloc_tests_abi());
BOOST_REQUIRE(abi_version.is_valid());
BOOST_REQUIRE_EQUAL(version_t(1,2), abi_version);
}
} FC_LOG_AND_RETHROW()
BOOST_AUTO_TEST_SUITE_END()
+143
View File
@@ -0,0 +1,143 @@
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
using namespace eosio;
using namespace eosio::testing;
using namespace eosio::chain;
using namespace eosio::testing;
using namespace fc;
using mvo = fc::mutable_variant_object;
struct bls_primitives_tester : tester {
bls_primitives_tester() {
create_accounts( { "test"_n } );
produce_block();
set_code( "eosio"_n, contracts::bls_primitives_test_wasm() );
set_abi( "eosio"_n, contracts::bls_primitives_test_abi().data() );
produce_blocks();
}
};
BOOST_AUTO_TEST_SUITE(bls_primitives_tests)
BOOST_FIXTURE_TEST_CASE( g1_add_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testg1add"_n, "test"_n, mvo()
("op1", "aa83970268d80b50a68535d920954bd993217b9114cbe255e5c0b64e748c5683b6518071552148ec555cdb8fed0f07001e76e62761e8d828a74b81f216a0c5ebeb923550cafd110512cec20e33ec9b272c0ff2b88215953945153fc926691506")
("op2", "e810c1d6ac7cbae0157a0fc958ef607c33e03dee20e72a97ae72de0dd9a0ef20d768ab4b659429255b87feda0be194062a77cd664976e6560b33c921d5968c19a5d5ae9e38c909690975c084c0a4e82481b01e4023b83d6a8ddcb9d38892f50f")
("res", "145cae227562a69bbf270b8ec8d1783bed4ad0fd43e9c81ac5caa7d3e7feaa3acda07d6033ece1f7f0649d6b75009a03e83ab8f9b44f94c4ab762611266b7a530ce05092ad38b7554a95caa2b63ad0969a902d69f34531dbccf8a4f2e12cf60d"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( g2_add_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testg2add"_n, "test"_n, mvo()
("op1", "a75a447bc0dd806bcdaee2cb429498193e409a4d370dfe0e9605c5a9ec4a09c0314c0321f2f918b72e5f37cf10ea7e0b69ac1a7fb3200e63e5cef9929cd2d9afde2fb957989e610c5b44649af8649d968baa0424b873b501be32c66ef040240b469127753f17ca28a072c2151b69d51fecff1ed0f4786b4e6fd4e52ec72f95ef73cf19fc2d6a28267bdf11a262b403110c2e901fb32d0e900082e4934a20c1c06c262533488fd7f9f47e4e2fde102fe98fb48344de25712d5e2e2887bc04d207")
("op2", "11cc3115ad08c43ed0b7fc3945ca83c69d0a6663f05b25373ea3fdff14c722a7fddd7a1b4f1cf44290e1c480f50b6208419f6a208ea48a48cef5a345a35c052cf0db4a76c719eb90a5829a8f606e99c807a6ae71493f079c364d57f02cba7c124f344978bb539bea7c448eb96ccea9b6c7b7d2495212b88227fc269ac88391f4a6d23e2d47d4fe47e63f8e709b61450644ba13c08e29770bc397da41466cb26c9fa7a1ffd9b5dd5c51c3ddbfb88412998e41f72e63b7972dfd856b9f11530c01")
("res", "d9458632a7cfcf59e72cf6d1ad70ec8d65d9e81edd0da77c2b10ec4d2a4169f1b0ac46419796d3ed6ef66b34eb76651288d916a5e5b44e75cc849ecd257a223398f92683f2318bf5fe7aa2b5d45e97dad6c415dac4b9cdc1c72071a4c9845c15096b203deb2e071d3856983cb26a101eb193cbfe914000ade94a62339b2e418c4a53578fb177af1986cc9dee3ce9ff0f9598925cb7e5a29af31404fa8cd9c22e17eb1a44b6b461dd9b7dc4d384ad60b82d94e431a389a244b1724a5441ac6009"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( g1_weighted_sum_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testg1wsum"_n, "test"_n, mvo()
("points", "7a63674c35f9f2be4f0ec092110b82fad24a283316a846d960843b9a6a8a98bfdabd7e897b7da774fbbb05d7ad95fb18940a5f7a7345e1821e0203e156d677e88445385bc0779d25f51b772be3c3a6ba0b09b2533a8ee66053b2f3c853994112e74a97324685e515c86d44ff5a3ef5218e53c6f29e7df49a546c79cd1fb9d14e63f68aaf6b2df1f6f56e6250fdd6f20dcc36499a5aea69f4c77a18774eccf8460e77ab6b0236ce2d85083faeacf0f3378a3dcc95e1d3b0ae282b9bbec1ecee1793e63ca4730ec63df496546c07094e848625610a514d99dd0a6dd9f58d15c4e4ed5aca65025562177ebd0a4c2c3ae8139d24be936dd5dbec6a54897ba2a98a68a9c43ea3199695896789c958bc289a7275550b5670a351b262c10166a48baa161f841df4255408abb7186f78647422313fbe3a0a35699a487dd71482b76b8adc20622f44bb32e04a78b98e4f2cd42f16a6d35ec2463a484906dbb655969b900a15cc8a47694b1961bd4b2e9f074afd79e4c04344d31dd8fcd56d5147a9a47712")
("scalars", "2be3984dc7a5c9e6172df42c905be929ce5bb29d9aa31a03f3ed8816e7d1265a0669a674fef9254f0efffd3e89c30f1f05587472251d362e1acea03a76918d137b322778b8188c1bf68c36ef8e0ce933290c67f981611c13a286e42235f89855e49966a4e9ad8c64122f4f5e720986193e59771fa91aef113d8739642bdd6613")
("num", 4)
("res", "25038aea2d2d1c15dad2fa4c6e31162d1b79ca1b1bca608190a05dea451701e9fc95a8c441a25083df7fa56d54eae51241a8c9489719b9cc35852ce3d7e04b5ada5c65f45d1818f80ea161264b70ab6fa86e694691281b8110000d209aea5c17"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( g2_weighted_sum_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testg2wsum"_n, "test"_n, mvo()
("points", "556524e3e80fcf448c0befd659ad744c409cdd1111291a81949324a02688999ab88e6ccb3e9dcecf57ccfe9aa7ada21540ba5407c0700ce81578bcee892ed385dd1ed476c465fe48cea2dd7e37784d8ae795fba842ce0f88baa76857ec1c7c137163beed84ff2c6a159d486d10c7128b2cbb6f10c547d202d0f6e68fb43a9a6a18a01823c4e70b5dc25d38b9c33d4916510de467f10922f3b284855c4accc816f542fe74fd0b331b1884dac6918d3c38860b0725809a19b6101e5d3942b9f40eee6901e17a0c50187e6385767b7d1e54eaacbb3c1939e2e995ec79569dd0200583a937891035475e1e5a733a0446f7063e77f9d564c60dfc6dc25572369bf7fe51b2607f73fd0fa9eee9d27b127a81c63bbd7f08dd64237d082e9735018d96024c56d32b55e991e84f39c6ffc0d56ef17307e82fc200df9259f83b7bdae719124f7151d855b8f51f703e087ea1540900c4eba1592de051db895689aeb5233dec52ccb74f93acc8fc14bcde4413a14dceb0ec386623021ddf9ad1fce429e1780c5a6877b00b17af384fd49b7077434387672218967f4a7647174162c07e99d9007380be10a7bef367181ba886a0e40c160a4b36548826c30710ea8238b0c37ec06e331fe1d3aaf1b5a73ae0880794d0c0a9623b8498d9bbd4754e1a8c1e2346091fec42aaeddc40f2ae06456e8ad9059c61db437089a855af3d1bc2a6d68e9c01474bdbaabfa185a58dba9808f8e0b20a3c51c51c5bca629aa061dfa5ff238a43e1e90242df403635869743c723276c0eca711c6c91b94a65310b6b869ee556179ed113a2b406a52de2fe54f61f4589f510924b2e3f8b14ead1541af2e1cc9dd35a91f6cd4bbc02c58a844d9e4906a106197b8ab39a539561aeecd265762bcf5106344ae2fe0a62c7af1bbc846e9b39ebe38a046461d7c0c4901caddb0fd7c70b86246d53bf3124af629596f6367e86f3456cc954e3581bfea600b6d2818259332fedeb88ece673626ffd4d5935d0310e5cf2462055d5fa4b6cc4531f11cf0722c8647dbfc7364c9b2e24e0066ef5b0e3497ce38537a7230e02f7edc2f53e980f")
("scalars", "e5a6afde5d144ed43bd1742b7ec7f5385a7d392f65465927e37afe7b9f0a9e368449cf52e36ca432b096f8562c98f318216d21a426b2d51f0a4db8fcafcd687326b548cd973f30d4fc47d79d853ec94239c620229ea0632b2570a1f8df08fe1ce323ef2cad610917a13d1157e25fac05ef6bafaa68e8ce265594d207a5d13c1e")
("num", 4)
("res", "889d8b750987cbce4aa4b872b29f22011752354e672b24ad4b229ca575ce14a8c081366db5cfd0f7a85ff68559bd4216b3cecfb6a2618a29c6c95b17147d083f28cc1fae5959fd7de74d986e7fd543ce1060cbdd8d4ae136910d8a15a1b3ee16d955657630d5f50aae107d13aa0c46040616e2d3018e5d07f9551e2a4c34565c9b59b8fd7751e025f473772120b4a511946e09fc93dcf9732399244c1fbb864fa09c2dd5d29543e794e64b6e1a2df39289245ff4b65dff0357a6621d151e4514"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( pairing_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testpairing"_n, "test"_n, mvo()
("g1_points", "af7d28fa69e9ff7cf98da7614f02faf91f8ae2888d522db1a225724394bedd8547ae93cb07b41f5f21092846c6c2950e43328c2e6aaa18cf735a703f4ee43a60658167b9c1bf895ddbc898dae5269a335699c595aa9dc4137103d5480320270f756a4c35700b847a02d4933be43e508139affb438b7bcf547debcf9904f1056d197ec8484283e2f194430e16443d250f0b4734d5380cac631d6287e2b45a6a12fb5fea3eed96a7b2cd3bac9a532e4bb6176b1e792964444798e5bf151e14c314277fa052e05911619c457335e708633aca11239a33686e56dd949e6f50e5fe79f1d069bbb01822566f992299184ddc06d08c662a5d2b37668c7821bef5177ff4df977799dc81ae15d0444be9a54db2195d41e316f7ebdb7d879f8f7b355cb416137401a36684f0ccbce51fd4d8b32f45d81f2c33bc95687ed777e7fcb181367e163d94356c96d239f193dabf01616d13936ba746ed9a64578a5a4b191238fe8472e4135525afcac4ed818c13e518864ce82de26a6bb1066b9c0771c021716603")
("g2_points", "5528fc322669dcf2757583835b5ba5cc84f629db47e1d5e3ec78523fff567ec26100b7977ba038586c9e465abbaeb603554afef9cfe21ac33847b1d11796088cc6b18c7544355da3f996ddb0c0a15c8b1eeba2ec3a5cc8c7b4a8ecc7131e4609582cc42caa57f68017f95af50757bfc0d3c4d4327d1d40012af8f664da428f1984bf17c26d43b6fd65a8ce6c3d039d03f1247385a3f565108de722d4e08b0e9d23bba036646668167bdd41709ebe8bf5aadbd88ccc2af0c6d5940531c9fd50053e786ffe9011554db15fc7e130ea07cd254f21a86911fe758517274f96b89cb67e30c104186c4a6cb0d92cb82e39260245b68e74bdb828992697a1957be0564a9863f56eaf36bb5fc4d0869468b6ad4e36a1e7c550303c80c4ca0cbae773b309a61c6d4d6a4d2f17a4424c1987d294f195275581c8b8f88b7ce7fec5bc67e7bfd58bb747f39aa4dbc77d79cd18dd09142b10a45d49abc8fd544281f02a0e045062b72b25ead1a376e4f705ac83ad2385c84a8fd914d2f6a71d7eeb7126d677001013a0df759ff906a09fe4a3da307dd6cc17ee1fd72af8f7d953662be427cda2985cb1073563bbea492d9e6a96ca8a05ca5d45d349cb3e2f09cff6022a9916324eaa4fe5c543d46cafe5f82e81c5baddc2cc58100b03a20c2feaeed58cbd63019b8e3586d14193470d4ee9c1a0fc5e0a736e1ba94d7ad20ead3a3dacc4b2f3530ad751daffa944be4cb1969b3d2595058007d28d49e2fdebab68607c119b77d766785ed9e209582c737fce93b6ad0d4d795f86415238e0d3b70b9d8954d6a20ce85e7128588a849c505d5d2c81ff63bf12ea3ad52a316316ce49b2014dfbc486c9934dccb98db06089c03dc8f76ad70323ada12fe7e5b9f552c5b6cc073f72409a6e44f6634ca58bed30649b9840f177ea0039932f81574ea22b6da18b702f0e367f633e41d2b585d5166669f4c48d389f003eeecf06b5aa119d0df46de26adcb938d362e4410fdaa990a6fc4c2eca0f7bffee724789a0a47ba1b531bb4a3c95c129585ba5c9a6fe978a6915f4afedeb710ef6a55f153a5b21f943de6531680d")
("res", "01cc207c7c76c65afc059d073106d545705af7c4e4ed78e6169c599bae1c9bf6358d5a2cdfeeae389cc64436dfe7b7192c733fe9e2d105c0eaec21589d8bb5ecd5c71a5fee083af47a1cbc3af2df8a13603a78956c39f55fd0663ed482846a047280f87426ecde4c535c0d30bdf4b95ff5aff45782129ee6c7a0fa20a632bc98e95bfb663685eb2443e4b1f518c40f00502303b3db49be61f36ef6af46b9097c83835a864ae6337ef07e40df617af1aacea98c0d75e96a104d41a3617e7a4f05fc1cdcec57ea40a0237ff387a5d9130b34c92cb57a3450080bbaa2f6f9e895851b05c05eec03abd2d5083c81c402a500d2bec4895cf0f58a9953e43ee9039a38ae73cc3ec325fa636777e1f597b69a2b6a62bd49fba5b163bc03ce73f277f818fad1c6681fa59be891c2baf85b6a5e908d96b6a6c4cf3d53b3de23fdade91b3dde7199648aca0fce1d2307253bf57b054a4c4dc276034f8d57017cddc0a84975c643f9ea808652f2cefea32f767fe8e6df58a837c47c3136ced7107e7dbd9711399605212e6a1b8da806a12636076f7da0629ca8173f0411ba2a1050d1bca61994e28f69f274ec94e016a3ba6f9a6b06cd17f570928b5e4b8c75a5d62a0a67bd54249702923b440355db775599ea7be7cd3c6d88ab8da7694e43352837b0080814880a1460bc61fae141d36f961db8393313f74a65c3eabcc38793b84062999364bb0c36a415445ec4318b59c16e850260a53e7aaaf72bcaa568b57b69b552bf827c3e1c116565122322d6c26e14354fd96dc4bb1161ede0ee36efeeae1a5503"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( g1_map_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testg1map"_n, "test"_n, mvo()
("e", "6de1c03023f2b4e454559b97266ebc1f96cd5510c4f48e2acafbe73a536a1477f2c8d1c9b5f6615d01968ea59ef4fd07")
("res", "2c7390d4bfbe0ccbaae9699aab5458d62f6d1aa91938b0ab0717249ad89209cb14ee8ed764a8952415382dbbfdef2312d5b2988b1ed7e6907d73ef2335cba7f9263b63003effa44ab8d6805d6ed0f08d87919230f0cb45d9ec35b2e0615d920f"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( g2_map_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testg2map"_n, "test"_n, mvo()
("e", "b4108d552274d175fd4e52dd766ff396a4f365c102e0ef7b4d266f220ec67eefab48ac15d1db0d98ba31cda435616e0bdeb51952b044ce0f64b5d42199d9560ed0175f3d2c58af07909d29db4480c1b417dfbf7f1af274648adb54b029e38f08")
("res", "f74a6a357dc6a1fb33344f60898ab9eb29c68170727136b26d943249fbbd9393bd893846ea0d43250d4fd37737e49f1463d11827561e80cda0f6ead2cd3c84d4be6d99d61fa4cbc41cce534af2cf3d1b3fc31ccecc1259cfc7530a93c58e801951454f38f693d2d763e0f993c202151d873eefec3e90507cea6232cb3c0061f254a2f4b5872098b23362763a79d6c004333e0e02ad077c8a3683d63827becf20c88a9b7a63bbac739bc3a4f659d119df2f5853e371a25c803fc8301c393e7804"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( fp_mul_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testfpmul"_n, "test"_n, mvo()
("op1", "AAAAFFFFFFFFFEB9FFFF53B1FEFFAB1E24F6B0F6A0D23067BF1285F3844B7764D7AC4B43B6A71B4B9AE67F39EA11011A")
("op2", "AAAAFFFFFFFFFEB9FFFF53B1FEFFAB1E24F6B0F6A0D23067BF1285F3844B7764D7AC4B43B6A71B4B9AE67F39EA11011A")
("res", "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( fp_exp_test, bls_primitives_tester ) try {
push_action("eosio"_n, "testfpexp"_n, "test"_n, mvo()
("base", "AAAAFFFFFFFFFEB9FFFF53B1FEFFAB1E24F6B0F6A0D23067BF1285F3844B7764D7AC4B43B6A71B4B9AE67F39EA11011A")
("exp", "AAAAFFFFFFFFFEB9FFFF53B1FEFFAB1E24F6B0F6A0D23067BF1285F3844B7764D7AC4B43B6A71B4B9AE67F39EA11011A00000000000000000000000000000000")
("res", "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( base64_test, bls_primitives_tester ) try {
push_action("eosio"_n, "g1baseb4enc"_n, "test"_n, mvo()
("g1", "4783d417e555ba2fe4a6a9068e3c212bc43d5c895a83dc15bfdcbb65357c4caafbf6a6884c36a41c68587a77caba3f1105feb50023b4806b003c913c3ecca1ede21ff4cf322576520571977958ec1f6b8d483ae505a1eb93675ecf856ae0dc0e")
("base64", "PUB_BLS_R4PUF-VVui_kpqkGjjwhK8Q9XIlag9wVv9y7ZTV8TKr79qaITDakHGhYenfKuj8RBf61ACO0gGsAPJE8Psyh7eIf9M8yJXZSBXGXeVjsH2uNSDrlBaHrk2dez4Vq4NwOf9VEMA"));
push_action("eosio"_n, "sigbaseb4enc"_n, "test"_n, mvo()
("g2", "ddb6db1f52a1eb191dfa57656645689fbd08e76170f08c9674c20c243c71bda00054d06862623083abe2a738da032000f1d2784eefacb8696a48f185ecc225f2b0cc26d3e59d84cb6bafba976785002446cd2921cb954daa124058a368ba270ef6e7a57e41f3c651f2ca6e70982330b5ab3acc65887f24e9f5c63d3550d2c6fa643fd6ea061c7e24ecdc41a8c55850089ab3cf40b0d986d283d065f1e7b66047008596d721db450b0e8b8eada95a09ca258a651d0d19b4651e2b38cbae308218")
("base64", "SIG_BLS_3bbbH1Kh6xkd-ldlZkVon70I52Fw8IyWdMIMJDxxvaAAVNBoYmIwg6vipzjaAyAA8dJ4Tu-suGlqSPGF7MIl8rDMJtPlnYTLa6-6l2eFACRGzSkhy5VNqhJAWKNouicO9uelfkHzxlHyym5wmCMwtas6zGWIfyTp9cY9NVDSxvpkP9bqBhx-JOzcQajFWFAImrPPQLDZhtKD0GXx57ZgRwCFltch20ULDouOralaCcolimUdDRm0ZR4rOMuuMIIYOJG0NA"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( sig_verify_test, bls_primitives_tester ) try {
// assumes signed message of std::vector<uint8_t> msg = {51, 23, 56, 93, 212, 129, 128, 27, 251, 12, 42, 129, 210, 9, 34, 98};
// vector<uint8_t> seed(32, 0x30); array<uint64_t, 4> sk = secret_key(seed); g1 pk = g1::one().scale(sk).affine(); string pk_hex = to_hex(pk.toAffineBytesLE());
// g2 sig = sign(sk, msg); string sig_hex = to_hex(sig.toAffineBytesLE());
push_action("eosio"_n, "verifyraw"_n, "test"_n, mvo()
("pk", "c27efc440ed89d739ff80f1c7178d4672d5f71e8c8926a85785d0f84074e79c1662c522fdbd6fcaebd640d816dea6c0dc36c5d7e7a297afc960369e306d845fcad0e5fe2a88c0d3bbe854d4f9e3e6365c9c1003662f0e81b35fd9c6a11d0a10c")
("sig", "e13a38c18dfad440a9af8d720bfb9ce0f388a25a5789a8cdc34b87204fe29db5cc16658a5d9f4fa4a7cc16b8ef8d2d0d1a5984e6b69ca228692f1920e9340f149024b4d856711656f11bb1e0c7d081e5bb80692638a9bace2d8f4d796b4887129c59fbb7901997cbbb681f709291a45315979f55b719dfc8757d3a878cf01e4a48a0e6647b837d0ea8aea5d41e121b0dd37fa20007aef4f51740d846cc8d6ab151dbd88964e7d19890a500d5537be81b881451b75f928a66f546441d45028603"));
// bls_private_key sk = bls_private_key(seed_1);
// bls_public_key pk = sk.get_public_key();
// std::string msg = "this is a message string";
// std::vector<uint8_t> msg_v(msg.begin(), msg.end());
// bls_signature signature = sk.sign(msg_v);
// pk.to_string();
// signature.to_string();
push_action("eosio"_n, "verify"_n, "test"_n, mvo()
("pk", "PUB_BLS_sS66EwY8bNx7vkDn3mKhwPhhqa1V6STN1QSb6bWOIFBTloF5zt5b55r9y7uQMiQGrvt6XOZO3CpEgthlba7R7qz7Qob2YcD5EX3Ng_rUUdMBsjEJRuXNWICPe0QbKAoCQOw9vw")
("sig", "SIG_BLS_07NCCTekrxhDFurhRhl3b8m4T-xmTixSl63TYcee_xJONi2_qy9-8o5vyetMefsL4hhDMfy1yIeHERqxUvGguRBBncpabp84b3P2bNpY18A-PVs7qKFqlld1gEUqt-cDOcwkyUe6HqqFXR5wtXoSHE4lHauV3CzR0lD91gnr2c49aUQPAC7SD-ZcnZyahwURje-Db26zhTXIO1WWIx6vwKnZUuvZEbzYrijjBQKeZsqp0eoAzjrByx9gOmN2d_AR9PhRvg")
("msg", "this is a message string"));
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( sig_pop_verify_test, bls_primitives_tester ) try {
push_action("eosio"_n, "popverifyraw"_n, "test"_n, mvo()
("pk", "3b08e73bbda9c3eff597fc60fbb1bd8c81af3659024f62829082438ef52a02a71f99658087ea58108e12543c08980a0f1950c7f3085ab4b49e3137e8d35adfcbed616dd37cd011435e940a74f53f99ab1d1fd220a089d4e8517df0267ecb0802")
("sig", "3a1e5689abddbd0ed54c48c88dcef7ac9bba70abdd7a8e965fb807a188cfc8a7e21ca5c9ecc58df7681d158cc6aced13d50bbe35a5aa7848c32a290b096e1f7a61b2817660bd6e6d5686180a1c00716d47ee996ced081fdb6c4417d6cc8dbd06f26f037331c1b4703e94454374ba04e71fb7571159299b9020c124e9ecee777c2b5c16a51ca883b716082fdf2e6c150551a82eaca5efaf761053d6998a439cc696366fe82eb93f19aac34893610698b37d11f0d608fdc1befc50a7e565ea4813"));
push_action("eosio"_n, "popverify"_n, "test"_n, mvo()
("pk", "PUB_BLS_82P3oM1u0IEv64u9i4vSzvg1-QDl4Fb2n50Mp8Sk7Fr1Tz0MJypzL39nSd5VPFgFC9WqrjopRbBm1Pf0RkP018fo1k2rXaJY7Wtzd9RKlE8PoQ6XhDm4PyZlIupQg_gOuiMhcg")
("sig", "SIG_BLS_RrwvP79LxfahskX-ceZpbgrJ1aUkSSIzE2sMFj0twuhK8QwjcGMvT2tZ_-QMHvAV83tWZYOs7SEvoyteCKGD_Tk6YySkw1HONgvVeNWM8ZwuNgonOHkegNNPIXSIvWMTczfkg2lEtEh-ngBa5t9-4CvZ6aOjg29XPVvu6dimzHix-9E0M53YkWZ-gW5GDkkOLoN2FMxjXaELmhuI64xSeSlcWLFfZa6TMVTctBFWsHDXm1ZMkURoB83dokKHEi4OQTbJtg"));
} FC_LOG_AND_RETHROW()
BOOST_AUTO_TEST_SUITE_END()
+275
View File
@@ -0,0 +1,275 @@
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
using namespace eosio;
using namespace eosio::testing;
using namespace fc;
using mvo = fc::mutable_variant_object;
struct acct_and_code {
account_name acct;
std::vector<uint8_t> wasm;
char* abi = nullptr;
};
// The first account in the accounts vector is the action initiating the
// first sync call
struct call_tester: tester {
call_tester(const std::vector<acct_and_code>& accounts) {
for (auto i = 0u; i < accounts.size(); ++i) {
create_account(accounts[i].acct);
set_code(accounts[i].acct, accounts[i].wasm);
set_abi(accounts[i].acct, accounts[i].abi);
}
produce_block();
}
};
BOOST_AUTO_TEST_SUITE(sync_call_tests)
// Verify a sync call returns value correctly
BOOST_AUTO_TEST_CASE(return_value_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
// Using host function directly
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "hstretvaltst"_n, "caller"_n, {}));
// Using call_wrapper
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "wrpretvaltst"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify one parameter passing works correctly
BOOST_AUTO_TEST_CASE(param_basic_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
// Using host function directly
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "hstoneprmtst"_n, "caller"_n, {}));
// Using call_wrapper
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "wrponeprmtst"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify multiple parameters passing works correctly
BOOST_AUTO_TEST_CASE(multiple_params_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
// Using host function directly
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "hstmulprmtst"_n, "caller"_n, {}));
// Using call_wrapper
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "wrpmulprmtst"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify passing a struct parameter works correctly
BOOST_AUTO_TEST_CASE(struct_param_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "structtest"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify passing a mix of structs and integer works correctly
BOOST_AUTO_TEST_CASE(mix_struct_int_params_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "structinttst"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify a sync call to a void function works properly.
BOOST_AUTO_TEST_CASE(void_func_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
auto check = [] (const transaction_trace_ptr& trx_trace) {
auto& atrace = trx_trace->action_traces;
auto& call_traces = atrace[0].call_traces;
BOOST_REQUIRE_EQUAL(call_traces.size(), 1u);
// Verify the print from the void function is correct.
// The test contract checks the return value size is 0.
auto& call_trace = call_traces[0];
BOOST_REQUIRE_EQUAL(call_trace.call_ordinal, 1u);
BOOST_REQUIRE_EQUAL(call_trace.sender_ordinal, 0u);
BOOST_REQUIRE_EQUAL(call_trace.console, "I am a void function");
};
// Using host function directly
auto trx_trace = t.push_action("caller"_n, "hstvodfuntst"_n, "caller"_n, {});
check(trx_trace);
// Using call_wrapper
trx_trace = t.push_action("caller"_n, "wrpvodfuntst"_n, "caller"_n, {});
check(trx_trace);
} FC_LOG_AND_RETHROW() }
// Verify a function tagged as both `action` and `call` works
BOOST_AUTO_TEST_CASE(mixed_action_call_tags_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
// `sum` in `callee` contract is tagged as `action` and `call`
// Make sure we can make a sync call to `sum` (`mulparamtest` in `caller` does
// a sync call to `sum`)
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "hstmulprmtst"_n, "caller"_n, {}));
// Make sure we can push an action using `sum`.
BOOST_REQUIRE_NO_THROW(t.push_action("callee"_n, "sum"_n, "callee"_n,
mvo()
("a", 1)
("b", 2)
("c", 3)));
} FC_LOG_AND_RETHROW() }
// Verify the receiver contract with only one sync call function works
// (for testing the sync_call entry point dispatcher)
BOOST_AUTO_TEST_CASE(single_function_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::single_func_wasm(), contracts::single_func_abi().data()}
});
// The single_func_wasm contains only one function and the caller contract
// hooks up with it
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "hstretvaltst"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify support_mode for void and non-void sync calls if calls are a failure
BOOST_AUTO_TEST_CASE(sync_call_support_mode_failure_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::not_supported_wasm(), contracts::not_supported_abi().data()}
});
// voidfncnoop uses support_mode::no_op
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "voidfncnoop"_n, "caller"_n, {}));
// voidfncabort uses default support_mode::abort
BOOST_CHECK_EXCEPTION(t.push_action("caller"_n, "voidfncabort"_n, "caller"_n, {}),
eosio_assert_message_exception,
fc_exception_message_contains("receiver does not support sync call but support_mode is set to abort"));
// intfuncnoop uses support_mode::no_op
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "intfuncnoop"_n, "caller"_n, {}));
// intfuncabort uses default support_mode::abort
BOOST_CHECK_EXCEPTION(t.push_action("caller"_n, "intfuncabort"_n, "caller"_n, {}),
eosio_assert_message_exception,
fc_exception_message_contains("receiver does not support sync call but support_mode is set to abort"));
} FC_LOG_AND_RETHROW() }
// Verify support_mode for void and non-void sync calls if call is successful
BOOST_AUTO_TEST_CASE(sync_call_support_mode_success_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
// voidnoopsucc uses support_mode::no_op
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "voidnoopsucc"_n, "caller"_n, {}));
// sumnoopsucc uses support_mode::no_op
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "sumnoopsucc"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify header validation
BOOST_AUTO_TEST_CASE(unknown_function_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "hdrvaltest"_n, "caller"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify adding/reading entries to/from a table, and read-only enforcement work
BOOST_AUTO_TEST_CASE(addr_book_tests) { try {
call_tester t({
{"caller"_n, contracts::addr_book_caller_wasm(), contracts::addr_book_caller_abi().data()},
{"callee"_n, contracts::addr_book_callee_wasm(), contracts::addr_book_callee_abi().data()}
});
// Try to add an entry using a read-only sync call
BOOST_CHECK_EXCEPTION(t.push_action("caller"_n, "upsertrdonly"_n, "caller"_n, mvo()
("user", "alice")
("first_name", "alice")
("street", "123 Main St.")),
unaccessible_api,
fc_exception_message_contains("this API is not allowed in read only action/call"));
// Add an entry using a read-write sync call
t.push_action("caller"_n, "upsert"_n, "caller"_n, mvo()
("user", "alice")
("first_name", "alice")
("street", "123 Main St."));
// Read the inserted entry. "get"_n action will check the return value from the sync call
BOOST_REQUIRE_NO_THROW(t.push_action("caller"_n, "get"_n, "caller"_n, mvo() ("user", "alice")));
} FC_LOG_AND_RETHROW() }
// For a function tagged as both `action` and `call`, verify is_sync_call()
// returns true if tagged as `call` and false if tagged as `action`.
BOOST_AUTO_TEST_CASE(is_sync_call_test) { try {
call_tester t({
{"caller"_n, contracts::caller_wasm(), contracts::caller_abi().data()},
{"callee"_n, contracts::callee_wasm(), contracts::callee_abi().data()}
});
// issynccall() is tagged as both `action` and `call`, and returns
// is_sync_call(). makesynccall() calls issynccall() as a sync call
// and returns its result. So the current action return value must be
// true.
auto trx_trace = t.push_action("caller"_n, "makesynccall"_n, "caller"_n, {});
auto& action_trace = trx_trace->action_traces[0];
bool return_value = fc::raw::unpack<bool>(action_trace.return_value);
BOOST_REQUIRE(return_value == true);
// Call issynccall() directly as an action. Since issynccall()
// returns is_sync_call(), the current action return value must be false.
trx_trace = t.push_action("callee"_n, "issynccall"_n, "callee"_n, {});
auto& action_trace1 = trx_trace->action_traces[0];
return_value = fc::raw::unpack<bool>(action_trace1.return_value);
BOOST_REQUIRE(return_value == false);
} FC_LOG_AND_RETHROW() }
// Verify customized sync call entry function, without sync call tag
BOOST_AUTO_TEST_CASE(customized_call_entry_func_test1) { try {
call_tester t({{"receiver"_n, contracts::cust_entry_wasm(), contracts::cust_entry_abi().data()}});
BOOST_REQUIRE_NO_THROW(t.push_action("receiver"_n, "cusentrytst1"_n, "receiver"_n, {}));
} FC_LOG_AND_RETHROW() }
// Verify customized sync call entry function, with sync call tag
BOOST_AUTO_TEST_CASE(customized_call_entry_func_test2) { try {
call_tester t({{"receiver"_n, contracts::cust_entry_wasm(), contracts::cust_entry_abi().data()}});
BOOST_REQUIRE_NO_THROW(t.push_action("receiver"_n, "cusentrytst2"_n, "receiver"_n, {}));
} FC_LOG_AND_RETHROW() }
BOOST_AUTO_TEST_SUITE_END()
-2
View File
@@ -2,8 +2,6 @@
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <Runtime/Runtime.h>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
-2
View File
@@ -2,8 +2,6 @@
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <Runtime/Runtime.h>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
+34
View File
@@ -3,6 +3,8 @@
namespace eosio::testing {
struct contracts {
static std::vector<uint8_t> array_tests_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/array_tests.wasm"); }
static std::vector<char> array_tests_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/array_tests.abi"); }
static std::vector<uint8_t> malloc_tests_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/malloc_tests.wasm"); }
static std::vector<char> malloc_tests_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/malloc_tests.abi"); }
static std::vector<uint8_t> old_malloc_tests_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/old_malloc_tests.wasm"); }
@@ -22,5 +24,37 @@ namespace eosio::testing {
static std::vector<uint8_t> crypto_primitives_test_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/crypto_primitives_tests.wasm"); }
static std::vector<char> crypto_primitives_test_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/crypto_primitives_tests.abi"); }
static std::vector<uint8_t> bls_primitives_test_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/bls_primitives_tests.wasm"); }
static std::vector<char> bls_primitives_test_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/bls_primitives_tests.abi"); }
static std::vector<uint8_t> instant_finality_test_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/instant_finality_tests.wasm"); }
static std::vector<char> instant_finality_test_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/instant_finality_tests.abi"); }
static std::vector<uint8_t> get_code_hash_write_test_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/get_code_hash_write.wasm"); }
static std::vector<char> get_code_hash_write_test_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/get_code_hash_write.abi"); }
static std::vector<uint8_t> get_code_hash_read_test_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/get_code_hash_read.wasm"); }
static std::vector<char> get_code_hash_read_test_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/get_code_hash_read.abi"); }
static std::vector<uint8_t> name_pk_tests_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/name_pk_tests.wasm"); }
static std::vector<char> name_pk_tests_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/name_pk_tests.abi"); }
static std::vector<uint8_t> test_multi_index_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/test_multi_index.wasm"); }
static std::vector<char> test_multi_index_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/test_multi_index.abi"); }
static std::vector<uint8_t> caller_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_caller.wasm"); }
static std::vector<char> caller_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_caller.abi"); }
static std::vector<uint8_t> callee_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_callee.wasm"); }
static std::vector<char> callee_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_callee.abi"); }
static std::vector<uint8_t> not_supported_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_not_supported.wasm"); }
static std::vector<char> not_supported_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_not_supported.abi"); }
static std::vector<uint8_t> single_func_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_single_func.wasm"); }
static std::vector<char> single_func_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_single_func.abi"); }
static std::vector<uint8_t> addr_book_callee_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_addr_book_callee.wasm"); }
static std::vector<char> addr_book_callee_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_addr_book_callee.abi"); }
static std::vector<uint8_t> addr_book_caller_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_addr_book_caller.wasm"); }
static std::vector<char> addr_book_caller_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_addr_book_caller.abi"); }
static std::vector<uint8_t> cust_entry_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_cust_entry.wasm"); }
static std::vector<char> cust_entry_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/sync_call_cust_entry.abi"); }
};
} //ns eosio::testing
-2
View File
@@ -2,8 +2,6 @@
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <Runtime/Runtime.h>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
+44
View File
@@ -0,0 +1,44 @@
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
using namespace eosio;
using namespace eosio::testing;
using namespace eosio::chain;
using namespace fc;
using mvo = fc::mutable_variant_object;
struct code_hash {
uint64_t id;
fc::sha256 hash;
uint64_t primary_key() const { return id; }
};
FC_REFLECT(code_hash, (id)(hash))
BOOST_AUTO_TEST_SUITE(get_code_hash_tests_suite)
BOOST_FIXTURE_TEST_CASE( get_code_hash_tests, tester ) try {
create_accounts( { "test"_n } );
produce_block();
set_code( "test"_n, contracts::get_code_hash_write_test_wasm() );
set_abi( "test"_n, contracts::get_code_hash_write_test_abi().data() );
produce_blocks();
push_action("test"_n, "theaction"_n, "test"_n, mvo());
code_hash entry;
get_table_entry(entry, "test"_n, "test"_n, "code.hash"_n, 0);
wdump((entry.hash));
set_code( "test"_n, contracts::get_code_hash_read_test_wasm() );
produce_blocks();
push_action("test"_n, "theaction"_n, "test"_n, mvo());
} FC_LOG_AND_RETHROW()
BOOST_AUTO_TEST_SUITE_END()
@@ -0,0 +1,55 @@
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
using namespace eosio;
using namespace eosio::testing;
using namespace fc;
using mvo = fc::mutable_variant_object;
BOOST_AUTO_TEST_SUITE(instant_finality_tests)
BOOST_FIXTURE_TEST_CASE(instant_finality_test, tester) try {
create_accounts( { "test"_n } );
produce_block();
set_code( config::system_account_name, contracts::instant_finality_test_wasm() );
set_abi( config::system_account_name, contracts::instant_finality_test_abi().data() );
produce_block();
push_action(config::system_account_name, "setfinalizer"_n, "test"_n, mvo()
("finalizer_policy", mvo()("threshold", 1)
("finalizers", std::vector<mvo>{mvo()
("description", "test_desc")
("weight", 1)
("public_key", "744beeb74c9d1debc318fe847f73b822ae905dff6351c3144f59c22515fe251625158acefea2adff1e37f6f509d83919df639de8074967e4bd756444f52cbeed0e9b363a6820e3f4716ce4282d43aa685f137a5a5be293840de7a0b915f12b08")})));
signed_block_ptr cur_block = produce_block();
fc::variant pretty_output;
abi_serializer::to_variant( *cur_block, pretty_output, get_resolver(), fc::microseconds::maximum() );
std::cout << fc::json::to_string(pretty_output, fc::time_point::now() + abi_serializer_max_time) << std::endl;
std::string output_json = fc::json::to_pretty_string(pretty_output);
BOOST_TEST(output_json.find("finality_extension") != std::string::npos);
BOOST_TEST(output_json.find("\"generation\": 2") != std::string::npos);
BOOST_TEST(output_json.find("\"threshold\": 1") != std::string::npos);
BOOST_TEST(output_json.find("\"description\": \"test_desc\"") != std::string::npos);
BOOST_TEST(output_json.find("\"weight\": 1") != std::string::npos);
BOOST_TEST(output_json.find("PUB_BLS_dEvut0ydHevDGP6Ef3O4Iq6QXf9jUcMUT1nCJRX-JRYlFYrO_qKt_x439vUJ2DkZ32Od6AdJZ-S9dWRE9Sy-7Q6bNjpoIOP0cWzkKC1DqmhfE3paW-KThA3noLkV8SsILcfxpQ") != std::string::npos);
// testing wrong public key size
BOOST_CHECK_THROW(push_action(config::system_account_name, "setfinalizer"_n, "test"_n, mvo()
("finalizer_policy", mvo()("threshold", 1)
("finalizers", std::vector<mvo>{mvo()
("description", "test_desc")
("weight", 1)
("public_key", std::vector<char>{'a', 'b', 'c'})}))), fc::exception);
} FC_LOG_AND_RETHROW()
BOOST_AUTO_TEST_SUITE_END()
-1
View File
@@ -8,7 +8,6 @@
#include <boost/test/included/unit_test.hpp>
#include <fc/log/logger.hpp>
#include <eosio/chain/exceptions.hpp>
#include <Runtime/Runtime.h>
#define BOOST_TEST_STATIC_LINK
-2
View File
@@ -2,8 +2,6 @@
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <Runtime/Runtime.h>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
+75
View File
@@ -0,0 +1,75 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <boost/test/unit_test.hpp>
#pragma GCC diagnostic pop
#include <eosio/testing/tester.hpp>
#include <contracts.hpp>
using namespace eosio;
using namespace eosio::testing;
#ifdef NON_VALIDATING_TEST
#define TESTER tester
#else
#define TESTER validating_tester
#endif
BOOST_AUTO_TEST_SUITE(multi_index_tests)
// this test is copied from Spring test_api_multi_index
BOOST_FIXTURE_TEST_CASE(main_multi_index_tests, TESTER) { try {
produce_blocks(1);
create_account( "testapi"_n );
produce_blocks(1);
set_code( "testapi"_n, contracts::test_multi_index_wasm() );
set_abi( "testapi"_n, contracts::test_multi_index_abi().data() );
produce_blocks(1);
auto check_failure = [this]( action_name a, const char* expected_error_msg ) {
BOOST_CHECK_EXCEPTION( push_action( "testapi"_n, a, "testapi"_n, {} ),
eosio_assert_message_exception,
eosio_assert_message_is( expected_error_msg )
);
};
push_action( "testapi"_n, "s1g"_n, "testapi"_n, {} ); // idx64_general
push_action( "testapi"_n, "s1store"_n, "testapi"_n, {} ); // idx64_store_only
push_action( "testapi"_n, "s1check"_n, "testapi"_n, {} ); // idx64_check_without_storing
push_action( "testapi"_n, "s2g"_n, "testapi"_n, {} ); // idx128_general
push_action( "testapi"_n, "s2store"_n, "testapi"_n, {} ); // idx128_store_only
push_action( "testapi"_n, "s2check"_n, "testapi"_n, {} ); // idx128_check_without_storing
push_action( "testapi"_n, "s2autoinc"_n, "testapi"_n, {} ); // idx128_autoincrement_test
push_action( "testapi"_n, "s2autoinc1"_n, "testapi"_n, {} ); // idx128_autoincrement_test_part1
push_action( "testapi"_n, "s2autoinc2"_n, "testapi"_n, {} ); // idx128_autoincrement_test_part2
push_action( "testapi"_n, "s3g"_n, "testapi"_n, {} ); // idx256_general
push_action( "testapi"_n, "sdg"_n, "testapi"_n, {} ); // idx_double_general
push_action( "testapi"_n, "sldg"_n, "testapi"_n, {} ); // idx_long_double_general
check_failure( "s1pkend"_n, "cannot increment end iterator" ); // idx64_pk_iterator_exceed_end
check_failure( "s1skend"_n, "cannot increment end iterator" ); // idx64_sk_iterator_exceed_end
check_failure( "s1pkbegin"_n, "cannot decrement iterator at beginning of table" ); // idx64_pk_iterator_exceed_begin
check_failure( "s1skbegin"_n, "cannot decrement iterator at beginning of index" ); // idx64_sk_iterator_exceed_begin
check_failure( "s1pkref"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_pk_ref_to_other_table
check_failure( "s1skref"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_sk_ref_to_other_table
check_failure( "s1pkitrto"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_pk_end_itr_to_iterator_to
check_failure( "s1pkmodify"_n, "cannot pass end iterator to modify" ); // idx64_pass_pk_end_itr_to_modify
check_failure( "s1pkerase"_n, "cannot pass end iterator to erase" ); // idx64_pass_pk_end_itr_to_erase
check_failure( "s1skitrto"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_sk_end_itr_to_iterator_to
check_failure( "s1skmodify"_n, "cannot pass end iterator to modify" ); // idx64_pass_sk_end_itr_to_modify
check_failure( "s1skerase"_n, "cannot pass end iterator to erase" ); // idx64_pass_sk_end_itr_to_erase
check_failure( "s1modpk"_n, "updater cannot change primary key when modifying an object" ); // idx64_modify_primary_key
check_failure( "s1exhaustpk"_n, "next primary key in table is at autoincrement limit" ); // idx64_run_out_of_avl_pk
check_failure( "s1findfail1"_n, "unable to find key" ); // idx64_require_find_fail
check_failure( "s1findfail2"_n, "unable to find primary key in require_find" );// idx64_require_find_fail_with_msg
check_failure( "s1findfail3"_n, "unable to find secondary key" ); // idx64_require_find_sk_fail
check_failure( "s1findfail4"_n, "unable to find sec key" ); // idx64_require_find_sk_fail_with_msg
push_action( "testapi"_n, "s1skcache"_n, "testapi"_n, {} ); // idx64_sk_cache_pk_lookup
push_action( "testapi"_n, "s1pkcache"_n, "testapi"_n, {} ); // idx64_pk_cache_sk_lookup
BOOST_REQUIRE_EQUAL( validate(), true );
} FC_LOG_AND_RETHROW() }
BOOST_AUTO_TEST_SUITE_END()
+30
View File
@@ -0,0 +1,30 @@
#include <boost/test/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <fc/variant_object.hpp>
#include <contracts.hpp>
using namespace eosio;
using namespace eosio::testing;
using namespace eosio::chain;
using namespace fc;
using mvo = fc::mutable_variant_object;
BOOST_AUTO_TEST_SUITE(name_pk_tests_suite)
BOOST_FIXTURE_TEST_CASE( name_pk_tests, tester ) try {
create_accounts( { "test"_n } );
produce_block();
set_code( "test"_n, contracts::name_pk_tests_wasm() );
set_abi( "test"_n, contracts::name_pk_tests_abi().data() );
produce_blocks();
push_action("test"_n, "write"_n, "test"_n, mvo());
push_action("test"_n, "read"_n, "test"_n, mvo());
} FC_LOG_AND_RETHROW()
BOOST_AUTO_TEST_SUITE_END()
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <cstdint>
#include <string>
#include <cstring>
#include <string_view>
#include <vector>
#include <optional>
#include <charconv>
inline eosio::chain::version_t extract_version_from_json_abi(std::vector<char> abi) {
std::string_view sv(abi.data(), abi.size());
constexpr const char* pattern = R"("version": "eosio::abi/)";
if (auto pos = sv.find(pattern); pos != std::string_view::npos) {
return eosio::chain::version_t{sv.substr(pos + strlen(pattern))};
}
return {};
}
@@ -1,6 +1,7 @@
{
"tests" : [
{
"compile_flags": [],
"expected" : {
"abi-file" : "action_results_test.abi"
}
@@ -1,6 +1,7 @@
{
"tests": [
{
"compile_flags": [],
"expected": {
"abi-file": "aliased_type_variant_template_arg.abi"
}
@@ -0,0 +1,50 @@
#pragma once
#include <eosio/eosio.hpp>
#include <eosio/name.hpp>
#include <eosio/singleton.hpp>
#include <eosio/multi_index.hpp>
struct [[eosio::table]] out_of_class {
uint64_t id;
uint64_t primary_key() const { return id; }
};
typedef eosio::multi_index<"mi.config55"_n, out_of_class> out_of_class_index;
using uout_of_class_index = eosio::multi_index<"mi.config551"_n, out_of_class>;
typedef eosio::singleton<"smpl.conf55"_n, eosio::name> smpl_config55;
typedef eosio::singleton<"config55"_n, out_of_class> config55;
typedef smpl_config55 smpl_config551;
typedef config55 config551;
using smpl_conf551 = eosio::singleton<"smpl.conf551"_n, eosio::name>;
using config552 = eosio::singleton<"config552"_n, out_of_class>;
using smpl_conf552 = smpl_conf551;
using config553 = config551;
class [[eosio::contract("singleton_contract_simple2")]] singleton_contract_simple2 : public eosio::contract {
public:
using eosio::contract::contract;
[[eosio::action]]
void whatever() {};
struct [[eosio::table]] inside_class {
uint64_t id;
uint64_t primary_key() const { return id; }
};
typedef eosio::singleton<"smpl.conf552"_n, eosio::name> smpl_conf552;
typedef eosio::singleton<"config552"_n, inside_class> config552;
typedef smpl_conf552 smpl_conf553;
typedef config552 config553;
using smpl_conf554 = eosio::singleton<"smpl.conf554"_n, eosio::name>;
using config554 = eosio::singleton<"config554"_n, inside_class>;
using smpl_conf555 = smpl_conf554;
using config555 = config554;
typedef eosio::multi_index<"mi.config553"_n, inside_class> inside_class_index;
using uinside_class_index = eosio::multi_index<"mi.config554"_n, inside_class>;
};
@@ -1,6 +1,7 @@
{
"tests" : [
{
"compile_flags": [],
"expected" : {
"abi-file" : "nested_container.abi"
}

Some files were not shown because too many files have changed in this diff Show More