Compare commits

...

1245 Commits

Author SHA1 Message Date
greg7mdp b45ef199b0 Update appbase to branch tip 2023-06-15 12:00:09 -04:00
greg7mdp 153ff89c19 Don't throw when app().quit() called during plugin_startup. 2023-06-15 11:39:32 -04:00
greg7mdp 2ac21bca3f Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-15 10:53:16 -04:00
Kevin Heifner 804d3a4df4 Merge pull request #1298 from AntelopeIO/GH-1228-empty-block-log-main
[4.0 -> main] Fix for loading snapshot with empty block log
2023-06-14 15:10:12 -05:00
Peter Oschwald 12de1d9337 Merge pull request #1297 from AntelopeIO/init-pinned-build-workflow
Create initial workflow file for Pinned Builds.
2023-06-14 15:08:31 -05:00
Kevin Heifner 53d4847c38 Merge remote-tracking branch 'origin/release/4.0' into GH-1228-empty-block-log-main 2023-06-14 14:34:42 -05:00
Kevin Heifner b9c2e739eb Merge pull request #1285 from AntelopeIO/GH-1228-empty-block-log-4.0
[4.0] Fix for loading snapshot with empty block log
2023-06-14 14:32:13 -05:00
Peter Oschwald b016822c57 Not using cached build environments so removing this job. Replace with temp job for now. 2023-06-14 14:18:14 -05:00
greg7mdp 42e88242c1 Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-14 11:16:53 -04:00
greg7mdp 64ef9ea9dd Remove unneeded semicolumn 2023-06-14 11:14:33 -04:00
Peter Oschwald a8fb85c854 Create initial workflow file for Pinned Builds.
Creating a shell of the initial pinned_build.yaml workflow to be merged quickly into main to allow development of actual workflow in follow on branch.  Need to have workflow file in main before github will allow triggering it in a development branch.
2023-06-14 09:49:50 -05:00
Kevin Heifner 3406b68857 GH-1228 Improve assert message 2023-06-14 09:25:02 -05:00
Kevin Heifner 4734d36b55 GH-1228 Fix empty block log to support loading from a snapshot 2023-06-14 06:35:54 -05:00
Kevin Heifner 02dd569d35 GH-1228 Better assertion message 2023-06-14 06:35:31 -05:00
Kevin Heifner 40332eccb7 GH-1228 Add test for reading a snapshot with no block log option. 2023-06-14 06:35:04 -05:00
Vlad 53ac7e8f62 Merge pull request #1274 from AntelopeIO/GH-1273-improve-snapshot-tst
Made snapshot test more robust in case of asap scheduling
2023-06-13 15:39:26 -04:00
Kevin Heifner b951f747a8 Merge pull request #1278 from AntelopeIO/GH-1272-ship-main
[4.0 -> main] SHiP: fix intermittent empty get_block_result
2023-06-13 13:34:32 -05:00
Kevin Heifner ea9b988f56 GH-1272 Fix merge 2023-06-13 12:42:54 -05:00
Kevin Heifner b8d64a5399 Merge remote-tracking branch 'origin/release/4.0' into GH-1272-ship-main 2023-06-13 12:29:41 -05:00
Kevin Heifner 9bba26a2c3 Merge pull request #1276 from AntelopeIO/GH-1272-ship-4.0
[4.0] SHiP: fix intermittent empty get_block_result
2023-06-13 12:27:10 -05:00
766C6164 845a5e4e2f more readable ps_start 2023-06-13 07:43:41 -04:00
Kevin Heifner d4d8839be5 GH-1272 Fix merge issue 2023-06-12 20:06:53 -05:00
Kevin Heifner 93b357dc11 GH-1272 Use block_state if it is current block instead of trying to find the block in forkdb 2023-06-12 19:31:18 -05:00
Kevin Heifner 23c57bf1f2 GH-1272 Add ship and streamer client to verify blocks received over fork 2023-06-12 19:30:30 -05:00
766C6164 9589cbee34 Made test more robust in case of asap scheduling 2023-06-12 18:08:08 -04:00
greg7mdp ce96bf9736 Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-12 16:54:41 -04:00
greg7mdp 5291108573 Fix incorrect merge 2023-06-12 16:50:32 -04:00
Kevin Heifner d86ba3aa41 Merge pull request #1271 from AntelopeIO/GH-1240-net-loop-main
[4.0 -> main] P2P excessive logging caused by message spamming
2023-06-12 14:59:22 -05:00
Kevin Heifner 45429a3e34 Merge remote-tracking branch 'origin/release/4.0' into GH-1240-net-loop-main 2023-06-12 13:59:18 -05:00
Kevin Heifner bccfa160f8 Merge pull request #1267 from AntelopeIO/GH-1240-net-loop-4.0
[4.0] P2P excessive logging caused by message spamming
2023-06-12 13:55:23 -05:00
greg7mdp 42ca5163d7 Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-12 14:31:58 -04:00
Kevin Heifner 6c5e1564b8 Merge pull request #1269 from AntelopeIO/fix-i256-main
[4.0 -> main] fix i256 key type conversion by initialize buffer before usage
2023-06-12 11:30:08 -05:00
Kevin Heifner de9c8f0c7a Merge remote-tracking branch 'origin/release/4.0' into fix-i256-main 2023-06-12 10:53:19 -05:00
Kevin Heifner 1b14fc9c1d Merge pull request #1266 from AntelopeIO/fix-i256-4.0
[3.2 -> 4.0] fix i256 key type conversion by initialize buffer before usage
2023-06-12 10:52:50 -05:00
Kevin Heifner c2026ced33 Merge pull request #1243 from AntelopeIO/GH-1072-send-time-latency
P2P use round trip of time_message to calculate latency
2023-06-12 07:47:13 -05:00
Kevin Heifner 84fa137298 Merge branch 'main' into GH-1072-send-time-latency 2023-06-12 06:56:42 -05:00
Kevin Heifner d495b4094c Merge remote-tracking branch 'origin/release/3.2' into fix-i256-4.0 2023-06-12 06:32:36 -05:00
Kevin Heifner e06fc98e81 Merge pull request #1264 from AntelopeIO/fix-i256-3.2
[3.2] fix `i256` key type conversion by initialize buffer before usage
2023-06-12 06:31:41 -05:00
Vlad 9cfcbf0b30 Merge pull request #1265 from AntelopeIO/GH-1239-make-output-dir-required-main
[4.0 -> main] Output-dir should be required for block-log subcommands of leap-util
2023-06-11 18:34:43 -04:00
Gregory Popovitch 990d2eacf8 Merge pull request #1253 from AntelopeIO/cleanup_net_plugin_pimpl
Cleanup pimpl idiom for `net_plugin`
2023-06-11 11:41:05 -04:00
766C6164 a3f863fa7b Merge branch 'release/4.0' into GH-1239-make-output-dir-required-main 2023-06-11 11:30:26 -04:00
Vlad 3677c3c80f Merge pull request #1263 from AntelopeIO/GH-1239-make-output-dir-required-40
[3.2 -> 4.0] Output-dir should be required for block-log subcommands of leap-util
2023-06-11 11:27:06 -04:00
learnforpractice db657e5082 fix i256 key type conversion by initialize buffer before usage 2023-06-10 15:30:22 -05:00
Matt Witherspoon f8930f4bc2 Merge pull request #1252 from learnforpractice/main
fix `i256` key type conversion by initialize buffer before usage
2023-06-10 16:22:39 -04:00
Kevin Heifner 8ffb1b4412 GH-1240 Better handling of close when not syncing 2023-06-10 10:06:09 -05:00
Kevin Heifner affbbd087f GH-1240 get_time is supposed to be nanoseconds 2023-06-10 08:46:45 -05:00
Kevin Heifner 2409db22d8 GH-1027 catch_up message with head was being ignored. This was likely not noticed before because handshake would provide it eventually. 2023-06-10 08:29:58 -05:00
learnforpractice c5f0eae2a4 Merge branch 'main' into main 2023-06-10 07:00:49 +08:00
766C6164 48b3beef41 make output-dir required for leap-util block-log subcommands 2023-06-09 17:37:49 -04:00
766C6164 1b043c75de Merge branch 'release/3.2' into GH-1239-make-output-dir-required-40 2023-06-09 17:34:40 -04:00
Vlad 4a640d422e Merge pull request #1262 from AntelopeIO/GH-1239-make-output-dir-required-32
[3.2] Output-dir should be required for extract-blocks subcommand of leap-util
2023-06-09 17:30:54 -04:00
Kevin Heifner bb289379eb GH-1240 Prevent infinite loop in net_plugin by not sending back a handshake for a catch_up notice if nothing new to report. 2023-06-09 15:12:52 -05:00
Kevin Heifner b2e7857642 GH-1027 Since we now sync ahead the sync_next_expected_num needs reset if we get an unlinkable block 2023-06-09 14:24:16 -05:00
766C6164 852f1bb285 output-dir should be required for extract-blocks 2023-06-09 13:20:17 -04:00
Kevin Heifner c86ca4726d GH-1027 catch_up message with head was being ignored. This was likely not noticed before because handshake would provide it eventually. 2023-06-09 11:37:57 -05:00
Gregory Popovitch 651d21f2a3 Merge pull request #1234 from AntelopeIO/gh-1057
Remove fc/string.hpp to_string impls
2023-06-09 12:25:21 -04:00
Kevin Heifner ea230ce353 GH-1027 Simplify time_message logic 2023-06-09 09:07:32 -05:00
Kevin Heifner d74af81c8a GH-1027 Simplify time_message logic 2023-06-09 08:42:57 -05:00
Kevin Heifner 2c43180043 GH-1027 Reduce handshake storm by only sending handshake if head changed or 50ms has passed 2023-06-09 08:03:49 -05:00
Kevin Heifner aa25f11201 GH-1027 Remove notice_message that is a no-op 2023-06-09 07:13:05 -05:00
learnforpractice 0974eac7cf fix i256 key type conversion by initialize buffer before usage 2023-06-09 08:27:57 +08:00
Gregory Popovitch 7c0694b4c9 Merge pull request #1258 from AntelopeIO/gh-1238
Add harden flags to pinned builds
2023-06-08 20:21:22 -04:00
Kevin Heifner 9fe62d5f1c GH-1027 Reset sync_source when unable to request range 2023-06-08 18:37:38 -05:00
Kevin Heifner 39df8b5a10 GH-1027 Rename net_latency_ns to peer_ping_time_ns 2023-06-08 18:36:50 -05:00
greg7mdp 07b0586c32 Add harden flags to pinned builds
see: https://www.redhat.com/en/blog/hardening-elf-binaries-using-relocation-read-only-relro
2023-06-08 16:31:45 -04:00
greg7mdp 727175d512 Fix merge issue 2023-06-08 16:05:48 -04:00
greg7mdp 839f5c9b8f Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-08 15:59:33 -04:00
Kevin Heifner 5b34d53348 GH-1027 If two time_message loops in progress, drop all but the expected one. 2023-06-08 14:15:36 -05:00
Kevin Heifner 438d1251ac GH-1027 Use constants for normalize 2023-06-08 11:23:24 -05:00
Kevin Heifner ef1b486896 GH-1027 No need to normalize msg.org 2023-06-08 10:20:18 -05:00
greg7mdp 62d8543ddc Clean up connection::_close() which doesn't need to be static. 2023-06-08 11:15:28 -04:00
Kevin Heifner 7032cdac99 GH-1027 Prevent infinite time_message loops by making sure only one in progress at a time 2023-06-08 09:52:48 -05:00
greg7mdp c1cb2bc0b6 forgot to remove a try/catch. 2023-06-08 10:38:39 -04:00
greg7mdp 78dc9cddc5 Cleanup net_plugin pimpl idiom. 2023-06-08 10:30:23 -04:00
greg7mdp 6ec9bf3479 Merge branch 'main' of github.com:AntelopeIO/leap into gh-1057 2023-06-08 09:50:53 -04:00
Kevin Heifner 1c607bd880 Merge pull request #1248 from AntelopeIO/GH-1217-ship-main
[4.0 -> main] SHiP: Fix state-history-log-retain-blocks option handling
2023-06-07 15:32:59 -05:00
Kevin Heifner 3778e33c6e Merge remote-tracking branch 'origin/release/4.0' into GH-1217-ship-main 2023-06-07 14:58:21 -05:00
Kevin Heifner a79f306ec7 Merge pull request #1241 from AntelopeIO/GH-1217-ship-4.0
[4.0] SHiP: Fix state-history-log-retain-blocks option handling
2023-06-07 14:57:45 -05:00
Kevin Heifner 91346b10f2 GH-1027 start_sync will determine if sync needed 2023-06-07 14:54:58 -05:00
Matt Witherspoon 60eb61b7f8 Merge pull request #1242 from AntelopeIO/unlimited_rotrx_thread_start
[4.0 -> main] allow ROtrx threads unlimited time to start
2023-06-07 15:35:58 -04:00
greg7mdp d399f5d74a Forgot to add symbol.cpp 2023-06-07 14:16:01 -04:00
greg7mdp addef1ff56 Merge branch 'main' of github.com:AntelopeIO/leap into gh-1057 2023-06-07 14:13:54 -04:00
greg7mdp 1c2c0ea8bd Remove trim from fc/string.hpp (use boost trim_copy directly). 2023-06-07 14:04:33 -04:00
Kevin Heifner fa5eeb7b0a GH-1027 Remove unneeded handshake 2023-06-07 11:30:02 -05:00
Kevin Heifner 1600c88124 GH-1027 No need to sync or send handshake if already syncing 2023-06-07 11:24:16 -05:00
Matt Witherspoon 952e4065ed Merge remote-tracking branch 'origin/release/4.0' into unlimited_rotrx_thread_start 2023-06-07 11:58:51 -04:00
Kevin Heifner 27d049b3b1 GH-1217 Fix process of state-history-log-retain-blocks option 2023-06-07 10:52:11 -05:00
Matt Witherspoon ce99dc18ab Merge pull request #1221 from AntelopeIO/unlimited_rotrx_thread_start_40x
[4.0] allow ROtrx threads unlimited time to start
2023-06-07 11:49:24 -04:00
Kevin Heifner fed0e8a363 Merge branch 'main' into GH-1072-latency 2023-06-07 10:30:56 -05:00
Kevin Heifner 73644fd0af GH-1072 Revert: No reason to post if syncing from peer. 2023-06-07 09:54:11 -05:00
Vlad d23cb169ee Merge pull request #1236 from AntelopeIO/snapshot-scheduler-test-fix
Improve robustness of snapshot unit test
2023-06-07 10:28:14 -04:00
Kevin Heifner 2fab062269 GH-1072 Revert check for in sync as we need to always attempt a start sync on a lib notice. 2023-06-06 23:01:20 -05:00
Kevin Heifner 668d2a4aaf GH-1072 Update comments 2023-06-06 21:58:07 -05:00
Kevin Heifner cdd05a8351 GH-1072 Do not print out complete blocklog on failure as it is way too much output for ci/cd. 2023-06-06 16:40:00 -05:00
Peter Oschwald 6ad30814c5 Merge pull request #1229 from AntelopeIO/ph-read-only-trxs
[PH] Read-Only transaction support
2023-06-06 16:25:27 -05:00
Peter Oschwald a8f559cf9f Address peer review comments.
Rename and simplify test naming for clarity.
Rename endpoint api type to simply be endpoint mode for clarity.
2023-06-06 15:27:04 -05:00
Kevin Heifner 1341215ff3 GH-1072 Fix for net_latency_ns not being calculated yet. 2023-06-06 12:46:20 -05:00
Peter Oschwald 85ea6ff296 Merge branch 'main' into ph-read-only-trxs 2023-06-06 11:37:36 -05:00
766C6164 620964759c Desensitize test in case of auto determining start block 2023-06-06 12:26:17 -04:00
jgiszczak ba919c7941 Merge pull request #1232 from AntelopeIO/test-harness-double-kill-fix
Avoid trying to kill a node twice to prevent orphaned processes.
2023-06-06 10:51:36 -05:00
Kevin Heifner 703f8eb322 GH-1072 Use round trip time_message for calculation of latency. 2023-06-06 10:44:24 -05:00
greg7mdp 15ae38669d Removed last to_string() overloads from the fc string.hpp header. 2023-06-06 11:18:30 -04:00
greg7mdp 1c5a555419 replace uses of fc::to_string for integer types with std::to_string 2023-06-06 11:05:45 -04:00
Peter Oschwald ff2d795f8e Merge branch 'main' into ph-read-only-trxs 2023-06-06 09:51:51 -05:00
greg7mdp 5abbc3c811 remove fc::to_string for integer types 2023-06-06 10:38:24 -04:00
Peter Oschwald 776040ac41 Another round of peer review comments addressed. 2023-06-06 09:33:38 -05:00
jgiszczak 3537d22340 Merge branch 'main' into test-harness-double-kill-fix 2023-06-05 19:08:57 -05:00
Jonathan Giszczak 8f865a93ef Avoid trying to kill a node twice to prevent orphaned processes. 2023-06-05 18:07:01 -05:00
Vlad 15c6727954 Merge pull request #1220 from AntelopeIO/GH-1152-zero-values
Extended snapshot scheduler to better handle missing and zero params
2023-06-05 17:43:31 -04:00
Peter Oschwald 566e12fa8d Address peer review comments & move function implementations into cpp files.
Address possibility of optional receipt not having data if a transaction fails.
2023-06-05 16:34:53 -05:00
greg7mdp 48be9385ba fix typo 2023-06-05 16:46:32 -04:00
greg7mdp 4224df0588 Update usage_pattern.md 2023-06-05 16:26:19 -04:00
Peter Oschwald f16786ecb5 Merge branch 'main' into ph-read-only-trxs 2023-06-05 15:26:14 -05:00
Peter Oschwald f9838a118b Address peer review comments. 2023-06-05 15:25:32 -05:00
Peter Oschwald 265ae7f236 Update documentation. 2023-06-05 14:52:19 -05:00
Peter Oschwald edd768beed Make configuration of validation and api nodes condititional. 2023-06-05 14:52:01 -05:00
Kevin Heifner c776ac9412 GH-1072 No reason to post if syncing from peer 2023-06-05 14:34:22 -05:00
greg7mdp 4869d6308e Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-05 15:05:30 -04:00
Kevin Heifner d04757a8b0 Merge pull request #1225 from AntelopeIO/GH-1072-sync-ahead
P2P sync ahead while applying received blocks
2023-06-05 13:57:04 -05:00
Peter Oschwald ed5333b716 Fix endpointApiType which moved from TpsTrxGensConfig onto the TransactionGeneratorsLauncher itself. 2023-06-05 13:14:23 -05:00
greg7mdp 2bd881850d Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-05 13:59:34 -04:00
Peter Oschwald f7f487d75b Refactor endpointApiType and apiEndpoint a little. 2023-06-05 12:53:37 -05:00
greg7mdp a4f54a29cd Add usage_patterns.md file 2023-06-05 13:50:27 -04:00
Kevin Heifner 87564199b5 GH-1072 Simplify logic 2023-06-05 12:47:29 -05:00
Kevin Heifner 644ded8a7f GH-1072 Comment sync_ members 2023-06-05 12:47:09 -05:00
Peter Oschwald a41b2ff2f0 Add performance load test with read-only trxs
Add apiEndpoint and userTrxData to test report for reference.

Simplify createReport argument list.
2023-06-05 11:29:52 -05:00
Peter Oschwald b803af646a Forgot to add test to group. 2023-06-05 11:28:04 -05:00
Peter Oschwald bec972a015 Merge branch 'main' into ph-read-only-trxs 2023-06-05 10:15:14 -05:00
Peter Oschwald 29bdea6adf Add read-only transaction support through user defined transaction config.
Add configuration option for api-endpoint to allow targeting specific http endpoint with transactions.

Configurable number of read-only threads for the api nodes.

Allow for empty authorizations in transaction action for read-only trx support.
2023-06-05 10:14:19 -05:00
Matt Witherspoon c6972500ac Merge pull request #1227 from AntelopeIO/fix_nplr_nonleap
[4.0 -> main] fix NP & LR CI workflow for forked/mirrored repos that are not named leap
2023-06-03 15:15:53 -04:00
Matt Witherspoon 8335c5576e Merge remote-tracking branch 'origin/release/4.0' into fix_nplr_nonleap 2023-06-02 17:29:05 -04:00
Matt Witherspoon 05ce10c375 Merge pull request #1226 from AntelopeIO/fix_nplr_nonleap_40x
[4.0] fix NP & LR CI workflow for forked/mirrored repos that are not named `leap`
2023-06-02 17:20:09 -04:00
Matt Witherspoon 19af68829b don't hardcode leap in parallel-ctest-containers action 2023-06-02 15:33:24 -04:00
Gregory Popovitch 96ab7afd32 Merge pull request #1224 from AntelopeIO/cleanup_ship_pimpl
Cleanup pimpl idiom for ship.
2023-06-02 15:25:01 -04:00
766C6164 f7ebd6c1c5 Addressed feedback 2023-06-02 15:07:58 -04:00
Peter Oschwald 1da6a8373b Erase map entry if resulting locate of key words turns up empty.
Previously it was leaving the empty placeholder in the map which made it trigger the map as non empty and do unnecessary work in the generator.
2023-06-02 13:07:17 -05:00
Peter Oschwald 3902a9e0e1 Rename to include 'type' for the endpoint api to differentiate with upcoming additions including specifying actual api endpoints for use. 2023-06-02 12:59:49 -05:00
Matt Witherspoon be76e1085d catch and handle exceptions from std::thread's ctor 2023-06-02 13:21:37 -04:00
Kevin Heifner ce78703563 GH-1072 Update log message 2023-06-02 12:03:26 -05:00
greg7mdp 61ff2fdafa Fix compilation issue with g++. 2023-06-02 11:26:42 -04:00
greg7mdp d3e7b01aaf Cleanup pimpl idion for ship. 2023-06-02 11:06:25 -04:00
greg7mdp a35e793450 Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-06-02 10:37:59 -04:00
Gregory Popovitch ccd732f322 Merge pull request #1222 from AntelopeIO/cleanup_chain_plugin_pimpl
Cleanup pimpl idiom on chain_plugin
2023-06-02 10:30:04 -04:00
Matt Witherspoon 2389bc1cd7 move blocking start&init to named_thread_pool's start() 2023-06-01 23:07:01 -04:00
Kevin Heifner 90486af748 GH-1072 Sync ahead while processing current range of blocks 2023-06-01 20:17:17 -05:00
greg7mdp 2f82b1e993 Merge branch 'main' of github.com:AntelopeIO/leap into cleanup_chain_plugin_pimpl 2023-06-01 12:47:42 -04:00
greg7mdp c4f997d79a Cleanup pimpl idiom on chain_plugin
Avoid excessive access to `_impl` class through `my->`
2023-06-01 12:12:44 -04:00
greg7mdp dc72da4e58 Remove unnecessary (now) try/catch block calling plugin_shutdown() 2023-06-01 11:30:18 -04:00
Kevin Heifner 645ad8b207 GH-1072 Sync ahead while applying blocks 2023-06-01 08:44:17 -05:00
Matt Witherspoon 618915c30f allow ROtrx threads unlimited time to start 2023-05-31 18:34:02 -04:00
Kevin Heifner 0eba3914b9 Merge remote-tracking branch 'origin/main' into GH-1072-sync-ahead 2023-05-31 16:20:39 -05:00
Kevin Heifner db132c5fd4 Merge pull request #1215 from AntelopeIO/GH-1072-sync
P2P sync improvements
2023-05-31 16:18:06 -05:00
Kevin Heifner 7c7f2eb2ae Merge branch 'GH-1072-sync' into GH-1072-sync-ahead 2023-05-31 15:48:22 -05:00
766C6164 3382c49530 fix 2023-05-31 16:42:36 -04:00
Kevin Heifner 94df7279b9 GH-1072 Need to send handshake when connecting 2023-05-31 15:29:32 -05:00
766C6164 b42df934d7 Added better handling ow zero/empty params 2023-05-31 16:21:11 -04:00
Kevin Heifner c0a0b72e51 GH-1072 Resize list since those outside range are not needed. 2023-05-31 14:50:23 -05:00
Kevin Heifner d99c7daf31 GH-1072 Use a connection_state enum for connection state instead of bool variables. Rename syncing to peer_syncing_from_us. Rename syncing_with_peer() to syncing_from_peer(). 2023-05-31 14:40:34 -05:00
Kevin Heifner f3c57978e1 GH-1072 Add is_transactions_connection and is_blocks_connection to simply logic 2023-05-31 12:22:17 -05:00
Kevin Heifner 04a5143529 GH-1072 simplify 2023-05-31 11:17:18 -05:00
Kevin Heifner 99bf7bc018 GH-1072 += not needed 2023-05-31 11:07:07 -05:00
greg7mdp 97aa42071e Merge branch 'main' of github.com:AntelopeIO/leap into gh-672 2023-05-30 18:13:17 -04:00
Gregory Popovitch f53faff7a9 Merge pull request #1213 from AntelopeIO/producer_plugin_cleanup
Cleanup producer_plugin pimpl idiom.
2023-05-30 18:12:30 -04:00
Kevin Heifner df042c2fd3 GH-1072 WIP test of sync ahead 2023-05-27 08:23:59 -05:00
greg7mdp a2157c4d79 In plugin_startup(), in case of error, better throw than call app().quit() 2023-05-26 15:47:10 -04:00
greg7mdp 81e5a81074 Whitespace fix 2023-05-26 15:46:47 -04:00
greg7mdp 3210dfe48b No need to catch exceptions to make sure plugin_shutdown() is executed.
This is now ensured with the current version of appbase.
2023-05-26 15:45:54 -04:00
greg7mdp 3812d5b026 Do not destroy chain::controller on plugin_shutdown().
as other plugins could possibly not be shutdown yet.
2023-05-26 15:43:46 -04:00
Kevin Heifner 386f00bdc5 GH-1072 Use absolute value latency and improve logging 2023-05-26 13:35:16 -05:00
greg7mdp 626b437b7f More whitespace fix according to PR review. 2023-05-26 13:22:15 -04:00
greg7mdp fa07fd84f7 More whitespace cleanup 2023-05-26 10:29:17 -04:00
greg7mdp cefd98b186 cleanup EOS_ASSERT whitespace 2023-05-26 10:24:18 -04:00
greg7mdp ecedaca967 reduce backslash indentation 2023-05-26 10:12:01 -04:00
greg7mdp ce82a0b882 More whitespace cleanup 2023-05-26 10:09:54 -04:00
greg7mdp dd8a05e36d More whitespace cleanup according to PR comments 2023-05-26 10:07:00 -04:00
greg7mdp 2487ac651e More whitespace cleanup according to PR comments 2023-05-26 10:04:06 -04:00
greg7mdp 6fcf9a9fc9 More whitespace cleanup 2023-05-26 09:48:31 -04:00
greg7mdp a423d40554 run clang-format and do some manual cleanup (mostly fc_dlog) 2023-05-26 09:38:46 -04:00
greg7mdp ceab818352 More whitespace cleanup 2023-05-26 09:23:37 -04:00
greg7mdp eaff6c165e Address PR comments, fix indentation/spacing in plugin_initialize. 2023-05-26 09:05:51 -04:00
Kevin Heifner 851af76905 GH-1072 Move trx sync check 2023-05-26 07:59:26 -05:00
greg7mdp d90f5b6d19 Merge branch 'main' of github.com:AntelopeIO/leap into producer_plugin_cleanup 2023-05-25 17:26:35 -04:00
greg7mdp 04eab3feae More producer_plugin cleanup towards proper pimpl idiom 2023-05-25 16:57:01 -04:00
greg7mdp fd3d54f42a More producer_plugin cleanup towards proper pimpl idiom 2023-05-25 16:49:10 -04:00
greg7mdp f4d067e9d8 Fix incorrect indentation in producer_plugin::plugin_initialize 2023-05-25 16:17:50 -04:00
greg7mdp b3b131f991 cleanup plugin_initialize() 2023-05-25 16:11:29 -04:00
Matt Witherspoon 794066ee2a Merge pull request #1211 from AntelopeIO/stray}
[4.0 -> main] remove innocuous stray `}` in log statement
2023-05-25 15:36:48 -04:00
greg7mdp ee29899e1a update appbase to new tip 2023-05-25 14:26:28 -04:00
Kevin Heifner 24f5986eef GH-1072 Drop incoming trx when syncing 2023-05-25 13:15:02 -05:00
Kevin Heifner 7b1e62cd9f GH-1072 Use peer_head_block_num for should_sync_from instead of lib 2023-05-25 13:14:20 -05:00
greg7mdp 2952bfb264 Cleanup use of my-> in plugin_startup() and plugin_shutdown(). 2023-05-25 11:16:26 -04:00
greg7mdp ee4e4b0db6 use appbase branch which calls plugin_shutdown() on exception. 2023-05-25 11:13:37 -04:00
Kevin Heifner a632f751a6 GH-1072 milliseconds not microseconds 2023-05-24 19:16:16 -05:00
Kevin Heifner 3ad3b7775c GH-1072 Use latency and peer block range to determine who to sync from 2023-05-24 18:21:50 -05:00
Kevin Heifner 0615a25447 Merge pull request #1209 from AntelopeIO/GH-1173-rm-option
Remove disable-subjective-billing option
2023-05-24 16:03:21 -05:00
Matt Witherspoon 782f5ed66c Merge remote-tracking branch 'origin/release/4.0' into HEAD 2023-05-24 10:15:13 -04:00
Matt Witherspoon 125df80b4e Merge pull request #1207 from AntelopeIO/stray}_40x
[4.0] remove innocuous stray `}` in log statement
2023-05-24 10:13:57 -04:00
Kevin Heifner 2ebb2be892 GH-1072 Add tracking of latency 2023-05-23 18:52:53 -05:00
Kevin Heifner e49997d939 Merge branch 'GH-1072-sync' of https://github.com/AntelopeIO/leap into GH-1072-sync 2023-05-23 15:18:11 -05:00
Kevin Heifner 5027edaa58 Add sync-peer-limit option 2023-05-23 14:20:31 -05:00
jgiszczak d215122c07 Merge pull request #1210 from AntelopeIO/test-harness-urllib-configurable-limit
Add prettyPrint and printReturnLimit to processUrllibRequest()
2023-05-23 13:41:14 -05:00
Kevin Heifner 3f59cc85af GH-1072 Change default sync_fetch_span from 100 to 1000 2023-05-23 09:23:45 -05:00
Jonathan Giszczak 5d0ee1fb42 Add prettyPrint and printReturnLimit to processUrllibRequest() 2023-05-22 19:18:06 -05:00
Kevin Heifner 552ae0dde0 Merge remote-tracking branch 'origin/main' into GH-1072-sync 2023-05-22 17:17:17 -05:00
Kevin Heifner 2d06cfbcfd Merge pull request #1187 from AntelopeIO/GH-1072-refactor
P2P Refactor connections management
2023-05-22 16:44:44 -05:00
Kevin Heifner bad4bb49eb GH-1173 Remove disable-subjective-billing option 2023-05-22 16:21:15 -05:00
Peter Oschwald ef9c176be7 Merge pull request #1195 from AntelopeIO/ph-perf-test-improvements
[PH] Performance Harness improvements
2023-05-22 16:16:21 -05:00
Peter Oschwald 8d5d04aa0e Merge branch 'main' into ph-perf-test-improvements 2023-05-22 15:44:38 -05:00
jgiszczak a62bbdda76 Merge pull request #1182 from AntelopeIO/test-harness-process-control
Test harness process control
2023-05-22 15:34:47 -05:00
jgiszczak dfc8128912 Merge branch 'main' into test-harness-process-control 2023-05-22 15:02:25 -05:00
Peter Oschwald 4e89f7bef3 Merge branch 'main' into ph-perf-test-improvements 2023-05-22 14:53:12 -05:00
Kevin Heifner 44820e9c9c Merge remote-tracking branch 'origin/main' into GH-1072-refactor 2023-05-22 14:41:51 -05:00
Huang-Ming Huang 605f600cb7 Merge pull request #1203 from AntelopeIO/huangminghuang/ipv6
IPv6 support
2023-05-22 14:29:09 -05:00
Kevin Heifner 0af651b1e2 Merge remote-tracking branch 'origin/main' into GH-1072-refactor 2023-05-22 13:55:56 -05:00
Kevin Heifner 01dae4ef0b GH-1072 Fix any_of_block_connections to verify not transaction only connection 2023-05-22 13:03:36 -05:00
Peter Oschwald e37a1a65b1 Merge branch 'main' into ph-perf-test-improvements 2023-05-22 12:45:17 -05:00
Kevin Heifner 6a5bf21d8d GH-1072 Add any_of_block_connections and change for_each_connection and for_each_block_connection to not short circuit 2023-05-22 12:43:49 -05:00
Huang-Ming Huang 880c9739ea use reference 2023-05-22 11:39:14 -05:00
Huang-Ming Huang 7ae4a97335 Merge branch 'main' into huangminghuang/ipv6 2023-05-22 11:23:47 -05:00
Huang-Ming Huang a342d0d9cd move include header 2023-05-22 11:18:11 -05:00
Kevin Heifner 7470c68b4a GH-1072 Remove unneeded check 2023-05-22 10:51:50 -05:00
Kevin Heifner a6b5259b34 GH-1072 Add any_of_connection and use it for duplicate implementation 2023-05-22 10:48:41 -05:00
Kevin Heifner a80f5bc227 GH-1072 Fix indentation 2023-05-22 10:17:56 -05:00
Peter Oschwald b0d2e602a3 Fix spacing. 2023-05-22 10:17:38 -05:00
Kevin Heifner 30d6fd5b42 GH-1072 Rename _impl methods to _i to distinguish from _impl types. 2023-05-22 10:15:29 -05:00
Kevin Heifner 0efab27e1c GH-1072 Use flat_set and some other misc cleanup 2023-05-22 10:09:02 -05:00
iamveritas 4667a381e0 Merge pull request #1208 from AntelopeIO/4.0_to_main_fix-devrel#248-document-chain-api-endpoints
[4.0 -> main] [docs] fix devrel#248 document chain api endpoints
2023-05-22 16:37:10 +03:00
iamveritas 88d71ccf5d Merge pull request #1204 from AntelopeIO/4.0_fix-devrel#248-document-chain-api-endpoints
[4.0] add docs/yaml content for missing chain api endpoints
2023-05-22 16:18:49 +03:00
Peter Oschwald a29763448a Fix type to timedelta. 2023-05-22 08:01:26 -05:00
iamveritas 3515b83970 correct description for read-only 2023-05-22 15:49:22 +03:00
iamveritas 561da880ef release 4.0 add docs/yaml content for missing chain api endpoints:
/get_code_hash
/get_producer_schedule
/get_transaction_id
/send_read_only_transaction
/push_block
2023-05-22 08:54:01 +03:00
Matt Witherspoon ae7107bde0 remove innocuous stray } in log statement 2023-05-20 18:10:17 -04:00
Huang-Ming Huang 1979f8da16 remove unix socket file on exit 2023-05-19 16:36:15 -05:00
Huang-Ming Huang 8039427e09 log_listening fix 2023-05-19 15:51:09 -05:00
Huang-Ming Huang 1c7ed0d137 fix test 2023-05-19 15:10:46 -05:00
Jonathan Giszczak ed754170ad Remove CMake install of launcher.py. 2023-05-19 14:41:45 -05:00
jgiszczak a9e0a06acd Merge branch 'main' into test-harness-process-control 2023-05-19 14:04:01 -05:00
Jonathan Giszczak 12706fd3f0 Remove unused variables from performance_test_basic ClusterConfig. 2023-05-19 14:02:28 -05:00
Jonathan Giszczak 2ff0243d34 Remove last vestiges of launcher tool, fixing all bridge topology tests. 2023-05-19 14:00:14 -05:00
Jonathan Giszczak d72a52ec68 Fix copy paste redundancy. 2023-05-19 13:54:22 -05:00
Huang-Ming Huang ebe824164e address PR comments 2023-05-19 13:30:31 -05:00
Peter Oschwald 324b99808d Merge branch 'main' into ph-perf-test-improvements 2023-05-19 10:59:37 -05:00
Gregory Popovitch cc523ee3b1 Merge pull request #1199 from AntelopeIO/gh-1025
Improve packed_transaction parsing performance
2023-05-19 11:16:45 -04:00
Peter Oschwald 16a1981e1f Merge branch 'main' into ph-perf-test-improvements 2023-05-19 09:32:46 -05:00
Jonathan Giszczak 687b0bb155 Remove deprecated launcher tool. Add cluster launch smoke test. 2023-05-18 19:18:06 -05:00
Jonathan Giszczak dbbf0bbba3 Fix merge error. 2023-05-18 17:46:46 -05:00
Jonathan Giszczak f345dd395a Revert getTransaction timings, per Kevin. 2023-05-18 17:15:13 -05:00
Jonathan Giszczak b6038dbbae Restore node shutdown in distributed_transactions_test. 2023-05-18 17:13:39 -05:00
Jonathan Giszczak b60eafb1f4 Formatting. 2023-05-18 17:10:40 -05:00
Jonathan Giszczak 59e22df433 Added check of self.popenProc in Node verifyAlive. 2023-05-18 16:57:20 -05:00
Jonathan Giszczak 5f3a8d7d81 Formatting. 2023-05-18 16:40:01 -05:00
Jonathan Giszczak 8b45cf4e3e Fix merge error. 2023-05-18 16:39:20 -05:00
Jonathan Giszczak ae890e8ec0 Restore gelf_test, lost in an unrelated prior merge. 2023-05-18 16:31:37 -05:00
greg7mdp 3ae59db3ed Remove unneeded try/catch. 2023-05-18 17:29:50 -04:00
Jonathan Giszczak 74b9300089 Formatting. 2023-05-18 16:06:56 -05:00
Jonathan Giszczak fddef77964 Remove --clean-run from performance_test documentation. 2023-05-18 16:05:41 -05:00
Jonathan Giszczak 1739c377d5 Relocate dontKill and keepLogs from TestHelperConfig to ClusterConfig
in performance_test_basic's configuration classes.
2023-05-18 16:05:07 -05:00
Jonathan Giszczak e503383c47 Add comment to biosNodeId magic number. 2023-05-18 15:24:34 -05:00
Jonathan Giszczak b839caea68 Replace a string modified with a % operator with an f-string. 2023-05-18 15:24:13 -05:00
Jonathan Giszczak 8f654585dd Give bios node magic number a name.
Remove commented code.
2023-05-18 15:10:28 -05:00
jgiszczak 73588bce69 Merge branch 'main' into test-harness-process-control 2023-05-18 14:53:40 -05:00
Jonathan Giszczak 77a5a260ea Reduce launcher_test to one producer account. 2023-05-18 14:51:16 -05:00
Huang-Ming Huang a873457da5 fix tcp_socket 2023-05-18 14:35:27 -05:00
Lin Huang a1c8806619 Merge pull request #1202 from AntelopeIO/merge_4_0_1_version_bump
[4.0 -> Main] Merge 4.0.1 version bump
2023-05-18 15:30:34 -04:00
greg7mdp 7b4b55ae33 Merge branch 'main' of github.com:AntelopeIO/leap into gh-1025 2023-05-18 14:59:45 -04:00
Huang-Ming Huang 68c69226af Merge remote-tracking branch 'origin/main' into huangminghuang/ipv6
# Conflicts:
#	plugins/state_history_plugin/state_history_plugin.cpp
2023-05-18 13:59:31 -05:00
Huang-Ming Huang b6368138dc ipv6 support 2023-05-18 13:57:03 -05:00
greg7mdp 2fe5079e3e Fix crash. 2023-05-18 14:49:26 -04:00
Kevin Heifner 548692ee5f GH-1072 Use better heuristic for determing who to sync from 2023-05-18 13:39:17 -05:00
Lin Huang 8ea496bcb9 Merge 4.0.1 version bump to Main 2023-05-18 14:25:14 -04:00
Lin Huang 0d8de6cc5d Merge pull request #1201 from AntelopeIO/bump_leap_to_4_0_1
[4.0] Bump Leap to 4.0.1
2023-05-18 13:51:26 -04:00
Lin Huang 8a6e3e68e6 Bump Leap to 4.0.1 2023-05-18 13:16:00 -04:00
Vlad 09470dc06c Merge pull request #1200 from AntelopeIO/GH-1130-replay-memory-consumption-main
[4.0 -> main] Fix for nodeos large memory consumption during a blocks log replay
2023-05-18 12:26:50 -04:00
Huang-Ming Huang 530c9f13a9 Merge pull request #1180 from AntelopeIO/huangminghuang/gelf-test-fix
fix unstable gelf test
2023-05-18 11:05:36 -05:00
766C6164 d657dc2aa7 Merge branch 'release/4.0' into GH-1130-replay-memory-consumption-main 2023-05-18 11:40:21 -04:00
Vlad 9bc44bf9f3 Merge pull request #1191 from AntelopeIO/GH-1130-replay-memory-consumption-40
[4.0] Fix for nodeos large memory consumption during a blocks log replay
2023-05-18 11:36:22 -04:00
Huang-Ming Huang 9fd2706fda grammar fix 2023-05-18 10:25:26 -05:00
766C6164 3dcaf77b75 Added additional comments 2023-05-18 11:00:32 -04:00
greg7mdp 972f8df642 Address PR comments 2023-05-18 10:07:05 -04:00
greg7mdp 92144f5431 Merge branch 'main' of github.com:AntelopeIO/leap into gh-1025 2023-05-18 09:15:26 -04:00
greg7mdp e1add68dd4 Use caching_resolver in more locations where we serialize/deserialize transactions 2023-05-18 09:14:30 -04:00
Peter Oschwald c8313145b0 Merge branch 'main' into ph-perf-test-improvements 2023-05-18 07:54:46 -05:00
Kevin Heifner caf601d6d5 Merge branch 'main' into GH-1072-refactor 2023-05-18 07:52:20 -05:00
greg7mdp ad84e9d757 Add caching_resolver to cache abi_serializers when deserializing transactions. 2023-05-18 08:28:11 -04:00
Gregory Popovitch e9d1b3afad Merge pull request #1188 from AntelopeIO/fix_warning_no_return
Fix compilation warning (does not return a value in all control paths)
2023-05-17 23:45:17 -04:00
Jonathan Giszczak 6119f2f2f9 Fix defect in trx_finality_status_forked_test.
Depending on timing, LIB may not advance far enough the first time after
the bridge node comes back up to fork out the block with the transaction
in it.
2023-05-17 19:46:22 -05:00
Jonathan Giszczak 3508cc488d Remove unused import. 2023-05-17 19:43:35 -05:00
Peter Oschwald 129c3da3f6 Merge branch 'main' into ph-perf-test-improvements 2023-05-17 19:29:25 -05:00
Peter Oschwald 89a97598de Refactor to add test results to PerformanceTestBasic.
Move report creation out of log_reader into the more appropriate performance test basic. Now only parse and analyze logs in log_reader and leave report creation to the test itself.

Add Search Scenarios Summary of results to the performance test report to give a quick overview of the scenarios and success/failure for each.

Consolidate json report creation and exporting into a single location in JsonReportHandler.

Added test duration calculation to report for easy reference.
2023-05-17 19:24:26 -05:00
Areg Hayrapetian 1ce956e1ae Merge pull request #1194 from AntelopeIO/arhag/forward-pr-1193
[4.0 -> main] Revert "Simplify Pinned Build Scripts"
2023-05-17 16:23:38 -07:00
Areg Hayrapetian e02695003a Merge branch 'release/4.0' into arhag/forward-pr-1193 2023-05-17 15:48:49 -07:00
Areg Hayrapetian 5a277b4f99 Merge pull request #1193 from AntelopeIO/revert-857-zach-install-deps
[4.0] Revert "Simplify Pinned Build Scripts"
2023-05-17 15:46:49 -07:00
Areg Hayrapetian 70ec11d055 Revert "Simplify Pinned Build Scripts" 2023-05-17 14:17:25 -07:00
766C6164 70276ce275 typo 2023-05-17 17:15:16 -04:00
766C6164 d69cef0cdc Update 2023-05-17 17:04:28 -04:00
766C6164 137c93a998 Do not post any updates if thread pool not started yet 2023-05-17 16:46:16 -04:00
greg7mdp dc917f2f0c Merge branch 'main' of github.com:AntelopeIO/leap into fix_warning_no_return 2023-05-17 16:09:20 -04:00
jgiszczak 197396debe Merge branch 'main' into test-harness-process-control 2023-05-17 14:16:59 -05:00
766C6164 b7a9ff5213 Capture block_state by ref 2023-05-17 14:59:30 -04:00
Huang-Ming Huang 70035268eb Merge pull request #1190 from AntelopeIO/huangminghuang/replay-fix-main
[4.0->main] fix replay for partitioned block log
2023-05-17 13:32:50 -05:00
Peter Oschwald 601548a58d Refactor evaluation of success out of performance_test into performance_test_basic.
This allows knowledge of objective and subjective test scenario success outcomes at the basic test level.

Add reporting of summary of search scenarios for quick reference.

Add test duration calculation to report for quick reference.
2023-05-17 13:10:38 -05:00
Peter Oschwald 04a94567fc Give tests unique test names to allow easier individual running of tests. 2023-05-17 13:00:48 -05:00
greg7mdp a50d82ed70 Add get_serializers_cache() template and use it. 2023-05-17 13:46:45 -04:00
Huang-Ming Huang 29e553f4c5 Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/replay-fix-main 2023-05-17 12:00:24 -05:00
Huang-Ming Huang f36725e1fa Merge pull request #1164 from AntelopeIO/huangminghuang/replay-fix
[4.0] fix replay for partitioned block log
2023-05-17 11:14:47 -05:00
Huang-Ming Huang ef49d306d2 Merge pull request #1184 from AntelopeIO/huangminghuang/update-appbase
update appbase submodule
2023-05-17 11:13:08 -05:00
greg7mdp 40ec0e0220 Fix compilation warning (does not return a value in all control paths)
leap/plugins/http_plugin/http_plugin.cpp:76:4: warning: non-void function does not return a value in all control paths [-Wreturn-type]
2023-05-17 11:21:09 -04:00
Gregory Popovitch 2b216acee6 Merge pull request #1183 from AntelopeIO/gh-1067
Move log line for `onblock` and update saved log file for tests
2023-05-17 10:19:19 -04:00
Huang-Ming Huang 13521b2569 fix typo 2023-05-17 08:16:07 -05:00
Kevin Heifner 4ef2981e05 app->initialize now throws 2023-05-17 07:46:22 -05:00
Kevin Heifner 31983be931 GH-1072 Use uint32_t for max-clients 2023-05-17 07:07:54 -05:00
greg7mdp f3e715657e Fix whitespace. 2023-05-16 22:27:39 -04:00
Kevin Heifner 75ee2e2a79 GH-1072 Refactor connections set into a connections_manager class 2023-05-16 20:00:41 -05:00
greg7mdp a5ef2d23c0 Simplify change as per PR comments. 2023-05-16 16:59:54 -04:00
Jonathan Giszczak 1aed737278 Update gelf_test. 2023-05-16 15:25:58 -05:00
Peter Oschwald e2418be3e9 Add min-tps-to-test option to control floor of search range. 2023-05-16 14:54:25 -05:00
Jonathan Giszczak 4874cc2f1c Update plugin_http_api_test for changes from main. 2023-05-16 14:31:47 -05:00
Huang-Ming Huang 34f4b62e7a update appbase submodule 2023-05-16 14:04:45 -05:00
jgiszczak c6b74a3591 Merge branch 'main' into test-harness-process-control 2023-05-16 13:46:39 -05:00
greg7mdp 20b60c354d Move log line for onblock and update saved log file for tests 2023-05-16 13:54:18 -04:00
Jonathan Giszczak 7fc3fba92d Remove commented code. 2023-05-16 12:02:30 -05:00
Jonathan Giszczak 33443c0123 Also kill bios node in validate-dirty-db. 2023-05-16 11:58:02 -05:00
Peter Oschwald b160a5ef61 remove using. 2023-05-16 10:54:50 -05:00
Peter Oschwald 95c2c1697d Fix warning. 2023-05-16 10:54:31 -05:00
Huang-Ming Huang d49c6a9bdf fix gelf test 2023-05-16 09:05:21 -05:00
Huang-Ming Huang f7d28a492f address PR review 2023-05-16 08:36:53 -05:00
Kevin Heifner 3579eb9dd9 Merge pull request #1178 from AntelopeIO/GH-1170-unlinkable-m
[4.0 -> main] Correctly handle close while syncing
2023-05-16 08:09:56 -05:00
Kevin Heifner feb73c8e88 Merge remote-tracking branch 'origin/release/4.0' into GH-1170-unlinkable-m 2023-05-16 07:03:03 -05:00
Kevin Heifner 7a2285dbda Merge pull request #1177 from AntelopeIO/GH-1149-http-shutdown-main
[4.0 -> main] Ignore http error on remote_endpoint() causing shutdown
2023-05-16 07:01:30 -05:00
Kevin Heifner 8ebac13d22 Merge pull request #1171 from AntelopeIO/GH-1170-unlinkable-4.0
[4.0] Correctly handle close while syncing
2023-05-16 06:59:49 -05:00
Kevin Heifner 203309b88d Merge pull request #1139 from AntelopeIO/GH-1062-time-limits
Update API/serialization time constraints
2023-05-15 19:28:48 -05:00
Jonathan Giszczak eb0d6f1b6e Fix Cluster's list of unstarted nodes to not include the bios node. 2023-05-15 17:48:10 -05:00
Kevin Heifner dd801e37bf Merge remote-tracking branch 'origin/release/4.0' into GH-1149-http-shutdown-main 2023-05-15 14:14:08 -05:00
Kevin Heifner c764d00a6f Merge pull request #1175 from AntelopeIO/GH-1149-http-shutdown-4.0
[4.0] Ignore http error on remote_endpoint() causing shutdown
2023-05-15 14:11:17 -05:00
Kevin Heifner 0465384e31 GH-1062 If time_limit_ms not specified use http-max-response-time-ms instead of 10ms 2023-05-15 12:09:26 -05:00
Kevin Heifner bd896c7a81 GH-1062 Change default http-max-response-time-ms from 30 to 15 2023-05-15 12:08:17 -05:00
Huang-Ming Huang 90a519fcb9 Merge pull request #1145 from AntelopeIO/huangminghuang/gelf-test
add gelf test
2023-05-15 11:29:55 -05:00
Huang-Ming Huang 37b1499b62 Merge branch 'main' into huangminghuang/gelf-test 2023-05-15 10:46:22 -05:00
Kevin Heifner 2df745999f GH-1062 Update test to reflect get_activate_protocol_features ignored limit and time limit 2023-05-15 10:39:13 -05:00
Kevin Heifner 3dc18415b5 GH-1062 Make get_activated_protocol_features atomic 2023-05-15 09:56:42 -05:00
Kevin Heifner 87e598a4ad GH-1062 Simplify deadline calculation. 2023-05-15 09:46:08 -05:00
Kevin Heifner 6d0a06b00f GH-1062 Add back check for correct table 2023-05-15 09:42:13 -05:00
Kevin Heifner 8ade32783d GH-1062 Fix merge issues 2023-05-15 09:35:00 -05:00
Kevin Heifner 079c650f9a Merge remote-tracking branch 'origin/main' into GH-1062-time-limits 2023-05-15 09:27:10 -05:00
Huang-Ming Huang e429ba6024 Merge pull request #1137 from AntelopeIO/huangminghuang/http
Support multiple http endpoints
2023-05-15 09:16:28 -05:00
Huang-Ming Huang eb0f174aaf address PR comments 2023-05-15 08:46:36 -05:00
Kevin Heifner 6489dd2289 GH-1170 Update comment 2023-05-13 13:08:27 -05:00
Jonathan Giszczak cfec0c3b3c Change language of debug message in Cluster parseProducerKeys. 2023-05-13 01:52:46 -05:00
Jonathan Giszczak 1755aef616 Fix bugs in resource_monitor_plugin_test. 2023-05-13 01:41:51 -05:00
Jonathan Giszczak 03c991ce15 Update Node launchUnstarted method. 2023-05-13 01:07:02 -05:00
Kevin Heifner c45d3dfefc GH-1170 Correctly handle close while syncing 2023-05-12 22:07:49 -05:00
Kevin Heifner 07d5a7476a GH-1062 assert on exclusive ownership of variant_object 2023-05-12 19:43:11 -05:00
Jonathan Giszczak 557a855f49 Remove last vestiges of cachePopen arguments. 2023-05-12 19:22:09 -05:00
Jonathan Giszczak faa5f8cbd6 Merge remote-tracking branch 'origin/test-harness-process-control-main' into test-harness-process-control 2023-05-12 18:29:07 -05:00
Jonathan Giszczak 3802203de2 Merge remote-tracking branch 'origin/test-harness-process-control-main' into test-harness-process-control 2023-05-12 17:48:57 -05:00
Jonathan Giszczak 51f8e000c9 Add address and port to net_plugin's listener logging. 2023-05-12 17:48:48 -05:00
Jonathan Giszczak a953a43c1f Include transaction IDs in transaction exception messages. 2023-05-12 17:48:13 -05:00
Jonathan Giszczak 1245c37019 Add explicit wallet and cluster shutdown to performance_test_basic. 2023-05-12 17:45:24 -05:00
Jonathan Giszczak 9791997f1f When constructing a new testnet, reset node class variables.
Required for performance_test binary search mode.
2023-05-12 17:44:28 -05:00
Jonathan Giszczak 3b0645387d Avoid spurious errors during cluster shutdown. 2023-05-12 17:42:36 -05:00
Jonathan Giszczak b02dc1ad04 Make all parent dirs when creating wallet dir.
Required for performance_test binary tree search mode.
2023-05-12 17:42:10 -05:00
Peter Oschwald cc354955fc Merge pull request #1165 from AntelopeIO/ph-feature-api-op-mode-reporting
[PH] Initial reporting updates for API Node and http transaction generator
2023-05-12 16:21:53 -05:00
Kevin Heifner 89729c0cf1 Test only works with a small number of producers, default now is 21. 2023-05-12 16:21:11 -05:00
Huang-Ming Huang 5d29893aee fix grammar 2023-05-12 16:18:20 -05:00
Huang-Ming Huang e73fd5a20a log categories for listening addresses 2023-05-12 16:12:36 -05:00
Huang-Ming Huang fc91ef758d remove unused include 2023-05-12 16:01:10 -05:00
Huang-Ming Huang 7133a66f47 Merge remote-tracking branch 'origin/main' into huangminghuang/http 2023-05-12 15:12:18 -05:00
Huang-Ming Huang 032e6102b4 fix leap util 2023-05-12 15:06:51 -05:00
Huang-Ming Huang 72be7c93c1 refactor extract_chain_context 2023-05-12 14:23:58 -05:00
Kevin Heifner af766dc80e GH-1062 Simplify recursion_depth lambda 2023-05-12 14:19:37 -05:00
Peter Oschwald 3bac4d8f7c Merge pull request #1161 from AntelopeIO/reopen-subprocess-results
Keep `subprocess_results.log` around when test fails
2023-05-12 14:11:08 -05:00
Kevin Heifner 7b1b90f17d Remove unneeded/unused cachePopen 2023-05-12 14:09:06 -05:00
Peter Oschwald 400c5b891a Address peer review comments. 2023-05-12 14:03:04 -05:00
Kevin Heifner c7bf139eba GH-1062 Refactor start_action_serialization into constructor of context 2023-05-12 13:36:04 -05:00
Peter Oschwald 3343f2521c Merge branch 'main' into ph-feature-api-op-mode-reporting 2023-05-12 13:27:59 -05:00
Peter Oschwald e3b2c0cd6e Initial reporting updates for API Node and http transaction generator 2023-05-12 13:12:59 -05:00
Kevin Heifner d2563d4cdb Sleep for 1 sec instead of 3 2023-05-12 12:41:41 -05:00
Kevin Heifner f0a7821cc4 Pause for 250ms instead of 3 seconds 2023-05-12 12:41:29 -05:00
Kevin Heifner 5c999d2bf2 Use block num trx was included in instead of trx ref_block_num 2023-05-12 12:40:59 -05:00
Huang-Ming Huang a206cf1ce8 fix supplied genesis 2023-05-12 09:57:34 -05:00
Huang-Ming Huang 7cde470ad1 address PR comments 2023-05-12 09:22:04 -05:00
Kevin Heifner 090910abbb Fix merge issue 2023-05-12 08:37:49 -05:00
Huang-Ming Huang 399b616a00 fix file permission 2023-05-12 08:03:50 -05:00
Kevin Heifner aae35e1ba6 Merge remote-tracking branch 'origin/main' into test-harness-process-control-main 2023-05-12 07:54:51 -05:00
Huang-Ming Huang 893ae24774 Merge pull request #1163 from AntelopeIO/huangminghuang/retain-files-main
[4.0->main] change max-retained-history-files default
2023-05-12 07:53:18 -05:00
Kevin Heifner 1394cc7512 GH-1149 Ignore error of remote_endpoint 2023-05-12 07:07:17 -05:00
Kevin Heifner d3a00fcc4e GH-1149 Do not allow remote_endpoint() to throw 2023-05-11 19:39:27 -05:00
Huang-Ming Huang 303e1706b7 fix retained_dir not existed 2023-05-11 15:57:48 -05:00
Huang-Ming Huang ab609f2066 address PR comment 2023-05-11 15:43:31 -05:00
Huang-Ming Huang 1c781358b0 fix replay 2023-05-11 15:11:48 -05:00
Peter Oschwald 9a52e330f8 Make directory detection and creation default behavior. 2023-05-11 13:52:00 -05:00
Huang-Ming Huang 6c765c1337 Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/retain-files-main 2023-05-11 13:20:45 -05:00
Huang-Ming Huang 8a9c4b505a address PR comments 2023-05-11 13:00:42 -05:00
Huang-Ming Huang ab7a120d9e Merge pull request #1141 from AntelopeIO/huangminghuang/retained-file
[4.0] change max-retained-history-files default
2023-05-11 12:51:39 -05:00
Huang-Ming Huang 0880013262 more PR comment fix 2023-05-11 12:47:31 -05:00
Matt Witherspoon 5a685c7331 Merge pull request #1160 from AntelopeIO/bn256_c++20_stdint
bump bn256 to main head with gcc13 + c++20 include fix
2023-05-11 12:47:43 -04:00
Peter Oschwald 92d497e1a4 Reopen checkOutputFilename in case where file may have been deleted, but attr was already set.
Allows for cases where Cluster cleanup is called initially in tests to remove old test data, which should no longer be a problem, however in doing so it now deletes subprocess_results.log while attr for checkOutputFile has already been set.  This allows reopening/recreating the file and continuing to log to it to capture all commands after the initial cleanup.
2023-05-11 11:43:51 -05:00
Kevin Heifner 91ba9e3da0 Merge pull request #1157 from AntelopeIO/virtual-warn
Fix clang warning
2023-05-11 11:29:53 -05:00
Matt Witherspoon ca3ba1fc4f bump bn256 to main head w/ gcc13 + c++20 include fix 2023-05-11 12:18:56 -04:00
Kevin Heifner ffab68b93f Fix clang warning 2023-05-11 10:58:46 -05:00
Vlad 6804cf2b3b Merge pull request #1155 from AntelopeIO/GH-1146-smoke-test-main
[4.0 -> main] Added block log version and num of blocks to output of leap-util block-log smoke-test
2023-05-11 10:15:01 -04:00
Huang-Ming Huang 1d06df34df fix keosd 2023-05-11 08:54:51 -05:00
Kevin Heifner 99f93200ac GH-1062 Use new fc time_point::safe_add 2023-05-10 17:44:07 -05:00
Kevin Heifner e666cd000e GH-1062 Revert unneeded changes to yield call 2023-05-10 17:38:34 -05:00
Kevin Heifner 6096c0bfc1 GH-1062 Refactor abi_serializer to accept a max_action_data_serialization_time which applies only to action data deserialization 2023-05-10 17:31:46 -05:00
Kevin Heifner 724be07d50 GH-1062 Also guard against underflow 2023-05-10 17:21:37 -05:00
Vlad bd75cf0e3b Merge pull request #1059 from AntelopeIO/bsd-stability-issues
Stability issues and improvements on BSD
2023-05-10 17:37:33 -04:00
Huang-Ming Huang 216a96d91a address PR comments 2023-05-10 16:31:39 -05:00
Huang-Ming Huang 0c2fbe9bc8 address PR comments 2023-05-10 15:56:31 -05:00
766C6164 1b885f011f Removed unrelated files from pull request 2023-05-10 16:36:43 -04:00
766C6164 ca4d0e18eb Merge branch 'release/4.0' into GH-1146-smoke-test-main 2023-05-10 16:29:29 -04:00
Vlad b694ae1a88 Merge pull request #1154 from AntelopeIO/GH-1146-smoke-test-40
[4.0] Added block log version and num of blocks to output of leap-util block-log smoke-test
2023-05-10 14:03:35 -04:00
Vlad 6f5ab9bf43 Merge branch 'release/4.0' into GH-1146-smoke-test-40 2023-05-10 12:13:25 -04:00
Vlad 858aad7905 Merge pull request #1147 from AntelopeIO/GH-1042-snapshots-test-coverage
Increase test coverage of snapshot-scheduler
2023-05-10 11:41:45 -04:00
766C6164 9e1edc0601 Added additional logging for smoke-test 2023-05-10 11:36:23 -04:00
Kevin Heifner 1d33a6885e GH-1062 Add variant_object to the exclude list of universal reference constructor of mutable_variant_object since there is an explicit constructor for it. 2023-05-10 06:57:06 -05:00
Lin Huang 8240816c04 Merge pull request #1148 from AntelopeIO/additional_contract_for_readonly_trx_test
Additional test contract for readonly trx test
2023-05-09 20:27:51 -04:00
Lin Huang 3c0ee240dc reduce excessive read-only-trx-parallel-test time from 640 seconds to 311 seconds 2023-05-09 19:16:34 -04:00
766C6164 353f0f315c appbase::app() -> scoped_app 2023-05-09 18:41:11 -04:00
Lin Huang 8b581156c5 add an additional test contract 2023-05-09 16:46:16 -04:00
Lin Huang dfa8b67b04 restructure test startup 2023-05-09 16:37:19 -04:00
Peter Oschwald fcd721115a Merge pull request #1138 from AntelopeIO/ph-feature-api-op-mode-trx-gen
[PH] Feature API Operational Mode and HTTP Transaction Generator
2023-05-09 13:18:49 -05:00
Peter Oschwald 28e8d55189 Address peer review comments. 2023-05-09 12:50:00 -05:00
766C6164 c68a82e5d4 Merge branch 'main' into bsd-stability-issues 2023-05-09 13:37:21 -04:00
766C6164 180bdd1f31 Added additional corner cases and some cleanup 2023-05-09 13:29:17 -04:00
Huang-Ming Huang 4d30e50b42 address PR comments 2023-05-09 08:49:13 -05:00
Huang-Ming Huang 448cbd137e fix config_dir 2023-05-09 08:05:41 -05:00
Jonathan Giszczak 5e04d627ad Use new Node name to fix an error message in under_min_avail_ram. 2023-05-08 19:03:15 -05:00
Jonathan Giszczak c9b028ff4a For some inexplicable reason, Nodes didn't know their own name.
Now they do.
2023-05-08 19:02:20 -05:00
Jonathan Giszczak 79e691b1a5 Don't append empty values in Node relaunch. 2023-05-08 18:15:27 -05:00
Jonathan Giszczak 9839af1fcd Reduce ship streamer runtime and fix logic error. 2023-05-08 16:45:48 -05:00
Jonathan Giszczak 2fecddffb0 Move keosd data directory into the unique per test directory. 2023-05-08 16:44:23 -05:00
Jonathan Giszczak 8ef2129048 In Node relaunch, use a new timestamp for launch time in relaunch. 2023-05-08 16:43:38 -05:00
Jonathan Giszczak d0e5fa009f In Cluster bootstrap, only use first 21 available producer accounts in schedule.
Increase default start delay between nodes from 1s to 2s.
Rework producer schedule command-line to use JSON module instead of
manual punctuation.
2023-05-08 16:41:32 -05:00
Huang-Ming Huang f17380b912 add gelf test 2023-05-08 15:46:13 -05:00
Huang-Ming Huang 841896f873 fix local_address 2023-05-08 15:31:58 -05:00
Kevin Heifner 0eec87e9e6 GH-1062 small optimization 2023-05-08 14:33:46 -05:00
Matt Witherspoon 0f79a5f467 Merge pull request #1143 from AntelopeIO/app&chainbase_ci_bump
bump chainbase & appbase submodules to main w/ CI tweaks
2023-05-08 14:27:16 -04:00
Matt Witherspoon bf1c80e4bf Merge pull request #1140 from 7flash/main
Update ship_client.cpp
2023-05-08 13:36:49 -04:00
Matt Witherspoon 210b88ac07 bump chainbase & appbase submodules to main w/ CI tweaks 2023-05-08 12:54:28 -04:00
Huang-Ming Huang 8b5645ab17 revise host validation 2023-05-08 10:47:53 -05:00
Kevin Heifner 0ef8b0960b GH-1062 Only reset deadline when explicitly asked to do so. 2023-05-08 09:45:28 -05:00
Kevin Heifner 05ff75236d GH-1062 Need to copy yield function since it is a const& 2023-05-08 09:38:58 -05:00
Kevin Heifner 0966651a9c GH-1062 Fix issue with variant internal variant_object being shared 2023-05-08 09:37:46 -05:00
Huang-Ming Huang 4022ed12ae change state-history-stride default 2023-05-08 08:45:16 -05:00
Igor Berlenko 29d97d2a70 Update ship_client.cpp 2023-05-08 19:33:28 +08:00
Kevin Heifner a7c5d3c048 GH-1062 Avoid unneeded copies 2023-05-06 08:17:37 -05:00
Huang-Ming Huang 444edc68cb conditional enable ipv6 test 2023-05-05 16:18:22 -05:00
Zach bb928c9cab Merge pull request #857 from AntelopeIO/zach-install-deps
Simplify Pinned Build Scripts
2023-05-05 16:40:12 -04:00
Peter Oschwald 69748fc993 Cleanup. Use std::variant for connections. 2023-05-05 15:27:57 -05:00
Peter Oschwald 815ac6e55f Fix tests. 2023-05-05 15:00:39 -05:00
Peter Oschwald 2bd0f23cd5 Fixes from peer review. 2023-05-05 14:55:29 -05:00
Peter Oschwald 53a720bc15 Peer review comments. 2023-05-05 14:19:35 -05:00
Huang-Ming Huang cfbd1e5504 fix host header 2023-05-05 14:11:16 -05:00
Peter Oschwald d64ccd7d40 Move elog outside of while loop. 2023-05-05 13:59:44 -05:00
Peter Oschwald 7b41fe2050 Address peer review comment. Missed method removal. 2023-05-05 13:55:24 -05:00
Peter Oschwald f342f5e3ca Address peer review comments. 2023-05-05 13:40:32 -05:00
Kevin Heifner 7e2bd04ef8 GH-1062 Enforce processing on the main thread to http-max-response-time up to a max of 1000 items or http-max-response-time is -1. 2023-05-05 13:30:26 -05:00
Kevin Heifner d480a26815 GH-1062 mutable_variant_object constructor for variant_object now explicit 2023-05-05 13:28:30 -05:00
Kevin Heifner cb1b52de82 GH-1062 Remove deadline since we no longer want to interrupt json creation on the http thread 2023-05-05 13:28:02 -05:00
Kevin Heifner 0e8739efc7 GH-1062 Remove deadline since we no longer want to interrupt json creation on the http thread 2023-05-05 13:26:14 -05:00
Kevin Heifner 086f1fb367 GH-1062 Add a safe_add that does not overflow. 2023-05-05 13:25:08 -05:00
Kevin Heifner 4e176a137c GH-1062 Change default abi_serializer yield function to enforce max_serialization_time per serialization step. 2023-05-05 13:24:11 -05:00
Kevin Heifner 9bcbb44624 GH-1062 Add move constructor for variant_object to mutable_variant_object 2023-05-05 13:22:15 -05:00
Huang-Ming Huang be4d98f0da fix for ubuntu 22.04 2023-05-05 12:14:37 -05:00
Peter Oschwald 77a215ab17 Put new tests in proper test categories. 2023-05-05 11:17:05 -05:00
Peter Oschwald 541cbd2413 Merge branch 'main' into ph-feature-api-op-mode-trx-gen 2023-05-05 09:59:21 -05:00
Peter Oschwald 0c055f3a79 Add API Node and Http Transaction Generator to performance harness. 2023-05-05 09:53:30 -05:00
Huang-Ming Huang 6fb23ca8e4 support multiple http endpoints 2023-05-05 09:31:05 -05:00
Lin Huang 31ae4cbe7a Merge pull request #1134 from AntelopeIO/read_only_trx_config_fix_main
[4.0 -> main] Check read-only trx options only when read-only-thread enabled, and present better error message
2023-05-04 14:03:28 -04:00
Lin Huang 4fc70c3994 Merge remote-tracking branch 'origin/release/4.0' into read_only_trx_config_fix_main 2023-05-04 12:58:50 -04:00
Lin Huang 117f022889 Merge pull request #1129 from AntelopeIO/read_only_trx_config_fix_4_0
[4.0] Check read-only trx options only when read-only-thread enabled, and present better error message
2023-05-04 12:56:23 -04:00
Lin Huang 11ad31e62c log configuration options and other values from the user perspective 2023-05-04 11:40:24 -04:00
Vlad 12543bb366 Merge branch 'main' into bsd-stability-issues 2023-05-04 10:31:24 -05:00
766C6164 459570dd7c Generalized macos specific timer to work on FreeBSD 2023-05-04 11:25:46 -04:00
Lin Huang 2b5095736d use enum instead of bool for better status indication 2023-05-04 10:03:37 -04:00
Lin Huang 4e98b2e9de make sure _ro_max_trx_time_us is always initialized 2023-05-04 09:32:42 -04:00
Kevin Heifner da28bc91e3 Merge remote-tracking branch 'origin/main' into GH-1062-time-limits 2023-05-04 06:18:03 -05:00
Kevin Heifner a36113873e Merge pull request #1125 from AntelopeIO/GH-1062-time-cleanup
Remove time_point implicit conversions
2023-05-04 06:15:50 -05:00
Lin Huang ce0260f810 test case for read-only trx related options not validated if read-only-threads is 0 2023-05-03 21:02:06 -04:00
Lin Huang fe64b22d6b Do not check execution window related configurations if --read-only-threads is not configured; better error message for invalid --read-only-write-window-time-us 2023-05-03 20:58:47 -04:00
766C6164 0af823f49b Bump chainbase to c4718cb 2023-05-03 16:47:59 -04:00
Kevin Heifner 1f60ff9143 GH-1062 Rename time_point to_string to to_iso_string 2023-05-03 13:53:40 -05:00
Kevin Heifner 6b10d8053a GH-1062 Remove possibly confusing arithmetic operators for time_point_sec. Remove implicit conversion from time_point to time_point_sec via operator=. 2023-05-03 13:41:10 -05:00
Kevin Heifner 18190c138a GH-1062 Remove time_point implicit conversions 2023-05-03 11:39:29 -05:00
Peter Oschwald d74d96e7fb Missed one location of Remove parameter in favor of using member variable directly. 2023-05-03 11:08:51 -05:00
Peter Oschwald b7286f7198 Remove duplication. Use port as unsigned short instead of string. 2023-05-03 11:06:36 -05:00
Peter Oschwald b818e68ae6 Simplify. Remove parameter in favor of using member variable directly. 2023-05-03 11:05:24 -05:00
Vlad 206d67adda Merge branch 'main' into bsd-stability-issues 2023-05-03 08:48:39 -04:00
Gregory Popovitch 174e8ff269 Merge pull request #1118 from AntelopeIO/update_pinned_build_dep_versions
Update pinned build versions for boost and llvm-src
2023-05-02 17:21:40 -04:00
Kevin Heifner 8cb572cab0 GH-1062 Add 1000 limit 2023-05-02 15:44:36 -05:00
Kevin Heifner 6c831db8f3 GH-1062 Use maximum() instead of 365 days for max 2023-05-02 15:32:57 -05:00
greg7mdp 7b682031eb Merge branch 'main' of github.com:AntelopeIO/leap into update_pinned_build_dep_versions 2023-05-02 15:15:36 -04:00
greg7mdp 8e66a744a7 Remove unneeded #ifdef in chain/types.hpp now that boost >= 1.71 2023-05-02 14:13:41 -04:00
Kevin Heifner 2eb261c592 GH-1062 Enforce http_max_response_time on main thread only and always return at least one. 2023-05-02 13:07:56 -05:00
Kevin Heifner 4692fd819b GH-1062 Remove unused struct 2023-05-02 13:06:32 -05:00
greg7mdp f91fff6cd4 Remove unneeded patch file 2023-05-02 14:02:58 -04:00
greg7mdp 88597fb03b Remove patched suffix 2023-05-02 13:49:46 -04:00
greg7mdp 6e1703dcd6 Get rid of the "patched" postfix 2023-05-02 13:40:38 -04:00
greg7mdp 2dcb42f3ef Update boost version in CMakeLists.txt to 1.71 2023-05-02 13:40:18 -04:00
Kevin Heifner bbeafe9eff GH-1062 Remove deadline from trace_api_plugin 2023-05-02 11:40:43 -05:00
iamveritas 2ad3148e27 Merge pull request #1110 from AntelopeIO/fix-devrel#205-4.0
[main] Update swagger files to include missing documentation
2023-05-02 19:20:39 +03:00
greg7mdp 26fe87e461 Remove typo 2023-05-02 12:16:02 -04:00
greg7mdp 0ca97bb612 Revert back to using clang build for ubuntu 16.04 2023-05-02 12:04:14 -04:00
greg7mdp d7dba628e3 llvm -> 11.0.1, boost -> 1.82 2023-05-02 11:35:54 -04:00
iamveritas 5a0f78f924 Merge pull request #1087 from AntelopeIO/fix-devrel#205-4.0
[4.0] Update swagger files to include missing doc
2023-05-02 10:56:01 +03:00
iamveritas 079935ed4e improvements based on peer review feedback 2023-05-02 10:29:35 +03:00
766C6164 1ab5a22606 Point to updated cb 2023-05-01 23:44:46 -04:00
Vlad 2029ce0d3d Merge branch 'main' into bsd-stability-issues 2023-05-01 20:40:12 -04:00
Vlad 3bdf68effc Merge pull request #1115 from AntelopeIO/GH-586-reorg-tests-plugins
Reorganize tests for plugins
2023-05-01 20:38:09 -04:00
Kevin Heifner 324ff339be Merge pull request #1112 from AntelopeIO/GH-259-test-cleanup
Tests: misc cleanup
2023-05-01 15:14:47 -05:00
Kevin Heifner 32ce2728eb GH-259 Add default case for setup_policy operator<<. 2023-05-01 13:53:31 -05:00
766C6164 f83ea63058 Trace api plugin convert to one test executable 2023-05-01 13:33:26 -04:00
766C6164 baf90e5005 Made chain plugin unit tests single executable 2023-05-01 12:40:18 -04:00
766C6164 d2833e6bca Cleaned up producer_plugin tests 2023-05-01 12:28:40 -04:00
Kevin Heifner 4b85f4ee6d GH-259 Add back TESTER macro since used in all generated tests. 2023-05-01 10:05:06 -05:00
Kevin Heifner 20cea10050 GH-259 Removed unused NON_VALIDATING_TEST 2023-05-01 09:33:27 -05:00
Peter Oschwald 3c261c85b6 remove unused function. 2023-05-01 09:15:03 -05:00
Kevin Heifner 51c71c662d GH-259 Remove old_wasm_tester and add test cases for different protocol featurs enabled. 2023-05-01 07:58:43 -05:00
Kevin Heifner a056b77b18 GH-259 Update tester to allow setup_policy to be used as boost data in tests 2023-05-01 07:58:02 -05:00
iamveritas 18d79f4cf3 take out <size> cause is not rendered correctly in final docs 2023-04-30 23:21:55 +03:00
Jonathan Giszczak fc94d3ab7d Update performance_test_basic. 2023-04-28 18:36:04 -05:00
Jonathan Giszczak e84f1479d9 Update restart-scenarios-test. 2023-04-28 17:53:21 -05:00
Jonathan Giszczak f76d4356d8 Rewrite node relaunch command line manipulation. 2023-04-28 16:22:53 -05:00
Kevin Heifner 57d5546b7b Merge pull request #1108 from AntelopeIO/GH-641-escape-opt
Optimization: New escape_str function for sanitizing strings
2023-04-28 13:26:31 -05:00
Kevin Heifner bbeaf9893c Merge pull request #1095 from AntelopeIO/GH-641-libfc-tests
Refactor libfc tests into one executable
2023-04-28 13:25:56 -05:00
Kevin Heifner 44355def2a GH-641 Remove unneeded if check 2023-04-28 12:37:45 -05:00
Gregory Popovitch b8be7391a0 Merge pull request #1103 from AntelopeIO/fix_gcc_10_link_issue
Fix g++-10 link issue when building with -std=c++20.
2023-04-28 13:23:03 -04:00
Kevin Heifner 0cee264774 GH-641 std::string_view instead of const char* 2023-04-28 12:10:12 -05:00
Kevin Heifner 332e22e931 GH-641 Use enum instead of bool 2023-04-28 11:48:01 -05:00
Kevin Heifner 4bbb4910fc GH-641 Add new test file 2023-04-28 11:47:39 -05:00
iamveritas 4f87a1b050 corect ref links 2023-04-28 18:48:55 +03:00
iamveritas c4f383ae2b Update swagger files to include: get_transaction_status, compute_transaction, send_transaction2 2023-04-28 18:48:55 +03:00
Kevin Heifner 122ad36b7d GH-641 Add parens so precedence is clearer 2023-04-28 10:28:19 -05:00
Matt Witherspoon 1bb997d030 Merge pull request #1097 from AntelopeIO/fix_test_container_log_upload
fix parallel-ctest-containers creation of log tarballs on failure
2023-04-28 11:06:16 -04:00
Kevin Heifner 9cbb09d0f5 GH-641 Optimize print_debug 2023-04-28 09:36:50 -05:00
Gregory Popovitch 59b519a103 Merge pull request #1107 from AntelopeIO/libc++_build_issues
`std::result_of` was deprecated in C++17, removed in C++20.
2023-04-28 10:36:46 -04:00
Kevin Heifner 94e7bd0696 GH-641 Use more efficient escape_str instead of format_string 2023-04-28 09:36:15 -05:00
Kevin Heifner 8375d5e634 GH-641 Add escape_str function 2023-04-28 09:35:35 -05:00
Huang-Ming Huang a8c34044f4 Merge pull request #1074 from AntelopeIO/huangminghuang/refactor-prometheus
refactor prometheus plugin
2023-04-28 09:31:24 -05:00
greg7mdp ac2c37c349 std::result_of was deprecated in C++17, removed in C++20. 2023-04-28 10:17:42 -04:00
Eric Passmore b0290bb60e Merge pull request #1105 from AntelopeIO/ehp/GH-1094-fix-swagger-component-path
4.0: Documentation fixed Error path in producer plugin swagger
2023-04-28 06:19:46 -07:00
Kevin Heifner ca7e9b1ae4 GH-641 Add an explicit main 2023-04-28 07:12:00 -05:00
Jonathan Giszczak d9eee885fa Python documentation never mentions FileNotFoundError in subprocess.run 2023-04-27 20:45:45 -05:00
Vlad 09e1b90de7 Merge pull request #1037 from AntelopeIO/snapshot-scheduler-refactoring
Snapshot code refactoring
2023-04-27 21:38:36 -04:00
Jonathan Giszczak 0997737b27 Don't wait for token issue action during bootstrap to be finalized. 2023-04-27 19:02:10 -05:00
Jonathan Giszczak 22c2105b03 Write network topology visualization file to each test directory.
Render network topology to PNG, ignoring if 'dot' tool isn't installed.
2023-04-27 19:00:56 -05:00
greg7mdp e71453641d Move variable declaration from Logging to IR as per PR comment. 2023-04-27 18:32:43 -04:00
greg7mdp d08a6b1202 Merge branch 'main' of github.com:AntelopeIO/leap into fix_gcc_10_link_issue 2023-04-27 18:02:43 -04:00
Eric Passmore 52a7df3d72 fixed rel path to Error 2023-04-27 14:55:38 -07:00
Huang-Ming Huang dff7b524ba Merge remote-tracking branch 'origin/main' into huangminghuang/refactor-prometheus 2023-04-27 16:43:57 -05:00
Gregory Popovitch c5bec2b3a5 Merge pull request #1070 from AntelopeIO/c++20_update
Changes for building with c++20.
2023-04-27 17:37:50 -04:00
Huang-Ming Huang 67edf65502 remove unused parameter 2023-04-27 16:24:14 -05:00
greg7mdp a4681a3c04 Declare WASM::check_limits variable is Logging library to fix g++ issue
Within `libraries/wasm-jit/Source`, `WASM` depends on `IR` and `Logging`, and `IR` depends on
`Logging`.
With the current declaration of `WASM::check_limits` in `WASM`, we have the following g++-10 link
error when building with `-std=c++20`:

```
_64-linux-gnu/libz.so  -ldl  libraries/libfc/secp256k1/libsecp256k1.a  libraries/chainbase/libchainbase.a  -lpthread  libraries/softfloat/libsoftfloat.a && :
/usr/bin/ld: libraries/wasm-jit/Source/IR/libIR.a(DisassemblyNames.cpp.o): warning: relocation against `_ZN4WASM12check_limitsE' in read-only section `.text'
/usr/bin/ld: libraries/wasm-jit/Source/IR/libIR.a(DisassemblyNames.cpp.o): in function `void Serialization::serialize<Serialization::MemoryInputStream>(Serialization::MemoryInputStream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/greg/github/enf/leap/libraries/wasm-jit/Include/Inline/Serialization.h:274: undefined reference to `WASM::check_limits'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
```

Moving the declaration of `WASM::check_limits` in `Logging` (end leaf of dependency graph) fixes the issue.
2023-04-27 15:36:51 -04:00
Peter Oschwald bcd70c2302 Merge pull request #1093 from AntelopeIO/ph-feature-api-op-mode
[PH] Initial API Node (HTTP Node) Support - Topology definition/configuration
2023-04-27 13:25:58 -05:00
Matt Witherspoon 9023583231 fix parallel-ctest-containers creation of log tarballs on failure 2023-04-27 13:08:46 -04:00
Huang-Ming Huang 22dd72753e address PR comments 2023-04-27 11:33:50 -05:00
Kevin Heifner 8db6fd8654 GH-641 Explicitly list source files to avoid cmake issues with GLOB 2023-04-27 11:32:09 -05:00
Kevin Heifner 72d47e0a21 GH-641 Remove unneeded CMakeLists.txt files 2023-04-27 09:13:39 -05:00
Kevin Heifner c410c7c943 GH-641 Refactor libfc tests into one executable 2023-04-27 09:07:31 -05:00
Jonathan Giszczak b3a9ed2fe6 Update terminate-scenarios-tests.
Includes update of Cluster relaunchEosInstances() method.
Fix bug in Node relaunch when launching a new chain.
2023-04-26 19:10:49 -05:00
greg7mdp 1f741664b6 Merge branch 'main' of github.com:AntelopeIO/leap into c++20_update 2023-04-26 14:03:34 -04:00
Gregory Popovitch 99d196176a Merge pull request #1092 from AntelopeIO/update_chainbase_tip
Update chainbase to tip (-Wfree-nonheap-object warning suppressed for gcc-12)
2023-04-26 14:02:13 -04:00
Peter Oschwald 18fd82fd7e Update README documentation. 2023-04-26 12:13:43 -05:00
Peter Oschwald 22a5aa1f08 Add initial support for configuring and running an API node. 2023-04-26 11:52:56 -05:00
Peter Oschwald ee930e01a7 Encapsulate validation node configuration. 2023-04-26 10:39:59 -05:00
greg7mdp 847fec0f13 Update chainbase to tip (-Wfree-nonheap-object suppressed got gcc-12) 2023-04-26 11:38:25 -04:00
greg7mdp abf1e75713 Merge branch 'main' of github.com:AntelopeIO/leap into c++20_update 2023-04-26 11:30:20 -04:00
Kevin Heifner 3342373d67 Merge pull request #1091 from AntelopeIO/GH-1081-dry-run-auth-check
[4.0 -> main] fix: not fail on signature checks for dry-run txns
2023-04-26 10:20:01 -05:00
Kevin Heifner 224630968a Merge remote-tracking branch 'origin/release/4.0' into GH-1081-dry-run-auth-check 2023-04-26 09:47:42 -05:00
Kevin Heifner b56d4b5400 Merge pull request #1090 from AntelopeIO/GH-1081-dry-run-auth-check-4.0
[3.2 -> 4.0] fix: not fail on signature checks for dry-run txns
2023-04-26 09:47:18 -05:00
Kevin Heifner e33ed69fcb Merge remote-tracking branch 'origin/release/3.2' into GH-1081-dry-run-auth-check-4.0 2023-04-26 09:13:17 -05:00
Kevin Heifner e059d8213e Merge pull request #1089 from AntelopeIO/GH-1081-dry-run-auth-check-3.2
[3.2] fix: not fail on signature checks for dry-run txns
2023-04-26 09:11:45 -05:00
Pinelliaw e07fd0a0c8 Fix not fail on signature checks for dry-run, include the time it takes for checker.all_keys_used() 2023-04-26 07:54:42 -05:00
Matt Witherspoon 6184957f42 Merge pull request #1081 from PinelliaC/main
fix: not fail on signature checks for dry-run txns
2023-04-25 21:56:28 -04:00
PinelliaC e585d0edbc Merge branch 'main' into main 2023-04-26 07:48:48 +08:00
Jonathan Giszczak 41708e6228 Update block_log_util_test. 2023-04-25 18:18:35 -05:00
Jonathan Giszczak fdffa3ed76 Update nodeos_snapshot_diff_test.
Remove rmFromFile used by only one test for config file editing and
replace with rmFromCmd in Node to achieve same.
2023-04-25 18:13:58 -05:00
greg7mdp e88383e409 Merge branch 'main' of github.com:AntelopeIO/leap into c++20_update 2023-04-25 18:37:36 -04:00
Gregory Popovitch 4a4ed579dc Merge pull request #1086 from AntelopeIO/update_submodules_tip
Update submodules to the version building with `-std=c++20`
2023-04-25 18:33:36 -04:00
Peter Oschwald 4f431014f1 Refactor how cluster is configured to give higher level understanding of the node types being configured.
Instead of simply relying on cluster's pnodes and totalnodes specification, add higher level definition of producerNodeCount and validationNodeCount (can be added to as additional node types are supported) that in sum make totalNodes.  Also pre-populate the nodeIds that cluster will configure for each node type.

Remove support for -s (topo) as currently only supporting default of
mesh anyway.
2023-04-25 17:10:20 -05:00
766C6164 d052b65a15 Removed not needed anymore header 2023-04-25 17:41:38 -04:00
766C6164 925ad20690 Addressed merge conflict 2023-04-25 17:39:07 -04:00
Vlad fd7051b6f3 Merge branch 'main' into snapshot-scheduler-refactoring 2023-04-25 17:01:40 -04:00
greg7mdp 5f01a2adac Update submodules to the version building with -std=c++20 2023-04-25 16:59:26 -04:00
Jonathan Giszczak 8816a9560c Update larger_lib_test. 2023-04-25 15:42:14 -05:00
Jonathan Giszczak 52bacf03a4 Update nodeos_chainbase_allocation_test. 2023-04-25 15:38:50 -05:00
greg7mdp 3f5c96f848 Merge branch 'main' of github.com:AntelopeIO/leap into c++20_update 2023-04-25 16:35:29 -04:00
Jonathan Giszczak 7071a350d0 Add missing command-line option to http-plugin-test.
Avoid adding duplicates of http-server-address and http-validate-host to
nodeos command line.  boost doesn't tolerate duplicates from the same
source.
2023-04-25 15:30:21 -05:00
766C6164 ef09502162 Missed one more spot 2023-04-25 15:01:11 -04:00
Kevin Heifner cc4a46df64 Merge pull request #1076 from AntelopeIO/GH-668-circle-dep
Refactor: Move subjective_billing to chain library
2023-04-25 13:12:44 -05:00
greg7mdp 7161fb6016 Merge branch 'main' of github.com:AntelopeIO/leap into c++20_update 2023-04-25 13:24:52 -04:00
greg7mdp 6bf4c8881f remove no longer used noncopyable struct 2023-04-25 13:06:43 -04:00
Pinelliaw a3589123ec refactor: include the time it takes for checker.all_keys_used() 2023-04-26 01:04:02 +08:00
766C6164 79a2f281c5 Removed a separate header related to json db 2023-04-25 12:50:39 -04:00
766C6164 02590a54d7 Addressng feedback 2023-04-25 12:31:48 -04:00
Kevin Heifner d2beec373b Merge branch 'main' into main 2023-04-25 11:17:59 -05:00
Huang-Ming Huang 101f11fa6c Merge pull request #1023 from AntelopeIO/huangminghuang/python-sitelib
use python_DISTLIB
2023-04-25 11:14:21 -05:00
Vlad b064339e91 Merge branch 'main' into snapshot-scheduler-refactoring 2023-04-25 11:39:40 -04:00
Matt Witherspoon 004130086c Merge pull request #1080 from AntelopeIO/ambig_variant_error
fix ambiguous to_variant()s in json tests
2023-04-25 10:37:41 -04:00
Pinelliaw a6b95519d0 fix: not fail on signature checks for read-only txns 2023-04-25 21:26:28 +08:00
Jonathan Giszczak b087d37b23 Revise node verifyAlive and launchUnstarted, fix relaunch (some more)
Update nodeos_read_terminate_at_block_test.
2023-04-24 20:36:24 -05:00
Matt Witherspoon 16685ab12d fix ambiguous to_variant()s 2023-04-24 17:31:27 -04:00
Lin Huang 83be35f713 Merge pull request #1078 from AntelopeIO/merge_4_0_0_version_bump
[4.0 -> main] Merge 4.0.0 version bump to main
2023-04-24 17:14:21 -04:00
Lin Huang 889d312468 correct version after merging 4.0.0 version bump 2023-04-24 15:56:46 -04:00
Kevin Heifner c5774f6911 GH-668 Remove space which confuses CMakeLists.txt processing 2023-04-24 14:55:03 -05:00
Lin Huang 48e83f138d Merge pull request #1077 from AntelopeIO/bump_to_4_0_0
[4.0] Bump Leap version to 4.0.0
2023-04-24 15:43:25 -04:00
Lin Huang af8383c34c [4.0] Bump Leap version to 4.0.0 2023-04-24 15:13:50 -04:00
Gregory Popovitch b67d1747dd Merge pull request #1075 from AntelopeIO/fix_abi_test_check
Fix test failure on fast machine (release builds)
2023-04-24 14:44:33 -04:00
Kevin Heifner a7d268df10 GH-668 Move subjective_billing to chain library. Break circular dependency between producer_plugin and chain_plugin. 2023-04-24 13:40:37 -05:00
greg7mdp f5cb026ee1 Lower another timeout which I hit occasionally when running tests. 2023-04-24 14:25:08 -04:00
greg7mdp 663fc516d1 Fix test failure on fast machine (release builds)
When I build in release mode, I have the following tests failing (both gcc-12 and clang-16, no problem in debug)
/home/greg/github/enf/leap/unittests/api_tests.cpp(1078): error: in "api_tests/checktime_pause_max_trx_cpu_extended_test": elapsed 26100us
/home/greg/github/enf/leap/unittests/api_tests.cpp(1136): error: in "api_tests/checktime_pause_max_trx_extended_test": elapsed 26056us

This is the first failure in the code:

      // This assumes that loading the WASM takes at least 1.5 ms
   // If this check fails but duration is >= 24'999 (previous check did not fail), then the check here is likely
   // because WASM took less than 1.5 ms to load.
   BOOST_CHECK_MESSAGE( dur > 26'500, "elapsed " << dur << "us" );
2023-04-24 13:50:14 -04:00
Huang-Ming Huang 5cbdf9bf1c refactor prometheus plugin 2023-04-24 12:30:09 -05:00
Huang-Ming Huang c81ae9a766 revert to use distutils 2023-04-24 09:24:47 -05:00
greg7mdp b40f23f64f Remove #ifdef preserving the nocopy constraint as per PR comment 2023-04-24 10:00:19 -04:00
Jonathan Giszczak 2cfeb99d8d Update cli_test. 2023-04-21 19:01:47 -05:00
Jonathan Giszczak 716665b0a8 Update plugin_http_api_test. 2023-04-21 18:58:09 -05:00
greg7mdp 55319ec01e Merge branch 'main' of github.com:AntelopeIO/leap into c++20_update 2023-04-21 19:27:53 -04:00
Peter Oschwald 6d4a3ac00d Remove duplicate of max_requests_in_flight 2023-04-21 15:55:04 -05:00
Jonathan Giszczak 7fa30714e6 Update protocol feature test.
Fixes to Node kill and relaunch.
Cache config_dir in Node.
2023-04-21 15:17:45 -05:00
greg7mdp fdc3bf6f38 Changes for building with c++20.
With these changes, plus the ones in the PRs opened in the following submodules:

- bn256
- eos-vm
- CLI11
- abieos

Leap builds with clang-16 in c++20 mode.
2023-04-21 15:57:00 -04:00
Peter Oschwald f9ac95cb9b Add command line support for http-max-in-flight-requests. 2023-04-21 14:47:06 -05:00
Peter Oschwald e994655f0d Slight reorg of config items in op modes doc showing associated plugin. 2023-04-21 14:46:34 -05:00
Peter Oschwald f91b9724a5 Factor out TestHelperConfig and ClusterConfig setup from args into one reusable location/helper function. 2023-04-21 14:09:00 -05:00
Gregory Popovitch 48b6a4e27c Merge pull request #1054 from AntelopeIO/gh-743
Move abi serialization of transaction trace off main thread for `chain_plugin: get_table_rows` and `get_account`
2023-04-21 13:45:27 -04:00
Peter Oschwald 3b99d8322e Merge pull request #1052 from AntelopeIO/ph-add-http-client-async
[PH] Add http client async
2023-04-21 12:19:42 -05:00
Peter Oschwald 73383f2710 Merge branch 'main' into ph-add-http-client-async 2023-04-21 11:51:36 -05:00
Peter Oschwald eacc0122f4 Merge pull request #1056 from AntelopeIO/ph-add-api-op-mode-desc
[PH] Update initial API Node Op Mode documentation.
2023-04-21 11:50:16 -05:00
Peter Oschwald f02287e445 Address peer review comments. 2023-04-21 11:06:30 -05:00
Matt Witherspoon 694b11b4a1 Merge pull request #1069 from AntelopeIO/libtester_boost170_cmake
remove boost <1.70 workaround in libtester cmakes
2023-04-21 10:36:37 -04:00
Matt Witherspoon fe16dc2967 Merge pull request #1068 from AntelopeIO/unused_libssl_libtester
remove unused libssl from libtester cmakes
2023-04-21 10:36:26 -04:00
Peter Oschwald 9ff417bc69 Fix comment. 2023-04-21 09:25:43 -05:00
Matt Witherspoon 5c5f550b8c also remove now always empty libosssl variable from link list 2023-04-21 10:22:05 -04:00
Peter Oschwald 575d7596e1 Small updates to config and performance measurement sections. 2023-04-21 09:21:46 -05:00
Matt Witherspoon 380dd917c8 remove boost <1.70 workaround in libtester cmakes 2023-04-20 20:04:38 -04:00
Matt Witherspoon 4594716347 remove unused libssl from libtester cmakes 2023-04-20 20:01:44 -04:00
Jonathan Giszczak eb4098db9f Update relaunch method to always save popen and use cmd array 2023-04-20 18:24:06 -05:00
Jonathan Giszczak b95a8db827 Remove --nodeos-log-path launcher argument and use existing config and data dir arguments
Move config directories into test parent directory with data for same.
2023-04-20 18:22:22 -05:00
766C6164 2215bc4ed5 fixes to merge conflicts 2023-04-20 17:00:19 -04:00
Vlad fc4d60af70 Merge pull request #1058 from AntelopeIO/compile-fix-std
Added missing namespace to logger in case of FC_USE_PTHREAD_NAME_NP not defined
2023-04-20 16:52:36 -04:00
766C6164 94540634be Merge 2023-04-20 15:48:23 -04:00
766C6164 c64783366e Merge branch 'main' into snapshot-scheduler-refactoring 2023-04-20 15:47:52 -04:00
Lin Huang da014a698a Merge pull request #1061 from AntelopeIO/update_chainbase
Update chainbase to include comparison of different signedness warning fix
2023-04-20 15:30:30 -04:00
greg7mdp 6f5254e442 Address PR comments 2023-04-20 15:05:08 -04:00
Lin Huang 57eab29d7a Merge branch 'main' into update_chainbase 2023-04-20 14:31:03 -04:00
Vlad 2b5b3ceedf Merge pull request #1060 from AntelopeIO/stringify-json-fix
Properly stringify both large and small int64's when converting to json
2023-04-20 13:53:00 -04:00
766C6164 c9c84d6175 adjustments 2023-04-20 13:26:28 -04:00
766C6164 876910a81b Merge branch 'stringify-json-fix' of github.com:AntelopeIO/leap into stringify-json-fix 2023-04-20 11:42:48 -04:00
766C6164 d3a36d3214 fix 2023-04-20 11:42:25 -04:00
Vlad 27325ffbfd Merge branch 'main' into stringify-json-fix 2023-04-20 10:30:08 -04:00
766C6164 24f886de91 updated if condition 2023-04-20 10:18:02 -04:00
Lin Huang 0457c48bfb Update chainbase to include comparison of different signedness warning fix 2023-04-20 09:31:07 -04:00
Lin Huang cba6aa8212 Merge pull request #1055 from AntelopeIO/fix_warning
Fix control reaches end of non-void function warning
2023-04-19 22:08:27 -04:00
Jonathan Giszczak 2e832a8150 Fix wrong variable name. 2023-04-19 19:04:50 -05:00
Jonathan Giszczak 5c814dad79 Merge branch 'main' into test-harness-process-control 2023-04-19 18:22:17 -05:00
Jonathan Giszczak 77f321dc09 Manage tracking and lifetime of bios node better. 2023-04-19 18:18:18 -05:00
766C6164 9501ea2b90 Convert small neg values to string as well 2023-04-19 19:00:27 -04:00
greg7mdp 1d19a7d2f1 Merge branch 'main' of github.com:AntelopeIO/leap into gh-743 2023-04-19 16:51:53 -04:00
766C6164 619de63b3d Added missing namespace 2023-04-19 16:45:02 -04:00
766C6164 3846d8653d Added bsd specific kevent-based timer 2023-04-19 16:23:43 -04:00
Kevin Heifner f583e29d76 Merge pull request #1049 from AntelopeIO/fc-cleanup
FC cleanup
2023-04-19 14:28:52 -05:00
Kevin Heifner d658d61081 Added include of optional 2023-04-19 13:58:24 -05:00
Kevin Heifner 202f224991 Remove some additional unused code 2023-04-19 13:44:06 -05:00
Lin Huang 6f8896ecd7 Fix a compile error from last minute change 2023-04-19 14:23:10 -04:00
Peter Oschwald 6a0beee038 Update initial API Node Op Mode documentation. 2023-04-19 13:13:48 -05:00
greg7mdp d75c0421f4 Fix compilation issue. 2023-04-19 14:12:54 -04:00
Lin Huang 8834403ca0 Fix control reaches end of non-void function warning 2023-04-19 14:06:36 -04:00
greg7mdp 1640c382de Update get_account() to serialize off the main thread. 2023-04-19 13:45:04 -04:00
Peter Oschwald b9f2d280a1 Add missing source file to executable in CMakeLists.
minor reformatting of CMakeLists
2023-04-19 10:55:39 -05:00
Peter Oschwald 81504813b7 Switch to callback model instead of promise/future.
Some reformatting of the new code.

Additional test checks
2023-04-19 10:41:39 -05:00
Peter Oschwald 0dbce37fce Make fail function inline. 2023-04-19 09:22:38 -05:00
Peter Oschwald f1b6b770b0 Add missed include 2023-04-19 08:29:50 -05:00
Peter Oschwald bc807a2660 Merge branch 'ph-feature-api-node-op-mode' into ph-add-http-client-async 2023-04-19 08:19:52 -05:00
Peter Oschwald ce33412a09 Add placeholder documentation for API Node Operational Mode 2023-04-19 08:17:57 -05:00
Peter Oschwald 0f1b0a300a Update http_client_async to POST with message body and promise/future to see response.
Add simple unit test to test http_client_async with simple_rest_server implementation.
2023-04-19 08:09:11 -05:00
Peter Oschwald 3b8ad9632c Replace bind with lambda 2023-04-19 07:47:56 -05:00
Kevin Heifner 060dbed7f7 Fix indentation 2023-04-18 17:49:03 -05:00
Kevin Heifner a1cb719176 Remove fc::string alias 2023-04-18 17:45:02 -05:00
Kevin Heifner acb580ad0a Remove unused files 2023-04-18 17:42:51 -05:00
Huang-Ming Huang f394de84ce Merge branch 'main' into huangminghuang/python-sitelib 2023-04-18 14:44:52 -05:00
greg7mdp b2d1d890c1 Update calling convention for get_account() 2023-04-18 15:07:44 -04:00
Huang-Ming Huang d1fd7c14e6 Merge pull request #1039 from AntelopeIO/huangminghuang/unix-path
mitigate unix socket path problem
2023-04-18 14:01:40 -05:00
Huang-Ming Huang 306e9145a3 add test 2023-04-18 13:49:19 -05:00
greg7mdp 41e2e68e3f Update get_table_rows_ex() to serialize off the main thread. 2023-04-18 14:10:28 -04:00
Huang-Ming Huang 11964ff71f Merge branch 'main' into huangminghuang/unix-path 2023-04-18 13:08:36 -05:00
Huang-Ming Huang f74763b8e6 use dist-package 2023-04-18 13:03:26 -05:00
Kevin Heifner a1b1722e47 Merge pull request #1045 from AntelopeIO/GH-452-block-buffer
P2P: Save and retry unlinkable blocks
2023-04-18 12:58:45 -05:00
Huang-Ming Huang 9dbe29ceae fix unix_sock listening path 2023-04-18 12:20:54 -05:00
Kevin Heifner ab84c78135 GH-452 Remove unneeded forward declare 2023-04-18 11:54:17 -05:00
Kevin Heifner b9c6a668c0 GH-452 Untangle unlinkable_block_state_cache and dispatch_manager 2023-04-18 11:40:38 -05:00
Huang-Ming Huang 53f9ca1f2a always use relative path 2023-04-18 11:40:09 -05:00
Huang-Ming Huang f02853063d Merge remote-tracking branch 'origin/main' into huangminghuang/unix-path 2023-04-18 11:19:13 -05:00
Huang-Ming Huang f3b92143f5 Merge pull request #1011 from AntelopeIO/huangminghuang/filesystem
Replace boost/fc filesystem
2023-04-18 11:17:37 -05:00
Kevin Heifner fd5546901c GH-452 Encapsulate unlinkable_block_state_index. 2023-04-18 10:54:28 -05:00
Huang-Ming Huang 88f477a7d5 address PR comments 2023-04-18 10:38:56 -05:00
Huang-Ming Huang de82f95baf Merge remote-tracking branch 'origin/main' into huangminghuang/python-sitelib 2023-04-18 09:32:19 -05:00
Huang-Ming Huang 4b104260ba make sure Python_SITELIB exists 2023-04-18 09:30:00 -05:00
Kevin Heifner 022b6f3d5a GH-452 Some renaming to make code clearer 2023-04-18 08:33:39 -05:00
greg7mdp 078f7b4861 Update get_table_rows_by_seckey() 2023-04-17 17:01:51 -04:00
greg7mdp 193f2cd5f0 Update calling convention for get_table_rows(). 2023-04-17 15:42:33 -04:00
Matt Witherspoon aba8b86be3 Merge pull request #1044 from AntelopeIO/WAST_string_include
add needed `string` include for some newer libc++ versions
2023-04-17 15:27:52 -04:00
Jonathan Giszczak 8993fc2557 Remove obsolete command line argument from performance harness use of TestHarness 2023-04-17 14:26:37 -05:00
Jonathan Giszczak 5b801d4e75 Python backwards compatibility. 2023-04-17 14:26:04 -05:00
Jonathan Giszczak 3ad05471e3 Fix up imports. 2023-04-17 14:14:56 -05:00
Matt Witherspoon fdb0ae65ba add needed string include for some newer libc++ 2023-04-17 14:36:44 -04:00
Kevin Heifner 120d2261d1 GH-452 Remove correct block 2023-04-17 13:18:30 -05:00
Vlad d849c9c67c Merge pull request #914 from AntelopeIO/leaputil-shutdown-state
Added leap-util subcommand to check for a clean shutdown
2023-04-17 14:03:08 -04:00
Kevin Heifner 2a3a784f3f GH-452 Keep and retry unlinkable blocks 2023-04-17 12:28:46 -05:00
766C6164 7200356530 Added graceful shutdown on snapshot execution exception 2023-04-17 11:56:44 -04:00
Kevin Heifner 2ef8789182 Merge pull request #1040 from AntelopeIO/GH-452-block-buffer
P2P: Misc improvements
2023-04-17 10:33:53 -05:00
Kevin Heifner 1ffb230b2b GH-452 Move setting of closing to false at end of close 2023-04-17 07:43:05 -05:00
Kevin Heifner dd045a8949 GH-452 Close immediately on buffer full. 2023-04-15 11:56:51 -05:00
Huang-Ming Huang 429bb3faad Merge remote-tracking branch 'origin/main' into huangminghuang/filesystem 2023-04-14 18:15:59 -05:00
Huang-Ming Huang f20f9382e6 remove more unnecessary generic_string() 2023-04-14 18:01:34 -05:00
Huang-Ming Huang c406945f63 address PR comments 2023-04-14 17:52:10 -05:00
Jonathan Giszczak eedb50a7d6 Fix spelling error. 2023-04-14 17:49:28 -05:00
Jonathan Giszczak 0b9fc5de67 Fix syntax error. 2023-04-14 17:48:40 -05:00
Jonathan Giszczak db779d1068 Fix resurrected Node relaunch() method. 2023-04-14 17:48:22 -05:00
Jonathan Giszczak 7a87c1eb93 Fix merge errors. 2023-04-14 17:47:59 -05:00
Jonathan Giszczak c6503d6e1c Fix merge failures. 2023-04-14 17:39:48 -05:00
Jonathan Giszczak 8f003d68e0 Merge branch 'main' into test-harness-process-control 2023-04-14 17:11:03 -05:00
Jonathan Giszczak e521e9baab Bring nodeos and keosd process control into TestHarness Node/WalletMgr
Use launcher as object in TestHarness rather than external program.
Eliminate --clean-run arguments.  All runs are clean.
Remove killall from Cluster and all scripts.  Tests only terminate their
own processes.
Remove unused scripts.
Remove unused test.
2023-04-14 16:06:49 -05:00
Peter Oschwald bd05872b6b Merge pull request #967 from AntelopeIO/ph-block-producer-op-mode
[PH] block producer op mode
2023-04-14 15:57:23 -05:00
Peter Oschwald 2bf7a1ace2 Make docs easier to update by limiting additional formatting from help messages. 2023-04-14 15:28:17 -05:00
Peter Oschwald 40e776bf29 Finish removing config options no longer supported by producer plugin. 2023-04-14 15:00:43 -05:00
Peter Oschwald 866ed20f35 Merge branch 'main' into ph-block-producer-op-mode 2023-04-14 14:52:12 -05:00
Kevin Heifner 054ddf8648 GH-452 Add alignas(hardware_destructive_interference_size) to avoid cache synchronization. Also removed an unneeded atomic 2023-04-14 13:49:33 -05:00
Huang-Ming Huang 495e417d82 mitigate unix socket path problem 2023-04-14 12:46:56 -05:00
766C6164 fdeb7bee94 Cleanup 2023-04-14 11:41:35 -04:00
Gregory Popovitch daa25c95e7 Merge pull request #1038 from AntelopeIO/abi_serializer
Pass Resolver as `const &` instead of by value.
2023-04-14 10:48:43 -04:00
Kevin Heifner 686bd5680d GH-452 No reason to stop processing a block just because the client has closed the connection 2023-04-14 09:21:50 -05:00
greg7mdp 7e322b3c2b Fix typo 2023-04-14 10:16:38 -04:00
greg7mdp 9f365be4a9 Pass Resolver as const & instead of by value 2023-04-14 09:57:41 -04:00
Kevin Heifner fcbd3da22f GH-452 Encapsulate sync_mtx 2023-04-14 08:01:52 -05:00
Kevin Heifner 509c047323 Merge pull request #958 from AntelopeIO/GH-955-ship-test
Test: Add SHiP forking and have_positions unittest
2023-04-14 07:07:30 -05:00
Huang-Ming Huang 16c437514e update Python_SITELIB 2023-04-14 04:09:24 -05:00
Kevin Heifner 7924cfa099 GH-955 minor perf improvement 2023-04-13 20:56:12 -05:00
Vlad 54a5a0555c Merge branch 'main' into snapshot-scheduler-refactoring 2023-04-13 21:43:28 -04:00
Gregory Popovitch fe9128e60f Merge pull request #1036 from AntelopeIO/sync_abieos
update to latest commit of abieos submodule
2023-04-13 21:43:16 -04:00
Vlad d3dfcbf37b Merge branch 'main' into snapshot-scheduler-refactoring 2023-04-13 21:26:03 -04:00
766C6164 4bb4d65b74 Multiple fixes 2023-04-13 21:02:28 -04:00
Huang-Ming Huang bdc73d43d1 remove unused include 2023-04-13 19:15:40 -05:00
Kevin Heifner 8e29a56cda GH-955 Use unordered_map 2023-04-13 18:15:05 -05:00
766C6164 9c856538a7 Moved snapshot code out of producer plugin 2023-04-13 18:21:27 -04:00
Kevin Heifner c89ee3ea22 Merge pull request #994 from AntelopeIO/small-opt
Small but measurable improvement to executor queue
2023-04-13 16:49:55 -05:00
greg7mdp 35eadc1697 update to latest commit of abieos submodule 2023-04-13 17:26:34 -04:00
Kevin Heifner 2b5915b260 Merge pull request #1022 from AntelopeIO/GH-452-clang-tidy
P2P: clang-tidy fixes
2023-04-13 15:43:28 -05:00
Gregory Popovitch ceeed297af Merge pull request #1027 from AntelopeIO/clang_16_warnings
Fix compilation warnings with clang-16
2023-04-13 14:31:48 -04:00
greg7mdp ae136cf9eb Address PR comment 2023-04-13 13:03:18 -04:00
greg7mdp 39cefd6304 Fix compilation warnings with clang-16 (mostly warning: unqualified call to 'std::forward') 2023-04-13 12:24:07 -04:00
Gregory Popovitch 3b2f6654f8 Merge pull request #999 from AntelopeIO/gh-698-part2
Move abi serialization of transaction trace off main thread
2023-04-13 11:31:57 -04:00
greg7mdp e0edbcdc30 Revert "Keep track of whether the serializer cache contains a setabi action."
This reverts commit 8d830dcef0.
2023-04-13 08:05:58 -04:00
greg7mdp 8d830dcef0 Keep track of whether the serializer cache contains a setabi action. 2023-04-12 21:49:09 -04:00
greg7mdp 380373b6cd Address PR comments (mostly allow parameters to be moved by accepting values) 2023-04-12 21:11:21 -04:00
greg7mdp 6e47c7142a Add comment as suggested in PR review. 2023-04-12 16:58:44 -04:00
Kevin Heifner bd6551947f GH-452 Avoid unnecessary construction of boost::asio::buffer 2023-04-12 15:56:11 -05:00
greg7mdp 0c041509e6 Change abi_cache name as per PR review comment. 2023-04-12 16:54:58 -04:00
Huang-Ming Huang e3583307fd use python_SITELIB 2023-04-12 15:16:55 -05:00
greg7mdp 8fabe5d1b8 Commonize to a single send_transaction function. 2023-04-12 16:08:21 -04:00
Kevin Heifner 4cb969d991 GH-452 Clang-tidy fixes 2023-04-12 14:48:18 -05:00
Kevin Heifner be11e4f2f6 Merge pull request #1020 from AntelopeIO/GH-767-p2p-net-opt
P2P:  Inform peer if not accepting transactions
2023-04-12 13:49:04 -05:00
Kevin Heifner 3e1f05bac9 GH-767 Add log on sending blocks only because of p2p-accept-transactions=false 2023-04-12 12:34:35 -05:00
Kevin Heifner b1c9efa270 GH-767 If configured to not accept transactions, p2p-accept-transactions=false, then inform peer the node is blocks only 2023-04-12 11:17:56 -05:00
Kevin Heifner dec181b6fc Merge pull request #1019 from AntelopeIO/GH-1003-debug-log-spam-main
[4.0 -> main] Reduce producer_plugin debug level log spam
2023-04-12 10:27:55 -05:00
Kevin Heifner 0f3685a4fd Merge remote-tracking branch 'origin/release/4.0' into GH-1003-debug-log-spam-main 2023-04-12 09:57:45 -05:00
Kevin Heifner 23e94d542d Merge pull request #1017 from AntelopeIO/GH-1003-debug-log-spam-4.0
[3.2 -> 4.0] Reduce producer_plugin debug level log spam
2023-04-12 09:57:12 -05:00
Kevin Heifner d7ea2e0c94 Merge pull request #1015 from AntelopeIO/GH-678-http-debug-main
[4.0 -> main] Log all http request/response at debug log level
2023-04-12 09:56:48 -05:00
Huang-Ming Huang 6726ca6ed3 update build.yaml 2023-04-12 09:54:30 -05:00
greg7mdp 52f0a2a954 have send_transaction call send_transaction2 2023-04-12 10:51:24 -04:00
Huang-Ming Huang e54457bcb0 Merge pull request #867 from AntelopeIO/huangminghuang/block_start_time
Optimize block start time
2023-04-12 09:44:38 -05:00
Kevin Heifner 2412691694 Merge remote-tracking branch 'origin/release/3.2' into GH-1003-debug-log-spam-4.0 2023-04-12 09:21:48 -05:00
Kevin Heifner 051a893ca7 Merge pull request #1010 from AntelopeIO/GH-1003-debug-log-spam-3.2
[3.2] Reduce producer_plugin debug level log spam
2023-04-12 09:21:20 -05:00
Huang-Ming Huang 8bd05824ce update cmake 2023-04-12 08:32:26 -05:00
Kevin Heifner c43bf480f6 Merge remote-tracking branch 'origin/release/4.0' into GH-678-http-debug-main 2023-04-12 08:24:28 -05:00
Huang-Ming Huang 5c1ac2ca70 Merge branch 'main' into huangminghuang/block_start_time 2023-04-12 08:19:47 -05:00
Huang-Ming Huang 63a97a63ce Merge pull request #1013 from AntelopeIO/huangminghuang/http-host-main
[4.0->main] response to disallowed host
2023-04-12 08:10:40 -05:00
Kevin Heifner 20b73e2e20 Merge pull request #1009 from AntelopeIO/GH-678-http-debug-4.0
[3.2 -> 4.0] Log all http request/response at debug log level
2023-04-12 07:38:30 -05:00
Gregory Popovitch ff2251d6d9 Merge pull request #1004 from AntelopeIO/get_account_cleanup
cleanup duplicated code blocks in `get_account`
2023-04-11 20:09:23 -04:00
Huang-Ming Huang b61198cbf4 Merge pull request #1008 from AntelopeIO/huangminghuang/http-host-4.0
[3.2->4.0] response to disallowed host
2023-04-11 17:56:15 -05:00
Huang-Ming Huang b9375ba27a Merge branch 'release/4.0' into huangminghuang/http-host-main 2023-04-11 17:43:49 -05:00
greg7mdp 645704057d Merge branch 'main' of github.com:AntelopeIO/leap into gh-698-part2 2023-04-11 17:23:25 -04:00
greg7mdp 03c5d6be9e Merge branch 'main' of github.com:AntelopeIO/leap into get_account_cleanup 2023-04-11 17:21:44 -04:00
greg7mdp 7808e5e993 Address PR comments. 2023-04-11 17:20:14 -04:00
greg7mdp 9aa412b107 Whitespace cleanup 2023-04-11 17:15:40 -04:00
Huang-Ming Huang 69c4e00613 update appbase 2023-04-11 16:01:56 -05:00
Huang-Ming Huang c7873a8a17 update submodules 2023-04-11 14:51:47 -05:00
Huang-Ming Huang 12d7500a69 some format fix 2023-04-11 14:51:47 -05:00
Huang-Ming Huang 67b0fca821 update submodule 2023-04-11 14:51:47 -05:00
Huang-Ming Huang 6df0840474 fix compressed_file 2023-04-11 14:51:47 -05:00
Huang-Ming Huang 29598be699 remove test_filesystem 2023-04-11 14:51:47 -05:00
Huang-Ming Huang d15d16b0be replace boost::filesystem 2023-04-11 14:51:47 -05:00
Kevin Heifner afbcdf240b GH-1003 Reduce producer_plugin debug log spam 2023-04-11 14:45:44 -05:00
Huang-Ming Huang 13d484ca9e Merge pull request #991 from AntelopeIO/huangminghuang/wildcard_linkauth
cleos wildcard linkauth
2023-04-11 14:38:23 -05:00
Kevin Heifner 8c391275e3 Merge branch 'huangminghuang/http-host-4.0' into GH-678-http-debug-4.0 2023-04-11 14:34:11 -05:00
Huang-Ming Huang 604567018f fix test 2023-04-11 13:51:00 -05:00
Kevin Heifner c8b917a884 Merge branch 'huangminghuang/http-host-4.0' into GH-678-http-debug-4.0 2023-04-11 13:38:54 -05:00
Kevin Heifner 29a69b6041 Merge remote-tracking branch 'origin/release/3.2' into GH-678-http-debug-4.0 2023-04-11 13:36:15 -05:00
Kevin Heifner 480374b245 Merge pull request #1000 from AntelopeIO/GH-678-http-debug-3.2
[3.2] Log all http request/response at debug log level
2023-04-11 13:29:36 -05:00
greg7mdp 52e25cdfe3 Avoid unnecessary copies, restore mutable on lambdas capturing the abi cache 2023-04-11 13:46:15 -04:00
Huang-Ming Huang 1c4ae672fa Merge branch 'release/3.2' into huangminghuang/http-host-4.0 2023-04-11 12:04:19 -05:00
Huang-Ming Huang a3f52dbf8e Merge pull request #1006 from AntelopeIO/huangminghuang/prometheus-fix-main
[4.0->main] prometheus fix main
2023-04-11 11:53:43 -05:00
Huang-Ming Huang c716ac5480 Merge pull request #996 from AntelopeIO/huangminghuang/http-host-3.2
[3.2] response to disallowed host
2023-04-11 11:52:08 -05:00
greg7mdp 841a59eb32 remove unnecesary mutable qualifiers. 2023-04-11 12:31:55 -04:00
greg7mdp eb49677485 2nd batch of changes from PR review comments 2023-04-11 12:21:17 -04:00
Huang-Ming Huang f8ce734569 Merge branch 'main' into huangminghuang/prometheus-fix-main 2023-04-11 10:48:32 -05:00
greg7mdp ac8c37c6d5 First batch of changes from PR review comments 2023-04-11 11:45:54 -04:00
Lin Huang 1a8d88f6a6 Merge pull request #1001 from AntelopeIO/merge_4_0_rc3_version_bump_to_main
[4.0 -> main] Merge release 4.0 rc3 version bump to main
2023-04-11 11:32:26 -04:00
Huang-Ming Huang bc101f5785 Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/prometheus-fix-main 2023-04-11 10:28:22 -05:00
Huang-Ming Huang 8dbb9f1bcc Merge pull request #1005 from AntelopeIO/huangminghuang/prometheus-fix
[4.0] fix resource not found bug
2023-04-11 10:22:24 -05:00
Huang-Ming Huang df88471be4 add test 2023-04-11 09:52:33 -05:00
Huang-Ming Huang 208c9160c9 fix resource not found buf 2023-04-11 09:13:46 -05:00
greg7mdp 36d4dd7feb cleanup duplicated code blocks in get_account 2023-04-11 10:02:21 -04:00
Huang-Ming Huang 7efec6a669 add test 2023-04-10 23:47:56 -05:00
Lin Huang dd2b3920c3 restore version after merging 4.0.0 rc3 version bump 2023-04-10 21:39:15 -04:00
Kevin Heifner d4bd548d61 GH-678 Log all http request/response when debug log enabled 2023-04-10 17:21:22 -05:00
Zach Butler 3f76a2e51b Merge branch 'release/4.0' into zach-install-deps
Resolve README.md conflict that GitHub thinks is a conflict but really
wasn't...
2023-04-10 17:39:43 -04:00
greg7mdp 01a0dc5c0c Merge branch 'main' of github.com:AntelopeIO/leap into gh-698-part2 2023-04-10 16:44:03 -04:00
greg7mdp 28b03d2145 Make a few lambdas mutable to avoid copying abi_serializers 2023-04-10 16:29:57 -04:00
Lin Huang 28ffcc841b Merge pull request #998 from AntelopeIO/bump_to_4_0_rc_3
[4.0] Bump Leap version to release 4.0 rc3
2023-04-10 16:24:44 -04:00
Lin Huang 282eee5765 Merge pull request #997 from AntelopeIO/merge_eosvmoc_retry_to_main
[4.0 -> main] Fix ROtrx dispatched to baseline runtime when compiled code not ready
2023-04-10 16:10:57 -04:00
Lin Huang 4966b62311 [4.0] Bump Leap to release 4.0 rc3 2023-04-10 15:55:03 -04:00
greg7mdp 9fd4dfff71 Update get_block() API to use new architecture. 2023-04-10 15:50:19 -04:00
Lin Huang 0d888b84e6 Merge remote-tracking branch 'origin/release/4.0' into merge_eosvmoc_retry_to_main 2023-04-10 15:41:01 -04:00
Matt Witherspoon aad4d4aa39 Merge pull request #995 from AntelopeIO/more_direct_eosio_exit
[4.0 -> main] make eosio_exit impl more direct
2023-04-10 15:34:06 -04:00
Kevin Heifner f08592d2c7 Merge pull request #992 from AntelopeIO/GH-980-restore-read-mode-speculative-main
[4.0 -> main] Restore read-mode=speculative
2023-04-10 14:32:40 -05:00
Peter Oschwald 0dc3a16e31 Add boost beast example http client async vs. 1.7 2023-04-10 13:33:05 -05:00
Lin Huang b9b4b8a035 Merge pull request #984 from AntelopeIO/eosvmoc_retry_4_0
[4.0] Fix ROtrx dispatched to baseline runtime when compiled code not ready
2023-04-10 13:56:51 -04:00
Huang-Ming Huang 0740055506 response to disallowed host 2023-04-10 12:09:32 -05:00
greg7mdp c2aab35c60 correct abi caching, avoid unnecessary serializer copies 2023-04-10 12:04:22 -04:00
Matt Witherspoon 7843090356 Merge pull request #993 from AntelopeIO/more_direct_eosio_exit_40
[4.0] make `eosio_exit` impl more direct
2023-04-10 11:37:34 -04:00
Peter Oschwald 29dd998fae Merge pull request #990 from AntelopeIO/update-leap-boost-version
Update boost version.
2023-04-10 10:06:10 -05:00
Kevin Heifner 708a8eec80 Small but measurable improvement to executor queue. 2023-04-10 09:43:07 -05:00
Peter Oschwald c5a956d05b With increasing min boost version to 1.70, can remove optional behavior for older versions. 2023-04-10 09:34:18 -05:00
Peter Oschwald 5ca44254f6 With increasing min boost version to 1.70, can remove optional behavior for older versions. 2023-04-10 09:18:36 -05:00
Matt Witherspoon 24e34bf8bb Merge remote-tracking branch 'origin/release/4.0' into more_direct_eosio_exit 2023-04-10 04:39:06 -04:00
Kevin Heifner 8ee0f9844b Merge remote-tracking branch 'origin/release/4.0' into GH-980-restore-read-mode-speculative-main 2023-04-08 08:10:29 -05:00
Kevin Heifner de1c1c2c0d Merge pull request #986 from AntelopeIO/GH-980-restore-read-mode-speculative-4.0
[4.0] Restore read-mode=speculative
2023-04-08 08:10:00 -05:00
Lin Huang 32ee290773 Merge branch 'release/4.0' into eosvmoc_retry_4_0 2023-04-08 08:26:05 -04:00
Huang-Ming Huang 8ea26048c4 fix test 2023-04-07 14:50:11 -05:00
Huang-Ming Huang abfbe13624 add type wildcard 2023-04-07 14:07:21 -05:00
Peter Oschwald 455b40b073 Update boost version. 2023-04-07 13:48:51 -05:00
Lin Huang c701194f48 Add missing transient_trx_failed_trace_log for speculative execution 2023-04-07 14:33:46 -04:00
Lin Huang aa892ef784 fix comments and move get_cd_failure into code_cache_base 2023-04-07 12:41:42 -04:00
Lin Huang 706bbb90ec simplify ro_trx_vm_oc_compile_temporary_failure handling 2023-04-07 12:40:47 -04:00
Lin Huang 4f35d9990f Fix the problem of ro_trx_vm_oc_compile exceptions caught prematurally 2023-04-07 12:39:55 -04:00
Lin Huang e58d26fb83 Replace ro_trx_temporary ro_trx_vm_oc_compile_temporary_failure, ro_trx_permanent with ro_trx_vm_oc_compile_permanent_failure, and add better description 2023-04-07 12:36:44 -04:00
Huang-Ming Huang dfe829e7dc Merge pull request #989 from AntelopeIO/huangminghuang/prometheus-port-main
[4.0->main] prometheus on different port
2023-04-07 11:12:53 -05:00
Huang-Ming Huang 7b3c2df592 Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/prometheus-port-main 2023-04-07 10:35:02 -05:00
Huang-Ming Huang 2b60a3919c Merge pull request #939 from AntelopeIO/huangminghuang/prometheus-port
[4.0] prometheus on different port
2023-04-07 10:31:51 -05:00
Kevin Heifner d8168632e5 GH-980 List speculative mode last since it is deprecated 2023-04-07 09:49:00 -05:00
Huang-Ming Huang 1b68dd7f83 address PR comments 2023-04-07 09:30:36 -05:00
Gregory Popovitch f31e5277cd Merge pull request #973 from AntelopeIO/gh-698
Unify definitions of `next_function` and its variant parameter
2023-04-07 09:09:03 -04:00
Kevin Heifner 0895779064 GH-980 Add a version of the distributed transaction test running in read-mode=speculative 2023-04-07 07:58:01 -05:00
greg7mdp e6166495b7 Merge branch 'gh-698' of github.com:AntelopeIO/leap into gh-698-part2 2023-04-07 08:34:35 -04:00
greg7mdp 8f90505d3e remove unnecessary header addition 2023-04-07 08:31:54 -04:00
greg7mdp 66c1731f3f Move serialization off main thread for compute_transaction 2023-04-07 08:27:50 -04:00
Matt Witherspoon 3a3d36ab08 make eosio_exit more direct 2023-04-06 22:03:24 -04:00
Vlad 21ede922f7 Merge pull request #985 from AntelopeIO/multiple-snapshot-fixes-main
[4.0 -> main] Several improvements and fixes for snapshot scheduling
2023-04-06 15:11:32 -04:00
greg7mdp 0b3cc3ddd7 Merge branch 'gh-698' of github.com:AntelopeIO/leap into gh-698-part2 2023-04-06 14:22:40 -04:00
greg7mdp 43f64b36a9 Merge branch 'main' of github.com:AntelopeIO/leap into gh-698 2023-04-06 14:10:14 -04:00
Vlad 49637bebb9 Merge branch 'main' into multiple-snapshot-fixes-main 2023-04-06 14:08:26 -04:00
greg7mdp 71824ff287 Merge branch 'gh-698' of github.com:AntelopeIO/leap into gh-698 2023-04-06 14:08:16 -04:00
Areg Hayrapetian b71ea9ad10 Merge pull request #987 from AntelopeIO/huangminghuang/cmake-fix-main
[4.0->main] fix cpack error message
2023-04-06 11:07:55 -07:00
greg7mdp 51d2b5bab7 Move abi serialization of transaction trace off main thread for send_transaction. 2023-04-06 13:47:52 -04:00
Vlad 2e8f098d7e Merge branch 'main' into multiple-snapshot-fixes-main 2023-04-06 12:01:08 -04:00
Huang-Ming Huang acdd583aaf Merge branch 'main' into huangminghuang/cmake-fix-main 2023-04-06 10:35:06 -05:00
Kevin Heifner 425f6e6105 Merge pull request #983 from AntelopeIO/GH-978-read-only-limit-main
[4.0 -> main] Set an upper limit on read-only-threads of 8
2023-04-06 10:29:31 -05:00
Kevin Heifner d5f8575eda GH-980 Restore read-mode=speculative 2023-04-06 10:09:56 -05:00
766C6164 17fb494060 Merge branch 'release/4.0' into multiple-snapshot-fixes-main 2023-04-06 10:47:33 -04:00
Vlad ae0018b525 Merge pull request #968 from AntelopeIO/make-pending-snapshots-nonopt
[4.0] Several improvements and fixes for snapshot scheduling
2023-04-06 10:43:43 -04:00
Huang-Ming Huang cbef1eca19 Merge branch 'release/4.0' into huangminghuang/cmake-fix-main 2023-04-06 09:25:12 -05:00
Huang-Ming Huang 07b99d386a Merge pull request #972 from AntelopeIO/huangminghuang/cmake-fix
[4.0] fix cpack error message
2023-04-06 09:22:19 -05:00
Peter Oschwald 3459a104ee Merge branch 'main' into ph-block-producer-op-mode 2023-04-06 08:02:16 -05:00
Kevin Heifner 0f316a45b5 Merge remote-tracking branch 'origin/release/4.0' into GH-978-read-only-limit-main 2023-04-06 06:34:37 -05:00
Kevin Heifner 7dac5948b1 Merge pull request #982 from AntelopeIO/GH-978-read-only-limit-4.0
[4.0] Set an upper limit on read-only-threads of 8
2023-04-06 06:34:00 -05:00
Lin Huang 4be7471c56 push_read_only_transaction handles temporary and permanent failure exceptions 2023-04-06 07:23:57 -04:00
Lin Huang 1b3e49b96c get_descriptor_for_code returns failure reason and wasm_interface::apply raises appropriate exceptions 2023-04-06 07:22:06 -04:00
Lin Huang d9cf9336ce add new exceptions for read-only trxs 2023-04-06 07:15:35 -04:00
Matt Witherspoon 54e897094e Merge pull request #927 from AntelopeIO/no_wavm_cxx11
remove WAVM specific c++11 flag
2023-04-05 19:17:17 -07:00
greg7mdp 74575d3404 Fix a couple typos. 2023-04-05 22:13:46 -04:00
greg7mdp 1d039b6749 Update whitespace as per PR comments. 2023-04-05 22:06:56 -04:00
greg7mdp 01b992ce05 Address some PR comments (define types in types.hpp and add comments) 2023-04-05 22:03:26 -04:00
Kevin Heifner 538437b7ad GH-978 Max of 8 read-only threads is allowed 2023-04-05 20:54:08 -05:00
Kevin Heifner 610bd6fba4 GH-978 Set an upper limit on read-only-threads of 8. 2023-04-05 20:10:59 -05:00
Matt Witherspoon 9ee7277ab8 Merge pull request #923 from AntelopeIO/more_wavm_removal
remove more unused WAVM code
2023-04-05 17:48:35 -07:00
Lin Huang ff31742b14 Merge pull request #979 from AntelopeIO/merge_missing_methods
[4.0 -> main] Added missing calls to wasmifs on read-only threads
2023-04-05 19:56:22 -04:00
Lin Huang 18736d61ac Merge remote-tracking branch 'origin/release/4.0' into merge_missing_methods 2023-04-05 19:06:38 -04:00
Lin Huang bc349683e9 Merge pull request #964 from AntelopeIO/wasmif_methods_4_0
[4.0] Added missing calls to wasmifs on read-only threads
2023-04-05 18:37:38 -04:00
766C6164 b2c81cdb4c Multiple updates 2023-04-05 17:42:51 -04:00
Lin Huang 8bce249ff0 Merge pull request #977 from AntelopeIO/merge_remove_check_limits_to_main
[4.0 -> main] Remove global WASM::check_limits and initial memory from instantiate_module
2023-04-05 17:20:56 -04:00
Lin Huang 599f08b649 Merge remote-tracking branch 'origin/release/4.0' into merge_remove_check_limits_to_main 2023-04-05 16:41:05 -04:00
Peter Oschwald b91b4c75c8 Merge branch 'main' into ph-block-producer-op-mode 2023-04-05 15:34:42 -05:00
Vlad 78e15feeaa Merge pull request #976 from AntelopeIO/test-snapshot-scheduler-stability-main
[4.0 -> main] test_snapshot_scheduler stability improvements
2023-04-05 16:30:39 -04:00
Lin Huang 64d06887a5 Merge pull request #975 from AntelopeIO/remove_check_limits_4_0
[4.0] Remove global WASM::check_limits and initial memory from instantiate_module
2023-04-05 16:03:11 -04:00
Peter Oschwald d115fa6e30 Merge branch 'main' into ph-block-producer-op-mode 2023-04-05 15:02:00 -05:00
Peter Oschwald 2bc918fc4d Deconflict shorthand arguments for help.
Cleanup commented out code.
2023-04-05 15:01:31 -05:00
766C6164 3cc4aa2344 Test stability improvements 2023-04-05 15:39:35 -04:00
766C6164 6ddfa97ebc Merge branch 'release/4.0' into test-snapshot-scheduler-stability-main 2023-04-05 15:35:18 -04:00
Peter Oschwald 32a7503e01 Update README for changes to arguments.
Update argument lists to use the direct output from --help to ease updating in future as no additional formatting is necessary.

Remove section on lauch_transaction_generators.py since that script was incorporated into the TestHarness module and is no longer command line executable.

Add infomration on newly broken out sub-commands and the arguments pertaining to those modes or config commands.
2023-04-05 14:16:12 -05:00
Lin Huang 9ddf0f7acf remove unused IR::Module module 2023-04-05 15:12:45 -04:00
Lin Huang 2cb34fea5c remove unneccessary bytes copying 2023-04-05 14:48:58 -04:00
Lin Huang b59c1ad5e7 Remove serialization completely from get_instantiated_module 2023-04-05 14:34:24 -04:00
Matt Witherspoon 160b42759d Merge pull request #961 from AntelopeIO/revert_ctest_test-dir
revert `ctest --test-dir` usage that is cmake 3.20+
2023-04-05 11:22:31 -07:00
Lin Huang 6e8bd9ad27 remove parse_initial_memory 2023-04-05 13:51:26 -04:00
Lin Huang 7e49aa03fc remove WASM::check_limits and initial memory from instantiate_module 2023-04-05 13:41:37 -04:00
Kevin Heifner ee7f5a8034 Merge branch 'release/4.0' into huangminghuang/cmake-fix 2023-04-05 12:28:00 -05:00
Peter Oschwald 80e05c8327 Updating README dir structure and test report outputs. 2023-04-05 12:24:50 -05:00
greg7mdp 3f9f704587 Missed another needed change 2023-04-05 13:14:46 -04:00
greg7mdp a2d676e517 Missed needed change in macros.hpp 2023-04-05 13:04:32 -04:00
greg7mdp be8217f31a unify definitions of next_function and its parameter
So that it is defined in a single location (DRY) and can be easily updated.
2023-04-05 11:35:31 -04:00
Huang-Ming Huang 16354ee6e5 Merge branch 'release/4.0' into huangminghuang/prometheus-port 2023-04-05 08:53:14 -05:00
Huang-Ming Huang 69a741c5ba fix make package 2023-04-04 21:01:10 -05:00
Lin Huang 9a10c803b3 Merge branch 'release/4.0' into wasmif_methods_4_0 2023-04-04 21:02:22 -04:00
766C6164 26e2f658e4 Make pending_snapshot non-optional 2023-04-04 18:32:19 -04:00
Peter Oschwald 088d5c7a30 Merge branch 'main' into ph-block-producer-op-mode 2023-04-04 17:18:00 -05:00
Peter Oschwald d7eb6d7f9f Merge pull request #945 from AntelopeIO/performance_harness_reduce_log_usage
[PH] Reduce log Usage and Other Performance Harness Improvements
2023-04-04 17:16:59 -05:00
Peter Oschwald 16b9d324b7 Add initial note on configuration of the bp operational mode. 2023-04-04 17:06:57 -05:00
Peter Oschwald 8d87497b00 Begin to layout framework for operational modes in performance_test.py.
Initial support for Block Producer Operational Mode provided through sub-command testBpOpMode
Update performance_test integration tests to use the new sub-commands.
2023-04-04 17:05:58 -05:00
Lin Huang 6a97c7bb16 revert the change for get_wasm_interface().exit() 2023-04-04 17:56:09 -04:00
Vlad 7218f25f50 Merge pull request #931 from AntelopeIO/test-snapshot-scheduler-stability
[4.0] Improved test_snapshot_scheduler stability
2023-04-04 17:52:29 -04:00
Peter Oschwald cd87f42a9b Fix logic in isOnBlockTransaction as it was inverted. 2023-04-04 16:44:53 -05:00
766C6164 dee4a153c4 Stop if pending_snapshots do not exist 2023-04-04 17:31:29 -04:00
Peter Oschwald 31273296fe Address peer review comments. 2023-04-04 16:18:39 -05:00
766C6164 a93faeb280 Tightened up test a bit 2023-04-04 15:35:04 -04:00
Lin Huang 1f46ff65ea remove first_block_num_used from wasm_instantiation_cache 2023-04-04 14:42:07 -04:00
Lin Huang 9b38815c56 make sure app wasm interface methods are called on wasmifs on all the read-only threads 2023-04-04 14:38:15 -04:00
Lin Huang 647dd99e44 wait until all read-only threads are started before proceeding in producer_plugin startup 2023-04-04 13:35:15 -04:00
Lin Huang 5b1c8dd644 Replace thread_local with unordered_map for wasmif 2023-04-04 13:25:13 -04:00
Lin Huang 553b834042 Merge pull request #962 from AntelopeIO/merge_oc_main_thread_fix
[4.0 -> main] Use is_write_window in eos-vm-oc main to determine if it is safe to update code cache
2023-04-04 11:09:09 -04:00
Huang-Ming Huang 7b2da964e5 fix calculate_pending_block_time 2023-04-04 09:45:21 -05:00
Huang-Ming Huang 8575d62354 Merge branch 'main' into huangminghuang/block_start_time
# Conflicts:
#	plugins/producer_plugin/producer_plugin.cpp
2023-04-04 09:24:54 -05:00
Huang-Ming Huang bf289ae1bc fix for boost 1.74+ 2023-04-04 08:12:36 -05:00
Lin Huang b31889d0e0 Merge remote-tracking branch 'origin/release/4.0' into merge_oc_main_thread_fix 2023-04-04 08:34:11 -04:00
Lin Huang 299d11f8a8 Merge pull request #960 from AntelopeIO/oc_main_thread_fix
[4.0] Use is_write_window in eos-vm-oc main to determine if it is safe to update code cache
2023-04-04 08:31:57 -04:00
Lin Huang 6f7a948488 Merge pull request #959 from AntelopeIO/merge_3_2_3_version_bump_from_4_0_to_main
[4.0 -> main] Merge 3.2.3 version bump from 4.0 to main
2023-04-04 08:23:21 -04:00
Lin Huang 56c6ad3b7f replace app().executor().is_write_window() with cleaner chain.is_write_window() 2023-04-03 22:16:36 -04:00
Kevin Heifner 50a4728478 Merge pull request #912 from AntelopeIO/GH-591-get-account-http
Return 400 http error for unknown account
2023-04-03 20:21:10 -05:00
Lin Huang 107670145a initialize app_window 2023-04-03 21:11:27 -04:00
Matt Witherspoon 92ee0041ba revert ctest --test-dir usage that is cmake 3.20+ 2023-04-03 20:53:33 -04:00
Lin Huang 49892f5ebb Merge remote-tracking branch 'origin/release/4.0' into merge_3_2_3_version_bump_from_4_0_to_main 2023-04-03 19:34:23 -04:00
Lin Huang 7586219c04 Change to use is_write_window to determine whether it is safe to update eos-vm-oc code cache 2023-04-03 19:22:49 -04:00
Lin Huang 4917ebcf36 Merge pull request #957 from AntelopeIO/merge_3_2_3_version_bump_to_4_0
[3.2 -> 4.0] Merge 3.2.3 version bump to 4.0
2023-04-03 19:20:31 -04:00
Lin Huang 66c23b9de6 Add execution window APIs to controller so chain can access current execution window 2023-04-03 19:19:45 -04:00
Kevin Heifner db54a5c66f Merge branch 'main' into GH-591-get-account-http 2023-04-03 16:01:59 -05:00
Kevin Heifner dd3b23005d Add SHiP forking and have_positions unittest. 2023-04-03 15:43:52 -05:00
Kevin Heifner d278917fcf Merge pull request #955 from AntelopeIO/ship-fork-main
[4.0 -> main] SHiP Fix forking behavior
2023-04-03 15:21:48 -05:00
Lin Huang 4b59a6bd32 restore version to 4.0 after merging 3.2.3 version bump 2023-04-03 16:17:04 -04:00
Huang-Ming Huang d10df32600 avoid std::bind 2023-04-03 15:09:31 -05:00
Kevin Heifner d51a94253a Merge remote-tracking branch 'origin/release/4.0' into ship-fork-main 2023-04-03 14:52:58 -05:00
Kevin Heifner a1e56a3ba9 Merge pull request #952 from AntelopeIO/ship-fork-4.0
[3.2 -> 4.0] SHiP Fix forking behavior
2023-04-03 14:52:43 -05:00
Huang-Ming Huang bd9511dd0e Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/prometheus-port 2023-04-03 14:39:35 -05:00
Huang-Ming Huang 0355c52126 based on boost 1.67 example 2023-04-03 14:30:11 -05:00
Lin Huang d382d71c7e Merge pull request #954 from AntelopeIO/merge_time_summary_fix_to_main
[4.0 -> main] Merge time summary fix to main
2023-04-03 14:23:45 -04:00
Lin Huang 43873e8221 Merge pull request #953 from AntelopeIO/bump_to_3_2_3
[3.2] Bump Leap version to 3.2.3
2023-04-03 13:52:59 -04:00
greg7mdp 3abe789f76 Add generic make_api_entry function which splits processing
between main thread and http thread pool
2023-04-03 13:50:29 -04:00
Kevin Heifner d40be19b02 CORE_SYMBOL is now in TestHarness 2023-04-03 12:40:09 -05:00
Lin Huang 34288c5bba Merge remote-tracking branch 'origin/release/4.0' into merge_time_summary_fix_to_main 2023-04-03 13:33:54 -04:00
Lin Huang f696190c0e Merge pull request #947 from AntelopeIO/time_summary_fix_4_0
[4.0] Correct time summary calculation for transient trxs due to change of read-only trxs windows
2023-04-03 13:28:24 -04:00
Lin Huang adaec7704c Bump Leap version to 3.2.3 2023-04-03 13:23:52 -04:00
Kevin Heifner cb909a8f1a Merge remote-tracking branch 'origin/release/3.2' into ship-fork-4.0 2023-04-03 11:47:47 -05:00
Peter Oschwald 1164893367 Remove log_reader_tests.py and associated test log files.
With rework to no longer rely on parsing a majority of the block and transaction data out of the nodeos log in favor of querying it directly from an active node, the log_reader_tests have lost their usefulness.  Can remove nodeos logs as well which were supporting the testing.
2023-04-03 11:27:54 -05:00
Kevin Heifner 1fa531daf8 Merge pull request #943 from AntelopeIO/ship-fork-3.2
[3.2] SHiP Fix forking behavior
2023-04-03 11:25:51 -05:00
Kevin Heifner fa2b7fece2 Use f-strings 2023-04-03 10:29:25 -05:00
Lin Huang e09d9570cb remove duplicated _ro_in_read_only_mode 2023-04-03 11:03:38 -04:00
Peter Oschwald 621ece03ad Merge branch 'main' into performance_harness_reduce_log_usage 2023-04-03 09:48:42 -05:00
Huang-Ming Huang 1b9c6525da address PR comments 2023-04-03 09:39:43 -05:00
Kevin Heifner bb7fc8d145 Fix spelling 2023-04-03 09:31:33 -05:00
Kevin Heifner c3814b9e59 Use 10 clients for test. Minor cleanups to ship_streamer_test.py 2023-04-03 06:58:58 -05:00
Lin Huang 61f3e7e818 Add missing idle time adjustment while executing read-only trxs and correct a format error 2023-04-02 16:48:20 -04:00
Lin Huang c6d5b13f12 remove unneeded is_on_main_thread from controller.hpp 2023-04-02 13:49:41 -04:00
Lin Huang a87705b4ff Correct transient trx time summary due to read-only trxs can run in both read and write window 2023-04-02 13:30:22 -04:00
Lin Huang 4099678077 Merge pull request #946 from AntelopeIO/merge_read_only_trx_improve_to_main
[4.0 -> main] Small improvements for parallelizing read-only transactions and tasks
2023-04-02 08:00:15 -04:00
Lin Huang 15e73d9bf7 Merge remote-tracking branch 'origin/release/4.0' into merge_read_only_trx_improve_to_main 2023-04-01 20:30:05 -04:00
Kevin Heifner 6f1e67b2b5 Merge pull request #944 from AntelopeIO/GH-596-fork-db-main
[4.0 -> main] forkdb reset in replay since blocks are signaled
2023-04-01 18:03:38 -05:00
Matt Witherspoon 2ec88efcca Merge pull request #920 from AntelopeIO/cmake_3.16_bump
bump minimum cmake requirement to 3.16
2023-04-01 10:52:40 -07:00
Lin Huang ab8202ffbf Merge pull request #933 from AntelopeIO/readonly_improve
[4.0] Small improvements for parallelizing read-only transactions and tasks
2023-03-31 21:50:19 -04:00
Lin Huang 0b3a0a7b8d Merge branch 'release/4.0' into readonly_improve 2023-03-31 21:22:21 -04:00
Kevin Heifner 618c805c7e Merge remote-tracking branch 'origin/release/4.0' into GH-596-fork-db-main 2023-03-31 17:27:50 -05:00
Kevin Heifner 60ebeddf41 Merge pull request #938 from AntelopeIO/GH-596-fork-db-4.0
[3.2 -> 4.0] forkdb reset in replay since blocks are signaled
2023-03-31 17:27:28 -05:00
ClaytonCalabrese 7f5a789406 Merge pull request #942 from AntelopeIO/cleanup_after_logs_release_4_0_to_main
[4.0 -> main] Clean tmp and TestLogs after test runs
2023-03-31 17:26:27 -05:00
Clayton Calabrese a78965bc9d remove accidental newline 2023-03-31 17:03:08 -05:00
Clayton Calabrese 6486facd38 rename chainData::nodes to chainData::numNodes to clarify what it means 2023-03-31 17:00:04 -05:00
Lin Huang 89e3a461c8 fine tuning error message 2023-03-31 17:55:04 -04:00
Lin Huang 1d57375ced Merge branch 'release/4.0' into readonly_improve 2023-03-31 17:51:43 -04:00
Clayton Calabrese 466093fad9 remove pointless return 2023-03-31 16:32:03 -05:00
Clayton Calabrese b1dfcb99f8 rename blockLog in chainData to blockList to better represent what the member actually is 2023-03-31 16:27:22 -05:00
Clayton Calabrese 72c36e0876 put blockDict and trxDict into chainData class 2023-03-31 16:25:05 -05:00
Clayton Calabrese 1fd2e67898 check forked and dropped blocks for each node in a performance test run. Change where updateTotal happens to not double count if blocks fork. 2023-03-31 15:55:57 -05:00
Matt Witherspoon b38adb5171 Merge pull request #941 from AntelopeIO/remove_more_unused_libfc_netstuff
remove more unused libfc network code
2023-03-31 13:02:18 -07:00
Kevin Heifner 6fb28e5f7d ship_streamer_test now the longest running nonparallelizable_tests, so make it long_running_test 2023-03-31 14:59:35 -05:00
Kevin Heifner fa8d025ca8 Make sure SHiP sends new blocks on forks 2023-03-31 14:44:12 -05:00
Lin Huang bcade58c1c Merge branch 'readonly_improve' of https://github.com/AntelopeIO/leap into readonly_improve 2023-03-31 15:39:44 -04:00
Lin Huang a617c5557b better error message 2023-03-31 15:39:11 -04:00
ClaytonCalabrese f3993e1790 Merge pull request #915 from AntelopeIO/clean_log_littering
[4.0] Clean tmp and TestLogs after test runs
2023-03-31 14:13:15 -05:00
Kevin Heifner 12924afa0a Add test for forking in SHiP 2023-03-31 14:10:05 -05:00
Huang-Ming Huang 0e0fdcccd7 Merge pull request #940 from AntelopeIO/huangminghuang/gelf-fix-main
[4.0->main] fix gelf DNS resolves to ipv6 address
2023-03-31 12:27:44 -05:00
Matt Witherspoon 6548567ad7 remove more unused libfc network code 2023-03-31 13:23:40 -04:00
Huang-Ming Huang 3a5c6bca80 Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/prometheus-port 2023-03-31 12:21:24 -05:00
Huang-Ming Huang 4d26ccb983 Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/gelf-fix-main 2023-03-31 11:58:41 -05:00
Kevin Heifner 5d91a7604a Merge pull request #937 from AntelopeIO/GH-596-ship-flush-main
[4.0 -> main] SHiP flush logs on write
2023-03-31 11:49:16 -05:00
Huang-Ming Huang a29c4f8b51 Merge pull request #917 from AntelopeIO/huangminghuang/gelf-fix
[4.0] fix gelf DNS resolves to ipv6 address
2023-03-31 11:30:02 -05:00
Lin Huang 96541108c3 Merge branch 'release/4.0' into readonly_improve 2023-03-31 12:26:05 -04:00
Kevin Heifner f3fcfe952a Merge remote-tracking branch 'origin/release/3.2' into GH-596-fork-db-4.0 2023-03-31 11:18:49 -05:00
Kevin Heifner d9a4772977 Merge pull request #936 from AntelopeIO/GH-596-fork-db-3.2
[3.2] forkdb reset in replay since blocks are signaled
2023-03-31 11:17:38 -05:00
Kevin Heifner 752da16214 Merge remote-tracking branch 'origin/release/4.0' into GH-596-ship-flush-main 2023-03-31 11:16:00 -05:00
Kevin Heifner fc8cd5b6ea Merge pull request #935 from AntelopeIO/GH-596-ship-flush-4
[3.2 -> 4.0] SHiP flush logs on write
2023-03-31 11:15:27 -05:00
Huang-Ming Huang 59a8809f98 prometheus on different port 2023-03-31 11:02:11 -05:00
Huang-Ming Huang b7b374200b remove commented line 2023-03-31 10:49:31 -05:00
Lin Huang d27d4cca72 incorporate review comments 2023-03-31 11:19:45 -04:00
Kevin Heifner 51c4bea20a GH-596 forkdb reset in replay since blocks are signaled 2023-03-31 09:20:27 -05:00
Kevin Heifner 46b223174c Merge remote-tracking branch 'origin/release/3.2' into GH-596-ship-flush-4 2023-03-31 09:08:57 -05:00
Peter Oschwald 5872a08793 Begin documenting operational modes.
First operational mode for the performance harness with be Block Producer mode.
2023-03-31 08:23:00 -05:00
Kevin Heifner 1043b9c054 GH-591 Fix spelling 2023-03-31 07:25:34 -05:00
Kevin Heifner 4359bc06f7 Merge pull request #928 from AntelopeIO/GH-596-ship-flush-3.2
[3.2] SHiP flush logs on write
2023-03-31 06:38:04 -05:00
Lin Huang 1e0aaf9c19 update eos-vm-oc threads limit calculation based on the design 2023-03-30 21:37:44 -04:00
Lin Huang 06595488c4 assert chain.is_building_block 2023-03-30 21:03:51 -04:00
Lin Huang d86a6bbed0 Add more descriptions about read and write timer default values 2023-03-30 20:39:03 -04:00
Lin Huang 89d334cb20 use boost deque which is faster than std:deque 2023-03-30 20:32:11 -04:00
766C6164 7642088732 Improved test stability 2023-03-30 17:40:40 -04:00
766C6164 b837affa1d Moved state_dir option to chain-state subcommand 2023-03-30 15:08:18 -04:00
766C6164 bba172f769 Dropped short argument form 2023-03-30 14:22:25 -04:00
Kevin Heifner 2384df3312 Merge pull request #929 from AntelopeIO/read-safe-multi-thread-main
[4.0 -> main] Execute read only safe tasks on read-only thread pool
2023-03-30 13:21:08 -05:00
Kevin Heifner 9f54fc4026 Merge remote-tracking branch 'origin/release/4.0' into read-safe-multi-thread-main 2023-03-30 11:52:22 -05:00
Kevin Heifner e871f05cfe Merge pull request #901 from AntelopeIO/read-safe-multi-thread-4.0
[4.0] Execute read only safe tasks on read-only thread pool
2023-03-30 11:51:28 -05:00
Matt Witherspoon 5bfb498b45 Merge pull request #924 from AntelopeIO/remove_curl
curl is no longer a required dependency; remove from docs & CI environment
2023-03-30 09:46:37 -07:00
Kevin Heifner 8aab319a2d Resize vector to ensure it is empty 2023-03-30 09:55:56 -05:00
Kevin Heifner bf5746f6cf Remove unneeded call to cancel. 2023-03-30 08:57:59 -05:00
Kevin Heifner efd642b151 GH-596 flush log and index files to make it more likely that a kill-9 or crash leaves valid ship logs. 2023-03-30 07:27:09 -05:00
Matt Witherspoon 735fc8f732 missed cmake version bump in readme's prose section 2023-03-29 23:08:45 -04:00
Kevin Heifner 4465a8bd99 Cleanup window deadline calculation for read-only trxs.
Since repost_exhausted_transactions is called in start_block, check should_interrupt_start_block in while loop.
2023-03-29 21:50:00 -05:00
Matt Witherspoon 8aeb0b5445 remove WAVM specific c++11 flag 2023-03-29 22:28:37 -04:00
jgiszczak 2f46f75970 Merge pull request #926 from AntelopeIO/test-harness-k-argument-support-main
[4.0 -> main] Implement support for -k/--kill in launcher.
2023-03-29 18:57:46 -05:00
jgiszczak e2539791a8 Merge pull request #921 from AntelopeIO/test-harness-k-argument-support
[4.0] Implement support for -k/--kill in launcher.
2023-03-29 18:01:55 -05:00
Kevin Heifner ca4de0e435 Remove unneeded cancel and update read-only-threads help description. 2023-03-29 17:52:01 -05:00
Jonathan Giszczak c708815a25 Suppress spurious error and use signal number on all platforms.
Pass kill signal number to kill for consistency with bounce/down.
2023-03-29 17:34:19 -05:00
Matt Witherspoon 5a39a122dc curl is no longer a required dependency 2023-03-29 18:23:01 -04:00
Clayton Calabrese 82e8ba8b6a change folder for performance_test runs to performance_test from p 2023-03-29 17:17:07 -05:00
Jonathan Giszczak 661515f5a8 Implement support for -k/--kill in launcher. 2023-03-29 16:15:07 -05:00
Huang-Ming Huang d29df5ef70 fix tests 2023-03-29 15:37:12 -05:00
Clayton Calabrese fb249230c1 convert to f string in walletMgr 2023-03-29 15:11:34 -05:00
Clayton Calabrese f07ccdc417 adjust indent 2023-03-29 15:10:44 -05:00
Clayton Calabrese 3ecb150933 Adjust test harness walletMgr to place files inside the wallet dir 2023-03-29 15:10:06 -05:00
Clayton Calabrese 97aa5b02d5 revert change for auto-bp_peering_test that is no longer needed 2023-03-29 14:38:47 -05:00
Clayton Calabrese 07c38c5c86 address PR comments for performance_test_basic and auto_bp_peering_test loggin 2023-03-29 14:28:28 -05:00
Huang-Ming Huang 3191ab295d remove deprecated options 2023-03-29 13:57:21 -05:00
Huang-Ming Huang 59b174029f restore udp non-blocking mode 2023-03-29 13:01:42 -05:00
Clayton Calabrese 82b179ccaa Merge remote-tracking branch 'origin/main' into performance_harness_reduce_log_usage 2023-03-29 12:05:31 -05:00
Kevin Heifner 6a989fd7eb Rename method and honor deadline. 2023-03-29 10:23:49 -05:00
Huang-Ming Huang dce7f418c3 address PR comment 2023-03-29 10:20:27 -05:00
Matt Witherspoon 6f6b5b7565 make use of some newer cmake functionality in CI 2023-03-29 10:29:46 -04:00
Matt Witherspoon 296fbc586f remove unused WAVM TestScript.h 2023-03-29 10:25:58 -04:00
Matt Witherspoon da68bd88ec remove WAVM travis CI 2023-03-29 10:25:54 -04:00
Matt Witherspoon 17201d4a63 remove WAVM Runtime 2023-03-29 10:25:47 -04:00
Matt Witherspoon b310933bb9 remove some unused WAVM headers 2023-03-29 10:25:43 -04:00
Matt Witherspoon a644bb2070 remove commented out cmake rules in WAVM 2023-03-29 10:25:42 -04:00
Matt Witherspoon 391d14e0d2 remove ENABLE_SIMD_PROTOTYPE & ENABLE_THREADING_PROTOTYPE WAVM code 2023-03-29 10:25:39 -04:00
Huang-Ming Huang 3ea7bae19f Merge branch 'main' into huangminghuang/block_start_time
# Conflicts:
#	plugins/producer_plugin/producer_plugin.cpp
2023-03-29 09:03:40 -05:00
Kevin Heifner 6672db333e Remove unneeded check of read-only exhausted trx queue 2023-03-29 07:25:42 -05:00
Kevin Heifner f80a95bf30 Add verification of posted read_only calls 2023-03-29 07:25:08 -05:00
Gregory Popovitch e22629623a Merge pull request #913 from AntelopeIO/optimize_http_api_calls
Replace needless std::map with std::vector, and std::move in capture
2023-03-28 23:21:35 -04:00
Kevin Heifner 81ff398777 Simplify use of exhausted read-only trx queue 2023-03-28 21:41:58 -05:00
Matt Witherspoon 8f36b20ab9 remove now unneeded CMAKE_VERSION checks 2023-03-28 21:23:21 -04:00
Matt Witherspoon cfab568b31 bump cmake minimum to 3.16 2023-03-28 21:22:25 -04:00
Huang-Ming Huang def64d1c6f Merge branch 'release/4.0' into huangminghuang/gelf-fix 2023-03-28 18:26:02 -05:00
Kevin Heifner 2dd1f6768c Remove unneeded _ro_exiting_read_window and simplify read_only_execution_task loop 2023-03-28 18:21:12 -05:00
Huang-Ming Huang e906597c2d fix gelf DNS resolves to ipv6 address 2023-03-28 17:34:45 -05:00
Kevin Heifner fa702aaccc Integrate #904 to prevent exit from read window until all threads are idle. 2023-03-28 17:21:37 -05:00
Clayton Calabrese c6908a45a6 Remove blkData by merging it with blockData and changing some use cases 2023-03-28 17:18:51 -05:00
Clayton Calabrese e0da601c80 fix performance_test and performance_test_basic leaving logs around in TestLogs 2023-03-28 15:50:15 -05:00
766C6164 33334b1b43 Added check for chainbase version 2023-03-28 16:40:07 -04:00
766C6164 f193441289 Added subcommand to check for a clean shutdown 2023-03-28 15:19:12 -04:00
Kevin Heifner 8eaa42ef39 Fix for slow runner hitting abi serialization deadline 2023-03-28 13:48:29 -05:00
greg7mdp abc8c1dcec Replace needless std::map with std::vector, and std::move in capture 2023-03-28 14:30:47 -04:00
Clayton Calabrese d5bbebbb13 fix a number of tests that leave logs in TestLogs even on success. 2023-03-28 12:22:15 -05:00
Kevin Heifner 18cd288c82 Simplify exhausted read-only handling 2023-03-28 10:52:43 -05:00
Clayton Calabrese a7c3431323 prevent snapshot test from creating a bunch of tmp files that aren't cleaned up 2023-03-28 10:06:54 -05:00
Clayton Calabrese 97f02ac1d0 remove unused code 2023-03-28 10:02:34 -05:00
Kevin Heifner ce8c1b70d5 GH-591 fix expected http code 2023-03-28 10:01:38 -05:00
Clayton Calabrese f906cfa686 clean up test wallet littering 2023-03-28 09:59:42 -05:00
Kevin Heifner 138737c414 Default read-only-threads to 3 if not specified when eosio::chain_api_plugin configured and not a producer. 2023-03-28 09:46:08 -05:00
Kevin Heifner 9ec3b79dea GH-591 Return 400 http error for unknown account 2023-03-28 07:42:45 -05:00
Kevin Heifner e8a081c3dc Run everything at the same time test 2023-03-27 19:56:48 -05:00
Kevin Heifner 06637d5221 Add some calls to read-only actions to the test. 2023-03-27 19:36:05 -05:00
Kevin Heifner f999202e94 Check test_mode 2023-03-27 18:22:44 -05:00
Vlad e13e2cf5bd Merge pull request #909 from AntelopeIO/increase-timeout-fork-test-main
[4.0 -> main] Adjusted timeout in tests to give better chance on reaching consensus
2023-03-27 18:55:33 -04:00
766C6164 fa920523c0 Merge branch 'release/4.0' into increase-timeout-fork-test-main 2023-03-27 17:27:14 -04:00
766C6164 6c0ea314a3 Merge branch 'increase-timeout-fork-test-main' of https://github.com/AntelopeIO/leap into increase-timeout-fork-test-main 2023-03-27 17:25:32 -04:00
Vlad 7eaaf66419 Merge branch 'main' into increase-timeout-fork-test-main 2023-03-27 17:25:20 -04:00
766C6164 966dec6f17 Revert "Increased timeout for the network to reach consensus"
This reverts commit d9cde1c924.
2023-03-27 17:24:20 -04:00
Kevin Heifner f07011d828 Minor updates 2023-03-27 16:05:22 -05:00
Kevin Heifner 66aef5b026 Merge remote-tracking branch 'origin/release/4.0' into read-safe-multi-thread-4.0 2023-03-27 15:29:49 -05:00
Kevin Heifner 1c5e133ce6 Merge pull request #910 from AntelopeIO/GH-891-interrupt-start-block-main
[4.0 -> main] Use block_num for interrupt of start_block & Use single timer for read and write windows
2023-03-27 14:38:34 -05:00
Matt Witherspoon 49939fe2f4 Merge pull request #894 from AntelopeIO/bionic_removal
remove ubuntu 18.04 from CI & documentation
2023-03-27 11:47:30 -07:00
Kevin Heifner 23fd711cbc Merge remote-tracking branch 'origin/main' into GH-891-interrupt-start-block-main 2023-03-27 13:40:38 -05:00
Gregory Popovitch 09c6af1659 Merge pull request #904 from AntelopeIO/gh_822_main
[4.0 -> main] Cleanup and prevent thread starvation while in the read window.
2023-03-27 14:31:21 -04:00
766C6164 d9cde1c924 Increased timeout for the network to reach consensus 2023-03-27 14:18:36 -04:00
Vlad fca96e56eb Merge pull request #907 from AntelopeIO/increase-timeout-fork-test
[4.0] Adjusted timeout in tests to give better chance on reaching consensus
2023-03-27 14:14:02 -04:00
Kevin Heifner bb4a277385 Merge remote-tracking branch 'origin/release/4.0' into GH-891-interrupt-start-block-main 2023-03-27 12:19:51 -05:00
Kevin Heifner a329707f22 Merge pull request #908 from AntelopeIO/GH-891-interrupt-start-block-4.0
[3.2 -> 4.0] Use block_num for interrupt of start_block
2023-03-27 12:19:20 -05:00
Lin Huang fed6d11e00 Merge pull request #905 from AntelopeIO/single_timer
[4.0] Use a single timer for read and write windows
2023-03-27 13:12:41 -04:00
Kevin Heifner 9e79e82dea GH-891 Integrate new received block into ro_trx_queue 2023-03-27 10:51:11 -05:00
766C6164 0c448aebee Adjusted timeout to give better chance on reaching consensus 2023-03-27 11:49:57 -04:00
Kevin Heifner 728f9b3861 Merge remote-tracking branch 'origin/release/3.2' into GH-891-interrupt-start-block-4.0 2023-03-27 10:30:27 -05:00
Kevin Heifner f1cc518341 Merge pull request #893 from AntelopeIO/GH-891-interrupt-start-block-3.2
[3.2] Use block_num for interrupt of start_block
2023-03-27 10:23:34 -05:00
Lin Huang d73bf1b0a5 Use a single timer for read and write windows 2023-03-27 10:52:24 -04:00
greg7mdp 90b1e9e5c0 Merge remote-tracking branch 'origin/release/4.0' into gh_822_main 2023-03-27 10:10:27 -04:00
Gregory Popovitch 8de29868c8 Merge pull request #892 from AntelopeIO/gh-822-4.0
[4.0] Cleanup and prevent thread starvation while in the read window.
2023-03-27 09:37:32 -04:00
Matt Witherspoon 89d60a09e7 Merge pull request #895 from AntelopeIO/ci_test_timeouts
set a maximum test time in CI via a ctest argument
2023-03-25 11:16:22 -07:00
Kevin Heifner 376470d685 Encapsulate mtx 2023-03-25 11:52:38 -05:00
Kevin Heifner 780fb3f8f8 Fix includes 2023-03-25 11:29:04 -05:00
Kevin Heifner d106d18f72 Fix rebase merge issue 2023-03-25 11:23:52 -05:00
Kevin Heifner ac234f6547 Add multiple runs to read_only_trx_test.py. Also be explicit about 0 read-only-threads 2023-03-25 10:53:07 -05:00
Kevin Heifner f47d7d23e7 Revert added whitespace 2023-03-25 10:53:07 -05:00
Kevin Heifner 33e1951aa9 Shutdown all read threads when read_only queue is empty 2023-03-25 10:53:06 -05:00
Lin Huang 25c0efcd6e correct version after merging from 4.0.0-rc1 2023-03-25 10:48:22 -05:00
Zach Butler fe74adcfad Restore markdown formatting erroneously deleted in commit 06c9e25327 2023-03-25 10:47:41 -05:00
Zach Butler 320d480be3 Cardinal objects should be in a numbered list 2023-03-25 10:47:41 -05:00
Zach Butler 1655c66786 Pull note about sudo into its own quote block 2023-03-25 10:47:41 -05:00
Zach Butler 2abdaa4f90 Minor pinned build script README changes 2023-03-25 10:47:40 -05:00
Kevin Heifner efa76d349f get_snapshot_requests safe to be parallel in read window 2023-03-25 10:47:40 -05:00
Kevin Heifner ea43426ca2 Fix test configuration 2023-03-25 10:47:40 -05:00
Kevin Heifner d9c9150be9 Enabled read-only thread pool on non-producer nodes by default with 3 threads. 2023-03-25 10:47:39 -05:00
Kevin Heifner 7893eebff5 Add --num-test-runs option and fix get_table_rows to not generate an error 2023-03-25 10:47:39 -05:00
Kevin Heifner 5126601c1e Rename some variables and add some additional comments 2023-03-25 10:47:38 -05:00
Kevin Heifner 73da55059c Rename general queue to read_write queue and read_only_safe queue to read_only queue. 2023-03-25 10:47:38 -05:00
Kevin Heifner d13c056933 net_plugin operations do not have to be on the main thread at all. 2023-03-25 10:47:38 -05:00
Kevin Heifner 709c0a94a9 Fix merge conflicts 2023-03-25 10:47:37 -05:00
Kevin Heifner a913cdbfb6 Use read_only_safe queue for switching. Add comments on why. 2023-03-25 10:47:37 -05:00
Kevin Heifner 366a9bb706 Rename read_only_trx_safe to read_only_safe 2023-03-25 10:47:36 -05:00
Kevin Heifner 44f7429407 Move operations not safe to run in parallel onto general queue 2023-03-25 10:46:11 -05:00
Kevin Heifner 791c2c9ca2 Clean up some comments 2023-03-25 10:44:35 -05:00
Kevin Heifner 8ca774328e Update comments 2023-03-25 10:44:35 -05:00
Kevin Heifner f051bad29f Swith db read mode when executing read-only trx on the main thread 2023-03-25 10:41:55 -05:00
Kevin Heifner d97aaf1a55 Add required thread safety to execution priority queue. 2023-03-25 10:41:55 -05:00
Kevin Heifner 1ff7e7de2e Revert to appbase main branch 2023-03-25 10:41:54 -05:00
Kevin Heifner 052faf630d max-transaction-time is required to be less than read-only-read-window-time-us 2023-03-25 10:41:54 -05:00
Kevin Heifner f53341b98e When running without read only thread pool, execute exhausted read only trxs during start block. 2023-03-25 10:41:53 -05:00
Kevin Heifner 8d8db42f7c Consistently execute read-only trx via process_read_only_transaction() 2023-03-25 10:41:53 -05:00
Kevin Heifner aca29eb87e Cleanup comments 2023-03-25 10:41:53 -05:00
Kevin Heifner 5ac13271ff Cleanup variable names and comments and fix mutex lock around execute_highest_read_only() 2023-03-25 10:41:52 -05:00
Kevin Heifner c10195cddf Update tests for pop() happening before execute() 2023-03-25 10:40:53 -05:00
Kevin Heifner cfa2cc2ec8 Read-only execution can run during write window so set read_window_deadline to allow it. 2023-03-25 10:40:53 -05:00
Kevin Heifner 3239eb7225 Update to appbase with priority queue pop() 2023-03-25 10:38:21 -05:00
Kevin Heifner e2ad3488e8 Execute read safe tasks on read-only thread pool. 2023-03-25 10:38:16 -05:00
Matt Witherspoon fd33c6d95b set a maximum test time in CI via ctest argument 2023-03-24 19:19:43 -04:00
greg7mdp f331ff96be Merge branch 'gh-822-4.0' of github.com:AntelopeIO/leap into gh-822-4.0 2023-03-24 18:52:27 -04:00
greg7mdp e05b737703 Fix hang occuring sometimes in test 2023-03-24 18:51:24 -04:00
Kevin Heifner ebadb713e9 GH-891 Use block_num for interrupt of start_block to handle case of receiving block before beginning of start_block 2023-03-24 14:17:13 -05:00
Gregory Popovitch bda60b521d Merge branch 'release/4.0' into gh-822-4.0 2023-03-24 14:54:04 -04:00
greg7mdp e4c138d490 simplify cond wait - greatly inspired from Kevin's branch 2023-03-24 14:49:14 -04:00
greg7mdp 12c9cdfe04 Fix test issue (uninitialized variables) 2023-03-24 14:49:10 -04:00
greg7mdp 4379207dac Replace option to turn off checking with a static variable. 2023-03-24 14:49:02 -04:00
greg7mdp 1ca223cad6 Address PR comments 2023-03-24 14:48:56 -04:00
greg7mdp ac61ecd816 Add extra test with 1 readonly thread 2023-03-24 14:48:46 -04:00
greg7mdp 30fc086249 Implement code review comments. 2023-03-24 14:48:40 -04:00
greg7mdp d75db84abf Notify condition_variable under the lock.
(see https://github.com/isocpp/CppCoreGuidelines/issues/925#issuecomment-302269850)
2023-03-24 14:48:30 -04:00
greg7mdp 5a76c1b240 Deal with possible spurious wakeups from wait(). 2023-03-24 14:48:24 -04:00
greg7mdp aad1729450 No need to check for option's presence since it has a default value 2023-03-24 14:48:19 -04:00
greg7mdp 77e96f8416 simplify capture list 2023-03-24 14:48:08 -04:00
greg7mdp da8a507642 Add C++ test exercizing readonly transactions in read window. 2023-03-24 14:48:02 -04:00
greg7mdp 0688dc7254 Fix a couple issues - now tests pass! 2023-03-24 14:47:57 -04:00
greg7mdp 8289563b69 Add two assert() checks. 2023-03-24 14:47:53 -04:00
greg7mdp f7822e3277 Small cleanups and comments. 2023-03-24 14:47:49 -04:00
greg7mdp 033ca045e5 Small cleanups. 2023-03-24 14:47:46 -04:00
greg7mdp 2a9653101f Consistent exit when read_window_deadline is reached, and encapsulate exit criteria in ro_trx_queue_t 2023-03-24 14:47:42 -04:00
greg7mdp 7b22be389f Update comment 2023-03-24 14:47:34 -04:00
greg7mdp 81939db6ea Forgot one notify_one call. 2023-03-24 14:47:30 -04:00
greg7mdp 72ea655875 Cleanup and prevent thread starvation while in the read window. 2023-03-24 14:47:23 -04:00
Lin Huang c227c63714 Merge pull request #890 from AntelopeIO/time_summary
[4.0 -> main] Add time summary logging for transient trx processing and read-only threads
2023-03-24 14:30:41 -04:00
Lin Huang a47447b5df Merge remote-tracking branch 'origin/release/4.0' into time_summary 2023-03-24 13:52:35 -04:00
Lin Huang f07e688305 Merge pull request #885 from AntelopeIO/read_only_time_report
[4.0] Add time summary logging for transient trx processing and read-only threads
2023-03-24 13:45:11 -04:00
Huang-Ming Huang 2766caf1ba address PR comment 2023-03-24 12:07:52 -05:00
Lin Huang 44b56b38ca use std::atomic<int64_t> for total thread time for simplicity 2023-03-23 21:14:38 -04:00
Kevin Heifner 291cd11cd4 Merge pull request #888 from AntelopeIO/fix-clang-warn
Fix clang warning
2023-03-23 18:42:06 -05:00
Lin Huang c600fbe0b8 let add_success_time and add_fail_time handle transient trxs time tracking 2023-03-23 19:19:08 -04:00
Kevin Heifner 15b271a98a Fix clang warning 2023-03-23 17:58:45 -05:00
Lin Huang 07af448870 add total time spent by all threads and minor format changes 2023-03-23 18:36:09 -04:00
Matt Witherspoon da685c1a70 remove ubuntu 18.04 from CI & documentation 2023-03-23 18:02:02 -04:00
Huang-Ming Huang 7b38f8eeee fix previous commit 2023-03-23 14:57:13 -05:00
Huang-Ming Huang 537e0f056b fix start time for the first block in a round 2023-03-23 14:46:27 -05:00
Lin Huang 318e1e4533 Merge pull request #884 from AntelopeIO/merge_4_0_0_rc_2_bump
[4.0 -> main] Merge 4.0.0-rc2 bump changes to main
2023-03-23 14:33:45 -04:00
Lin Huang fb21cdecb0 add us (for microseconds) to time text 2023-03-23 14:31:30 -04:00
Lin Huang b3cc74f621 Merge remote-tracking branch 'origin/release/4.0' into read_only_time_report 2023-03-23 14:03:37 -04:00
Lin Huang 8d86d7d2d4 change is_main_thread method name to is_on_main_thread 2023-03-23 14:02:56 -04:00
Lin Huang ccdaa64392 correct version after merging from 4.0.0-rc2 2023-03-23 13:28:43 -04:00
Kevin Heifner 150fe5de8f Merge pull request #882 from AntelopeIO/GH-871-test-fix-main
[4.0 -> main] Test fix: Add max-transaction-time -1
2023-03-23 12:10:00 -05:00
Lin Huang 59cf021b08 Merge pull request #881 from AntelopeIO/bump_to_4_0_0_rc2
Bump release/4.0.0 to rc2
2023-03-23 12:40:56 -04:00
Kevin Heifner 8b52aac579 Merge remote-tracking branch 'origin/release/4.0' into GH-871-test-fix-main 2023-03-23 11:39:53 -05:00
ClaytonCalabrese 1dd3f89555 Merge pull request #880 from AntelopeIO/restore_lost_node_py_changes_main
[4.0 -> main] Restore Node.py Changes that were lost
2023-03-23 11:38:09 -05:00
Lin Huang 5969e8b6fe Bump release/4.0.0 to rc2 2023-03-23 12:11:40 -04:00
Kevin Heifner 8cbd7decca Merge pull request #872 from AntelopeIO/GH-871-test-fix-4.0
[4.0] Test fix: Add max-transaction-time -1
2023-03-23 11:07:33 -05:00
Clayton Calabrese 25915c3510 merge release/4.0 into main to get missing Node.py changes 2023-03-23 11:04:19 -05:00
Kevin Heifner 2299d0b626 Merge pull request #878 from AntelopeIO/GH-854-fix-test-main
[4.0 -> main] Test Fix: Use max-transaction-time -1
2023-03-23 10:38:40 -05:00
ClaytonCalabrese c9fcb2ac2c Merge pull request #875 from AntelopeIO/restore_lost_node_py_changes
[4.0] Return Lost Changes to Node.py Functions
2023-03-23 10:10:32 -05:00
Kevin Heifner 40576f5416 Merge remote-tracking branch 'origin/release/4.0' into GH-854-fix-test-main 2023-03-23 10:06:16 -05:00
Kevin Heifner b5232f0eaf Merge pull request #864 from AntelopeIO/GH-854-fix-test-4.0
[4.0] Test Fix: Use max-transaction-time -1
2023-03-23 10:05:43 -05:00
Huang-Ming Huang 8134e5394a Merge pull request #877 from AntelopeIO/huangminghuang/unshare-import-fix
[4.0->main] unshare import fix & SHiP: Send until queue is empty
2023-03-23 10:05:23 -05:00
Huang-Ming Huang 6176fa323c Merge remote-tracking branch 'origin/release/4.0' into huangminghuang/unshare-import-fix 2023-03-23 09:43:27 -05:00
Vlad 5d1ab0c0bb Merge pull request #873 from AntelopeIO/increase-snapshot-test-robustness-main
[4.0 -> main] Increase robustness of snapshot diff python test
2023-03-23 10:37:35 -04:00
Huang-Ming Huang ac1a035b5e Merge pull request #869 from AntelopeIO/huangminghuang/unshare-import-fix-4.0
[4.0] unshare import fix
2023-03-23 09:36:49 -05:00
Lin Huang 2597e02383 Merge remote-tracking branch 'origin/release/4.0' into read_only_time_report 2023-03-23 09:15:53 -04:00
Kevin Heifner 191aafc8f6 Merge pull request #876 from AntelopeIO/GH-861-ship-fix-4.0
[4.0] SHiP: Send until queue is empty
2023-03-22 22:22:24 -05:00
Kevin Heifner 405ac4178d GH-861 Make sure to keep sending as long as there are items queued up to send. 2023-03-22 21:01:17 -05:00
Clayton Calabrese 41bb796d77 add forgotten piece of changing default time limit for cleosLimit 2023-03-22 19:52:15 -05:00
Clayton Calabrese 1e80205270 remove hardcoded 999 time limit for getTable and depend on version. Change from 99999 to 999 for non v2 nodeos 2023-03-22 18:29:22 -05:00
Clayton Calabrese 483b462717 restore lost changes due to splitting of Node.py and moving of functions 2023-03-22 18:23:57 -05:00
766C6164 1b04bdf71c Rolled back queries.py changes in this pr 2023-03-22 18:38:06 -04:00
766C6164 9e2593cc16 Merge branch 'release/4.0' into increase-snapshot-test-robustness-main 2023-03-22 17:45:31 -04:00
Kevin Heifner ec471ad8e5 GH-871 Use max-transaction-time=-1 for consistency 2023-03-22 15:36:17 -05:00
Kevin Heifner 3dbc0baeeb GH-871 Add max-transaction-time -1 for loading of contract 2023-03-22 15:03:57 -05:00
Huang-Ming Huang 6ee7e1f1bb add missing test in cmake 2023-03-22 13:55:44 -05:00
Huang-Ming Huang f3c424ef90 huangminghuang/unshare-import-fix 2023-03-22 13:39:57 -05:00
Clayton Calabrese 1bd16e8a6d some additional improvements to reduce performance test code and wasted effort 2023-03-22 12:21:30 -05:00
Vlad 2829420ecb Merge pull request #856 from AntelopeIO/increase-snapshot-test-robustness
[4.0] Increase robustness of snapshot diff python test
2023-03-22 11:51:46 -04:00
Huang-Ming Huang a4ee191185 optimize block start time 2023-03-22 10:51:16 -05:00
Kevin Heifner 87c7480656 Merge pull request #852 from AntelopeIO/GH-850-test-fix
[4.0] Test Fix: Pass a large time limit to get table call
2023-03-22 09:25:02 -05:00
Kevin Heifner 971102e243 GH-854 Use max-transaction-time -1 like other integration tests 2023-03-22 09:20:34 -05:00
Clayton Calabrese 41f5b7fec6 merge from main 2023-03-21 17:46:33 -05:00
Clayton Calabrese e793ed17df commit in progress rework and log reduction to allow merge from main 2023-03-21 17:43:15 -05:00
Zach Butler 229de5aa05 Fix spurious commit 2023-03-21 18:10:23 -04:00
Zach Butler 4381229880 Guard against sudo being missing 2023-03-21 18:07:10 -04:00
Zach Butler 9f523ed7f1 You pass "y", not "-y", lol 2023-03-21 17:54:43 -04:00
Zach Butler 624864f3e0 Apparently the software suite including apt-get is called APT, not aptitude 2023-03-21 17:15:38 -04:00
Zach Butler 429e6e7694 A comment 2023-03-21 17:09:33 -04:00
Zach Butler fcdbe4c938 Do not hide exit status in try() 2023-03-21 16:20:10 -04:00
Zach Butler c21e563b1b Make it easier to debug by printing significant commands before running them in try() 2023-03-21 16:19:15 -04:00
Zach Butler a0a7338118 Add a pinned build example where the [Y/n] prompts from aptitude are suppressed 2023-03-21 16:17:37 -04:00
Zach Butler 0fcb2a152f Add a note about the pinned build script asking for a password 2023-03-21 16:17:37 -04:00
Zach Butler 68bf7febf0 Remove scripts/install_deps.sh from the README.md 2023-03-21 16:17:37 -04:00
Zach Butler 71fe27cfdf Remove the "-y" flag from "apt-get install"
To suppress the prompts from aptitude, run:
echo 'y' | ./scripts/pinned_build.sh /leap/deps /leap/build "$(nproc)"
2023-03-21 16:17:37 -04:00
Zach Butler 41e34c4881 Remove hard-coded timezone
tzdata defaults to UTC anyways, lol
2023-03-21 16:17:36 -04:00
Zach Butler c7545f2cd6 Remove unnecessary MISSING_DEPS var 2023-03-21 16:17:36 -04:00
Zach Butler ddfedd4d88 SC2207 - warning: Prefer mapfile or read -a to split command output (or quote to avoid splitting)
Note: This implementation is backwards-compatible with BASH 3.x for
macOS
2023-03-21 16:17:36 -04:00
Zach Butler 75c5f3bcda SC2086 - note: Double quote to prevent globbing and word splitting 2023-03-21 16:17:31 -04:00
766C6164 cb64c3fb38 schedule snapshot at exact block num of another one 2023-03-21 15:43:31 -04:00
Zach Butler 1deeab7071 Use "dpkg -s" instead of "dpkg -l" 2023-03-21 14:18:16 -04:00
Zach Butler 8b25083310 Write code to by-pass invocation of apt-get (and sudo) if dependencies are already installed 2023-03-21 14:18:15 -04:00
Zach Butler fcb5437882 Use sudo for apt-get commands if we are not root 2023-03-21 14:18:15 -04:00
Zach Butler 8c0465a098 Use try() for apt-get commands 2023-03-21 14:18:15 -04:00
Zach Butler 3ed298c7aa Add a print statement at the beginning and end of package deps installation 2023-03-21 14:18:15 -04:00
Zach Butler dd2d53d480 Add a warning for OSes that do not have aptitude 2023-03-21 14:18:14 -04:00
Zach Butler f67e598ba1 Roll scripts/install_deps.sh into scripts/pinned_build.sh with a guard
for Debian-family OSes
2023-03-21 14:18:14 -04:00
Kevin Heifner 446a04a607 GH-850 Pass a large time limit so python does not have to handle more=true case. 2023-03-21 13:09:26 -05:00
Lin Huang 0ed5d6da9e track read-window time 2023-03-20 11:31:16 -04:00
Lin Huang 38d3c39e9d track transient trx on main thread execution time specifically 2023-03-19 20:52:48 -04:00
468 changed files with 15973 additions and 18691 deletions
-3
View File
@@ -1,7 +1,4 @@
{
"ubuntu18": {
"dockerfile": ".cicd/platforms/ubuntu18.Dockerfile"
},
"ubuntu20": {
"dockerfile": ".cicd/platforms/ubuntu20.Dockerfile"
},
-40
View File
@@ -1,40 +0,0 @@
FROM ubuntu:bionic
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
curl \
g++-8 \
git \
jq \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-7-dev \
ninja-build \
python3 \
python3-numpy \
python3-pip \
software-properties-common \
zlib1g-dev \
zstd
RUN python3 -m pip install dataclasses
# GitHub's actions/checkout requires git 2.18+ but Ubuntu 18 only provides 2.17
RUN add-apt-repository ppa:git-core/ppa && apt update && apt install -y git
# Leap requires boost 1.67+ but Ubuntu 18 only provides 1.65
# Probably need 1.70+ to work properly with old cmake provided in Ubuntu 18
RUN curl -L https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2 | tar jx && \
cd boost_* && \
./bootstrap.sh --prefix=/boost && \
./b2 --with-iostreams --with-date_time --with-filesystem --with-system \
--with-program_options --with-chrono --with-test -j$(nproc) install && \
cd .. && \
rm -rf boost_*
ENV CC=gcc-8
ENV CXX=g++-8
ENV BOOST_ROOT=/boost
ENV LLVM_DIR=/usr/lib/llvm-7/
+14 -14
View File
@@ -1,16 +1,16 @@
FROM ubuntu:focal
ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
curl \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
apt-get install -y build-essential \
cmake \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
+14 -14
View File
@@ -1,16 +1,16 @@
FROM ubuntu:jammy
ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
curl \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
apt-get install -y build-essential \
cmake \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
@@ -9,6 +9,8 @@ inputs:
required: true
tests-label:
required: true
test-timeout:
required: true
runs:
using: 'node16'
main: 'dist/index.mjs'
File diff suppressed because one or more lines are too long
@@ -10,25 +10,27 @@ const container = core.getInput('container', {required: true});
const error_log_paths = JSON.parse(core.getInput('error-log-paths', {required: true}));
const log_tarball_prefix = core.getInput('log-tarball-prefix', {required: true});
const tests_label = core.getInput('tests-label', {required: true});
const test_timeout = core.getInput('test-timeout', {required: true});
const repo_name = process.env.GITHUB_REPOSITORY.split('/')[1];
try {
if(child_process.spawnSync("docker", ["run", "--name", "base", "-v", `${process.cwd()}/build.tar.zst:/build.tar.zst`, "--workdir", "/__w/leap/leap", container, "sh", "-c", "zstdcat /build.tar.zst | tar x"], {stdio:"inherit"}).status)
if(child_process.spawnSync("docker", ["run", "--name", "base", "-v", `${process.cwd()}/build.tar.zst:/build.tar.zst`, "--workdir", `/__w/${repo_name}/${repo_name}`, container, "sh", "-c", "zstdcat /build.tar.zst | tar x"], {stdio:"inherit"}).status)
throw new Error("Failed to create base container");
if(child_process.spawnSync("docker", ["commit", "base", "baseimage"], {stdio:"inherit"}).status)
throw new Error("Failed to create base image");
if(child_process.spawnSync("docker", ["rm", "base"], {stdio:"inherit"}).status)
throw new Error("Failed to remove base container");
// the correct approach is by far "--show-only=json-v1" and then pluck out .tests[].name; but that doesn't work on U18's cmake 3.10 since it lacks json-v1 output
const test_query_result = child_process.spawnSync("docker", ["run", "--rm", "baseimage", "bash", "-e", "-o", "pipefail", "-c", `cd build; ctest -L '${tests_label}' --show-only | head -n -1 | cut -d ':' -f 2 -s | jq -cnR '[inputs | select(length>0)[1:]]'`]);
const test_query_result = child_process.spawnSync("docker", ["run", "--rm", "baseimage", "bash", "-e", "-o", "pipefail", "-c", `cd build; ctest -L '${tests_label}' --show-only=json-v1`]);
if(test_query_result.status)
throw new Error("Failed to discover tests with label")
const tests = JSON.parse(test_query_result.stdout);
const tests = JSON.parse(test_query_result.stdout).tests;
let subprocesses = [];
tests.forEach(t => {
subprocesses.push(new Promise(resolve => {
child_process.spawn("docker", ["run", "--security-opt", "seccomp=unconfined", "-e", "GITHUB_ACTIONS=True", "--name", t, "--init", "baseimage", "bash", "-c", `cd build; ctest --output-on-failure -R '^${t}$'`], {stdio:"inherit"}).on('close', code => resolve(code));
child_process.spawn("docker", ["run", "--security-opt", "seccomp=unconfined", "-e", "GITHUB_ACTIONS=True", "--name", t.name, "--init", "baseimage", "bash", "-c", `cd build; ctest --output-on-failure -R '^${t.name}$' --timeout ${test_timeout}`], {stdio:"inherit"}).on('close', code => resolve(code));
}));
});
@@ -45,13 +47,13 @@ try {
let packer = tar.pack();
extractor.on('entry', (header, stream, next) => {
if(!header.name.startsWith(`__w/leap/leap/build`)) {
if(!header.name.startsWith(`__w/${repo_name}/${repo_name}/build`)) {
stream.on('end', () => next());
stream.resume();
return;
}
header.name = header.name.substring(`__w/leap/leap/`.length);
header.name = header.name.substring(`__w/${repo_name}/${repo_name}/`.length);
if(header.name !== "build/" && error_log_paths.filter(p => header.name.startsWith(p)).length === 0) {
stream.on('end', () => next());
stream.resume();
@@ -61,8 +63,8 @@ try {
stream.pipe(packer.entry(header, next));
}).on('finish', () => {packer.finalize()});
child_process.spawn("docker", ["export", tests[i]]).stdout.pipe(extractor);
stream.promises.pipeline(packer, zlib.createGzip(), fs.createWriteStream(`${log_tarball_prefix}-${tests[i]}-logs.tar.gz`));
child_process.spawn("docker", ["export", tests[i].name]).stdout.pipe(extractor);
stream.promises.pipeline(packer, zlib.createGzip(), fs.createWriteStream(`${log_tarball_prefix}-${tests[i].name}-logs.tar.gz`));
}
} catch(e) {
core.setFailed(`Uncaught exception ${e.message}`);
+18 -15
View File
@@ -63,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu18, ubuntu20, ubuntu22]
platform: [ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-beefy"]
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
steps:
@@ -75,11 +75,9 @@ jobs:
run: |
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -GNinja ..
ninja
tar -pc -C .. --exclude "*.o" build | zstd --long -T0 -9 > ../build.tar.zst
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -GNinja
cmake --build build
tar -pc --exclude "*.o" build | zstd --long -T0 -9 > build.tar.zst
- name: Upload builddir
uses: AntelopeIO/upload-artifact-large-chunks-action@v1
with:
@@ -105,12 +103,18 @@ jobs:
zstdcat build.tar.zst | tar x
cd build
cpack
- name: Install dev package
run: |
apt update && apt upgrade -y
apt install -y ./build/leap_*.deb ./build/leap-dev*.deb
- name: Test using TestHarness
run: |
python3 -c "from TestHarness import Cluster"
- name: Upload dev package
uses: actions/upload-artifact@v3
with:
name: leap-dev-ubuntu20-amd64
path: build/leap-dev*.deb
tests:
name: Tests
needs: [d, Build]
@@ -120,7 +124,7 @@ jobs:
matrix:
platform: [ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-hightier"]
container:
container:
image: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
options: --security-opt seccomp=unconfined
steps:
@@ -133,12 +137,9 @@ jobs:
run: |
# https://github.com/actions/runner/issues/2033 -- need this because of full version label test looking at git revs
chown -R $(id -u):$(id -g) $PWD
# jammy's boost 1.74 can stumble on an EXDEV via copy_file_range() it doesn't have a fallback for; re-eval once moving to std::filesystem
export TMPDIR="$PWD/tmp"
mkdir -p $TMPDIR
zstdcat build.tar.zst | tar x
cd build
ctest --output-on-failure -j $(nproc) -LE "(nonparallelizable_tests|long_running_tests)"
ctest --output-on-failure -j $(nproc) -LE "(nonparallelizable_tests|long_running_tests)" --timeout 420
np-tests:
name: NP Tests
@@ -147,7 +148,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu18, ubuntu20, ubuntu22]
platform: [ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-midtier"]
steps:
- uses: actions/checkout@v3
@@ -162,7 +163,8 @@ jobs:
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]'
log-tarball-prefix: ${{matrix.platform}}
tests-label: nonparallelizable_tests
- name: Upload logs from failed tests
test-timeout: 420
- name: Upload logs from failed tests
uses: actions/upload-artifact@v3
if: failure()
with:
@@ -176,7 +178,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu18, ubuntu20, ubuntu22]
platform: [ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-lowtier"]
steps:
- uses: actions/checkout@v3
@@ -191,6 +193,7 @@ jobs:
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]'
log-tarball-prefix: ${{matrix.platform}}
tests-label: long_running_tests
test-timeout: 1800
- name: Upload logs from failed tests
uses: actions/upload-artifact@v3
if: failure()
+21
View File
@@ -0,0 +1,21 @@
name: "Pinned Build"
on:
workflow_dispatch:
permissions:
packages: read
contents: read
defaults:
run:
shell: bash
jobs:
Temp:
name: temp
runs-on: ubuntu-latest
steps:
- name: test
run: |
pwd
+6 -21
View File
@@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 3.8 )
cmake_minimum_required( VERSION 3.16 )
project( leap )
include(CTest) # suppresses DartConfiguration.tcl error
@@ -37,12 +37,8 @@ set( LEAP_UTIL_EXECUTABLE_NAME leap-util )
# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message(FATAL_ERROR "GCC version must be at least 8.0!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "Clang version must be at least 5.0!")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
message(FATAL_ERROR "GCC version must be at least 9.0!")
endif()
endif()
@@ -109,7 +105,7 @@ set(Boost_USE_MULTITHREADED ON)
set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
# Most boost deps get implictly picked up via fc, as just about everything links to fc. In addition we pick up
# the pthread dependency through fc.
find_package(Boost 1.67 REQUIRED COMPONENTS program_options unit_test_framework system)
find_package(Boost 1.71 REQUIRED COMPONENTS program_options unit_test_framework system)
if( APPLE AND UNIX )
# Apple Specific Options Here
@@ -251,7 +247,6 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests/TestHarness DESTINATION ${CM
PATTERN "*.json"
PATTERN "__pycache__" EXCLUDE
PATTERN "CMakeFiles" EXCLUDE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tests/launcher.py DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/leap_testing/tests COMPONENT dev EXCLUDE_FROM_ALL)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
# Cmake versions < 3.21 did not support installing symbolic links to a directory via install(FILES ...)
@@ -268,18 +263,8 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/python3/dist-packages/TestHarness DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/python3/dist-packages COMPONENT dev EXCLUDE_FROM_ALL)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/leap_testing/bin DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/leap_testing COMPONENT dev EXCLUDE_FROM_ALL)
else()
# The following install(CODE ...) steps are necessary for `make dev-install` to work on cmake versions < 3.21.
# However, it can flag as an error if using `make package` instead of `make dev-install` for installation.
# This is due to those directories and symbolic links being created in the postinit script during the package install instead.
# Note If/when doing `make package`, it is not a true error if you see:
# Error creating directory "/<leap_install_dir>/lib/python3/dist-packages".
# CMake Error: failed to create symbolic link '/<leap_install_dir>/lib/python3/dist-packages/TestHarness': no such file or directory
# CMake Error: failed to create symbolic link '/<leap_install_dir>/share/leap_testing/bin': no such file or directory
install(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_FULL_LIBDIR}/python3/dist-packages)" COMPONENT dev EXCLUDE_FROM_ALL)
install(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../share/leap_testing/tests/TestHarness ${CMAKE_INSTALL_FULL_LIBDIR}/python3/dist-packages/TestHarness)" COMPONENT dev EXCLUDE_FROM_ALL)
install(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ../../bin ${CMAKE_INSTALL_FULL_DATAROOTDIR}/leap_testing/bin)" COMPONENT dev EXCLUDE_FROM_ALL)
# The following install(SCRIPT ...) steps are necessary for `make dev-install` to work on cmake versions < 3.21.
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/scripts/install_testharness_symlinks.cmake COMPONENT dev EXCLUDE_FROM_ALL)
# The `make package` installation of symlinks happens via the `postinst` script installed in cmake.package via the line below
endif()
-7
View File
@@ -41,8 +41,6 @@ else ( APPLE )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall")
endif ( APPLE )
### Remove after Boost 1.70 CMake fixes are in place
set( Boost_NO_BOOST_CMAKE ON CACHE STRING "ON or OFF" )
set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
find_package(Boost @Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@ EXACT REQUIRED COMPONENTS
date_time
@@ -62,12 +60,9 @@ find_library(libwasm WASM @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libwast WAST @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libir IR @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(liblogging Logging @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libruntime Runtime @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libsoftfloat softfloat @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
get_filename_component(cryptodir @OPENSSL_CRYPTO_LIBRARY@ DIRECTORY)
find_library(liboscrypto crypto "${cryptodir}" NO_DEFAULT_PATH)
get_filename_component(ssldir @OPENSSL_SSL_LIBRARY@ DIRECTORY)
find_library(libosssl ssl "${ssldir}" NO_DEFAULT_PATH)
find_library(libchainbase chainbase @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libbuiltins builtins @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
@@ -89,11 +84,9 @@ macro(add_eosio_test_executable test_name)
${libfc}
${libwast}
${libwasm}
${libruntime}
${libir}
${libsoftfloat}
${liboscrypto}
${libosssl}
${liblogging}
${libchainbase}
${libbuiltins}
-7
View File
@@ -38,8 +38,6 @@ else ( APPLE )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall")
endif ( APPLE )
### Remove after Boost 1.70 CMake fixes are in place
set( Boost_NO_BOOST_CMAKE ON CACHE STRING "ON or OFF" )
set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
find_package(Boost @Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@ EXACT REQUIRED COMPONENTS
date_time
@@ -59,12 +57,9 @@ find_library(libwasm WASM @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/WASM NO_D
find_library(libwast WAST @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/WAST NO_DEFAULT_PATH)
find_library(libir IR @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/IR NO_DEFAULT_PATH)
find_library(liblogging Logging @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/Logging NO_DEFAULT_PATH)
find_library(libruntime Runtime @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/Runtime NO_DEFAULT_PATH)
find_library(libsoftfloat softfloat @CMAKE_BINARY_DIR@/libraries/softfloat NO_DEFAULT_PATH)
get_filename_component(cryptodir @OPENSSL_CRYPTO_LIBRARY@ DIRECTORY)
find_library(liboscrypto crypto "${cryptodir}" NO_DEFAULT_PATH)
get_filename_component(ssldir @OPENSSL_SSL_LIBRARY@ DIRECTORY)
find_library(libosssl ssl "${ssldir}" NO_DEFAULT_PATH)
find_library(libchainbase chainbase @CMAKE_BINARY_DIR@/libraries/chainbase NO_DEFAULT_PATH)
find_library(libbuiltins builtins @CMAKE_BINARY_DIR@/libraries/builtins NO_DEFAULT_PATH)
@@ -86,11 +81,9 @@ macro(add_eosio_test_executable test_name)
${libfc}
${libwast}
${libwasm}
${libruntime}
${libir}
${libsoftfloat}
${liboscrypto}
${libosssl}
${liblogging}
${libchainbase}
${libbuiltins}
+2 -53
View File
@@ -8,7 +8,6 @@ The `main` branch is the development branch; do not use it for production. Refer
We currently support the following operating systems.
- Ubuntu 22.04 Jammy
- Ubuntu 20.04 Focal
- Ubuntu 18.04 Bionic
Other Unix derivatives such as macOS are tended to on a best-effort basis and may not be full featured. If you aren't using Ubuntu, please visit the "[Build Unsupported OS](./docs/00_install/01_build-from-source/00_build-unsupported-os.md)" page to explore your options.
@@ -45,12 +44,11 @@ You will need to build on a [supported operating system](#supported-operating-sy
Requirements to build:
- C++17 compiler and standard library
- boost 1.67+
- CMake 3.8+
- boost 1.70+
- CMake 3.16+
- LLVM 7 - 11 - for Linux only
- newer versions do not work
- openssl 1.1+
- curl
- libcurl 7.40.0+
- git
- GMP
@@ -127,15 +125,12 @@ Now you can optionally [test](#step-4---test) your build, or [install](#step-5--
#### Unpinned Build
The following instructions are valid for this branch. Other release branches may have different requirements, so ensure you follow the directions in the branch or release you intend to build. If you are in an Ubuntu docker container, omit `sudo` because you run as `root` by default.
<details> <summary>Ubuntu 22.04 Jammy & Ubuntu 20.04 Focal</summary>
Install dependencies:
```bash
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
curl \
git \
libboost-all-dev \
libcurl4-openssl-dev \
@@ -151,52 +146,6 @@ cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 ..
make -j "$(nproc)" package
```
</details>
<details> <summary>Ubuntu 18.04 Bionic</summary>
Install dependencies:
```bash
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
curl \
g++-8 \
git \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-7-dev \
python3 \
python3-numpy \
python3-pip \
zlib1g-dev
python3 -m pip install dataclasses
```
You need to build Boost from source on this distribution:
```bash
curl -fL https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2 -o ~/Downloads/boost_1_79_0.tar.bz2
tar -jvxf ~/Downloads/boost_1_79_0.tar.bz2 -C ~/Downloads/
pushd ~/Downloads/boost_1_79_0
./bootstrap.sh --prefix="$HOME/boost1.79"
./b2 --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -j "$(nproc)" install
popd
```
The Boost `*.tar.bz2` download and `boost_1_79_0` folder can be removed now if you want more space.
```bash
rm -r ~/Downloads/boost_1_79_0.tar.bz2 ~/Downloads/boost_1_79_0
```
From a terminal in the root of the `leap` repo, build.
```bash
mkdir -p build
cd build
cmake -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_PREFIX_PATH="$HOME/boost1.79;/usr/lib/llvm-7/" -DCMAKE_BUILD_TYPE=Release ..
make -j "$(nproc)" package
```
After building, you may remove the `~/boost1.79` directory or you may keep it around for your next build.
</details>
Now you can optionally [test](#step-4---test) your build, or [install](#step-5---install) the `*.deb` binary packages, which will be in the root of your build directory.
-1
View File
@@ -12,7 +12,6 @@ Antelope currently supports the following operating systems:
1. Ubuntu 22.04 Jammy
2. Ubuntu 20.04 Focal
3. Ubuntu 18.04 Bionic
[[info | Note]]
| It may be possible to build and install Antelope on other Unix-based operating systems. We gathered helpful information on the following page but please keep in mind that it is experimental and not officially supported.
@@ -120,7 +120,7 @@ Config Options for eosio::chain_plugin:
applied to them (may specify multiple
times)
--read-mode arg (=head) Database read mode ("head",
"irreversible").
"irreversible", "speculative").
In "head" mode: database contains state
changes up to the head block;
transactions received by the node are
@@ -131,7 +131,14 @@ Config Options for eosio::chain_plugin:
received via the P2P network are not
relayed and transactions cannot be
pushed via the chain API.
In "speculative" mode: (DEPRECATED:
head mode recommended) database
contains state changes by transactions
in the blockchain up to the head block
as well as some transactions not yet
included in the blockchain;
transactions received by the node are
relayed if valid.
--api-accept-transactions arg (=1) Allow API transactions to be evaluated
and relayed if valid.
--validation-mode arg (=full) Chain validation mode ("full" or
@@ -122,8 +122,6 @@ Config Options for eosio::producer_plugin:
transaction queue. Exceeding this value
will subjectively drop transaction with
resource exhaustion.
--disable-subjective-billing arg (=1) Disable subjective CPU billing for
API/P2P transactions
--disable-subjective-account-billing arg
Account which is excluded from
subjective CPU billing
@@ -29,6 +29,7 @@ The `nodeos` service can be run in different "read" modes. These modes control h
- `head`: this only includes the side effects of confirmed transactions, this mode processes unconfirmed transactions but does not include them.
- `irreversible`: this mode also includes confirmed transactions only up to those included in the last irreversible block.
- `speculative`: this includes the side effects of confirmed and unconfirmed transactions.
A transaction is considered confirmed when a `nodeos` instance has received, processed, and written it to a block on the blockchain, i.e. it is in the head block or an earlier block.
@@ -44,6 +45,16 @@ When `nodeos` is configured to be in irreversible read mode, it will still track
Clients such as `cleos` and the RPC API will see database state as of the current head block of the chain. It **will not** include changes made by transactions known to this node but not included in the chain, such as unconfirmed transactions.
### Speculative Mode ( Deprecated )
Clients such as `cleos` and the RPC API, will see database state as of the current head block plus changes made by all transactions known to this node but potentially not included in the chain, unconfirmed transactions for example.
Speculative mode is low latency but fragile, there is no guarantee that the transactions reflected in the state will be included in the chain OR that they will reflected in the same order the state implies.
This mode features the lowest latency, but is the least consistent.
In speculative mode `nodeos` is able to execute transactions which have TaPoS (Transaction as Proof of Stake) pointing to any valid block in a fork considered to be the best fork by this node.
## How To Specify the Read Mode
The mode in which `nodeos` is run can be specified using the `--read-mode` option from the `eosio::chain_plugin`.
+5 -3
View File
@@ -5,8 +5,8 @@ file(GLOB HEADERS "include/eosio/chain/*.hpp"
"include/eosio/chain/webassembly/*.hpp"
"${CMAKE_CURRENT_BINARY_DIR}/include/eosio/chain/core_symbol.hpp" )
if(APPLE AND UNIX)
set(PLATFORM_TIMER_IMPL platform_timer_macos.cpp)
if((APPLE AND UNIX) OR (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"))
set(PLATFORM_TIMER_IMPL platform_timer_kqueue.cpp)
else()
try_run(POSIX_TIMER_TEST_RUN_RESULT POSIX_TIMER_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/platform_timer_posix_test.c)
if(POSIX_TIMER_TEST_RUN_RESULT EQUAL 0)
@@ -107,6 +107,7 @@ add_library( eosio_chain
abi_serializer.cpp
asset.cpp
snapshot.cpp
snapshot_scheduler.cpp
deep_mind.cpp
${CHAIN_EOSVMOC_SOURCES}
@@ -121,6 +122,7 @@ add_library( eosio_chain
protocol_feature_manager.cpp
producer_schedule.cpp
genesis_intrinsics.cpp
symbol.cpp
whitelisted_intrinsics.cpp
thread_utils.cpp
platform_timer_accuracy.cpp
@@ -128,7 +130,7 @@ add_library( eosio_chain
${HEADERS}
)
target_link_libraries( eosio_chain PUBLIC bn256 fc chainbase eosio_rapidjson Logging IR WAST WASM Runtime
target_link_libraries( eosio_chain PUBLIC bn256 fc chainbase eosio_rapidjson Logging IR WAST WASM
softfloat builtins ${CHAIN_EOSVM_LIBRARIES} ${LLVM_LIBS} ${CHAIN_RT_LINKAGE}
)
target_include_directories( eosio_chain
+27 -20
View File
@@ -4,6 +4,7 @@
#include <fc/io/raw.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <fc/io/varint.hpp>
#include <fc/time.hpp>
namespace eosio { namespace chain {
@@ -23,11 +24,11 @@ namespace eosio { namespace chain {
template <typename T>
inline fc::variant variant_from_stream(fc::datastream<const char*>& stream, const abi_serializer::yield_function_t& yield) {
fc::yield_function_t y = [&yield](){ yield(0); }; // create yield function matching fc::variant requirements, 0 for recursive depth
T temp;
fc::raw::unpack( stream, temp );
y();
return fc::variant( temp, y );
yield(0);
// create yield function matching fc::variant requirements, 0 for recursive depth
return fc::variant( temp, [yield](){ yield(0); } );
}
template <typename T>
@@ -129,7 +130,7 @@ namespace eosio { namespace chain {
}
void abi_serializer::set_abi(abi_def abi, const yield_function_t& yield) {
impl::abi_traverse_context ctx(yield);
impl::abi_traverse_context ctx(yield, fc::microseconds{});
EOS_ASSERT(starts_with(abi.version, "eosio::abi/1."), unsupported_abi_version_exception, "ABI has an unsupported version");
@@ -235,7 +236,7 @@ namespace eosio { namespace chain {
}
bool abi_serializer::is_type(const std::string_view& type, const yield_function_t& yield)const {
impl::abi_traverse_context ctx(yield);
impl::abi_traverse_context ctx(yield, fc::microseconds{});
return _is_type(type, ctx);
}
@@ -464,23 +465,27 @@ namespace eosio { namespace chain {
}
fc::variant abi_serializer::binary_to_variant( const std::string_view& type, const bytes& binary, const yield_function_t& yield, bool short_path )const {
impl::binary_to_variant_context ctx(*this, yield, type);
impl::binary_to_variant_context ctx(*this, yield, fc::microseconds{}, type);
ctx.short_path = short_path;
return _binary_to_variant(type, binary, ctx);
}
fc::variant abi_serializer::binary_to_variant( const std::string_view& type, const bytes& binary, const fc::microseconds& max_serialization_time, bool short_path )const {
return binary_to_variant( type, binary, create_yield_function(max_serialization_time), short_path );
fc::variant abi_serializer::binary_to_variant( const std::string_view& type, const bytes& binary, const fc::microseconds& max_action_data_serialization_time, bool short_path )const {
impl::binary_to_variant_context ctx(*this, create_depth_yield_function(), max_action_data_serialization_time, type);
ctx.short_path = short_path;
return _binary_to_variant(type, binary, ctx);
}
fc::variant abi_serializer::binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const yield_function_t& yield, bool short_path )const {
impl::binary_to_variant_context ctx(*this, yield, type);
impl::binary_to_variant_context ctx(*this, yield, fc::microseconds{}, type);
ctx.short_path = short_path;
return _binary_to_variant(type, binary, ctx);
}
fc::variant abi_serializer::binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const fc::microseconds& max_serialization_time, bool short_path )const {
return binary_to_variant( type, binary, create_yield_function(max_serialization_time), short_path );
fc::variant abi_serializer::binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const fc::microseconds& max_action_data_serialization_time, bool short_path )const {
impl::binary_to_variant_context ctx(*this, create_depth_yield_function(), max_action_data_serialization_time, type);
ctx.short_path = short_path;
return _binary_to_variant(type, binary, ctx);
}
void abi_serializer::_variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char *>& ds, impl::variant_to_binary_context& ctx )const
@@ -603,23 +608,27 @@ namespace eosio { namespace chain {
} FC_CAPTURE_AND_RETHROW() }
bytes abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, const yield_function_t& yield, bool short_path )const {
impl::variant_to_binary_context ctx(*this, yield, type);
impl::variant_to_binary_context ctx(*this, yield, fc::microseconds{}, type);
ctx.short_path = short_path;
return _variant_to_binary(type, var, ctx);
}
bytes abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, const fc::microseconds& max_serialization_time, bool short_path ) const {
return variant_to_binary( type, var, create_yield_function(max_serialization_time), short_path );
bytes abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, const fc::microseconds& max_action_data_serialization_time, bool short_path ) const {
impl::variant_to_binary_context ctx(*this, create_depth_yield_function(), max_action_data_serialization_time, type);
ctx.short_path = short_path;
return _variant_to_binary(type, var, ctx);
}
void abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const yield_function_t& yield, bool short_path )const {
impl::variant_to_binary_context ctx(*this, yield, type);
impl::variant_to_binary_context ctx(*this, yield, fc::microseconds{}, type);
ctx.short_path = short_path;
_variant_to_binary(type, var, ds, ctx);
}
void abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const fc::microseconds& max_serialization_time, bool short_path ) const {
variant_to_binary( type, var, create_yield_function(max_serialization_time), short_path );
void abi_serializer::variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const fc::microseconds& max_action_data_serialization_time, bool short_path ) const {
impl::variant_to_binary_context ctx(*this, create_depth_yield_function(), max_action_data_serialization_time, type);
ctx.short_path = short_path;
_variant_to_binary(type, var, ds, ctx);
}
type_name abi_serializer::get_action_type(name action)const {
@@ -650,9 +659,7 @@ namespace eosio { namespace chain {
namespace impl {
fc::scoped_exit<std::function<void()>> abi_traverse_context::enter_scope() {
std::function<void()> callback = [old_recursion_depth=recursion_depth, this](){
recursion_depth = old_recursion_depth;
};
std::function<void()> callback = [this](){ --recursion_depth; };
++recursion_depth;
yield( recursion_depth );
+21 -10
View File
@@ -19,15 +19,26 @@ namespace eosio { namespace chain {
static inline void print_debug(account_name receiver, const action_trace& ar) {
if (!ar.console.empty()) {
auto prefix = fc::format_string(
"\n[(${a},${n})->${r}]",
fc::mutable_variant_object()
("a", ar.act.account)
("n", ar.act.name)
("r", receiver));
dlog(prefix + ": CONSOLE OUTPUT BEGIN =====================\n"
+ ar.console
+ prefix + ": CONSOLE OUTPUT END =====================" );
if (fc::logger::get(DEFAULT_LOGGER).is_enabled( fc::log_level::debug )) {
std::string prefix;
prefix.reserve(3 + 13 + 1 + 13 + 3 + 13 + 1);
prefix += "\n[(";
prefix += ar.act.account.to_string();
prefix += ",";
prefix += ar.act.name.to_string();
prefix += ")->";
prefix += receiver.to_string();
prefix += "]";
std::string output;
output.reserve(512);
output += prefix;
output += ": CONSOLE OUTPUT BEGIN =====================\n";
output += ar.console;
output += prefix;
output += ": CONSOLE OUTPUT END =====================";
dlog( std::move(output) );
}
}
}
@@ -467,7 +478,7 @@ void apply_context::schedule_deferred_transaction( const uint128_t& sender_id, a
trx.ref_block_num = 0;
trx.ref_block_prefix = 0;
} else {
trx.expiration = control.pending_block_time() + fc::microseconds(999'999); // Rounds up to nearest second (makes expiration check unnecessary)
trx.expiration = time_point_sec{control.pending_block_time() + fc::microseconds(999'999)}; // Rounds up to nearest second (makes expiration check unnecessary)
trx.set_reference_block(control.head_block_id()); // No TaPoS check necessary
}
+9 -4
View File
@@ -1,9 +1,14 @@
#include <string>
#include <eosio/chain/asset.hpp>
#include <boost/rational.hpp>
#include <boost/algorithm/string.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/safe.hpp>
namespace eosio { namespace chain {
using fc::safe;
uint8_t asset::decimals()const {
return sym.decimals();
}
@@ -19,11 +24,11 @@ int64_t asset::precision()const {
string asset::to_string()const {
string sign = amount < 0 ? "-" : "";
int64_t abs_amount = std::abs(amount);
string result = fc::to_string( static_cast<int64_t>(abs_amount) / precision());
string result = std::to_string( static_cast<int64_t>(abs_amount) / precision());
if( decimals() )
{
auto fract = static_cast<int64_t>(abs_amount) % precision();
result += "." + fc::to_string(precision() + fract).erase(0,1);
result += "." + std::to_string(precision() + fract).erase(0,1);
}
return sign + result + " " + symbol_name();
}
@@ -31,12 +36,12 @@ string asset::to_string()const {
asset asset::from_string(const string& from)
{
try {
string s = fc::trim(from);
string s = boost::algorithm::trim_copy(from);
// Find space in order to split amount and symbol
auto space_pos = s.find(' ');
EOS_ASSERT((space_pos != string::npos), asset_type_exception, "Asset's amount and symbol should be separated with space");
auto symbol_str = fc::trim(s.substr(space_pos + 1));
auto symbol_str = boost::algorithm::trim_copy(s.substr(space_pos + 1));
auto amount_str = s.substr(0, space_pos);
// Ensure that if decimal point is used (.), decimal fraction is specified
+2 -2
View File
@@ -559,8 +559,8 @@ namespace eosio { namespace chain {
}
if( !allow_unused_keys || check_but_dont_fail) {
EOS_ASSERT( checker.all_keys_used(), tx_irrelevant_sig,
if( !allow_unused_keys ) {
EOS_ASSERT( checker.all_keys_used() || check_but_dont_fail, tx_irrelevant_sig,
"transaction bears irrelevant signatures from these keys: ${keys}",
("keys", checker.unused_keys()) );
}
+161 -109
View File
@@ -7,6 +7,7 @@
#include <fc/bitutil.hpp>
#include <fc/io/raw.hpp>
#include <mutex>
#include <string>
#if defined(__BYTE_ORDER__)
static_assert(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__);
@@ -67,14 +68,14 @@ namespace eosio { namespace chain {
sizeof(uint32_t) + sizeof(first_block_num) + sizeof(chain_id_type) + sizeof(block_log::npos);
template <typename Stream>
void read_from(Stream& ds, const fc::path& log_path) {
void read_from(Stream& ds, const std::filesystem::path& log_path) {
ds.read((char*)&ver, sizeof(ver));
EOS_ASSERT(version() > 0, block_log_exception, "Block log was not setup properly");
EOS_ASSERT(block_log::is_supported_version(version()), block_log_unsupported_version,
"Unsupported version of block log. Block log version is ${version} while code supports version(s) "
"[${min},${max}], log file: ${log}",
("version", version())("min", block_log::min_supported_version)(
"max", block_log::max_supported_version)("log", log_path.generic_string()));
"max", block_log::max_supported_version)("log", log_path));
first_block_num = 1;
if (version() != initial_version) {
@@ -150,7 +151,7 @@ namespace eosio { namespace chain {
class index_writer {
public:
index_writer(const fc::path& block_index_name, uint32_t blocks_expected, bool create = true) {
index_writer(const std::filesystem::path& block_index_name, uint32_t blocks_expected, bool create = true) {
index_file.set_file_path(block_index_name);
auto mode = create ? fc::cfile::truncate_rw_mode : fc::cfile::update_rw_mode;
index_file.open(mode);
@@ -204,12 +205,12 @@ namespace eosio { namespace chain {
public:
block_log_data() = default;
block_log_data(const fc::path& path) { open(path); }
block_log_data(const std::filesystem::path& path) { open(path); }
uint64_t first_block_position() const { return first_block_pos; }
const block_log_preamble& get_preamble() const { return preamble; }
void open(const fc::path& path) {
void open(const std::filesystem::path& path) {
if (file.is_open())
file.close();
file.set_file_path(path);
@@ -312,20 +313,20 @@ namespace eosio { namespace chain {
}
std::tuple<uint64_t, uint32_t, std::string>
full_validate_blocks(uint32_t last_block_num, const fc::path& blocks_dir, fc::time_point now);
full_validate_blocks(uint32_t last_block_num, const std::filesystem::path& blocks_dir, fc::time_point now);
void construct_index(const fc::path& index_file_path);
void construct_index(const std::filesystem::path& index_file_path);
};
using block_log_index = eosio::chain::log_index<block_log_exception>;
/// Provide the read only view for both blocks.log and blocks.index files
struct block_log_bundle {
fc::path block_file_name, index_file_name; // full pathname for blocks.log and blocks.index
std::filesystem::path block_file_name, index_file_name; // full pathname for blocks.log and blocks.index
block_log_data log_data;
block_log_index log_index;
block_log_bundle(fc::path block_file, fc::path index_file)
block_log_bundle(std::filesystem::path block_file, std::filesystem::path index_file)
: block_file_name(std::move(block_file)), index_file_name(std::move(index_file)) {
log_data.open(block_file_name);
@@ -345,7 +346,7 @@ namespace eosio { namespace chain {
"index_num_blocks", index_num_blocks)("index_file_name", index_file_name));
}
explicit block_log_bundle(const fc::path& block_dir)
explicit block_log_bundle(const std::filesystem::path& block_dir)
: block_log_bundle(block_dir / "blocks.log", block_dir / "blocks.index") {}
};
@@ -405,7 +406,7 @@ namespace eosio { namespace chain {
return num_blocks;
}
void block_log_data::construct_index(const fc::path& index_file_path) {
void block_log_data::construct_index(const std::filesystem::path& index_file_path) {
std::string index_file_name = index_file_path.generic_string();
ilog("Will write new blocks.index file ${file}", ("file", index_file_name));
@@ -438,12 +439,12 @@ namespace eosio { namespace chain {
struct block_log_verifier {
chain_id_type chain_id = chain_id_type::empty_chain_id();
void verify(block_log_data& log, const boost::filesystem::path& log_path) {
void verify(block_log_data& log, const std::filesystem::path& log_path) {
if (chain_id.empty()) {
chain_id = log.chain_id();
} else {
EOS_ASSERT(chain_id == log.chain_id(), block_log_exception,
"block log file ${path} has a different chain id", ("path", log_path.generic_string()));
"block log file ${path} has a different chain id", ("path", log_path));
}
}
};
@@ -496,19 +497,21 @@ namespace eosio { namespace chain {
/// Would remove pre-existing block log and index, never write blocks into disk.
struct empty_block_log final : block_log_impl {
explicit empty_block_log(const bfs::path& log_dir) {
fc::remove(log_dir / "blocks.log");
fc::remove(log_dir / "blocks.index");
uint32_t first_block_number = std::numeric_limits<uint32_t>::max();
explicit empty_block_log(const std::filesystem::path& log_dir) {
std::filesystem::remove(log_dir / "blocks.log");
std::filesystem::remove(log_dir / "blocks.index");
}
uint32_t first_block_num() final { return head ? head->block_num() : 1; }
uint32_t first_block_num() final { return head ? head->block_num() : first_block_number; }
void append(const signed_block_ptr& b, const block_id_type& id, const std::vector<char>& packed_block) final {
update_head(b, id);
}
uint64_t get_block_pos(uint32_t block_num) final { return block_log::npos; }
void reset(const genesis_state& gs, const signed_block_ptr& first_block) final { update_head(first_block); }
void reset(const chain_id_type& chain_id, uint32_t first_block_num) final {}
void reset(const chain_id_type& chain_id, uint32_t first_block_num) final { first_block_number = first_block_num; }
void flush() final {}
signed_block_ptr read_block_by_num(uint32_t block_num) final { return {}; };
@@ -526,10 +529,10 @@ namespace eosio { namespace chain {
basic_block_log() = default;
explicit basic_block_log(bfs::path log_dir) { open(log_dir); }
explicit basic_block_log(std::filesystem::path log_dir) { open(log_dir); }
static void ensure_file_exists(fc::cfile& f) {
if (fc::exists(f.get_file_path()))
if (std::filesystem::exists(f.get_file_path()))
return;
f.open(fc::cfile::create_or_update_rw_mode);
f.close();
@@ -544,7 +547,7 @@ namespace eosio { namespace chain {
index_file.open(fc::cfile::update_rw_mode);
vacuum(first_block_num_from_pruned_log(), preamble.first_block_num);
} else {
fc::resize_file(index_file.get_file_path(), 0);
std::filesystem::resize_file(index_file.get_file_path(), 0);
}
preamble.ver = preamble.version();
}
@@ -621,10 +624,10 @@ namespace eosio { namespace chain {
FC_LOG_AND_RETHROW()
}
void open(const fc::path& data_dir) {
void open(const std::filesystem::path& data_dir) {
if (!fc::is_directory(data_dir))
fc::create_directories(data_dir);
if (!std::filesystem::is_directory(data_dir))
std::filesystem::create_directories(data_dir);
this->block_file.set_file_path(data_dir / "blocks.log");
this->index_file.set_file_path(data_dir / "blocks.index");
@@ -649,8 +652,8 @@ namespace eosio { namespace chain {
*/
ensure_file_exists(block_file);
ensure_file_exists(index_file);
auto log_size = fc::file_size(this->block_file.get_file_path());
auto index_size = fc::file_size(this->index_file.get_file_path());
auto log_size = std::filesystem::file_size(this->block_file.get_file_path());
auto index_size = std::filesystem::file_size(this->index_file.get_file_path());
if (log_size) {
block_log_data log_data(block_file.get_file_path());
@@ -689,7 +692,7 @@ namespace eosio { namespace chain {
} else if (index_size) {
ilog("Log file is empty while the index file is nonempty, discard the index file");
boost::filesystem::resize_file(index_file.get_file_path(), 0);
std::filesystem::resize_file(index_file.get_file_path(), 0);
}
if (!block_file.is_open())
@@ -793,8 +796,8 @@ namespace eosio { namespace chain {
// and it'll mess this all up. Be sure to still remove the 4 byte trailer though.
if (!head) {
block_file.flush();
fc::resize_file(block_file.get_file_path(),
fc::file_size(block_file.get_file_path()) - sizeof(uint32_t));
std::filesystem::resize_file(block_file.get_file_path(),
std::filesystem::file_size(block_file.get_file_path()) - sizeof(uint32_t));
return;
}
@@ -829,7 +832,7 @@ namespace eosio { namespace chain {
}
}
block_file.flush();
fc::resize_file(block_file.get_file_path(), block_file.tellp());
std::filesystem::resize_file(block_file.get_file_path(), block_file.tellp());
index_file.flush();
{
@@ -847,7 +850,7 @@ namespace eosio { namespace chain {
block_file.write((char*)&new_pos, sizeof(new_pos));
}
}
fc::resize_file(index_file.get_file_path(), num_blocks_in_log * sizeof(uint64_t));
std::filesystem::resize_file(index_file.get_file_path(), num_blocks_in_log * sizeof(uint64_t));
preamble.first_block_num = first_block_num;
}
@@ -894,9 +897,9 @@ namespace eosio { namespace chain {
return block_file.tellp();
}
static void write_incomplete_block_data(const fc::path& blocks_dir, fc::time_point now, uint32_t block_num,
static void write_incomplete_block_data(const std::filesystem::path& blocks_dir, fc::time_point now, uint32_t block_num,
fc::cfile& strm) {
auto tail_path = blocks_dir / std::string("blocks-bad-tail-").append(now).append(".log");
auto tail_path = blocks_dir / std::string("blocks-bad-tail-").append(now.to_iso_string()).append(".log");
fc::cfile tail;
tail.set_file_path(tail_path);
tail.open(fc::cfile::create_or_update_rw_mode);
@@ -932,7 +935,7 @@ namespace eosio { namespace chain {
write_incomplete_block_data(block_file.get_file_path().parent_path(), fc::time_point::now(),
expected_block_num + 1, ds);
boost::filesystem::resize_file(block_file.get_file_path(), trimmed_block_file_size);
std::filesystem::resize_file(block_file.get_file_path(), trimmed_block_file_size);
return true;
} catch (...) { return false; }
}
@@ -944,12 +947,12 @@ namespace eosio { namespace chain {
block_log_catalog catalog;
const size_t stride;
partitioned_block_log(const bfs::path& log_dir, const partitioned_blocklog_config& config) : stride(config.stride) {
partitioned_block_log(const std::filesystem::path& log_dir, const partitioned_blocklog_config& config) : stride(config.stride) {
catalog.open(log_dir, config.retained_dir, config.archive_dir, "blocks");
catalog.max_retained_files = config.max_retained_files;
open(log_dir);
const auto log_size = fc::file_size(block_file.get_file_path());
const auto log_size = std::filesystem::file_size(block_file.get_file_path());
if (log_size == 0 && !catalog.empty()) {
basic_block_log::reset(catalog.verifier.chain_id, catalog.last_block_num() + 1);
@@ -965,12 +968,12 @@ namespace eosio { namespace chain {
fc::datastream<fc::cfile> new_block_file;
fc::datastream<fc::cfile> new_index_file;
fc::path block_file_path = block_file.get_file_path();
fc::path index_file_path = index_file.get_file_path();
std::filesystem::path block_file_path = block_file.get_file_path();
std::filesystem::path index_file_path = index_file.get_file_path();
fc::path tmp_block_file_path = block_file_path;
std::filesystem::path tmp_block_file_path = block_file_path;
tmp_block_file_path.replace_extension("log.tmp");
fc::path tmp_index_file_path = index_file_path;
std::filesystem::path tmp_index_file_path = index_file_path;
tmp_index_file_path.replace_extension("index.tmp");
new_block_file.set_file_path(tmp_block_file_path);
@@ -996,8 +999,8 @@ namespace eosio { namespace chain {
swap(new_block_file, block_file);
swap(new_index_file, index_file);
fc::rename(tmp_block_file_path, block_file_path);
fc::rename(tmp_index_file_path, index_file_path);
std::filesystem::rename(tmp_block_file_path, block_file_path);
std::filesystem::rename(tmp_index_file_path, index_file_path);
block_file.set_file_path(block_file_path);
index_file.set_file_path(index_file_path);
@@ -1046,7 +1049,7 @@ namespace eosio { namespace chain {
uint32_t first_block_number = 0; // the first number available to read
prune_blocklog_config prune_config;
punch_hole_block_log(const fc::path& data_dir, const prune_blocklog_config& prune_conf)
punch_hole_block_log(const std::filesystem::path& data_dir, const prune_blocklog_config& prune_conf)
: prune_config(prune_conf) {
EOS_ASSERT(__builtin_popcount(prune_config.prune_threshold) == 1, block_log_exception,
"block log prune threshold must be power of 2");
@@ -1168,7 +1171,7 @@ namespace eosio { namespace chain {
} // namespace detail
block_log::block_log(const fc::path& data_dir, const block_log_config& config)
block_log::block_log(const std::filesystem::path& data_dir, const block_log_config& config)
: my(std::visit(overloaded{ [&data_dir](const basic_blocklog_config& conf) -> detail::block_log_impl* {
return new detail::basic_block_log(data_dir);
},
@@ -1263,17 +1266,17 @@ namespace eosio { namespace chain {
}
// static
void block_log::construct_index(const fc::path& block_file_name, const fc::path& index_file_name) {
void block_log::construct_index(const std::filesystem::path& block_file_name, const std::filesystem::path& index_file_name) {
ilog("Will read existing blocks.log file ${file}", ("file", block_file_name.generic_string()));
ilog("Will write new blocks.index file ${file}", ("file", index_file_name.generic_string()));
ilog("Will read existing blocks.log file ${file}", ("file", block_file_name));
ilog("Will write new blocks.index file ${file}", ("file", index_file_name));
block_log_data log_data(block_file_name);
log_data.construct_index(index_file_name);
}
std::tuple<uint64_t, uint32_t, std::string>
block_log_data::full_validate_blocks(uint32_t last_block_num, const fc::path& blocks_dir, fc::time_point now) {
block_log_data::full_validate_blocks(uint32_t last_block_num, const std::filesystem::path& blocks_dir, fc::time_point now) {
uint64_t pos = first_block_position();
uint32_t block_num = first_block_num() - 1;
std::string error_msg;
@@ -1306,32 +1309,32 @@ namespace eosio { namespace chain {
}
// static
fc::path block_log::repair_log(const fc::path& data_dir, uint32_t truncate_at_block,
std::filesystem::path block_log::repair_log(const std::filesystem::path& data_dir, uint32_t truncate_at_block,
const char* reversible_block_dir_name) {
ilog("Recovering Block Log...");
EOS_ASSERT(fc::is_directory(data_dir) && fc::is_regular_file(data_dir / "blocks.log"), block_log_not_found,
EOS_ASSERT(std::filesystem::is_directory(data_dir) && std::filesystem::is_regular_file(data_dir / "blocks.log"), block_log_not_found,
"Block log not found in '${blocks_dir}'", ("blocks_dir", data_dir));
if (truncate_at_block == 0)
truncate_at_block = UINT32_MAX;
auto now = fc::time_point::now();
auto blocks_dir = fc::canonical(
auto blocks_dir = std::filesystem::canonical(
data_dir); // canonical always returns an absolute path that has no symbolic link, dot, or dot-dot elements
auto blocks_dir_name = blocks_dir.filename();
auto backup_dir = blocks_dir.parent_path() / blocks_dir_name.generic_string().append("-").append(now);
auto backup_dir = blocks_dir.parent_path() / blocks_dir_name.generic_string().append("-").append(now.to_iso_string());
EOS_ASSERT(!fc::exists(backup_dir), block_log_backup_dir_exist,
EOS_ASSERT(!std::filesystem::exists(backup_dir), block_log_backup_dir_exist,
"Cannot move existing blocks directory to already existing directory '${new_blocks_dir}'",
("new_blocks_dir", backup_dir));
fc::create_directories(backup_dir);
fc::rename(blocks_dir / "blocks.log", backup_dir / "blocks.log");
if (fc::exists(blocks_dir / "blocks.index")) {
fc::rename(blocks_dir / "blocks.index", backup_dir / "blocks.index");
std::filesystem::create_directories(backup_dir);
std::filesystem::rename(blocks_dir / "blocks.log", backup_dir / "blocks.log");
if (std::filesystem::exists(blocks_dir / "blocks.index")) {
std::filesystem::rename(blocks_dir / "blocks.index", backup_dir / "blocks.index");
}
if (strlen(reversible_block_dir_name) && fc::is_directory(blocks_dir / reversible_block_dir_name)) {
fc::rename(blocks_dir / reversible_block_dir_name, backup_dir / reversible_block_dir_name);
if (strlen(reversible_block_dir_name) && std::filesystem::is_directory(blocks_dir / reversible_block_dir_name)) {
std::filesystem::rename(blocks_dir / reversible_block_dir_name, backup_dir / reversible_block_dir_name);
}
ilog("Moved existing blocks directory to backup location: '${new_blocks_dir}'", ("new_blocks_dir", backup_dir));
@@ -1370,16 +1373,61 @@ namespace eosio { namespace chain {
}
// static
std::optional<genesis_state> block_log::extract_genesis_state(const fc::path& block_dir) {
boost::filesystem::path p(block_dir / "blocks.log");
for_each_file_in_dir_matches(block_dir, R"(blocks-1-\d+\.log)",
[&p](boost::filesystem::path log_path) { p = std::move(log_path); });
return block_log_data(p).get_genesis_state();
std::optional<block_log::chain_context> block_log::extract_chain_context(const std::filesystem::path& block_dir,
const std::filesystem::path& retained_dir) {
std::filesystem::path first_block_file;
if (!retained_dir.empty() && std::filesystem::exists(retained_dir)) {
for_each_file_in_dir_matches(retained_dir, R"(blocks-1-\d+\.log)",
[&](std::filesystem::path log_path) {
first_block_file = std::move(log_path);
});
}
if (first_block_file.empty() && std::filesystem::exists(block_dir / "blocks.log")) {
first_block_file = block_dir / "blocks.log";
}
if (!first_block_file.empty()) {
return block_log_data(first_block_file).get_preamble().chain_context;
}
if (!retained_dir.empty() && std::filesystem::exists(retained_dir)) {
const std::regex my_filter(R"(blocks-\d+-\d+\.log)");
std::smatch what;
std::filesystem::directory_iterator end_itr; // Default ctor yields past-the-end
for (std::filesystem::directory_iterator p(retained_dir); p != end_itr; ++p) {
// Skip if not a file
if (!std::filesystem::is_regular_file(p->status()))
continue;
// skip if it does not match the pattern
std::string file = p->path().filename().string();
if (!std::regex_match(file, what, my_filter))
continue;
return block_log_data(p->path()).chain_id();
}
}
return {};
}
// static
chain_id_type block_log::extract_chain_id(const fc::path& data_dir) {
return block_log_data(data_dir / "blocks.log").chain_id();
std::optional<genesis_state> block_log::extract_genesis_state(const std::filesystem::path& block_dir,
const std::filesystem::path& retained_dir) {
auto context = extract_chain_context(block_dir, retained_dir);
if (!context || std::holds_alternative<chain_id_type>(*context))
return {};
return std::get<genesis_state>(*context);
}
// static
std::optional<chain_id_type> block_log::extract_chain_id(const std::filesystem::path& block_dir,
const std::filesystem::path& retained_dir) {
auto context = extract_chain_context(block_dir, retained_dir);
if (!context)
return {};
return std::visit(overloaded{
[](const chain_id_type& id){ return id; },
[](const genesis_state& gs){ return gs.compute_chain_id(); }
} , *context);
}
// static
@@ -1398,7 +1446,7 @@ namespace eosio { namespace chain {
}
// static
bool block_log::is_pruned_log(const fc::path& data_dir) {
bool block_log::is_pruned_log(const std::filesystem::path& data_dir) {
uint32_t version = 0;
try {
fc::cfile log_file;
@@ -1409,7 +1457,7 @@ namespace eosio { namespace chain {
return detail::is_pruned_log_and_mask_version(version);
}
void extract_blocklog_i(block_log_bundle& log_bundle, const fc::path& new_block_filename, const fc::path& new_index_filename,
void extract_blocklog_i(block_log_bundle& log_bundle, const std::filesystem::path& new_block_filename, const std::filesystem::path& new_index_filename,
uint32_t first_block_num, uint32_t num_blocks) {
auto position_for_block = [&log_bundle](uint64_t block_num) {
@@ -1458,12 +1506,12 @@ namespace eosio { namespace chain {
}
// static
bool block_log::trim_blocklog_front(const fc::path& block_dir, const fc::path& temp_dir,
bool block_log::trim_blocklog_front(const std::filesystem::path& block_dir, const std::filesystem::path& temp_dir,
uint32_t truncate_at_block) {
EOS_ASSERT(block_dir != temp_dir, block_log_exception, "block_dir and temp_dir need to be different directories");
ilog("In directory ${dir} will trim all blocks before block ${n} from blocks.log and blocks.index.",
("dir", block_dir.generic_string())("n", truncate_at_block));
("dir", block_dir)("n", truncate_at_block));
block_log_bundle log_bundle(block_dir);
@@ -1478,17 +1526,17 @@ namespace eosio { namespace chain {
}
// ****** create the new block log file and write out the header for the file
fc::create_directories(temp_dir);
fc::path new_block_filename = temp_dir / "blocks.log";
fc::path new_index_filename = temp_dir / "blocks.index";
std::filesystem::create_directories(temp_dir);
std::filesystem::path new_block_filename = temp_dir / "blocks.log";
std::filesystem::path new_index_filename = temp_dir / "blocks.index";
extract_blocklog_i(log_bundle, new_block_filename, new_index_filename, truncate_at_block,
log_bundle.log_data.last_block_num() - truncate_at_block + 1);
fc::path old_log = temp_dir / "old.log";
std::filesystem::path old_log = temp_dir / "old.log";
rename(log_bundle.block_file_name, old_log);
rename(new_block_filename, log_bundle.block_file_name);
fc::path old_ind = temp_dir / "old.index";
std::filesystem::path old_ind = temp_dir / "old.index";
rename(log_bundle.index_file_name, old_ind);
rename(new_index_filename, log_bundle.index_file_name);
@@ -1496,13 +1544,13 @@ namespace eosio { namespace chain {
}
// static
int block_log::trim_blocklog_end(const fc::path& block_dir, uint32_t n) { // n is last block to keep (remove later blocks)
int block_log::trim_blocklog_end(const std::filesystem::path& block_dir, uint32_t n) { // n is last block to keep (remove later blocks)
block_log_bundle log_bundle(block_dir);
ilog("In directory ${block_dir} will trim all blocks after block ${n} from ${block_file} and ${index_file}",
("block_dir", block_dir.generic_string())("n", n)("block_file", log_bundle.block_file_name.generic_string())(
"index_file", log_bundle.index_file_name.generic_string()));
("block_dir", block_dir)("n", n)("block_file", log_bundle.block_file_name)(
"index_file", log_bundle.index_file_name));
if (n < log_bundle.log_data.first_block_num()) {
dlog("All blocks are after block ${n} so do nothing (trim_end would delete entire blocks.log)", ("n", n));
@@ -1519,21 +1567,25 @@ namespace eosio { namespace chain {
const auto to_trim_block_position = log_bundle.log_index.nth_block_position(to_trim_block_index);
const auto index_file_size = to_trim_block_index * sizeof(uint64_t);
boost::filesystem::resize_file(log_bundle.block_file_name, to_trim_block_position);
boost::filesystem::resize_file(log_bundle.index_file_name, index_file_size);
std::filesystem::resize_file(log_bundle.block_file_name, to_trim_block_position);
std::filesystem::resize_file(log_bundle.index_file_name, index_file_size);
ilog("blocks.index has been trimmed to ${index_file_size} bytes", ("index_file_size", index_file_size));
return 0;
}
// static
void block_log::smoke_test(const fc::path& block_dir, uint32_t interval) {
void block_log::smoke_test(const std::filesystem::path& block_dir, uint32_t interval) {
block_log_bundle log_bundle(block_dir);
ilog("block log version= ${version}",("version", log_bundle.log_data.version()));
ilog("first block= ${first}",("first", log_bundle.log_data.first_block_num()));
ilog("last block= ${last}",("last", log_bundle.log_data.last_block_num()));
ilog("blocks.log and blocks.index agree on number of blocks");
if (interval == 0) {
interval = std::max((log_bundle.log_index.num_blocks() + 7u) >> 3, 1u);
interval = std::max((log_bundle.log_index.num_blocks() + 7) >> 3, 1U);
}
uint32_t expected_block_num = log_bundle.log_data.first_block_num();
@@ -1543,18 +1595,18 @@ namespace eosio { namespace chain {
}
}
std::pair<fc::path, fc::path> blocklog_files(const fc::path& dir, uint32_t start_block_num, uint32_t num_blocks) {
std::pair<std::filesystem::path, std::filesystem::path> blocklog_files(const std::filesystem::path& dir, uint32_t start_block_num, uint32_t num_blocks) {
const int bufsize = 64;
char buf[bufsize];
snprintf(buf, bufsize, "blocks-%u-%u.log", start_block_num, start_block_num + num_blocks - 1);
fc::path new_block_filename = dir / buf;
fc::path new_index_filename(new_block_filename);
std::filesystem::path new_block_filename = dir / buf;
std::filesystem::path new_index_filename(new_block_filename);
new_index_filename.replace_extension(".index");
return std::make_pair(new_block_filename, new_index_filename);
}
// static
void block_log::extract_block_range(const fc::path& block_dir, const fc::path& dest_dir,
void block_log::extract_block_range(const std::filesystem::path& block_dir, const std::filesystem::path& dest_dir,
block_num_type start_block_num, block_num_type last_block_num) {
@@ -1564,8 +1616,8 @@ namespace eosio { namespace chain {
"The first available block is block ${first_block}.",
("first_block", log_bundle.log_data.first_block_num()));
if (!fc::exists(dest_dir))
fc::create_directories(dest_dir);
if (!std::filesystem::exists(dest_dir))
std::filesystem::create_directories(dest_dir);
uint32_t num_blocks = last_block_num - start_block_num + 1;
@@ -1575,14 +1627,14 @@ namespace eosio { namespace chain {
}
// static
void block_log::split_blocklog(const fc::path& block_dir, const fc::path& dest_dir, uint32_t stride) {
void block_log::split_blocklog(const std::filesystem::path& block_dir, const std::filesystem::path& dest_dir, uint32_t stride) {
block_log_bundle log_bundle(block_dir);
const uint32_t first_block_num = log_bundle.log_data.first_block_num();
const uint32_t last_block_num = log_bundle.log_data.last_block_num();
if (!fc::exists(dest_dir))
fc::create_directories(dest_dir);
if (!std::filesystem::exists(dest_dir))
std::filesystem::create_directories(dest_dir);
for (uint32_t i = (first_block_num - 1) / stride; i < (last_block_num + stride - 1) / stride; ++i) {
uint32_t start_block_num = std::max(i * stride + 1, first_block_num);
@@ -1594,16 +1646,16 @@ namespace eosio { namespace chain {
}
}
inline bfs::path operator+(const bfs::path& left, const bfs::path& right) { return bfs::path(left) += right; }
inline std::filesystem::path operator+(const std::filesystem::path& left, const std::filesystem::path& right) { return std::filesystem::path(left) += right; }
void move_blocklog_files(const bfs::path& src_dir, const fc::path& dest_dir, uint32_t start_block,
void move_blocklog_files(const std::filesystem::path& src_dir, const std::filesystem::path& dest_dir, uint32_t start_block,
uint32_t end_block) {
auto [log_filename, index_filename] = blocklog_files(dest_dir, start_block, end_block - start_block + 1);
bfs::rename(src_dir / "blocks.log", log_filename);
bfs::rename(src_dir / "blocks.index", index_filename);
std::filesystem::rename(src_dir / "blocks.log", log_filename);
std::filesystem::rename(src_dir / "blocks.index", index_filename);
}
uint32_t get_blocklog_version(const bfs::path& blocklog_file) {
uint32_t get_blocklog_version(const std::filesystem::path& blocklog_file) {
uint32_t version;
fc::cfile f;
f.set_file_path(blocklog_file.generic_string());
@@ -1613,7 +1665,7 @@ namespace eosio { namespace chain {
}
// static
void block_log::merge_blocklogs(const fc::path& blocks_dir, const fc::path& dest_dir) {
void block_log::merge_blocklogs(const std::filesystem::path& blocks_dir, const std::filesystem::path& dest_dir) {
block_log_catalog catalog;
catalog.open("", blocks_dir, "", "blocks");
@@ -1622,20 +1674,20 @@ namespace eosio { namespace chain {
return;
}
if (!fc::exists(dest_dir))
fc::create_directories(dest_dir);
if (!std::filesystem::exists(dest_dir))
std::filesystem::create_directories(dest_dir);
fc::temp_directory temp_dir;
bfs::path temp_path = temp_dir.path();
uint32_t start_block = 0, end_block = 0;
fc::temp_directory temp_dir;
std::filesystem::path temp_path = temp_dir.path();
uint32_t start_block = 0, end_block = 0;
bfs::path temp_block_log = temp_path / "blocks.log";
bfs::path temp_block_index = temp_path / "blocks.index";
std::filesystem::path temp_block_log = temp_path / "blocks.log";
std::filesystem::path temp_block_index = temp_path / "blocks.index";
fc::datastream<fc::cfile> file;
file.set_file_path(temp_block_log);
for (auto const& [first_block_num, val] : catalog.collection) {
if (bfs::exists(temp_block_log)) {
if (std::filesystem::exists(temp_block_log)) {
if (first_block_num == end_block + 1) {
block_log_data log_data;
log_data.open(val.filename_base + ".log");
@@ -1654,13 +1706,13 @@ namespace eosio { namespace chain {
} else
wlog("${file}.log cannot be merged with previous block log file because of the discontinuity of blocks, "
"skip merging.",
("file", val.filename_base.generic_string()));
("file", val.filename_base));
// there is a version or block number gap between the stride files
move_blocklog_files(temp_path, dest_dir, start_block, end_block);
}
bfs::copy(val.filename_base + ".log", temp_block_log);
bfs::copy(val.filename_base + ".index", temp_block_index);
std::filesystem::copy(val.filename_base + ".log", temp_block_log);
std::filesystem::copy(val.filename_base + ".index", temp_block_index);
start_block = first_block_num;
end_block = val.last_block_num;
}
@@ -1668,7 +1720,7 @@ namespace eosio { namespace chain {
if (file.is_open())
file.close();
if (bfs::exists(temp_block_log)) {
if (std::filesystem::exists(temp_block_log)) {
move_blocklog_files(temp_path, dest_dir, start_block, end_block);
}
}
+93 -35
View File
@@ -21,6 +21,7 @@
#include <eosio/chain/protocol_feature_manager.hpp>
#include <eosio/chain/authorization_manager.hpp>
#include <eosio/chain/resource_limits.hpp>
#include <eosio/chain/subjective_billing.hpp>
#include <eosio/chain/chain_snapshot.hpp>
#include <eosio/chain/thread_utils.hpp>
#include <eosio/chain/platform_timer.hpp>
@@ -69,7 +70,7 @@ class maybe_session {
maybe_session() = default;
maybe_session( maybe_session&& other)
:_session(move(other._session))
:_session(std::move(other._session))
{
}
@@ -96,7 +97,7 @@ class maybe_session {
maybe_session& operator = ( maybe_session&& mv ) {
if (mv._session) {
_session.emplace(move(*mv._session));
_session.emplace(std::move(*mv._session));
mv._session.reset();
} else {
_session.reset();
@@ -150,7 +151,7 @@ struct pending_state {
block_timestamp_type when,
uint16_t num_prev_blocks_to_confirm,
const vector<digest_type>& new_protocol_feature_activations )
:_db_session( move(s) )
:_db_session( std::move(s) )
,_block_stage( building_block( prev, when, num_prev_blocks_to_confirm, new_protocol_feature_activations ) )
{}
@@ -210,6 +211,12 @@ struct pending_state {
};
struct controller_impl {
enum class app_window_type {
write, // Only main thread is running; read-only threads are not running.
// All read-write and read-only tasks are sequentially executed.
read // Main thread and read-only threads are running read-ony tasks in parallel.
// Read-write tasks are not being executed.
};
// LLVM sets the new handler, we need to reset this to throw a bad_alloc exception so we can possibly exit cleanly
// and not just abort.
@@ -226,6 +233,7 @@ struct controller_impl {
block_state_ptr head;
fork_database fork_db;
resource_limits_manager resource_limits;
subjective_billing subjective_bill;
authorization_manager authorization;
protocol_feature_manager protocol_features;
controller::config conf;
@@ -246,11 +254,10 @@ struct controller_impl {
#if defined(EOSIO_EOS_VM_RUNTIME_ENABLED) || defined(EOSIO_EOS_VM_JIT_RUNTIME_ENABLED)
thread_local static vm::wasm_allocator wasm_alloc; // a copy for main thread and each read-only thread
#endif
// Ideally wasmif should be thread_local which must be a static.
// Unittests can create multiple controller objects (testers) at the same time,
// which overwrites the same static wasmif, is used for eosvmoc too.
wasm_interface wasmif; // used by main thread and all threads for EOSVMOC
thread_local static std::unique_ptr<wasm_interface> wasmif_thread_local; // a copy for each read-only thread, used by eos-vm and eos-vm-jit
std::mutex threaded_wasmifs_mtx;
std::unordered_map<std::thread::id, std::unique_ptr<wasm_interface>> threaded_wasmifs; // one for each read-only thread, used by eos-vm and eos-vm-jit
app_window_type app_window = app_window_type::write;
typedef pair<scope_name,action_name> handler_key;
map< account_name, map<handler_key, apply_handler> > apply_handlers;
@@ -265,9 +272,7 @@ struct controller_impl {
prev = fork_db.root();
}
if ( read_mode == db_read_mode::HEAD ) {
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot");
}
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot");
head = prev;
@@ -337,7 +342,12 @@ struct controller_impl {
set_activation_handler<builtin_protocol_feature_t::crypto_primitives>();
self.irreversible_block.connect([this](const block_state_ptr& bsp) {
get_wasm_interface().current_lib(bsp->block_num);
// producer_plugin has already asserted irreversible_block signal is
// called in write window
wasmif.current_lib(bsp->block_num);
for (auto& w: threaded_wasmifs) {
w.second->current_lib(bsp->block_num);
}
});
@@ -392,11 +402,13 @@ struct controller_impl {
}
}
void dmlog_applied_transaction(const transaction_trace_ptr& t) {
void dmlog_applied_transaction(const transaction_trace_ptr& t, const signed_transaction* trx = nullptr) {
// dmlog_applied_transaction is called by push_scheduled_transaction
// where transient transactions are not possible, and by push_transaction
// only when the transaction is not transient
if (auto dm_logger = get_deep_mind_logger(false)) {
if (trx && is_onblock(*t))
dm_logger->on_onblock(*trx);
dm_logger->on_applied_transaction(self.head_block_num() + 1, t);
}
}
@@ -415,7 +427,8 @@ struct controller_impl {
EOS_ASSERT( root_id == log_head_id, fork_database_exception, "fork database root does not match block log head" );
} else {
EOS_ASSERT( fork_db.root()->block_num == lib_num, fork_database_exception,
"empty block log expects the first appended block to build off a block that is not the fork database root. root block number: ${block_num}, lib: ${lib_num}", ("block_num", fork_db.root()->block_num) ("lib_num", lib_num) );
"The first block ${lib_num} when starting with an empty block log should be the block after fork database root ${bn}.",
("lib_num", lib_num)("bn", fork_db.root()->block_num) );
}
const auto fork_head = fork_db_head();
@@ -497,9 +510,10 @@ struct controller_impl {
void replay(std::function<bool()> check_shutdown) {
auto blog_head = blog.head();
if( !blog_head && !fork_db.root() ) {
if( !fork_db.root() ) {
fork_db.reset( *head );
return;
if (!blog_head)
return;
}
replaying = true;
@@ -1159,7 +1173,7 @@ struct controller_impl {
etrx.ref_block_num = 0;
etrx.ref_block_prefix = 0;
} else {
etrx.expiration = self.pending_block_time() + fc::microseconds(999'999); // Round up to nearest second to avoid appearing expired
etrx.expiration = time_point_sec{self.pending_block_time() + fc::microseconds(999'999)}; // Round up to nearest second to avoid appearing expired
etrx.set_reference_block( self.head_block_id() );
}
@@ -1616,7 +1630,7 @@ struct controller_impl {
emit(self.accepted_transaction, trx);
}
dmlog_applied_transaction(trace);
dmlog_applied_transaction(trace, &trn);
emit(self.applied_transaction, std::tie(trace, trx->packed_trx()));
}
}
@@ -1624,7 +1638,7 @@ struct controller_impl {
if ( trx->is_transient() ) {
// remove trx from pending block by not canceling 'restore'
trx_context.undo(); // this will happen automatically in destructor, but make it more explicit
} else if ( pending->_block_status == controller::block_status::ephemeral ) {
} else if ( read_mode != db_read_mode::SPECULATIVE && pending->_block_status == controller::block_status::ephemeral ) {
// An ephemeral block will never become a full block, but on a producer node the trxs should be saved
// in the un-applied transaction queue for execution during block production. For a non-producer node
// save the trxs in the un-applied transaction queue for use during block validation to skip signature
@@ -2420,7 +2434,7 @@ struct controller_impl {
for( const auto& a : trxs )
trx_digests.emplace_back( a.digest() );
return merkle( move(trx_digests) );
return merkle( std::move(trx_digests) );
}
void update_producers_authority() {
@@ -2475,7 +2489,7 @@ struct controller_impl {
auto now = self.is_building_block() ? self.pending_block_time() : self.head_block_time();
const auto total = dedupe_index.size();
uint32_t num_removed = 0;
while( (!dedupe_index.empty()) && ( now > fc::time_point(dedupe_index.begin()->expiration) ) ) {
while( (!dedupe_index.empty()) && ( now > dedupe_index.begin()->expiration.to_time_point() ) ) {
transaction_idx.remove(*dedupe_index.begin());
++num_removed;
if( deadline <= fc::time_point::now() ) {
@@ -2650,15 +2664,10 @@ struct controller_impl {
trx.ref_block_num = 0;
trx.ref_block_prefix = 0;
} else {
trx.expiration = self.pending_block_time() + fc::microseconds(999'999); // Round up to nearest second to avoid appearing expired
trx.expiration = time_point_sec{self.pending_block_time() + fc::microseconds(999'999)}; // Round up to nearest second to avoid appearing expired
trx.set_reference_block( self.head_block_id() );
}
// onblock transaction cannot be transient
if (auto dm_logger = get_deep_mind_logger(false)) {
dm_logger->on_onblock(trx);
}
return trx;
}
@@ -2680,28 +2689,51 @@ struct controller_impl {
// only called from non-main threads (read-only trx execution threads)
// when producer_plugin starts them
void init_thread_local_data() {
EOS_ASSERT( !is_main_thread(), misc_exception, "init_thread_local_data called on the main thread");
EOS_ASSERT( !is_on_main_thread(), misc_exception, "init_thread_local_data called on the main thread");
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
if ( is_eos_vm_oc_enabled() )
// EOSVMOC needs further initialization of its thread local data
wasmif.init_thread_local_data();
else
#endif
{
std::lock_guard g(threaded_wasmifs_mtx);
// Non-EOSVMOC needs a wasmif per thread
wasmif_thread_local = std::make_unique<wasm_interface>( conf.wasm_runtime, conf.eosvmoc_tierup, db, conf.state_dir, conf.eosvmoc_config, !conf.profile_accounts.empty());
threaded_wasmifs[std::this_thread::get_id()] = std::make_unique<wasm_interface>( conf.wasm_runtime, conf.eosvmoc_tierup, db, conf.state_dir, conf.eosvmoc_config, !conf.profile_accounts.empty());
}
}
bool is_main_thread() { return main_thread_id == std::this_thread::get_id(); };
bool is_on_main_thread() { return main_thread_id == std::this_thread::get_id(); };
void set_to_write_window() {
app_window = app_window_type::write;
}
void set_to_read_window() {
app_window = app_window_type::read;
}
bool is_write_window() const {
return app_window == app_window_type::write;
}
wasm_interface& get_wasm_interface() {
if ( is_main_thread()
if ( is_on_main_thread()
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
|| is_eos_vm_oc_enabled()
#endif
)
return wasmif;
else
return *wasmif_thread_local;
return *threaded_wasmifs[std::this_thread::get_id()];
}
void code_block_num_last_used(const digest_type& code_hash, uint8_t vm_type, uint8_t vm_version, uint32_t block_num) {
// The caller of this function apply_eosio_setcode has already asserted that
// the transaction is not a read-only trx, which implies we are
// in write window. Safe to call threaded_wasmifs's code_block_num_last_used
wasmif.code_block_num_last_used(code_hash, vm_type, vm_version, block_num);
for (auto& w: threaded_wasmifs) {
w.second->code_block_num_last_used(code_hash, vm_type, vm_version, block_num);
}
}
block_state_ptr fork_db_head() const;
@@ -2711,7 +2743,6 @@ thread_local platform_timer controller_impl::timer;
#if defined(EOSIO_EOS_VM_RUNTIME_ENABLED) || defined(EOSIO_EOS_VM_JIT_RUNTIME_ENABLED)
thread_local eosio::vm::wasm_allocator controller_impl::wasm_alloc;
#endif
thread_local std::unique_ptr<wasm_interface> controller_impl::wasmif_thread_local;
const resource_limits_manager& controller::get_resource_limits_manager()const
{
@@ -2736,6 +2767,15 @@ const protocol_feature_manager& controller::get_protocol_feature_manager()const
return my->protocol_features;
}
const subjective_billing& controller::get_subjective_billing()const {
return my->subjective_bill;
}
subjective_billing& controller::get_mutable_subjective_billing() {
return my->subjective_bill;
}
uint32_t controller::get_max_nonprivileged_inline_action_size()const
{
return my->conf.max_nonprivileged_inline_action_size;
@@ -3084,7 +3124,7 @@ block_id_type controller::fork_db_head_block_id()const {
return my->fork_db_head()->id;
}
time_point controller::pending_block_time()const {
block_timestamp_type controller::pending_block_timestamp()const {
EOS_ASSERT( my->pending, block_validate_exception, "no pending block" );
if( std::holds_alternative<completed_block>(my->pending->_block_stage) )
@@ -3093,6 +3133,10 @@ time_point controller::pending_block_time()const {
return my->pending->get_pending_block_header_state().timestamp;
}
time_point controller::pending_block_time()const {
return pending_block_timestamp();
}
uint32_t controller::pending_block_num()const {
EOS_ASSERT( my->pending, block_validate_exception, "no pending block" );
@@ -3436,12 +3480,12 @@ uint32_t controller::configured_subjective_signature_length_limit()const {
void controller::validate_expiration( const transaction& trx )const { try {
const auto& chain_configuration = get_global_properties().configuration;
EOS_ASSERT( time_point(trx.expiration) >= pending_block_time(),
EOS_ASSERT( trx.expiration.to_time_point() >= pending_block_time(),
expired_tx_exception,
"transaction has expired, "
"expiration is ${trx.expiration} and pending block time is ${pending_block_time}",
("trx.expiration",trx.expiration)("pending_block_time",pending_block_time()));
EOS_ASSERT( time_point(trx.expiration) <= pending_block_time() + fc::seconds(chain_configuration.max_transaction_lifetime),
EOS_ASSERT( trx.expiration.to_time_point() <= pending_block_time() + fc::seconds(chain_configuration.max_transaction_lifetime),
tx_exp_too_far_exception,
"Transaction expiration is too far in the future relative to the reference time of ${reference_time}, "
"expiration is ${trx.expiration} and the maximum transaction lifetime is ${max_til_exp} seconds",
@@ -3686,6 +3730,20 @@ void controller::init_thread_local_data() {
my->init_thread_local_data();
}
void controller::set_to_write_window() {
my->set_to_write_window();
}
void controller::set_to_read_window() {
my->set_to_read_window();
}
bool controller::is_write_window() const {
return my->is_write_window();
}
void controller::code_block_num_last_used(const digest_type& code_hash, uint8_t vm_type, uint8_t vm_version, uint32_t block_num) {
return my->code_block_num_last_used(code_hash, vm_type, vm_version, block_num);
}
/// Protocol feature activation handlers:
template<>
+1 -1
View File
@@ -160,7 +160,7 @@ void apply_eosio_setcode(apply_context& context) {
old_size = (int64_t)old_code_entry.code.size() * config::setcode_ram_bytes_multiplier;
if( old_code_entry.code_ref_count == 1 ) {
db.remove(old_code_entry);
context.control.get_wasm_interface().code_block_num_last_used(account.code_hash, account.vm_type, account.vm_version, context.control.head_block_num() + 1);
context.control.code_block_num_last_used(account.code_hash, account.vm_type, account.vm_version, context.control.head_block_num() + 1);
} else {
db.modify(old_code_entry, [](code_object& o) {
--o.code_ref_count;
+14 -14
View File
@@ -61,7 +61,7 @@ namespace eosio { namespace chain {
}
struct fork_database_impl {
explicit fork_database_impl( const fc::path& data_dir )
explicit fork_database_impl( const std::filesystem::path& data_dir )
:datadir(data_dir)
{}
@@ -69,7 +69,7 @@ namespace eosio { namespace chain {
fork_multi_index_type index;
block_state_ptr root; // Only uses the block_header_state portion
block_state_ptr head;
fc::path datadir;
std::filesystem::path datadir;
void open_impl( const std::function<void( block_timestamp_type,
const flat_set<digest_type>&,
@@ -97,7 +97,7 @@ namespace eosio { namespace chain {
};
fork_database::fork_database( const fc::path& data_dir )
fork_database::fork_database( const std::filesystem::path& data_dir )
:my( new fork_database_impl( data_dir ) )
{}
@@ -114,11 +114,11 @@ namespace eosio { namespace chain {
const flat_set<digest_type>&,
const vector<digest_type>& )>& validator )
{
if (!fc::is_directory(datadir))
fc::create_directories(datadir);
if (!std::filesystem::is_directory(datadir))
std::filesystem::create_directories(datadir);
auto fork_db_dat = datadir / config::forkdb_filename;
if( fc::exists( fork_db_dat ) ) {
if( std::filesystem::exists( fork_db_dat ) ) {
try {
string content;
fc::read_file_contents( fork_db_dat, content );
@@ -130,7 +130,7 @@ namespace eosio { namespace chain {
fc::raw::unpack( ds, totem );
EOS_ASSERT( totem == fork_database::magic_number, fork_database_exception,
"Fork database file '${filename}' has unexpected magic number: ${actual_totem}. Expected ${expected_totem}",
("filename", fork_db_dat.generic_string())
("filename", fork_db_dat)
("actual_totem", totem)
("expected_totem", fork_database::magic_number)
);
@@ -142,7 +142,7 @@ namespace eosio { namespace chain {
fork_database_exception,
"Unsupported version of fork database file '${filename}'. "
"Fork database version is ${version} while code supports version(s) [${min},${max}]",
("filename", fork_db_dat.generic_string())
("filename", fork_db_dat)
("version", version)
("min", fork_database::min_supported_version)
("max", fork_database::max_supported_version)
@@ -169,22 +169,22 @@ namespace eosio { namespace chain {
head = get_block_impl( head_id );
EOS_ASSERT( head, fork_database_exception,
"could not find head while reconstructing fork database from file; '${filename}' is likely corrupted",
("filename", fork_db_dat.generic_string()) );
("filename", fork_db_dat) );
}
auto candidate = index.get<by_lib_block_num>().begin();
if( candidate == index.get<by_lib_block_num>().end() || !(*candidate)->is_valid() ) {
EOS_ASSERT( head->id == root->id, fork_database_exception,
"head not set to root despite no better option available; '${filename}' is likely corrupted",
("filename", fork_db_dat.generic_string()) );
("filename", fork_db_dat) );
} else {
EOS_ASSERT( !first_preferred( **candidate, *head ), fork_database_exception,
"head not set to best available option available; '${filename}' is likely corrupted",
("filename", fork_db_dat.generic_string()) );
("filename", fork_db_dat) );
}
} FC_CAPTURE_AND_RETHROW( (fork_db_dat) )
fc::remove( fork_db_dat );
std::filesystem::remove( fork_db_dat );
}
}
@@ -199,7 +199,7 @@ namespace eosio { namespace chain {
if( !root ) {
if( index.size() > 0 ) {
elog( "fork_database is in a bad state when closing; not writing out '${filename}'",
("filename", fork_db_dat.generic_string()) );
("filename", fork_db_dat) );
}
return;
}
@@ -250,7 +250,7 @@ namespace eosio { namespace chain {
fc::raw::pack( out, head->id );
} else {
elog( "head not set in fork database; '${filename}' will be corrupted",
("filename", fork_db_dat.generic_string()) );
("filename", fork_db_dat) );
}
index.clear();
@@ -6,8 +6,9 @@
#include <utility>
#include <fc/variant_object.hpp>
#include <fc/scoped_exit.hpp>
#include <fc/time.hpp>
namespace eosio { namespace chain {
namespace eosio::chain {
using std::map;
using std::string;
@@ -23,6 +24,7 @@ namespace impl {
struct abi_traverse_context_with_path;
struct binary_to_variant_context;
struct variant_to_binary_context;
struct action_data_to_variant_context;
}
/**
@@ -48,7 +50,6 @@ struct abi_serializer {
bool is_szarray(const std::string_view& type)const;
bool is_optional(const std::string_view& type)const;
bool is_type( const std::string_view& type, const yield_function_t& yield )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
bool is_type(const std::string_view& type, const fc::microseconds& max_serialization_time)const;
bool is_builtin_type(const std::string_view& type)const;
bool is_integer(const std::string_view& type) const;
@@ -67,33 +68,29 @@ struct abi_serializer {
std::optional<string> get_error_message( uint64_t error_code )const;
fc::variant binary_to_variant( const std::string_view& type, const bytes& binary, const yield_function_t& yield, bool short_path = false )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
fc::variant binary_to_variant( const std::string_view& type, const bytes& binary, const fc::microseconds& max_serialization_time, bool short_path = false )const;
fc::variant binary_to_variant( const std::string_view& type, const bytes& binary, const fc::microseconds& max_action_data_serialization_time, bool short_path = false )const;
fc::variant binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const yield_function_t& yield, bool short_path = false )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
fc::variant binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const fc::microseconds& max_serialization_time, bool short_path = false )const;
fc::variant binary_to_variant( const std::string_view& type, fc::datastream<const char*>& binary, const fc::microseconds& max_action_data_serialization_time, bool short_path = false )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
bytes variant_to_binary( const std::string_view& type, const fc::variant& var, const fc::microseconds& max_serialization_time, bool short_path = false )const;
bytes variant_to_binary( const std::string_view& type, const fc::variant& var, const fc::microseconds& max_action_data_serialization_time, bool short_path = false )const;
bytes variant_to_binary( const std::string_view& type, const fc::variant& var, const yield_function_t& yield, bool short_path = false )const;
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
void variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const fc::microseconds& max_serialization_time, bool short_path = false )const;
void variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const fc::microseconds& max_action_data_serialization_time, bool short_path = false )const;
void variant_to_binary( const std::string_view& type, const fc::variant& var, fc::datastream<char*>& ds, const yield_function_t& yield, bool short_path = false )const;
template<typename T, typename Resolver>
static void to_variant( const T& o, fc::variant& vo, Resolver resolver, const yield_function_t& yield );
static void to_variant( const T& o, fc::variant& vo, const Resolver& resolver, const yield_function_t& yield );
template<typename T, typename Resolver>
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
static void to_variant( const T& o, fc::variant& vo, Resolver resolver, const fc::microseconds& max_serialization_time );
static void to_variant( const T& o, fc::variant& vo, const Resolver& resolver, const fc::microseconds& max_action_data_serialization_time );
template<typename T, typename Resolver>
static void to_log_variant( const T& o, fc::variant& vo, Resolver resolver, const yield_function_t& yield );
static void to_log_variant( const T& o, fc::variant& vo, const Resolver& resolver, const yield_function_t& yield );
template<typename T, typename Resolver>
static void to_log_variant( const T& o, fc::variant& vo, const Resolver& resolver, const fc::microseconds& max_action_data_serialization_time );
template<typename T, typename Resolver>
static void from_variant( const fc::variant& v, T& o, Resolver resolver, const yield_function_t& yield );
static void from_variant( const fc::variant& v, T& o, const Resolver& resolver, const yield_function_t& yield );
template<typename T, typename Resolver>
[[deprecated("use the overload with yield_function_t[=create_yield_function(max_serialization_time)]")]]
static void from_variant( const fc::variant& v, T& o, Resolver resolver, const fc::microseconds& max_serialization_time );
static void from_variant( const fc::variant& v, T& o, const Resolver& resolver, const fc::microseconds& max_action_data_serialization_time );
template<typename Vec>
static bool is_empty_abi(const Vec& abi_vec)
@@ -120,14 +117,10 @@ struct abi_serializer {
static constexpr size_t max_recursion_depth = 32; // arbitrary depth to prevent infinite recursion
// create standard yield function that checks for max_serialization_time and max_recursion_depth.
// now() deadline caputered at time of this call
// restricts serialization time from creation of yield function until serialization is complete.
// now() deadline captured at time of this call
static yield_function_t create_yield_function(const fc::microseconds& max_serialization_time) {
fc::time_point deadline = fc::time_point::now();
if( max_serialization_time > fc::microseconds::maximum() - deadline.time_since_epoch() ) {
deadline = fc::time_point::maximum();
} else {
deadline += max_serialization_time;
}
fc::time_point deadline = fc::time_point::now().safe_add(max_serialization_time);
return [max_serialization_time, deadline](size_t recursion_depth) {
EOS_ASSERT( recursion_depth < max_recursion_depth, abi_recursion_depth_exception,
"recursive definition, max_recursion_depth ${r} ", ("r", max_recursion_depth) );
@@ -137,6 +130,13 @@ struct abi_serializer {
};
}
static yield_function_t create_depth_yield_function() {
return [](size_t recursion_depth) {
EOS_ASSERT( recursion_depth < max_recursion_depth, abi_recursion_depth_exception,
"recursive definition, max_recursion_depth ${r} ", ("r", max_recursion_depth) );
};
}
private:
map<type_name, type_name, std::less<>> typedefs;
@@ -172,8 +172,9 @@ private:
namespace impl {
const static size_t hex_log_max_size = 64;
struct abi_traverse_context {
explicit abi_traverse_context( abi_serializer::yield_function_t yield )
abi_traverse_context( abi_serializer::yield_function_t yield, fc::microseconds max_action_data_serialization )
: yield(std::move( yield ))
, max_action_serialization_time(max_action_data_serialization)
{
}
@@ -187,7 +188,9 @@ namespace impl {
protected:
abi_serializer::yield_function_t yield;
size_t recursion_depth = 0;
// if set then restricts each individual action data serialization
fc::microseconds max_action_serialization_time;
size_t recursion_depth = 1;
bool log = false;
};
@@ -226,8 +229,8 @@ namespace impl {
using path_item = std::variant<empty_path_item, array_index_path_item, field_path_item, variant_path_item>;
struct abi_traverse_context_with_path : public abi_traverse_context {
abi_traverse_context_with_path( const abi_serializer& abis, abi_serializer::yield_function_t yield, const std::string_view& type )
: abi_traverse_context( std::move( yield ) ), abis(abis)
abi_traverse_context_with_path( const abi_serializer& abis, abi_serializer::yield_function_t yield, fc::microseconds max_action_data_serialization_time, const std::string_view& type )
: abi_traverse_context( std::move( yield ), max_action_data_serialization_time ), abis(abis)
{
set_path_root(type);
}
@@ -263,6 +266,22 @@ namespace impl {
using abi_traverse_context_with_path::abi_traverse_context_with_path;
};
struct action_data_to_variant_context : public binary_to_variant_context {
action_data_to_variant_context( const abi_serializer& abis, const abi_traverse_context& ctx, const std::string_view& type )
: binary_to_variant_context(abis, ctx, type)
{
short_path = true; // Just to be safe while avoiding the complexity of threading an override boolean all over the place
if (max_action_serialization_time.count() > 0) {
fc::time_point deadline = fc::time_point::now().safe_add(max_action_serialization_time);
yield = [deadline, y=yield, max=max_action_serialization_time](size_t depth) {
y(depth); // call provided yield that might include an overall time limit or not
EOS_ASSERT( fc::time_point::now() < deadline, abi_serialization_deadline_exception,
"serialization action data time limit ${t}us exceeded", ("t", max) );
};
}
}
};
struct variant_to_binary_context : public abi_traverse_context_with_path {
using abi_traverse_context_with_path::abi_traverse_context_with_path;
@@ -335,7 +354,7 @@ namespace impl {
* and can be degraded to the normal ::to_variant(...) processing
*/
template<typename M, typename Resolver, not_require_abi_t<M> = 1>
static void add( mutable_variant_object &mvo, const char* name, const M& v, Resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &mvo, const char* name, const M& v, const Resolver&, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
mvo(name,v);
@@ -346,14 +365,14 @@ namespace impl {
* for these types we create new ABI aware visitors
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void add( mutable_variant_object &mvo, const char* name, const M& v, Resolver resolver, abi_traverse_context& ctx );
static void add( mutable_variant_object &mvo, const char* name, const M& v, const Resolver& resolver, abi_traverse_context& ctx );
/**
* template which overloads add for vectors of types which contain ABI information in their trees
* for these members we call ::add in order to trigger further processing
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void add( mutable_variant_object &mvo, const char* name, const vector<M>& v, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &mvo, const char* name, const vector<M>& v, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
vector<fc::variant> array;
@@ -372,7 +391,7 @@ namespace impl {
* for these members we call ::add in order to trigger further processing
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void add( mutable_variant_object &mvo, const char* name, const deque<M>& v, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &mvo, const char* name, const deque<M>& v, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
deque<fc::variant> array;
@@ -389,7 +408,7 @@ namespace impl {
* for these members we call ::add in order to trigger further processing
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void add( mutable_variant_object &mvo, const char* name, const std::shared_ptr<M>& v, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &mvo, const char* name, const std::shared_ptr<M>& v, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
if( !v ) return;
@@ -402,10 +421,10 @@ namespace impl {
struct add_static_variant
{
mutable_variant_object& obj_mvo;
Resolver& resolver;
const Resolver& resolver;
abi_traverse_context& ctx;
add_static_variant( mutable_variant_object& o, Resolver& r, abi_traverse_context& ctx )
add_static_variant( mutable_variant_object& o, const Resolver& r, abi_traverse_context& ctx )
:obj_mvo(o), resolver(r), ctx(ctx) {}
typedef void result_type;
@@ -416,7 +435,7 @@ namespace impl {
};
template<typename Resolver, typename... Args>
static void add( mutable_variant_object &mvo, const char* name, const std::variant<Args...>& v, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &mvo, const char* name, const std::variant<Args...>& v, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
mutable_variant_object obj_mvo;
@@ -426,7 +445,7 @@ namespace impl {
}
template<typename Resolver>
static bool add_special_logging( mutable_variant_object& mvo, const char* name, const action& act, Resolver& resolver, abi_traverse_context& ctx ) {
static bool add_special_logging( mutable_variant_object& mvo, const char* name, const action& act, const Resolver& resolver, abi_traverse_context& ctx ) {
if( !ctx.is_logging() ) return false;
try {
@@ -455,7 +474,7 @@ namespace impl {
* @return
*/
template<typename Resolver>
static void add( mutable_variant_object &out, const char* name, const action& act, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &out, const char* name, const action& act, const Resolver& resolver, abi_traverse_context& ctx )
{
static_assert(fc::reflector<action>::total_member_count == 4);
auto h = ctx.enter_scope();
@@ -485,16 +504,16 @@ namespace impl {
};
try {
auto abi = resolver(act.account);
if (abi) {
auto type = abi->get_action_type(act.name);
auto abi_optional = resolver(act.account);
if (abi_optional) {
const abi_serializer& abi = *abi_optional;
auto type = abi.get_action_type(act.name);
if (!type.empty()) {
try {
binary_to_variant_context _ctx(*abi, ctx, type);
_ctx.short_path = true; // Just to be safe while avoiding the complexity of threading an override boolean all over the place
mvo( "data", abi->_binary_to_variant( type, act.data, _ctx ));
action_data_to_variant_context _ctx(abi, ctx, type);
mvo( "data", abi._binary_to_variant( type, act.data, _ctx ));
} catch(...) {
// any failure to serialize data, then leave as not serailzed
// any failure to serialize data, then leave as not serialized
set_hex_data(mvo, "data", act.data);
}
} else {
@@ -520,7 +539,7 @@ namespace impl {
* @return
*/
template<typename Resolver>
static void add( mutable_variant_object& out, const char* name, const action_trace& act_trace, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object& out, const char* name, const action_trace& act_trace, const Resolver& resolver, abi_traverse_context& ctx )
{
static_assert(fc::reflector<action_trace>::total_member_count == 17);
auto h = ctx.enter_scope();
@@ -546,13 +565,13 @@ namespace impl {
mvo("return_value_hex_data", act_trace.return_value);
auto act = act_trace.act;
try {
auto abi = resolver(act.account);
if (abi) {
auto type = abi->get_action_result_type(act.name);
auto abi_optional = resolver(act.account);
if (abi_optional) {
const abi_serializer& abi = *abi_optional;
auto type = abi.get_action_result_type(act.name);
if (!type.empty()) {
binary_to_variant_context _ctx(*abi, ctx, type);
_ctx.short_path = true; // Just to be safe while avoiding the complexity of threading an override boolean all over the place
mvo( "return_value_data", abi->_binary_to_variant( type, act_trace.return_value, _ctx ));
action_data_to_variant_context _ctx(abi, ctx, type);
mvo( "return_value_data", abi._binary_to_variant( type, act_trace.return_value, _ctx ));
}
}
} catch(...) {}
@@ -569,7 +588,7 @@ namespace impl {
* @return
*/
template<typename Resolver>
static void add( mutable_variant_object &out, const char* name, const packed_transaction& ptrx, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &out, const char* name, const packed_transaction& ptrx, const Resolver& resolver, abi_traverse_context& ctx )
{
static_assert(fc::reflector<packed_transaction>::total_member_count == 4);
auto h = ctx.enter_scope();
@@ -593,7 +612,7 @@ namespace impl {
* This matches the FC_REFLECT for this type, but this is provided to allow extracting the contents of trx.transaction_extensions
*/
template<typename Resolver>
static void add( mutable_variant_object &out, const char* name, const transaction& trx, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &out, const char* name, const transaction& trx, const Resolver& resolver, abi_traverse_context& ctx )
{
static_assert(fc::reflector<transaction>::total_member_count == 9);
auto h = ctx.enter_scope();
@@ -624,7 +643,7 @@ namespace impl {
* block.header_extensions and block.block_extensions
*/
template<typename Resolver>
static void add( mutable_variant_object &out, const char* name, const signed_block& block, Resolver resolver, abi_traverse_context& ctx )
static void add( mutable_variant_object &out, const char* name, const signed_block& block, const Resolver& resolver, abi_traverse_context& ctx )
{
static_assert(fc::reflector<signed_block>::total_member_count == 12);
auto h = ctx.enter_scope();
@@ -648,7 +667,7 @@ namespace impl {
for (auto feature : new_protocol_features) {
mutable_variant_object feature_mvo;
add(feature_mvo, "feature_digest", feature, resolver, ctx);
pf_array.push_back(feature_mvo);
pf_array.push_back(std::move(feature_mvo));
}
mvo("new_protocol_features", pf_array);
}
@@ -678,13 +697,13 @@ namespace impl {
* this will degrade to the common fc::to_variant as soon as the type no longer contains
* ABI related info
*
* @tparam Reslover - callable with the signature (const name& code_account) -> std::optional<abi_def>
* @tparam Resolver - callable with the signature (const name& code_account) -> std::optional<abi_def>
*/
template<typename T, typename Resolver>
class abi_to_variant_visitor
{
public:
abi_to_variant_visitor( mutable_variant_object& _mvo, const T& _val, Resolver _resolver, abi_traverse_context& _ctx )
abi_to_variant_visitor( mutable_variant_object& _mvo, const T& _val, const Resolver& _resolver, abi_traverse_context& _ctx )
:_vo(_mvo)
,_val(_val)
,_resolver(_resolver)
@@ -707,7 +726,7 @@ namespace impl {
private:
mutable_variant_object& _vo;
const T& _val;
Resolver _resolver;
const Resolver& _resolver;
abi_traverse_context& _ctx;
};
@@ -717,7 +736,7 @@ namespace impl {
* and can be degraded to the normal ::from_variant(...) processing
*/
template<typename M, typename Resolver, not_require_abi_t<M> = 1>
static void extract( const fc::variant& v, M& o, Resolver, abi_traverse_context& ctx )
static void extract( const fc::variant& v, M& o, const Resolver&, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
from_variant(v, o);
@@ -728,14 +747,14 @@ namespace impl {
* for these types we create new ABI aware visitors
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void extract( const fc::variant& v, M& o, Resolver resolver, abi_traverse_context& ctx );
static void extract( const fc::variant& v, M& o, const Resolver& resolver, abi_traverse_context& ctx );
/**
* template which overloads extract for vectors of types which contain ABI information in their trees
* for these members we call ::extract in order to trigger further processing
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void extract( const fc::variant& v, vector<M>& o, Resolver resolver, abi_traverse_context& ctx )
static void extract( const fc::variant& v, vector<M>& o, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
const variants& array = v.get_array();
@@ -753,7 +772,7 @@ namespace impl {
* for these members we call ::extract in order to trigger further processing
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void extract( const fc::variant& v, deque<M>& o, Resolver resolver, abi_traverse_context& ctx )
static void extract( const fc::variant& v, deque<M>& o, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
const variants& array = v.get_array();
@@ -771,7 +790,7 @@ namespace impl {
* for these members we call ::extract in order to trigger further processing
*/
template<typename M, typename Resolver, require_abi_t<M> = 1>
static void extract( const fc::variant& v, std::shared_ptr<M>& o, Resolver resolver, abi_traverse_context& ctx )
static void extract( const fc::variant& v, std::shared_ptr<M>& o, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
const variant_object& vo = v.get_object();
@@ -786,7 +805,7 @@ namespace impl {
* exploded and processed explicitly
*/
template<typename Resolver>
static void extract( const fc::variant& v, action& act, Resolver resolver, abi_traverse_context& ctx )
static void extract( const fc::variant& v, action& act, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
const variant_object& vo = v.get_object();
@@ -806,13 +825,14 @@ namespace impl {
from_variant(data, act.data);
valid_empty_data = act.data.empty();
} else if ( data.is_object() ) {
auto abi = resolver(act.account);
if (abi) {
auto type = abi->get_action_type(act.name);
auto abi_optional = resolver(act.account);
if (abi_optional) {
const abi_serializer& abi = *abi_optional;
auto type = abi.get_action_type(act.name);
if (!type.empty()) {
variant_to_binary_context _ctx(*abi, ctx, type);
variant_to_binary_context _ctx(abi, ctx, type);
_ctx.short_path = true; // Just to be safe while avoiding the complexity of threading an override boolean all over the place
act.data = std::move( abi->_variant_to_binary( type, data, _ctx ));
act.data = abi._variant_to_binary( type, data, _ctx );
valid_empty_data = act.data.empty();
}
}
@@ -833,7 +853,7 @@ namespace impl {
}
template<typename Resolver>
static void extract( const fc::variant& v, packed_transaction& ptrx, Resolver resolver, abi_traverse_context& ctx )
static void extract( const fc::variant& v, packed_transaction& ptrx, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
const variant_object& vo = v.get_object();
@@ -890,7 +910,7 @@ namespace impl {
class abi_from_variant_visitor : public reflector_init_visitor<T>
{
public:
abi_from_variant_visitor( const variant_object& _vo, T& v, Resolver _resolver, abi_traverse_context& _ctx )
abi_from_variant_visitor( const variant_object& _vo, T& v, const Resolver& _resolver, abi_traverse_context& _ctx )
: reflector_init_visitor<T>(v)
,_vo(_vo)
,_resolver(_resolver)
@@ -914,12 +934,12 @@ namespace impl {
private:
const variant_object& _vo;
Resolver _resolver;
const Resolver& _resolver;
abi_traverse_context& _ctx;
};
template<typename M, typename Resolver, require_abi_t<M>>
void abi_to_variant::add( mutable_variant_object &mvo, const char* name, const M& v, Resolver resolver, abi_traverse_context& ctx )
void abi_to_variant::add( mutable_variant_object &mvo, const char* name, const M& v, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
mutable_variant_object member_mvo;
@@ -928,7 +948,7 @@ namespace impl {
}
template<typename M, typename Resolver, require_abi_t<M>>
void abi_from_variant::extract( const fc::variant& v, M& o, Resolver resolver, abi_traverse_context& ctx )
void abi_from_variant::extract( const fc::variant& v, M& o, const Resolver& resolver, abi_traverse_context& ctx )
{
auto h = ctx.enter_scope();
const variant_object& vo = v.get_object();
@@ -937,38 +957,158 @@ namespace impl {
} /// namespace eosio::chain::impl
template<typename T, typename Resolver>
void abi_serializer::to_variant( const T& o, fc::variant& vo, Resolver resolver, const yield_function_t& yield ) try {
void abi_serializer::to_variant( const T& o, fc::variant& vo, const Resolver& resolver, const yield_function_t& yield ) try {
mutable_variant_object mvo;
impl::abi_traverse_context ctx( yield );
impl::abi_traverse_context ctx( yield, fc::microseconds{} );
impl::abi_to_variant::add(mvo, "_", o, resolver, ctx);
vo = std::move(mvo["_"]);
} FC_RETHROW_EXCEPTIONS(error, "Failed to serialize: ${type}", ("type", boost::core::demangle( typeid(o).name() ) ))
template<typename T, typename Resolver>
void abi_serializer::to_variant( const T& o, fc::variant& vo, Resolver resolver, const fc::microseconds& max_serialization_time ) {
to_variant( o, vo, resolver, create_yield_function(max_serialization_time) );
}
void abi_serializer::to_variant( const T& o, fc::variant& vo, const Resolver& resolver, const fc::microseconds& max_action_data_serialization_time ) try {
mutable_variant_object mvo;
impl::abi_traverse_context ctx( create_depth_yield_function(), max_action_data_serialization_time );
impl::abi_to_variant::add(mvo, "_", o, resolver, ctx);
vo = std::move(mvo["_"]);
} FC_RETHROW_EXCEPTIONS(error, "Failed to serialize: ${type}", ("type", boost::core::demangle( typeid(o).name() ) ))
template<typename T, typename Resolver>
void abi_serializer::to_log_variant( const T& o, fc::variant& vo, Resolver resolver, const yield_function_t& yield ) try {
void abi_serializer::to_log_variant( const T& o, fc::variant& vo, const Resolver& resolver, const yield_function_t& yield ) try {
mutable_variant_object mvo;
impl::abi_traverse_context ctx( yield );
impl::abi_traverse_context ctx( yield, fc::microseconds{} );
ctx.logging();
impl::abi_to_variant::add(mvo, "_", o, resolver, ctx);
vo = std::move(mvo["_"]);
} FC_RETHROW_EXCEPTIONS(error, "Failed to serialize: ${type}", ("type", boost::core::demangle( typeid(o).name() ) ))
template<typename T, typename Resolver>
void abi_serializer::to_log_variant( const T& o, fc::variant& vo, const Resolver& resolver, const fc::microseconds& max_action_data_serialization_time ) try {
mutable_variant_object mvo;
impl::abi_traverse_context ctx( create_depth_yield_function(), max_action_data_serialization_time );
ctx.logging();
impl::abi_to_variant::add(mvo, "_", o, resolver, ctx);
vo = std::move(mvo["_"]);
} FC_RETHROW_EXCEPTIONS(error, "Failed to serialize: ${type}", ("type", boost::core::demangle( typeid(o).name() ) ))
template<typename T, typename Resolver>
void abi_serializer::from_variant( const fc::variant& v, T& o, Resolver resolver, const yield_function_t& yield ) try {
impl::abi_traverse_context ctx( yield );
void abi_serializer::from_variant( const fc::variant& v, T& o, const Resolver& resolver, const yield_function_t& yield ) try {
impl::abi_traverse_context ctx( yield, fc::microseconds{} );
impl::abi_from_variant::extract(v, o, resolver, ctx);
} FC_RETHROW_EXCEPTIONS(error, "Failed to deserialize variant", ("variant",v))
template<typename T, typename Resolver>
void abi_serializer::from_variant( const fc::variant& v, T& o, Resolver resolver, const fc::microseconds& max_serialization_time ) {
from_variant( v, o, resolver, create_yield_function(max_serialization_time) );
}
void abi_serializer::from_variant( const fc::variant& v, T& o, const Resolver& resolver, const fc::microseconds& max_action_data_serialization_time ) try {
impl::abi_traverse_context ctx( create_depth_yield_function(), max_action_data_serialization_time );
impl::abi_from_variant::extract(v, o, resolver, ctx);
} FC_RETHROW_EXCEPTIONS(error, "Failed to deserialize variant", ("variant",v))
using abi_serializer_cache_t = std::unordered_map<account_name, std::optional<abi_serializer>>;
using resolver_fn_t = std::function<std::optional<abi_serializer>(const account_name& name)>;
class abi_resolver {
public:
explicit abi_resolver(abi_serializer_cache_t&& abi_serializers) :
abi_serializers(std::move(abi_serializers))
{}
} } // eosio::chain
std::optional<std::reference_wrapper<const abi_serializer>> operator()(const account_name& account) const {
auto it = abi_serializers.find(account);
if (it != abi_serializers.end() && it->second)
return std::reference_wrapper<const abi_serializer>(*it->second);
return {};
};
private:
abi_serializer_cache_t abi_serializers;
};
class abi_serializer_cache_builder {
public:
explicit abi_serializer_cache_builder(resolver_fn_t resolver) :
resolver_(std::move(resolver))
{
}
abi_serializer_cache_builder(const abi_serializer_cache_builder&) = delete;
abi_serializer_cache_builder&& add_serializers(const chain::signed_block_ptr& block) && {
for( const auto& receipt: block->transactions ) {
if( std::holds_alternative<chain::packed_transaction>( receipt.trx ) ) {
const auto& pt = std::get<chain::packed_transaction>( receipt.trx );
const auto& t = pt.get_transaction();
for( const auto& a: t.actions )
add_to_cache( a );
for( const auto& a: t.context_free_actions )
add_to_cache( a );
}
}
return std::move(*this);
}
abi_serializer_cache_builder&& add_serializers(const transaction_trace_ptr& trace_ptr) && {
for( const auto& trace: trace_ptr->action_traces ) {
add_to_cache(trace.act);
}
return std::move(*this);
}
abi_serializer_cache_t&& get() && {
return std::move(abi_serializers);
}
private:
void add_to_cache(const chain::action& a) {
auto it = abi_serializers.find( a.account );
if( it == abi_serializers.end() ) {
try {
abi_serializers.emplace_hint( it, a.account, resolver_( a.account ) );
} catch( ... ) {
// keep behavior of not throwing on invalid abi, will result in hex data
}
}
}
resolver_fn_t resolver_;
abi_serializer_cache_t abi_serializers;
};
/*
* This is equivalent to a resolver, except that everytime the abi_serializer for an account
* is retrieved, it is stored in an unordered_map, so we won't waste time retrieving it again.
* This is handy when parsing packed_transactions received in a fc::variant.
*/
class caching_resolver {
public:
explicit caching_resolver(resolver_fn_t resolver) :
resolver_(std::move(resolver))
{
}
// make it non-copiable (we should only move it for performance reasons)
caching_resolver(const caching_resolver&) = delete;
caching_resolver& operator=(const caching_resolver&) = delete;
std::optional<std::reference_wrapper<const abi_serializer>> operator()(const account_name& account) const {
auto it = abi_serializers.find(account);
if (it != abi_serializers.end()) {
if (it->second)
return *it->second;
return {};
}
auto serializer = resolver_(account);
auto& dest = abi_serializers[account]; // add entry regardless
if (serializer) {
// we got a serializer, so move it into the cache
dest = abi_serializer_cache_t::mapped_type{std::move(*serializer)};
return *dest; // and return a reference to it
}
return {};
};
private:
const resolver_fn_t resolver_;
mutable abi_serializer_cache_t abi_serializers;
};
} // eosio::chain
@@ -188,7 +188,7 @@ struct authority {
}
authority( uint32_t t, vector<key_weight> k, vector<permission_level_weight> p = {}, vector<wait_weight> w = {} )
:threshold(t),keys(move(k)),accounts(move(p)),waits(move(w)){}
:threshold(t),keys(std::move(k)),accounts(std::move(p)),waits(std::move(w)){}
authority(){}
uint32_t threshold = 0;
@@ -42,7 +42,7 @@ namespace eosio { namespace chain {
class block_log {
public:
explicit block_log(const fc::path& data_dir, const block_log_config& config = block_log_config{});
explicit block_log(const std::filesystem::path& data_dir, const block_log_config& config = block_log_config{});
block_log(block_log&& other) noexcept;
~block_log();
@@ -80,13 +80,21 @@ namespace eosio { namespace chain {
* All static methods expected to be called on quiescent block log
*/
static fc::path repair_log( const fc::path& data_dir, uint32_t truncate_at_block = 0, const char* reversible_block_dir_name="" );
static std::filesystem::path repair_log( const std::filesystem::path& data_dir, uint32_t truncate_at_block = 0, const char* reversible_block_dir_name="" );
static std::optional<genesis_state> extract_genesis_state( const fc::path& data_dir );
using chain_context = std::variant<genesis_state, chain_id_type>;
static std::optional<chain_context> extract_chain_context(const std::filesystem::path& data_dir,
const std::filesystem::path& retained_dir);
static chain_id_type extract_chain_id( const fc::path& data_dir );
static std::optional<genesis_state>
extract_genesis_state(const std::filesystem::path& data_dir,
const std::filesystem::path& retained_dir = std::filesystem::path{});
static void construct_index(const fc::path& block_file_name, const fc::path& index_file_name);
static std::optional<chain_id_type>
extract_chain_id(const std::filesystem::path& data_dir,
const std::filesystem::path& retained_dir = std::filesystem::path{});
static void construct_index(const std::filesystem::path& block_file_name, const std::filesystem::path& index_file_name);
static bool contains_genesis_state(uint32_t version, uint32_t first_block_num);
@@ -94,12 +102,12 @@ namespace eosio { namespace chain {
static bool is_supported_version(uint32_t version);
static bool is_pruned_log(const fc::path& data_dir);
static bool is_pruned_log(const std::filesystem::path& data_dir);
static void extract_block_range(const fc::path& block_dir, const fc::path&output_dir, block_num_type start, block_num_type end);
static void extract_block_range(const std::filesystem::path& block_dir, const std::filesystem::path&output_dir, block_num_type start, block_num_type end);
static bool trim_blocklog_front(const fc::path& block_dir, const fc::path& temp_dir, uint32_t truncate_at_block);
static int trim_blocklog_end(const fc::path& block_dir, uint32_t n);
static bool trim_blocklog_front(const std::filesystem::path& block_dir, const std::filesystem::path& temp_dir, uint32_t truncate_at_block);
static int trim_blocklog_end(const std::filesystem::path& block_dir, uint32_t n);
// used for unit test to generate older version blocklog
static void set_initial_version(uint32_t);
@@ -109,10 +117,10 @@ namespace eosio { namespace chain {
/**
* @param n Only test 1 block out of every n blocks. If n is 0, the interval is adjusted so that at most 8 blocks are tested.
*/
static void smoke_test(const fc::path& block_dir, uint32_t n);
static void smoke_test(const std::filesystem::path& block_dir, uint32_t n);
static void split_blocklog(const fc::path& block_dir, const fc::path& dest_dir, uint32_t stride);
static void merge_blocklogs(const fc::path& block_dir, const fc::path& dest_dir);
static void split_blocklog(const std::filesystem::path& block_dir, const std::filesystem::path& dest_dir, uint32_t stride);
static void merge_blocklogs(const std::filesystem::path& block_dir, const std::filesystem::path& dest_dir);
private:
std::unique_ptr<detail::block_log_impl> my;
};
@@ -1,20 +1,18 @@
#pragma once
#include <boost/filesystem/path.hpp>
#include <variant>
namespace eosio { namespace chain {
namespace bfs = boost::filesystem;
struct basic_blocklog_config {};
struct empty_blocklog_config {};
struct partitioned_blocklog_config {
bfs::path retained_dir;
bfs::path archive_dir;
uint32_t stride = UINT32_MAX;
uint32_t max_retained_files = UINT32_MAX;
std::filesystem::path retained_dir;
std::filesystem::path archive_dir;
uint32_t stride = UINT32_MAX;
uint32_t max_retained_files = UINT32_MAX;
};
struct prune_blocklog_config {
@@ -76,7 +76,7 @@ const static uint32_t default_max_inline_action_size = 512 * 102
const static uint16_t default_max_inline_action_depth = 4;
const static uint16_t default_max_auth_depth = 6;
const static uint32_t default_sig_cpu_bill_pct = 50 * percent_1; // billable percentage of signature recovery
const static uint32_t default_block_cpu_effort_pct = 80 * percent_1; // percentage of block time used for producing block
const static uint32_t default_block_cpu_effort_pct = 90 * percent_1; // percentage of block time used for producing block
const static uint16_t default_controller_thread_pool_size = 2;
const static uint32_t default_max_variable_signature_length = 16384u;
const static uint32_t default_max_nonprivileged_inline_action_size = 4 * 1024; // 4 KB
@@ -39,6 +39,7 @@ namespace eosio { namespace chain {
class permission_object;
class account_object;
class deep_mind_handler;
class subjective_billing;
using resource_limits::resource_limits_manager;
using apply_handler = std::function<void(apply_context&)>;
using forked_branch_callback = std::function<void(const branch_type&)>;
@@ -49,7 +50,8 @@ namespace eosio { namespace chain {
enum class db_read_mode {
HEAD,
IRREVERSIBLE
IRREVERSIBLE,
SPECULATIVE
};
enum class validation_mode {
@@ -196,6 +198,8 @@ namespace eosio { namespace chain {
const authorization_manager& get_authorization_manager()const;
authorization_manager& get_mutable_authorization_manager();
const protocol_feature_manager& get_protocol_feature_manager()const;
const subjective_billing& get_subjective_billing()const;
subjective_billing& get_mutable_subjective_billing();
uint32_t get_max_nonprivileged_inline_action_size()const;
const flat_set<account_name>& get_actor_whitelist() const;
@@ -223,6 +227,7 @@ namespace eosio { namespace chain {
block_id_type fork_db_head_block_id()const;
time_point pending_block_time()const;
block_timestamp_type pending_block_timestamp()const;
account_name pending_block_producer()const;
const block_signing_authority& pending_block_signing_authority()const;
std::optional<block_id_type> pending_producer_block_id()const;
@@ -343,26 +348,6 @@ namespace eosio { namespace chain {
const apply_handler* find_apply_handler( account_name contract, scope_name scope, action_name act )const;
wasm_interface& get_wasm_interface();
std::optional<abi_serializer> get_abi_serializer( account_name n, const abi_serializer::yield_function_t& yield )const {
if( n.good() ) {
try {
const auto& a = get_account( n );
if( abi_def abi; abi_serializer::to_abi( a.abi, abi ))
return abi_serializer( std::move(abi), yield );
} FC_CAPTURE_AND_LOG((n))
}
return std::optional<abi_serializer>();
}
template<typename T>
fc::variant to_variant_with_abi( const T& obj, const abi_serializer::yield_function_t& yield )const {
fc::variant pretty_output;
abi_serializer::to_variant( obj, pretty_output,
[&]( account_name n ){ return get_abi_serializer( n, yield ); }, yield );
return pretty_output;
}
static chain_id_type extract_chain_id(snapshot_reader& snapshot);
static std::optional<chain_id_type> extract_chain_id_from_db( const path& state_dir );
@@ -373,6 +358,10 @@ namespace eosio { namespace chain {
void set_db_read_only_mode();
void unset_db_read_only_mode();
void init_thread_local_data();
void set_to_write_window();
void set_to_read_window();
bool is_write_window() const;
void code_block_num_last_used(const digest_type& code_hash, uint8_t vm_type, uint8_t vm_version, uint32_t block_num);
private:
friend class apply_context;
@@ -170,7 +170,7 @@ namespace fc {
inline
void from_variant( const variant& v, eosio::chain::shared_string& s ) {
string _s;
std::string _s;
from_variant(v, _s);
s = eosio::chain::shared_string(_s.begin(), _s.end(), s.get_allocator());
}
@@ -182,7 +182,7 @@ namespace fc {
inline
void from_variant( const variant& v, eosio::chain::shared_blob& b ) {
string _s = base64_decode(v.as_string());
std::string _s = base64_decode(v.as_string());
b = eosio::chain::shared_blob(_s.begin(), _s.end(), b.get_allocator());
}
@@ -87,6 +87,26 @@
NEXT(e.dynamic_copy_exception());\
}
/**
* Capture all exceptions and return return_type which is constructible from a fc::exception_ptr
*/
#define CATCH_AND_RETURN(return_type)\
catch ( const fc::exception& err ) {\
return return_type(err.dynamic_copy_exception());\
} catch ( const std::exception& e ) {\
fc::exception fce( \
FC_LOG_MESSAGE( warn, "rethrow ${what}: ", ("what",e.what())),\
fc::std_exception_code,\
BOOST_CORE_TYPEID(e).name(),\
e.what() ) ;\
return return_type(fce.dynamic_copy_exception());\
} catch( ... ) {\
fc::unhandled_exception e(\
FC_LOG_MESSAGE(warn, "rethrow"),\
std::current_exception());\
return return_type(e.dynamic_copy_exception());\
}
#define EOS_RECODE_EXC( cause_type, effect_type ) \
catch( const cause_type& e ) \
{ throw( effect_type( e.what(), e.get_log() ) ); }
@@ -361,6 +381,10 @@ namespace eosio { namespace chain {
3080007, "Transaction exceeded the current greylisted account network usage limit" )
FC_DECLARE_DERIVED_EXCEPTION( greylist_cpu_usage_exceeded, resource_exhausted_exception,
3080008, "Transaction exceeded the current greylisted account CPU usage limit" )
FC_DECLARE_DERIVED_EXCEPTION( ro_trx_vm_oc_compile_temporary_failure, resource_exhausted_exception,
3080009, "Read-only transaction eos-vm-oc compile temporary failure" )
FC_DECLARE_DERIVED_EXCEPTION( ro_trx_vm_oc_compile_permanent_failure, resource_exhausted_exception,
3080010, "Read-only transaction eos-vm-oc compile permanent failure" )
FC_DECLARE_DERIVED_EXCEPTION( leeway_deadline_exception, deadline_exception,
3081001, "Transaction reached the deadline set due to leeway on account CPU limits" )
@@ -579,6 +603,8 @@ namespace eosio { namespace chain {
3170014, "Snapshot request not found" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_snapshot_request, producer_exception,
3170015, "Invalid snapshot request" )
FC_DECLARE_DERIVED_EXCEPTION( snapshot_execution_exception, producer_exception,
3170016, "Snapshot execution exception" )
FC_DECLARE_DERIVED_EXCEPTION( reversible_blocks_exception, chain_exception,
3180000, "Reversible Blocks exception" )
@@ -22,7 +22,7 @@ namespace eosio { namespace chain {
class fork_database {
public:
explicit fork_database( const fc::path& data_dir );
explicit fork_database( const std::filesystem::path& data_dir );
~fork_database();
void open( const std::function<void( block_timestamp_type,
@@ -1,6 +1,5 @@
#pragma once
#include <boost/container/flat_map.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/iostreams/device/mapped_file.hpp>
#include <fc/io/cfile.hpp>
#include <fc/io/datastream.hpp>
@@ -9,19 +8,19 @@
namespace eosio {
namespace chain {
namespace bfs = boost::filesystem;
template <typename Lambda>
void for_each_file_in_dir_matches(const bfs::path& dir, std::string pattern, Lambda&& lambda) {
void for_each_file_in_dir_matches(const std::filesystem::path& dir, std::string pattern, Lambda&& lambda) {
const std::regex my_filter(pattern);
std::smatch what;
bfs::directory_iterator end_itr; // Default ctor yields past-the-end
for (bfs::directory_iterator p(dir); p != end_itr; ++p) {
std::filesystem::directory_iterator end_itr; // Default ctor yields past-the-end
for (std::filesystem::directory_iterator p(dir); p != end_itr; ++p) {
// Skip if not a file
if (!bfs::is_regular_file(p->status()))
if (!std::filesystem::is_regular_file(p->status()))
continue;
auto name = p->path().filename().string();
// skip if it does not match the pattern
if (!std::regex_match(p->path().filename().string(), what, my_filter))
if (!std::regex_match(name, what, my_filter))
continue;
lambda(p->path());
}
@@ -29,7 +28,7 @@ void for_each_file_in_dir_matches(const bfs::path& dir, std::string pattern, Lam
struct null_verifier {
template <typename LogData>
void verify(const LogData&, const bfs::path&) {}
void verify(const LogData&, const std::filesystem::path&) {}
};
template <typename LogData, typename LogIndex, typename LogVerifier = null_verifier>
@@ -37,21 +36,21 @@ struct log_catalog {
using block_num_t = uint32_t;
struct mapped_type {
block_num_t last_block_num;
bfs::path filename_base;
block_num_t last_block_num;
std::filesystem::path filename_base;
};
using collection_t = boost::container::flat_map<block_num_t, mapped_type>;
using size_type = typename collection_t::size_type;
static constexpr size_type npos = std::numeric_limits<size_type>::max();
bfs::path retained_dir;
bfs::path archive_dir;
size_type max_retained_files = std::numeric_limits<size_type>::max();
collection_t collection;
size_type active_index = npos;
LogData log_data;
LogIndex log_index;
LogVerifier verifier;
std::filesystem::path retained_dir;
std::filesystem::path archive_dir;
size_type max_retained_files = std::numeric_limits<size_type>::max();
collection_t collection;
size_type active_index = npos;
LogData log_data;
LogIndex log_index;
LogVerifier verifier;
bool empty() const { return collection.empty(); }
@@ -67,17 +66,17 @@ struct log_catalog {
return collection.rbegin()->second.last_block_num;
}
static bfs::path make_absolute_dir(const bfs::path& base_dir, bfs::path new_dir) {
static std::filesystem::path make_absolute_dir(const std::filesystem::path& base_dir, std::filesystem::path new_dir) {
if (new_dir.is_relative())
new_dir = base_dir / new_dir;
if (!bfs::is_directory(new_dir))
bfs::create_directories(new_dir);
if (!std::filesystem::is_directory(new_dir))
std::filesystem::create_directories(new_dir);
return new_dir;
}
void open(const bfs::path& log_dir, const bfs::path& retained_path, const bfs::path& archive_path, const char* name,
void open(const std::filesystem::path& log_dir, const std::filesystem::path& retained_path, const std::filesystem::path& archive_path, const char* name,
const char* suffix_pattern = R"(-\d+-\d+\.log)") {
retained_dir = make_absolute_dir(log_dir, retained_path.empty() ? log_dir : retained_path);
@@ -85,7 +84,7 @@ struct log_catalog {
archive_dir = make_absolute_dir(log_dir, archive_path);
}
for_each_file_in_dir_matches(retained_dir, std::string(name) + suffix_pattern, [this](bfs::path path) {
for_each_file_in_dir_matches(retained_dir, std::string(name) + suffix_pattern, [this](std::filesystem::path path) {
auto log_path = path;
auto index_path = path.replace_extension("index");
auto path_without_extension = log_path.parent_path() / log_path.stem().string();
@@ -117,11 +116,11 @@ struct log_catalog {
});
}
bool index_matches_data(const bfs::path& index_path, LogData& log) const {
if (!bfs::exists(index_path))
bool index_matches_data(const std::filesystem::path& index_path, LogData& log) const {
if (!std::filesystem::exists(index_path))
return false;
auto num_blocks_in_index = bfs::file_size(index_path) / sizeof(uint64_t);
auto num_blocks_in_index = std::filesystem::file_size(index_path) / sizeof(uint64_t);
if (num_blocks_in_index != log.num_blocks())
return false;
@@ -187,17 +186,17 @@ struct log_catalog {
return {};
}
static void rename_if_not_exists(bfs::path old_name, bfs::path new_name) {
if (!bfs::exists(new_name)) {
bfs::rename(old_name, new_name);
static void rename_if_not_exists(std::filesystem::path old_name, std::filesystem::path new_name) {
if (!std::filesystem::exists(new_name)) {
std::filesystem::rename(old_name, new_name);
} else {
bfs::remove(old_name);
std::filesystem::remove(old_name);
wlog("${new_name} already exists, just removing ${old_name}",
("old_name", old_name.string())("new_name", new_name.string()));
}
}
static void rename_bundle(bfs::path orig_path, bfs::path new_path) {
static void rename_bundle(std::filesystem::path orig_path, std::filesystem::path new_path) {
rename_if_not_exists(orig_path.replace_extension(".log"), new_path.replace_extension(".log"));
rename_if_not_exists(orig_path.replace_extension(".index"), new_path.replace_extension(".index"));
}
@@ -209,12 +208,12 @@ struct log_catalog {
/// invalidated and the mapping between the log data their block range would be wrong. This function is only used
/// during the splitting of block log. Using this function for other purpose should make sure if the monotonically
/// increasing block num guarantee can be met.
void add(uint32_t start_block_num, uint32_t end_block_num, const bfs::path& dir, const char* name) {
void add(uint32_t start_block_num, uint32_t end_block_num, const std::filesystem::path& dir, const char* name) {
const int bufsize = 64;
char buf[bufsize];
snprintf(buf, bufsize, "%s-%u-%u", name, start_block_num, end_block_num);
bfs::path new_path = retained_dir / buf;
std::filesystem::path new_path = retained_dir / buf;
rename_bundle(dir / name, new_path);
size_type items_to_erase = 0;
collection.emplace(start_block_num, mapped_type{end_block_num, new_path});
@@ -226,8 +225,8 @@ struct log_catalog {
auto orig_name = it->second.filename_base;
if (archive_dir.empty()) {
// delete the old files when no backup dir is specified
bfs::remove(orig_name.replace_extension("log"));
bfs::remove(orig_name.replace_extension("index"));
std::filesystem::remove(orig_name.replace_extension("log"));
std::filesystem::remove(orig_name.replace_extension("index"));
} else {
// move the the archive dir
rename_bundle(orig_name, archive_dir / orig_name.filename());
@@ -246,14 +245,14 @@ struct log_catalog {
/// from the catalog.
///
/// \return if nonzero, it's the starting block number for the log/index bundle being renamed.
uint32_t truncate(uint32_t block_num, bfs::path new_name) {
uint32_t truncate(uint32_t block_num, std::filesystem::path new_name) {
if (collection.empty())
return 0;
auto remove_files = [](typename collection_t::const_reference v) {
auto name = v.second.filename_base;
bfs::remove(name.replace_extension("log"));
bfs::remove(name.replace_extension("index"));
std::filesystem::remove(name.replace_extension("log"));
std::filesystem::remove(name.replace_extension("index"));
};
active_index = npos;
@@ -266,8 +265,8 @@ struct log_catalog {
} else {
auto truncate_it = --it;
auto name = truncate_it->second.filename_base;
bfs::rename(name.replace_extension("log"), new_name.replace_extension("log"));
bfs::rename(name.replace_extension("index"), new_name.replace_extension("index"));
std::filesystem::rename(name.replace_extension("log"), new_name.replace_extension("log"));
std::filesystem::rename(name.replace_extension("index"), new_name.replace_extension("index"));
std::for_each(truncate_it + 1, collection.end(), remove_files);
auto result = truncate_it->first;
collection.erase(truncate_it, collection.end());
@@ -1,6 +1,5 @@
#pragma once
#include <boost/filesystem/path.hpp>
#include <fc/io/cfile.hpp>
namespace eosio {
@@ -14,11 +13,11 @@ class log_index {
std::size_t num_blocks_ = 0;
public:
log_index() = default;
log_index(const boost::filesystem::path& path) {
log_index(const std::filesystem::path& path) {
open(path);
}
void open(const boost::filesystem::path& path) {
void open(const std::filesystem::path& path) {
if (file_.is_open())
file_.close();
file_.set_file_path(path);
@@ -26,13 +25,13 @@ class log_index {
file_.seek_end(0);
num_blocks_ = file_.tellp()/ sizeof(uint64_t);
EOS_ASSERT(file_.tellp() % sizeof(uint64_t) == 0, Exception,
"The size of ${file} is not a multiple of sizeof(uint64_t)", ("file", path.generic_string()));
"The size of ${file} is not a multiple of sizeof(uint64_t)", ("file", path));
}
bool is_open() const { return file_.is_open(); }
uint64_t back() { return nth_block_position(num_blocks()-1); }
unsigned num_blocks() const { return num_blocks_; }
uint32_t num_blocks() const { return num_blocks_; }
uint64_t nth_block_position(uint32_t n) {
file_.seek(n*sizeof(uint64_t));
uint64_t r;
@@ -0,0 +1,61 @@
#pragma once
#include <eosio/chain/controller.hpp>
#include <eosio/chain/types.hpp>
#include <string>
namespace eosio::chain {
namespace fs = std::filesystem;
template<typename T>
class pending_snapshot {
public:
using next_t = eosio::chain::next_function<T>;
pending_snapshot(const chain::block_id_type& block_id, const next_t& next, std::string pending_path, std::string final_path)
: block_id(block_id), next(next), pending_path(std::move(pending_path)), final_path(std::move(final_path)) {}
uint32_t get_height() const {
return chain::block_header::num_from_id(block_id);
}
static fs::path get_final_path(const chain::block_id_type& block_id, const fs::path& snapshots_dir) {
return snapshots_dir / fc::format_string("snapshot-${id}.bin", fc::mutable_variant_object()("id", block_id));
}
static fs::path get_pending_path(const chain::block_id_type& block_id, const fs::path& snapshots_dir) {
return snapshots_dir / fc::format_string(".pending-snapshot-${id}.bin", fc::mutable_variant_object()("id", block_id));
}
static fs::path get_temp_path(const chain::block_id_type& block_id, const fs::path& snapshots_dir) {
return snapshots_dir / fc::format_string(".incomplete-snapshot-${id}.bin", fc::mutable_variant_object()("id", block_id));
}
T finalize(const chain::controller& chain) const {
auto block_ptr = chain.fetch_block_by_id(block_id);
auto in_chain = (bool) block_ptr;
std::error_code ec;
if(!in_chain) {
fs::remove(fs::path(pending_path), ec);
EOS_THROW(chain::snapshot_finalization_exception,
"Snapshotted block was forked out of the chain. ID: ${block_id}",
("block_id", block_id));
}
fs::rename(fs::path(pending_path), fs::path(final_path), ec);
EOS_ASSERT(!ec, chain::snapshot_finalization_exception,
"Unable to finalize valid snapshot of block number ${bn}: [code: ${ec}] ${message}",
("bn", get_height())("ec", ec.value())("message", ec.message()));
return {block_id, block_ptr->block_num(), block_ptr->timestamp, chain::chain_snapshot_header::current_version, final_path};
}
chain::block_id_type block_id;
next_t next;
std::string pending_path;
std::string final_path;
};
}// namespace eosio::chain
@@ -396,8 +396,8 @@ private:
std::function<deep_mind_handler*(bool is_trx_transient)> _get_deep_mind_logger;
};
std::optional<builtin_protocol_feature> read_builtin_protocol_feature( const fc::path& p );
protocol_feature_set initialize_protocol_features( const fc::path& p, bool populate_missing_builtins = true );
std::optional<builtin_protocol_feature> read_builtin_protocol_feature( const std::filesystem::path& p );
protocol_feature_set initialize_protocol_features( const std::filesystem::path& p, bool populate_missing_builtins = true );
} } // namespace eosio::chain
@@ -376,7 +376,7 @@ namespace eosio { namespace chain {
class istream_json_snapshot_reader : public snapshot_reader {
public:
explicit istream_json_snapshot_reader(const fc::path& p);
explicit istream_json_snapshot_reader(const std::filesystem::path& p);
~istream_json_snapshot_reader();
void validate() const override;
@@ -0,0 +1,223 @@
#pragma once
#include <eosio/chain/pending_snapshot.hpp>
#include <eosio/chain/block_state.hpp>
#include <eosio/chain/config.hpp>
#include <eosio/chain/exceptions.hpp>
#include <eosio/chain/resource_limits.hpp>
#include <eosio/chain/resource_limits_private.hpp>
#include <eosio/chain/transaction.hpp>
#include <eosio/chain/types.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/random_access_index.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <limits>
namespace eosio::chain {
namespace bmi = boost::multi_index;
namespace fs = std::filesystem;
class snapshot_scheduler {
public:
struct snapshot_information {
chain::block_id_type head_block_id;
uint32_t head_block_num;
fc::time_point head_block_time;
uint32_t version;
std::string snapshot_name;
};
struct snapshot_request_information {
uint32_t block_spacing = 0;
uint32_t start_block_num = 0;
uint32_t end_block_num = std::numeric_limits<uint32_t>::max();
std::string snapshot_description = "";
};
// this struct used to hold request params in api call
// it is differentiate between 0 and empty values
struct snapshot_request_params {
std::optional<uint32_t> block_spacing;
std::optional<uint32_t> start_block_num;
std::optional<uint32_t> end_block_num;
std::optional<std::string> snapshot_description;
};
struct snapshot_request_id_information {
uint32_t snapshot_request_id = 0;
};
struct snapshot_schedule_result : public snapshot_request_id_information, public snapshot_request_information {
};
struct snapshot_schedule_information : public snapshot_request_id_information, public snapshot_request_information {
std::vector<snapshot_information> pending_snapshots;
};
struct get_snapshot_requests_result {
std::vector<snapshot_schedule_information> snapshot_requests;
};
template<typename T>
using next_function = eosio::chain::next_function<T>;
struct by_height;
using pending_snapshot_index = bmi::multi_index_container<
pending_snapshot<snapshot_information>,
indexed_by<
bmi::hashed_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(pending_snapshot<snapshot_information>, block_id_type, block_id)>,
bmi::ordered_non_unique<tag<by_height>, BOOST_MULTI_INDEX_CONST_MEM_FUN(pending_snapshot<snapshot_information>, uint32_t, get_height)>>>;
class snapshot_db_json {
public:
snapshot_db_json() = default;
~snapshot_db_json() = default;
void set_path(std::filesystem::path path) {
db_path = std::move(path);
}
std::filesystem::path get_json_path() const {
return db_path / "snapshot-schedule.json";
}
const snapshot_db_json& operator>>(std::vector<snapshot_schedule_information>& sr) {
boost::property_tree::ptree root;
try {
std::ifstream file(get_json_path().string());
file.exceptions(std::istream::failbit | std::istream::eofbit);
boost::property_tree::read_json(file, root);
// parse ptree
for(boost::property_tree::ptree::value_type& req: root.get_child("snapshot_requests")) {
snapshot_schedule_information ssi;
ssi.snapshot_request_id = req.second.get<uint32_t>("snapshot_request_id");
ssi.snapshot_description = req.second.get<std::string>("snapshot_description");
ssi.block_spacing = req.second.get<uint32_t>("block_spacing");
ssi.start_block_num = req.second.get<uint32_t>("start_block_num");
ssi.end_block_num = req.second.get<uint32_t>("end_block_num");
sr.push_back(ssi);
}
} catch(std::ifstream::failure& e) {
elog("unable to restore snapshots schedule from filesystem ${jsonpath}, details: ${details}",
("jsonpath", get_json_path().string())("details", e.what()));
}
return *this;
}
const snapshot_db_json& operator<<(const std::vector<snapshot_schedule_information>& sr) const {
boost::property_tree::ptree root;
boost::property_tree::ptree node_srs;
for(const auto& key: sr) {
boost::property_tree::ptree node;
node.put("snapshot_request_id", key.snapshot_request_id);
node.put("snapshot_description", key.snapshot_description);
node.put("block_spacing", key.block_spacing);
node.put("start_block_num", key.start_block_num);
node.put("end_block_num", key.end_block_num);
node_srs.push_back(std::make_pair("", node));
}
root.push_back(std::make_pair("snapshot_requests", node_srs));
try {
std::ofstream file(get_json_path().string());
file.exceptions(std::istream::failbit | std::istream::eofbit);
boost::property_tree::write_json(file, root);
} catch(std::ofstream::failure& e) {
elog("unable to store snapshots schedule to filesystem to ${jsonpath}, details: ${details}",
("jsonpath", get_json_path().string())("details", e.what()));
}
return *this;
}
private:
fs::path db_path;
};
private:
struct by_snapshot_id;
struct by_snapshot_value;
struct as_vector;
using snapshot_requests = bmi::multi_index_container<
snapshot_schedule_information,
indexed_by<
bmi::hashed_unique<tag<by_snapshot_id>, BOOST_MULTI_INDEX_MEMBER(snapshot_request_id_information, uint32_t, snapshot_request_id)>,
bmi::random_access<tag<as_vector>>,
bmi::ordered_unique<tag<by_snapshot_value>,
composite_key<snapshot_schedule_information,
BOOST_MULTI_INDEX_MEMBER(snapshot_request_information, uint32_t, block_spacing),
BOOST_MULTI_INDEX_MEMBER(snapshot_request_information, uint32_t, start_block_num),
BOOST_MULTI_INDEX_MEMBER(snapshot_request_information, uint32_t, end_block_num)>>>>;
snapshot_requests _snapshot_requests;
snapshot_db_json _snapshot_db;
pending_snapshot_index _pending_snapshot_index;
uint32_t _snapshot_id = 0;
uint32_t _inflight_sid = 0;
// path to write the snapshots to
fs::path _snapshots_dir;
void x_serialize() {
auto& vec = _snapshot_requests.get<as_vector>();
std::vector<snapshot_schedule_information> sr(vec.begin(), vec.end());
_snapshot_db << sr;
};
public:
snapshot_scheduler() = default;
// snapshot scheduler listener
void on_start_block(uint32_t height, chain::controller& chain);
// to promote pending snapshots
void on_irreversible_block(const signed_block_ptr& lib, const chain::controller& chain);
// snapshot scheduler handlers
snapshot_schedule_result schedule_snapshot(const snapshot_request_information& sri);
snapshot_schedule_result unschedule_snapshot(uint32_t sri);
get_snapshot_requests_result get_snapshot_requests();
// initialize with storage
void set_db_path(fs::path db_path);
// set snapshot path
void set_snapshots_path(fs::path sn_path);
// add pending snapshot info to inflight snapshot request
void add_pending_snapshot_info(const snapshot_information& si);
// execute snapshot
void execute_snapshot(uint32_t srid, chain::controller& chain);
// former producer_plugin snapshot fn
void create_snapshot(next_function<snapshot_information> next, chain::controller& chain, std::function<void(void)> predicate);
};
}// namespace eosio::chain
FC_REFLECT(eosio::chain::snapshot_scheduler::snapshot_information, (head_block_id) (head_block_num) (head_block_time) (version) (snapshot_name))
FC_REFLECT(eosio::chain::snapshot_scheduler::snapshot_request_information, (block_spacing) (start_block_num) (end_block_num) (snapshot_description))
FC_REFLECT(eosio::chain::snapshot_scheduler::snapshot_request_params, (block_spacing) (start_block_num) (end_block_num) (snapshot_description))
FC_REFLECT(eosio::chain::snapshot_scheduler::snapshot_request_id_information, (snapshot_request_id))
FC_REFLECT(eosio::chain::snapshot_scheduler::get_snapshot_requests_result, (snapshot_requests))
FC_REFLECT_DERIVED(eosio::chain::snapshot_scheduler::snapshot_schedule_information, (eosio::chain::snapshot_scheduler::snapshot_request_id_information)(eosio::chain::snapshot_scheduler::snapshot_request_information), (pending_snapshots))
FC_REFLECT_DERIVED(eosio::chain::snapshot_scheduler::snapshot_schedule_result, (eosio::chain::snapshot_scheduler::snapshot_request_id_information)(eosio::chain::snapshot_scheduler::snapshot_request_information), )
@@ -8,12 +8,14 @@
#include <eosio/chain/resource_limits_private.hpp>
#include <eosio/chain/config.hpp>
#include <fc/time.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/ordered_index.hpp>
namespace eosio {
namespace eosio::chain {
class subjective_billing {
private:
@@ -92,7 +94,7 @@ private:
public: // public for tests
static constexpr uint32_t subjective_time_interval_ms = 5'000;
size_t get_account_cache_size() {return _account_subjective_bill_cache.size();}
size_t get_account_cache_size() const {return _account_subjective_bill_cache.size();}
void remove_subjective_billing( const chain::transaction_id_type& trx_id, uint32_t time_ordinal ) {
auto& idx = _trx_cache_index.get<by_id>();
auto itr = idx.find( trx_id );
@@ -107,7 +109,7 @@ public:
void disable_account( chain::account_name a ) { _disabled_accounts.emplace( a ); }
bool is_account_disabled(const chain::account_name& a ) const { return _disabled || _disabled_accounts.count( a ); }
void subjective_bill( const chain::transaction_id_type& id, const fc::time_point& expire,
void subjective_bill( const chain::transaction_id_type& id, fc::time_point_sec expire,
const chain::account_name& first_auth, const fc::microseconds& elapsed )
{
if( !_disabled && !_disabled_accounts.count( first_auth ) ) {
@@ -116,7 +118,7 @@ public:
trx_cache_entry{id,
first_auth,
bill,
expire} );
expire.to_time_point()} );
if( p.second ) {
_account_subjective_bill_cache[first_auth].pending_cpu_us += bill;
}
@@ -149,15 +151,15 @@ public:
}
}
void abort_block() {
}
void on_block( fc::logger& log, const chain::block_state_ptr& bsp, const fc::time_point& now ) {
if( bsp == nullptr || _disabled ) return;
const auto time_ordinal = time_ordinal_for(now);
const auto orig_count = _account_subjective_bill_cache.size();
remove_subjective_billing( bsp, time_ordinal );
fc_dlog( log, "Subjective billed accounts ${n} removed ${r}", ("n", orig_count)("r", orig_count - _account_subjective_bill_cache.size()) );
if (orig_count > 0) {
fc_dlog( log, "Subjective billed accounts ${n} removed ${r}",
("n", orig_count)("r", orig_count - _account_subjective_bill_cache.size()) );
}
}
template <typename Yield>
@@ -197,4 +199,4 @@ public:
}
};
} //eosio
} //eosio::chain
+4 -18
View File
@@ -1,12 +1,12 @@
#pragma once
#include <fc/exception/exception.hpp>
#include <eosio/chain/exceptions.hpp>
#include <eosio/chain/types.hpp>
#include <eosio/chain/core_symbol.hpp>
#include <string>
#include <functional>
namespace eosio {
namespace chain {
namespace eosio::chain {
/**
class symbol represents a token and contains precision and name.
@@ -65,20 +65,7 @@ namespace eosio {
explicit symbol(uint64_t v = CORE_SYMBOL): m_value(v) {
EOS_ASSERT(valid(), symbol_type_exception, "invalid symbol: ${name}", ("name",name()));
}
static symbol from_string(const string& from)
{
try {
string s = fc::trim(from);
EOS_ASSERT(!s.empty(), symbol_type_exception, "creating symbol from empty string");
auto comma_pos = s.find(',');
EOS_ASSERT(comma_pos != string::npos, symbol_type_exception, "missing comma in symbol");
auto prec_part = s.substr(0, comma_pos);
uint8_t p = fc::to_int64(prec_part);
string name_part = s.substr(comma_pos + 1);
EOS_ASSERT( p <= max_precision, symbol_type_exception, "precision ${p} should be <= 18", ("p", p));
return symbol(string_to_symbol(p, name_part.c_str()));
} FC_CAPTURE_LOG_AND_RETHROW((from))
}
static symbol from_string(const string& from);
uint64_t value() const { return m_value; }
bool valid() const
{
@@ -184,8 +171,7 @@ namespace eosio {
{
return std::tie(lhs.sym, lhs.contract) > std::tie(rhs.sym, rhs.contract);
}
} // namespace chain
} // namespace eosio
} // namespace eosio::chain
namespace fc {
inline void to_variant(const eosio::chain::symbol& var, fc::variant& vo) { vo = var.to_string(); }
@@ -37,9 +37,13 @@ namespace eosio { namespace chain {
/// Spawn threads, can be re-started after stop().
/// Assumes start()/stop() called from the same thread or externally protected.
/// Blocks until all threads are created and completed their init function, or an exception is thrown
/// during thread startup or an init function. Exceptions thrown during these stages are rethrown from start()
/// but some threads might still have been started. Calling stop() after such a failure is safe.
/// @param num_threads is number of threads spawned
/// @param on_except is the function to call if io_context throws an exception, is called from thread pool thread.
/// if an empty function then logs and rethrows exception on thread which will terminate.
/// if an empty function then logs and rethrows exception on thread which will terminate. Not called
/// for exceptions during the init function (such exceptions are rethrown from start())
/// @param init is an optional function to call at startup to initialize any data.
/// @throw assert_exception if already started and not stopped.
void start( size_t num_threads, on_except_t on_except, init_t init = {} ) {
@@ -47,9 +51,25 @@ namespace eosio { namespace chain {
_ioc_work.emplace( boost::asio::make_work_guard( _ioc ) );
_ioc.restart();
_thread_pool.reserve( num_threads );
for( size_t i = 0; i < num_threads; ++i ) {
_thread_pool.emplace_back( std::thread( &named_thread_pool::run_thread, this, i, on_except, init ) );
std::promise<void> start_complete;
std::atomic<uint32_t> threads_remaining = num_threads;
std::exception_ptr pending_exception;
std::mutex pending_exception_mutex;
try {
for( size_t i = 0; i < num_threads; ++i ) {
_thread_pool.emplace_back( std::thread( &named_thread_pool::run_thread, this, i, on_except, init, std::ref(start_complete),
std::ref(threads_remaining), std::ref(pending_exception), std::ref(pending_exception_mutex) ) );
}
}
catch( ... ) {
/// only an exception from std::thread's ctor should end up here. shut down all threads to ensure no
/// potential access to the promise, atomic, etc above performed after throwing out of start
stop();
throw;
}
start_complete.get_future().get();
}
/// destroy work guard, stop io_context, join thread_pool
@@ -63,16 +83,42 @@ namespace eosio { namespace chain {
}
private:
void run_thread( size_t i, const on_except_t& on_except, const init_t& init ) {
std::string tn = boost::core::demangle(typeid(this).name());
auto offset = tn.rfind("::");
if (offset != std::string::npos)
tn.erase(0, offset+2);
tn = tn.substr(0, tn.find('>')) + "-" + std::to_string( i );
void run_thread( size_t i, const on_except_t& on_except, const init_t& init, std::promise<void>& start_complete,
std::atomic<uint32_t>& threads_remaining, std::exception_ptr& pending_exception, std::mutex& pending_exception_mutex ) {
std::string tn;
auto decrement_remaining = [&]() {
if( !--threads_remaining ) {
if( pending_exception )
start_complete.set_exception( pending_exception );
else
start_complete.set_value();
}
};
try {
try {
tn = boost::core::demangle(typeid(this).name());
auto offset = tn.rfind("::");
if (offset != std::string::npos)
tn.erase(0, offset+2);
tn = tn.substr(0, tn.find('>')) + "-" + std::to_string( i );
fc::set_os_thread_name( tn );
if ( init )
init();
} FC_LOG_AND_RETHROW()
}
catch( ... ) {
std::lock_guard<std::mutex> l( pending_exception_mutex );
pending_exception = std::current_exception();
decrement_remaining();
return;
}
decrement_remaining();
try {
fc::set_os_thread_name( tn );
if ( init )
init();
_ioc.run();
} catch( const fc::exception& e ) {
if( on_except ) {
+28 -16
View File
@@ -8,7 +8,6 @@
#include <fc/io/varint.hpp>
#include <fc/io/enum_type.hpp>
#include <fc/crypto/sha224.hpp>
#include <fc/safe.hpp>
#include <fc/container/flat.hpp>
#include <fc/string.hpp>
#include <fc/io/raw.hpp>
@@ -43,7 +42,7 @@
#define _V(n, v) fc::mutable_variant_object(n, v)
namespace eosio { namespace chain {
namespace eosio::chain {
using std::map;
using std::vector;
using std::unordered_map;
@@ -61,7 +60,7 @@ namespace eosio { namespace chain {
using std::to_string;
using std::all_of;
using fc::path;
using std::filesystem::path;
using fc::variant_object;
using fc::variant;
using fc::enum_type;
@@ -69,7 +68,6 @@ namespace eosio { namespace chain {
using fc::signed_int;
using fc::time_point_sec;
using fc::time_point;
using fc::safe;
using fc::flat_map;
using fc::flat_multimap;
using fc::flat_set;
@@ -78,15 +76,12 @@ namespace eosio { namespace chain {
using public_key_type = fc::crypto::public_key;
using private_key_type = fc::crypto::private_key;
using signature_type = fc::crypto::signature;
#if BOOST_VERSION >= 107100
// configurable boost deque performs much better than std::deque in our use cases
using block_1024_option_t = boost::container::deque_options< boost::container::block_size<1024u> >::type;
template<typename T>
using deque = boost::container::deque< T, void, block_1024_option_t >;
#else
template<typename T>
using deque = std::deque<T>;
#endif
// configurable boost deque (for boost >= 1.71) performs much better than std::deque in our use cases
using block_1024_option_t = boost::container::deque_options< boost::container::block_size<1024u> >::type;
template<typename T>
using deque = boost::container::deque< T, void, block_1024_option_t >;
struct void_t{};
using chainbase::allocator;
@@ -375,7 +370,7 @@ namespace eosio { namespace chain {
}
template<typename E, typename F>
static inline auto has_field( F flags, E field )
static constexpr auto has_field( F flags, E field )
-> std::enable_if_t< std::is_integral<F>::value && std::is_unsigned<F>::value &&
std::is_enum<E>::value && std::is_same< F, std::underlying_type_t<E> >::value, bool>
{
@@ -383,7 +378,7 @@ namespace eosio { namespace chain {
}
template<typename E, typename F>
static inline auto set_field( F flags, E field, bool value = true )
static constexpr auto set_field( F flags, E field, bool value = true )
-> std::enable_if_t< std::is_integral<F>::value && std::is_unsigned<F>::value &&
std::is_enum<E>::value && std::is_same< F, std::underlying_type_t<E> >::value, F >
{
@@ -396,7 +391,24 @@ namespace eosio { namespace chain {
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
} } // eosio::chain
// next_function is a function passed to an API (like send_transaction) and which is called at the end of
// the API processing on the main thread. The type T is a description of the API result that can be
// serialized as output.
// The function accepts a variant which can contain an exception_ptr (if an exception occured while
// processing the API) or the result T.
// The third option is a function which can be executed in a multithreaded context (likely on the
// http_plugin thread pool) and which completes the API processing and returns the result T.
// -------------------------------------------------------------------------------------------------------
template<typename T>
using t_or_exception = std::variant<T, fc::exception_ptr>;
template<typename T>
using next_function_variant = std::variant<fc::exception_ptr, T, std::function<t_or_exception<T>()>>;
template<typename T>
using next_function = std::function<void(const next_function_variant<T>&)>;
} // eosio::chain
namespace chainbase {
// chainbase::shared_cow_string
@@ -27,7 +27,7 @@ enum class trx_enum_type {
incoming_p2p = 4 // incoming_end() needs to be updated if this changes
};
using next_func_t = std::function<void(const std::variant<fc::exception_ptr, transaction_trace_ptr>&)>;
using next_func_t = next_function<transaction_trace_ptr>;
struct unapplied_transaction {
const transaction_metadata_ptr trx_meta;
@@ -37,11 +37,6 @@ struct unapplied_transaction {
const transaction_id_type& id()const { return trx_meta->id(); }
fc::time_point_sec expiration()const { return trx_meta->packed_trx()->expiration(); }
unapplied_transaction(const unapplied_transaction&) = delete;
unapplied_transaction() = delete;
unapplied_transaction& operator=(const unapplied_transaction&) = delete;
unapplied_transaction(unapplied_transaction&&) = default;
};
/**
@@ -99,7 +94,7 @@ public:
auto& persisted_by_expiry = queue.get<by_expiry>();
while( !persisted_by_expiry.empty() ) {
const auto& itr = persisted_by_expiry.begin();
if( itr->expiration() > pending_block_time ) {
if( itr->expiration().to_time_point() > pending_block_time ) {
break;
}
if( yield() ) {
@@ -168,121 +168,121 @@ namespace eosio { namespace chain { namespace wasm_injections {
constexpr const char* inject_which_op( uint16_t opcode ) {
switch ( opcode ) {
case wasm_ops::f32_add_code:
return u8"_eosio_f32_add";
return "_eosio_f32_add";
case wasm_ops::f32_sub_code:
return u8"_eosio_f32_sub";
return "_eosio_f32_sub";
case wasm_ops::f32_mul_code:
return u8"_eosio_f32_mul";
return "_eosio_f32_mul";
case wasm_ops::f32_div_code:
return u8"_eosio_f32_div";
return "_eosio_f32_div";
case wasm_ops::f32_min_code:
return u8"_eosio_f32_min";
return "_eosio_f32_min";
case wasm_ops::f32_max_code:
return u8"_eosio_f32_max";
return "_eosio_f32_max";
case wasm_ops::f32_copysign_code:
return u8"_eosio_f32_copysign";
return "_eosio_f32_copysign";
case wasm_ops::f32_abs_code:
return u8"_eosio_f32_abs";
return "_eosio_f32_abs";
case wasm_ops::f32_neg_code:
return u8"_eosio_f32_neg";
return "_eosio_f32_neg";
case wasm_ops::f32_sqrt_code:
return u8"_eosio_f32_sqrt";
return "_eosio_f32_sqrt";
case wasm_ops::f32_ceil_code:
return u8"_eosio_f32_ceil";
return "_eosio_f32_ceil";
case wasm_ops::f32_floor_code:
return u8"_eosio_f32_floor";
return "_eosio_f32_floor";
case wasm_ops::f32_trunc_code:
return u8"_eosio_f32_trunc";
return "_eosio_f32_trunc";
case wasm_ops::f32_nearest_code:
return u8"_eosio_f32_nearest";
return "_eosio_f32_nearest";
case wasm_ops::f32_eq_code:
return u8"_eosio_f32_eq";
return "_eosio_f32_eq";
case wasm_ops::f32_ne_code:
return u8"_eosio_f32_ne";
return "_eosio_f32_ne";
case wasm_ops::f32_lt_code:
return u8"_eosio_f32_lt";
return "_eosio_f32_lt";
case wasm_ops::f32_le_code:
return u8"_eosio_f32_le";
return "_eosio_f32_le";
case wasm_ops::f32_gt_code:
return u8"_eosio_f32_gt";
return "_eosio_f32_gt";
case wasm_ops::f32_ge_code:
return u8"_eosio_f32_ge";
return "_eosio_f32_ge";
case wasm_ops::f64_add_code:
return u8"_eosio_f64_add";
return "_eosio_f64_add";
case wasm_ops::f64_sub_code:
return u8"_eosio_f64_sub";
return "_eosio_f64_sub";
case wasm_ops::f64_mul_code:
return u8"_eosio_f64_mul";
return "_eosio_f64_mul";
case wasm_ops::f64_div_code:
return u8"_eosio_f64_div";
return "_eosio_f64_div";
case wasm_ops::f64_min_code:
return u8"_eosio_f64_min";
return "_eosio_f64_min";
case wasm_ops::f64_max_code:
return u8"_eosio_f64_max";
return "_eosio_f64_max";
case wasm_ops::f64_copysign_code:
return u8"_eosio_f64_copysign";
return "_eosio_f64_copysign";
case wasm_ops::f64_abs_code:
return u8"_eosio_f64_abs";
return "_eosio_f64_abs";
case wasm_ops::f64_neg_code:
return u8"_eosio_f64_neg";
return "_eosio_f64_neg";
case wasm_ops::f64_sqrt_code:
return u8"_eosio_f64_sqrt";
return "_eosio_f64_sqrt";
case wasm_ops::f64_ceil_code:
return u8"_eosio_f64_ceil";
return "_eosio_f64_ceil";
case wasm_ops::f64_floor_code:
return u8"_eosio_f64_floor";
return "_eosio_f64_floor";
case wasm_ops::f64_trunc_code:
return u8"_eosio_f64_trunc";
return "_eosio_f64_trunc";
case wasm_ops::f64_nearest_code:
return u8"_eosio_f64_nearest";
return "_eosio_f64_nearest";
case wasm_ops::f64_eq_code:
return u8"_eosio_f64_eq";
return "_eosio_f64_eq";
case wasm_ops::f64_ne_code:
return u8"_eosio_f64_ne";
return "_eosio_f64_ne";
case wasm_ops::f64_lt_code:
return u8"_eosio_f64_lt";
return "_eosio_f64_lt";
case wasm_ops::f64_le_code:
return u8"_eosio_f64_le";
return "_eosio_f64_le";
case wasm_ops::f64_gt_code:
return u8"_eosio_f64_gt";
return "_eosio_f64_gt";
case wasm_ops::f64_ge_code:
return u8"_eosio_f64_ge";
return "_eosio_f64_ge";
case wasm_ops::f64_promote_f32_code:
return u8"_eosio_f32_promote";
return "_eosio_f32_promote";
case wasm_ops::f32_demote_f64_code:
return u8"_eosio_f64_demote";
return "_eosio_f64_demote";
case wasm_ops::i32_trunc_u_f32_code:
return u8"_eosio_f32_trunc_i32u";
return "_eosio_f32_trunc_i32u";
case wasm_ops::i32_trunc_s_f32_code:
return u8"_eosio_f32_trunc_i32s";
return "_eosio_f32_trunc_i32s";
case wasm_ops::i32_trunc_u_f64_code:
return u8"_eosio_f64_trunc_i32u";
return "_eosio_f64_trunc_i32u";
case wasm_ops::i32_trunc_s_f64_code:
return u8"_eosio_f64_trunc_i32s";
return "_eosio_f64_trunc_i32s";
case wasm_ops::i64_trunc_u_f32_code:
return u8"_eosio_f32_trunc_i64u";
return "_eosio_f32_trunc_i64u";
case wasm_ops::i64_trunc_s_f32_code:
return u8"_eosio_f32_trunc_i64s";
return "_eosio_f32_trunc_i64s";
case wasm_ops::i64_trunc_u_f64_code:
return u8"_eosio_f64_trunc_i64u";
return "_eosio_f64_trunc_i64u";
case wasm_ops::i64_trunc_s_f64_code:
return u8"_eosio_f64_trunc_i64s";
return "_eosio_f64_trunc_i64s";
case wasm_ops::f32_convert_s_i32_code:
return u8"_eosio_i32_to_f32";
return "_eosio_i32_to_f32";
case wasm_ops::f32_convert_u_i32_code:
return u8"_eosio_ui32_to_f32";
return "_eosio_ui32_to_f32";
case wasm_ops::f32_convert_s_i64_code:
return u8"_eosio_i64_f32";
return "_eosio_i64_f32";
case wasm_ops::f32_convert_u_i64_code:
return u8"_eosio_ui64_to_f32";
return "_eosio_ui64_to_f32";
case wasm_ops::f64_convert_s_i32_code:
return u8"_eosio_i32_to_f64";
return "_eosio_i32_to_f64";
case wasm_ops::f64_convert_u_i32_code:
return u8"_eosio_ui32_to_f64";
return "_eosio_ui32_to_f64";
case wasm_ops::f64_convert_s_i64_code:
return u8"_eosio_i64_to_f64";
return "_eosio_i64_to_f64";
case wasm_ops::f64_convert_u_i64_code:
return u8"_eosio_ui64_to_f64";
return "_eosio_ui64_to_f64";
default:
FC_THROW_EXCEPTION( eosio::chain::wasm_execution_error, "Error, unknown opcode in injection ${op}", ("op", opcode));
@@ -483,7 +483,7 @@ namespace eosio { namespace chain { namespace wasm_injections {
static void init() {}
static void accept( wasm_ops::instr* inst, wasm_ops::visitor_arg& arg ) {
int32_t idx;
injector_utils::add_import<ResultType::f64, ValueType::f32>( *(arg.module), u8"_eosio_f32_promote", idx );
injector_utils::add_import<ResultType::f64, ValueType::f32>( *(arg.module), "_eosio_f32_promote", idx );
wasm_ops::op_types<>::call_t f32promote;
f32promote.field = idx;
f32promote.pack(arg.new_code);
@@ -496,7 +496,7 @@ namespace eosio { namespace chain { namespace wasm_injections {
static void init() {}
static void accept( wasm_ops::instr* inst, wasm_ops::visitor_arg& arg ) {
int32_t idx;
injector_utils::add_import<ResultType::f32, ValueType::f64>( *(arg.module), u8"_eosio_f64_demote", idx );
injector_utils::add_import<ResultType::f32, ValueType::f64>( *(arg.module), "_eosio_f64_demote", idx );
wasm_ops::op_types<>::call_t f32promote;
f32promote.field = idx;
f32promote.pack(arg.new_code);
@@ -4,8 +4,6 @@
#include <eosio/chain/whitelisted_intrinsics.hpp>
#include <eosio/chain/exceptions.hpp>
#include <functional>
#include "Runtime/Linker.h"
#include "Runtime/Runtime.h"
namespace eosio { namespace chain {
@@ -42,7 +40,7 @@ namespace eosio { namespace chain {
}
}
wasm_interface(vm_type vm, bool eosvmoc_tierup, const chainbase::database& d, const boost::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, bool profile);
wasm_interface(vm_type vm, bool eosvmoc_tierup, const chainbase::database& d, const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, bool profile);
~wasm_interface();
// initialize exec per thread
@@ -63,9 +61,6 @@ namespace eosio { namespace chain {
//Calls apply or error on a given code
void apply(const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version, apply_context& context);
//Immediately exits currently running wasm. UB is called when no wasm running
void exit();
//Returns true if the code is cached
bool is_code_cached(const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) const;
@@ -15,7 +15,6 @@
#include <fc/scoped_exit.hpp>
#include "IR/Module.h"
#include "Runtime/Intrinsics.h"
#include "Platform/Platform.h"
#include "WAST/WAST.h"
#include "IR/Validate.h"
@@ -26,7 +25,6 @@
using namespace fc;
using namespace eosio::chain::webassembly;
using namespace IR;
using namespace Runtime;
using boost::multi_index_container;
@@ -37,7 +35,6 @@ namespace eosio { namespace chain {
struct wasm_interface_impl {
struct wasm_cache_entry {
digest_type code_hash;
uint32_t first_block_num_used;
uint32_t last_block_num_used;
std::unique_ptr<wasm_instantiated_module_interface> module;
uint8_t vm_type = 0;
@@ -49,7 +46,7 @@ namespace eosio { namespace chain {
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
struct eosvmoc_tier {
eosvmoc_tier(const boost::filesystem::path& d, const eosvmoc::config& c, const chainbase::database& db)
eosvmoc_tier(const std::filesystem::path& d, const eosvmoc::config& c, const chainbase::database& db)
: cc(d, c, db) {
// construct exec for the main thread
init_thread_local_data();
@@ -68,7 +65,7 @@ namespace eosio { namespace chain {
};
#endif
wasm_interface_impl(wasm_interface::vm_type vm, bool eosvmoc_tierup, const chainbase::database& d, const boost::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, bool profile) : db(d), wasm_runtime_time(vm) {
wasm_interface_impl(wasm_interface::vm_type vm, bool eosvmoc_tierup, const chainbase::database& d, const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, bool profile) : db(d), wasm_runtime_time(vm) {
#ifdef EOSIO_EOS_VM_RUNTIME_ENABLED
if(vm == wasm_interface::vm_type::eos_vm)
runtime_interface = std::make_unique<webassembly::eos_vm_runtime::eos_vm_runtime<eosio::vm::interpreter>>();
@@ -109,24 +106,6 @@ namespace eosio { namespace chain {
return it != wasm_instantiation_cache.end();
}
std::vector<uint8_t> parse_initial_memory(const Module& module) {
std::vector<uint8_t> mem_image;
for(const DataSegment& data_segment : module.dataSegments) {
EOS_ASSERT(data_segment.baseOffset.type == InitializerExpression::Type::i32_const, wasm_exception, "");
EOS_ASSERT(module.memories.defs.size(), wasm_exception, "");
const U32 base_offset = data_segment.baseOffset.i32;
const Uptr memory_size = (module.memories.defs[0].type.size.min << IR::numBytesPerPageLog2);
if(base_offset >= memory_size || base_offset + data_segment.data.size() > memory_size)
FC_THROW_EXCEPTION(wasm_execution_error, "WASM data segment outside of valid memory range");
if(base_offset + data_segment.data.size() > mem_image.size())
mem_image.resize(base_offset + data_segment.data.size(), 0x00);
memcpy(mem_image.data() + base_offset, data_segment.data.data(), data_segment.data.size());
}
return mem_image;
}
void code_block_num_last_used(const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version, const uint32_t& block_num) {
wasm_cache_index::iterator it = wasm_instantiation_cache.find(boost::make_tuple(code_hash, vm_type, vm_version));
if(it != wasm_instantiation_cache.end())
@@ -157,7 +136,6 @@ namespace eosio { namespace chain {
it = wasm_instantiation_cache.emplace( wasm_interface_impl::wasm_cache_entry{
.code_hash = code_hash,
.first_block_num_used = codeobject->first_block_used,
.last_block_num_used = UINT32_MAX,
.module = nullptr,
.vm_type = vm_type,
@@ -173,24 +151,8 @@ namespace eosio { namespace chain {
trx_context.resume_billing_timer();
});
trx_context.pause_billing_timer();
IR::Module module;
std::vector<U8> bytes = {
(const U8*)codeobject->code.data(),
(const U8*)codeobject->code.data() + codeobject->code.size()};
try {
Serialization::MemoryInputStream stream((const U8*)bytes.data(),
bytes.size());
WASM::scoped_skip_checks no_check;
WASM::serialize(stream, module);
module.userSections.clear();
} catch (const Serialization::FatalSerializationException& e) {
EOS_ASSERT(false, wasm_serialization_error, e.message.c_str());
} catch (const IR::ValidationException& e) {
EOS_ASSERT(false, wasm_serialization_error, e.message.c_str());
}
wasm_instantiation_cache.modify(it, [&](auto& c) {
c.module = runtime_interface->instantiate_module((const char*)bytes.data(), bytes.size(), parse_initial_memory(module), code_hash, vm_type, vm_version);
c.module = runtime_interface->instantiate_module(codeobject->code.data(), codeobject->code.size(), code_hash, vm_type, vm_version);
});
}
return it->module;
@@ -209,7 +171,6 @@ namespace eosio { namespace chain {
member<wasm_cache_entry, uint8_t, &wasm_cache_entry::vm_version>
>
>,
ordered_non_unique<tag<by_first_block_num>, member<wasm_cache_entry, uint32_t, &wasm_cache_entry::first_block_num_used>>,
ordered_non_unique<tag<by_last_block_num>, member<wasm_cache_entry, uint32_t, &wasm_cache_entry::last_block_num_used>>
>
> wasm_cache_index;
@@ -19,7 +19,6 @@
namespace eosio { namespace chain { namespace webassembly { namespace eosvmoc {
using namespace IR;
using namespace Runtime;
using namespace fc;
using namespace eosio::chain::eosvmoc;
@@ -28,12 +27,11 @@ class eosvmoc_instantiated_module;
class eosvmoc_runtime : public eosio::chain::wasm_runtime_interface {
public:
eosvmoc_runtime(const boost::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db);
eosvmoc_runtime(const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db);
~eosvmoc_runtime();
std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t> initial_memory,
std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size,
const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) override;
void immediately_exit_currently_running_module() override;
void init_thread_local_data() override;
friend eosvmoc_instantiated_module;
@@ -31,21 +31,27 @@ using namespace boost::multi_index;
using namespace boost::asio;
namespace bip = boost::interprocess;
namespace bfs = boost::filesystem;
using allocator_t = bip::rbtree_best_fit<bip::null_mutex_family, bip::offset_ptr<void>, alignof(std::max_align_t)>;
struct config;
class code_cache_base {
public:
code_cache_base(const bfs::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db);
code_cache_base(const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db);
~code_cache_base();
const int& fd() const { return _cache_fd; }
void free_code(const digest_type& code_id, const uint8_t& vm_version);
// get_descriptor_for_code failure reasons
enum class get_cd_failure {
temporary, // oc compile not done yet, users like read-only trxs can retry
permanent // oc will not start, users should not retry
};
protected:
struct by_hash;
@@ -65,8 +71,8 @@ class code_cache_base {
const chainbase::database& _db;
bfs::path _cache_file_path;
int _cache_fd;
std::filesystem::path _cache_file_path;
int _cache_fd;
io_context _ctx;
local::datagram_protocol::socket _compile_monitor_write_socket{_ctx};
@@ -85,20 +91,17 @@ class code_cache_base {
template <typename T>
void serialize_cache_index(fc::datastream<T>& ds);
std::thread::id _main_thread_id;
bool is_main_thread() const;
};
class code_cache_async : public code_cache_base {
public:
code_cache_async(const bfs::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db);
code_cache_async(const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db);
~code_cache_async();
//If code is in cache: returns pointer & bumps to front of MRU list
//If code is not in cache, and not blacklisted, and not currently compiling: return nullptr and kick off compile
//otherwise: return nullptr
const code_descriptor* const get_descriptor_for_code(const digest_type& code_id, const uint8_t& vm_version);
const code_descriptor* const get_descriptor_for_code(const digest_type& code_id, const uint8_t& vm_version, bool is_write_window, get_cd_failure& failure);
private:
std::thread _monitor_reply_thread;
@@ -115,7 +118,7 @@ class code_cache_sync : public code_cache_base {
~code_cache_sync();
//Can still fail and return nullptr if, for example, there is an expected instantiation failure
const code_descriptor* const get_descriptor_for_code_sync(const digest_type& code_id, const uint8_t& vm_version);
const code_descriptor* const get_descriptor_for_code_sync(const digest_type& code_id, const uint8_t& vm_version, bool is_write_window);
};
}}}
@@ -5,7 +5,6 @@
#include <vector>
#include <string>
#include <boost/filesystem/path.hpp>
#include <fc/reflect/reflect.hpp>
namespace eosio { namespace chain { namespace eosvmoc {
@@ -43,15 +43,11 @@ template<typename Backend>
class eos_vm_runtime : public eosio::chain::wasm_runtime_interface {
public:
eos_vm_runtime();
std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t>,
std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size,
const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) override;
void immediately_exit_currently_running_module() override;
private:
// todo: managing this will get more complicated with sync calls;
// immediately_exit_currently_running_module() should probably
// move from wasm_runtime_interface to wasm_instantiated_module_interface.
eos_vm_backend_t<Backend>* _bkend = nullptr; // non owning pointer to allow for immediate exit
template<typename Impl>
@@ -61,10 +57,8 @@ class eos_vm_runtime : public eosio::chain::wasm_runtime_interface {
class eos_vm_profile_runtime : public eosio::chain::wasm_runtime_interface {
public:
eos_vm_profile_runtime();
std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t>,
std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size,
const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) override;
void immediately_exit_currently_running_module() override;
};
}}}}// eosio::chain::webassembly::eos_vm_runtime
@@ -20,12 +20,9 @@ class wasm_instantiated_module_interface {
class wasm_runtime_interface {
public:
virtual std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t> initial_memory,
virtual std::unique_ptr<wasm_instantiated_module_interface> instantiate_module(const char* code_bytes, size_t code_size,
const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) = 0;
//immediately exit the currently running wasm_instantiated_module_interface. Yep, this assumes only one can possibly run at a time.
virtual void immediately_exit_currently_running_module() = 0;
virtual ~wasm_runtime_interface();
// eosvmoc_runtime needs this
@@ -11,9 +11,18 @@
#include <sys/event.h>
// this makes kqueue calls compatible with FreeBSD and this timer can be safely used
#if defined(__FreeBSD__)
#define EV_SET64(kev, ident, filter, flags, fflags, data, udata, ext0, ext1) EV_SET(kev, ident, filter, flags, fflags, data, reinterpret_cast<void*>(udata))
#define kevent64(kq, changelist, nchanges, eventlist, nevents, flags, timeout) kevent(kq, changelist, nchanges, eventlist, nevents, timeout)
#define kevent64_s kevent
#define KEVENT_FLAG_IMMEDIATE 0
#define NOTE_CRITICAL 0
#endif
namespace eosio { namespace chain {
//a kqueue & thread is shared for all platform_timer_macos instances
// a kqueue & thread is shared for all platform_timer_macos instances
static std::mutex timer_ref_mutex;
static unsigned next_timerid;
static unsigned refcount;
+17 -17
View File
@@ -780,34 +780,34 @@ Enables new `get_block_num` intrinsic which returns the current block number.
}
}
std::optional<builtin_protocol_feature> read_builtin_protocol_feature( const fc::path& p ) {
std::optional<builtin_protocol_feature> read_builtin_protocol_feature( const std::filesystem::path& p ) {
try {
return fc::json::from_file<builtin_protocol_feature>( p );
} catch( const fc::exception& e ) {
wlog( "problem encountered while reading '${path}':\n${details}",
("path", p.generic_string())("details",e.to_detail_string()) );
("path", p)("details",e.to_detail_string()) );
} catch( ... ) {
dlog( "unknown problem encountered while reading '${path}'",
("path", p.generic_string()) );
("path", p) );
}
return {};
}
protocol_feature_set initialize_protocol_features( const fc::path& p, bool populate_missing_builtins ) {
using boost::filesystem::directory_iterator;
protocol_feature_set initialize_protocol_features( const std::filesystem::path& p, bool populate_missing_builtins ) {
using std::filesystem::directory_iterator;
protocol_feature_set pfs;
bool directory_exists = true;
if( fc::exists( p ) ) {
EOS_ASSERT( fc::is_directory( p ), plugin_exception,
if( std::filesystem::exists( p ) ) {
EOS_ASSERT( std::filesystem::is_directory( p ), plugin_exception,
"Path to protocol-features is not a directory: ${path}",
("path", p.generic_string())
("path", p)
);
} else {
if( populate_missing_builtins )
boost::filesystem::create_directories( p );
std::filesystem::create_directories( p );
else
directory_exists = false;
}
@@ -849,7 +849,7 @@ Enables new `get_block_num` intrinsic which returns the current block number.
}
};
map<builtin_protocol_feature_t, fc::path> found_builtin_protocol_features;
map<builtin_protocol_feature_t, std::filesystem::path> found_builtin_protocol_features;
map<digest_type, std::pair<builtin_protocol_feature, bool> > builtin_protocol_features_to_add;
// The bool in the pair is set to true if the builtin protocol feature has already been visited to add
map< builtin_protocol_feature_t, std::optional<digest_type> > visited_builtins;
@@ -858,7 +858,7 @@ Enables new `get_block_num` intrinsic which returns the current block number.
if( directory_exists ) {
for( directory_iterator enditr, itr{p}; itr != enditr; ++itr ) {
auto file_path = itr->path();
if( !fc::is_regular_file( file_path ) || file_path.extension().generic_string().compare( ".json" ) != 0 )
if( !std::filesystem::is_regular_file( file_path ) || file_path.extension().generic_string().compare( ".json" ) != 0 )
continue;
auto f = read_builtin_protocol_feature( file_path );
@@ -870,8 +870,8 @@ Enables new `get_block_num` intrinsic which returns the current block number.
EOS_ASSERT( res.second, plugin_exception,
"Builtin protocol feature '${codename}' was already included from a previous_file",
("codename", builtin_protocol_feature_codename(f->get_codename()))
("current_file", file_path.generic_string())
("previous_file", res.first->second.generic_string())
("current_file", file_path)
("previous_file", res.first->second)
);
const auto feature_digest = f->digest();
@@ -916,23 +916,23 @@ Enables new `get_block_num` intrinsic which returns the current block number.
auto file_path = p / filename;
EOS_ASSERT( !fc::exists( file_path ), plugin_exception,
EOS_ASSERT( !std::filesystem::exists( file_path ), plugin_exception,
"Could not save builtin protocol feature with codename '${codename}' because a file at the following path already exists: ${path}",
("codename", builtin_protocol_feature_codename( f.get_codename() ))
("path", file_path.generic_string())
("path", file_path)
);
if( fc::json::save_to_file( f, file_path ) ) {
ilog( "Saved default specification for builtin protocol feature '${codename}' (with digest of '${digest}') to: ${path}",
("codename", builtin_protocol_feature_codename(f.get_codename()))
("digest", feature_digest)
("path", file_path.generic_string())
("path", file_path)
);
} else {
elog( "Error occurred while writing default specification for builtin protocol feature '${codename}' (with digest of '${digest}') to: ${path}",
("codename", builtin_protocol_feature_codename(f.get_codename()))
("digest", feature_digest)
("path", file_path.generic_string())
("path", file_path)
);
}
};
+1 -1
View File
@@ -355,7 +355,7 @@ struct istream_json_snapshot_reader_impl {
istream_json_snapshot_reader::~istream_json_snapshot_reader() = default;
istream_json_snapshot_reader::istream_json_snapshot_reader(const fc::path& p)
istream_json_snapshot_reader::istream_json_snapshot_reader(const std::filesystem::path& p)
: impl{new istream_json_snapshot_reader_impl{0, 0, {}, {}}}
{
FILE* fp = fopen(p.string().c_str(), "rb");
+231
View File
@@ -0,0 +1,231 @@
#include <eosio/chain/controller.hpp>
#include <eosio/chain/exceptions.hpp>
#include <eosio/chain/pending_snapshot.hpp>
#include <eosio/chain/snapshot_scheduler.hpp>
#include <fc/scoped_exit.hpp>
namespace eosio::chain {
// snapshot_scheduler_listener
void snapshot_scheduler::on_start_block(uint32_t height, chain::controller& chain) {
bool snapshot_executed = false;
auto execute_snapshot_with_log = [this, height, &snapshot_executed, &chain](const auto& req) {
// one snapshot per height
if(!snapshot_executed) {
dlog("snapshot scheduler creating a snapshot from the request [start_block_num:${start_block_num}, end_block_num=${end_block_num}, block_spacing=${block_spacing}], height=${height}",
("start_block_num", req.start_block_num)("end_block_num", req.end_block_num)("block_spacing", req.block_spacing)("height", height));
execute_snapshot(req.snapshot_request_id, chain);
snapshot_executed = true;
}
};
std::vector<uint32_t> unschedule_snapshot_request_ids;
for(const auto& req: _snapshot_requests.get<0>()) {
// -1 since its called from start block
bool recurring_snapshot = req.block_spacing && (height >= req.start_block_num + 1) && (!((height - req.start_block_num - 1) % req.block_spacing));
bool onetime_snapshot = (!req.block_spacing) && (height == req.start_block_num + 1);
bool marked_for_deletion = ((!req.block_spacing) && (height >= req.start_block_num + 1)) || // if one time snapshot executed or scheduled for the past, it should be gone
(height > 0 && ((height-1) >= req.end_block_num)); // any snapshot can expire by end block num (end_block_num can be max value)
if(recurring_snapshot || onetime_snapshot) {
execute_snapshot_with_log(req);
}
// cleanup - remove expired (or invalid) request
if(marked_for_deletion) {
unschedule_snapshot_request_ids.push_back(req.snapshot_request_id);
}
}
for(const auto& i: unschedule_snapshot_request_ids) {
unschedule_snapshot(i);
}
}
void snapshot_scheduler::on_irreversible_block(const signed_block_ptr& lib, const chain::controller& chain) {
auto& snapshots_by_height = _pending_snapshot_index.get<by_height>();
uint32_t lib_height = lib->block_num();
while(!snapshots_by_height.empty() && snapshots_by_height.begin()->get_height() <= lib_height) {
const auto& pending = snapshots_by_height.begin();
auto next = pending->next;
try {
next(pending->finalize(chain));
}
CATCH_AND_CALL(next);
snapshots_by_height.erase(snapshots_by_height.begin());
}
}
snapshot_scheduler::snapshot_schedule_result snapshot_scheduler::schedule_snapshot(const snapshot_request_information& sri) {
auto& snapshot_by_value = _snapshot_requests.get<by_snapshot_value>();
auto existing = snapshot_by_value.find(std::make_tuple(sri.block_spacing, sri.start_block_num, sri.end_block_num));
EOS_ASSERT(existing == snapshot_by_value.end(), chain::duplicate_snapshot_request, "Duplicate snapshot request");
EOS_ASSERT(sri.start_block_num <= sri.end_block_num, chain::invalid_snapshot_request, "End block number should be greater or equal to start block number");
EOS_ASSERT(sri.start_block_num + sri.block_spacing <= sri.end_block_num, chain::invalid_snapshot_request, "Block spacing exceeds defined by start and end range");
_snapshot_requests.emplace(snapshot_schedule_information{{_snapshot_id++}, {sri.block_spacing, sri.start_block_num, sri.end_block_num, sri.snapshot_description}, {}});
x_serialize();
// returning snapshot_schedule_result
return snapshot_schedule_result{{_snapshot_id - 1}, {sri.block_spacing, sri.start_block_num, sri.end_block_num, sri.snapshot_description}};
}
snapshot_scheduler::snapshot_schedule_result snapshot_scheduler::unschedule_snapshot(uint32_t sri) {
auto& snapshot_by_id = _snapshot_requests.get<by_snapshot_id>();
auto existing = snapshot_by_id.find(sri);
EOS_ASSERT(existing != snapshot_by_id.end(), chain::snapshot_request_not_found, "Snapshot request not found");
snapshot_schedule_result result{{existing->snapshot_request_id}, {existing->block_spacing, existing->start_block_num, existing->end_block_num, existing->snapshot_description}};
_snapshot_requests.erase(existing);
x_serialize();
// returning snapshot_schedule_result
return result;
}
snapshot_scheduler::get_snapshot_requests_result snapshot_scheduler::get_snapshot_requests() {
get_snapshot_requests_result result;
auto& asvector = _snapshot_requests.get<as_vector>();
result.snapshot_requests.reserve(asvector.size());
result.snapshot_requests.insert(result.snapshot_requests.begin(), asvector.begin(), asvector.end());
return result;
}
void snapshot_scheduler::set_db_path(fs::path db_path) {
_snapshot_db.set_path(std::move(db_path));
// init from db
if(std::filesystem::exists(_snapshot_db.get_json_path())) {
std::vector<snapshot_schedule_information> sr;
_snapshot_db >> sr;
// if db read succeeded, clear/load
_snapshot_requests.get<by_snapshot_id>().clear();
_snapshot_requests.insert(sr.begin(), sr.end());
}
}
void snapshot_scheduler::set_snapshots_path(fs::path sn_path) {
_snapshots_dir = std::move(sn_path);
}
void snapshot_scheduler::add_pending_snapshot_info(const snapshot_information& si) {
auto& snapshot_by_id = _snapshot_requests.get<by_snapshot_id>();
auto snapshot_req = snapshot_by_id.find(_inflight_sid);
if(snapshot_req != snapshot_by_id.end()) {
_snapshot_requests.modify(snapshot_req, [&si](auto& p) {
p.pending_snapshots.emplace_back(si);
});
}
}
void snapshot_scheduler::execute_snapshot(uint32_t srid, chain::controller& chain) {
_inflight_sid = srid;
auto next = [srid, this](const chain::next_function_variant<snapshot_information>& result) {
if(std::holds_alternative<fc::exception_ptr>(result)) {
try {
std::get<fc::exception_ptr>(result)->dynamic_rethrow_exception();
} catch(const fc::exception& e) {
EOS_THROW(snapshot_execution_exception,
"Snapshot creation error: ${details}",
("details", e.to_detail_string()));
} catch(const std::exception& e) {
EOS_THROW(snapshot_execution_exception,
"Snapshot creation error: ${details}",
("details", e.what()));
}
} else {
// success, snapshot finalized
auto snapshot_info = std::get<snapshot_information>(result);
auto& snapshot_by_id = _snapshot_requests.get<by_snapshot_id>();
auto snapshot_req = snapshot_by_id.find(srid);
if(snapshot_req != snapshot_by_id.end()) {
_snapshot_requests.modify(snapshot_req, [&](auto& p) {
auto& pending = p.pending_snapshots;
auto it = std::remove_if(pending.begin(), pending.end(), [&snapshot_info](const snapshot_information& s) { return s.head_block_num <= snapshot_info.head_block_num; });
pending.erase(it, pending.end());
});
}
}
};
create_snapshot(next, chain, {});
}
void snapshot_scheduler::create_snapshot(next_function<snapshot_information> next, chain::controller& chain, std::function<void(void)> predicate) {
auto head_id = chain.head_block_id();
const auto head_block_num = chain.head_block_num();
const auto head_block_time = chain.head_block_time();
const auto& snapshot_path = pending_snapshot<snapshot_information>::get_final_path(head_id, _snapshots_dir);
const auto& temp_path = pending_snapshot<snapshot_information>::get_temp_path(head_id, _snapshots_dir);
// maintain legacy exception if the snapshot exists
if(fs::is_regular_file(snapshot_path)) {
auto ex = snapshot_exists_exception(FC_LOG_MESSAGE(error, "snapshot named ${name} already exists", ("name", _snapshots_dir)));
next(ex.dynamic_copy_exception());
return;
}
auto write_snapshot = [&](const fs::path& p) -> void {
if(predicate) predicate();
fs::create_directory(p.parent_path());
auto snap_out = std::ofstream(p.generic_string(), (std::ios::out | std::ios::binary));
auto writer = std::make_shared<ostream_snapshot_writer>(snap_out);
chain.write_snapshot(writer);
writer->finalize();
snap_out.flush();
snap_out.close();
};
// If in irreversible mode, create snapshot and return path to snapshot immediately.
if(chain.get_read_mode() == db_read_mode::IRREVERSIBLE) {
try {
write_snapshot(temp_path);
std::error_code ec;
fs::rename(temp_path, snapshot_path, ec);
EOS_ASSERT(!ec, snapshot_finalization_exception,
"Unable to finalize valid snapshot of block number ${bn}: [code: ${ec}] ${message}",
("bn", head_block_num)("ec", ec.value())("message", ec.message()));
next(snapshot_information{head_id, head_block_num, head_block_time, chain_snapshot_header::current_version, snapshot_path.generic_string()});
}
CATCH_AND_CALL(next);
return;
}
// Otherwise, the result will be returned when the snapshot becomes irreversible.
// determine if this snapshot is already in-flight
auto& pending_by_id = _pending_snapshot_index.get<by_id>();
auto existing = pending_by_id.find(head_id);
if(existing != pending_by_id.end()) {
// if a snapshot at this block is already pending, attach this requests handler to it
pending_by_id.modify(existing, [&next](auto& entry) {
entry.next = [prev = entry.next, next](const next_function_variant<snapshot_information>& res) {
prev(res);
next(res);
};
});
} else {
const auto& pending_path = pending_snapshot<snapshot_information>::get_pending_path(head_id, _snapshots_dir);
try {
write_snapshot(temp_path);// create a new pending snapshot
std::error_code ec;
fs::rename(temp_path, pending_path, ec);
EOS_ASSERT(!ec, snapshot_finalization_exception,
"Unable to promote temp snapshot to pending for block number ${bn}: [code: ${ec}] ${message}",
("bn", head_block_num)("ec", ec.value())("message", ec.message()));
_pending_snapshot_index.emplace(head_id, next, pending_path.generic_string(), snapshot_path.generic_string());
add_pending_snapshot_info(snapshot_information{head_id, head_block_num, head_block_time, chain_snapshot_header::current_version, pending_path.generic_string()});
}
CATCH_AND_CALL(next);
}
}
}// namespace eosio::chain
+21
View File
@@ -0,0 +1,21 @@
#include <eosio/chain/symbol.hpp>
#include <boost/algorithm/string.hpp>
namespace eosio::chain {
symbol symbol::from_string(const string& from)
{
try {
string s = boost::algorithm::trim_copy(from);
EOS_ASSERT(!s.empty(), symbol_type_exception, "creating symbol from empty string");
auto comma_pos = s.find(',');
EOS_ASSERT(comma_pos != string::npos, symbol_type_exception, "missing comma in symbol");
auto prec_part = s.substr(0, comma_pos);
uint8_t p = fc::to_int64(prec_part);
string name_part = s.substr(comma_pos + 1);
EOS_ASSERT( p <= max_precision, symbol_type_exception, "precision ${p} should be <= 18", ("p", p));
return symbol(string_to_symbol(p, name_part.c_str()));
} FC_CAPTURE_LOG_AND_RETHROW((from));
}
} // namespace eosio::chain
+3 -3
View File
@@ -469,7 +469,7 @@ namespace eosio { namespace chain {
"not enough time left in block to complete executing transaction ${billing_timer}us",
("now", now)("deadline", _deadline)("start", start)("billing_timer", now - pseudo_start) );
} else if( deadline_exception_code == tx_cpu_usage_exceeded::code_value ) {
std::string assert_msg = "transaction was executing for too long ${billing_timer}us";
std::string assert_msg = "transaction ${id} was executing for too long ${billing_timer}us";
if (subjective_cpu_bill_us > 0) {
assert_msg += " with a subjective cpu of (${subjective} us)";
}
@@ -477,10 +477,10 @@ namespace eosio { namespace chain {
assert_msg += get_tx_cpu_usage_exceeded_reason_msg(limit);
if (cpu_limit_due_to_greylist) {
assert_msg = "greylisted " + assert_msg;
EOS_THROW( greylist_cpu_usage_exceeded, assert_msg,
EOS_THROW( greylist_cpu_usage_exceeded, assert_msg, ("id", packed_trx.id())
("billing_timer", now - pseudo_start)("subjective", subjective_cpu_bill_us)("limit", limit) );
} else {
EOS_THROW( tx_cpu_usage_exceeded, assert_msg,
EOS_THROW( tx_cpu_usage_exceeded, assert_msg, ("id", packed_trx.id())
("billing_timer", now - pseudo_start)("subjective", subjective_cpu_bill_us)("limit", limit) );
}
} else if( deadline_exception_code == leeway_deadline_exception::code_value ) {
+10 -6
View File
@@ -32,7 +32,7 @@
namespace eosio { namespace chain {
wasm_interface::wasm_interface(vm_type vm, bool eosvmoc_tierup, const chainbase::database& d, const boost::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, bool profile)
wasm_interface::wasm_interface(vm_type vm, bool eosvmoc_tierup, const chainbase::database& d, const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, bool profile)
: my( new wasm_interface_impl(vm, eosvmoc_tierup, d, data_dir, eosvmoc_config, profile) ), vm( vm ) {}
wasm_interface::~wasm_interface() {}
@@ -92,8 +92,9 @@ namespace eosio { namespace chain {
#ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED
if(my->eosvmoc) {
const chain::eosvmoc::code_descriptor* cd = nullptr;
chain::eosvmoc::code_cache_base::get_cd_failure failure = chain::eosvmoc::code_cache_base::get_cd_failure::temporary;
try {
cd = my->eosvmoc->cc.get_descriptor_for_code(code_hash, vm_version);
cd = my->eosvmoc->cc.get_descriptor_for_code(code_hash, vm_version, context.control.is_write_window(), failure);
}
catch(...) {
//swallow errors here, if EOS VM OC has gone in to the weeds we shouldn't bail: continue to try and run baseline
@@ -107,15 +108,18 @@ namespace eosio { namespace chain {
my->eosvmoc->exec->execute(*cd, my->eosvmoc->mem, context);
return;
}
else if (context.trx_context.is_read_only()) {
if (failure == chain::eosvmoc::code_cache_base::get_cd_failure::temporary) {
EOS_ASSERT(false, ro_trx_vm_oc_compile_temporary_failure, "get_descriptor_for_code failed with temporary failure");
} else {
EOS_ASSERT(false, ro_trx_vm_oc_compile_permanent_failure, "get_descriptor_for_code failed with permanent failure");
}
}
}
#endif
my->get_instantiated_module(code_hash, vm_type, vm_version, context.trx_context)->apply(context);
}
void wasm_interface::exit() {
my->runtime_interface->immediately_exit_currently_running_module();
}
bool wasm_interface::is_code_cached(const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) const {
return my->is_code_cached(code_hash, vm_type, vm_version);
}
+2 -1
View File
@@ -45,7 +45,8 @@ namespace eosio { namespace chain { namespace webassembly {
}
}
//be aware that EOS VM OC handles eosio_exit internally and this function will not be called by OC
void interface::eosio_exit( int32_t code ) const {
context.control.get_wasm_interface().exit();
throw wasm_exit{};
}
}}} // ns eosio::chain::webassembly
+6 -2
View File
@@ -118,14 +118,18 @@ namespace eosio { namespace chain { namespace webassembly {
int32_t interface::alt_bn128_add(span<const char> op1, span<const char> op2, span<char> result ) const {
if (op1.size() != 64 || op2.size() != 64 || result.size() < 64 ||
bn256::g1_add({(const uint8_t*)op1.data(), 64}, {(const uint8_t*)op2.data(), 64}, { (uint8_t*)result.data(), 64}) == -1)
bn256::g1_add(std::span<const uint8_t, 64>{(const uint8_t*)op1.data(), 64},
std::span<const uint8_t, 64>{(const uint8_t*)op2.data(), 64},
std::span<uint8_t, 64>{ (uint8_t*)result.data(), 64}) == -1)
return return_code::failure;
return return_code::success;
}
int32_t interface::alt_bn128_mul(span<const char> g1_point, span<const char> scalar, span<char> result) const {
if (g1_point.size() != 64 || scalar.size() != 32 || result.size() < 64 ||
bn256::g1_scalar_mul({(const uint8_t*)g1_point.data(), 64}, {(const uint8_t*)scalar.data(), 32}, { (uint8_t*)result.data(), 64}) == -1)
bn256::g1_scalar_mul(std::span<const uint8_t, 64>{(const uint8_t*)g1_point.data(), 64},
std::span<const uint8_t, 32>{(const uint8_t*)scalar.data(), 32},
std::span<uint8_t, 64>{ (uint8_t*)result.data(), 64}) == -1)
return return_code::failure;
return return_code::success;
}
@@ -28,7 +28,7 @@ class eosvmoc_instantiated_module : public wasm_instantiated_module_interface {
bool is_main_thread() { return _main_thread_id == std::this_thread::get_id(); };
void apply(apply_context& context) override {
const code_descriptor* const cd = _eosvmoc_runtime.cc.get_descriptor_for_code_sync(_code_hash, _vm_version);
const code_descriptor* const cd = _eosvmoc_runtime.cc.get_descriptor_for_code_sync(_code_hash, _vm_version, context.control.is_write_window());
EOS_ASSERT(cd, wasm_execution_error, "EOS VM OC instantiation failed");
if ( is_main_thread() )
@@ -43,21 +43,18 @@ class eosvmoc_instantiated_module : public wasm_instantiated_module_interface {
std::thread::id _main_thread_id;
};
eosvmoc_runtime::eosvmoc_runtime(const boost::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db)
eosvmoc_runtime::eosvmoc_runtime(const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db)
: cc(data_dir, eosvmoc_config, db), exec(cc), mem(wasm_constraints::maximum_linear_memory/wasm_constraints::wasm_page_size) {
}
eosvmoc_runtime::~eosvmoc_runtime() {
}
std::unique_ptr<wasm_instantiated_module_interface> eosvmoc_runtime::instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t> initial_memory,
std::unique_ptr<wasm_instantiated_module_interface> eosvmoc_runtime::instantiate_module(const char* code_bytes, size_t code_size,
const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) {
return std::make_unique<eosvmoc_instantiated_module>(code_hash, vm_type, *this);
}
//never called. EOS VM OC overrides eosio_exit to its own implementation
void eosvmoc_runtime::immediately_exit_currently_running_module() {}
void eosvmoc_runtime::init_thread_local_data() {
exec_thread_local = std::make_unique<eosvmoc::executor>(cc);
}
@@ -20,7 +20,6 @@
#include "LLVMJIT.h"
using namespace IR;
using namespace Runtime;
namespace eosio { namespace chain { namespace eosvmoc {
@@ -39,7 +38,7 @@ static constexpr size_t descriptor_ptr_from_file_start = header_offset + offseto
static_assert(sizeof(code_cache_header) <= header_size, "code_cache_header too big");
code_cache_async::code_cache_async(const bfs::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db) :
code_cache_async::code_cache_async(const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db) :
code_cache_base(data_dir, eosvmoc_config, db),
_result_queue(eosvmoc_config.threads * 2),
_threads(eosvmoc_config.threads)
@@ -107,10 +106,11 @@ std::tuple<size_t, size_t> code_cache_async::consume_compile_thread_queue() {
}
const code_descriptor* const code_cache_async::get_descriptor_for_code(const digest_type& code_id, const uint8_t& vm_version) {
const code_descriptor* const code_cache_async::get_descriptor_for_code(const digest_type& code_id, const uint8_t& vm_version, bool is_write_window, get_cd_failure& failure) {
//if there are any outstanding compiles, process the result queue now
//do this only on main thread (which is in single threaded write window)
if(is_main_thread() && _outstanding_compiles_and_poison.size()) {
//When app is in write window, all tasks are running sequentially and read-only threads
//are not running. Safe to update cache entries.
if(is_write_window && _outstanding_compiles_and_poison.size()) {
auto [count_processed, bytes_remaining] = consume_compile_thread_queue();
if(count_processed)
@@ -136,37 +136,48 @@ const code_descriptor* const code_cache_async::get_descriptor_for_code(const dig
//check for entry in cache
code_cache_index::index<by_hash>::type::iterator it = _cache_index.get<by_hash>().find(boost::make_tuple(code_id, vm_version));
if(it != _cache_index.get<by_hash>().end()) {
if (is_main_thread())
if (is_write_window)
_cache_index.relocate(_cache_index.begin(), _cache_index.project<0>(it));
return &*it;
}
if(!is_main_thread()) // on read-only thread
if(!is_write_window) {
failure = get_cd_failure::temporary; // Compile might not be done yet
return nullptr;
}
const code_tuple ct = code_tuple{code_id, vm_version};
if(_blacklist.find(ct) != _blacklist.end())
if(_blacklist.find(ct) != _blacklist.end()) {
failure = get_cd_failure::permanent; // Compile will not start
return nullptr;
}
if(auto it = _outstanding_compiles_and_poison.find(ct); it != _outstanding_compiles_and_poison.end()) {
failure = get_cd_failure::temporary; // Compile might not be done yet
it->second = false;
return nullptr;
}
if(_queued_compiles.find(ct) != _queued_compiles.end())
if(_queued_compiles.find(ct) != _queued_compiles.end()) {
failure = get_cd_failure::temporary; // Compile might not be done yet
return nullptr;
}
if(_outstanding_compiles_and_poison.size() >= _threads) {
_queued_compiles.emplace(ct);
failure = get_cd_failure::temporary; // Compile might not be done yet
return nullptr;
}
const code_object* const codeobject = _db.find<code_object,by_code_hash>(boost::make_tuple(code_id, 0, vm_version));
if(!codeobject) //should be impossible right?
if(!codeobject) { //should be impossible right?
failure = get_cd_failure::permanent; // Compile will not start
return nullptr;
}
_outstanding_compiles_and_poison.emplace(ct, false);
std::vector<wrapped_fd> fds_to_pass;
fds_to_pass.emplace_back(memfd_for_bytearray(codeobject->code));
write_message_with_fds(_compile_monitor_write_socket, compile_wasm_message{ ct }, fds_to_pass);
failure = get_cd_failure::temporary; // Compile might not be done yet
return nullptr;
}
@@ -179,15 +190,15 @@ code_cache_sync::~code_cache_sync() {
elog("unexpected response from EOS VM OC compile monitor during shutdown");
}
const code_descriptor* const code_cache_sync::get_descriptor_for_code_sync(const digest_type& code_id, const uint8_t& vm_version) {
const code_descriptor* const code_cache_sync::get_descriptor_for_code_sync(const digest_type& code_id, const uint8_t& vm_version, bool is_write_window) {
//check for entry in cache
code_cache_index::index<by_hash>::type::iterator it = _cache_index.get<by_hash>().find(boost::make_tuple(code_id, vm_version));
if(it != _cache_index.get<by_hash>().end()) {
if (is_main_thread())
if (is_write_window)
_cache_index.relocate(_cache_index.begin(), _cache_index.project<0>(it));
return &*it;
}
if(!is_main_thread())
if(!is_write_window)
return nullptr;
const code_object* const codeobject = _db.find<code_object,by_code_hash>(boost::make_tuple(code_id, 0, vm_version));
@@ -210,20 +221,19 @@ const code_descriptor* const code_cache_sync::get_descriptor_for_code_sync(const
return &*_cache_index.push_front(std::move(std::get<code_descriptor>(result.result))).first;
}
code_cache_base::code_cache_base(const boost::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db) :
code_cache_base::code_cache_base(const std::filesystem::path data_dir, const eosvmoc::config& eosvmoc_config, const chainbase::database& db) :
_db(db),
_cache_file_path(data_dir/"code_cache.bin"),
_main_thread_id(std::this_thread::get_id())
_cache_file_path(data_dir/"code_cache.bin")
{
static_assert(sizeof(allocator_t) <= header_offset, "header offset intersects with allocator");
bfs::create_directories(data_dir);
std::filesystem::create_directories(data_dir);
if(!bfs::exists(_cache_file_path)) {
if(!std::filesystem::exists(_cache_file_path)) {
EOS_ASSERT(eosvmoc_config.cache_size >= allocator_t::get_min_size(total_header_size), database_exception, "configured code cache size is too small");
std::ofstream ofs(_cache_file_path.generic_string(), std::ofstream::trunc);
EOS_ASSERT(ofs.good(), database_exception, "unable to create EOS VM Optimized Compiler code cache");
bfs::resize_file(_cache_file_path, eosvmoc_config.cache_size);
std::filesystem::resize_file(_cache_file_path, eosvmoc_config.cache_size);
bip::file_mapping creation_mapping(_cache_file_path.generic_string().c_str(), bip::read_write);
bip::mapped_region creation_region(creation_mapping, bip::read_write);
new (creation_region.get_address()) allocator_t(eosvmoc_config.cache_size, total_header_size);
@@ -244,9 +254,9 @@ code_cache_base::code_cache_base(const boost::filesystem::path data_dir, const e
set_on_disk_region_dirty(true);
auto existing_file_size = bfs::file_size(_cache_file_path);
auto existing_file_size = std::filesystem::file_size(_cache_file_path);
if(eosvmoc_config.cache_size > existing_file_size) {
bfs::resize_file(_cache_file_path, eosvmoc_config.cache_size);
std::filesystem::resize_file(_cache_file_path, eosvmoc_config.cache_size);
bip::file_mapping resize_mapping(_cache_file_path.generic_string().c_str(), bip::read_write);
bip::mapped_region resize_region(resize_mapping, bip::read_write);
@@ -390,8 +400,4 @@ void code_cache_base::check_eviction_threshold(size_t free_bytes) {
if(free_bytes < _free_bytes_eviction_threshold)
run_eviction_round();
}
bool code_cache_base::is_main_thread() const {
return _main_thread_id == std::this_thread::get_id();
}
}}}
@@ -15,6 +15,8 @@
#include <boost/hana/equal.hpp>
#include "IR/Types.h"
#include <asm/prctl.h>
#include <sys/prctl.h>
#include <sys/syscall.h>
@@ -234,12 +234,7 @@ template<typename Impl>
eos_vm_runtime<Impl>::eos_vm_runtime() {}
template<typename Impl>
void eos_vm_runtime<Impl>::immediately_exit_currently_running_module() {
throw wasm_exit{};
}
template<typename Impl>
std::unique_ptr<wasm_instantiated_module_interface> eos_vm_runtime<Impl>::instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t>,
std::unique_ptr<wasm_instantiated_module_interface> eos_vm_runtime<Impl>::instantiate_module(const char* code_bytes, size_t code_size,
const digest_type&, const uint8_t&, const uint8_t&) {
using backend_t = eos_vm_backend_t<Impl>;
@@ -261,11 +256,7 @@ template class eos_vm_runtime<eosio::vm::jit>;
eos_vm_profile_runtime::eos_vm_profile_runtime() {}
void eos_vm_profile_runtime::immediately_exit_currently_running_module() {
throw wasm_exit{};
}
std::unique_ptr<wasm_instantiated_module_interface> eos_vm_profile_runtime::instantiate_module(const char* code_bytes, size_t code_size, std::vector<uint8_t>,
std::unique_ptr<wasm_instantiated_module_interface> eos_vm_profile_runtime::instantiate_module(const char* code_bytes, size_t code_size,
const digest_type&, const uint8_t&, const uint8_t&) {
using backend_t = eosio::vm::backend<eos_vm_host_functions_t, eosio::vm::jit_profile, webassembly::eos_vm_runtime::apply_options, vm::profile_instr_map>;
@@ -1,87 +1,121 @@
#pragma once
#include <appbase/application_base.hpp>
#include <appbase/execution_priority_queue.hpp>
#include <eosio/chain/exec_pri_queue.hpp>
#include <chrono>
#include <mutex>
/*
* Custmomize appbase to support two-queue exector.
* Customize appbase to support two-queue executor.
*/
namespace appbase {
enum class exec_window {
read, // the window during which operations from read_only_trx_safe queue
// can be executed in app thread in parallel with read-only transactions
// in read-only transaction excuting threads.
write, // the window during which operations from both general and
// read_only_trx_safe queues can be executed in app thread,
// while read-only transactions are not executed in read-only
// transaction excuting threads.
read, // the window during which operations from read_only queue
// can be executed in parallel in the read-only thread pool
// as well as in the app thread.
write, // the window during which operations from both read_write and
// parallel queues can be executed in app thread,
// while read-only operations are not executed in read-only
// thread pool. The read-only thread pool is not active; only
// the main app thread is active.
};
enum class exec_queue {
read_only_trx_safe, // the queue storing operations which are safe to execute
// on app thread in parallel with read-only transactions
// in read-only transaction excuting threads.
general // the queue storing operations which can be only executed
// on the app thread while read-only transactions are
// not being executed in read-only threads
read_only, // the queue storing tasks which are safe to execute
// in parallel with other read-only tasks in the read-only
// thread pool as well as on the main app thread.
// Multi-thread safe as long as nothing is executed from the read_write queue.
read_write // the queue storing tasks which can be only executed
// on the app thread while read-only tasks are
// not being executed in read-only threads. Single threaded.
};
class two_queue_executor {
public:
// Trade off on returning to appbase exec() loop as the overhead of poll/run can be measurable for small running tasks.
// This adds to the total time that the main thread can be busy when a high priority task is waiting.
static constexpr uint16_t minimum_runtime_ms = 3;
template <typename Func>
auto post( int priority, exec_queue q, Func&& func ) {
if ( q == exec_queue::general )
return boost::asio::post(io_serv_, general_queue_.wrap(priority, --order_, std::forward<Func>(func)));
if ( q == exec_queue::read_write )
return boost::asio::post(io_serv_, read_write_queue_.wrap(priority, --order_, std::forward<Func>(func)));
else
return boost::asio::post(io_serv_, read_only_trx_safe_queue_.wrap(priority, --order_, std::forward<Func>(func)));
return boost::asio::post( io_serv_, read_only_queue_.wrap( priority, --order_, std::forward<Func>( func)));
}
// Legacy and deprecated. To be removed after cleaning up its uses in base appbase
template <typename Func>
auto post( int priority, Func&& func ) {
// safer to use general queue for unknown type of operation since operations
// from general queue are not executed in parallel with read-only transactions
return boost::asio::post(io_serv_, general_queue_.wrap(priority, --order_, std::forward<Func>(func)));
// safer to use read_write queue for unknown type of operation since operations
// from read_write queue are not executed in parallel with read-only operations
return boost::asio::post(io_serv_, read_write_queue_.wrap(priority, --order_, std::forward<Func>(func)));
}
boost::asio::io_service& get_io_service() { return io_serv_; }
bool execute_highest() {
if ( exec_window_ == exec_window::write ) {
if( !general_queue_.empty() && ( read_only_trx_safe_queue_.empty() || *read_only_trx_safe_queue_.top() < *general_queue_.top()) ) {
// general_queue_'s top function's priority greater than read_only_trx_safe_queue_'s top function's, or general_queue_ empty
general_queue_.execute_highest();
} else if( !read_only_trx_safe_queue_.empty() ) {
read_only_trx_safe_queue_.execute_highest();
// execute for at least minimum runtime
const auto end = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds(minimum_runtime_ms);
bool more = false;
while (true) {
if ( exec_window_ == exec_window::write ) {
// During write window only main thread is accessing anything in two_queue_executor, no locking required
if( !read_write_queue_.empty() && (read_only_queue_.empty() || *read_only_queue_.top() < *read_write_queue_.top()) ) {
// read_write_queue_'s top function's priority greater than read_only_queue_'s top function's, or read_only_queue_ empty
read_write_queue_.execute_highest();
} else if( !read_only_queue_.empty() ) {
read_only_queue_.execute_highest();
}
more = !read_only_queue_.empty() || !read_write_queue_.empty();
} else {
// When in read window, multiple threads including main app thread are accessing two_queue_executor, locking required
more = read_only_queue_.execute_highest_locked(false);
}
return !read_only_trx_safe_queue_.empty() || !general_queue_.empty();
} else {
return read_only_trx_safe_queue_.execute_highest();
if (!more || std::chrono::high_resolution_clock::now() > end)
break;
}
return more;
}
bool execute_highest_read_only() {
// execute for at least minimum runtime
const auto end = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds(minimum_runtime_ms);
bool more = false;
while (true) {
more = read_only_queue_.execute_highest_locked( true );
if (!more || std::chrono::high_resolution_clock::now() > end)
break;
}
return more;
}
template <typename Function>
boost::asio::executor_binder<Function, appbase::execution_priority_queue::executor>
boost::asio::executor_binder<Function, appbase::exec_pri_queue::executor>
wrap(int priority, exec_queue q, Function&& func ) {
if ( q == exec_queue::general )
return general_queue_.wrap(priority, --order_, std::forward<Function>(func));
if ( q == exec_queue::read_write )
return read_write_queue_.wrap(priority, --order_, std::forward<Function>(func));
else
return read_only_trx_safe_queue_.wrap(priority, --order_, std::forward<Function>(func));
return read_only_queue_.wrap( priority, --order_, std::forward<Function>( func));
}
void clear() {
read_only_trx_safe_queue_.clear();
general_queue_.clear();
read_only_queue_.clear();
read_write_queue_.clear();
}
void set_to_read_window() {
void set_to_read_window(uint32_t num_threads, std::function<bool()> should_exit) {
exec_window_ = exec_window::read;
read_only_queue_.enable_locking(num_threads, std::move(should_exit));
}
void set_to_write_window() {
exec_window_ = exec_window::write;
read_only_queue_.disable_locking();
}
bool is_read_window() const {
@@ -92,15 +126,15 @@ public:
return exec_window_ == exec_window::write;
}
auto& read_only_trx_safe_queue() { return read_only_trx_safe_queue_; }
auto& read_only_queue() { return read_only_queue_; }
auto& general_queue() { return general_queue_; }
auto& read_write_queue() { return read_write_queue_; }
// members are ordered taking into account that the last one is destructed first
private:
boost::asio::io_service io_serv_;
appbase::execution_priority_queue read_only_trx_safe_queue_;
appbase::execution_priority_queue general_queue_;
appbase::exec_pri_queue read_only_queue_;
appbase::exec_pri_queue read_write_queue_;
std::atomic<std::size_t> order_ { std::numeric_limits<size_t>::max() }; // to maintain FIFO ordering in both queues within priority
exec_window exec_window_ { exec_window::write };
};
@@ -0,0 +1,233 @@
#pragma once
#include <boost/asio.hpp>
#include <condition_variable>
#include <mutex>
#include <queue>
namespace appbase {
// adapted from: https://www.boost.org/doc/libs/1_69_0/doc/html/boost_asio/example/cpp11/invocation/prioritised_handlers.cpp
// Locking has to be coordinated by caller, use with care.
class exec_pri_queue : public boost::asio::execution_context
{
public:
void enable_locking(uint32_t num_threads, std::function<bool()> should_exit) {
assert(num_threads > 0 && num_waiting_ == 0);
lock_enabled_ = true;
max_waiting_ = num_threads;
should_exit_ = std::move(should_exit);
exiting_blocking_ = false;
}
void disable_locking() {
lock_enabled_ = false;
should_exit_ = [](){ assert(false); return true; }; // should not be called when locking is disabled
}
// called from appbase::application_base::exec poll_one() or run_one()
template <typename Function>
void add(int priority, size_t order, Function function)
{
std::unique_ptr<queued_handler_base> handler(new queued_handler<Function>(priority, order, std::move(function)));
if (lock_enabled_) {
std::lock_guard g( mtx_ );
handlers_.push( std::move( handler ) );
if (num_waiting_)
cond_.notify_one();
} else {
handlers_.push( std::move( handler ) );
}
}
// only call when no lock required
void clear()
{
handlers_ = prio_queue();
}
// only call when no lock required
bool execute_highest()
{
if( !handlers_.empty() ) {
handlers_.top()->execute();
handlers_.pop();
}
return !handlers_.empty();
}
private:
// has to be defined before use, auto return type
auto pop() {
auto t = std::move(const_cast<std::unique_ptr<queued_handler_base>&>(handlers_.top()));
handlers_.pop();
return t;
}
public:
bool execute_highest_locked(bool should_block) {
std::unique_lock g(mtx_);
if (should_block) {
++num_waiting_;
cond_.wait(g, [this](){
bool exit = exiting_blocking_ || should_exit_();
bool empty = handlers_.empty();
if (empty || exit) {
if (((empty && num_waiting_ == max_waiting_) || exit) && !exiting_blocking_) {
cond_.notify_all();
exiting_blocking_ = true;
}
return exit || exiting_blocking_; // same as calling should_exit(), but faster
}
return true;
});
--num_waiting_;
if (exiting_blocking_ || should_exit_())
return false;
}
if( handlers_.empty() )
return false;
auto t = pop();
g.unlock();
t->execute();
return true;
}
// Only call when locking disabled
size_t size() const { return handlers_.size(); }
// Only call when locking disabled
bool empty() const { return handlers_.empty(); }
// Only call when locking disabled
const auto& top() const { return handlers_.top(); }
class executor
{
public:
executor(exec_pri_queue& q, int p, size_t o)
: context_(q), priority_(p), order_(o)
{
}
exec_pri_queue& context() const noexcept
{
return context_;
}
template <typename Function, typename Allocator>
void dispatch(Function f, const Allocator&) const
{
context_.add(priority_, order_, std::move(f));
}
template <typename Function, typename Allocator>
void post(Function f, const Allocator&) const
{
context_.add(priority_, order_, std::move(f));
}
template <typename Function, typename Allocator>
void defer(Function f, const Allocator&) const
{
context_.add(priority_, order_, std::move(f));
}
void on_work_started() const noexcept {}
void on_work_finished() const noexcept {}
bool operator==(const executor& other) const noexcept
{
return order_ == other.order_ && &context_ == &other.context_ && priority_ == other.priority_;
}
bool operator!=(const executor& other) const noexcept
{
return !operator==(other);
}
private:
exec_pri_queue& context_;
int priority_;
size_t order_;
};
template <typename Function>
boost::asio::executor_binder<Function, executor>
wrap(int priority, size_t order, Function&& func)
{
return boost::asio::bind_executor( executor(*this, priority, order), std::forward<Function>(func) );
}
private:
class queued_handler_base
{
public:
queued_handler_base( int p, size_t order )
: priority_( p )
, order_( order )
{
}
virtual ~queued_handler_base() = default;
virtual void execute() = 0;
int priority() const { return priority_; }
// C++20
// friend std::weak_ordering operator<=>(const queued_handler_base&,
// const queued_handler_base&) noexcept = default;
friend bool operator<(const queued_handler_base& a,
const queued_handler_base& b) noexcept
{
return std::tie( a.priority_, a.order_ ) < std::tie( b.priority_, b.order_ );
}
private:
int priority_;
size_t order_;
};
template <typename Function>
class queued_handler : public queued_handler_base
{
public:
queued_handler(int p, size_t order, Function f)
: queued_handler_base( p, order )
, function_( std::move(f) )
{
}
void execute() override
{
function_();
}
private:
Function function_;
};
struct deref_less
{
template<typename Pointer>
bool operator()(const Pointer& a, const Pointer& b) noexcept(noexcept(*a < *b))
{
return *a < *b;
}
};
bool lock_enabled_ = false;
std::mutex mtx_;
std::condition_variable cond_;
uint32_t num_waiting_{0};
uint32_t max_waiting_{0};
bool exiting_blocking_{false};
std::function<bool()> should_exit_; // called holding mtx_
using prio_queue = std::priority_queue<std::unique_ptr<queued_handler_base>, std::deque<std::unique_ptr<queued_handler_base>>, deref_less>;
prio_queue handlers_;
};
} // appbase
@@ -27,28 +27,28 @@ BOOST_AUTO_TEST_CASE( default_exec_window ) {
// post functions
std::map<int, int> rslts {};
int seq_num = 0;
app->executor().post( priority::medium, exec_queue::read_only_trx_safe, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::general, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only_trx_safe, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_only_trx_safe, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::general, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only_trx_safe, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[7]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::read_only, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::read_write, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_only, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_write, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[7]=seq_num; ++seq_num; } );
// Stop app. Use the lowest priority to make sure this function to execute the last
app->executor().post( priority::lowest, exec_queue::read_only_trx_safe, [&]() {
// read_only_trx_safe_queue should only contain the current lambda function,
// and general_queue should have execute all its functions
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().size(), 1);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().size(), 0 );
app->executor().post( priority::lowest, exec_queue::read_only, [&]() {
// read_only_queue should only contain the current lambda function,
// and read_write_queue should have executed all its functions
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().size(), 1); // pop()s after execute
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().size(), 0 );
app->quit();
} );
app_thread.join();
// both queues are cleared after execution
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().empty(), true);
// exactly number of both queues' functions processed
BOOST_REQUIRE_EQUAL( rslts.size(), 8 );
@@ -64,40 +64,40 @@ BOOST_AUTO_TEST_CASE( default_exec_window ) {
BOOST_CHECK_LT( rslts[6], rslts[7] );
}
// verify functions only from read_only_trx_safe queue are processed during read window
// verify functions only from read_only queue are processed during read window
BOOST_AUTO_TEST_CASE( execute_from_read_queue ) {
appbase::scoped_app app;
auto app_thread = start_app_thread(app);
// set to run functions from read_only_trx_safe queue only
app->executor().set_to_read_window();
// set to run functions from read_only queue only
app->executor().set_to_read_window(1, [](){return false;});
// post functions
std::map<int, int> rslts {};
int seq_num = 0;
app->executor().post( priority::medium, exec_queue::general, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only_trx_safe, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only_trx_safe, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_only_trx_safe, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::general, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only_trx_safe, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only_trx_safe, [&]() { rslts[7]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only_trx_safe, [&]() { rslts[8]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[9]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::read_write, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_only, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_write, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only, [&]() { rslts[7]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_only, [&]() { rslts[8]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[9]=seq_num; ++seq_num; } );
// stop application. Use lowest at the end to make sure this executes the last
app->executor().post( priority::lowest, exec_queue::read_only_trx_safe, [&]() {
// read_queue should have current function and write_queue should have all its functions
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().size(), 1);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().size(), 4 );
app->executor().post( priority::lowest, exec_queue::read_only, [&]() {
// read_queue should be empty (read window pops before execute) and write_queue should have all its functions
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().size(), 0); // pop()s before execute
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().size(), 4 );
app->quit();
} );
app_thread.join();
// both queues are cleared after execution
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().empty(), true);
// exactly number of posts processed
BOOST_REQUIRE_EQUAL( rslts.size(), 6 );
@@ -109,40 +109,40 @@ BOOST_AUTO_TEST_CASE( execute_from_read_queue ) {
BOOST_CHECK_LT( rslts[3], rslts[4] );
}
// verify no functions are executed during read window if read_only_trx_safe queue is empty
// verify no functions are executed during read window if read_only queue is empty
BOOST_AUTO_TEST_CASE( execute_from_empty_read_queue ) {
appbase::scoped_app app;
auto app_thread = start_app_thread(app);
// set to run functions from read_only_trx_safe queue only
app->executor().set_to_read_window();
// set to run functions from read_only queue only
app->executor().set_to_read_window(1, [](){return false;});
// post functions
std::map<int, int> rslts {};
int seq_num = 0;
app->executor().post( priority::medium, exec_queue::general, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::general, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::general, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::general, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::general, [&]() { rslts[7]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[8]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[9]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::read_write, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_write, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_write, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_write, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_write, [&]() { rslts[7]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[8]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[9]=seq_num; ++seq_num; } );
// Stop application. Use lowest at the end to make sure this executes the last
app->executor().post( priority::lowest, exec_queue::read_only_trx_safe, [&]() {
// read_queue should have current function and write_queue should have all its functions
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().size(), 1);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().size(), 10 );
app->executor().post( priority::lowest, exec_queue::read_only, [&]() {
// read_queue should be empty (read window pops before execute) and write_queue should have all its functions
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().size(), 0); // pop()s before execute
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().size(), 10 );
app->quit();
} );
app_thread.join();
// both queues are cleared after execution
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().empty(), true);
// no results
BOOST_REQUIRE_EQUAL( rslts.size(), 0 );
@@ -159,32 +159,32 @@ BOOST_AUTO_TEST_CASE( execute_from_both_queues ) {
// post functions
std::map<int, int> rslts {};
int seq_num = 0;
app->executor().post( priority::medium, exec_queue::read_only_trx_safe, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::general, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::general, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::lowest, exec_queue::read_only_trx_safe, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_only_trx_safe, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::general, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only_trx_safe, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::general, [&]() { rslts[7]=seq_num; ++seq_num; } );
app->executor().post( priority::lowest, exec_queue::read_only_trx_safe, [&]() { rslts[8]=seq_num; ++seq_num; } );
app->executor().post( priority::lowest, exec_queue::read_only_trx_safe, [&]() { rslts[9]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::general, [&]() { rslts[10]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::general, [&]() { rslts[11]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::read_only, [&]() { rslts[0]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::read_write, [&]() { rslts[1]=seq_num; ++seq_num; } );
app->executor().post( priority::high, exec_queue::read_write, [&]() { rslts[2]=seq_num; ++seq_num; } );
app->executor().post( priority::lowest, exec_queue::read_only, [&]() { rslts[3]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_only, [&]() { rslts[4]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_write, [&]() { rslts[5]=seq_num; ++seq_num; } );
app->executor().post( priority::highest,exec_queue::read_only, [&]() { rslts[6]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_write, [&]() { rslts[7]=seq_num; ++seq_num; } );
app->executor().post( priority::lowest, exec_queue::read_only, [&]() { rslts[8]=seq_num; ++seq_num; } );
app->executor().post( priority::lowest, exec_queue::read_only, [&]() { rslts[9]=seq_num; ++seq_num; } );
app->executor().post( priority::low, exec_queue::read_write, [&]() { rslts[10]=seq_num; ++seq_num; } );
app->executor().post( priority::medium, exec_queue::read_write, [&]() { rslts[11]=seq_num; ++seq_num; } );
// stop application. Use lowest at the end to make sure this executes the last
app->executor().post( priority::lowest, exec_queue::read_only_trx_safe, [&]() {
app->executor().post( priority::lowest, exec_queue::read_only, [&]() {
// read_queue should have current function and write_queue's functions are all executed
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().size(), 1);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().size(), 0 );
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().size(), 1); // pop()s after execute
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().size(), 0 );
app->quit();
} );
app_thread.join();
// queues are emptied after quit
BOOST_REQUIRE_EQUAL( app->executor().read_only_trx_safe_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().general_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_only_queue().empty(), true);
BOOST_REQUIRE_EQUAL( app->executor().read_write_queue().empty(), true);
// exactly number of posts processed
BOOST_REQUIRE_EQUAL( rslts.size(), 12 );
+2 -11
View File
@@ -9,7 +9,6 @@ find_package(OpenSSL REQUIRED)
set( fc_sources
src/uint128.cpp
src/real128.cpp
src/variant.cpp
src/exception.cpp
src/variant_object.cpp
@@ -56,9 +55,6 @@ set( fc_sources
src/crypto/modular_arithmetic.cpp
src/crypto/blake2.cpp
src/crypto/k1_recover.cpp
src/network/ip.cpp
src/network/resolve.cpp
src/network/udp_socket.cpp
src/network/url.cpp
src/network/http/http_client.cpp
src/compress/zlib.cpp
@@ -97,7 +93,6 @@ endif()
find_package(Boost 1.66 REQUIRED COMPONENTS
date_time
filesystem
chrono
unit_test_framework
iostreams)
@@ -125,11 +120,7 @@ find_package(ZLIB REQUIRED)
target_include_directories(fc PUBLIC include)
# try and make this very clear that this json parser is intended only for webauthn parsing..
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.11.0)
set_source_files_properties(src/crypto/elliptic_webauthn.cpp PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include/fc/crypto/webauthn_json/include")
else()
set_source_files_properties(src/crypto/elliptic_webauthn.cpp PROPERTIES COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/include/fc/crypto/webauthn_json/include")
endif()
set_source_files_properties(src/crypto/elliptic_webauthn.cpp PROPERTIES COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/include/fc/crypto/webauthn_json/include")
if(WIN32)
target_link_libraries( fc PUBLIC ws2_32 mswsock userenv )
@@ -139,7 +130,7 @@ if(APPLE)
find_library(security_framework Security)
find_library(corefoundation_framework CoreFoundation)
endif()
target_link_libraries( fc PUBLIC Boost::date_time Boost::filesystem Boost::chrono Boost::iostreams Threads::Threads
target_link_libraries( fc PUBLIC Boost::date_time Boost::chrono Boost::iostreams Threads::Threads
OpenSSL::Crypto ZLIB::ZLIB ${PLATFORM_SPECIFIC_LIBS} ${CMAKE_DL_LIBS} secp256k1 ${security_framework} ${corefoundation_framework})
# Critically, this ensures that OpenSSL 1.1 & 3.0 both have a variant of BN_zero() with void return value. But it also allows access
-7
View File
@@ -1,7 +0,0 @@
#pragma once
#include <boost/any.hpp>
namespace fc {
// TODO: define this without using boost
typedef boost::any any;
}
-134
View File
@@ -1,134 +0,0 @@
#pragma once
#include <fc/thread/future.hpp>
#include <fc/any.hpp>
#include <functional>
#include <boost/config.hpp>
// ms visual c++ (as of 2013) doesn't accept the standard syntax for calling a
// templated member function (foo->template bar();)
#ifdef _MSC_VER
# define FC_CALL_MEMBER_TEMPLATE_KEYWORD
#else
# define FC_CALL_MEMBER_TEMPLATE_KEYWORD template
#endif
namespace fc {
struct identity_member {
template<typename R, typename C, typename P, typename... Args>
static std::function<R(Args...)> functor( P&& p, R (C::*mem_func)(Args...) );
template<typename R, typename C, typename P, typename... Args>
static std::function<R(Args...)> functor( P&& p, R (C::*mem_func)(Args...)const );
};
template< typename Interface, typename Transform >
struct vtable : public std::enable_shared_from_this<vtable<Interface,Transform>>
{ private: vtable(); };
template<typename OtherType>
struct vtable_copy_visitor {
typedef OtherType other_type;
vtable_copy_visitor( OtherType& s):_source( s ){}
template<typename R, typename MemberPtr, typename... Args>
void operator()( const char* name, std::function<R(Args...)>& memb, MemberPtr m )const {
OtherType* src = &_source;
memb = [src,m]( Args... args ){ return (src->*m)(args...); };
}
OtherType& _source;
};
template<typename Interface, typename Transform >
class api;
class api_connection;
typedef uint32_t api_id_type;
class api_base
{
public:
api_base() {}
virtual ~api_base() {}
virtual uint64_t get_handle()const = 0;
virtual api_id_type register_api( api_connection& conn )const = 0;
// defined in api_connection.hpp
template< typename T >
api<T, identity_member> as();
};
typedef std::shared_ptr< api_base > api_ptr;
class api_connection;
template<typename Interface, typename Transform = identity_member >
class api : public api_base {
public:
typedef vtable<Interface,Transform> vtable_type;
api():_vtable( std::make_shared<vtable_type>() ) {}
/** T is anything with pointer semantics */
template<typename T >
api( const T& p )
:_vtable( std::make_shared<vtable_type>() )
{
_data = std::make_shared<fc::any>(p);
T& ptr = boost::any_cast<T&>(*_data);
auto& pointed_at = *ptr;
typedef typename std::remove_reference<decltype(pointed_at)>::type source_vtable_type;
_vtable->FC_CALL_MEMBER_TEMPLATE_KEYWORD visit_other( vtable_copy_visitor<source_vtable_type>(pointed_at) );
}
api( const api& cpy ):_vtable(cpy._vtable),_data(cpy._data) {}
virtual ~api() {}
friend bool operator == ( const api& a, const api& b ) { return a._data == b._data && a._vtable == b._vtable; }
friend bool operator != ( const api& a, const api& b ) { return !(a._data == b._data && a._vtable == b._vtable); }
virtual uint64_t get_handle()const override { return uint64_t(_data.get()); }
virtual api_id_type register_api( api_connection& conn )const override; // defined in api_connection.hpp
vtable_type& operator*()const { FC_ASSERT( _vtable ); return *_vtable; }
vtable_type* operator->()const { FC_ASSERT( _vtable ); return _vtable.get(); }
protected:
std::shared_ptr<vtable_type> _vtable;
std::shared_ptr<fc::any> _data;
};
} // namespace fc
#include <boost/preprocessor/repeat.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/stringize.hpp>
#define FC_API_VTABLE_DEFINE_MEMBER( r, data, elem ) \
decltype(Transform::functor( (data*)nullptr, &data::elem)) elem;
#define FC_API_VTABLE_DEFINE_VISIT_OTHER( r, data, elem ) \
{ typedef typename Visitor::other_type OtherType; \
v( BOOST_PP_STRINGIZE(elem), elem, &OtherType::elem ); }
#define FC_API_VTABLE_DEFINE_VISIT( r, data, elem ) \
v( BOOST_PP_STRINGIZE(elem), elem );
#define FC_API( CLASS, METHODS ) \
namespace fc { \
template<typename Transform> \
struct vtable<CLASS,Transform> : public std::enable_shared_from_this<vtable<CLASS,Transform>> { \
BOOST_PP_SEQ_FOR_EACH( FC_API_VTABLE_DEFINE_MEMBER, CLASS, METHODS ) \
template<typename Visitor> \
void visit_other( Visitor&& v ){ \
BOOST_PP_SEQ_FOR_EACH( FC_API_VTABLE_DEFINE_VISIT_OTHER, CLASS, METHODS ) \
} \
template<typename Visitor> \
void visit( Visitor&& v ){ \
BOOST_PP_SEQ_FOR_EACH( FC_API_VTABLE_DEFINE_VISIT, CLASS, METHODS ) \
} \
}; \
}
+1 -1
View File
@@ -124,7 +124,7 @@ namespace fc {
{
static const char* name()
{
static std::string _name = std::string("fc::array<")+std::string(fc::get_typename<T>::name())+","+ fc::to_string(N) + ">";
static std::string _name = std::string("fc::array<")+std::string(fc::get_typename<T>::name())+","+ std::to_string(N) + ">";
return _name.c_str();
}
};
+2 -2
View File
@@ -1,10 +1,10 @@
#pragma once
#include <fc/string.hpp>
#include <string>
namespace fc
{
string zlib_compress(const string& in);
std::string zlib_compress(const std::string& in);
} // namespace fc
@@ -1,12 +0,0 @@
#pragma once
#include <deque>
#include <fc/io/raw.hpp>
namespace fc {
namespace raw {
} // namespace raw
} // namespace fc
+4 -5
View File
@@ -6,7 +6,6 @@
#include <vector>
namespace fc {
class path;
class aes_encoder
{
@@ -42,13 +41,13 @@ namespace fc {
std::vector<char> aes_decrypt( const fc::sha512& key, const std::vector<char>& cipher_text );
/** encrypts plain_text and then includes a checksum that enables us to verify the integrety of
* the file / key prior to decryption.
* the file / key prior to decryption.
*/
void aes_save( const fc::path& file, const fc::sha512& key, std::vector<char> plain_text );
void aes_save( const std::filesystem::path& file, const fc::sha512& key, std::vector<char> plain_text );
/**
* recovers the plain_text saved via aes_save()
*/
std::vector<char> aes_load( const fc::path& file, const fc::sha512& key );
std::vector<char> aes_load( const std::filesystem::path& file, const fc::sha512& key );
} // namespace fc
} // namespace fc
+1 -1
View File
@@ -55,7 +55,7 @@ namespace fc {
bigint operator--(int);
bigint& operator--();
operator fc::string()const;
operator std::string()const;
// returns bignum as bigendian bytes
operator std::vector<char>()const;
+2 -2
View File
@@ -105,7 +105,7 @@ namespace fc { namespace crypto {
auto data_str = to_base58( packed.data(), packed.size(), _yield );
_yield();
if (!is_default) {
data_str = string(Prefixes[position]) + "_" + data_str;
data_str = std::string(Prefixes[position]) + "_" + data_str;
}
_yield();
@@ -178,7 +178,7 @@ namespace fc { namespace crypto {
{}
shim(data_type&& data)
:_data(forward<data_type>(data))
:_data(std::move(data))
{}
shim(const data_type& data)
+3 -3
View File
@@ -1,15 +1,15 @@
#pragma once
#include <fc/string.hpp>
#include <fc/utility.hpp>
#include <string>
#include <vector>
namespace fc {
uint8_t from_hex( char c );
fc::string to_hex( const char* d, uint32_t s );
std::string to_hex( const char* d, uint32_t s );
std::string to_hex( const std::vector<char>& data );
/**
* @return the number of bytes decoded
*/
size_t from_hex( const fc::string& hex_str, char* out_data, size_t out_data_len );
size_t from_hex( const std::string& hex_str, char* out_data, size_t out_data_len );
}
@@ -10,14 +10,12 @@
#include <openssl/obj_mac.h>
#include <openssl/bn.h>
/**
/**
* @file openssl.hpp
* Provides common utility calls for wrapping openssl c api.
*/
namespace fc
namespace fc
{
class path;
template <typename ssl_type>
struct ssl_wrapper
{
@@ -46,14 +46,14 @@ namespace fc { namespace crypto {
}
// serialize to/from string
explicit private_key(const string& base58str);
explicit private_key(const std::string& base58str);
std::string to_string(const fc::yield_function_t& yield = fc::yield_function_t()) const;
private:
storage_type _storage;
private_key( storage_type&& other_storage )
:_storage(forward<storage_type>(other_storage))
:_storage(other_storage)
{}
friend bool operator == ( const private_key& p1, const private_key& p2);
@@ -31,7 +31,7 @@ namespace fc { namespace crypto {
public_key( const signature& c, const sha256& digest, bool check_canonical = true );
public_key( storage_type&& other_storage )
:_storage(forward<storage_type>(other_storage))
:_storage(std::move(other_storage))
{}
bool valid()const;
@@ -39,7 +39,7 @@ namespace fc { namespace crypto {
size_t which()const;
// serialize to/from string
explicit public_key(const string& base58str);
explicit public_key(const std::string& base58str);
std::string to_string(const fc::yield_function_t& yield = fc::yield_function_t()) const;
storage_type _storage;
@@ -12,10 +12,10 @@ class ripemd160
{
public:
ripemd160();
explicit ripemd160( const string& hex_str );
explicit ripemd160( const std::string& hex_str );
string str()const;
explicit operator string()const;
std::string str()const;
explicit operator std::string()const;
char* data()const;
size_t data_size()const { return 160/8; }
@@ -23,7 +23,7 @@ class ripemd160
static ripemd160 hash( const fc::sha512& h );
static ripemd160 hash( const fc::sha256& h );
static ripemd160 hash( const char* d, uint32_t dlen );
static ripemd160 hash( const string& );
static ripemd160 hash( const std::string& );
template<typename T>
static ripemd160 hash( const T& t )
+4 -4
View File
@@ -8,17 +8,17 @@ class sha1
{
public:
sha1();
explicit sha1( const string& hex_str );
explicit sha1( const std::string& hex_str );
string str()const;
operator string()const;
std::string str()const;
operator std::string()const;
char* data();
const char* data()const;
size_t data_size()const { return 20; }
static sha1 hash( const char* d, uint32_t dlen );
static sha1 hash( const string& );
static sha1 hash( const std::string& );
template<typename T>
static sha1 hash( const T& t )
+4 -4
View File
@@ -11,17 +11,17 @@ class sha224
{
public:
sha224();
explicit sha224( const string& hex_str );
explicit sha224( const std::string& hex_str );
string str()const;
operator string()const;
std::string str()const;
operator std::string()const;
char* data();
const char* data()const;
size_t data_size()const { return 224 / 8; }
static sha224 hash( const char* d, uint32_t dlen );
static sha224 hash( const string& );
static sha224 hash( const std::string& );
template<typename T>
static sha224 hash( const T& t )
+4 -4
View File
@@ -12,11 +12,11 @@ class sha256
{
public:
sha256();
explicit sha256( const string& hex_str );
explicit sha256( const std::string& hex_str );
explicit sha256( const char *data, size_t size );
string str()const;
operator string()const;
std::string str()const;
operator std::string()const;
const char* data()const;
char* data();
@@ -27,7 +27,7 @@ class sha256
}
static sha256 hash( const char* d, uint32_t dlen );
static sha256 hash( const string& );
static sha256 hash( const std::string& );
static sha256 hash( const sha256& );
template<typename T>
+4 -4
View File
@@ -13,11 +13,11 @@ class sha3
public:
sha3();
~sha3(){}
explicit sha3(const string &hex_str);
explicit sha3(const std::string &hex_str);
explicit sha3(const char *data, size_t size);
string str() const;
operator string() const;
std::string str() const;
operator std::string() const;
const char *data() const;
char* data();
@@ -29,7 +29,7 @@ public:
const auto& sha = e.result(is_nist);
return sha;
}
static sha3 hash(const string& s, bool is_nist=true) { return hash(s.c_str(), s.size(), is_nist); }
static sha3 hash(const std::string& s, bool is_nist=true) { return hash(s.c_str(), s.size(), is_nist); }
static sha3 hash(const sha3& s, bool is_nist=true) { return hash(s.data(), sizeof(s._hash), is_nist); }
template <typename T>
+4 -4
View File
@@ -9,17 +9,17 @@ class sha512
{
public:
sha512();
explicit sha512( const string& hex_str );
explicit sha512( const std::string& hex_str );
string str()const;
operator string()const;
std::string str()const;
operator std::string()const;
char* data();
const char* data()const;
size_t data_size()const { return 512 / 8; }
static sha512 hash( const char* d, uint32_t dlen );
static sha512 hash( const string& );
static sha512 hash( const std::string& );
template<typename T>
static sha512 hash( const T& t )
@@ -27,7 +27,7 @@ namespace fc { namespace crypto {
signature& operator= (const signature& ) = default;
// serialize to/from string
explicit signature(const string& base58str);
explicit signature(const std::string& base58str);
std::string to_string(const fc::yield_function_t& yield = fc::yield_function_t()) const;
size_t which() const;
@@ -38,7 +38,7 @@ namespace fc { namespace crypto {
storage_type _storage;
signature( storage_type&& other_storage )
:_storage(std::forward<storage_type>(other_storage))
:_storage(std::move(other_storage))
{}
friend bool operator == ( const signature& p1, const signature& p2);
+43 -246
View File
@@ -1,264 +1,61 @@
#pragma once
#include <utility>
#include <memory>
#include <utility>
#include <fc/string.hpp>
#include <fc/reflect/typename.hpp>
#include <fc/fwd.hpp>
#include <fc/reflect/typename.hpp>
#include <fc/string.hpp>
namespace boost {
namespace filesystem {
class path;
class directory_iterator;
class recursive_directory_iterator;
}
}
#include <filesystem>
namespace fc {
/**
* @brief wraps boost::filesystem::path to provide platform independent path manipulation.
*
* Most calls are simply a passthrough to boost::filesystem::path, however exceptions are
* wrapped in an fc::error_report and the additional helper method fc::path::windows_string(),
* can be used to calculate paths intended for systems different than the host.
*
* @note Serializes to a fc::value() as the result of generic_string()
*/
class path {
public:
path();
~path();
path( const boost::filesystem::path& );
path( const std::string& p );
/// Constructor to build path using unicode native characters.
path(const std::wstring& p);
path( const char* );
path( const path& p );
path( path&& p );
path& operator =( const path& );
path& operator =( path&& );
path& operator /=( const fc::path& );
friend path operator /( const fc::path& p, const fc::path& );
friend bool operator ==( const fc::path& p, const fc::path& );
friend bool operator !=( const fc::path& p, const fc::path& );
friend bool operator < ( const fc::path& p, const fc::path& );
/** @return the home directory on Linux and OS X and the Profile directory on Windows */
const std::filesystem::path& home_path();
operator boost::filesystem::path& ();
operator const boost::filesystem::path& ()const;
/** @return the home_path() on Linux, home_path()/Library/Application Support/ on OS X,
* and APPDATA on windows
*/
const std::filesystem::path& app_path();
void replace_extension( const fc::path& e );
fc::path stem()const;
fc::path extension()const;
fc::path filename()const;
fc::path parent_path()const;
std::string string()const;
std::string generic_string()const;
/** On windows, returns a path where all path separators are '\' suitable for displaying
* to users. On other platforms, it does the same as generic_string()
*/
std::string preferred_string() const;
class variant;
void to_variant(const std::filesystem::path&, fc::variant&);
void from_variant(const fc::variant&, std::filesystem::path&);
std::wstring wstring() const;
std::wstring generic_wstring() const;
std::wstring preferred_wstring() const;
template <>
struct get_typename<std::filesystem::path> {
static const char* name() { return "path"; }
};
/** Retrieves native string path representation and next converts it into
ANSI UTF-8 representation.
It is needed since not all parts of fc library accept unicode paths
(fc::file_mapping).
*/
std::string to_native_ansi_path() const;
class temp_directory {
std::filesystem::path tmp_path;
/**
* @brief replaces '/' with '\' in the result of generic_string()
*
* @note not part of boost::filesystem::path
*/
std::string windows_string()const;
public:
temp_directory(const std::filesystem::path& tempFolder = std::filesystem::temp_directory_path()) {
std::filesystem::path template_path{ tempFolder / "fc-XXXXXX" };
std::string tmp_buf = template_path.string();
// The following is valid because the return array of std::string::data() is null-terminated since C++11
if (mkdtemp(tmp_buf.data()) == nullptr)
throw std::system_error(errno, std::generic_category(), __PRETTY_FUNCTION__);
tmp_path = tmp_buf;
}
temp_directory(const temp_directory&) = delete;
temp_directory(temp_directory&& other) { tmp_path.swap(other.tmp_path); }
bool is_relative()const;
bool is_absolute()const;
bool empty() const;
static char separator_char;
private:
#ifdef _WIN64
fwd<boost::filesystem::path,40> _p;
#else
fwd<boost::filesystem::path,32> _p;
#endif
};
namespace detail
{
class path_wrapper
{
public:
path_wrapper(path p) :
_path(p)
{
~temp_directory() {
if (!tmp_path.empty()) {
std::error_code ec;
std::filesystem::remove_all(tmp_path, ec);
}
const path* operator->() const
{
return &_path;
}
private:
path _path;
};
}
}
class directory_iterator {
public:
directory_iterator( const fc::path& p );
directory_iterator();
~directory_iterator();
fc::path operator*()const;
detail::path_wrapper operator->() const;
directory_iterator& operator++(int);
directory_iterator& operator++();
friend bool operator==( const directory_iterator&, const directory_iterator& );
friend bool operator!=( const directory_iterator&, const directory_iterator& );
private:
fwd<boost::filesystem::directory_iterator,16> _p;
};
class recursive_directory_iterator {
public:
recursive_directory_iterator( const fc::path& p );
recursive_directory_iterator();
~recursive_directory_iterator();
fc::path operator*()const;
recursive_directory_iterator& operator++(int);
recursive_directory_iterator& operator++();
void pop();
int level();
temp_directory& operator=(const temp_directory&) = delete;
temp_directory& operator=(temp_directory&& other) {
tmp_path.swap(other.tmp_path);
return *this;
}
const std::filesystem::path& path() const { return tmp_path; }
};
friend bool operator==( const recursive_directory_iterator&, const recursive_directory_iterator& );
friend bool operator!=( const recursive_directory_iterator&, const recursive_directory_iterator& );
private:
fwd<boost::filesystem::recursive_directory_iterator,16> _p;
};
bool exists( const path& p );
bool is_directory( const path& p );
bool is_regular_file( const path& p );
void create_directories( const path& p );
void remove_all( const path& p );
path absolute( const path& p );
path make_relative(const path& from, const path& to);
path canonical( const path& p );
uint64_t file_size( const path& p );
uint64_t directory_size( const path& p );
bool remove( const path& p );
void copy( const path& from, const path& to );
void rename( const path& from, const path& to );
void resize_file( const path& file, size_t s );
// setuid, setgid not implemented.
// translates octal permission like 0755 to S_ stuff defined in sys/stat.h
// no-op on Windows.
void chmod( const path& p, int perm );
void create_hard_link( const path& from, const path& to );
path unique_path();
path temp_directory_path();
/** @return the home directory on Linux and OS X and the Profile directory on Windows */
const path& home_path();
/** @return the home_path() on Linux, home_path()/Library/Application Support/ on OS X,
* and APPDATA on windows
*/
const path& app_path();
/** @return application executable path */
const fc::path& current_path();
class variant;
void to_variant( const fc::path&, fc::variant& );
void from_variant( const fc::variant& , fc::path& );
template<> struct get_typename<path> { static const char* name() { return "path"; } };
/**
* Class which creates a temporary directory inside an existing temporary directory.
*/
class temp_file_base
{
public:
inline ~temp_file_base() { remove(); }
inline operator bool() const { return _path.has_value(); }
inline bool operator!() const { return !_path.has_value(); }
const fc::path& path() const;
void remove();
void release();
protected:
typedef std::optional<fc::path> path_t;
inline temp_file_base(const path_t& path) : _path(path) {}
inline temp_file_base(path_t&& path) : _path(std::move(path)) {}
path_t _path;
};
/**
* Class which creates a temporary directory inside an existing temporary directory.
*/
class temp_file : public temp_file_base
{
public:
temp_file(temp_file&& other);
temp_file& operator=(temp_file&& other);
temp_file(const fc::path& tempFolder = fc::temp_directory_path(), bool create = false);
};
/**
* Class which creates a temporary directory inside an existing temporary directory.
*/
class temp_directory : public temp_file_base
{
public:
temp_directory(temp_directory&& other);
temp_directory& operator=(temp_directory&& other);
temp_directory(const fc::path& tempFolder = fc::temp_directory_path());
};
#if !defined(__APPLE__)
// this code is known to work on linux and windows. It may work correctly on mac,
// or it may need slight tweaks or extra includes. It's disabled now to avoid giving
// a false sense of security.
# define FC_HAS_SIMPLE_FILE_LOCK
#endif
#ifdef FC_HAS_SIMPLE_FILE_LOCK
/** simple class which only allows one process to open any given file.
* approximate usage:
* int main() {
* fc::simple_file_lock instance_lock("~/.my_app/.lock");
* if (!instance_lock.try_lock()) {
* elog("my_app is already running");
* return 1;
* }
* // do stuff here, file will be unlocked when instance_lock goes out of scope
* }
*/
class simple_lock_file
{
public:
simple_lock_file(const path& lock_file_path);
~simple_lock_file();
bool try_lock();
void unlock();
private:
class impl;
std::unique_ptr<impl> my;
};
#endif // FC_HAS_SIMPLE_FILE_LOCK
}
} // namespace fc
@@ -1,67 +0,0 @@
#pragma once
#include <fc/thread/future.hpp>
#include <fc/io/buffered_iostream.hpp>
#include <vector>
#include <fc/string.hpp>
#include <fc/filesystem.hpp>
namespace fc
{
/**
* @brief abstract interface for interacting with external processes
*
* At the very least we have ssh::process and direct child processes, and
* there may be other processes that need to implement this protocol.
*/
class iprocess
{
public:
enum exec_opts {
open_none = 0,
open_stdin = 0x01,
open_stdout = 0x02,
open_stderr = 0x04,
open_all = open_stdin|open_stdout|open_stderr,
suppress_console = 0x08
};
virtual ~iprocess(){}
/**
*
* @return *this
*/
virtual iprocess& exec( const path& exe, std::vector<std::string> args,
const path& work_dir = path(), int opts = open_all ) = 0;
/**
* @return blocks until the process exits
*/
virtual int result(const microseconds& timeout = microseconds::maximum()) = 0;
/**
* Forcefully kills the process.
*/
virtual void kill() = 0;
/**
* @brief returns a stream that writes to the process' stdin
*/
virtual buffered_ostream_ptr in_stream() = 0;
/**
* @brief returns a stream that reads from the process' stdout
*/
virtual buffered_istream_ptr out_stream() = 0;
/**
* @brief returns a stream that reads from the process' stderr
*/
virtual buffered_istream_ptr err_stream() = 0;
};
typedef std::shared_ptr<iprocess> iprocess_ptr;
} // namespace fc
@@ -1,37 +0,0 @@
#pragma once
#include <fc/interprocess/iprocess.hpp>
namespace fc {
fc::path find_executable_in_path( const fc::string name );
/**
* @brief start and manage an local process
* @note this class implements reference semantics.
*/
class process : public iprocess
{
public:
process();
~process();
virtual iprocess& exec( const fc::path& exe,
std::vector<std::string> args,
const fc::path& work_dir = fc::path(),
int opts = open_all );
virtual int result(const microseconds& timeout = microseconds::maximum());
virtual void kill();
virtual fc::buffered_ostream_ptr in_stream();
virtual fc::buffered_istream_ptr out_stream();
virtual fc::buffered_istream_ptr err_stream();
class impl;
private:
std::unique_ptr<impl> my;
};
typedef std::shared_ptr<process> process_ptr;
} // namespace fc
@@ -1,73 +0,0 @@
#pragma once
#include <fc/io/iostream.hpp>
namespace fc
{
namespace detail
{
class buffered_istream_impl;
class buffered_ostream_impl;
}
/**
* @brief Reads data from an unbuffered stream
* and enables peek functionality.
*/
class buffered_istream : public virtual istream
{
public:
buffered_istream( istream_ptr is );
buffered_istream( buffered_istream&& o );
buffered_istream& operator=( buffered_istream&& i );
virtual ~buffered_istream();
/** read at least 1 byte or throw, if no data is available
* this method should block cooperatively until data is
* available or fc::eof_exception is thrown.
*
* @pre len > 0
* @pre buf != nullptr
* @throws fc::eof if at least 1 byte cannot be read
**/
virtual std::size_t readsome( char* buf, std::size_t len );
virtual size_t readsome( const std::shared_ptr<char>& buf, size_t len, size_t offset );
/**
* This method may block until at least 1 character is
* available.
*/
virtual char peek() const;
private:
std::unique_ptr<detail::buffered_istream_impl> my;
};
typedef std::shared_ptr<buffered_istream> buffered_istream_ptr;
/**
*
*/
class buffered_ostream : public virtual ostream
{
public:
buffered_ostream( ostream_ptr o, size_t bufsize = 4096 );
buffered_ostream( buffered_ostream&& m );
~buffered_ostream();
buffered_ostream& operator=( buffered_ostream&& m );
/**
* This method will return immediately unless the buffer
* is full, in which case it will flush which may block.
*/
virtual size_t writesome( const char* buf, size_t len );
virtual size_t writesome( const std::shared_ptr<const char>& buf, size_t len, size_t offset );
virtual void close();
virtual void flush();
private:
std::unique_ptr<detail::buffered_ostream_impl> my;
};
typedef std::shared_ptr<buffered_ostream> buffered_ostream_ptr;
}
+49 -3
View File
@@ -29,16 +29,30 @@ class cfile_datastream;
* std::ios_base::failure exception thrown for errors.
*/
class cfile {
friend class temp_cfile;
public:
cfile()
: _file(nullptr, &fclose)
{}
void set_file_path( fc::path file_path ) {
cfile(cfile&& other)
: _open(other._open)
, _file_path(std::move(other._file_path))
, _file_blk_size(other._file_blk_size)
, _file(std::move(other._file))
{}
cfile& operator=(cfile&& other){
swap(*this, other);
return *this;
}
void set_file_path( std::filesystem::path file_path ) {
_file_path = std::move( file_path );
}
fc::path get_file_path() const {
std::filesystem::path get_file_path() const {
return _file_path;
}
@@ -221,11 +235,43 @@ public:
private:
bool _open = false;
fc::path _file_path;
std::filesystem::path _file_path;
size_t _file_blk_size = 4096;
detail::unique_file _file;
};
class temp_cfile {
cfile _impl;
public:
explicit temp_cfile(const char* mode = "wb"){
std::filesystem::path template_path{ std::filesystem::temp_directory_path() / "fc-XXXXXX" };
std::string tmp = template_path.string();
int fd = mkstemp(tmp.data());
if (fd == -1)
throw std::system_error(errno, std::generic_category(), __PRETTY_FUNCTION__);
_impl.set_file_path(tmp);
_impl._file.reset(fdopen(fd, mode));
if( !_impl._file ) {
using namespace std::literals::string_literals;
throw std::ios_base::failure( "cfile unable to open: "s + tmp + " in mode: " + std::string( mode ) );
}
_impl._open = true;
}
~temp_cfile() {
_impl.close();
std::error_code ec;
std::filesystem::remove(_impl.get_file_path(), ec);
}
temp_cfile(temp_cfile&& other): _impl(std::move(other._impl)) { }
temp_cfile& operator = (temp_cfile&& other){
_impl = std::move(other._impl);
return *this;
}
cfile& file() { return _impl; }
};
/*
* @brief datastream adapter that adapts cfile for use with fc unpack
*
+1 -1
View File
@@ -7,5 +7,5 @@ namespace fc {
* NB reading a full file into memory is a poor choice
* if the file may be very large.
*/
void read_file_contents( const fc::path& filename, std::string& result );
void read_file_contents( const std::filesystem::path& filename, std::string& result );
}

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