├── .buildkite ├── pipeline_light.yml ├── pipeline_linux_build.yml └── pipeline_mac_build.yml ├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .gitlab-ci.yml ├── .gitmodules ├── CMakeLists.txt ├── CMakeModules ├── CMakeASM-LLVMWARInformation.cmake ├── CMakeDetermineASM-LLVMWARCompiler.cmake ├── CMakeTestASM-LLVMWARCompiler.cmake ├── EosioTester.cmake.in ├── EosioTesterBuild.cmake.in ├── FindCppkafka.cmake ├── FindGperftools.cmake ├── FindWasm.cmake ├── InstallDirectoryPermissions.cmake ├── MASSigning.cmake ├── additionalPlugins.cmake ├── cotire.cmake ├── doxygen.cmake ├── eosio-config.cmake.in ├── installer.cmake ├── package.cmake └── utils.cmake ├── Docker ├── Dockerfile ├── README.md ├── builder │ └── Dockerfile ├── cleos.sh ├── config.ini ├── dev │ └── Dockerfile ├── docker-compose-latest.yml ├── docker-compose.yml └── nodeosd.sh ├── HEADER ├── LICENSE ├── README.md ├── README_CN.md ├── debian ├── CMakeLists.txt └── postinst ├── docs └── doxygen.css ├── eos.doxygen.in ├── eosio.version.in ├── eosio_build.sh ├── eosio_install.sh ├── eosio_uninstall.sh ├── externals └── CMakeLists.txt ├── images ├── bos-workflow.png ├── eos-logo.png ├── mesh.dot ├── mesh.png ├── ring.dot ├── ring.png ├── star.dot ├── star.png └── testnet-diagrams.sh ├── libraries ├── CMakeLists.txt ├── builtins │ ├── CMakeLists.txt │ ├── README.txt │ ├── compiler_builtins.hpp │ ├── fixdfti.c │ ├── fixsfti.c │ ├── fixtfti.c │ ├── fixunsdfti.c │ ├── fixunssfti.c │ ├── fixunstfti.c │ ├── floattidf.c │ ├── floatuntidf.c │ ├── fp128.h │ ├── fp32.h │ ├── fp64.h │ └── int_t.h ├── chain │ ├── CMakeLists.txt │ ├── abi_serializer.cpp │ ├── apply_context.cpp │ ├── asset.cpp │ ├── authorization_manager.cpp │ ├── block_header.cpp │ ├── block_header_state.cpp │ ├── block_log.cpp │ ├── block_state.cpp │ ├── chain_config.cpp │ ├── chain_id_type.cpp │ ├── controller.cpp │ ├── eosio_contract.cpp │ ├── eosio_contract_abi.cpp │ ├── fork_database.cpp │ ├── genesis_intrinsics.cpp │ ├── genesis_state.cpp │ ├── genesis_state_root_key.cpp.in │ ├── include │ │ └── eosio │ │ │ └── chain │ │ │ ├── abi_def.hpp │ │ │ ├── abi_serializer.hpp │ │ │ ├── account_object.hpp │ │ │ ├── action.hpp │ │ │ ├── action_receipt.hpp │ │ │ ├── apply_context.hpp │ │ │ ├── asset.hpp │ │ │ ├── authority.hpp │ │ │ ├── authority_checker.hpp │ │ │ ├── authorization_manager.hpp │ │ │ ├── block.hpp │ │ │ ├── block_header.hpp │ │ │ ├── block_header_state.hpp │ │ │ ├── block_log.hpp │ │ │ ├── block_state.hpp │ │ │ ├── block_summary_object.hpp │ │ │ ├── block_timestamp.hpp │ │ │ ├── chain_config.hpp │ │ │ ├── chain_id_type.hpp │ │ │ ├── chain_snapshot.hpp │ │ │ ├── code_object.hpp │ │ │ ├── config.hpp │ │ │ ├── config_xos.hpp │ │ │ ├── contract_table_objects.hpp │ │ │ ├── contract_types.hpp │ │ │ ├── controller.hpp │ │ │ ├── core_symbol.hpp.in │ │ │ ├── database_utils.hpp │ │ │ ├── eosio_contract.hpp │ │ │ ├── exceptions.hpp │ │ │ ├── fixed_key.hpp │ │ │ ├── fork_database.hpp │ │ │ ├── generated_transaction_object.hpp │ │ │ ├── genesis_intrinsics.hpp │ │ │ ├── genesis_state.hpp │ │ │ ├── global_property_object.hpp │ │ │ ├── incremental_merkle.hpp │ │ │ ├── merkle.hpp │ │ │ ├── multi_index_includes.hpp │ │ │ ├── name.hpp │ │ │ ├── parallel_markers.hpp │ │ │ ├── pbft.hpp │ │ │ ├── pbft_database.hpp │ │ │ ├── permission_link_object.hpp │ │ │ ├── permission_object.hpp │ │ │ ├── platform_timer.hpp │ │ │ ├── platform_timer_accuracy.hpp │ │ │ ├── producer_object.hpp │ │ │ ├── producer_schedule.hpp │ │ │ ├── protocol.hpp │ │ │ ├── protocol_state_object.hpp │ │ │ ├── resource_limits.hpp │ │ │ ├── resource_limits_private.hpp │ │ │ ├── reversible_block_object.hpp │ │ │ ├── snapshot.hpp │ │ │ ├── symbol.hpp │ │ │ ├── thread_utils.hpp │ │ │ ├── trace.hpp │ │ │ ├── transaction.hpp │ │ │ ├── transaction_context.hpp │ │ │ ├── transaction_metadata.hpp │ │ │ ├── transaction_object.hpp │ │ │ ├── types.hpp │ │ │ ├── wasm_eosio_binary_ops.hpp │ │ │ ├── wasm_eosio_constraints.hpp │ │ │ ├── wasm_eosio_injection.hpp │ │ │ ├── wasm_eosio_validation.hpp │ │ │ ├── wasm_interface.hpp │ │ │ ├── wasm_interface_private.hpp │ │ │ ├── wast_to_wasm.hpp │ │ │ ├── webassembly │ │ │ ├── common.hpp │ │ │ ├── eos-vm-oc.hpp │ │ │ ├── eos-vm-oc │ │ │ │ ├── code_cache.hpp │ │ │ │ ├── compile_monitor.hpp │ │ │ │ ├── compile_trampoline.hpp │ │ │ │ ├── config.hpp │ │ │ │ ├── eos-vm-oc.h │ │ │ │ ├── eos-vm-oc.hpp │ │ │ │ ├── executor.hpp │ │ │ │ ├── gs_seg_helpers.h │ │ │ │ ├── intrinsic.hpp │ │ │ │ ├── intrinsic_mapping.hpp │ │ │ │ ├── ipc_helpers.hpp │ │ │ │ ├── ipc_protocol.hpp │ │ │ │ └── memory.hpp │ │ │ ├── eos-vm.hpp │ │ │ ├── runtime_interface.hpp │ │ │ ├── wabt.hpp │ │ │ └── wavm.hpp │ │ │ └── whitelisted_intrinsics.hpp │ ├── merkle.cpp │ ├── name.cpp │ ├── pbft.cpp │ ├── pbft_database.cpp │ ├── platform_timer_accuracy.cpp │ ├── platform_timer_asio_fallback.cpp │ ├── platform_timer_macos.cpp │ ├── platform_timer_posix.cpp │ ├── platform_timer_posix_test.c │ ├── protocol_state_object.cpp │ ├── resource_limits.cpp │ ├── snapshot.cpp │ ├── trace.cpp │ ├── transaction.cpp │ ├── transaction_context.cpp │ ├── transaction_metadata.cpp │ ├── wasm_eosio_binary_ops.cpp │ ├── wasm_eosio_injection.cpp │ ├── wasm_eosio_validation.cpp │ ├── wasm_interface.cpp │ ├── wast_to_wasm.cpp │ ├── webassembly │ │ ├── eos-vm-oc.cpp │ │ ├── eos-vm-oc │ │ │ ├── About WAVM │ │ │ ├── LLVMEmitIR.cpp │ │ │ ├── LLVMJIT.cpp │ │ │ ├── LLVMJIT.h │ │ │ ├── code_cache.cpp │ │ │ ├── compile_monitor.cpp │ │ │ ├── compile_trampoline.cpp │ │ │ ├── executor.cpp │ │ │ ├── gs_seg_helpers.c │ │ │ ├── intrinsic.cpp │ │ │ ├── ipc_helpers.cpp │ │ │ ├── llvmWARshim.cpp │ │ │ ├── llvmWARshim.llvmwar │ │ │ └── memory.cpp │ │ ├── eos-vm.cpp │ │ ├── wabt.cpp │ │ └── wavm.cpp │ └── whitelisted_intrinsics.cpp ├── testing │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── testing │ │ │ ├── chainbase_fixture.hpp │ │ │ ├── tester.hpp │ │ │ └── tester_network.hpp │ ├── tester.cpp │ └── tester_network.cpp └── wasm-jit │ ├── .travis.yml │ ├── CMakeLists.txt │ ├── Include │ ├── Emscripten │ │ └── Emscripten.h │ ├── IR │ │ ├── IR.h │ │ ├── Module.h │ │ ├── OperatorPrinter.h │ │ ├── Operators.h │ │ ├── Types.h │ │ └── Validate.h │ ├── Inline │ │ ├── BasicTypes.h │ │ ├── CMakeLists.txt │ │ ├── DenseStaticIntSet.h │ │ ├── Errors.h │ │ ├── Floats.h │ │ ├── Serialization.h │ │ ├── Timing.h │ │ └── UTF8.h │ ├── Logging │ │ └── Logging.h │ ├── Platform │ │ └── Platform.h │ ├── Runtime │ │ ├── Intrinsics.h │ │ ├── Linker.h │ │ ├── Runtime.h │ │ ├── TaggedValue.h │ │ └── llvmWARshim.h │ ├── WASM │ │ └── WASM.h │ └── WAST │ │ ├── TestScript.h │ │ └── WAST.h │ ├── LICENSE │ ├── README.md │ ├── Source │ ├── Emscripten │ │ ├── CMakeLists.txt │ │ └── Emscripten.cpp │ ├── IR │ │ ├── CMakeLists.txt │ │ ├── DisassemblyNames.cpp │ │ ├── Operators.cpp │ │ ├── Types.cpp │ │ └── Validate.cpp │ ├── Logging │ │ ├── CMakeLists.txt │ │ └── Logging.cpp │ ├── Platform │ │ ├── CMakeLists.txt │ │ ├── POSIX.cpp │ │ └── Windows.cpp │ ├── Programs │ │ ├── Assemble.cpp │ │ ├── CLI.h │ │ ├── CMakeLists.txt │ │ ├── Disassemble.cpp │ │ ├── Test.cpp │ │ └── wavm.cpp │ ├── Runtime │ │ ├── CMakeLists.txt │ │ ├── Intrinsics.cpp │ │ ├── LLVMEmitIR.cpp │ │ ├── LLVMJIT.cpp │ │ ├── LLVMJIT.h │ │ ├── Linker.cpp │ │ ├── Memory.cpp │ │ ├── ModuleInstance.cpp │ │ ├── ObjectGC.cpp │ │ ├── Runtime.cpp │ │ ├── RuntimePrivate.h │ │ ├── Table.cpp │ │ ├── Threads.cpp │ │ ├── WAVMIntrinsics.cpp │ │ ├── llvmWARshim.cpp │ │ └── llvmWARshim.llvmwar │ ├── ThirdParty │ │ ├── dtoa.c │ │ └── xxhash │ │ │ ├── LICENSE │ │ │ ├── xxhash.c │ │ │ └── xxhash.h │ ├── WASM │ │ ├── CMakeLists.txt │ │ └── WASMSerialization.cpp │ └── WAST │ │ ├── CMakeLists.txt │ │ ├── Lexer.cpp │ │ ├── Lexer.h │ │ ├── NFA.cpp │ │ ├── NFA.h │ │ ├── Parse.cpp │ │ ├── Parse.h │ │ ├── ParseFunction.cpp │ │ ├── ParseModule.cpp │ │ ├── ParseNumbers.cpp │ │ ├── ParseTests.cpp │ │ ├── Print.cpp │ │ ├── Regexp.cpp │ │ └── Regexp.h │ ├── Test │ ├── Benchmark │ │ └── Benchmark.cpp │ └── spec │ │ ├── CMakeLists.txt │ │ └── LICENSE │ ├── afl │ ├── readme │ ├── run-afl-fuzz │ ├── simplify-crashes │ └── wast.dict │ └── travis-build.sh ├── pipeline.jsonc ├── plugins ├── CMakeLists.txt ├── COMMUNITY.md ├── chain_api_plugin │ ├── CMakeLists.txt │ ├── chain_api_plugin.cpp │ └── include │ │ └── eosio │ │ └── chain_api_plugin │ │ └── chain_api_plugin.hpp ├── chain_interface │ └── include │ │ └── eosio │ │ └── chain │ │ └── plugin_interface.hpp ├── chain_plugin │ ├── CMakeLists.txt │ ├── account_query_db.cpp │ ├── chain_plugin.cpp │ └── include │ │ └── eosio │ │ └── chain_plugin │ │ ├── account_query_db.hpp │ │ └── chain_plugin.hpp ├── db_size_api_plugin │ ├── CMakeLists.txt │ ├── db_size_api_plugin.cpp │ └── include │ │ └── eosio │ │ └── db_size_api_plugin │ │ └── db_size_api_plugin.hpp ├── eosio-make_new_plugin.sh ├── faucet_testnet_plugin │ ├── CMakeLists.txt │ ├── faucet_testnet_plugin.cpp │ └── include │ │ └── eosio │ │ └── faucet_testnet_plugin │ │ └── faucet_testnet_plugin.hpp ├── history_api_plugin │ ├── CMakeLists.txt │ ├── history_api_plugin.cpp │ └── include │ │ └── eosio │ │ └── history_api_plugin │ │ └── history_api_plugin.hpp ├── history_plugin │ ├── CMakeLists.txt │ ├── history_plugin.cpp │ └── include │ │ └── eosio │ │ └── history_plugin │ │ ├── account_control_history_object.hpp │ │ ├── history_plugin.hpp │ │ └── public_key_history_object.hpp ├── http_client_plugin │ ├── CMakeLists.txt │ ├── http_client_plugin.cpp │ └── include │ │ └── eosio │ │ └── http_client_plugin │ │ └── http_client_plugin.hpp ├── http_plugin │ ├── CMakeLists.txt │ ├── http_plugin.cpp │ └── include │ │ └── eosio │ │ └── http_plugin │ │ ├── http_plugin.hpp │ │ └── local_endpoint.hpp ├── kafka_plugin │ ├── CMakeLists.txt │ ├── fifo.h │ ├── kafka.cpp │ ├── kafka.hpp │ ├── kafka_plugin.cpp │ ├── kafka_plugin.hpp │ ├── readme.md │ ├── try_handle.cpp │ ├── try_handle.hpp │ └── types.hpp ├── login_plugin │ ├── .clang-format │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── login_plugin │ │ │ └── login_plugin.hpp │ └── login_plugin.cpp ├── mongo_db_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── mongo_db_plugin │ │ │ └── mongo_db_plugin.hpp │ └── mongo_db_plugin.cpp ├── net_api_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── net_api_plugin │ │ │ └── net_api_plugin.hpp │ └── net_api_plugin.cpp ├── net_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── net_plugin │ │ │ ├── net_plugin.hpp │ │ │ └── protocol.hpp │ └── net_plugin.cpp ├── notify_plugin │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ │ └── eosio │ │ │ └── notify_plugin │ │ │ ├── http_async_client.hpp │ │ │ └── notify_plugin.hpp │ └── notify_plugin.cpp ├── pbft_api_plugin │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ │ └── eosio │ │ │ └── pbft_api_plugin │ │ │ └── pbft_api_plugin.hpp │ └── pbft_api_plugin.cpp ├── pbft_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── pbft_plugin │ │ │ └── pbft_plugin.hpp │ └── pbft_plugin.cpp ├── producer_api_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── producer_api_plugin │ │ │ └── producer_api_plugin.hpp │ └── producer_api_plugin.cpp ├── producer_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── producer_plugin │ │ │ └── producer_plugin.hpp │ └── producer_plugin.cpp ├── state_history_plugin │ ├── .clang-format │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── state_history_plugin │ │ │ ├── state_history_log.hpp │ │ │ ├── state_history_plugin.hpp │ │ │ └── state_history_serialization.hpp │ ├── state_history_plugin.cpp │ └── state_history_plugin_abi.cpp ├── template_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── template_plugin │ │ │ └── template_plugin.hpp │ └── template_plugin.cpp ├── test_control_api_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── test_control_api_plugin │ │ │ └── test_control_api_plugin.hpp │ └── test_control_api_plugin.cpp ├── test_control_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── test_control_plugin │ │ │ └── test_control_plugin.hpp │ └── test_control_plugin.cpp ├── txn_test_gen_plugin │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ │ └── eosio │ │ │ └── txn_test_gen_plugin │ │ │ └── txn_test_gen_plugin.hpp │ └── txn_test_gen_plugin.cpp ├── wallet_api_plugin │ ├── CMakeLists.txt │ ├── include │ │ └── eosio │ │ │ └── wallet_api_plugin │ │ │ └── wallet_api_plugin.hpp │ └── wallet_api_plugin.cpp └── wallet_plugin │ ├── CMakeLists.txt │ ├── include │ └── eosio │ │ └── wallet_plugin │ │ ├── macos_user_auth.h │ │ ├── se_wallet.hpp │ │ ├── wallet.hpp │ │ ├── wallet_api.hpp │ │ ├── wallet_manager.hpp │ │ ├── wallet_plugin.hpp │ │ ├── yubihsm.h │ │ └── yubihsm_wallet.hpp │ ├── macos_user_auth.m │ ├── se_wallet.cpp │ ├── wallet.cpp │ ├── wallet_manager.cpp │ ├── wallet_plugin.cpp │ └── yubihsm_wallet.cpp ├── programs ├── CMakeLists.txt ├── cleos │ ├── CLI11.hpp │ ├── CMakeLists.txt │ ├── config.hpp.in │ ├── eosc.pot │ ├── help_text.cpp │ ├── help_text.hpp │ ├── httpc.cpp │ ├── httpc.hpp │ ├── localize.hpp │ └── main.cpp ├── eosio-blocklog │ ├── CMakeLists.txt │ └── main.cpp ├── eosio-launcher │ ├── CMakeLists.txt │ ├── config.hpp.in │ └── main.cpp ├── keosd │ ├── CMakeLists.txt │ ├── config.hpp.in │ └── main.cpp └── nodeos │ ├── CMakeLists.txt │ ├── config.hpp.in │ └── main.cpp ├── scripts ├── CMakeLists.txt ├── abi_is_json.py ├── boost.rb ├── clean_old_install.sh ├── eosio-tn_bounce.sh ├── eosio-tn_down.sh ├── eosio-tn_roll.sh ├── eosio-tn_up.sh ├── eosio_build_amazon.sh ├── eosio_build_centos.sh ├── eosio_build_darwin.sh ├── eosio_build_dep ├── eosio_build_fedora.sh ├── eosio_build_ubuntu.sh ├── generate_bottle.sh ├── generate_deb.sh ├── generate_package.sh.in ├── generate_rpm.sh └── generate_tarball.sh ├── testnet.md ├── testnet.template ├── tests ├── CMakeLists.txt ├── Cluster.py ├── Node.py ├── TestHelper.py ├── WalletMgr.py ├── chain_plugin_tests.cpp ├── consensus-validation-malicious-producers.py ├── core_symbol.py ├── core_symbol.py.in ├── distributed-transactions-remote-test.py ├── distributed-transactions-test.py ├── get_table_tests.cpp ├── impaired_network.py ├── launcher_test.py ├── lossy_network.py ├── main.cpp ├── nodeos_forked_chain_test.py ├── nodeos_run_remote_test.py ├── nodeos_run_test.py ├── nodeos_under_min_avail_ram.py ├── nodeos_voting_test.py ├── p2p_network_test.py ├── p2p_stress.py ├── p2p_test_peers.py ├── p2p_tests │ └── dawn_515 │ │ └── test.sh ├── restart-scenarios-test.py ├── sample-cluster-map.json ├── testUtils.py ├── trans_sync_across_mixed_cluster_test.sh ├── validate-dirty-db.py ├── version-label.sh └── wallet_tests.cpp ├── tools ├── CMakeLists.txt ├── ctestwrapper.sh ├── llvm-gcov.sh ├── mas_sign.sh └── validate_reflection.py ├── tutorials ├── bios-boot-tutorial │ ├── .gitignore │ ├── README.md │ ├── accounts.json │ ├── bios-boot-tutorial.py │ └── genesis.json └── exchange-tutorial-python │ ├── README.md │ └── exchange_tutorial.py └── unittests ├── CMakeLists.txt ├── abi_tests.cpp ├── actiondemo ├── actiondemo.abi ├── actiondemo.cpp ├── actiondemo.hpp └── test.py ├── api_tests.cpp ├── auth_tests.cpp ├── block_tests.cpp ├── block_timestamp_tests.cpp ├── bootseq_tests.cpp ├── contracts.hpp.in ├── contracts ├── 80k_deep_loop_with_ret.wasm ├── 80k_deep_loop_with_void.wasm ├── CMakeLists.txt ├── big_allocation.wasm ├── crash_section_size_too_big.wasm ├── deep_loops_ext_report.wasm ├── deep_nested.abi.hpp ├── eosio.bios │ ├── eosio.bios.abi │ └── eosio.bios.wasm ├── eosio.msig │ ├── eosio.msig.abi │ └── eosio.msig.wasm ├── eosio.system │ ├── eosio.system.abi │ └── eosio.system.wasm ├── eosio.token │ ├── eosio.token.abi │ └── eosio.token.wasm ├── eosio.wrap │ ├── eosio.wrap.abi │ └── eosio.wrap.wasm ├── fuzz1.wasm ├── fuzz10.wasm ├── fuzz11.wasm ├── fuzz12.wasm ├── fuzz13.wasm ├── fuzz14.wasm ├── fuzz15.wasm ├── fuzz2.wasm ├── fuzz3.wasm ├── fuzz4.wasm ├── fuzz5.wasm ├── fuzz6.wasm ├── fuzz7.wasm ├── fuzz8.wasm ├── fuzz9.wasm ├── getcode_deepindent.wasm ├── indent-mismatch.wasm ├── large_nested.abi.hpp ├── leak_no_destructor.wasm ├── leak_readExports.wasm ├── leak_readFunctions.wasm ├── leak_readFunctions_2.wasm ├── leak_readFunctions_3.wasm ├── leak_readGlobals.wasm ├── leak_readImports.wasm ├── leak_wasm_binary_cpp_L1249.wasm ├── locals-s.wasm ├── locals-yc.wasm ├── readFunctions_slowness_out_of_memory.wasm ├── slowwasm_localsets.wasm ├── test_softfloat_wasts.hpp └── test_wasts.hpp ├── currency_tests.cpp ├── database_gmr_blklst_tests.cpp ├── database_tests.cpp ├── delay_tests.cpp ├── eosio.token_tests.cpp ├── eosio_system_tester.hpp ├── forked_tests.cpp ├── fuzz13.wasm ├── gmr_test.cpp ├── incbin.h ├── include └── config.hpp.in ├── main.cpp ├── message_buffer_tests.cpp ├── misc_tests.cpp ├── payloadless_tests.cpp ├── pbft_tests.cpp ├── producer_schedule_tests.cpp ├── ram_tests.cpp ├── resource_limits_test.cpp ├── snapshot_tests.cpp ├── special_accounts_tests.cpp ├── test-contracts ├── CMakeLists.txt ├── README.md ├── asserter │ ├── CMakeLists.txt │ ├── asserter.abi │ ├── asserter.cpp │ ├── asserter.hpp │ └── asserter.wasm ├── deferred_test │ ├── CMakeLists.txt │ ├── deferred_test.abi │ ├── deferred_test.cpp │ ├── deferred_test.hpp │ └── deferred_test.wasm ├── get_sender_test │ ├── CMakeLists.txt │ ├── get_sender_test.abi │ ├── get_sender_test.cpp │ ├── get_sender_test.hpp │ └── get_sender_test.wasm ├── get_table_test │ ├── CMakeLists.txt │ ├── get_table_test.abi │ ├── get_table_test.cpp │ ├── get_table_test.hpp │ └── get_table_test.wasm ├── integration_test │ ├── CMakeLists.txt │ ├── integration_test.abi │ ├── integration_test.cpp │ ├── integration_test.hpp │ └── integration_test.wasm ├── noop │ ├── CMakeLists.txt │ ├── noop.abi │ ├── noop.cpp │ ├── noop.hpp │ └── noop.wasm ├── payloadless │ ├── CMakeLists.txt │ ├── payloadless.abi │ ├── payloadless.cpp │ ├── payloadless.hpp │ └── payloadless.wasm ├── proxy │ ├── CMakeLists.txt │ ├── proxy.abi │ ├── proxy.cpp │ ├── proxy.hpp │ └── proxy.wasm ├── ram_restrictions_test │ ├── CMakeLists.txt │ ├── ram_restrictions_test.abi │ ├── ram_restrictions_test.cpp │ ├── ram_restrictions_test.hpp │ └── ram_restrictions_test.wasm ├── reject_all │ ├── CMakeLists.txt │ ├── reject_all.cpp │ └── reject_all.wasm ├── restrict_action_test │ ├── CMakeLists.txt │ ├── restrict_action_test.abi │ ├── restrict_action_test.cpp │ ├── restrict_action_test.hpp │ └── restrict_action_test.wasm ├── snapshot_test │ ├── CMakeLists.txt │ ├── snapshot_test.abi │ ├── snapshot_test.cpp │ ├── snapshot_test.hpp │ └── snapshot_test.wasm ├── test_api │ ├── CMakeLists.txt │ ├── test_action.cpp │ ├── test_api.cpp │ ├── test_api.hpp │ ├── test_api.wasm │ ├── test_api_common.hpp │ ├── test_chain.cpp │ ├── test_checktime.cpp │ ├── test_crypto.cpp │ ├── test_datastream.cpp │ ├── test_permission.cpp │ ├── test_print.cpp │ ├── test_transaction.cpp │ └── test_types.cpp ├── test_api_db │ ├── CMakeLists.txt │ ├── test_api_db.abi │ ├── test_api_db.cpp │ ├── test_api_db.hpp │ └── test_api_db.wasm ├── test_api_multi_index │ ├── CMakeLists.txt │ ├── test_api_multi_index.abi │ ├── test_api_multi_index.cpp │ ├── test_api_multi_index.hpp │ └── test_api_multi_index.wasm └── test_ram_limit │ ├── CMakeLists.txt │ ├── test_ram_limit.abi │ ├── test_ram_limit.cpp │ └── test_ram_limit.wasm ├── wasm_tests.cpp └── whitelist_blacklist_tests.cpp /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## Change Description 5 | 6 | 7 | 8 | ## Consensus Changes 9 | 10 | 11 | 12 | 13 | ## API Changes 14 | 15 | 16 | 17 | 18 | ## Documentation Additions 19 | 20 | 21 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | image: docker:latest 2 | 3 | build: 4 | script: 5 | - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY 6 | - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -f Docker/Dockerfile . 7 | - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libraries/chainbase"] 2 | path = libraries/chainbase 3 | url = https://github.com/boscore/chainbase 4 | ignore = dirty 5 | [submodule "libraries/appbase"] 6 | path = libraries/appbase 7 | url = https://github.com/eosio/appbase 8 | ignore = dirty 9 | [submodule "contracts/musl/upstream"] 10 | path = contracts/musl/upstream 11 | url = https://github.com/EOSIO/musl.git 12 | branch = eosio 13 | [submodule "contracts/libc++/upstream"] 14 | path = contracts/libc++/upstream 15 | url = https://github.com/EOSIO/libcxx.git 16 | branch = eosio 17 | [submodule "externals/binaryen"] 18 | path = externals/binaryen 19 | url = https://github.com/EOSIO/binaryen 20 | 21 | [submodule "libraries/softfloat"] 22 | path = libraries/softfloat 23 | url = https://github.com/eosio/berkeley-softfloat-3 24 | [submodule "externals/magic_get"] 25 | path = externals/magic_get 26 | url = https://github.com/EOSIO/magic_get 27 | [submodule "libraries/fc"] 28 | path = libraries/fc 29 | url = https://github.com/EOSIO/fc 30 | [submodule "libraries/wabt"] 31 | path = libraries/wabt 32 | url = https://github.com/EOSIO/wabt 33 | [submodule "libraries/eos-vm"] 34 | path = libraries/eos-vm 35 | url = https://github.com/eosio/eos-vm 36 | -------------------------------------------------------------------------------- /CMakeModules/CMakeASM-LLVMWARInformation.cmake: -------------------------------------------------------------------------------- 1 | # These trio of files implement a workaround for LLVM bug 39427 2 | 3 | set(ASM_DIALECT "-LLVMWAR") 4 | set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS llvmwar) 5 | 6 | set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "g++ -x c++ -O3 --std=c++11 -c -o ") 7 | 8 | include(CMakeASMInformation) 9 | set(ASM_DIALECT) 10 | -------------------------------------------------------------------------------- /CMakeModules/CMakeDetermineASM-LLVMWARCompiler.cmake: -------------------------------------------------------------------------------- 1 | # These trio of files implement a workaround for LLVM bug 39427 2 | 3 | set(ASM_DIALECT "-LLVMWAR") 4 | set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "g++") 5 | include(CMakeDetermineASMCompiler) 6 | set(ASM_DIALECT) 7 | -------------------------------------------------------------------------------- /CMakeModules/CMakeTestASM-LLVMWARCompiler.cmake: -------------------------------------------------------------------------------- 1 | # These trio of files implement a workaround for LLVM bug 39427 2 | 3 | set(ASM_DIALECT "-LLVMWAR") 4 | include(CMakeTestASMCompiler) 5 | set(ASM_DIALECT) 6 | -------------------------------------------------------------------------------- /CMakeModules/FindCppkafka.cmake: -------------------------------------------------------------------------------- 1 | # Override default CMAKE_FIND_LIBRARY_SUFFIXES 2 | if (CPPKAFKA_SHARED_LIB) 3 | set(CPPKAFKA_SUFFIX so) 4 | else() 5 | set(CPPKAFKA_SUFFIX a) 6 | endif() 7 | message(STATUS "Cppkafka finding .${CPPKAFKA_SUFFIX} library") 8 | 9 | FIND_PATH( 10 | CPPKAFKA_INCLUDE_DIR cppkafka.h 11 | PATH "/usr/local" 12 | PATH_SUFFIXES "" "cppkafka") 13 | MARK_AS_ADVANCED(CPPKAFKA_INCLUDE_DIR) 14 | 15 | SET(CPPKAFKA_INCLUDE_DIR ${CPPKAFKA_INCLUDE_DIR}) 16 | 17 | FIND_LIBRARY( 18 | CPPKAFKA_LIBRARY 19 | NAMES cppkafka.${CPPKAFKA_SUFFIX} libcppkafka.${CPPKAFKA_SUFFIX} 20 | HINTS ${CPPKAFKA_INCLUDE_DIR}/.. 21 | PATH_SUFFIXES lib${LIB_SUFFIX}) 22 | MARK_AS_ADVANCED(CPPKAFKA_LIBRARY) 23 | 24 | SET(CPPKAFKA_LIBRARY ${CPPKAFKA_LIBRARY}) 25 | message(STATUS "Cppkafka found ${CPPKAFKA_LIBRARY}") 26 | 27 | include(FindPackageHandleStandardArgs) 28 | SET(_CPPKAFKA_REQUIRED_VARS CPPKAFKA_INCLUDE_DIR CPPKAFKA_LIBRARY) 29 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cppkafka DEFAULT_MSG ${_CPPKAFKA_REQUIRED_VARS}) 30 | -------------------------------------------------------------------------------- /CMakeModules/FindWasm.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find WASM 2 | 3 | # TODO: Check if compiler is able to generate wasm32 4 | if ("${WASM_ROOT}" STREQUAL "") 5 | if (APPLE) 6 | set( WASM_ROOT "/usr/local/wasm" ) 7 | elseif (UNIX AND NOT APPLE) 8 | set( WASM_ROOT "$ENV{HOME}/opt/wasm" ) 9 | else() 10 | message(FATAL_ERROR "WASM not found and don't know where to look, please specify WASM_ROOT") 11 | endif() 12 | endif() 13 | find_program(WASM_CLANG clang PATHS ${WASM_ROOT}/bin NO_DEFAULT_PATH) 14 | find_program(WASM_LLC llc PATHS ${WASM_ROOT}/bin NO_DEFAULT_PATH) 15 | find_program(WASM_LLVM_LINK llvm-link PATHS ${WASM_ROOT}/bin NO_DEFAULT_PATH) 16 | 17 | include(FindPackageHandleStandardArgs) 18 | # handle the QUIETLY and REQUIRED arguments and set EOS_FOUND to TRUE 19 | # if all listed variables are TRUE 20 | 21 | find_package_handle_standard_args(WASM REQUIRED_VARS WASM_CLANG WASM_LLC WASM_LLVM_LINK) 22 | 23 | -------------------------------------------------------------------------------- /CMakeModules/InstallDirectoryPermissions.cmake: -------------------------------------------------------------------------------- 1 | # Fix directory permissions after installation of header files (primarily). 2 | macro(install_directory_permissions) 3 | cmake_parse_arguments(ARG "" "DIRECTORY" "" ${ARGN}) 4 | set(dir ${ARG_DIRECTORY}) 5 | install(DIRECTORY DESTINATION ${dir} 6 | DIRECTORY_PERMISSIONS OWNER_READ 7 | OWNER_WRITE 8 | OWNER_EXECUTE 9 | GROUP_READ 10 | GROUP_EXECUTE 11 | WORLD_READ 12 | WORLD_EXECUTE 13 | ) 14 | endmacro(install_directory_permissions) 15 | -------------------------------------------------------------------------------- /CMakeModules/MASSigning.cmake: -------------------------------------------------------------------------------- 1 | macro(mas_sign target) 2 | 3 | #example values: 4 | # MAS_CERT_FINGERPRINT=C5139C2C4D7FA071EFBFD86CE44B652631C9376A 5 | # MAS_BASE_APPID=5A4683969Z.com.example. < ${MAS_PROVISIONING_PROFILE} ${MAS_KEYCHAIN_GROUP} $ 16 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 17 | VERBATIM 18 | ) 19 | 20 | endif() 21 | 22 | endmacro(mas_sign) -------------------------------------------------------------------------------- /CMakeModules/additionalPlugins.cmake: -------------------------------------------------------------------------------- 1 | macro(eosio_additional_plugin) 2 | set(ADDITIONAL_PLUGINS_TARGET "${ADDITIONAL_PLUGINS_TARGET};${ARGN}" PARENT_SCOPE) 3 | endmacro() 4 | 5 | foreach(ADDITIONAL_PLUGIN_SOURCE_DIR ${EOSIO_ADDITIONAL_PLUGINS}) 6 | string(UUID ADDITIONAL_PLUGIN_SOURCE_DIR_MD5 NAMESPACE "00000000-0000-0000-0000-000000000000" NAME ${ADDITIONAL_PLUGIN_SOURCE_DIR} TYPE MD5) 7 | message(STATUS "[Additional Plugin] ${ADDITIONAL_PLUGIN_SOURCE_DIR} => ${CMAKE_BINARY_DIR}/additional_plugins/${ADDITIONAL_PLUGIN_SOURCE_DIR_MD5}") 8 | add_subdirectory(${ADDITIONAL_PLUGIN_SOURCE_DIR} ${CMAKE_BINARY_DIR}/additional_plugins/${ADDITIONAL_PLUGIN_SOURCE_DIR_MD5}) 9 | endforeach() 10 | 11 | foreach(ADDITIONAL_PLUGIN_TARGET ${ADDITIONAL_PLUGINS_TARGET}) 12 | target_link_libraries( nodeos PRIVATE -Wl,${whole_archive_flag} ${ADDITIONAL_PLUGIN_TARGET} -Wl,${no_whole_archive_flag} ) 13 | endforeach() 14 | -------------------------------------------------------------------------------- /CMakeModules/doxygen.cmake: -------------------------------------------------------------------------------- 1 | configure_file("eos.doxygen.in" "${CMAKE_BINARY_DIR}/eos.doxygen") 2 | 3 | include(FindDoxygen) 4 | 5 | if(NOT DOXYGEN_FOUND) 6 | message(STATUS "Doxygen not found. Contract documentation will not be generated.") 7 | else() 8 | set(DOXY_EOS_VERSION "${VERSION_FULL}" CACHE INTERNAL "Version string used in PROJECT_NUMBER.") 9 | # CMake strips trailing path separators off of variables it knows are paths, 10 | # so the trailing '/' Doxygen expects is embedded in the doxyfile. 11 | set(DOXY_DOC_DEST_DIR "${CMAKE_BINARY_DIR}/docs" CACHE PATH "Path to the doxygen output") 12 | set(DOXY_DOC_INPUT_ROOT_DIR "contracts" CACHE PATH "Path to the doxygen input") 13 | if(DOXYGEN_DOT_FOUND) 14 | set(DOXY_HAVE_DOT "YES" CACHE STRING "Doxygen to use dot for diagrams.") 15 | else(DOXYGEN_DOT_FOUND) 16 | set(DOXY_HAVE_DOT "NO" CACHE STRING "Doxygen to use dot for diagrams.") 17 | endif(DOXYGEN_DOT_FOUND) 18 | if(BUILD_DOXYGEN) 19 | message(STATUS "Doxygen found. Contract documentation will be generated.") 20 | # Doxygen has issues making destination directories more than one level deep, so do it for it. 21 | add_custom_target(make_doc_dir ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${DOXY_DOC_DEST_DIR}") 22 | add_custom_target(contract_documentation ALL 23 | COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/eos.doxygen" 24 | DEPENDS make_doc_dir 25 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" 26 | COMMENT "Building doxygen documentation into ${DOXY_DOC_DEST_DIR}..." 27 | VERBATIM) 28 | endif(BUILD_DOXYGEN) 29 | endif() 30 | -------------------------------------------------------------------------------- /CMakeModules/package.cmake: -------------------------------------------------------------------------------- 1 | set(VENDOR "BOS Core") 2 | set(PROJECT_NAME "bos") 3 | set(DESC "Software for the BOS network") 4 | set(URL "https://github.com/boscore/bos") 5 | set(EMAIL "support@boscore.io") 6 | 7 | configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_package.sh.in ${CMAKE_BINARY_DIR}/packages/generate_package.sh @ONLY) 8 | configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_bottle.sh ${CMAKE_BINARY_DIR}/packages/generate_bottle.sh COPYONLY) 9 | configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_deb.sh ${CMAKE_BINARY_DIR}/packages/generate_deb.sh COPYONLY) 10 | configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_rpm.sh ${CMAKE_BINARY_DIR}/packages/generate_rpm.sh COPYONLY) 11 | configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_tarball.sh ${CMAKE_BINARY_DIR}/packages/generate_tarball.sh COPYONLY) 12 | -------------------------------------------------------------------------------- /CMakeModules/utils.cmake: -------------------------------------------------------------------------------- 1 | macro( copy_bin file ) 2 | add_custom_command( TARGET ${file} POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin ) 3 | add_custom_command( TARGET ${file} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${file} ${CMAKE_BINARY_DIR}/bin/ ) 4 | endmacro( copy_bin ) 5 | -------------------------------------------------------------------------------- /Docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM boscore/builder:v2.0.6 as builder 2 | ARG branch=master 3 | ARG symbol=EOS 4 | 5 | ENV OPENSSL_ROOT_DIR /usr/include/openssl 6 | 7 | RUN git clone -b $branch https://github.com/boscore/bos.git --recursive \ 8 | && cd bos && echo "$branch:$(git rev-parse HEAD)" > /etc/boscore-version \ 9 | && cmake -H. -B"/tmp/build" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \ 10 | -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DBUILD_MONGO_DB_PLUGIN=true -DCORE_SYMBOL_NAME=$symbol \ 11 | -DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DCMAKE_CXX_STANDARD_LIBRARIES="-lpthread" -DENABLE_TOOLS=OFF \ 12 | && cmake --build /tmp/build --target install 13 | 14 | FROM ubuntu:18.04 15 | 16 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl ca-certificates iproute2 && rm -rf /var/lib/apt/lists/* 17 | COPY --from=builder /usr/local/lib/* /usr/local/lib/ 18 | COPY --from=builder /tmp/build/bin /opt/eosio/bin 19 | COPY --from=builder /bos/Docker/config.ini / 20 | COPY --from=builder /etc/boscore-version /etc 21 | COPY --from=builder /bos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh 22 | ENV EOSIO_ROOT=/opt/eosio 23 | RUN chmod +x /opt/eosio/bin/nodeosd.sh 24 | ENV LD_LIBRARY_PATH /usr/local/lib 25 | ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -------------------------------------------------------------------------------- /Docker/cleos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Usage: 4 | # Go into cmd loop: sudo ./cleos.sh 5 | # Run single cmd: sudo ./cleos.sh 6 | 7 | PREFIX="docker-compose exec nodeosd cleos" 8 | if [ -z $1 ] ; then 9 | while : 10 | do 11 | read -e -p "cleos " cmd 12 | history -s "$cmd" 13 | $PREFIX $cmd 14 | done 15 | else 16 | $PREFIX "$@" 17 | fi 18 | -------------------------------------------------------------------------------- /Docker/dev/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM boscore/builder 2 | ARG branch=master 3 | ARG symbol=SYS 4 | 5 | RUN git clone -b $branch https://github.com/boscore/bos.git --recursive \ 6 | && cd eos && echo "$branch:$(git rev-parse HEAD)" > /etc/eosio-version \ 7 | && cmake -H. -B"/opt/eosio" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \ 8 | -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eosio -DBUILD_MONGO_DB_PLUGIN=true -DCORE_SYMBOL_NAME=$symbol \ 9 | && cmake --build /opt/eosio --target install \ 10 | && cp /eos/Docker/config.ini / && ln -s /opt/eosio/contracts /contracts && cp /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh && ln -s /eos/tutorials /tutorials 11 | 12 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl ca-certificates vim psmisc python3-pip && rm -rf /var/lib/apt/lists/* 13 | RUN pip3 install numpy 14 | ENV EOSIO_ROOT=/opt/eosio 15 | RUN chmod +x /opt/eosio/bin/nodeosd.sh 16 | ENV LD_LIBRARY_PATH /usr/local/lib 17 | ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 18 | -------------------------------------------------------------------------------- /Docker/docker-compose-latest.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | nodeosd: 5 | image: eosio/eos:latest 6 | command: /opt/eosio/bin/nodeosd.sh --data-dir /opt/eosio/bin/data-dir -e --http-alias=nodeosd:8888 --http-alias=127.0.0.1:8888 --http-alias=localhost:8888 7 | hostname: nodeosd 8 | ports: 9 | - 8888:8888 10 | - 9876:9876 11 | expose: 12 | - "8888" 13 | volumes: 14 | - nodeos-data-volume:/opt/eosio/bin/data-dir 15 | cap_add: 16 | - IPC_LOCK 17 | stop_grace_period: 10m 18 | 19 | keosd: 20 | image: eosio/eos:latest 21 | command: /opt/eosio/bin/keosd --wallet-dir /opt/eosio/bin/data-dir --http-server-address=127.0.0.1:8900 --http-alias=keosd:8900 --http-alias=localhost:8900 22 | hostname: keosd 23 | links: 24 | - nodeosd 25 | volumes: 26 | - keosd-data-volume:/opt/eosio/bin/data-dir 27 | stop_grace_period: 10m 28 | 29 | volumes: 30 | nodeos-data-volume: 31 | external: true 32 | keosd-data-volume: 33 | external: true 34 | -------------------------------------------------------------------------------- /Docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | builder: 5 | build: 6 | context: builder 7 | image: eosio/builder 8 | 9 | nodeosd: 10 | build: 11 | context: . 12 | image: eosio/eos 13 | command: /opt/eosio/bin/nodeosd.sh --data-dir /opt/eosio/bin/data-dir -e --http-alias=nodeosd:8888 --http-alias=127.0.0.1:8888 --http-alias=localhost:8888 14 | hostname: nodeosd 15 | ports: 16 | - 8888:8888 17 | - 9876:9876 18 | expose: 19 | - "8888" 20 | volumes: 21 | - nodeos-data-volume:/opt/eosio/bin/data-dir 22 | cap_add: 23 | - IPC_LOCK 24 | stop_grace_period: 10m 25 | 26 | keosd: 27 | image: eosio/eos 28 | command: /opt/eosio/bin/keosd --wallet-dir /opt/eosio/bin/data-dir --http-server-address=127.0.0.1:8900 --http-alias=keosd:8900 --http-alias=localhost:8900 29 | hostname: keosd 30 | links: 31 | - nodeosd 32 | volumes: 33 | - keosd-data-volume:/opt/eosio/bin/data-dir 34 | stop_grace_period: 10m 35 | 36 | volumes: 37 | nodeos-data-volume: 38 | external: true 39 | keosd-data-volume: 40 | external: true 41 | -------------------------------------------------------------------------------- /Docker/nodeosd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /opt/eosio/bin 3 | 4 | if [ ! -d "/opt/eosio/bin/data-dir" ]; then 5 | mkdir /opt/eosio/bin/data-dir 6 | fi 7 | 8 | if [ -f '/opt/eosio/bin/data-dir/config.ini' ]; then 9 | echo 10 | else 11 | cp /config.ini /opt/eosio/bin/data-dir 12 | fi 13 | 14 | while :; do 15 | case $1 in 16 | --config-dir=?*) 17 | CONFIG_DIR=${1#*=} 18 | ;; 19 | *) 20 | break 21 | esac 22 | shift 23 | done 24 | 25 | if [ ! "$CONFIG_DIR" ]; then 26 | CONFIG_DIR="--config-dir=/opt/eosio/bin/data-dir" 27 | else 28 | CONFIG_DIR="" 29 | fi 30 | 31 | exec /opt/eosio/bin/nodeos $CONFIG_DIR "$@" 32 | -------------------------------------------------------------------------------- /HEADER: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Respective Authors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, Respective Authors all rights reserved. 2 | 3 | The MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /debian/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst" PARENT_SCOPE) 2 | -------------------------------------------------------------------------------- /eosio.version.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /// VERSION @VERSION_FULL@ 4 | namespace eosio { 5 | enum version { 6 | MAJOR @VERSION_MAJOR@, 7 | MINOR @VERSION_MINOR@, 8 | PATCH @VERSION_PATCH@ 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /eosio_uninstall.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | binaries=(cleos 4 | eosio-abigen 5 | eosio-launcher 6 | eosio-s2wasm 7 | eosio-wast2wasm 8 | eosiocpp 9 | keosd 10 | nodeos 11 | eosio-applesdemo) 12 | 13 | if [ -d "/usr/local/eosio" ]; then 14 | printf "\tDo you wish to remove this install? (requires sudo)\n" 15 | select yn in "Yes" "No"; do 16 | case $yn in 17 | [Yy]* ) 18 | if [ "$(id -u)" -ne 0 ]; then 19 | printf "\n\tThis requires sudo, please run ./eosio_uninstall.sh with sudo\n\n" 20 | exit -1 21 | fi 22 | 23 | pushd /usr/local &> /dev/null 24 | rm -rf eosio 25 | pushd bin &> /dev/null 26 | for binary in ${binaries[@]}; do 27 | rm ${binary} 28 | done 29 | # Handle cleanup of directories created from installation 30 | if [ "$1" == "--full" ]; then 31 | if [ -d ~/Library/Application\ Support/eosio ]; then rm -rf ~/Library/Application\ Support/eosio; fi # Mac OS 32 | if [ -d ~/.local/share/eosio ]; then rm -rf ~/.local/share/eosio; fi # Linux 33 | fi 34 | popd &> /dev/null 35 | break;; 36 | [Nn]* ) 37 | printf "\tAborting uninstall\n\n" 38 | exit -1;; 39 | esac 40 | done 41 | fi 42 | -------------------------------------------------------------------------------- /externals/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( binaryen ) 2 | -------------------------------------------------------------------------------- /images/bos-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/images/bos-workflow.png -------------------------------------------------------------------------------- /images/eos-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/images/eos-logo.png -------------------------------------------------------------------------------- /images/mesh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/images/mesh.png -------------------------------------------------------------------------------- /images/ring.dot: -------------------------------------------------------------------------------- 1 | digraph G 2 | { 3 | inita->initb [dir="both"] 4 | initb->initc [dir="both"] 5 | initc->initd [dir="both"] 6 | initd->inite [dir="both"] 7 | inite->initf [dir="both"] 8 | initf->initg [dir="both"] 9 | initg->inith [dir="both"] 10 | inith->initi [dir="both"] 11 | initi->initj [dir="both"] 12 | initj->initk [dir="both"] 13 | initk->inita [dir="both"] 14 | } 15 | -------------------------------------------------------------------------------- /images/ring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/images/ring.png -------------------------------------------------------------------------------- /images/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/images/star.png -------------------------------------------------------------------------------- /images/testnet-diagrams.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | circo ring.dot -Tpng -oring.png 4 | circo star.dot -Tpng -ostar.png 5 | fdp mesh.dot -Tpng -omesh.png 6 | -------------------------------------------------------------------------------- /libraries/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( fc ) 2 | add_subdirectory( builtins ) 3 | add_subdirectory( softfloat ) 4 | add_subdirectory( chainbase ) 5 | add_subdirectory( wasm-jit ) 6 | add_subdirectory( appbase ) 7 | add_subdirectory( chain ) 8 | add_subdirectory( testing ) 9 | 10 | #turn tools&tests off; not needed for library build 11 | set(BUILD_TESTS OFF CACHE BOOL "Build GTest-based tests") 12 | set(BUILD_TOOLS OFF CACHE BOOL "Build wabt tools") 13 | set(RUN_RE2C OFF CACHE BOOL "Run re2c") 14 | set(WITH_EXCEPTIONS ON CACHE BOOL "Build with exceptions enabled" FORCE) 15 | add_subdirectory( wabt ) 16 | if(eos-vm IN_LIST EOSIO_WASM_RUNTIMES OR eos-vm-jit IN_LIST EOSIO_WASM_RUNTIMES) 17 | add_subdirectory( eos-vm ) 18 | endif() -------------------------------------------------------------------------------- /libraries/builtins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Defines builtins library 2 | project (builtins C) 3 | 4 | # generate compile command database for external tools 5 | set (CMAKE_EXPORT_COMPILE_COMMANDS "ON") 6 | 7 | message ( STATUS "Configuring Builtins" ) 8 | set(C_DEFINES, "-D__wasm__ -DQUAD_PRECISION") 9 | set( CMAKE_C_FLAGS " -Wall ${CMAKE_C_FLAGS} ${C_DEFINES}" ) 10 | set ( builtins_sources 11 | fixtfti.c 12 | fixunstfti.c 13 | fixsfti.c 14 | fixdfti.c 15 | fixunssfti.c 16 | fixunsdfti.c 17 | floattidf.c 18 | floatuntidf.c 19 | ) 20 | 21 | file ( GLOB builtins_headers "${CMAKE_CURRENT_SOURCE_DIR}*.h" ) 22 | list( APPEND builtins_sources ${builtins_headers} ) 23 | add_library ( builtins STATIC ${builtins_sources} ) 24 | target_include_directories( builtins PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" 25 | "${CMAKE_CURRENT_SOURCE_DIR}../softfloat/source/include" ) 26 | 27 | install ( TARGETS 28 | builtins 29 | 30 | RUNTIME DESTINATION bin 31 | LIBRARY DESTINATION lib 32 | ARCHIVE DESTINATION lib 33 | ) 34 | -------------------------------------------------------------------------------- /libraries/builtins/compiler_builtins.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | __int128 ___fixdfti(uint64_t); 7 | __int128 ___fixsfti(uint32_t); 8 | __int128 ___fixtfti( float128_t); 9 | unsigned __int128 ___fixunsdfti(uint64_t); 10 | unsigned __int128 ___fixunssfti(uint32_t); 11 | unsigned __int128 ___fixunstfti(float128_t); 12 | double ___floattidf(__int128); 13 | double ___floatuntidf(unsigned __int128); 14 | } 15 | -------------------------------------------------------------------------------- /libraries/builtins/fixtfti.c: -------------------------------------------------------------------------------- 1 | /* ===-- fixtfti.c - Implement __fixtfti -----------------------------------=== 2 | * 3 | * The LLVM Compiler Infrastructure 4 | * 5 | * This file is dual licensed under the MIT and the University of Illinois Open 6 | * Source Licenses. See LICENSE.TXT for details. 7 | * 8 | * ===----------------------------------------------------------------------=== 9 | */ 10 | 11 | #include "fp128.h" 12 | 13 | __int128 ___fixtfti( float128_t a) { 14 | const __int128 fixint_max = (__int128)((~(unsigned __int128)0) / 2); 15 | const __int128 fixint_min = -fixint_max - 1; 16 | // Break a into sign, exponent, significand 17 | const __int128 aRep = toRep(a); 18 | const __int128 aAbs = aRep & absMask; 19 | const __int128 sign = aRep & signBit ? -1 : 1; 20 | const int exponent = (aAbs >> significandBits) - exponentBias; 21 | const __int128 significand = (aAbs & significandMask) | implicitBit; 22 | 23 | // If exponent is negative, the result is zero. 24 | if (exponent < 0) 25 | return 0; 26 | 27 | // If the value is too large for the integer type, saturate. 28 | if ((unsigned)exponent >= sizeof(__int128) * CHAR_BIT) 29 | return sign == 1 ? fixint_max : fixint_min; 30 | 31 | // If 0 <= exponent < significandBits, right shift to get the result. 32 | // Otherwise, shift left. 33 | if (exponent < significandBits) 34 | return sign * (significand >> (significandBits - exponent)); 35 | else 36 | return sign * ((__int128)significand << (exponent - significandBits)); 37 | } 38 | -------------------------------------------------------------------------------- /libraries/builtins/fixunsdfti.c: -------------------------------------------------------------------------------- 1 | /* ===-- fixunsdfti.c - Implement __fixunsdfti -----------------------------=== 2 | * 3 | * The LLVM Compiler Infrastructure 4 | * 5 | * This file is dual licensed under the MIT and the University of Illinois Open 6 | * Source Licenses. See LICENSE.TXT for details. 7 | * 8 | * ===----------------------------------------------------------------------=== 9 | */ 10 | 11 | #include "fp64.h" 12 | 13 | typedef unsigned __int128 fixuint_t; 14 | 15 | fixuint_t ___fixunsdfti(uint64_t a) { 16 | // Break a into sign, exponent, significand 17 | const rep_t aRep = a; 18 | const rep_t aAbs = aRep & absMask; 19 | const int sign = aRep & signBit ? -1 : 1; 20 | const int exponent = (aAbs >> significandBits) - exponentBias; 21 | const rep_t significand = (aAbs & significandMask) | implicitBit; 22 | 23 | // If either the value or the exponent is negative, the result is zero. 24 | if (sign == -1 || exponent < 0) 25 | return 0; 26 | 27 | // If the value is too large for the integer type, saturate. 28 | if ((unsigned)exponent >= sizeof(fixuint_t) * CHAR_BIT) 29 | return ~(fixuint_t)0; 30 | 31 | // If 0 <= exponent < significandBits, right shift to get the result. 32 | // Otherwise, shift left. 33 | if (exponent < significandBits) 34 | return significand >> (significandBits - exponent); 35 | else 36 | return (fixuint_t)significand << (exponent - significandBits); 37 | } 38 | -------------------------------------------------------------------------------- /libraries/builtins/fixunstfti.c: -------------------------------------------------------------------------------- 1 | /* ===-- fixunstfsi.c - Implement __fixunstfsi -----------------------------=== 2 | * 3 | * The LLVM Compiler Infrastructure 4 | * 5 | * This file is dual licensed under the MIT and the University of Illinois Open 6 | * Source Licenses. See LICENSE.TXT for details. 7 | * 8 | * ===----------------------------------------------------------------------=== 9 | */ 10 | 11 | #include "fp128.h" 12 | 13 | typedef float128_t fp_t; 14 | typedef unsigned __int128 fixuint_t; 15 | typedef unsigned __int128 tu_int; 16 | typedef __int128 rep_t; 17 | 18 | tu_int ___fixunstfti(fp_t a) { 19 | // Break a into sign, exponent, significand 20 | const rep_t aRep = toRep(a); 21 | const rep_t aAbs = aRep & absMask; 22 | const int sign = aRep & signBit ? -1 : 1; 23 | const int exponent = (aAbs >> significandBits) - exponentBias; 24 | const rep_t significand = (aAbs & significandMask) | implicitBit; 25 | 26 | // If either the value or the exponent is negative, the result is zero. 27 | if (sign == -1 || exponent < 0) 28 | return 0; 29 | 30 | // If the value is too large for the integer type, saturate. 31 | if ((unsigned)exponent >= sizeof(fixuint_t) * CHAR_BIT) 32 | return ~(fixuint_t)0; 33 | 34 | // If 0 <= exponent < significandBits, right shift to get the result. 35 | // Otherwise, shift left. 36 | if (exponent < significandBits) 37 | return significand >> (significandBits - exponent); 38 | else 39 | return (fixuint_t)significand << (exponent - significandBits); 40 | } 41 | -------------------------------------------------------------------------------- /libraries/builtins/fp128.h: -------------------------------------------------------------------------------- 1 | #ifndef __compiler_rt_fp_128_h__ 2 | #define __compiler_rt_fp_128_h__ 3 | 4 | #include 5 | #include 6 | #include "../softfloat/source/include/softfloat.h" 7 | 8 | #define REP_C (__uint128_t) 9 | #define significandBits 112 10 | #define typeWidth (sizeof(__int128)*CHAR_BIT) 11 | #define exponentBits (typeWidth - significandBits - 1) 12 | #define maxExponent ((1 << exponentBits) - 1) 13 | #define exponentBias (maxExponent >> 1) 14 | 15 | #define implicitBit (REP_C(1) << significandBits) 16 | #define significandMask (implicitBit - 1U) 17 | #define signBit (REP_C(1) << (significandBits + exponentBits)) 18 | #define absMask (signBit - 1U) 19 | #define exponentMask (absMask ^ significandMask) 20 | #define oneRep ((rep_t)exponentBias << significandBits) 21 | #define infRep exponentMask 22 | #define quietBit (implicitBit >> 1) 23 | #define qnanRep (exponentMask | quietBit) 24 | 25 | static __inline __int128 toRep(float128_t x) { 26 | const union { float128_t f; __int128 i; } rep = {.f = x}; 27 | return rep.i; 28 | } 29 | 30 | #endif //__compiler_rt_fp_h__ 31 | -------------------------------------------------------------------------------- /libraries/builtins/fp32.h: -------------------------------------------------------------------------------- 1 | #ifndef __compiler_rt_fp_32_h__ 2 | #define __compiler_rt_fp_32_h__ 3 | 4 | #include 5 | #include 6 | 7 | typedef uint32_t rep_t; 8 | 9 | #define REP_C (uint32_t) 10 | #define significandBits 23 11 | #define typeWidth (sizeof(rep_t)*CHAR_BIT) 12 | #define exponentBits (typeWidth - significandBits - 1) 13 | #define maxExponent ((1 << exponentBits) - 1) 14 | #define exponentBias (maxExponent >> 1) 15 | 16 | #define implicitBit (REP_C(1) << significandBits) 17 | #define significandMask (implicitBit - 1U) 18 | #define signBit (REP_C(1) << (significandBits + exponentBits)) 19 | #define absMask (signBit - 1U) 20 | #define exponentMask (absMask ^ significandMask) 21 | #define oneRep ((rep_t)exponentBias << significandBits) 22 | #define infRep exponentMask 23 | #define quietBit (implicitBit >> 1) 24 | #define qnanRep (exponentMask | quietBit) 25 | 26 | #endif //__compiler_rt_fp_h__ 27 | -------------------------------------------------------------------------------- /libraries/builtins/fp64.h: -------------------------------------------------------------------------------- 1 | #ifndef __compiler_rt_fp_64_h__ 2 | #define __compiler_rt_fp_64_h__ 3 | 4 | #include 5 | #include 6 | 7 | typedef uint64_t rep_t; 8 | 9 | #define REP_C (uint64_t) 10 | #define significandBits 52 11 | #define typeWidth (sizeof(rep_t)*CHAR_BIT) 12 | #define exponentBits (typeWidth - significandBits - 1) 13 | #define maxExponent ((1 << exponentBits) - 1) 14 | #define exponentBias (maxExponent >> 1) 15 | 16 | #define implicitBit (REP_C(1) << significandBits) 17 | #define significandMask (implicitBit - 1U) 18 | #define signBit (REP_C(1) << (significandBits + exponentBits)) 19 | #define absMask (signBit - 1U) 20 | #define exponentMask (absMask ^ significandMask) 21 | #define oneRep ((rep_t)exponentBias << significandBits) 22 | #define infRep exponentMask 23 | #define quietBit (implicitBit >> 1) 24 | #define qnanRep (exponentMask | quietBit) 25 | 26 | #endif //__compiler_rt_fp_h__ 27 | -------------------------------------------------------------------------------- /libraries/builtins/int_t.h: -------------------------------------------------------------------------------- 1 | #ifndef __compiler_rt_int_t_h__ 2 | #define __compiler_rt_int_t_h__ 3 | #include 4 | #include 5 | 6 | typedef union 7 | { 8 | __int128 all; 9 | struct 10 | { 11 | uint64_t low; 12 | int64_t high; 13 | }s; 14 | } twords; 15 | 16 | typedef union 17 | { 18 | unsigned __int128 all; 19 | struct 20 | { 21 | uint64_t low; 22 | uint64_t high; 23 | }s; 24 | } utwords; 25 | 26 | typedef union 27 | { 28 | uint64_t all; 29 | struct 30 | { 31 | uint32_t low; 32 | uint32_t high; 33 | }s; 34 | } udwords; 35 | 36 | typedef union 37 | { 38 | udwords u; 39 | double f; 40 | } double_bits; 41 | 42 | 43 | typedef __int128 ti_int; 44 | typedef unsigned __int128 tu_int; 45 | inline __int128 __clzti2(__int128 a) 46 | { 47 | twords x; 48 | x.all = a; 49 | const int64_t f = -(x.s.high == 0); 50 | return __builtin_clzll((x.s.high & ~f) | (x.s.low & f)) + 51 | ((int32_t)f & ((int32_t)(sizeof(int64_t) * CHAR_BIT))); 52 | } 53 | 54 | #endif// __compiler_rt_int_t_h__ 55 | -------------------------------------------------------------------------------- /libraries/chain/block_header.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace eosio { namespace chain { 12 | digest_type block_header::digest()const 13 | { 14 | return digest_type::hash(*this); 15 | } 16 | 17 | uint32_t block_header::num_from_id(const block_id_type& id) 18 | { 19 | return fc::endian_reverse_u32(id._hash[0]); 20 | } 21 | 22 | block_id_type block_header::id()const 23 | { 24 | // Do not include signed_block_header attributes in id, specifically exclude producer_signature. 25 | block_id_type result = digest(); //fc::sha256::hash(*static_cast(this)); 26 | result._hash[0] &= 0xffffffff00000000; 27 | result._hash[0] += fc::endian_reverse_u32(block_num()); // store the block num in the ID, 160 bits is plenty for the hash 28 | return result; 29 | } 30 | 31 | void block_header::set_block_extensions_mroot(digest_type& mroot) 32 | { 33 | if (header_extensions.size() < 1) 34 | header_extensions.emplace_back(); 35 | 36 | header_extensions[0].first = static_cast(block_header_extensions_type::block_extensions_mroot); 37 | header_extensions[0].second.resize(mroot.data_size()); 38 | std::copy(mroot.data(), mroot.data() + mroot.data_size(), header_extensions[0].second.data()); 39 | } 40 | 41 | 42 | } } 43 | -------------------------------------------------------------------------------- /libraries/chain/block_state.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace eosio { namespace chain { 5 | 6 | block_state::block_state( const block_header_state& prev, block_timestamp_type when, bool pbft_enabled ) 7 | :block_header_state( prev.generate_next( when, pbft_enabled) ), 8 | block( std::make_shared() ) 9 | { 10 | static_cast(*block) = header; 11 | } 12 | 13 | block_state::block_state( const block_header_state& prev, signed_block_ptr b, bool skip_validate_signee, bool pbft_enabled ) 14 | :block_header_state( prev.next( *b, skip_validate_signee, pbft_enabled)), block( move(b) ) 15 | { } 16 | 17 | 18 | 19 | } } /// eosio::chain 20 | -------------------------------------------------------------------------------- /libraries/chain/chain_id_type.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | namespace eosio { namespace chain { 10 | 11 | void chain_id_type::reflector_init()const { 12 | EOS_ASSERT( *reinterpret_cast(this) != fc::sha256(), chain_id_type_exception, "chain_id_type cannot be zero" ); 13 | } 14 | 15 | } } // namespace eosio::chain 16 | 17 | namespace fc { 18 | 19 | void to_variant(const eosio::chain::chain_id_type& cid, fc::variant& v) { 20 | to_variant( static_cast(cid), v); 21 | } 22 | 23 | void from_variant(const fc::variant& v, eosio::chain::chain_id_type& cid) { 24 | from_variant( v, static_cast(cid) ); 25 | } 26 | 27 | } // fc 28 | -------------------------------------------------------------------------------- /libraries/chain/genesis_state.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | 6 | #include 7 | 8 | // these are required to serialize a genesis_state 9 | #include // required for gcc in release mode 10 | 11 | namespace eosio { namespace chain { 12 | 13 | genesis_state::genesis_state() { 14 | initial_timestamp = fc::time_point::from_iso_string( "2018-06-01T12:00:00" ); 15 | initial_key = fc::variant(eosio_root_key).as(); 16 | } 17 | 18 | chain::chain_id_type genesis_state::compute_chain_id() const { 19 | digest_type::encoder enc; 20 | fc::raw::pack( enc, *this ); 21 | return chain_id_type{enc.result()}; 22 | } 23 | 24 | } } // namespace eosio::chain 25 | -------------------------------------------------------------------------------- /libraries/chain/genesis_state_root_key.cpp.in: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | 6 | #include 7 | 8 | namespace eosio { namespace chain { 9 | 10 | const string genesis_state::eosio_root_key = "${EOSIO_ROOT_KEY}"; 11 | 12 | } } // namespace eosio::chain 13 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/action_receipt.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace eosio { namespace chain { 10 | 11 | /** 12 | * For each action dispatched this receipt is generated 13 | */ 14 | struct action_receipt { 15 | account_name receiver; 16 | digest_type act_digest; 17 | uint64_t global_sequence = 0; ///< total number of actions dispatched since genesis 18 | uint64_t recv_sequence = 0; ///< total number of actions with this receiver since genesis 19 | flat_map auth_sequence; 20 | fc::unsigned_int code_sequence = 0; ///< total number of setcodes 21 | fc::unsigned_int abi_sequence = 0; ///< total number of setabis 22 | 23 | digest_type digest()const { return digest_type::hash(*this); } 24 | }; 25 | 26 | } } /// namespace eosio::chain 27 | 28 | FC_REFLECT( eosio::chain::action_receipt, (receiver)(act_digest)(global_sequence)(recv_sequence)(auth_sequence)(code_sequence)(abi_sequence) ) 29 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/block_summary_object.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | 8 | #include "multi_index_includes.hpp" 9 | 10 | namespace eosio { namespace chain { 11 | /** 12 | * @brief tracks minimal information about past blocks to implement TaPOS 13 | * @ingroup object 14 | * 15 | * When attempting to calculate the validity of a transaction we need to 16 | * lookup a past block and check its block hash and the time it occurred 17 | * so we can calculate whether the current transaction is valid and at 18 | * what time it should expire. 19 | */ 20 | class block_summary_object : public chainbase::object 21 | { 22 | OBJECT_CTOR(block_summary_object) 23 | 24 | id_type id; 25 | block_id_type block_id; 26 | }; 27 | 28 | struct by_block_id; 29 | using block_summary_multi_index = chainbase::shared_multi_index_container< 30 | block_summary_object, 31 | indexed_by< 32 | ordered_unique, BOOST_MULTI_INDEX_MEMBER(block_summary_object, block_summary_object::id_type, id)> 33 | // ordered_unique, BOOST_MULTI_INDEX_MEMBER(block_summary_object, block_id_type, block_id)> 34 | > 35 | >; 36 | 37 | } } 38 | 39 | CHAINBASE_SET_INDEX_TYPE(eosio::chain::block_summary_object, eosio::chain::block_summary_multi_index) 40 | 41 | FC_REFLECT( eosio::chain::block_summary_object, (block_id) ) 42 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/chain_id_type.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | 9 | struct hello; 10 | 11 | namespace eosio { 12 | 13 | class net_plugin_impl; 14 | struct handshake_message; 15 | 16 | namespace chain_apis { 17 | class read_only; 18 | } 19 | 20 | namespace chain { 21 | 22 | struct chain_id_type : public fc::sha256 { 23 | using fc::sha256::sha256; 24 | 25 | template 26 | inline friend T& operator<<( T& ds, const chain_id_type& cid ) { 27 | ds.write( cid.data(), cid.data_size() ); 28 | return ds; 29 | } 30 | 31 | template 32 | inline friend T& operator>>( T& ds, chain_id_type& cid ) { 33 | ds.read( cid.data(), cid.data_size() ); 34 | return ds; 35 | } 36 | 37 | void reflector_init()const; 38 | 39 | private: 40 | chain_id_type() = default; 41 | 42 | // Some exceptions are unfortunately necessary: 43 | template 44 | friend T fc::variant::as()const; 45 | 46 | friend class eosio::chain_apis::read_only; 47 | 48 | friend class eosio::net_plugin_impl; 49 | friend struct eosio::handshake_message; 50 | }; 51 | 52 | } } // namespace eosio::chain 53 | 54 | namespace fc { 55 | class variant; 56 | void to_variant(const eosio::chain::chain_id_type& cid, fc::variant& v); 57 | void from_variant(const fc::variant& v, eosio::chain::chain_id_type& cid); 58 | } // fc 59 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/chain_snapshot.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace eosio { namespace chain { 10 | 11 | struct chain_snapshot_header { 12 | /** 13 | * Version history 14 | * 1: initial version 15 | */ 16 | 17 | static constexpr uint32_t minimum_compatible_version = 1; 18 | static constexpr uint32_t current_version = 1; 19 | 20 | uint32_t version = current_version; 21 | 22 | void validate() const { 23 | auto min = minimum_compatible_version; 24 | auto max = current_version; 25 | EOS_ASSERT(version >= min && version <= max, 26 | snapshot_validation_exception, 27 | "Unsupported version of chain snapshot: ${version}. Supported version must be between ${min} and ${max} inclusive.", 28 | ("version",version)("min",min)("max",max)); 29 | } 30 | }; 31 | 32 | struct batch_pbft_snapshot_migrated{}; 33 | 34 | struct batch_pbft_enabled{}; 35 | 36 | struct batch_pbft_lscb_branch{}; 37 | } } 38 | 39 | FC_REFLECT(eosio::chain::chain_snapshot_header,(version)) -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/config_xos.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE.txt 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | #pragma GCC diagnostic ignored "-Wunused-variable" 10 | 11 | namespace eosio { namespace chain { namespace config { 12 | 13 | //guaranteed minimum resources which is abbreviated gmr 14 | const static uint32_t default_gmr_cpu_limit = 200'000; /// free cpu usage in microseconds 15 | const static uint32_t default_gmr_net_limit = 10 * 1024; // 10 KB 16 | const static uint32_t default_gmr_ram_limit = 0; // 0 KB 17 | const static uint16_t default_gmr_resource_limit_per_day = 1000; 18 | 19 | 20 | 21 | } } } // namespace eosio::chain::config 22 | 23 | 24 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/core_symbol.hpp.in: -------------------------------------------------------------------------------- 1 | /** @file 2 | * @copyright defined in eos/LICENSE 3 | * 4 | * \warning This file is machine generated. DO NOT EDIT. See core_symbol.hpp.in for changes. 5 | */ 6 | 7 | #define CORE_SYMBOL SY(4,${CORE_SYMBOL_NAME}) 8 | #define CORE_SYMBOL_NAME "${CORE_SYMBOL_NAME}" -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/eosio_contract.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace eosio { namespace chain { 11 | 12 | class apply_context; 13 | 14 | /** 15 | * @defgroup native_action_handlers Native Action Handlers 16 | */ 17 | ///@{ 18 | void apply_eosio_newaccount(apply_context&); 19 | void apply_eosio_updateauth(apply_context&); 20 | void apply_eosio_deleteauth(apply_context&); 21 | void apply_eosio_linkauth(apply_context&); 22 | void apply_eosio_unlinkauth(apply_context&); 23 | 24 | /* 25 | void apply_eosio_postrecovery(apply_context&); 26 | void apply_eosio_passrecovery(apply_context&); 27 | void apply_eosio_vetorecovery(apply_context&); 28 | */ 29 | 30 | void apply_eosio_setcode(apply_context&); 31 | void apply_eosio_setabi(apply_context&); 32 | 33 | void apply_eosio_canceldelay(apply_context&); 34 | ///@} end action handlers 35 | 36 | } } /// namespace eosio::chain 37 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/genesis_intrinsics.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace eosio { namespace chain { 6 | 7 | extern const std::vector genesis_intrinsics; 8 | 9 | } } // namespace eosio::chain 10 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/merkle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace eosio { namespace chain { 5 | 6 | digest_type make_canonical_left(const digest_type& val); 7 | digest_type make_canonical_right(const digest_type& val); 8 | 9 | bool is_canonical_left(const digest_type& val); 10 | bool is_canonical_right(const digest_type& val); 11 | 12 | 13 | inline auto make_canonical_pair(const digest_type& l, const digest_type& r) { 14 | return make_pair(make_canonical_left(l), make_canonical_right(r)); 15 | }; 16 | 17 | /** 18 | * Calculates the merkle root of a set of digests, if ids is odd it will duplicate the last id. 19 | */ 20 | digest_type merkle( vector ids ); 21 | 22 | } } /// eosio::chain 23 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/multi_index_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace bmi = boost::multi_index; 15 | using bmi::indexed_by; 16 | using bmi::ordered_unique; 17 | using bmi::ordered_non_unique; 18 | using bmi::composite_key; 19 | using bmi::member; 20 | using bmi::const_mem_fun; 21 | using bmi::tag; 22 | using bmi::composite_key_compare; 23 | 24 | struct by_id; 25 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/platform_timer_accuracy.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace eosio { namespace chain { 4 | 5 | struct platform_timer; 6 | void compute_and_print_timer_accuracy(platform_timer& t); 7 | 8 | }} -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/protocol.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/protocol_state_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "multi_index_includes.hpp" 8 | 9 | namespace eosio { namespace chain { 10 | 11 | /** 12 | * @class protocol_state_object 13 | * @brief Maintains global state information about consensus protocol rules 14 | * @ingroup object 15 | * @ingroup implementation 16 | */ 17 | class protocol_state_object : public chainbase::object 18 | { 19 | OBJECT_CTOR(protocol_state_object, (whitelisted_intrinsics)) 20 | 21 | id_type id; 22 | whitelisted_intrinsics_type whitelisted_intrinsics; 23 | }; 24 | 25 | using protocol_state_multi_index = chainbase::shared_multi_index_container< 26 | protocol_state_object, 27 | indexed_by< 28 | ordered_unique, 29 | BOOST_MULTI_INDEX_MEMBER(protocol_state_object, protocol_state_object::id_type, id) 30 | > 31 | > 32 | >; 33 | 34 | }} 35 | 36 | CHAINBASE_SET_INDEX_TYPE(eosio::chain::protocol_state_object, eosio::chain::protocol_state_multi_index) 37 | 38 | FC_REFLECT(eosio::chain::protocol_state_object, 39 | (whitelisted_intrinsics) 40 | ) 41 | 42 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/thread_utils.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE.txt 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace eosio { namespace chain { 13 | 14 | // async on thread_pool and return future 15 | template 16 | auto async_thread_pool( boost::asio::thread_pool& thread_pool, F&& f ) { 17 | auto task = std::make_shared>( std::forward( f ) ); 18 | boost::asio::post( thread_pool, [task]() { (*task)(); } ); 19 | return task->get_future(); 20 | } 21 | 22 | } } // eosio::chain 23 | 24 | 25 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/wast_to_wasm.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | namespace eosio { namespace chain { 10 | 11 | std::vector wast_to_wasm( const std::string& wast ); 12 | std::string wasm_to_wast( const std::vector& wasm, bool strip_names ); 13 | std::string wasm_to_wast( const uint8_t* data, uint64_t size, bool strip_names ); 14 | 15 | } } /// eosio::chain 16 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/compile_monitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace eosio { namespace chain { namespace eosvmoc { 9 | 10 | wrapped_fd get_connection_to_compile_monitor(int cache_fd); 11 | 12 | }}} -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/compile_trampoline.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace eosio { namespace chain { namespace eosvmoc { 4 | 5 | void run_compile_trampoline(int fd); 6 | 7 | }}} -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/config.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | namespace eosio { namespace chain { namespace eosvmoc { 12 | 13 | struct config { 14 | uint64_t cache_size = 1024u*1024u*1024u; 15 | uint64_t threads = 1u; 16 | }; 17 | 18 | }}} 19 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/eos-vm-oc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #include 10 | namespace eosio { namespace chain {class apply_context;}} 11 | #endif 12 | 13 | struct eos_vm_oc_control_block { 14 | uint64_t magic; 15 | uintptr_t execution_thread_code_start; 16 | size_t execution_thread_code_length; 17 | uintptr_t execution_thread_memory_start; 18 | size_t execution_thread_memory_length; 19 | #ifdef __cplusplus 20 | eosio::chain::apply_context* ctx; 21 | std::exception_ptr* eptr; 22 | #else 23 | void* ctx; 24 | void* eptr; 25 | #endif 26 | unsigned current_call_depth_remaining; 27 | int64_t current_linear_memory_pages; //-1 if no memory 28 | char* full_linear_memory_start; 29 | sigjmp_buf* jmp; 30 | #ifdef __cplusplus 31 | std::list>* bounce_buffers; 32 | #else 33 | void* bounce_buffers; 34 | #endif 35 | uintptr_t running_code_base; 36 | int64_t first_invalid_memory_address; 37 | unsigned is_running; 38 | }; -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/executor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace eosio { namespace chain { 13 | 14 | class apply_context; 15 | 16 | namespace eosvmoc { 17 | 18 | class code_cache_base; 19 | class memory; 20 | struct code_descriptor; 21 | 22 | class executor { 23 | public: 24 | executor(const code_cache_base& cc); 25 | ~executor(); 26 | 27 | void execute(const code_descriptor& code, const memory& mem, apply_context& context); 28 | 29 | private: 30 | uint8_t* code_mapping; 31 | size_t code_mapping_size; 32 | bool mapping_is_executable; 33 | 34 | std::exception_ptr executors_exception_ptr; 35 | sigjmp_buf executors_sigjmp_buf; 36 | std::list> executors_bounce_buffers; 37 | }; 38 | 39 | }}} 40 | -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/gs_seg_helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #ifdef __clang__ 10 | #define GS_PTR __attribute__((address_space(256))) 11 | #else 12 | #define GS_PTR __seg_gs 13 | #endif 14 | 15 | //This is really rather unfortunate, but on the upside it does allow a static assert to know if 16 | //the values ever slide which would be a PIC breaking event we'd want to know about at compile 17 | //time. 18 | #define EOS_VM_OC_CONTROL_BLOCK_OFFSET (-18944) 19 | #define EOS_VM_OC_MEMORY_STRIDE (UINT64_C(4329598976)) 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | int32_t eos_vm_oc_grow_memory(int32_t grow, int32_t max); 26 | sigjmp_buf* eos_vm_oc_get_jmp_buf(); 27 | void* eos_vm_oc_get_exception_ptr(); 28 | void* eos_vm_oc_get_bounce_buffer_list(); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/intrinsic.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace IR { 9 | struct FunctionType; 10 | } 11 | 12 | namespace eosio { namespace chain { namespace eosvmoc { 13 | 14 | struct intrinsic { 15 | intrinsic(const char* name, const IR::FunctionType* type, void* function_ptr, size_t ordinal); 16 | }; 17 | 18 | struct intrinsic_entry { 19 | const IR::FunctionType* const type; 20 | const void* const function_ptr; 21 | const size_t ordinal; 22 | }; 23 | 24 | using intrinsic_map_t = std::map; 25 | 26 | const intrinsic_map_t& get_intrinsic_map(); 27 | 28 | }}} -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/webassembly/runtime_interface.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace IR { 6 | struct Module; 7 | } 8 | 9 | namespace eosio { namespace chain { 10 | 11 | class apply_context; 12 | 13 | class wasm_instantiated_module_interface { 14 | public: 15 | virtual void apply(apply_context& context) = 0; 16 | 17 | virtual ~wasm_instantiated_module_interface(); 18 | }; 19 | 20 | class wasm_runtime_interface { 21 | public: 22 | virtual bool inject_module(IR::Module& module) = 0; 23 | virtual std::unique_ptr instantiate_module(const char* code_bytes, size_t code_size, std::vector initial_memory, 24 | const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) = 0; 25 | 26 | //immediately exit the currently running wasm_instantiated_module_interface. Yep, this assumes only one can possibly run at a time. 27 | virtual void immediately_exit_currently_running_module() = 0; 28 | 29 | virtual ~wasm_runtime_interface(); 30 | }; 31 | 32 | }} -------------------------------------------------------------------------------- /libraries/chain/include/eosio/chain/whitelisted_intrinsics.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace eosio { namespace chain { 6 | 7 | using whitelisted_intrinsics_type = shared_flat_multimap; 8 | 9 | // TODO: Improve performance by using std::string_view when we switch to C++17. 10 | 11 | bool is_intrinsic_whitelisted( const whitelisted_intrinsics_type& whitelisted_intrinsics, const std::string& name ); 12 | 13 | void add_intrinsic_to_whitelist( whitelisted_intrinsics_type& whitelisted_intrinsics, const std::string& name ); 14 | 15 | void remove_intrinsic_from_whitelist( whitelisted_intrinsics_type& whitelisted_intrinsics, const std::string& name ); 16 | 17 | void reset_intrinsic_whitelist( whitelisted_intrinsics_type& whitelisted_intrinsics, 18 | const std::set& s ); 19 | 20 | std::set convert_intrinsic_whitelist_to_set( const whitelisted_intrinsics_type& whitelisted_intrinsics ); 21 | 22 | } } // namespace eosio::chain 23 | -------------------------------------------------------------------------------- /libraries/chain/merkle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace eosio { namespace chain { 5 | 6 | /** 7 | * in order to keep proofs concise, before hashing we set the first bit 8 | * of the previous hashes to 0 or 1 to indicate the side it is on 9 | * 10 | * this relieves our proofs from having to indicate left vs right contactenation 11 | * as the node values will imply it 12 | */ 13 | 14 | digest_type make_canonical_left(const digest_type& val) { 15 | digest_type canonical_l = val; 16 | canonical_l._hash[0] &= 0xFFFFFFFFFFFFFF7FULL; 17 | return canonical_l; 18 | } 19 | 20 | digest_type make_canonical_right(const digest_type& val) { 21 | digest_type canonical_r = val; 22 | canonical_r._hash[0] |= 0x0000000000000080ULL; 23 | return canonical_r; 24 | } 25 | 26 | bool is_canonical_left(const digest_type& val) { 27 | return (val._hash[0] & 0x0000000000000080ULL) == 0; 28 | } 29 | 30 | bool is_canonical_right(const digest_type& val) { 31 | return (val._hash[0] & 0x0000000000000080ULL) != 0; 32 | } 33 | 34 | 35 | digest_type merkle(vector ids) { 36 | if( 0 == ids.size() ) { return digest_type(); } 37 | 38 | while( ids.size() > 1 ) { 39 | if( ids.size() % 2 ) 40 | ids.push_back(ids.back()); 41 | 42 | for (int i = 0; i < ids.size() / 2; i++) { 43 | ids[i] = digest_type::hash(make_canonical_pair(ids[2 * i], ids[(2 * i) + 1])); 44 | } 45 | 46 | ids.resize(ids.size() / 2); 47 | } 48 | 49 | return ids.front(); 50 | } 51 | 52 | } } // eosio::chain 53 | -------------------------------------------------------------------------------- /libraries/chain/name.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace eosio::chain { 8 | 9 | void name::set( std::string_view str ) { 10 | const auto len = str.size(); 11 | EOS_ASSERT(len <= 13, name_type_exception, "Name is longer than 13 characters (${name}) ", ("name", std::string(str))); 12 | value = string_to_uint64_t(str); 13 | EOS_ASSERT(to_string() == str, name_type_exception, 14 | "Name not properly normalized (name: ${name}, normalized: ${normalized}) ", 15 | ("name", std::string(str))("normalized", to_string())); 16 | } 17 | 18 | // keep in sync with name::to_string() in contract definition for name 19 | std::string name::to_string()const { 20 | static const char* charmap = ".12345abcdefghijklmnopqrstuvwxyz"; 21 | 22 | std::string str(13,'.'); 23 | 24 | uint64_t tmp = value; 25 | for( uint32_t i = 0; i <= 12; ++i ) { 26 | char c = charmap[tmp & (i == 0 ? 0x0f : 0x1f)]; 27 | str[12-i] = c; 28 | tmp >>= (i == 0 ? 4 : 5); 29 | } 30 | 31 | boost::algorithm::trim_right_if( str, []( char c ){ return c == '.'; } ); 32 | return str; 33 | } 34 | 35 | } // eosio::chain 36 | 37 | namespace fc { 38 | void to_variant(const eosio::chain::name& c, fc::variant& v) { v = c.to_string(); } 39 | void from_variant(const fc::variant& v, eosio::chain::name& check) { check.set( v.get_string() ); } 40 | } // fc 41 | -------------------------------------------------------------------------------- /libraries/chain/platform_timer_posix_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | struct itimerval enable = {{0, 0}, {0, 1000u}}; 7 | if(setitimer(ITIMER_REAL, &enable, NULL)) 8 | return 1; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /libraries/chain/trace.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace eosio { namespace chain { 4 | 5 | action_trace::action_trace( 6 | const transaction_trace& trace, const action& act, account_name receiver, bool context_free, 7 | uint32_t action_ordinal, uint32_t creator_action_ordinal, uint32_t closest_unnotified_ancestor_action_ordinal 8 | ) 9 | :action_ordinal( action_ordinal ) 10 | ,creator_action_ordinal( creator_action_ordinal ) 11 | ,closest_unnotified_ancestor_action_ordinal( closest_unnotified_ancestor_action_ordinal ) 12 | ,receiver( receiver ) 13 | ,act( act ) 14 | ,context_free( context_free ) 15 | ,trx_id( trace.id ) 16 | ,block_num( trace.block_num ) 17 | ,block_time( trace.block_time ) 18 | ,producer_block_id( trace.producer_block_id ) 19 | {} 20 | 21 | action_trace::action_trace( 22 | const transaction_trace& trace, action&& act, account_name receiver, bool context_free, 23 | uint32_t action_ordinal, uint32_t creator_action_ordinal, uint32_t closest_unnotified_ancestor_action_ordinal 24 | ) 25 | :action_ordinal( action_ordinal ) 26 | ,creator_action_ordinal( creator_action_ordinal ) 27 | ,closest_unnotified_ancestor_action_ordinal( closest_unnotified_ancestor_action_ordinal ) 28 | ,receiver( receiver ) 29 | ,act( std::move(act) ) 30 | ,context_free( context_free ) 31 | ,trx_id( trace.id ) 32 | ,block_num( trace.block_num ) 33 | ,block_time( trace.block_time ) 34 | ,producer_block_id( trace.producer_block_id ) 35 | {} 36 | 37 | } } // eosio::chain 38 | -------------------------------------------------------------------------------- /libraries/chain/webassembly/eos-vm-oc/LLVMJIT.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Inline/BasicTypes.h" 4 | #include "IR/Module.h" 5 | 6 | #pragma push_macro("N") 7 | #undef N 8 | #include "llvm/IR/Module.h" 9 | #pragma pop_macro("N") 10 | #include 11 | #include 12 | 13 | namespace eosio { namespace chain { namespace eosvmoc { 14 | 15 | struct instantiated_code { 16 | std::vector code; 17 | std::map function_offsets; 18 | }; 19 | 20 | namespace LLVMJIT { 21 | bool getFunctionIndexFromExternalName(const char* externalName,Uptr& outFunctionDefIndex); 22 | llvm::Module* emitModule(const IR::Module& module); 23 | instantiated_code instantiateModule(const IR::Module& module); 24 | } 25 | }}} -------------------------------------------------------------------------------- /libraries/chain/webassembly/eos-vm-oc/intrinsic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace eosio { namespace chain { namespace eosvmoc { 4 | 5 | static intrinsic_map_t& the_intrinsic_map() { 6 | static intrinsic_map_t intrinsic_map; 7 | return intrinsic_map; 8 | } 9 | 10 | const intrinsic_map_t& get_intrinsic_map() { 11 | return the_intrinsic_map(); 12 | } 13 | 14 | intrinsic::intrinsic(const char* n, const IR::FunctionType* t, void* f, size_t o) { 15 | the_intrinsic_map().erase(n); 16 | the_intrinsic_map().emplace(n, intrinsic_entry{t, f, o}); 17 | } 18 | 19 | }}} -------------------------------------------------------------------------------- /libraries/chain/webassembly/eos-vm-oc/llvmWARshim.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | namespace eosio { namespace chain { namespace eosvmoc { 3 | namespace LLVMJIT { 4 | 5 | llvm::Value* CreateInBoundsGEPWAR(llvm::IRBuilder<>& irBuilder, llvm::Value* Ptr, llvm::Value* v1, llvm::Value* v2) { 6 | if(!v2) 7 | return irBuilder.CreateInBoundsGEP(Ptr, v1); 8 | else 9 | return irBuilder.CreateInBoundsGEP(Ptr, {v1, v2}); 10 | } 11 | 12 | } 13 | 14 | }}} -------------------------------------------------------------------------------- /libraries/chain/webassembly/eos-vm-oc/llvmWARshim.llvmwar: -------------------------------------------------------------------------------- 1 | llvmWARshim.cpp -------------------------------------------------------------------------------- /libraries/testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/testing/*.hpp") 2 | 3 | ## SORT .cpp by most likely to change / break compile 4 | add_library( eosio_testing 5 | tester.cpp 6 | tester_network.cpp 7 | ${HEADERS} 8 | ) 9 | 10 | target_link_libraries( eosio_testing eosio_chain fc chainbase Logging IR WAST WASM Runtime ) 11 | target_include_directories( eosio_testing 12 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" 13 | "${CMAKE_CURRENT_SOURCE_DIR}/../wasm-jit/Include" 14 | "${CMAKE_BINARY_DIR}/unittests/include" 15 | ) 16 | 17 | if(MSVC) 18 | set_source_files_properties( db_init.cpp db_block.cpp database.cpp block_log.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) 19 | endif(MSVC) 20 | 21 | set_target_properties( eosio_testing PROPERTIES PUBLIC_HEADER "${HEADERS}" ) 22 | install( TARGETS eosio_testing 23 | RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} 24 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 25 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 26 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/testing 27 | ) 28 | install_directory_permissions( DIRECTORY ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/testing ) 29 | 30 | -------------------------------------------------------------------------------- /libraries/testing/include/eosio/testing/chainbase_fixture.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | namespace eosio { namespace testing { 7 | 8 | /** 9 | * Utility class to create and tear down a temporary chainbase::database using RAII 10 | * 11 | * @tparam MAX_SIZE - the maximum size of the chainbase::database 12 | */ 13 | template 14 | struct chainbase_fixture { 15 | chainbase_fixture() 16 | : _tempdir() 17 | , _db(std::make_unique(_tempdir.path(), chainbase::database::read_write, MAX_SIZE)) 18 | { 19 | } 20 | 21 | ~chainbase_fixture() 22 | { 23 | _db.reset(); 24 | _tempdir.remove(); 25 | } 26 | 27 | fc::temp_directory _tempdir; 28 | std::unique_ptr _db; 29 | }; 30 | 31 | } } // eosio::testing -------------------------------------------------------------------------------- /libraries/wasm-jit/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: c++ 4 | compiler: 5 | - clang 6 | - gcc 7 | 8 | install: 9 | - if [ "$CXX" = "g++" ]; then export CXX="g++-5" CC="gcc-5"; fi 10 | - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" != "osx" ]; then export CXX="clang++-3.8" CC="clang-3.8"; fi 11 | 12 | script: ./travis-build.sh 13 | 14 | os: 15 | - linux 16 | - osx 17 | 18 | matrix: 19 | exclude: 20 | - os: osx 21 | compiler: gcc 22 | 23 | addons: 24 | apt: 25 | sources: 26 | - llvm-toolchain-precise-3.8 27 | - ubuntu-toolchain-r-test 28 | packages: 29 | - gcc-5 30 | - g++-5 31 | - libedit-dev 32 | - clang-3.8 -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/Emscripten/Emscripten.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef EMSCRIPTEN_API 4 | #define EMSCRIPTEN_API DLL_IMPORT 5 | #endif 6 | 7 | #include 8 | 9 | namespace IR { struct Module; } 10 | namespace Runtime { struct ModuleInstance; } 11 | 12 | namespace Emscripten 13 | { 14 | EMSCRIPTEN_API void initInstance(const IR::Module& module,Runtime::ModuleInstance* moduleInstance); 15 | EMSCRIPTEN_API void injectCommandArgs(const std::vector& argStrings,std::vector& outInvokeArgs); 16 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/IR/IR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Platform/Platform.h" 4 | 5 | #ifndef IR_API 6 | #define IR_API DLL_IMPORT 7 | #endif 8 | 9 | namespace IR 10 | { 11 | enum { maxMemoryPages = (Uptr)65536 }; 12 | enum { numBytesPerPage = (Uptr)65536 }; 13 | enum { numBytesPerPageLog2 = (Uptr)16 }; 14 | 15 | enum { requireSharedFlagForAtomicOperators = false }; 16 | } 17 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/Inline/BasicTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | typedef uint8_t U8; 6 | typedef int8_t I8; 7 | typedef uint16_t U16; 8 | typedef int16_t I16; 9 | typedef uint32_t U32; 10 | typedef int32_t I32; 11 | typedef uint64_t U64; 12 | typedef int64_t I64; 13 | typedef float F32; 14 | typedef double F64; 15 | 16 | // The OSX libc defines uintptr_t to be a long where U32/U64 are int. This causes uintptr_t/uint64 to be treated as distinct types for e.g. overloading. 17 | // Work around it by defining our own Uptr/Iptr that are always int type. 18 | template 19 | struct PointerIntHelper; 20 | template<> struct PointerIntHelper<4> { typedef I32 IntType; typedef U32 UnsignedIntType; }; 21 | template<> struct PointerIntHelper<8> { typedef I64 IntType; typedef U64 UnsignedIntType; }; 22 | typedef PointerIntHelper::UnsignedIntType Uptr; 23 | typedef PointerIntHelper::IntType Iptr; 24 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/Inline/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(PublicHeaders 2 | BasicTypes.h 3 | DenseStaticIntSet.h 4 | Errors.h 5 | Floats.h 6 | Serialization.h 7 | Timing.h 8 | UTF8.h) 9 | add_custom_target(Inline SOURCES ${PublicHeaders}) 10 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/Inline/Errors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace Errors 10 | { 11 | // Fatal error handling. 12 | [[noreturn]] inline void fatalf(const char* messageFormat,...) 13 | { 14 | va_list varArgs; 15 | va_start(varArgs,messageFormat); 16 | std::vfprintf(stderr,messageFormat,varArgs); 17 | std::fflush(stderr); 18 | va_end(varArgs); 19 | std::abort(); 20 | } 21 | [[noreturn]] inline void fatal(const char* message) { fatalf("%s\n",message); } 22 | [[noreturn]] inline void unreachable() { fatalf("reached unreachable code\n"); } 23 | [[noreturn]] inline void unimplemented(const char* context) { fatalf("unimplemented: %s\n",context); } 24 | } 25 | 26 | // Like assert, but is never removed in any build configuration. 27 | #define errorUnless(condition) if(!(condition)) { Errors::fatalf("errorUnless(%s) failed\n",#condition); } 28 | 29 | #define WAVM_ASSERT_THROW(cond) ({ if( !(cond) ) throw std::runtime_error{"wavm assert: " #cond}; }) 30 | 31 | #define WAVM_ASSERT_TERMINATE(cond) ({ if( !(cond) ) { fprintf(stderr, "wavm assert in destructor: %s", #cond); std::terminate(); } }) 32 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/Inline/Timing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "Logging/Logging.h" 6 | 7 | namespace Timing 8 | { 9 | // Encapsulates a timer that starts when constructed and stops when read. 10 | struct Timer 11 | { 12 | Timer(): startTime(std::chrono::high_resolution_clock::now()), isStopped(false) {} 13 | void stop() { endTime = std::chrono::high_resolution_clock::now(); } 14 | U64 getMicroseconds() 15 | { 16 | if(!isStopped) { stop(); } 17 | return std::chrono::duration_cast(endTime - startTime).count(); 18 | } 19 | F64 getMilliseconds() { return getMicroseconds() / 1000.0; } 20 | F64 getSeconds() { return getMicroseconds() / 1000000.0; } 21 | private: 22 | std::chrono::high_resolution_clock::time_point startTime; 23 | std::chrono::high_resolution_clock::time_point endTime; 24 | bool isStopped; 25 | }; 26 | 27 | // Helpers for printing timers. 28 | inline void logTimer(const char* context,Timer& timer) { Log::printf(Log::Category::metrics,"%s in %.2fms\n",context,timer.getMilliseconds()); } 29 | inline void logRatePerSecond(const char* context,Timer& timer,F64 numerator,const char* numeratorUnit) 30 | { 31 | Log::printf(Log::Category::metrics,"%s in %.2fms (%f %s/s)\n", 32 | context, 33 | timer.getMilliseconds(), 34 | numerator / timer.getSeconds(), 35 | numeratorUnit 36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/Logging/Logging.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef LOGGING_API 4 | #define LOGGING_API DLL_IMPORT 5 | #endif 6 | 7 | #include "Inline/BasicTypes.h" 8 | #include "Platform/Platform.h" 9 | 10 | // Debug logging. 11 | namespace Log 12 | { 13 | // Allow filtering the logging by category. 14 | enum class Category 15 | { 16 | error, 17 | debug, 18 | metrics, 19 | num 20 | }; 21 | LOGGING_API void setCategoryEnabled(Category category,bool enable); 22 | LOGGING_API bool isCategoryEnabled(Category category); 23 | 24 | // Print some categorized, formatted string, and flush the output. Newline is not included. 25 | LOGGING_API void printf(Category category,const char* format,...); 26 | }; -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/Runtime/llvmWARshim.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace LLVMJIT { 6 | 7 | llvm::Value* CreateInBoundsGEPWAR(llvm::IRBuilder<>& irBuilder, llvm::Value* Ptr, llvm::Value* v1, llvm::Value* v2 = nullptr); 8 | 9 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/WASM/WASM.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef WEBASSEMBLY_API 4 | #define WEBASSEMBLY_API DLL_IMPORT 5 | #endif 6 | 7 | #include "Inline/BasicTypes.h" 8 | 9 | namespace IR { struct Module; struct DisassemblyNames; } 10 | namespace Serialization { struct InputStream; struct OutputStream; } 11 | 12 | namespace WASM 13 | { 14 | WEBASSEMBLY_API void serialize(Serialization::InputStream& stream,IR::Module& module); 15 | WEBASSEMBLY_API void serialize(Serialization::OutputStream& stream,const IR::Module& module); 16 | } 17 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Include/WAST/WAST.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef WAST_API 4 | #define WAST_API DLL_IMPORT 5 | #endif 6 | 7 | #include "Inline/BasicTypes.h" 8 | #include "Runtime/Runtime.h" 9 | #include "WASM/WASM.h" 10 | 11 | namespace WAST 12 | { 13 | // A location in a text file. 14 | struct TextFileLocus 15 | { 16 | std::string sourceLine; 17 | U32 newlines; 18 | U32 tabs; 19 | U32 characters; 20 | 21 | TextFileLocus(): newlines(0), tabs(0), characters(0) {} 22 | 23 | U32 lineNumber() const { return newlines + 1; } 24 | U32 column(U32 spacesPerTab = 4) const { return tabs * spacesPerTab + characters + 1; } 25 | 26 | std::string describe(U32 spacesPerTab = 4) const 27 | { 28 | return std::to_string(lineNumber()) + ":" + std::to_string(column(spacesPerTab)); 29 | } 30 | }; 31 | 32 | // A WAST parse error. 33 | struct Error 34 | { 35 | TextFileLocus locus; 36 | std::string message; 37 | }; 38 | 39 | // Parse a module from a string. Returns true if it succeeds, and writes the module to outModule. 40 | // If it fails, returns false and appends a list of errors to outErrors. 41 | WAST_API bool parseModule(const char* string,Uptr stringLength,IR::Module& outModule,std::vector& outErrors); 42 | 43 | // Prints a module in WAST format. 44 | WAST_API std::string print(const IR::Module& module); 45 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Emscripten/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Sources Emscripten.cpp) 2 | set(PublicHeaders ${WAVM_INCLUDE_DIR}/Emscripten/Emscripten.h) 3 | include_directories(${WAVM_INCLUDE_DIR}/Emscripten) 4 | 5 | add_library(Emscripten STATIC ${Sources} ${PublicHeaders}) 6 | 7 | add_definitions(-DEMSCRIPTEN_API=DLL_EXPORT) 8 | 9 | target_link_libraries(Emscripten Logging Platform Runtime) 10 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/IR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Sources 2 | DisassemblyNames.cpp 3 | Operators.cpp 4 | Types.cpp 5 | Validate.cpp) 6 | 7 | set(PublicHeaders 8 | ${WAVM_INCLUDE_DIR}/IR/IR.h 9 | ${WAVM_INCLUDE_DIR}/IR/Module.h 10 | ${WAVM_INCLUDE_DIR}/IR/OperatorPrinter.h 11 | ${WAVM_INCLUDE_DIR}/IR/Operators.h 12 | ${WAVM_INCLUDE_DIR}/IR/Types.h 13 | ${WAVM_INCLUDE_DIR}/IR/Validate.h) 14 | include_directories(${WAVM_INCLUDE_DIR}/IR) 15 | 16 | add_library(IR STATIC ${Sources} ${PublicHeaders}) 17 | add_definitions(-DIR_API=DLL_EXPORT) 18 | target_link_libraries(IR Logging) 19 | 20 | install(TARGETS IR 21 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 22 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) 23 | 24 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/IR/Operators.cpp: -------------------------------------------------------------------------------- 1 | #include "Operators.h" 2 | 3 | namespace IR 4 | { 5 | const char* getOpcodeName(Opcode opcode) 6 | { 7 | switch(opcode) 8 | { 9 | #define VISIT_OPCODE(encoding,name,nameString,Imm,...) case Opcode::name: return nameString; 10 | ENUM_OPERATORS(VISIT_OPCODE) 11 | #undef VISIT_OPCODE 12 | default: return "unknown"; 13 | }; 14 | } 15 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Logging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Sources 2 | Logging.cpp) 3 | set(PublicHeaders 4 | ${WAVM_INCLUDE_DIR}/Logging/Logging.h) 5 | include_directories(${WAVM_INCLUDE_DIR}/Logging) 6 | 7 | add_definitions(-DLOGGING_API=DLL_EXPORT) 8 | 9 | add_library(Logging STATIC ${Sources} ${PublicHeaders}) 10 | target_link_libraries(Logging Platform) 11 | 12 | # Link with dl on Linux for dladdr. 13 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 14 | target_link_libraries(Logging dl pthread) 15 | endif() 16 | 17 | install(TARGETS Logging 18 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 19 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) 20 | 21 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Logging/Logging.cpp: -------------------------------------------------------------------------------- 1 | #include "Logging.h" 2 | #include "Platform/Platform.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace Log 9 | { 10 | static Platform::Mutex* categoryEnabledMutex = Platform::createMutex(); 11 | static bool categoryEnabled[(Uptr)Category::num] = 12 | { 13 | true, // error 14 | #ifdef _DEBUG // debug 15 | true, 16 | #else 17 | false, 18 | #endif 19 | WAVM_METRICS_OUTPUT != 0 // metrics 20 | }; 21 | void setCategoryEnabled(Category category,bool enable) 22 | { 23 | Platform::Lock lock(categoryEnabledMutex); 24 | WAVM_ASSERT_THROW(category < Category::num); 25 | categoryEnabled[(Uptr)category] = enable; 26 | } 27 | bool isCategoryEnabled(Category category) 28 | { 29 | Platform::Lock lock(categoryEnabledMutex); 30 | WAVM_ASSERT_THROW(category < Category::num); 31 | return categoryEnabled[(Uptr)category]; 32 | } 33 | void printf(Category category,const char* format,...) 34 | { 35 | Platform::Lock lock(categoryEnabledMutex); 36 | if(categoryEnabled[(Uptr)category]) 37 | { 38 | va_list varArgs; 39 | va_start(varArgs,format); 40 | vfprintf(stdout,format,varArgs); 41 | fflush(stdout); 42 | va_end(varArgs); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Platform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Sources 2 | POSIX.cpp 3 | Windows.cpp) 4 | set(PublicHeaders 5 | ${WAVM_INCLUDE_DIR}/Platform/Platform.h) 6 | include_directories(${WAVM_INCLUDE_DIR}/Platform) 7 | 8 | add_definitions(-DPLATFORM_API=DLL_EXPORT) 9 | 10 | add_library(Platform STATIC ${Sources} ${PublicHeaders}) 11 | 12 | # Link with dl on Linux for dladdr. 13 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 14 | target_link_libraries(Platform dl pthread rt) 15 | endif() 16 | 17 | install(TARGETS Platform 18 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 19 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) 20 | 21 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Programs/Assemble.cpp: -------------------------------------------------------------------------------- 1 | #include "Inline/BasicTypes.h" 2 | #include "CLI.h" 3 | #include "WAST/WAST.h" 4 | #include "WASM/WASM.h" 5 | 6 | int commandMain(int argc,char** argv) 7 | { 8 | if(argc < 3) 9 | { 10 | std::cerr << "Usage: Assemble in.wast out.wasm [switches]" << std::endl; 11 | std::cerr << " -n|--omit-names\t\tOmits WAST function and local names from the output" << std::endl; 12 | return EXIT_FAILURE; 13 | } 14 | const char* inputFilename = argv[1]; 15 | const char* outputFilename = argv[2]; 16 | bool omitNames = false; 17 | if(argc > 3) 18 | { 19 | for(Iptr argumentIndex = 3;argumentIndex < argc;++argumentIndex) 20 | { 21 | if(!strcmp(argv[argumentIndex],"-n") || !strcmp(argv[argumentIndex],"--omit-names")) 22 | { 23 | omitNames = true; 24 | } 25 | else 26 | { 27 | std::cerr << "Unrecognized argument: " << argv[argumentIndex] << std::endl; 28 | return EXIT_FAILURE; 29 | } 30 | } 31 | } 32 | 33 | // Load the WAST module. 34 | IR::Module module; 35 | if(!loadTextModule(inputFilename,module)) { return EXIT_FAILURE; } 36 | 37 | // If the command-line switch to omit names was specified, strip the name section. 38 | if(omitNames) 39 | { 40 | for(auto sectionIt = module.userSections.begin();sectionIt != module.userSections.end();++sectionIt) 41 | { 42 | if(sectionIt->name == "name") { module.userSections.erase(sectionIt); break; } 43 | } 44 | } 45 | 46 | // Write the binary module. 47 | if(!saveBinaryModule(outputFilename,module)) { return EXIT_FAILURE; } 48 | 49 | return EXIT_SUCCESS; 50 | } 51 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Programs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(Assemble Assemble.cpp CLI.h) 2 | target_link_libraries(Assemble Logging IR WAST WASM) 3 | set_target_properties(Assemble PROPERTIES FOLDER Programs) 4 | 5 | add_executable(Disassemble Disassemble.cpp CLI.h) 6 | target_link_libraries(Disassemble Logging IR WAST WASM) 7 | set_target_properties(Disassemble PROPERTIES FOLDER Programs) 8 | 9 | add_executable(Test Test.cpp CLI.h) 10 | target_link_libraries(Test Logging IR WAST Runtime) 11 | set_target_properties(Test PROPERTIES FOLDER Programs) 12 | 13 | add_executable(wavm wavm.cpp CLI.h) 14 | target_link_libraries(wavm Logging IR WAST WASM Runtime Emscripten) 15 | set_target_properties(wavm PROPERTIES FOLDER Programs) 16 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Programs/Disassemble.cpp: -------------------------------------------------------------------------------- 1 | #include "Inline/BasicTypes.h" 2 | #include "CLI.h" 3 | #include "WAST/WAST.h" 4 | #include "WASM/WASM.h" 5 | 6 | int commandMain(int argc,char** argv) 7 | { 8 | if(argc != 3) 9 | { 10 | std::cerr << "Usage: Disassemble in.wasm out.wast" << std::endl; 11 | return EXIT_FAILURE; 12 | } 13 | const char* inputFilename = argv[1]; 14 | const char* outputFilename = argv[2]; 15 | 16 | // Load the WASM file. 17 | IR::Module module; 18 | if(!loadBinaryModule(inputFilename,module)) { return EXIT_FAILURE; } 19 | 20 | // Print the module to WAST. 21 | const std::string wastString = WAST::print(module); 22 | 23 | // Write the serialized data to the output file. 24 | std::ofstream outputStream(outputFilename); 25 | outputStream.write(wastString.data(),wastString.size()); 26 | outputStream.close(); 27 | 28 | return EXIT_SUCCESS; 29 | } 30 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Runtime/llvmWARshim.cpp: -------------------------------------------------------------------------------- 1 | #include "Runtime/llvmWARshim.h" 2 | 3 | namespace LLVMJIT { 4 | 5 | llvm::Value* CreateInBoundsGEPWAR(llvm::IRBuilder<>& irBuilder, llvm::Value* Ptr, llvm::Value* v1, llvm::Value* v2) { 6 | if(!v2) 7 | return irBuilder.CreateInBoundsGEP(Ptr, v1); 8 | else 9 | return irBuilder.CreateInBoundsGEP(Ptr, {v1, v2}); 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/Runtime/llvmWARshim.llvmwar: -------------------------------------------------------------------------------- 1 | #include "Runtime/llvmWARshim.h" 2 | 3 | namespace LLVMJIT { 4 | 5 | llvm::Value* CreateInBoundsGEPWAR(llvm::IRBuilder<>& irBuilder, llvm::Value* Ptr, llvm::Value* v1, llvm::Value* v2) { 6 | if(!v2) 7 | return irBuilder.CreateInBoundsGEP(Ptr, v1); 8 | else 9 | return irBuilder.CreateInBoundsGEP(Ptr, {v1, v2}); 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/ThirdParty/xxhash/LICENSE: -------------------------------------------------------------------------------- 1 | xxHash Library 2 | Copyright (c) 2012-2014, Yann Collet 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or 13 | other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 22 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/WASM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Sources WASMSerialization.cpp) 2 | set(PublicHeaders ${WAVM_INCLUDE_DIR}/WASM/WASM.h) 3 | include_directories(${WAVM_INCLUDE_DIR}/WASM) 4 | 5 | add_library(WASM STATIC ${Sources} ${PublicHeaders}) 6 | add_definitions(-DWEBASSEMBLY_API=DLL_EXPORT) 7 | target_link_libraries(WASM Logging IR) 8 | 9 | install(TARGETS WASM 10 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 11 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 12 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/WAST/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Sources 2 | NFA.cpp 3 | NFA.h 4 | Lexer.cpp 5 | Lexer.h 6 | Parse.cpp 7 | Parse.h 8 | ParseFunction.cpp 9 | ParseNumbers.cpp 10 | ParseModule.cpp 11 | ParseTests.cpp 12 | Print.cpp 13 | Regexp.cpp 14 | Regexp.h) 15 | set(PublicHeaders 16 | ${WAVM_INCLUDE_DIR}/WAST/WAST.h 17 | ${WAVM_INCLUDE_DIR}/WAST/TestScript.h) 18 | include_directories(${WAVM_INCLUDE_DIR}/WAST) 19 | 20 | add_library(WAST STATIC ${Sources} ${PublicHeaders}) 21 | add_definitions(-DWAST_API=DLL_EXPORT) 22 | target_link_libraries(WAST Logging IR WASM) 23 | install(TARGETS WAST 24 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 25 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) 26 | 27 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Source/WAST/Regexp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Inline/BasicTypes.h" 4 | #include "NFA.h" 5 | 6 | namespace Regexp 7 | { 8 | // Parses a regular expression from a string, and adds a recognizer for it to the given NFA 9 | // The recognizer will start from initialState, and end in finalState when the regular expression has been completely matched. 10 | void addToNFA(const char* regexpString,NFA::Builder* nfaBuilder,NFA::StateIndex initialState,NFA::StateIndex finalState); 11 | }; 12 | -------------------------------------------------------------------------------- /libraries/wasm-jit/Test/Benchmark/Benchmark.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct point 5 | { 6 | double x; 7 | double y; 8 | }; 9 | 10 | int main() 11 | { 12 | // Generate a lot of uniformly distributed 2d points in the range -1,-1 to +1,+1. 13 | enum { numXSamples = 10000 }; 14 | enum { numYSamples = 10000 }; 15 | std::vector points; 16 | points.reserve(numXSamples * numYSamples); 17 | for(int x = 0;x < numXSamples;++x) 18 | { 19 | for(int y = 0;y < numXSamples;++y) 20 | { 21 | point p = {-1.0 + 2.0 * x / (numXSamples-1),-1.0 + 2.0 * y / (numYSamples-1)}; 22 | points.push_back(p); 23 | } 24 | } 25 | 26 | // Count the ratio of points inside the unit circle. 27 | int numerator = 0; 28 | int denominator = 0; 29 | for(auto pointIt = points.begin();pointIt != points.end();++pointIt) 30 | { 31 | if(pointIt->x * pointIt->x + pointIt->y * pointIt->y < 1.0) 32 | { 33 | ++numerator; 34 | } 35 | ++denominator; 36 | } 37 | 38 | // Derive the area of the unit circle. 39 | auto circleArea = 4.0 * (double)numerator / denominator; 40 | std::cout << "result: " << circleArea << std::endl; 41 | 42 | return 0; 43 | } -------------------------------------------------------------------------------- /libraries/wasm-jit/afl/readme: -------------------------------------------------------------------------------- 1 | Scripts for helping to run the AFL (http://lcamtuf.coredump.cx/afl/) fuzzer against wavm 2 | 3 | 1) Add the directory containing the AFL binaries to your path 4 | 2) Make a directory to contain the AFL build 5 | 3) From the new directory, run /afl/run-afl-fuzz (to run a n more slave instances if the machine can handle it) 6 | -------------------------------------------------------------------------------- /libraries/wasm-jit/afl/run-afl-fuzz: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | WAVM="$1" 4 | WAVM_BIN=./bin 5 | 6 | TMPDIR=./tmp 7 | FINDINGS=${TMPDIR}/findings 8 | CORPUS_SRC=${WAVM}/Test/fuzz 9 | 10 | if [ -n "$2" ] ; then 11 | NUM_SLAVES=$2 12 | else 13 | NUM_SLAVES=0 14 | fi 15 | 16 | # Compile WAVM using the AFL compiler and ASAN. 17 | export CC=afl-clang-fast 18 | export CXX=afl-clang-fast++ 19 | export AFL_HARDEN=1 20 | cmake ${WAVM} -DENABLE_ASAN=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo 21 | make -j 22 | 23 | # Set up ASAN to ignore seg faults, ignore leaks, and abort on error. 24 | export ASAN_OPTIONS=handle_segv=0:detect_leaks=0:abort_on_error=1 25 | 26 | # Make a ramdisk to hold the AFL temp files. 27 | if [ ! -d $TMPDIR ] ; then 28 | mkdir $TMPDIR && chmod 777 $TMPDIR 29 | sudo mount -t tmpfs -o size=512M tmpfs $TMPDIR 30 | fi 31 | 32 | if [ ! -d $FINDINGS ] ; then 33 | mkdir $FINDINGS 34 | fi 35 | 36 | # Assemble the corpus. 37 | CORPUS=${TMPDIR}/corpus 38 | mkdir -p $CORPUS 39 | rm -rf ${CORPUS}/* 40 | for wast in ${CORPUS_SRC}/*.wast; do 41 | ${WAVM_BIN}/Assemble $wast ${CORPUS}/$(basename $wast).wasm 42 | done 43 | 44 | # Spawn the slave fuzzers 45 | for i in `seq 0 $NUM_SLAVES`; do 46 | afl-fuzz -i ${CORPUS} -o ${FINDINGS} -m 9999999999999999999 -t 5000 -S slave${i} -- ${WAVM_BIN}/wavm @@ 1>slave${i}.stdout.txt 2>slave${i}.stderr.txt & 47 | done 48 | 49 | # Run the master fuzzer 50 | afl-fuzz -i ${CORPUS} -o ${FINDINGS} -m 9999999999999999999 -t 5000 -M master -- ${WAVM_BIN}/wavm @@ 51 | -------------------------------------------------------------------------------- /libraries/wasm-jit/afl/simplify-crashes: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | for f in crashes/id* ; do 3 | afl-tmin -i $f -o $f.min -m 9999999999999999999 -e -- ./bin/wavm --text @@ 4 | done 5 | -------------------------------------------------------------------------------- /libraries/wasm-jit/travis-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e -v 4 | 5 | $CXX --version 6 | 7 | if [[ $TRAVIS_OS_NAME == "osx" ]]; then 8 | export CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Darwin-x86_64.tar.gz"; 9 | export LLVM_URL="https://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-apple-darwin.tar.xz"; 10 | else 11 | export CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"; 12 | export LLVM_URL="https://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz"; 13 | fi 14 | 15 | 16 | # Download a newer version of cmake than is available in Travis's whitelisted apt sources. 17 | mkdir cmake 18 | cd cmake 19 | wget --quiet -O ./cmake.tar.gz ${CMAKE_URL} 20 | tar --strip-components=1 -xzf ./cmake.tar.gz 21 | export PATH=`pwd`/bin:${PATH} 22 | cd .. 23 | cmake --version 24 | 25 | # Download a binary build of LLVM4 (also not available in Travis's whitelisted apt sources) 26 | mkdir llvm4 27 | cd llvm4 28 | wget --quiet -O ./llvm.tar.xz ${LLVM_URL} 29 | tar --strip-components=1 -xf ./llvm.tar.xz 30 | export LLVM_DIR=`pwd`/lib/cmake/llvm 31 | cd .. 32 | 33 | # Build and test a release build of WAVM. 34 | mkdir release 35 | cd release 36 | cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DLLVM_DIR=${LLVM_DIR} 37 | make 38 | ctest -V 39 | cd .. 40 | 41 | # Build and test a debug build of WAVM. 42 | mkdir debug 43 | cd debug 44 | cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DLLVM_DIR=${LLVM_DIR} 45 | make 46 | ASAN_OPTIONS=detect_leaks=0 ctest -V 47 | cd .. 48 | -------------------------------------------------------------------------------- /pipeline.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "eosio-lrt": 3 | { 4 | "pipeline-branch": "legacy-os" 5 | }, 6 | "eosio-nightly-builds": 7 | { 8 | "pipeline-branch": "legacy-os" 9 | }, 10 | "eosio-base-images": 11 | { 12 | "pipeline-branch": "release/1.6.x" 13 | } 14 | } -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(net_plugin) 2 | add_subdirectory(net_api_plugin) 3 | add_subdirectory(http_plugin) 4 | add_subdirectory(http_client_plugin) 5 | add_subdirectory(chain_plugin) 6 | add_subdirectory(chain_api_plugin) 7 | add_subdirectory(producer_plugin) 8 | add_subdirectory(producer_api_plugin) 9 | add_subdirectory(history_plugin) 10 | add_subdirectory(history_api_plugin) 11 | add_subdirectory(pbft_plugin) 12 | add_subdirectory(pbft_api_plugin) 13 | add_subdirectory(state_history_plugin) 14 | 15 | add_subdirectory(wallet_plugin) 16 | add_subdirectory(wallet_api_plugin) 17 | add_subdirectory(txn_test_gen_plugin) 18 | add_subdirectory(db_size_api_plugin) 19 | #add_subdirectory(faucet_testnet_plugin) 20 | add_subdirectory(mongo_db_plugin) 21 | add_subdirectory(login_plugin) 22 | add_subdirectory(test_control_plugin) 23 | add_subdirectory(test_control_api_plugin) 24 | add_subdirectory(kafka_plugin) 25 | add_subdirectory(notify_plugin) 26 | 27 | # Forward variables to top level so packaging picks them up 28 | set(CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS} PARENT_SCOPE) 29 | -------------------------------------------------------------------------------- /plugins/COMMUNITY.md: -------------------------------------------------------------------------------- 1 | # Community Plugin List 2 | 3 | This file contains a list of community authored plugins for `nodeos`, acting as a directory of the plugins that are available. 4 | 5 | Third parties are encouraged to make pull requests to this file (`develop` branch please) in order to list new plugins. 6 | 7 | | Description | URL | 8 | | ----------- | --- | 9 | | BP Heartbeat | https://github.com/bancorprotocol/eos-producer-heartbeat-plugin | 10 | | ElasticSearch | https://github.com/EOSLaoMao/elasticsearch_plugin | 11 | | Kafka | https://github.com/TP-Lab/kafka_plugin | 12 | | MySQL | https://github.com/eosBLACK/eosio_mysqldb_plugin | 13 | | SQL | https://github.com/asiniscalchi/eosio_sql_plugin | 14 | | Watch for specific actions and send them to an HTTP URL | https://github.com/eosauthority/eosio-watcher-plugin | 15 | | ZMQ / history | https://github.com/cc32d9/eos_zmq_plugin | 16 | | ZMQ Light History API | https://github.com/cc32d9/eos_zmq_light_api | 17 | | Chintai ZMQ Watcher | https://github.com/acoutts/chintai-zeromq-watcher-plugin | 18 | | Mongo History API | https://github.com/CryptoLions/EOS-mongo-history-API | 19 | | State History API | https://github.com/acoutts/EOS-state-history-API | 20 | 21 | ## DISCLAIMER: 22 | 23 | The fact that a plugin is listed in this file does not mean the plugin has been reviewed by this repository's maintainers. No warranties are made, i.e. you are at your own risk if you choose to use them. 24 | -------------------------------------------------------------------------------- /plugins/chain_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/chain_api_plugin/*.hpp") 2 | add_library( chain_api_plugin 3 | chain_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( chain_api_plugin chain_plugin http_plugin appbase ) 7 | target_include_directories( chain_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/chain_api_plugin/include/eosio/chain_api_plugin/chain_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace eosio { 13 | using eosio::chain::controller; 14 | using std::unique_ptr; 15 | using namespace appbase; 16 | 17 | class chain_api_plugin : public plugin { 18 | public: 19 | APPBASE_PLUGIN_REQUIRES((chain_plugin)(http_plugin)) 20 | 21 | chain_api_plugin(); 22 | virtual ~chain_api_plugin(); 23 | 24 | virtual void set_program_options(options_description&, options_description&) override; 25 | 26 | void plugin_initialize(const variables_map&); 27 | void plugin_startup(); 28 | void plugin_shutdown(); 29 | 30 | private: 31 | unique_ptr my; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /plugins/chain_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/chain_plugin/*.hpp") 2 | add_library( chain_plugin 3 | account_query_db.cpp 4 | chain_plugin.cpp 5 | ${HEADERS} ) 6 | 7 | target_link_libraries( chain_plugin eosio_chain appbase ) 8 | target_include_directories( chain_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/appbase/include") 9 | -------------------------------------------------------------------------------- /plugins/db_size_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/db_size_api_plugin/*.hpp") 2 | add_library( db_size_api_plugin 3 | db_size_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( db_size_api_plugin http_plugin chain_plugin ) 7 | target_include_directories( db_size_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/eosio-make_new_plugin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 1 ]; then 4 | echo Usage: $0 my_new_plugin 5 | echo ... where my_new_plugin is the name of the plugin you want to create 6 | exit 1 7 | fi 8 | 9 | pluginName=$1 10 | 11 | echo Copying template... 12 | cp -r template_plugin $pluginName 13 | 14 | echo Renaming files/directories... 15 | mv $pluginName/include/eosio/template_plugin $pluginName/include/eosio/$pluginName 16 | for file in `find $pluginName -type f -name '*template_plugin*'`; do mv $file `sed s/template_plugin/$pluginName/g <<< $file`; done; 17 | 18 | echo Renaming in files... 19 | find $pluginName -type f -exec sed -i "s/template_plugin/$pluginName/g" {} \; 20 | 21 | echo "Done! $pluginName is ready. Don't forget to add it to CMakeLists.txt!" 22 | -------------------------------------------------------------------------------- /plugins/faucet_testnet_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/faucet_testnet_plugin/*.hpp") 2 | add_library( faucet_testnet_plugin 3 | faucet_testnet_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( faucet_testnet_plugin appbase fc http_plugin chain_plugin ) 7 | target_include_directories( faucet_testnet_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/faucet_testnet_plugin/include/eosio/faucet_testnet_plugin/faucet_testnet_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | namespace eosio { 10 | 11 | using namespace appbase; 12 | 13 | class faucet_testnet_plugin : public appbase::plugin { 14 | public: 15 | faucet_testnet_plugin(); 16 | ~faucet_testnet_plugin(); 17 | 18 | APPBASE_PLUGIN_REQUIRES((http_plugin)) 19 | virtual void set_program_options(options_description&, options_description& cfg) override; 20 | 21 | void plugin_initialize(const variables_map& options); 22 | void plugin_startup(); 23 | void plugin_shutdown(); 24 | 25 | private: 26 | std::unique_ptr my; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /plugins/history_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB HEADERS "include/eosio/history_api_plugin/*.hpp" ) 2 | add_library( history_api_plugin 3 | history_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( history_api_plugin history_plugin chain_plugin http_plugin appbase ) 7 | target_include_directories( history_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/history_api_plugin/include/eosio/history_api_plugin/history_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | 6 | #pragma once 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace eosio { 14 | 15 | using namespace appbase; 16 | 17 | class history_api_plugin : public plugin { 18 | public: 19 | APPBASE_PLUGIN_REQUIRES((history_plugin)(chain_plugin)(http_plugin)) 20 | 21 | history_api_plugin(); 22 | virtual ~history_api_plugin(); 23 | 24 | virtual void set_program_options(options_description&, options_description&) override; 25 | 26 | void plugin_initialize(const variables_map&); 27 | void plugin_startup(); 28 | void plugin_shutdown(); 29 | 30 | private: 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /plugins/history_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/history_plugin/*.hpp") 2 | add_library( history_plugin 3 | history_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( history_plugin chain_plugin eosio_chain appbase ) 7 | target_include_directories( history_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/http_client_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/http_client_plugin/*.hpp") 2 | add_library( http_client_plugin 3 | http_client_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( http_client_plugin appbase eosio_chain fc ) 7 | target_include_directories( http_client_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/http_client_plugin/include/eosio/http_client_plugin/http_client_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | namespace eosio { 10 | using namespace appbase; 11 | using fc::http_client; 12 | 13 | class http_client_plugin : public appbase::plugin 14 | { 15 | public: 16 | http_client_plugin(); 17 | virtual ~http_client_plugin(); 18 | 19 | APPBASE_PLUGIN_REQUIRES() 20 | virtual void set_program_options(options_description&, options_description& cfg) override; 21 | 22 | void plugin_initialize(const variables_map& options); 23 | void plugin_startup(); 24 | void plugin_shutdown(); 25 | 26 | http_client& get_client() { 27 | return *my; 28 | } 29 | 30 | private: 31 | std::unique_ptr my; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /plugins/http_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/http_plugin/*.hpp") 2 | add_library( http_plugin 3 | http_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( http_plugin eosio_chain appbase fc ) 7 | target_include_directories( http_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/kafka_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.hpp") 2 | add_library(kafka_plugin 3 | kafka_plugin.cpp kafka.cpp try_handle.cpp 4 | ${HEADERS}) 5 | 6 | find_package(Cppkafka) 7 | find_package(RdKafka) 8 | 9 | target_include_directories(kafka_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ${CPPKAFKA_INCLUDE_DIR}) 10 | target_link_libraries(kafka_plugin chain_plugin appbase ${CPPKAFKA_LIBRARY} RdKafka::rdkafka) 11 | -------------------------------------------------------------------------------- /plugins/kafka_plugin/kafka.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "types.hpp" 9 | 10 | namespace kafka { 11 | 12 | using namespace std; 13 | using namespace cppkafka; 14 | using namespace eosio; 15 | 16 | class kafka { 17 | public: 18 | void set_config(Configuration config); 19 | void set_topics(const string& block_topic, const string& tx_topic, const string& tx_trace_topic, const string& action_topic); 20 | void set_partition(int partition); 21 | void start(); 22 | void stop(); 23 | 24 | void push_block(const chain::block_state_ptr& block_state, bool irreversible); 25 | std::pair push_transaction(const chain::transaction_receipt& transaction_receipt, const BlockPtr& block, uint16_t block_seq); 26 | void push_transaction_trace(const chain::transaction_trace_ptr& transaction_trace); 27 | void push_action(const chain::action_trace& action_trace, uint64_t parent_seq, const TransactionTracePtr& tx); 28 | 29 | private: 30 | void consume_block(BlockPtr block); 31 | void consume_transaction(TransactionPtr tx); 32 | void consume_transaction_trace(TransactionTracePtr tx_trace); 33 | void consume_action(ActionPtr action); 34 | 35 | Configuration config_; 36 | string block_topic_; 37 | string tx_topic_; 38 | string tx_trace_topic_; 39 | string action_topic_; 40 | 41 | int partition_{-1}; 42 | 43 | std::unique_ptr producer_; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /plugins/kafka_plugin/kafka_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace kafka { 7 | class kafka; // forward declaration 8 | } 9 | 10 | namespace eosio { 11 | 12 | using namespace appbase; 13 | 14 | class kafka_plugin : public appbase::plugin { 15 | public: 16 | APPBASE_PLUGIN_REQUIRES((kafka_plugin)) 17 | 18 | kafka_plugin(); 19 | virtual ~kafka_plugin(); 20 | 21 | void set_program_options(options_description&, options_description& cfg) override; 22 | 23 | void plugin_initialize(const variables_map& options); 24 | void plugin_startup(); 25 | void plugin_shutdown(); 26 | 27 | private: 28 | bool configured_{}; 29 | 30 | chain_plugin* chain_plugin_{}; 31 | 32 | boost::signals2::connection block_conn_; 33 | boost::signals2::connection irreversible_block_conn_; 34 | boost::signals2::connection transaction_conn_; 35 | 36 | std::atomic start_sync_{false}; 37 | 38 | std::unique_ptr kafka_; 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /plugins/kafka_plugin/readme.md: -------------------------------------------------------------------------------- 1 | # Kafka Plugin 说明 2 | 3 | ### 一、Topic 4 | 5 | 默认开启以下4个topic 6 | 7 | 1. blocks // 其中block字段是由完整区块数据持久化的json结构,是一份全量数据。 8 | 2. transaction 9 | 3. transaction_trace 10 | 4. action 11 | 12 | transaction、transaction_trace、action为nodeos中数据解析所得,提取了主要的可能使用的字段(相当于推荐配置),业务使用者可根据需要适当增减字段。 另,也可以删除这三个topic,仅依赖blocks中的全量数据。 13 | 14 | 详见:`plugins/kafka_plugin/types.hpp ` 15 | 16 | 17 | ### 二、常见问题 18 | 19 | #### bos在Mac上编译常见报错 20 | ``` 21 | Could not find a package configuration file provided by "RdKafka" with any of the following names: 22 | RdKafkaConfig.cmake 23 | rdkafka-config.cmake 24 | ``` 25 | 26 | 原因:系统安装的kafka版本太低 27 | 28 | 解决方法: 29 | 30 | 删除`/usr/local/include/cppkafka` , `/usr/local/include/librdkafka`两个目录 31 | 重新开始bos编译(会自动下载安装适配的kafka版本) -------------------------------------------------------------------------------- /plugins/kafka_plugin/try_handle.cpp: -------------------------------------------------------------------------------- 1 | #include "try_handle.hpp" 2 | 3 | namespace kafka { 4 | 5 | void handle(std::function handler, const std::string& desc) { 6 | try { 7 | handler(); 8 | } catch (fc::exception& e) { 9 | elog("FC Exception while ${desc}: ${e}", ("e", e.to_string())("desc", desc)); 10 | } catch (std::exception& e) { 11 | elog("STD Exception while ${desc}: ${e}", ("e", e.what())("desc", desc)); 12 | } catch (...) { 13 | elog("Unknown exception while ${desc}", ("desc", desc)); 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /plugins/kafka_plugin/try_handle.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace kafka { 6 | 7 | void handle(std::function handler, const std::string& desc); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /plugins/login_plugin/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | IndentWidth: 3 3 | ColumnLimit: 120 4 | PointerAlignment: Left 5 | AlwaysBreakTemplateDeclarations: true 6 | -------------------------------------------------------------------------------- /plugins/login_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/login_plugin/*.hpp") 2 | add_library( login_plugin 3 | login_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( login_plugin chain_plugin http_plugin appbase ) 7 | target_include_directories( login_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/mongo_db_plugin/include/eosio/mongo_db_plugin/mongo_db_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace eosio { 12 | 13 | using mongo_db_plugin_impl_ptr = std::shared_ptr; 14 | 15 | /** 16 | * Provides persistence to MongoDB for: 17 | * accounts 18 | * actions 19 | * block_states 20 | * blocks 21 | * transaction_traces 22 | * transactions 23 | * pub_keys 24 | * account_controls 25 | * 26 | * See data dictionary (DB Schema Definition - EOS API) for description of MongoDB schema. 27 | * 28 | * If cmake -DBUILD_MONGO_DB_PLUGIN=true not specified then this plugin not compiled/included. 29 | */ 30 | class mongo_db_plugin : public plugin { 31 | public: 32 | APPBASE_PLUGIN_REQUIRES((chain_plugin)) 33 | 34 | mongo_db_plugin(); 35 | virtual ~mongo_db_plugin(); 36 | 37 | virtual void set_program_options(options_description& cli, options_description& cfg) override; 38 | 39 | void plugin_initialize(const variables_map& options); 40 | void plugin_startup(); 41 | void plugin_shutdown(); 42 | 43 | private: 44 | mongo_db_plugin_impl_ptr my; 45 | }; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /plugins/net_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/net_api_plugin/*.hpp") 2 | add_library( net_api_plugin 3 | net_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( net_api_plugin net_plugin http_plugin appbase ) 7 | target_include_directories( net_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/net_api_plugin/include/eosio/net_api_plugin/net_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace eosio { 13 | 14 | using namespace appbase; 15 | 16 | class net_api_plugin : public plugin { 17 | public: 18 | APPBASE_PLUGIN_REQUIRES((net_plugin) (http_plugin)) 19 | 20 | net_api_plugin() = default; 21 | net_api_plugin(const net_api_plugin&) = delete; 22 | net_api_plugin(net_api_plugin&&) = delete; 23 | net_api_plugin& operator=(const net_api_plugin&) = delete; 24 | net_api_plugin& operator=(net_api_plugin&&) = delete; 25 | virtual ~net_api_plugin() override = default; 26 | 27 | virtual void set_program_options(options_description& cli, options_description& cfg) override {} 28 | void plugin_initialize(const variables_map& vm); 29 | void plugin_startup(); 30 | void plugin_shutdown() {} 31 | 32 | private: 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /plugins/net_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/net_plugin/*.hpp" ) 2 | add_library( net_plugin 3 | net_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( net_plugin chain_plugin producer_plugin appbase fc ) 7 | target_include_directories( net_plugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/appbase/include") 8 | -------------------------------------------------------------------------------- /plugins/notify_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/notify_plugin/*.hpp") 2 | add_library( notify_plugin 3 | notify_plugin.cpp 4 | ${HEADERS} include/eosio/notify_plugin/notify_plugin.hpp) 5 | 6 | target_link_libraries( notify_plugin chain_plugin eosio_chain appbase fc ) 7 | target_include_directories( notify_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) -------------------------------------------------------------------------------- /plugins/notify_plugin/include/eosio/notify_plugin/notify_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright eospace in eos/LICENSE.txt 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | namespace eosio { 10 | 11 | using namespace appbase; 12 | using notify_plugin_ptr = std::unique_ptr; 13 | 14 | /** 15 | * notify_plugin: make notifications to apps on chain. 16 | */ 17 | class notify_plugin : public appbase::plugin { 18 | public: 19 | notify_plugin(); 20 | virtual ~notify_plugin(); 21 | 22 | APPBASE_PLUGIN_REQUIRES((chain_plugin)) 23 | virtual void set_program_options(options_description&, options_description& cfg) override; 24 | 25 | void plugin_initialize(const variables_map& options); 26 | void plugin_startup(); 27 | void plugin_shutdown(); 28 | 29 | private: 30 | notify_plugin_ptr my; 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /plugins/pbft_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/pbft_api_plugin/*.hpp") 2 | add_library( pbft_api_plugin 3 | pbft_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( pbft_api_plugin pbft_plugin http_plugin appbase ) 7 | target_include_directories( pbft_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/pbft_api_plugin/include/eosio/pbft_api_plugin/pbft_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace eosio { 13 | 14 | using namespace appbase; 15 | 16 | class pbft_api_plugin : public plugin { 17 | public: 18 | APPBASE_PLUGIN_REQUIRES( (pbft_plugin)(http_plugin)) 19 | 20 | pbft_api_plugin() = default; 21 | pbft_api_plugin(const pbft_api_plugin&) = delete; 22 | pbft_api_plugin(pbft_api_plugin&&) = delete; 23 | pbft_api_plugin& operator=(const pbft_api_plugin&) = delete; 24 | pbft_api_plugin& operator=(pbft_api_plugin&&) = delete; 25 | virtual ~pbft_api_plugin() override = default; 26 | 27 | virtual void set_program_options(options_description& cli, options_description& cfg) override {} 28 | void plugin_initialize(const variables_map& vm); 29 | void plugin_startup(); 30 | void plugin_shutdown() {} 31 | 32 | private: 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /plugins/pbft_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/pbft_plugin/*.hpp") 2 | add_library( pbft_plugin 3 | pbft_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( pbft_plugin appbase fc eosio_chain chain_plugin net_plugin) 7 | target_include_directories( pbft_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include") 8 | -------------------------------------------------------------------------------- /plugins/producer_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/producer_api_plugin/*.hpp") 2 | add_library( producer_api_plugin 3 | producer_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( producer_api_plugin producer_plugin http_plugin appbase ) 7 | target_include_directories( producer_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/producer_api_plugin/include/eosio/producer_api_plugin/producer_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace eosio { 13 | 14 | using namespace appbase; 15 | 16 | class producer_api_plugin : public plugin { 17 | public: 18 | APPBASE_PLUGIN_REQUIRES((producer_plugin) (http_plugin)) 19 | 20 | producer_api_plugin() = default; 21 | producer_api_plugin(const producer_api_plugin&) = delete; 22 | producer_api_plugin(producer_api_plugin&&) = delete; 23 | producer_api_plugin& operator=(const producer_api_plugin&) = delete; 24 | producer_api_plugin& operator=(producer_api_plugin&&) = delete; 25 | virtual ~producer_api_plugin() override = default; 26 | 27 | virtual void set_program_options(options_description& cli, options_description& cfg) override {} 28 | void plugin_initialize(const variables_map& vm); 29 | void plugin_startup(); 30 | void plugin_shutdown() {} 31 | 32 | private: 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /plugins/producer_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/producer_plugin/*.hpp") 2 | 3 | add_library( producer_plugin 4 | producer_plugin.cpp 5 | ${HEADERS} 6 | ) 7 | 8 | target_link_libraries( producer_plugin chain_plugin http_client_plugin appbase eosio_chain ) 9 | target_include_directories( producer_plugin 10 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include" ) 11 | -------------------------------------------------------------------------------- /plugins/state_history_plugin/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | IndentWidth: 3 3 | ColumnLimit: 120 4 | PointerAlignment: Left 5 | AlwaysBreakTemplateDeclarations: true 6 | AlignConsecutiveAssignments: true 7 | AlignConsecutiveDeclarations: true 8 | BreakConstructorInitializers: BeforeComma 9 | -------------------------------------------------------------------------------- /plugins/state_history_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/state_history_plugin/*.hpp") 2 | add_library( state_history_plugin 3 | state_history_plugin.cpp 4 | state_history_plugin_abi.cpp 5 | ${HEADERS} ) 6 | 7 | target_link_libraries( state_history_plugin chain_plugin eosio_chain appbase ) 8 | target_include_directories( state_history_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 9 | -------------------------------------------------------------------------------- /plugins/template_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/template_plugin/*.hpp") 2 | add_library( template_plugin 3 | template_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( template_plugin appbase fc ) 7 | target_include_directories( template_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/template_plugin/include/eosio/template_plugin/template_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | 8 | namespace eosio { 9 | 10 | using namespace appbase; 11 | 12 | /** 13 | * This is a template plugin, intended to serve as a starting point for making new plugins 14 | */ 15 | class template_plugin : public appbase::plugin { 16 | public: 17 | template_plugin(); 18 | virtual ~template_plugin(); 19 | 20 | APPBASE_PLUGIN_REQUIRES() 21 | virtual void set_program_options(options_description&, options_description& cfg) override; 22 | 23 | void plugin_initialize(const variables_map& options); 24 | void plugin_startup(); 25 | void plugin_shutdown(); 26 | 27 | private: 28 | std::unique_ptr my; 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /plugins/template_plugin/template_plugin.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #include 6 | 7 | namespace eosio { 8 | static appbase::abstract_plugin& _template_plugin = app().register_plugin(); 9 | 10 | class template_plugin_impl { 11 | public: 12 | }; 13 | 14 | template_plugin::template_plugin():my(new template_plugin_impl()){} 15 | template_plugin::~template_plugin(){} 16 | 17 | void template_plugin::set_program_options(options_description&, options_description& cfg) { 18 | cfg.add_options() 19 | ("option-name", bpo::value()->default_value("default value"), 20 | "Option Description") 21 | ; 22 | } 23 | 24 | void template_plugin::plugin_initialize(const variables_map& options) { 25 | try { 26 | if( options.count( "option-name" )) { 27 | // Handle the option 28 | } 29 | } 30 | FC_LOG_AND_RETHROW() 31 | } 32 | 33 | void template_plugin::plugin_startup() { 34 | // Make the magic happen 35 | } 36 | 37 | void template_plugin::plugin_shutdown() { 38 | // OK, that's enough magic 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /plugins/test_control_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/test_control_api_plugin/*.hpp") 2 | add_library( test_control_api_plugin 3 | test_control_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( test_control_api_plugin test_control_plugin chain_plugin http_plugin appbase ) 7 | target_include_directories( test_control_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/test_control_api_plugin/include/eosio/test_control_api_plugin/test_control_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace eosio { 13 | using eosio::chain::controller; 14 | using std::unique_ptr; 15 | using namespace appbase; 16 | 17 | class test_control_api_plugin : public plugin { 18 | public: 19 | APPBASE_PLUGIN_REQUIRES((test_control_plugin)(chain_plugin)(http_plugin)) 20 | 21 | test_control_api_plugin(); 22 | virtual ~test_control_api_plugin(); 23 | 24 | virtual void set_program_options(options_description&, options_description&) override; 25 | 26 | void plugin_initialize(const variables_map&); 27 | void plugin_startup(); 28 | void plugin_shutdown(); 29 | 30 | private: 31 | unique_ptr my; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /plugins/test_control_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/test_control_plugin/*.hpp") 2 | 3 | add_library( test_control_plugin 4 | test_control_plugin.cpp 5 | ${HEADERS} ) 6 | 7 | target_link_libraries( test_control_plugin producer_plugin chain_plugin http_client_plugin appbase eosio_chain ) 8 | target_include_directories( test_control_plugin 9 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 10 | -------------------------------------------------------------------------------- /plugins/txn_test_gen_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/txn_test_gen_plugin/*.hpp") 2 | add_library( txn_test_gen_plugin 3 | txn_test_gen_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( txn_test_gen_plugin appbase fc http_plugin chain_plugin eosio_testing net_plugin) 7 | target_include_directories( txn_test_gen_plugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include 8 | txn_test_gen_plugin PUBLIC ${CMAKE_SOURCE_DIR}/libraries/testing/include 9 | txn_test_gen_plugin PUBLIC ${CMAKE_BINARY_DIR}/unittests/include ) 10 | -------------------------------------------------------------------------------- /plugins/txn_test_gen_plugin/include/eosio/txn_test_gen_plugin/txn_test_gen_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | #include 9 | 10 | namespace eosio { 11 | 12 | using namespace appbase; 13 | 14 | class txn_test_gen_plugin : public appbase::plugin { 15 | public: 16 | txn_test_gen_plugin(); 17 | ~txn_test_gen_plugin(); 18 | 19 | APPBASE_PLUGIN_REQUIRES((http_plugin)(chain_plugin)) 20 | virtual void set_program_options(options_description&, options_description& cfg) override; 21 | 22 | void plugin_initialize(const variables_map& options); 23 | void plugin_startup(); 24 | void plugin_shutdown(); 25 | 26 | private: 27 | std::unique_ptr my; 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /plugins/wallet_api_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/wallet_api_plugin/*.hpp") 2 | add_library( wallet_api_plugin 3 | wallet_api_plugin.cpp 4 | ${HEADERS} ) 5 | 6 | target_link_libraries( wallet_api_plugin wallet_plugin http_plugin appbase ) 7 | target_include_directories( wallet_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 8 | -------------------------------------------------------------------------------- /plugins/wallet_api_plugin/include/eosio/wallet_api_plugin/wallet_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace eosio { 13 | 14 | using namespace appbase; 15 | 16 | class wallet_api_plugin : public plugin { 17 | public: 18 | APPBASE_PLUGIN_REQUIRES((wallet_plugin) (http_plugin)) 19 | 20 | wallet_api_plugin() = default; 21 | wallet_api_plugin(const wallet_api_plugin&) = delete; 22 | wallet_api_plugin(wallet_api_plugin&&) = delete; 23 | wallet_api_plugin& operator=(const wallet_api_plugin&) = delete; 24 | wallet_api_plugin& operator=(wallet_api_plugin&&) = delete; 25 | virtual ~wallet_api_plugin() override = default; 26 | 27 | virtual void set_program_options(options_description& cli, options_description& cfg) override {} 28 | void plugin_initialize(const variables_map& vm); 29 | void plugin_startup(); 30 | void plugin_shutdown() {} 31 | 32 | private: 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /plugins/wallet_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/eosio/wallet_plugin/*.hpp") 2 | 3 | if(APPLE) 4 | set(SE_WALLET_SOURCES se_wallet.cpp macos_user_auth.m) 5 | set_source_files_properties(macos_user_presence.m PROPERTIES COMPILE_FLAGS "-x objective-c") 6 | 7 | find_library(security_framework Security) 8 | find_library(localauthentication_framework LocalAuthentication) 9 | find_library(corefoundation_framework CoreFoundation) 10 | find_library(cocoa_framework Cocoa) 11 | 12 | if(MAS_KEYCHAIN_GROUP) 13 | add_definitions(-DMAS_KEYCHAIN_GROUP=${MAS_KEYCHAIN_GROUP}) 14 | endif(MAS_KEYCHAIN_GROUP) 15 | endif(APPLE) 16 | 17 | add_library( wallet_plugin 18 | wallet.cpp 19 | wallet_plugin.cpp 20 | wallet_manager.cpp 21 | ${SE_WALLET_SOURCES} 22 | yubihsm_wallet.cpp 23 | ${HEADERS} ) 24 | 25 | target_link_libraries( wallet_plugin eosio_chain appbase ${security_framework} ${corefoundation_framework} ${localauthentication_framework} ${cocoa_framework}) 26 | target_include_directories( wallet_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 27 | -------------------------------------------------------------------------------- /plugins/wallet_plugin/include/eosio/wallet_plugin/macos_user_auth.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | //ask for user authentication and call callback with true/false once compelte. **Note that the callback 6 | // will be done in a separate thread** 7 | extern "C" void macos_user_auth(void(*cb)(int, void*), void* cb_userdata, CFStringRef message); -------------------------------------------------------------------------------- /plugins/wallet_plugin/include/eosio/wallet_plugin/se_wallet.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | using namespace eosio::chain; 8 | 9 | namespace eosio { namespace wallet { 10 | 11 | namespace detail { 12 | struct se_wallet_impl; 13 | } 14 | 15 | class se_wallet final : public wallet_api { 16 | public: 17 | se_wallet(); 18 | ~se_wallet(); 19 | 20 | private_key_type get_private_key(public_key_type pubkey) const override; 21 | 22 | bool is_locked() const override; 23 | void lock() override; 24 | void unlock(string password) override; 25 | void check_password(string password) override; 26 | void set_password(string password) override; 27 | 28 | map list_keys() override; 29 | flat_set list_public_keys() override; 30 | 31 | bool import_key(string wif_key) override; 32 | string create_key(string key_type) override; 33 | bool remove_key(string key) override; 34 | 35 | fc::optional try_sign_digest(const digest_type digest, const public_key_type public_key) override; 36 | 37 | private: 38 | std::unique_ptr my; 39 | }; 40 | 41 | }} -------------------------------------------------------------------------------- /plugins/wallet_plugin/include/eosio/wallet_plugin/wallet_plugin.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace fc { class variant; } 12 | 13 | namespace eosio { 14 | using namespace appbase; 15 | 16 | namespace wallet { 17 | class wallet_manager; 18 | } 19 | using namespace wallet; 20 | 21 | class wallet_plugin : public plugin { 22 | public: 23 | APPBASE_PLUGIN_REQUIRES() 24 | 25 | wallet_plugin(); 26 | wallet_plugin(const wallet_plugin&) = delete; 27 | wallet_plugin(wallet_plugin&&) = delete; 28 | wallet_plugin& operator=(const wallet_plugin&) = delete; 29 | wallet_plugin& operator=(wallet_plugin&&) = delete; 30 | virtual ~wallet_plugin() override = default; 31 | 32 | virtual void set_program_options(options_description& cli, options_description& cfg) override; 33 | void plugin_initialize(const variables_map& options); 34 | void plugin_startup() {} 35 | void plugin_shutdown() {} 36 | 37 | // api interface provider 38 | wallet_manager& get_wallet_manager(); 39 | 40 | private: 41 | std::unique_ptr wallet_manager_ptr; 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /plugins/wallet_plugin/include/eosio/wallet_plugin/yubihsm_wallet.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | using namespace eosio::chain; 8 | 9 | namespace eosio { namespace wallet { 10 | 11 | namespace detail { 12 | struct yubihsm_wallet_impl; 13 | } 14 | 15 | class yubihsm_wallet final : public wallet_api { 16 | public: 17 | yubihsm_wallet(const string& connector, const uint16_t authkey); 18 | ~yubihsm_wallet(); 19 | 20 | private_key_type get_private_key(public_key_type pubkey) const override; 21 | 22 | bool is_locked() const override; 23 | void lock() override; 24 | void unlock(string password) override; 25 | void check_password(string password) override; 26 | void set_password(string password) override; 27 | 28 | map list_keys() override; 29 | flat_set list_public_keys() override; 30 | 31 | bool import_key(string wif_key) override; 32 | string create_key(string key_type) override; 33 | bool remove_key(string key) override; 34 | 35 | fc::optional try_sign_digest(const digest_type digest, const public_key_type public_key) override; 36 | 37 | private: 38 | std::unique_ptr my; 39 | }; 40 | 41 | }} -------------------------------------------------------------------------------- /plugins/wallet_plugin/macos_user_auth.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | void macos_user_auth(void(*cb)(int, void*), void* cb_userdata, CFStringRef message) { 4 | static LAContext* ctx; 5 | if(ctx) 6 | [ctx dealloc]; 7 | ctx = [[LAContext alloc] init]; 8 | [ctx evaluatePolicy:kLAPolicyDeviceOwnerAuthentication localizedReason:(NSString*)message reply:^(BOOL success, NSError* error) { 9 | cb(success, cb_userdata); 10 | }]; 11 | } -------------------------------------------------------------------------------- /programs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( nodeos ) 2 | add_subdirectory( cleos ) 3 | add_subdirectory( keosd ) 4 | add_subdirectory( eosio-launcher ) 5 | add_subdirectory( eosio-blocklog ) 6 | -------------------------------------------------------------------------------- /programs/cleos/config.hpp.in: -------------------------------------------------------------------------------- 1 | /** @file 2 | * @copyright defined in eos/LICENSE 3 | * 4 | * \warning This file is machine generated. DO NOT EDIT. See config.hpp.in for changes. 5 | */ 6 | 7 | namespace eosio { namespace client { namespace config { 8 | constexpr char version_str[] = "${cleos_BUILD_VERSION}"; 9 | constexpr char locale_path[] = "${LOCALEDIR}"; 10 | constexpr char locale_domain[] = "${LOCALEDOMAIN}"; 11 | constexpr char key_store_executable_name[] = "${KEY_STORE_EXECUTABLE_NAME}"; 12 | }}} 13 | -------------------------------------------------------------------------------- /programs/cleos/help_text.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | #include 7 | 8 | namespace eosio { namespace client { namespace help { 9 | bool print_recognized_errors(const fc::exception& e, const bool verbose_errors); 10 | bool print_help_text(const fc::exception& e); 11 | }}} -------------------------------------------------------------------------------- /programs/cleos/localize.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace eosio { namespace client { namespace localize { 11 | #if !defined(_) 12 | #define _(str) str 13 | #endif 14 | 15 | #define localized(str, ...) localized_with_variant((str), fc::mutable_variant_object() __VA_ARGS__ ) 16 | 17 | inline auto localized_with_variant( const char* raw_fmt, const fc::variant_object& args) { 18 | if (raw_fmt != nullptr) { 19 | try { 20 | return fc::format_string(::gettext(raw_fmt), args); 21 | } catch (...) { 22 | } 23 | return std::string(raw_fmt); 24 | } 25 | return std::string(); 26 | } 27 | }}} 28 | -------------------------------------------------------------------------------- /programs/eosio-blocklog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable( eosio-blocklog main.cpp ) 2 | 3 | if( UNIX AND NOT APPLE ) 4 | set(rt_library rt ) 5 | endif() 6 | 7 | find_package( Gperftools QUIET ) 8 | if( GPERFTOOLS_FOUND ) 9 | message( STATUS "Found gperftools; compiling eosio-blocklog with TCMalloc") 10 | list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) 11 | endif() 12 | 13 | target_include_directories(eosio-blocklog PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) 14 | 15 | target_link_libraries( eosio-blocklog 16 | PRIVATE appbase 17 | PRIVATE eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) 18 | 19 | install( TARGETS 20 | eosio-blocklog 21 | 22 | RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} 23 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 24 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 25 | ) 26 | -------------------------------------------------------------------------------- /programs/eosio-launcher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable( eosio-launcher main.cpp ) 2 | if( UNIX AND NOT APPLE ) 3 | set(rt_library rt ) 4 | endif() 5 | 6 | find_package( Gperftools QUIET ) 7 | if( GPERFTOOLS_FOUND ) 8 | message( STATUS "Found gperftools; compiling with TCMalloc") 9 | list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) 10 | endif() 11 | 12 | if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.git) 13 | find_package(Git) 14 | if(GIT_FOUND) 15 | execute_process( 16 | COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD 17 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../.." 18 | OUTPUT_VARIABLE "launcher_BUILD_VERSION" 19 | ERROR_QUIET 20 | OUTPUT_STRIP_TRAILING_WHITESPACE) 21 | message(STATUS "Git commit revision: ${launcher_BUILD_VERSION}") 22 | else() 23 | set(launcher_BUILD_VERSION 0) 24 | endif() 25 | endif() 26 | 27 | configure_file(config.hpp.in config.hpp ESCAPE_QUOTES) 28 | 29 | target_include_directories(eosio-launcher PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) 30 | 31 | target_link_libraries(eosio-launcher 32 | PRIVATE eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) 33 | 34 | install( TARGETS 35 | eosio-launcher 36 | 37 | RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} 38 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 39 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 40 | ) 41 | -------------------------------------------------------------------------------- /programs/eosio-launcher/config.hpp.in: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | * 5 | * \warning This file is machine generated. DO NOT EDIT. See config.hpp.in for changes. 6 | */ 7 | #pragma once 8 | 9 | #ifndef CONFIG_HPP_IN 10 | #define CONFIG_HPP_IN 11 | 12 | namespace eosio { namespace launcher { namespace config { 13 | constexpr char version_str[] = "${launcher_BUILD_VERSION}"; 14 | }}} 15 | 16 | #endif // CONFIG_HPP_IN 17 | -------------------------------------------------------------------------------- /programs/keosd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable( ${KEY_STORE_EXECUTABLE_NAME} main.cpp ) 2 | if( UNIX AND NOT APPLE ) 3 | set(rt_library rt ) 4 | endif() 5 | 6 | find_package( Gperftools QUIET ) 7 | if( GPERFTOOLS_FOUND ) 8 | message( STATUS "Found gperftools; compiling ${KEY_STORE_EXECUTABLE_NAME} with TCMalloc") 9 | list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) 10 | endif() 11 | 12 | configure_file(config.hpp.in config.hpp ESCAPE_QUOTES) 13 | 14 | target_link_libraries( ${KEY_STORE_EXECUTABLE_NAME} 15 | PRIVATE appbase 16 | PRIVATE wallet_api_plugin wallet_plugin 17 | PRIVATE http_plugin 18 | PRIVATE eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) 19 | target_include_directories(${KEY_STORE_EXECUTABLE_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) 20 | 21 | mas_sign(${KEY_STORE_EXECUTABLE_NAME}) 22 | 23 | copy_bin( ${KEY_STORE_EXECUTABLE_NAME} ) 24 | install( TARGETS 25 | ${KEY_STORE_EXECUTABLE_NAME} 26 | 27 | RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} 28 | LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 29 | ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} 30 | ) 31 | -------------------------------------------------------------------------------- /programs/keosd/config.hpp.in: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | * 5 | * \warning This file is machine generated. DO NOT EDIT. See config.hpp.in for changes. 6 | */ 7 | #pragma once 8 | 9 | namespace eosio { namespace keosd { namespace config { 10 | const string key_store_executable_name = "${KEY_STORE_EXECUTABLE_NAME}"; 11 | }}} 12 | -------------------------------------------------------------------------------- /programs/nodeos/config.hpp.in: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | * 5 | * \warning This file is machine generated. DO NOT EDIT. See config.hpp.in for changes. 6 | */ 7 | #pragma once 8 | 9 | #ifndef CONFIG_HPP_IN 10 | #define CONFIG_HPP_IN 11 | 12 | namespace eosio { namespace nodeos { namespace config { 13 | constexpr uint64_t version = 0x${nodeos_BUILD_VERSION}; 14 | }}} 15 | 16 | #endif // CONFIG_HPP_IN 17 | -------------------------------------------------------------------------------- /scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | configure_file(eosio-tn_bounce.sh eosio-tn_bounce.sh COPYONLY) 3 | configure_file(eosio-tn_down.sh eosio-tn_down.sh COPYONLY) 4 | configure_file(eosio-tn_roll.sh eosio-tn_roll.sh COPYONLY) 5 | configure_file(eosio-tn_up.sh eosio-tn_up.sh COPYONLY) 6 | configure_file(abi_is_json.py abi_is_json.py COPYONLY) 7 | -------------------------------------------------------------------------------- /scripts/abi_is_json.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json 4 | import sys 5 | 6 | def json_validator(data): 7 | try: 8 | json.loads(data) 9 | return True 10 | except ValueError as error: 11 | print("invalid json: %s" % error) 12 | return False 13 | 14 | def test_json_validator(abi_name): 15 | abi_file = open(abi_name,'r') 16 | abi_text = abi_file.read() 17 | abi_file.close() 18 | return json_validator(abi_text) 19 | 20 | if __name__ == "__main__": 21 | for filename in sys.argv[1:]: 22 | print("Testing abi file ", filename) 23 | if not test_json_validator(filename): 24 | exit(1) 25 | exit(0) 26 | -------------------------------------------------------------------------------- /scripts/eosio-tn_bounce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # eosio-tn_bounce is used to restart a node that is acting badly or is down. 4 | # usage: eosio-tn_bounce.sh [arglist] 5 | # arglist will be passed to the node's command line. First with no modifiers 6 | # then with --hard-replay-blockchain and then a third time with --delete-all-blocks 7 | # 8 | # the data directory and log file are set by this script. Do not pass them on 9 | # the command line. 10 | # 11 | # in most cases, simply running ./eosio-tn_bounce.sh is sufficient. 12 | # 13 | 14 | pushd $EOSIO_HOME 15 | 16 | if [ ! -f programs/nodeos/nodeos ]; then 17 | echo unable to locate binary for nodeos 18 | exit 1 19 | fi 20 | 21 | config_base=etc/eosio/node_ 22 | if [ -z "$EOSIO_NODE" ]; then 23 | DD=`ls -d ${config_base}[012]?` 24 | ddcount=`echo $DD | wc -w` 25 | if [ $ddcount -ne 1 ]; then 26 | echo $HOSTNAME has $ddcount config directories, bounce not possible. Set environment variable 27 | echo EOSIO_NODE to the 2-digit node id number to specify which node to bounce. For example: 28 | echo EOSIO_NODE=06 $0 \ 29 | cd - 30 | exit 1 31 | fi 32 | OFS=$((${#DD}-2)) 33 | export EOSIO_NODE=${DD:$OFS} 34 | else 35 | DD=${config_base}$EOSIO_NODE 36 | if [ ! \( -d $DD \) ]; then 37 | echo no directory named $PWD/$DD 38 | cd - 39 | exit 1 40 | fi 41 | fi 42 | 43 | bash $EOSIO_HOME/scripts/eosio-tn_down.sh 44 | bash $EOSIO_HOME/scripts/eosio-tn_up.sh "$*" 45 | -------------------------------------------------------------------------------- /scripts/eosio-tn_down.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # eosio-tn_down.sh is used by the eosio-tn_bounce.sh and eosio-tn_roll.sh scripts. 4 | # It is intended to terminate specific EOS.IO daemon processes. 5 | # 6 | 7 | 8 | if [ "$PWD" != "$EOSIO_HOME" ]; then 9 | echo $0 must only be run from $EOSIO_HOME 10 | exit -1 11 | fi 12 | 13 | prog=nodeos 14 | 15 | DD=var/lib/node_$EOSIO_NODE 16 | runtest=`cat $DD/$prog.pid` 17 | echo runtest = $runtest 18 | running=`ps -e | grep $runtest | grep -cv grep ` 19 | 20 | if [ $running -ne 0 ]; then 21 | echo killing $prog 22 | 23 | kill -15 $runtest 24 | 25 | for (( a = 1;11-$a; a = $(($a + 1)) )); do 26 | echo waiting for safe termination, pass $a 27 | sleep 2 28 | running=`ps -e | grep $runtest | grep -cv grep` 29 | echo running = $running 30 | if [ $running -eq 0 ]; then 31 | break; 32 | fi 33 | done 34 | fi 35 | 36 | if [ $running -ne 0 ]; then 37 | echo killing $prog with SIGTERM failed, trying with SIGKILL 38 | pkill -9 $runtest 39 | fi 40 | -------------------------------------------------------------------------------- /scripts/eosio_build_dep: -------------------------------------------------------------------------------- 1 | automake,-x,/usr/local/bin/automake,automake,http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz 2 | Libtool,-x,/usr/local/bin/glibtool,libtool,http://gnu.askapache.com/libtool/libtool-2.4.6.tar.gz 3 | OpenSSL,-f,/usr/local/opt/openssl/lib/libssl.a,openssl,https://www.openssl.org/source/openssl-1.0.2n.tar.gz 4 | llvm,-x,/usr/local/opt/llvm@7/bin/clang-7,llvm@7,http://releases.llvm.org/7.0.1/llvm-7.0.1.src.tar.xz 5 | wget,-x,/usr/local/bin/wget,wget,https://ftp.gnu.org/gnu/wget/wget-1.19.2.tar.gz 6 | CMake,-x,/usr/local/bin/cmake,cmake,https://cmake.org/files/v3.15/cmake-3.15.4-Darwin-x86_64.tar.gz 7 | GMP,-f,/usr/local/opt/gmp/include/gmpxx.h,gmp,https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2 8 | gettext,-x,/usr/local/opt/gettext/bin/gettext,gettext,https://ftp.gnu.org/pub/gnu/gettext/gettext-latest.tar.gz 9 | MongoDB,-x,/usr/local/opt/mongodb/bin/mongod,mongodb,https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-3.6.3.tgz 10 | Doxygen,-x,/usr/local/bin/doxygen,doxygen,http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.14.src.tar.gz 11 | Graphviz,-x,/usr/local/bin/dot,graphviz,https://graphviz.gitlab.io/pub/graphviz/stable/SOURCES/graphviz.tar.gz 12 | LCOV,-f,/usr/local/bin/lcov,lcov,http://downloads.sourceforge.net/ltp/lcov-1.13.tar.gz 13 | -------------------------------------------------------------------------------- /scripts/generate_deb.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | PREFIX="usr" 4 | SPREFIX=${PREFIX} 5 | SUBPREFIX="opt/${PROJECT}/${VERSION}" 6 | SSUBPREFIX="opt\/${PROJECT}\/${VERSION}" 7 | RELEASE="${VERSION_SUFFIX}" 8 | 9 | # default release to "1" if there is no suffix 10 | if [[ -z $RELEASE ]]; then 11 | RELEASE="1" 12 | fi 13 | 14 | NAME="${PROJECT}_${VERSION_NO_SUFFIX}-${RELEASE}_amd64" 15 | 16 | mkdir -p ${PROJECT}/DEBIAN 17 | chmod 0755 ${PROJECT}/DEBIAN 18 | echo "Package: ${PROJECT} 19 | Version: ${VERSION_NO_SUFFIX}-${RELEASE} 20 | Section: devel 21 | Priority: optional 22 | Depends: libbz2-dev (>= 1.0), libssl-dev (>= 1.0), libgmp3-dev, build-essential, libicu-dev, zlib1g-dev, libtinfo5 23 | Architecture: amd64 24 | Homepage: ${URL} 25 | Maintainer: ${EMAIL} 26 | Description: ${DESC}" &> ${PROJECT}/DEBIAN/control 27 | 28 | export PREFIX 29 | export SUBPREFIX 30 | export SPREFIX 31 | export SSUBPREFIX 32 | 33 | bash generate_tarball.sh ${NAME}.tar.gz 34 | 35 | tar -xvzf ${NAME}.tar.gz -C ${PROJECT} 36 | dpkg-deb --build ${PROJECT} 37 | BUILDSTATUS=$? 38 | mv ${PROJECT}.deb ${NAME}.deb 39 | rm -r ${PROJECT} 40 | 41 | exit $BUILDSTATUS 42 | -------------------------------------------------------------------------------- /scripts/generate_package.sh.in: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | VARIANT=$1 4 | 5 | VERSION_NO_SUFFIX="@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@" 6 | VERSION_SUFFIX="@VERSION_SUFFIX@" 7 | VERSION="@VERSION_FULL@" 8 | BUILD_DIR="@CMAKE_BINARY_DIR@" 9 | 10 | VENDOR="@VENDOR@" 11 | PROJECT="@PROJECT_NAME@" 12 | DESC="@DESC@" 13 | URL="@URL@" 14 | EMAIL="@EMAIL@" 15 | 16 | export BUILD_DIR 17 | export VERSION_NO_SUFFIX 18 | export VERSION_SUFFIX 19 | export VERSION 20 | export VENDOR 21 | export PROJECT 22 | export DESC 23 | export URL 24 | export EMAIL 25 | 26 | mkdir tmp 27 | 28 | if [[ ${VARIANT} == "brew" ]]; then 29 | bash generate_bottle.sh 30 | elif [[ ${VARIANT} == "deb" ]]; then 31 | bash generate_deb.sh 32 | elif [[ ${VARIANT} == "rpm" ]]; then 33 | bash generate_rpm.sh 34 | else 35 | echo "Error, unknown package type. Use either ['brew', 'deb', 'rpm']." 36 | exit -1 37 | fi 38 | 39 | BUILDSTATUS=$? 40 | 41 | rm -r tmp 42 | 43 | exit $BUILDSTATUS 44 | -------------------------------------------------------------------------------- /scripts/generate_rpm.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | PREFIX="usr" 4 | SPREFIX=${PREFIX} 5 | SUBPREFIX="opt/${PROJECT}/${VERSION}" 6 | SSUBPREFIX="opt\/${PROJECT}\/${VERSION}" 7 | RELEASE="${VERSION_SUFFIX}" 8 | 9 | # default release to "1" if there is no suffix 10 | if [[ -z $RELEASE ]]; then 11 | RELEASE="1" 12 | fi 13 | 14 | NAME="${PROJECT}-${VERSION_NO_SUFFIX}-${RELEASE}" 15 | 16 | export PREFIX 17 | export SUBPREFIX 18 | export SPREFIX 19 | export SSUBPREFIX 20 | 21 | bash generate_tarball.sh ${NAME}.tar.gz 22 | 23 | RPMBUILD=`realpath ~/rpmbuild/BUILDROOT/${NAME}.x86_64` 24 | mkdir -p ${RPMBUILD} 25 | FILES=$(tar -xvzf ${NAME}.tar.gz -C ${RPMBUILD}) 26 | PFILES="" 27 | for f in ${FILES[@]}; do 28 | if [ -f ${RPMBUILD}/${f} ]; then 29 | PFILES="${PFILES}/${f}\n" 30 | fi 31 | done 32 | echo -e ${PFILES} &> ~/rpmbuild/BUILD/filenames.txt 33 | 34 | mkdir -p ${PROJECT} 35 | echo -e "Name: ${PROJECT} 36 | Version: ${VERSION_NO_SUFFIX} 37 | License: MIT 38 | Vendor: ${VENDOR} 39 | Source: ${URL} 40 | Requires: openssl-devel, gmp-devel, libstdc++-devel, bzip2, bzip2-devel, mongodb, mongodb-server 41 | URL: ${URL} 42 | Packager: ${VENDOR} <${EMAIL}> 43 | Summary: ${DESC} 44 | Release: ${RELEASE} 45 | %description 46 | ${DESC} 47 | %files -f filenames.txt" &> ${PROJECT}.spec 48 | 49 | rpmbuild -bb ${PROJECT}.spec 50 | BUILDSTATUS=$? 51 | mv ~/rpmbuild/RPMS/x86_64 ./ 52 | rm -r ${PROJECT} ~/rpmbuild/BUILD/filenames.txt ${PROJECT}.spec 53 | 54 | exit $BUILDSTATUS 55 | -------------------------------------------------------------------------------- /scripts/generate_tarball.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | NAME=$1 4 | EOS_PREFIX=${PREFIX}/${SUBPREFIX} 5 | mkdir -p ${PREFIX}/bin/ 6 | #mkdir -p ${PREFIX}/lib/cmake/${PROJECT} 7 | mkdir -p ${EOS_PREFIX}/bin 8 | mkdir -p ${EOS_PREFIX}/licenses/eosio 9 | #mkdir -p ${EOS_PREFIX}/include 10 | #mkdir -p ${EOS_PREFIX}/lib/cmake/${PROJECT} 11 | #mkdir -p ${EOS_PREFIX}/cmake 12 | #mkdir -p ${EOS_PREFIX}/scripts 13 | 14 | # install binaries 15 | cp -R ${BUILD_DIR}/bin/* ${EOS_PREFIX}/bin 16 | 17 | # install licenses 18 | cp -R ${BUILD_DIR}/licenses/eosio/* ${EOS_PREFIX}/licenses 19 | 20 | # install libraries 21 | #cp -R ${BUILD_DIR}/lib/* ${EOS_PREFIX}/lib 22 | 23 | # install cmake modules 24 | #sed "s/_PREFIX_/\/${SPREFIX}/g" ${BUILD_DIR}/modules/EosioTesterPackage.cmake &> ${EOS_PREFIX}/lib/cmake/${PROJECT}/EosioTester.cmake 25 | #sed "s/_PREFIX_/\/${SPREFIX}\/${SSUBPREFIX}/g" ${BUILD_DIR}/modules/${PROJECT}-config.cmake.package &> ${EOS_PREFIX}/lib/cmake/${PROJECT}/${PROJECT}-config.cmake 26 | 27 | # install includes 28 | #cp -R ${BUILD_DIR}/include/* ${EOS_PREFIX}/include 29 | 30 | # make symlinks 31 | #pushd ${PREFIX}/lib/cmake/${PROJECT} &> /dev/null 32 | #ln -sf ../../../${SUBPREFIX}/lib/cmake/${PROJECT}/${PROJECT}-config.cmake ${PROJECT}-config.cmake 33 | #ln -sf ../../../${SUBPREFIX}/lib/cmake/${PROJECT}/EosioTester.cmake EosioTester.cmake 34 | #popd &> /dev/null 35 | 36 | pushd ${PREFIX}/bin &> /dev/null 37 | for f in `ls ${BUILD_DIR}/bin/`; do 38 | bn=$(basename $f) 39 | ln -sf ../${SUBPREFIX}/bin/$bn $bn 40 | done 41 | popd &> /dev/null 42 | 43 | tar -cvzf $NAME ./${PREFIX}/* 44 | rm -r ${PREFIX} 45 | -------------------------------------------------------------------------------- /tests/core_symbol.py: -------------------------------------------------------------------------------- 1 | CORE_SYMBOL='SYS' 2 | -------------------------------------------------------------------------------- /tests/core_symbol.py.in: -------------------------------------------------------------------------------- 1 | CORE_SYMBOL='${CORE_SYMBOL_NAME}' -------------------------------------------------------------------------------- /tests/impaired_network.py: -------------------------------------------------------------------------------- 1 | import testUtils 2 | import p2p_test_peers 3 | import random 4 | 5 | RemoteCmd = p2p_test_peers.P2PTestPeers 6 | 7 | class ImpairedNetwork: 8 | cmd="tc qdisc add dev {dev} root tbf limit 65536 burst 65536 rate" 9 | args=["1mbps","500kbps","100kbps","10kbps","1kbps"] #,"1bps"] 10 | 11 | resetcmd="tc qdisc del dev {dev} root" 12 | 13 | def maxIndex(self): 14 | return len(self.args) 15 | 16 | def execute(self, cmdInd, node, testerAccount, eosio): 17 | print("\n==== impaired network test: set network speed to %s ====" % (self.args[cmdInd])) 18 | RemoteCmd.exec(self.cmd + " " + self.args[cmdInd]) 19 | s="" 20 | for i in range(12): 21 | s=s+random.choice("abcdefghijklmnopqrstuvwxyz12345") 22 | testerAccount.name = s 23 | transIdlist = [] 24 | print("==== creating account %s ====" % (s)) 25 | trans = node.createAccount(testerAccount, eosio, stakedDeposit=0, waitForTransBlock=True) 26 | if trans is None: 27 | return ([], "", 0.0, "failed to create account") 28 | transIdlist.append(node.getTransId(trans)) 29 | return (transIdlist, "", 0.0, "") 30 | 31 | def on_exit(self): 32 | RemoteCmd.exec(self.resetcmd) 33 | -------------------------------------------------------------------------------- /tests/lossy_network.py: -------------------------------------------------------------------------------- 1 | import testUtils 2 | import p2p_test_peers 3 | import random 4 | 5 | RemoteCmd = p2p_test_peers.P2PTestPeers 6 | 7 | class LossyNetwork: 8 | cmd="tc qdisc add dev {dev} root netem loss" 9 | args=["0%", "1%", "10%", "50%", "90%", "99%"] 10 | 11 | resetcmd="tc qdisc del dev {dev} root" 12 | 13 | def maxIndex(self): 14 | return len(self.args) 15 | 16 | def execute(self, cmdInd, node, testerAccount, eosio): 17 | print("\n==== lossy network test: set loss ratio to %s ====" % (self.args[cmdInd])) 18 | RemoteCmd.exec(self.cmd + " " + self.args[cmdInd]) 19 | s="" 20 | for i in range(12): 21 | s=s+random.choice("abcdefghijklmnopqrstuvwxyz12345") 22 | testerAccount.name = s 23 | transIdlist = [] 24 | print("==== creating account %s ====" % (s)) 25 | trans = node.createAccount(testerAccount, eosio, stakedDeposit=0, waitForTransBlock=True) 26 | if trans is None: 27 | return ([], "", 0.0, "failed to create account") 28 | transIdlist.append(node.getTransId(trans)) 29 | return (transIdlist, "", 0.0, "") 30 | 31 | def on_exit(self): 32 | RemoteCmd.exec(self.resetcmd) 33 | -------------------------------------------------------------------------------- /tests/sample-cluster-map.json: -------------------------------------------------------------------------------- 1 | { 2 | "keys": { 3 | "initaPrivateKey": "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3", 4 | "initbPrivateKey": "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" 5 | }, 6 | "nodes": [ 7 | {"port": 8888, "host": "localhost"}, 8 | {"port": 8889, "host": "localhost"}, 9 | {"port": 8890, "host": "localhost"} 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/llvm-gcov.sh ${CMAKE_CURRENT_BINARY_DIR}/llvm-gcov.sh COPYONLY) 2 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ctestwrapper.sh ${CMAKE_CURRENT_BINARY_DIR}/ctestwrapper.sh COPYONLY) 3 | -------------------------------------------------------------------------------- /tools/ctestwrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # run ctest, disregard failure code 3 | ctest --output-on-failure $@ 4 | exit 0 5 | -------------------------------------------------------------------------------- /tools/llvm-gcov.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | exec llvm-cov gcov "$@" 3 | -------------------------------------------------------------------------------- /tutorials/bios-boot-tutorial/.gitignore: -------------------------------------------------------------------------------- 1 | nodes/ 2 | wallet/ 3 | output.log 4 | -------------------------------------------------------------------------------- /tutorials/bios-boot-tutorial/genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "initial_timestamp": "2018-03-02T12:00:00.000", 3 | "initial_key": "EOS8Znrtgwt8TfpmbVpTKvA2oB8Nqey625CLN8bCN3TEbgx86Dsvr", 4 | "initial_configuration": { 5 | "max_block_net_usage": 1048576, 6 | "target_block_net_usage_pct": 1000, 7 | "max_transaction_net_usage": 524288, 8 | "base_per_transaction_net_usage": 12, 9 | "net_usage_leeway": 500, 10 | "context_free_discount_net_usage_num": 20, 11 | "context_free_discount_net_usage_den": 100, 12 | "max_block_cpu_usage": 100000, 13 | "target_block_cpu_usage_pct": 500, 14 | "max_transaction_cpu_usage": 50000, 15 | "min_transaction_cpu_usage": 100, 16 | "max_transaction_lifetime": 3600, 17 | "deferred_trx_expiration_window": 600, 18 | "max_transaction_delay": 3888000, 19 | "max_inline_action_size": 4096, 20 | "max_inline_action_depth": 4, 21 | "max_authority_depth": 6 22 | }, 23 | "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000" 24 | } 25 | -------------------------------------------------------------------------------- /tutorials/exchange-tutorial-python/README.md: -------------------------------------------------------------------------------- 1 | The following steps must be taken for the example script to work. 2 | 3 | 0. Create wallet 4 | 0. Create account for eosio.token 5 | 0. Create account for scott 6 | 0. Create account for exchange 7 | 0. Set token contract on eosio.token 8 | 0. Create EOS token 9 | 0. Issue initial tokens to scott 10 | 11 | **Note**: 12 | Deleting the `transactions.txt` file will prevent replay from working. 13 | 14 | 15 | ### Create wallet 16 | `cleos wallet create` 17 | 18 | ### Create account steps 19 | `cleos create key` 20 | 21 | `cleos create key` 22 | 23 | `cleos wallet import --private-key ` 24 | 25 | `cleos wallet import --private-key ` 26 | 27 | `cleos create account eosio ` 28 | 29 | ### Set contract steps 30 | `cleos set contract eosio.token /contracts/eosio.token -p eosio.token@active` 31 | 32 | ### Create EOS token steps 33 | `cleos push action eosio.token create '{"issuer": "eosio.token", "maximum_supply": "100000.0000 EOS", "can_freeze": 1, "can_recall": 1, "can_whitelist": 1}' -p eosio.token@active` 34 | 35 | ### Issue token steps 36 | `cleos push action eosio.token issue '{"to": "scott", "quantity": "900.0000 EOS", "memo": "testing"}' -p eosio.token@active` 37 | -------------------------------------------------------------------------------- /unittests/block_timestamp_tests.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace eosio; 12 | using namespace chain; 13 | 14 | 15 | 16 | BOOST_AUTO_TEST_SUITE(block_timestamp_tests) 17 | 18 | 19 | BOOST_AUTO_TEST_CASE(constructor_test) { 20 | block_timestamp_type bt; 21 | BOOST_TEST( bt.slot == 0, "Default constructor gives wrong value"); 22 | 23 | fc::time_point t(fc::seconds(978307200)); 24 | block_timestamp_type bt2(t); 25 | BOOST_TEST( bt2.slot == (978307200 - 946684800)*2, "Time point constructor gives wrong value"); 26 | } 27 | 28 | BOOST_AUTO_TEST_CASE(conversion_test) { 29 | block_timestamp_type bt; 30 | fc::time_point t = (fc::time_point)bt; 31 | BOOST_TEST(t.time_since_epoch().to_seconds() == 946684800ll, "Time point conversion failed"); 32 | 33 | block_timestamp_type bt1(200); 34 | t = (fc::time_point)bt1; 35 | BOOST_TEST(t.time_since_epoch().to_seconds() == 946684900ll, "Time point conversion failed"); 36 | 37 | } 38 | 39 | BOOST_AUTO_TEST_SUITE_END() 40 | -------------------------------------------------------------------------------- /unittests/contracts/80k_deep_loop_with_ret.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/80k_deep_loop_with_ret.wasm -------------------------------------------------------------------------------- /unittests/contracts/80k_deep_loop_with_void.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/80k_deep_loop_with_void.wasm -------------------------------------------------------------------------------- /unittests/contracts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # will be implictly used for any compilation unit if not overrided by SYSTEM_INCLUDE_FOLDERS parameter 2 | # these directories go as -isystem to avoid warnings from code of third-party libraries 3 | 4 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/eosio.bios/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/eosio.bios/) 5 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/eosio.msig/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/eosio.msig/) 6 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/eosio.system/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/eosio.system/) 7 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/eosio.token/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/eosio.token/) 8 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/eosio.wrap/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/eosio.wrap/) 9 | 10 | -------------------------------------------------------------------------------- /unittests/contracts/big_allocation.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/big_allocation.wasm -------------------------------------------------------------------------------- /unittests/contracts/crash_section_size_too_big.wasm: -------------------------------------------------------------------------------- 1 | asm -------------------------------------------------------------------------------- /unittests/contracts/deep_loops_ext_report.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/deep_loops_ext_report.wasm -------------------------------------------------------------------------------- /unittests/contracts/eosio.bios/eosio.bios.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/eosio.bios/eosio.bios.wasm -------------------------------------------------------------------------------- /unittests/contracts/eosio.msig/eosio.msig.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/eosio.msig/eosio.msig.wasm -------------------------------------------------------------------------------- /unittests/contracts/eosio.system/eosio.system.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/eosio.system/eosio.system.wasm -------------------------------------------------------------------------------- /unittests/contracts/eosio.token/eosio.token.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/eosio.token/eosio.token.wasm -------------------------------------------------------------------------------- /unittests/contracts/eosio.wrap/eosio.wrap.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/eosio.wrap/eosio.wrap.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz1.wasm: -------------------------------------------------------------------------------- 1 | asm` 2 |  n -------------------------------------------------------------------------------- /unittests/contracts/fuzz10.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz10.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz11.wasm: -------------------------------------------------------------------------------- 1 | asm` -------------------------------------------------------------------------------- /unittests/contracts/fuzz12.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz12.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz13.wasm: -------------------------------------------------------------------------------- 1 | asm -------------------------------------------------------------------------------- /unittests/contracts/fuzz14.wasm: -------------------------------------------------------------------------------- 1 | asmmf -------------------------------------------------------------------------------- /unittests/contracts/fuzz15.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz15.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz2.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz2.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz3.wasm: -------------------------------------------------------------------------------- 1 | asm` 2 | ||||||||||| 3 | 1/          namdm'in -------------------------------------------------------------------------------- /unittests/contracts/fuzz4.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz4.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz5.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz5.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz6.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz6.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz7.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz7.wasm -------------------------------------------------------------------------------- /unittests/contracts/fuzz8.wasm: -------------------------------------------------------------------------------- 1 | asm -------------------------------------------------------------------------------- /unittests/contracts/fuzz9.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/fuzz9.wasm -------------------------------------------------------------------------------- /unittests/contracts/getcode_deepindent.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/getcode_deepindent.wasm -------------------------------------------------------------------------------- /unittests/contracts/indent-mismatch.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/indent-mismatch.wasm -------------------------------------------------------------------------------- /unittests/contracts/leak_no_destructor.wasm: -------------------------------------------------------------------------------- 1 | asm -------------------------------------------------------------------------------- /unittests/contracts/leak_readExports.wasm: -------------------------------------------------------------------------------- 1 | asm -------------------------------------------------------------------------------- /unittests/contracts/leak_readFunctions.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/leak_readFunctions.wasm -------------------------------------------------------------------------------- /unittests/contracts/leak_readFunctions_2.wasm: -------------------------------------------------------------------------------- 1 | asm` 2 |   -------------------------------------------------------------------------------- /unittests/contracts/leak_readFunctions_3.wasm: -------------------------------------------------------------------------------- 1 | asm` 2 |  -------------------------------------------------------------------------------- /unittests/contracts/leak_readGlobals.wasm: -------------------------------------------------------------------------------- 1 | asm -------------------------------------------------------------------------------- /unittests/contracts/leak_readImports.wasm: -------------------------------------------------------------------------------- 1 | asm' -------------------------------------------------------------------------------- /unittests/contracts/leak_wasm_binary_cpp_L1249.wasm: -------------------------------------------------------------------------------- 1 | asm -------------------------------------------------------------------------------- /unittests/contracts/locals-s.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/locals-s.wasm -------------------------------------------------------------------------------- /unittests/contracts/locals-yc.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/locals-yc.wasm -------------------------------------------------------------------------------- /unittests/contracts/readFunctions_slowness_out_of_memory.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/readFunctions_slowness_out_of_memory.wasm -------------------------------------------------------------------------------- /unittests/contracts/slowwasm_localsets.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/contracts/slowwasm_localsets.wasm -------------------------------------------------------------------------------- /unittests/fuzz13.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/fuzz13.wasm -------------------------------------------------------------------------------- /unittests/include/config.hpp.in: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | 6 | namespace eosio { namespace unittests { namespace config { 7 | constexpr char eosiolib_path[] = "${CMAKE_CURRENT_SOURCE_DIR}/../contracts"; 8 | constexpr char core_symbol_path[] = "${CMAKE_BINARY_DIR}/contracts"; 9 | constexpr char pfr_include_path[] = "${CMAKE_CURRENT_SOURCE_DIR}/../externals/magic_get/include"; 10 | constexpr char boost_include_path[] = "${Boost_INCLUDE_DIR}"; 11 | }}} 12 | -------------------------------------------------------------------------------- /unittests/test-contracts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | set(EOSIO_WASM_OLD_BEHAVIOR "Off") 3 | find_package( eosio.cdt REQUIRED ) 4 | endif() 5 | 6 | if ("${CMAKE_GENERATOR}" STREQUAL "Ninja") 7 | add_compile_options(-fcolor-diagnostics) 8 | endif() 9 | 10 | add_subdirectory( asserter ) 11 | add_subdirectory( deferred_test ) 12 | add_subdirectory( get_sender_test ) 13 | add_subdirectory( get_table_test ) 14 | add_subdirectory( integration_test ) 15 | add_subdirectory( noop ) 16 | add_subdirectory( payloadless ) 17 | add_subdirectory( proxy ) 18 | add_subdirectory( ram_restrictions_test ) 19 | add_subdirectory( reject_all ) 20 | add_subdirectory( restrict_action_test ) 21 | add_subdirectory( snapshot_test ) 22 | add_subdirectory( test_api ) 23 | add_subdirectory( test_api_db ) 24 | add_subdirectory( test_api_multi_index ) 25 | add_subdirectory( test_ram_limit ) 26 | -------------------------------------------------------------------------------- /unittests/test-contracts/README.md: -------------------------------------------------------------------------------- 1 | test_ram_limit contract was compiled with eosio.cdt v1.4.1 2 | 3 | That contract was ported to compile with eosio.cdt v1.5.0, but the test that uses it is very sensitive to stdlib/eosiolib changes, compilation flags and linker flags. 4 | 5 | deferred_test, get_sender_test, proxy, reject_all, and test_api contracts were compiled with eosio.cdt v1.6.1 6 | 7 | The remaining contracts have been ported to compile with eosio.cdt v1.6.x. They were compiled with a patched version of eosio.cdt v1.6.0-rc1 (commit 1c9180ff5a1e431385180ce459e11e6a1255c1a4). 8 | -------------------------------------------------------------------------------- /unittests/test-contracts/asserter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( asserter asserter asserter.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/asserter.wasm ${CMAKE_CURRENT_BINARY_DIR}/asserter.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/asserter.abi ${CMAKE_CURRENT_BINARY_DIR}/asserter.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/asserter/asserter.abi: -------------------------------------------------------------------------------- 1 | { 2 | "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", 3 | "version": "eosio::abi/1.1", 4 | "types": [], 5 | "structs": [ 6 | { 7 | "name": "procassert", 8 | "base": "", 9 | "fields": [ 10 | { 11 | "name": "condition", 12 | "type": "int8" 13 | }, 14 | { 15 | "name": "message", 16 | "type": "string" 17 | } 18 | ] 19 | }, 20 | { 21 | "name": "provereset", 22 | "base": "", 23 | "fields": [] 24 | } 25 | ], 26 | "actions": [ 27 | { 28 | "name": "procassert", 29 | "type": "procassert", 30 | "ricardian_contract": "" 31 | }, 32 | { 33 | "name": "provereset", 34 | "type": "provereset", 35 | "ricardian_contract": "" 36 | } 37 | ], 38 | "tables": [], 39 | "ricardian_clauses": [], 40 | "variants": [] 41 | } -------------------------------------------------------------------------------- /unittests/test-contracts/asserter/asserter.cpp: -------------------------------------------------------------------------------- 1 | #include "asserter.hpp" 2 | 3 | using namespace eosio; 4 | 5 | static int global_variable = 45; 6 | 7 | void asserter::procassert( int8_t condition, std::string message ) { 8 | check( condition != 0, message ); 9 | } 10 | 11 | void asserter::provereset() { 12 | check( global_variable == 45, "Global Variable Initialized poorly" ); 13 | global_variable = 100; 14 | } 15 | -------------------------------------------------------------------------------- /unittests/test-contracts/asserter/asserter.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class [[eosio::contract]] asserter : public eosio::contract { 6 | public: 7 | using eosio::contract::contract; 8 | 9 | [[eosio::action]] 10 | void procassert( int8_t condition, std::string message ); 11 | 12 | [[eosio::action]] 13 | void provereset(); 14 | }; 15 | -------------------------------------------------------------------------------- /unittests/test-contracts/asserter/asserter.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/asserter/asserter.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/deferred_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( deferred_test deferred_test deferred_test.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/deferred_test.wasm ${CMAKE_CURRENT_BINARY_DIR}/deferred_test.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/deferred_test.abi ${CMAKE_CURRENT_BINARY_DIR}/deferred_test.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/deferred_test/deferred_test.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class [[eosio::contract]] deferred_test : public eosio::contract { 7 | public: 8 | using eosio::contract::contract; 9 | 10 | [[eosio::action]] 11 | void defercall( eosio::name payer, uint64_t sender_id, eosio::name contract, uint64_t payload ); 12 | 13 | [[eosio::action]] 14 | void delayedcall( eosio::name payer, uint64_t sender_id, eosio::name contract, 15 | uint64_t payload, uint32_t delay_sec, bool replace_existing ); 16 | 17 | [[eosio::action]] 18 | void deferfunc( uint64_t payload ); 19 | using deferfunc_action = eosio::action_wrapper<"deferfunc"_n, &deferred_test::deferfunc>; 20 | 21 | [[eosio::action]] 22 | void inlinecall( eosio::name contract, eosio::name authorizer, uint64_t payload ); 23 | 24 | [[eosio::action]] 25 | void fail(); 26 | 27 | [[eosio::on_notify("eosio::onerror")]] 28 | void on_error( uint128_t sender_id, eosio::ignore> sent_trx ); 29 | }; 30 | -------------------------------------------------------------------------------- /unittests/test-contracts/deferred_test/deferred_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/deferred_test/deferred_test.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/get_sender_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( get_sender_test get_sender_test get_sender_test.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/get_sender_test.wasm ${CMAKE_CURRENT_BINARY_DIR}/get_sender_test.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/get_sender_test.abi ${CMAKE_CURRENT_BINARY_DIR}/get_sender_test.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/get_sender_test/get_sender_test.cpp: -------------------------------------------------------------------------------- 1 | #include "get_sender_test.hpp" 2 | #include 3 | 4 | using namespace eosio; 5 | 6 | void get_sender_test::assertsender( name expected_sender ) { 7 | check( get_sender() == expected_sender, "sender did not match" ); 8 | } 9 | 10 | void get_sender_test::sendinline( name to, name expected_sender ) { 11 | assertsender_action a( to, std::vector{} ); 12 | a.send( expected_sender ); 13 | } 14 | 15 | void get_sender_test::notify( name to, name expected_sender, bool send_inline ) { 16 | require_recipient( to ); 17 | } 18 | 19 | void get_sender_test::on_notify( name to, name expected_sender, bool send_inline ) { 20 | if( send_inline ) { 21 | assertsender_action a( get_first_receiver(), std::vector{} ); 22 | a.send( expected_sender ); 23 | } else { 24 | check( get_sender() == expected_sender, "sender did not match" ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /unittests/test-contracts/get_sender_test/get_sender_test.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace eosio { 6 | namespace internal_use_do_not_use { 7 | extern "C" { 8 | __attribute__((eosio_wasm_import)) 9 | uint64_t get_sender(); 10 | } 11 | } 12 | } 13 | 14 | namespace eosio { 15 | name get_sender() { 16 | return name( internal_use_do_not_use::get_sender() ); 17 | } 18 | } 19 | 20 | class [[eosio::contract]] get_sender_test : public eosio::contract { 21 | public: 22 | using eosio::contract::contract; 23 | 24 | [[eosio::action]] 25 | void assertsender( eosio::name expected_sender ); 26 | using assertsender_action = eosio::action_wrapper<"assertsender"_n, &get_sender_test::assertsender>; 27 | 28 | [[eosio::action]] 29 | void sendinline( eosio::name to, eosio::name expected_sender ); 30 | 31 | [[eosio::action]] 32 | void notify( eosio::name to, eosio::name expected_sender, bool send_inline ); 33 | 34 | // eosio.cdt 1.6.1 has a problem with "*::notify" so hardcode to tester1 for now. 35 | // TODO: Change it back to "*::notify" when the bug is fixed in eosio.cdt. 36 | [[eosio::on_notify("tester1::notify")]] 37 | void on_notify( eosio::name to, eosio::name expected_sender, bool send_inline ); 38 | 39 | }; 40 | -------------------------------------------------------------------------------- /unittests/test-contracts/get_sender_test/get_sender_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/get_sender_test/get_sender_test.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/get_table_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( get_table_test get_table_test get_table_test.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/get_table_test.wasm ${CMAKE_CURRENT_BINARY_DIR}/get_table_test.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/get_table_test.abi ${CMAKE_CURRENT_BINARY_DIR}/get_table_test.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/get_table_test/get_table_test.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @copyright defined in eos/LICENSE 4 | */ 5 | #include "get_table_test.hpp" 6 | 7 | void get_table_test::addnumobj(uint64_t input) { 8 | numobjs numobjs_table( _self, _self.value ); 9 | numobjs_table.emplace(_self, [&]( auto& obj ) { 10 | obj.key = numobjs_table.available_primary_key(); 11 | obj.sec64 = input; 12 | obj.sec128 = input; 13 | obj.secdouble = input; 14 | obj.secldouble = input; 15 | }); 16 | } 17 | 18 | void get_table_test::addhashobj(std::string hashinput) { 19 | hashobjs hashobjs_table( _self, _self.value ); 20 | hashobjs_table.emplace(_self, [&]( auto& obj ) { 21 | obj.key = hashobjs_table.available_primary_key(); 22 | obj.hash_input = hashinput; 23 | obj.sec256 = sha256(hashinput.data(), hashinput.size()); 24 | obj.sec160 = ripemd160(hashinput.data(), hashinput.size()); 25 | }); 26 | } -------------------------------------------------------------------------------- /unittests/test-contracts/get_table_test/get_table_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/get_table_test/get_table_test.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/integration_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( integration_test integration_test integration_test.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/integration_test.wasm ${CMAKE_CURRENT_BINARY_DIR}/integration_test.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/integration_test.abi ${CMAKE_CURRENT_BINARY_DIR}/integration_test.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/integration_test/integration_test.abi: -------------------------------------------------------------------------------- 1 | { 2 | "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", 3 | "version": "eosio::abi/1.1", 4 | "types": [], 5 | "structs": [ 6 | { 7 | "name": "payload", 8 | "base": "", 9 | "fields": [ 10 | { 11 | "name": "key", 12 | "type": "uint64" 13 | }, 14 | { 15 | "name": "data", 16 | "type": "uint64[]" 17 | } 18 | ] 19 | }, 20 | { 21 | "name": "store", 22 | "base": "", 23 | "fields": [ 24 | { 25 | "name": "from", 26 | "type": "name" 27 | }, 28 | { 29 | "name": "to", 30 | "type": "name" 31 | }, 32 | { 33 | "name": "num", 34 | "type": "uint64" 35 | } 36 | ] 37 | } 38 | ], 39 | "actions": [ 40 | { 41 | "name": "store", 42 | "type": "store", 43 | "ricardian_contract": "" 44 | } 45 | ], 46 | "tables": [ 47 | { 48 | "name": "payloads", 49 | "type": "payload", 50 | "index_type": "i64", 51 | "key_names": [], 52 | "key_types": [] 53 | } 54 | ], 55 | "ricardian_clauses": [], 56 | "variants": [] 57 | } -------------------------------------------------------------------------------- /unittests/test-contracts/integration_test/integration_test.cpp: -------------------------------------------------------------------------------- 1 | #include "integration_test.hpp" 2 | 3 | using namespace eosio; 4 | 5 | void integration_test::store( name from, name to, uint64_t num ) { 6 | require_auth( from ); 7 | 8 | check( is_account( to ), "to account does not exist" ); 9 | check( num < std::numeric_limits::max(), "num to large" ); 10 | 11 | payloads_table data( get_self(), from.value ); 12 | uint64_t key = 0; 13 | const uint64_t num_keys = 5; 14 | 15 | while( data.find( key ) != data.end() ) { 16 | key += num_keys; 17 | } 18 | 19 | for( uint64_t i = 0; i < num_keys; ++i ) { 20 | data.emplace( from, [&]( auto& g ) { 21 | g.key = key + i; 22 | g.data = std::vector( static_cast(num), 5 ); 23 | } ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /unittests/test-contracts/integration_test/integration_test.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class [[eosio::contract]] integration_test : public eosio::contract { 6 | public: 7 | using eosio::contract::contract; 8 | 9 | [[eosio::action]] 10 | void store( eosio::name from, eosio::name to, uint64_t num ); 11 | 12 | struct [[eosio::table("payloads")]] payload { 13 | uint64_t key; 14 | std::vector data; 15 | 16 | uint64_t primary_key()const { return key; } 17 | 18 | EOSLIB_SERIALIZE( payload, (key)(data) ) 19 | }; 20 | 21 | using payloads_table = eosio::multi_index< "payloads"_n, payload >; 22 | 23 | }; 24 | -------------------------------------------------------------------------------- /unittests/test-contracts/integration_test/integration_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/integration_test/integration_test.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/noop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( noop noop noop.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/noop.wasm ${CMAKE_CURRENT_BINARY_DIR}/noop.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/noop.abi ${CMAKE_CURRENT_BINARY_DIR}/noop.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/noop/noop.abi: -------------------------------------------------------------------------------- 1 | { 2 | "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", 3 | "version": "eosio::abi/1.1", 4 | "types": [], 5 | "structs": [ 6 | { 7 | "name": "anyaction", 8 | "base": "", 9 | "fields": [ 10 | { 11 | "name": "from", 12 | "type": "name" 13 | }, 14 | { 15 | "name": "type", 16 | "type": "string" 17 | }, 18 | { 19 | "name": "data", 20 | "type": "string" 21 | } 22 | ] 23 | } 24 | ], 25 | "actions": [ 26 | { 27 | "name": "anyaction", 28 | "type": "anyaction", 29 | "ricardian_contract": "" 30 | } 31 | ], 32 | "tables": [], 33 | "ricardian_clauses": [], 34 | "variants": [] 35 | } -------------------------------------------------------------------------------- /unittests/test-contracts/noop/noop.cpp: -------------------------------------------------------------------------------- 1 | #include "noop.hpp" 2 | 3 | using namespace eosio; 4 | 5 | void noop::anyaction( name from, 6 | const ignore& type, 7 | const ignore& data ) 8 | { 9 | require_auth( from ); 10 | } 11 | -------------------------------------------------------------------------------- /unittests/test-contracts/noop/noop.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class [[eosio::contract]] noop : public eosio::contract { 6 | public: 7 | using eosio::contract::contract; 8 | 9 | [[eosio::action]] 10 | void anyaction( eosio::name from, 11 | const eosio::ignore& type, 12 | const eosio::ignore& data ); 13 | }; 14 | -------------------------------------------------------------------------------- /unittests/test-contracts/noop/noop.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/noop/noop.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/payloadless/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( payloadless payloadless payloadless.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/payloadless.wasm ${CMAKE_CURRENT_BINARY_DIR}/payloadless.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/payloadless.abi ${CMAKE_CURRENT_BINARY_DIR}/payloadless.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/payloadless/payloadless.abi: -------------------------------------------------------------------------------- 1 | { 2 | "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", 3 | "version": "eosio::abi/1.1", 4 | "types": [], 5 | "structs": [ 6 | { 7 | "name": "doit", 8 | "base": "", 9 | "fields": [] 10 | } 11 | ], 12 | "actions": [ 13 | { 14 | "name": "doit", 15 | "type": "doit", 16 | "ricardian_contract": "" 17 | } 18 | ], 19 | "tables": [], 20 | "ricardian_clauses": [], 21 | "variants": [] 22 | } -------------------------------------------------------------------------------- /unittests/test-contracts/payloadless/payloadless.cpp: -------------------------------------------------------------------------------- 1 | #include "payloadless.hpp" 2 | 3 | using namespace eosio; 4 | 5 | void payloadless::doit() { 6 | print("Im a payloadless action"); 7 | } 8 | -------------------------------------------------------------------------------- /unittests/test-contracts/payloadless/payloadless.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class [[eosio::contract]] payloadless : public eosio::contract { 6 | public: 7 | using eosio::contract::contract; 8 | 9 | [[eosio::action]] 10 | void doit(); 11 | }; 12 | -------------------------------------------------------------------------------- /unittests/test-contracts/payloadless/payloadless.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/payloadless/payloadless.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/proxy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( proxy proxy proxy.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/proxy.wasm ${CMAKE_CURRENT_BINARY_DIR}/proxy.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/proxy.abi ${CMAKE_CURRENT_BINARY_DIR}/proxy.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/proxy/proxy.abi: -------------------------------------------------------------------------------- 1 | { 2 | "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", 3 | "version": "eosio::abi/1.1", 4 | "types": [], 5 | "structs": [ 6 | { 7 | "name": "config", 8 | "base": "", 9 | "fields": [ 10 | { 11 | "name": "owner", 12 | "type": "name" 13 | }, 14 | { 15 | "name": "delay", 16 | "type": "uint32" 17 | }, 18 | { 19 | "name": "next_id", 20 | "type": "uint32" 21 | } 22 | ] 23 | }, 24 | { 25 | "name": "setowner", 26 | "base": "", 27 | "fields": [ 28 | { 29 | "name": "owner", 30 | "type": "name" 31 | }, 32 | { 33 | "name": "delay", 34 | "type": "uint32" 35 | } 36 | ] 37 | } 38 | ], 39 | "actions": [ 40 | { 41 | "name": "setowner", 42 | "type": "setowner", 43 | "ricardian_contract": "" 44 | } 45 | ], 46 | "tables": [ 47 | { 48 | "name": "config", 49 | "type": "config", 50 | "index_type": "i64", 51 | "key_names": [], 52 | "key_types": [] 53 | } 54 | ], 55 | "ricardian_clauses": [], 56 | "variants": [] 57 | } -------------------------------------------------------------------------------- /unittests/test-contracts/proxy/proxy.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/proxy/proxy.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/ram_restrictions_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( ram_restrictions_test ram_restrictions_test ram_restrictions_test.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ram_restrictions_test.wasm ${CMAKE_CURRENT_BINARY_DIR}/ram_restrictions_test.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ram_restrictions_test.abi ${CMAKE_CURRENT_BINARY_DIR}/ram_restrictions_test.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/ram_restrictions_test/ram_restrictions_test.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class [[eosio::contract]] ram_restrictions_test : public eosio::contract { 6 | public: 7 | struct [[eosio::table]] data { 8 | uint64_t key; 9 | std::vector value; 10 | 11 | uint64_t primary_key() const { return key; } 12 | }; 13 | 14 | typedef eosio::multi_index<"tablea"_n, data> tablea; 15 | typedef eosio::multi_index<"tableb"_n, data> tableb; 16 | 17 | public: 18 | using eosio::contract::contract; 19 | 20 | [[eosio::action]] 21 | void noop(); 22 | 23 | [[eosio::action]] 24 | void setdata( uint32_t len1, uint32_t len2, eosio::name payer ); 25 | 26 | [[eosio::action]] 27 | void notifysetdat( eosio::name acctonotify, uint32_t len1, uint32_t len2, eosio::name payer ); 28 | 29 | [[eosio::on_notify("tester2::notifysetdat")]] 30 | void on_notify_setdata( eosio::name acctonotify, uint32_t len1, uint32_t len2, eosio::name payer ); 31 | 32 | [[eosio::action]] 33 | void senddefer( uint64_t senderid, eosio::name payer ); 34 | 35 | [[eosio::action]] 36 | void notifydefer( eosio::name acctonotify, uint64_t senderid, eosio::name payer ); 37 | 38 | [[eosio::on_notify("tester2::notifydefer")]] 39 | void on_notifydefer( eosio::name acctonotify, uint64_t senderid, eosio::name payer ); 40 | 41 | }; 42 | -------------------------------------------------------------------------------- /unittests/test-contracts/ram_restrictions_test/ram_restrictions_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/ram_restrictions_test/ram_restrictions_test.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/reject_all/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( reject_all reject_all reject_all.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/reject_all.wasm ${CMAKE_CURRENT_BINARY_DIR}/reject_all.wasm COPYONLY ) 5 | endif() 6 | -------------------------------------------------------------------------------- /unittests/test-contracts/reject_all/reject_all.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace eosio; 4 | 5 | extern "C" { 6 | void apply( uint64_t receiver, uint64_t first_receiver, uint64_t action ) { 7 | check( receiver == first_receiver, "rejecting all notifications" ); 8 | 9 | // reject all actions with only the following exceptions: 10 | // * do not reject an eosio::setcode that sets code on the eosio account unless the rejectall account exists; 11 | // * do not reject an eosio::newaccount that creates the rejectall account. 12 | 13 | if( first_receiver == "eosio"_n.value ) { 14 | if( action == "setcode"_n.value ) { 15 | auto accnt = unpack_action_data(); 16 | if( accnt == "eosio"_n && !is_account("rejectall"_n) ) 17 | return; 18 | } else if( action == "newaccount"_n.value ) { 19 | auto accnts = unpack_action_data< std::pair >(); 20 | if( accnts.second == "rejectall"_n ) 21 | return; 22 | } 23 | } 24 | 25 | check( false , "rejecting all actions" ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /unittests/test-contracts/reject_all/reject_all.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/reject_all/reject_all.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/restrict_action_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( restrict_action_test restrict_action_test restrict_action_test.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/restrict_action_test.wasm ${CMAKE_CURRENT_BINARY_DIR}/restrict_action_test.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/restrict_action_test.abi ${CMAKE_CURRENT_BINARY_DIR}/restrict_action_test.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/restrict_action_test/restrict_action_test.cpp: -------------------------------------------------------------------------------- 1 | #include "restrict_action_test.hpp" 2 | #include 3 | 4 | using namespace eosio; 5 | 6 | void restrict_action_test::noop( ) { 7 | 8 | } 9 | 10 | void restrict_action_test::sendinline( name authorizer ) { 11 | action( 12 | permission_level{authorizer,"active"_n}, 13 | get_self(), 14 | "noop"_n, 15 | std::make_tuple() 16 | ).send(); 17 | } 18 | 19 | void restrict_action_test::senddefer( name authorizer, uint32_t senderid ) { 20 | transaction trx; 21 | trx.actions.emplace_back( 22 | permission_level{authorizer,"active"_n}, 23 | get_self(), 24 | "noop"_n, 25 | std::make_tuple() 26 | ); 27 | trx.send(senderid, get_self()); 28 | } 29 | 30 | void restrict_action_test::notifyinline( name acctonotify, name authorizer ) { 31 | require_recipient(acctonotify); 32 | } 33 | 34 | void restrict_action_test::notifydefer( name acctonotify, name authorizer, uint32_t senderid ) { 35 | require_recipient(acctonotify); 36 | } 37 | 38 | void restrict_action_test::on_notify_inline( name acctonotify, name authorizer ) { 39 | sendinline(authorizer); 40 | } 41 | 42 | void restrict_action_test::on_notify_defer( name acctonotify, name authorizer, uint32_t senderid ) { 43 | senddefer(authorizer, senderid); 44 | } 45 | -------------------------------------------------------------------------------- /unittests/test-contracts/restrict_action_test/restrict_action_test.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class [[eosio::contract]] restrict_action_test : public eosio::contract { 6 | public: 7 | using eosio::contract::contract; 8 | 9 | [[eosio::action]] 10 | void noop( ); 11 | 12 | [[eosio::action]] 13 | void sendinline( eosio::name authorizer ); 14 | 15 | [[eosio::action]] 16 | void senddefer( eosio::name authorizer, uint32_t senderid ); 17 | 18 | 19 | [[eosio::action]] 20 | void notifyinline( eosio::name acctonotify, eosio::name authorizer ); 21 | 22 | [[eosio::action]] 23 | void notifydefer( eosio::name acctonotify, eosio::name authorizer, uint32_t senderid ); 24 | 25 | [[eosio::on_notify("testacc::notifyinline")]] 26 | void on_notify_inline( eosio::name acctonotify, eosio::name authorizer ); 27 | 28 | [[eosio::on_notify("testacc::notifydefer")]] 29 | void on_notify_defer( eosio::name acctonotify, eosio::name authorizer, uint32_t senderid ); 30 | }; 31 | -------------------------------------------------------------------------------- /unittests/test-contracts/restrict_action_test/restrict_action_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/restrict_action_test/restrict_action_test.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/snapshot_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( snapshot_test snapshot_test snapshot_test.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/snapshot_test.wasm ${CMAKE_CURRENT_BINARY_DIR}/snapshot_test.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/snapshot_test.abi ${CMAKE_CURRENT_BINARY_DIR}/snapshot_test.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/snapshot_test/snapshot_test.cpp: -------------------------------------------------------------------------------- 1 | #include "snapshot_test.hpp" 2 | 3 | using namespace eosio; 4 | 5 | void snapshot_test::increment( uint32_t value ) { 6 | require_auth( get_self() ); 7 | 8 | data_table data( get_self(), get_self().value ); 9 | 10 | auto current = data.begin(); 11 | if( current == data.end() ) { 12 | data.emplace( get_self(), [&]( auto& r ) { 13 | r.id = value; 14 | r.index_f64 = value; 15 | r.index_f128 = value; 16 | r.index_i64 = value; 17 | r.index_i128 = value; 18 | r.index_i256.data()[0] = value; 19 | } ); 20 | } else { 21 | data.modify( current, same_payer, [&]( auto& r ) { 22 | r.index_f64 += value; 23 | r.index_f128 += value; 24 | r.index_i64 += value; 25 | r.index_i128 += value; 26 | r.index_i256.data()[0] += value; 27 | } ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /unittests/test-contracts/snapshot_test/snapshot_test.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/snapshot_test/snapshot_test.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/test_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_executable( test_api test_api.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_api.wasm ${CMAKE_CURRENT_BINARY_DIR}/test_api.wasm COPYONLY ) 5 | endif() 6 | -------------------------------------------------------------------------------- /unittests/test-contracts/test_api/test_api.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/test_api/test_api.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/test_api/test_chain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "test_api.hpp" 6 | 7 | #pragma pack(push, 1) 8 | struct producers { 9 | char len; 10 | capi_name producers[21]; 11 | }; 12 | #pragma pack(pop) 13 | 14 | void test_chain::test_activeprods() { 15 | producers act_prods; 16 | read_action_data( &act_prods, sizeof(producers) ); 17 | 18 | eosio_assert( act_prods.len == 21, "producers.len != 21" ); 19 | 20 | producers api_prods; 21 | get_active_producers( api_prods.producers, sizeof(eosio::name)*21 ); 22 | 23 | for( int i = 0; i < 21 ; ++i ) 24 | eosio_assert( api_prods.producers[i] == act_prods.producers[i], "Active producer" ); 25 | } 26 | -------------------------------------------------------------------------------- /unittests/test-contracts/test_api_db/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( test_api_db test_api_db test_api_db.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_api_db.wasm ${CMAKE_CURRENT_BINARY_DIR}/test_api_db.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_api_db.abi ${CMAKE_CURRENT_BINARY_DIR}/test_api_db.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/test_api_db/test_api_db.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class [[eosio::contract]] test_api_db : public eosio::contract { 6 | public: 7 | using eosio::contract::contract; 8 | 9 | [[eosio::action("pg")]] 10 | void primary_i64_general(); 11 | 12 | [[eosio::action("pl")]] 13 | void primary_i64_lowerbound(); 14 | 15 | [[eosio::action("pu")]] 16 | void primary_i64_upperbound(); 17 | 18 | [[eosio::action("s1g")]] 19 | void idx64_general(); 20 | 21 | [[eosio::action("s1l")]] 22 | void idx64_lowerbound(); 23 | 24 | [[eosio::action("s1u")]] 25 | void idx64_upperbound(); 26 | 27 | [[eosio::action("tia")]] 28 | void test_invalid_access( eosio::name code, uint64_t val, uint32_t index, bool store ); 29 | 30 | [[eosio::action("sdnancreate")]] 31 | void idx_double_nan_create_fail(); 32 | 33 | [[eosio::action("sdnanmodify")]] 34 | void idx_double_nan_modify_fail(); 35 | 36 | [[eosio::action("sdnanlookup")]] 37 | void idx_double_nan_lookup_fail( uint32_t lookup_type ); 38 | 39 | [[eosio::action("sk32align")]] 40 | void misaligned_secondary_key256_tests(); 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /unittests/test-contracts/test_api_db/test_api_db.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/test_api_db/test_api_db.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/test_api_multi_index/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | add_contract( test_api_multi_index test_api_multi_index test_api_multi_index.cpp ) 3 | else() 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_api_multi_index.wasm ${CMAKE_CURRENT_BINARY_DIR}/test_api_multi_index.wasm COPYONLY ) 5 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_api_multi_index.abi ${CMAKE_CURRENT_BINARY_DIR}/test_api_multi_index.abi COPYONLY ) 6 | endif() 7 | -------------------------------------------------------------------------------- /unittests/test-contracts/test_api_multi_index/test_api_multi_index.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/test_api_multi_index/test_api_multi_index.wasm -------------------------------------------------------------------------------- /unittests/test-contracts/test_ram_limit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( EOSIO_COMPILE_TEST_CONTRACTS ) 2 | message(STATUS "Not building test_ram_limit, read README.txt in eos/unittests/test-contracts/test_ram_limit") 3 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_ram_limit.wasm ${CMAKE_CURRENT_BINARY_DIR}/test_ram_limit.wasm COPYONLY ) 4 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_ram_limit.abi ${CMAKE_CURRENT_BINARY_DIR}/test_ram_limit.abi COPYONLY ) 5 | else() 6 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_ram_limit.wasm ${CMAKE_CURRENT_BINARY_DIR}/test_ram_limit.wasm COPYONLY ) 7 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_ram_limit.abi ${CMAKE_CURRENT_BINARY_DIR}/test_ram_limit.abi COPYONLY ) 8 | endif() 9 | -------------------------------------------------------------------------------- /unittests/test-contracts/test_ram_limit/test_ram_limit.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boscore/bos/02a237a8206f808b123f5385aa02a765ab5801df/unittests/test-contracts/test_ram_limit/test_ram_limit.wasm --------------------------------------------------------------------------------