From 80a0e6241a7187f43c4994ec97312987b39681fd Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Thu, 18 Mar 2021 11:13:01 -0400 Subject: [PATCH 01/23] Improve timeouts occurring on Anka builds. --- .cicd/generate-pipeline.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.cicd/generate-pipeline.sh b/.cicd/generate-pipeline.sh index 9df96b23b0f..71f96466de3 100755 --- a/.cicd/generate-pipeline.sh +++ b/.cicd/generate-pipeline.sh @@ -136,6 +136,8 @@ EOF always-pull: true debug: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com failover-registries: - 'registry_1' - 'registry_2' @@ -218,6 +220,8 @@ EOF always-pull: true debug: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com failover-registries: - 'registry_1' - 'registry_2' @@ -274,6 +278,8 @@ EOF always-pull: true debug: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com failover-registries: - 'registry_1' - 'registry_2' @@ -330,6 +336,8 @@ EOF always-pull: true debug: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com failover-registries: - 'registry_1' - 'registry_2' @@ -388,6 +396,8 @@ EOF always-pull: true debug: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com failover-registries: - 'registry_1' - 'registry_2' @@ -568,6 +578,8 @@ cat < Date: Thu, 18 Mar 2021 11:19:03 -0400 Subject: [PATCH 02/23] Update other pipelines. --- .cicd/base-images.yml | 4 ++++ .cicd/build-scripts.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.cicd/base-images.yml b/.cicd/base-images.yml index 604af7be029..cf142664186 100644 --- a/.cicd/base-images.yml +++ b/.cicd/base-images.yml @@ -34,6 +34,8 @@ steps: no-volume: true always-pull: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com vm-registry-tag: "clean::cicd::git-ssh::nas::brew::buildkite-agent" failover-registries: - "registry_1" @@ -99,6 +101,8 @@ steps: no-volume: true always-pull: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com vm-registry-tag: "clean::cicd::git-ssh::nas::brew::buildkite-agent" failover-registries: - "registry_1" diff --git a/.cicd/build-scripts.yml b/.cicd/build-scripts.yml index a628c957d75..b3018066b5d 100644 --- a/.cicd/build-scripts.yml +++ b/.cicd/build-scripts.yml @@ -40,6 +40,8 @@ steps: modify-ram: 24 always-pull: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com vm-registry-tag: "clean::cicd::git-ssh::nas::brew::buildkite-agent" failover-registries: - "registry_1" @@ -113,6 +115,8 @@ steps: modify-ram: 24 always-pull: true wait-network: true + pre-execute-sleep: 5 + pre-execute-ping-sleep: github.com vm-registry-tag: "clean::cicd::git-ssh::nas::brew::buildkite-agent" failover-registries: - "registry_1" From 2855d038ec89cb309a55d5ecf895c632594a8745 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Thu, 18 Mar 2021 20:42:38 -0400 Subject: [PATCH 03/23] Updating nodeos parameter tests to use cmake locations. --- tests/CMakeLists.txt | 6 ++--- tests/full-version-label.sh | 54 +++++-------------------------------- tests/print-build-info.sh | 8 +++--- tests/version-label.sh | 52 ++++------------------------------- 4 files changed, 17 insertions(+), 103 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3495ce06748..0265efee9c4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -95,9 +95,9 @@ set_property(TEST keosd_auto_launch_test PROPERTY LABELS nonparallelizable_tests add_test(NAME db_modes_test COMMAND tests/db_modes_test.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) set_tests_properties(db_modes_test PROPERTIES COST 6000) add_test(NAME release-build-test COMMAND tests/release-build.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -add_test(NAME version-label-test COMMAND tests/version-label.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -add_test(NAME full-version-label-test COMMAND tests/full-version-label.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -add_test(NAME print-build-info-test COMMAND tests/print-build-info.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_test(NAME version-label-test COMMAND tests/version-label.sh ${VERSION_FULL} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_test(NAME full-version-label-test COMMAND tests/full-version-label.sh ${VERSION_FULL} ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_test(NAME print-build-info-test COMMAND tests/print-build-info.sh ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) # Long running tests add_test(NAME nodeos_sanity_lr_test COMMAND tests/nodeos_run_test.py -v --sanity-test --clean-run --dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index 2a988980252..8b86fa41b25 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -3,60 +3,18 @@ set -eo pipefail # The purpose of this test is to ensure that the output of the "nodeos --full-version" command matches the version string defined by our CMake files echo '##### Nodeos Full Version Label Test #####' # orient ourselves -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/eos/') -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/EOSIO/eosio/') -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/build/' | sed 's,/build/,,') +[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(pwd) echo "Using EOSIO_ROOT=\"$EOSIO_ROOT\"." -# determine expected value -CMAKE_CACHE="$EOSIO_ROOT/build/CMakeCache.txt" -CMAKE_LISTS="$EOSIO_ROOT/CMakeLists.txt" -if [[ -f "$CMAKE_CACHE" && $(cat "$CMAKE_CACHE" | grep -c 'DOXY_EOS_VERSION') > 0 ]]; then - echo "Parsing \"$CMAKE_CACHE\"..." - EXPECTED="v$(cat "$CMAKE_CACHE" | grep 'DOXY_EOS_VERSION' | cut -d '=' -f 2)" -elif [[ -f "$CMAKE_LISTS" ]]; then - echo "Parsing \"$CMAKE_LISTS\"..." - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_MAJOR' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_MINOR' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_PATCH' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - if [[ $(cat $CMAKE_LISTS | grep -ice 'set *( *VERSION_SUFFIX') > 0 ]]; then - echo 'Using version suffix...' - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_SUFFIX' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - export $(echo "$(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_FULL.*VERSION_SUFFIX' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}')" | sed "s/VERSION_MAJOR/$VERSION_MAJOR/" | sed "s/VERSION_MINOR/$VERSION_MINOR/" | sed "s/VERSION_PATCH/$VERSION_PATCH/" | sed "s/VERSION_SUFFIX/$VERSION_SUFFIX/" | tr -d '"{}$') - else - echo 'No version suffix found.' - export $(echo "$(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_FULL' | grep -ive 'VERSION_SUFFIX' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}')" | sed "s/VERSION_MAJOR/$VERSION_MAJOR/" | sed "s/VERSION_MINOR/$VERSION_MINOR/" | sed "s/VERSION_PATCH/$VERSION_PATCH/" | tr -d '"{}$') - fi - EXPECTED="v$VERSION_FULL" -fi -# fail if no expected value was found +EXPECTED=$1 if [[ -z "$EXPECTED" ]]; then - echo 'ERROR: Could not determine expected value for version label!' - set +e - echo "EOSIO_ROOT=\"$EOSIO_ROOT\"" - echo "CMAKE_CACHE=\"$CMAKE_CACHE\"" - echo "CMAKE_LISTS=\"$CMAKE_LISTS\"" - echo '' - echo "VERSION_MAJOR=\"$VERSION_MAJOR\"" - echo "VERSION_MINOR=\"$VERSION_MINOR\"" - echo "VERSION_PATCH=\"$VERSION_PATCH\"" - echo "VERSION_SUFFIX=\"$VERSION_SUFFIX\"" - echo "VERSION_FULL=\"$VERSION_FULL\"" - echo '' - echo '$ cat "$CMAKE_CACHE" | grep "DOXY_EOS_VERSION"' - cat "$CMAKE_CACHE" | grep "DOXY_EOS_VERSION" - echo '$ pwd' - pwd - echo '$ ls -la "$EOSIO_ROOT"' - ls -la "$EOSIO_ROOT" - echo '$ ls -la "$EOSIO_ROOT/build"' - ls -la "$EOSIO_ROOT/build" + echo "Missing version input." exit 1 fi -[[ -z "$BUILDKITE_COMMIT" ]] && VERSION_HASH="$(git rev-parse HEAD 2>/dev/null || :)" || VERSION_HASH=$BUILDKITE_COMMIT -EXPECTED=$EXPECTED-$VERSION_HASH +VERSION_HASH="$(pushd $2 &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" +EXPECTED=v$EXPECTED-$VERSION_HASH echo "Expecting \"$EXPECTED\"..." # get nodeos version -ACTUAL=$($EOSIO_ROOT/build/bin/nodeos --full-version) +ACTUAL=$($EOSIO_ROOT/bin/nodeos --full-version) EXIT_CODE=$? # verify 0 exit code explicitly if [[ $EXIT_CODE -ne 0 ]]; then diff --git a/tests/print-build-info.sh b/tests/print-build-info.sh index 79195e9603d..792a90cfff4 100755 --- a/tests/print-build-info.sh +++ b/tests/print-build-info.sh @@ -4,13 +4,11 @@ set -eo pipefail # This includes verifying valid output in JSON shape and checking parameters (only boost for now). echo '##### Nodeos Print Build Info Test #####' # orient ourselves -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/eos/') -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/EOSIO/eosio/') -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/build/' | sed 's,/build/,,') +[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT="$(pwd)" echo "Using EOSIO_ROOT=\"$EOSIO_ROOT\"." exec 9>&1 # enable tee to write to STDOUT as a file -PRINT_BUILD_INFO="$EOSIO_ROOT/build/bin/nodeos --print-build-info 2>&1 | tee >(cat - >&9) || :" +PRINT_BUILD_INFO="$EOSIO_ROOT/bin/nodeos --print-build-info 2>&1 | tee >(cat - >&9) || :" echo "$ $PRINT_BUILD_INFO" OUTPUT="$(eval $PRINT_BUILD_INFO)" @@ -46,7 +44,7 @@ if [[ "$PLATFORM_TYPE" == "pinned" ]]; then echo "Missing IMAGE_TAG variable." exit 1 fi - FILE=$(ls $EOSIO_ROOT/.cicd/platforms/pinned/$IMAGE_TAG* | head) + FILE=$(ls $1/.cicd/platforms/pinned/$IMAGE_TAG* | head) BOOST=$(cat $FILE | grep boost | tr -d '\r\n' | sed -E 's/^.+boost_([0-9]+_[0-9]+_[0-9]+).+$/\1/' | head) BOOST_MAJOR=$(echo $BOOST | sed -E 's/^([0-9])+_[0-9]+_[0-9]+$/\1/') BOOST_MINOR=$(echo $BOOST | sed -E 's/^[0-9]+_([0-9]+)_[0-9]+$/\1/') diff --git a/tests/version-label.sh b/tests/version-label.sh index 769b8f60c1e..e8a790babfb 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -3,58 +3,16 @@ set -eo pipefail # The purpose of this test is to ensure that the output of the "nodeos --version" command matches the version string defined by our CMake files echo '##### Nodeos Version Label Test #####' # orient ourselves -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/eos/') -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/EOSIO/eosio/') -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(echo $(pwd)/ | grep -ioe '.*/build/' | sed 's,/build/,,') +[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT="$(pwd)" echo "Using EOSIO_ROOT=\"$EOSIO_ROOT\"." -# determine expected value -CMAKE_CACHE="$EOSIO_ROOT/build/CMakeCache.txt" -CMAKE_LISTS="$EOSIO_ROOT/CMakeLists.txt" -if [[ -f "$CMAKE_CACHE" && $(cat "$CMAKE_CACHE" | grep -c 'DOXY_EOS_VERSION') > 0 ]]; then - echo "Parsing \"$CMAKE_CACHE\"..." - EXPECTED="v$(cat "$CMAKE_CACHE" | grep 'DOXY_EOS_VERSION' | cut -d '=' -f 2)" -elif [[ -f "$CMAKE_LISTS" ]]; then - echo "Parsing \"$CMAKE_LISTS\"..." - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_MAJOR' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_MINOR' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_PATCH' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - if [[ $(cat $CMAKE_LISTS | grep -ice 'set *( *VERSION_SUFFIX') > 0 ]]; then - echo 'Using version suffix...' - export $(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_SUFFIX' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}') - export $(echo "$(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_FULL.*VERSION_SUFFIX' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}')" | sed "s/VERSION_MAJOR/$VERSION_MAJOR/" | sed "s/VERSION_MINOR/$VERSION_MINOR/" | sed "s/VERSION_PATCH/$VERSION_PATCH/" | sed "s/VERSION_SUFFIX/$VERSION_SUFFIX/" | tr -d '"{}$') - else - echo 'No version suffix found.' - export $(echo "$(cat $CMAKE_LISTS | grep -ie 'set *( *VERSION_FULL' | grep -ive 'VERSION_SUFFIX' | cut -d '(' -f 2 | cut -d ')' -f 1 | awk '{print $1"="$2}')" | sed "s/VERSION_MAJOR/$VERSION_MAJOR/" | sed "s/VERSION_MINOR/$VERSION_MINOR/" | sed "s/VERSION_PATCH/$VERSION_PATCH/" | tr -d '"{}$') - fi - EXPECTED="v$VERSION_FULL" -fi -# fail if no expected value was found -if [[ "$EXPECTED" == '' ]]; then - echo 'ERROR: Could not determine expected value for version label!' - set +e - echo "EOSIO_ROOT=\"$EOSIO_ROOT\"" - echo "CMAKE_CACHE=\"$CMAKE_CACHE\"" - echo "CMAKE_LISTS=\"$CMAKE_LISTS\"" - echo '' - echo "VERSION_MAJOR=\"$VERSION_MAJOR\"" - echo "VERSION_MINOR=\"$VERSION_MINOR\"" - echo "VERSION_PATCH=\"$VERSION_PATCH\"" - echo "VERSION_SUFFIX=\"$VERSION_SUFFIX\"" - echo "VERSION_FULL=\"$VERSION_FULL\"" - echo '' - echo '$ cat "$CMAKE_CACHE" | grep "DOXY_EOS_VERSION"' - cat "$CMAKE_CACHE" | grep "DOXY_EOS_VERSION" - echo '$ pwd' - pwd - echo '$ ls -la "$EOSIO_ROOT"' - ls -la "$EOSIO_ROOT" - echo '$ ls -la "$EOSIO_ROOT/build"' - ls -la "$EOSIO_ROOT/build" +EXPECTED=v$1 +if [[ -z "$EXPECTED" ]]; then + echo "Missing version input." exit 1 fi echo "Expecting \"$EXPECTED\"..." # get nodeos version -ACTUAL=$($EOSIO_ROOT/build/bin/nodeos --version) +ACTUAL=$($EOSIO_ROOT/bin/nodeos --version) EXIT_CODE=$? # verify 0 exit code explicitly if [[ $EXIT_CODE -ne 0 ]]; then From 8e24c63c5d322d57bc8e90a8d7cbf2db4035188c Mon Sep 17 00:00:00 2001 From: William Blevins Date: Fri, 19 Mar 2021 09:59:31 -0400 Subject: [PATCH 04/23] Rename EOSIO_ROOT to BUILD_ROOT as the name is misleading. --- tests/full-version-label.sh | 6 +++--- tests/print-build-info.sh | 6 +++--- tests/version-label.sh | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index 8b86fa41b25..7039fc98415 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -3,8 +3,8 @@ set -eo pipefail # The purpose of this test is to ensure that the output of the "nodeos --full-version" command matches the version string defined by our CMake files echo '##### Nodeos Full Version Label Test #####' # orient ourselves -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT=$(pwd) -echo "Using EOSIO_ROOT=\"$EOSIO_ROOT\"." +[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT=$(pwd) +echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." EXPECTED=$1 if [[ -z "$EXPECTED" ]]; then echo "Missing version input." @@ -14,7 +14,7 @@ VERSION_HASH="$(pushd $2 &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &> EXPECTED=v$EXPECTED-$VERSION_HASH echo "Expecting \"$EXPECTED\"..." # get nodeos version -ACTUAL=$($EOSIO_ROOT/bin/nodeos --full-version) +ACTUAL=$($BUILD_ROOT/bin/nodeos --full-version) EXIT_CODE=$? # verify 0 exit code explicitly if [[ $EXIT_CODE -ne 0 ]]; then diff --git a/tests/print-build-info.sh b/tests/print-build-info.sh index 792a90cfff4..a9883d573fe 100755 --- a/tests/print-build-info.sh +++ b/tests/print-build-info.sh @@ -4,11 +4,11 @@ set -eo pipefail # This includes verifying valid output in JSON shape and checking parameters (only boost for now). echo '##### Nodeos Print Build Info Test #####' # orient ourselves -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT="$(pwd)" -echo "Using EOSIO_ROOT=\"$EOSIO_ROOT\"." +[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT="$(pwd)" +echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." exec 9>&1 # enable tee to write to STDOUT as a file -PRINT_BUILD_INFO="$EOSIO_ROOT/bin/nodeos --print-build-info 2>&1 | tee >(cat - >&9) || :" +PRINT_BUILD_INFO="$BUILD_ROOT/bin/nodeos --print-build-info 2>&1 | tee >(cat - >&9) || :" echo "$ $PRINT_BUILD_INFO" OUTPUT="$(eval $PRINT_BUILD_INFO)" diff --git a/tests/version-label.sh b/tests/version-label.sh index e8a790babfb..18957916399 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -3,8 +3,8 @@ set -eo pipefail # The purpose of this test is to ensure that the output of the "nodeos --version" command matches the version string defined by our CMake files echo '##### Nodeos Version Label Test #####' # orient ourselves -[[ "$EOSIO_ROOT" == '' ]] && EOSIO_ROOT="$(pwd)" -echo "Using EOSIO_ROOT=\"$EOSIO_ROOT\"." +[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT="$(pwd)" +echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." EXPECTED=v$1 if [[ -z "$EXPECTED" ]]; then echo "Missing version input." @@ -12,7 +12,7 @@ if [[ -z "$EXPECTED" ]]; then fi echo "Expecting \"$EXPECTED\"..." # get nodeos version -ACTUAL=$($EOSIO_ROOT/bin/nodeos --version) +ACTUAL=$($BUILD_ROOT/bin/nodeos --version) EXIT_CODE=$? # verify 0 exit code explicitly if [[ $EXIT_CODE -ne 0 ]]; then From cbfa766cc052966b9926a93622d622de30b5d5e8 Mon Sep 17 00:00:00 2001 From: Luis Paris Date: Thu, 25 Mar 2021 12:57:55 -0400 Subject: [PATCH 05/23] add eosio 2.0.11 release notes to dev portal :doc --- docs/30_release-notes/88_v2.0.11.md | 4 +++ docs/30_release-notes/89_v2.0.10.md | 39 ++++++++++++++++++++++++++++- docs/30_release-notes/index.md | 36 ++++++-------------------- 3 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 docs/30_release-notes/88_v2.0.11.md diff --git a/docs/30_release-notes/88_v2.0.11.md b/docs/30_release-notes/88_v2.0.11.md new file mode 100644 index 00000000000..0bbd3fa7f99 --- /dev/null +++ b/docs/30_release-notes/88_v2.0.11.md @@ -0,0 +1,4 @@ +--- +link: /30_release-notes/index.md +link_text: v2.0.11 +--- diff --git a/docs/30_release-notes/89_v2.0.10.md b/docs/30_release-notes/89_v2.0.10.md index e7247d125a8..5ddad16cc70 100644 --- a/docs/30_release-notes/89_v2.0.10.md +++ b/docs/30_release-notes/89_v2.0.10.md @@ -1,4 +1,41 @@ --- -link: /30_release-notes/index.md +content_title: EOSIO v2.0.10 Release Notes link_text: v2.0.10 --- + +This release contains security, stability, and miscellaneous fixes. + +## Security bug fixes + +### Consolidated Security Fixes for v2.0.10 ([#10091](https://github.com/EOSIO/eos/pull/10091)) +- Fix issue with account query db that could result in incorrect data or hung processes +- Implement a Subjective CPU billing system that helps P2P and API nodes better respond to extreme network congestion + +Note: These security fixes are relevant to all nodes on EOSIO blockchain networks. + +### Notes on Subjective CPU Billing + +This system consists of two primary features: a subjective (node local) view of spent CPU resources that are not yet accounted for by the blockchain that allows individual nodes to predict what resource consumption will be and, a subjective penalty system to offset work done in service of erroneous or malicious transactions. + +The subjective view of CPU resources will synchronize with the resources present in the blockchain as it discovers the true CPU billing for transactions it has already accounted for. + +The system will also accumulate CPU resources spent on failing transactions that will not be relayed in a decaying "subjective penalty" which can protect the individual nodes from abusive actors while remaining tolerant to occasional mistakes. + +Subjective billing defaults to active and can be disabled with the `disable-subjective-billing` configuration in `config.ini` or on the command line. + +## Stability bug fixes +- ([#9985](https://github.com/EOSIO/eos/pull/9985)) EPE-389 net_plugin stall during head catchup - merge release/2.0.x + +## Other changes +- ([#9894](https://github.com/EOSIO/eos/pull/9894)) EOS VM OC: Support LLVM 11 - 2.0 +- ([#9911](https://github.com/EOSIO/eos/pull/9911)) add step to the pipeline to build and push to dockerhub on release br… +- ([#9944](https://github.com/EOSIO/eos/pull/9944)) Create eosio-debug-build Pipeline +- ([#9969](https://github.com/EOSIO/eos/pull/9969)) Updating name for the new Docker hub repo EOSIO instead EOS +- ([#9971](https://github.com/EOSIO/eos/pull/9971)) Fix pinned builds error due to obsolete LLVM repo +- ([#10015](https://github.com/EOSIO/eos/pull/10015)) [release 2.0.x] Fix LRT triggers +- ([#10026](https://github.com/EOSIO/eos/pull/10026)) EPE-165: Improve logic for unlinkable blocks while sync'ing +- ([#10047](https://github.com/EOSIO/eos/pull/10047)) Reduce Docker Hub Manifest Queries +- ([#10088](https://github.com/EOSIO/eos/pull/10088)) [release 2.0.x] Specify boost version for unpinned MacOS 10.14 builds + +## Documentation +- ([#10011](https://github.com/EOSIO/eos/pull/10011)) [docs] Update various cleos how-tos and fix index - 2.0 diff --git a/docs/30_release-notes/index.md b/docs/30_release-notes/index.md index 5097b4c4d39..067b03c515c 100644 --- a/docs/30_release-notes/index.md +++ b/docs/30_release-notes/index.md @@ -1,40 +1,20 @@ --- -content_title: EOSIO v2.0.10 Release Notes +content_title: EOSIO v2.0.11 Release Notes --- -This release contains security, stability, and miscellaneous fixes. +This release contains security and miscellaneous fixes. ## Security bug fixes -### Consolidated Security Fixes for v2.0.10 ([#10091](https://github.com/EOSIO/eos/pull/10091)) -- Fix issue with account query db that could result in incorrect data or hung processes -- Implement a Subjective CPU billing system that helps P2P and API nodes better respond to extreme network congestion +### Consolidated Security Fixes for v2.0.11 ([#10147](https://github.com/EOSIO/eos/pull/10147)) +- Fix issue with account query db that could result in incorrect data or hung processes Note: These security fixes are relevant to all nodes on EOSIO blockchain networks. -### Notes on Subjective CPU Billing - -This system consists of two primary features: a subjective (node local) view of spent CPU resources that are not yet accounted for by the blockchain that allows individual nodes to predict what resource consumption will be and, a subjective penalty system to offset work done in service of erroneous or malicious transactions. - -The subjective view of CPU resources will synchronize with the resources present in the blockchain as it discovers the true CPU billing for transactions it has already accounted for. - -The system will also accumulate CPU resources spent on failing transactions that will not be relayed in a decaying "subjective penalty" which can protect the individual nodes from abusive actors while remaining tolerant to occasional mistakes. - -Subjective billing defaults to active and can be disabled with the `disable-subjective-billing` configuration in `config.ini` or on the command line. - -## Stability bug fixes -- ([#9985](https://github.com/EOSIO/eos/pull/9985)) EPE-389 net_plugin stall during head catchup - merge release/2.0.x - ## Other changes -- ([#9894](https://github.com/EOSIO/eos/pull/9894)) EOS VM OC: Support LLVM 11 - 2.0 -- ([#9911](https://github.com/EOSIO/eos/pull/9911)) add step to the pipeline to build and push to dockerhub on release br… -- ([#9944](https://github.com/EOSIO/eos/pull/9944)) Create eosio-debug-build Pipeline -- ([#9969](https://github.com/EOSIO/eos/pull/9969)) Updating name for the new Docker hub repo EOSIO instead EOS -- ([#9971](https://github.com/EOSIO/eos/pull/9971)) Fix pinned builds error due to obsolete LLVM repo -- ([#10015](https://github.com/EOSIO/eos/pull/10015)) [release 2.0.x] Fix LRT triggers -- ([#10026](https://github.com/EOSIO/eos/pull/10026)) EPE-165: Improve logic for unlinkable blocks while sync'ing -- ([#10047](https://github.com/EOSIO/eos/pull/10047)) Reduce Docker Hub Manifest Queries -- ([#10088](https://github.com/EOSIO/eos/pull/10088)) [release 2.0.x] Specify boost version for unpinned MacOS 10.14 builds +- ([#10063](https://github.com/EOSIO/eos/pull/10063)) [release 2.0.x] Fix docker steps on tagged builds. +- ([#10135](https://github.com/EOSIO/eos/pull/10135)) Wlb/adding nodeos param tests 2.0.x +- ([#10133](https://github.com/EOSIO/eos/pull/10133)) fix compiling with boost 1.76; add include in chainbase - 2.0 ## Documentation -- ([#10011](https://github.com/EOSIO/eos/pull/10011)) [docs] Update various cleos how-tos and fix index - 2.0 +- ([#10094](https://github.com/EOSIO/eos/pull/10094)) [docs] Add EOSIO 2.0.10 release notes to dev portal - 2.0 From 414943689f164586eb86a74f2148da31287ca4a0 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 8 Apr 2021 12:52:51 -0400 Subject: [PATCH 06/23] Use a variable for CMAKE_SOURCE_DIR --- tests/full-version-label.sh | 3 ++- tests/print-build-info.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index 7039fc98415..389c3ed4f0a 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -5,12 +5,13 @@ echo '##### Nodeos Full Version Label Test #####' # orient ourselves [[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT=$(pwd) echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." +[[ -z "$CMAKE_SOURCE_DIR" ]] && export CMAKE_SOURCE_DIR="$2" EXPECTED=$1 if [[ -z "$EXPECTED" ]]; then echo "Missing version input." exit 1 fi -VERSION_HASH="$(pushd $2 &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" +VERSION_HASH="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" EXPECTED=v$EXPECTED-$VERSION_HASH echo "Expecting \"$EXPECTED\"..." # get nodeos version diff --git a/tests/print-build-info.sh b/tests/print-build-info.sh index a9883d573fe..cf07db4350e 100755 --- a/tests/print-build-info.sh +++ b/tests/print-build-info.sh @@ -6,6 +6,7 @@ echo '##### Nodeos Print Build Info Test #####' # orient ourselves [[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT="$(pwd)" echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." +[[ -z "$CMAKE_SOURCE_DIR" ]] && export CMAKE_SOURCE_DIR="$1" exec 9>&1 # enable tee to write to STDOUT as a file PRINT_BUILD_INFO="$BUILD_ROOT/bin/nodeos --print-build-info 2>&1 | tee >(cat - >&9) || :" @@ -44,7 +45,7 @@ if [[ "$PLATFORM_TYPE" == "pinned" ]]; then echo "Missing IMAGE_TAG variable." exit 1 fi - FILE=$(ls $1/.cicd/platforms/pinned/$IMAGE_TAG* | head) + FILE=$(ls $CMAKE_SOURCE_DIR/.cicd/platforms/pinned/$IMAGE_TAG* | head) BOOST=$(cat $FILE | grep boost | tr -d '\r\n' | sed -E 's/^.+boost_([0-9]+_[0-9]+_[0-9]+).+$/\1/' | head) BOOST_MAJOR=$(echo $BOOST | sed -E 's/^([0-9])+_[0-9]+_[0-9]+$/\1/') BOOST_MINOR=$(echo $BOOST | sed -E 's/^[0-9]+_([0-9]+)_[0-9]+$/\1/') From 1a9f9a097f224b74350374d298bcea85573f2039 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 8 Apr 2021 13:12:40 -0400 Subject: [PATCH 07/23] Consistency is key --- tests/full-version-label.sh | 2 +- tests/print-build-info.sh | 2 +- tests/version-label.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index 389c3ed4f0a..0fb46161329 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -3,7 +3,7 @@ set -eo pipefail # The purpose of this test is to ensure that the output of the "nodeos --full-version" command matches the version string defined by our CMake files echo '##### Nodeos Full Version Label Test #####' # orient ourselves -[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT=$(pwd) +[[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)" echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." [[ -z "$CMAKE_SOURCE_DIR" ]] && export CMAKE_SOURCE_DIR="$2" EXPECTED=$1 diff --git a/tests/print-build-info.sh b/tests/print-build-info.sh index cf07db4350e..897fa26a7d9 100755 --- a/tests/print-build-info.sh +++ b/tests/print-build-info.sh @@ -4,7 +4,7 @@ set -eo pipefail # This includes verifying valid output in JSON shape and checking parameters (only boost for now). echo '##### Nodeos Print Build Info Test #####' # orient ourselves -[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT="$(pwd)" +[[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)" echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." [[ -z "$CMAKE_SOURCE_DIR" ]] && export CMAKE_SOURCE_DIR="$1" diff --git a/tests/version-label.sh b/tests/version-label.sh index 18957916399..2945ed8a454 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -3,7 +3,7 @@ set -eo pipefail # The purpose of this test is to ensure that the output of the "nodeos --version" command matches the version string defined by our CMake files echo '##### Nodeos Version Label Test #####' # orient ourselves -[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT="$(pwd)" +[[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)" echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." EXPECTED=v$1 if [[ -z "$EXPECTED" ]]; then From a3e5978a97b47a04e5058562d06a1be61cdeea5c Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 8 Apr 2021 13:15:26 -0400 Subject: [PATCH 08/23] Support getting the commit hash without invoking git, for testing --full-version on a clean Linux install --- tests/full-version-label.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index 0fb46161329..3ade7cfb9a2 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -11,8 +11,8 @@ if [[ -z "$EXPECTED" ]]; then echo "Missing version input." exit 1 fi -VERSION_HASH="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" -EXPECTED=v$EXPECTED-$VERSION_HASH +[[ -z "$BUILDKITE_COMMIT" ]] && export BUILDKITE_COMMIT="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" +EXPECTED=v$EXPECTED-$BUILDKITE_COMMIT echo "Expecting \"$EXPECTED\"..." # get nodeos version ACTUAL=$($BUILD_ROOT/bin/nodeos --full-version) From 83adc3fc1e9963310b4ddd12ae766f3d97f3b794 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 8 Apr 2021 13:22:46 -0400 Subject: [PATCH 09/23] Support providing an expected value from outside the test (and without git or CMake) --- tests/full-version-label.sh | 8 +++++--- tests/version-label.sh | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index 3ade7cfb9a2..c62ec22d33a 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -6,13 +6,15 @@ echo '##### Nodeos Full Version Label Test #####' [[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)" echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." [[ -z "$CMAKE_SOURCE_DIR" ]] && export CMAKE_SOURCE_DIR="$2" -EXPECTED=$1 +# test expectations +if [[ -z "$EXPECTED" ]]; then + [[ -z "$BUILDKITE_COMMIT" ]] && export BUILDKITE_COMMIT="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" + export EXPECTED="v$1-$BUILDKITE_COMMIT" +fi if [[ -z "$EXPECTED" ]]; then echo "Missing version input." exit 1 fi -[[ -z "$BUILDKITE_COMMIT" ]] && export BUILDKITE_COMMIT="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" -EXPECTED=v$EXPECTED-$BUILDKITE_COMMIT echo "Expecting \"$EXPECTED\"..." # get nodeos version ACTUAL=$($BUILD_ROOT/bin/nodeos --full-version) diff --git a/tests/version-label.sh b/tests/version-label.sh index 2945ed8a454..d65415e4da2 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -5,7 +5,10 @@ echo '##### Nodeos Version Label Test #####' # orient ourselves [[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)" echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." -EXPECTED=v$1 +# test expectations +if [[ -z "$EXPECTED" ]]; then + export EXPECTED="v$1" +fi if [[ -z "$EXPECTED" ]]; then echo "Missing version input." exit 1 From 709d4e3d24e099d9eb8059a814e151dfe8dd60e9 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 8 Apr 2021 13:58:09 -0400 Subject: [PATCH 10/23] Test now works with full git tags, not partial ones --- tests/CMakeLists.txt | 4 ++-- tests/full-version-label.sh | 2 +- tests/version-label.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0265efee9c4..e62d5718d31 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -95,8 +95,8 @@ set_property(TEST keosd_auto_launch_test PROPERTY LABELS nonparallelizable_tests add_test(NAME db_modes_test COMMAND tests/db_modes_test.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) set_tests_properties(db_modes_test PROPERTIES COST 6000) add_test(NAME release-build-test COMMAND tests/release-build.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -add_test(NAME version-label-test COMMAND tests/version-label.sh ${VERSION_FULL} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -add_test(NAME full-version-label-test COMMAND tests/full-version-label.sh ${VERSION_FULL} ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_test(NAME version-label-test COMMAND tests/version-label.sh "v${VERSION_FULL}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_test(NAME full-version-label-test COMMAND tests/full-version-label.sh "v${VERSION_FULL}" ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) add_test(NAME print-build-info-test COMMAND tests/print-build-info.sh ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) # Long running tests diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index c62ec22d33a..beb5cc66648 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -9,7 +9,7 @@ echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." # test expectations if [[ -z "$EXPECTED" ]]; then [[ -z "$BUILDKITE_COMMIT" ]] && export BUILDKITE_COMMIT="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" - export EXPECTED="v$1-$BUILDKITE_COMMIT" + export EXPECTED="$1-$BUILDKITE_COMMIT" fi if [[ -z "$EXPECTED" ]]; then echo "Missing version input." diff --git a/tests/version-label.sh b/tests/version-label.sh index d65415e4da2..a07eb417568 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -7,7 +7,7 @@ echo '##### Nodeos Version Label Test #####' echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." # test expectations if [[ -z "$EXPECTED" ]]; then - export EXPECTED="v$1" + export EXPECTED="$1" fi if [[ -z "$EXPECTED" ]]; then echo "Missing version input." From dd7d9336f065f1ef5bf82bc0850c6d7990362161 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 8 Apr 2021 13:36:36 -0400 Subject: [PATCH 11/23] Support providing git tag via environment variables in addition to argument 1 --- tests/full-version-label.sh | 3 ++- tests/version-label.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index beb5cc66648..b6d64a5b78f 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -9,7 +9,8 @@ echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." # test expectations if [[ -z "$EXPECTED" ]]; then [[ -z "$BUILDKITE_COMMIT" ]] && export BUILDKITE_COMMIT="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" - export EXPECTED="$1-$BUILDKITE_COMMIT" + [[ -z "$BUILDKITE_TAG" ]] export BUILDKITE_TAG="${GIT_TAG:-$1}" + export EXPECTED="$BUILDKITE_TAG-$BUILDKITE_COMMIT" fi if [[ -z "$EXPECTED" ]]; then echo "Missing version input." diff --git a/tests/version-label.sh b/tests/version-label.sh index a07eb417568..df756d3b1e1 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -7,7 +7,8 @@ echo '##### Nodeos Version Label Test #####' echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." # test expectations if [[ -z "$EXPECTED" ]]; then - export EXPECTED="$1" + [[ -z "$BUILDKITE_TAG" ]] export BUILDKITE_TAG="${GIT_TAG:-$1}" + export EXPECTED="$BUILDKITE_TAG" fi if [[ -z "$EXPECTED" ]]; then echo "Missing version input." From 84f6838eee7eda9baef385622a372134fa2def43 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 8 Apr 2021 14:48:11 -0400 Subject: [PATCH 12/23] Fix missing symbol --- tests/full-version-label.sh | 2 +- tests/version-label.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index b6d64a5b78f..732727c85b3 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -9,7 +9,7 @@ echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." # test expectations if [[ -z "$EXPECTED" ]]; then [[ -z "$BUILDKITE_COMMIT" ]] && export BUILDKITE_COMMIT="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)" - [[ -z "$BUILDKITE_TAG" ]] export BUILDKITE_TAG="${GIT_TAG:-$1}" + [[ -z "$BUILDKITE_TAG" ]] && export BUILDKITE_TAG="${GIT_TAG:-$1}" export EXPECTED="$BUILDKITE_TAG-$BUILDKITE_COMMIT" fi if [[ -z "$EXPECTED" ]]; then diff --git a/tests/version-label.sh b/tests/version-label.sh index df756d3b1e1..3b431be9220 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -7,7 +7,7 @@ echo '##### Nodeos Version Label Test #####' echo "Using BUILD_ROOT=\"$BUILD_ROOT\"." # test expectations if [[ -z "$EXPECTED" ]]; then - [[ -z "$BUILDKITE_TAG" ]] export BUILDKITE_TAG="${GIT_TAG:-$1}" + [[ -z "$BUILDKITE_TAG" ]] && export BUILDKITE_TAG="${GIT_TAG:-$1}" export EXPECTED="$BUILDKITE_TAG" fi if [[ -z "$EXPECTED" ]]; then From 1f13e7c5c4af8689c820e9b761066539415fb4db Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Mon, 12 Apr 2021 15:13:20 -0400 Subject: [PATCH 13/23] update boost download links --- .cicd/platforms/pinned/amazon_linux-2-pinned.dockerfile | 2 +- .cicd/platforms/pinned/centos-7.7-pinned.dockerfile | 2 +- .cicd/platforms/pinned/macos-10.14-pinned.sh | 2 +- .cicd/platforms/pinned/ubuntu-16.04-pinned.dockerfile | 2 +- .cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile | 2 +- .cicd/platforms/unpinned/amazon_linux-2-unpinned.dockerfile | 2 +- .cicd/platforms/unpinned/centos-7.7-unpinned.dockerfile | 2 +- .cicd/platforms/unpinned/ubuntu-18.04-unpinned.dockerfile | 2 +- .../02_manual-build/03_platforms/amazon_linux-2.md | 2 +- .../02_manual-build/03_platforms/centos-7.7.md | 2 +- .../02_manual-build/03_platforms/ubuntu-18.04.md | 2 +- scripts/helpers/eosio.sh | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.cicd/platforms/pinned/amazon_linux-2-pinned.dockerfile b/.cicd/platforms/pinned/amazon_linux-2-pinned.dockerfile index c9fd9e7445b..bb2dbe8fb2c 100644 --- a/.cicd/platforms/pinned/amazon_linux-2-pinned.dockerfile +++ b/.cicd/platforms/pinned/amazon_linux-2-pinned.dockerfile @@ -43,7 +43,7 @@ RUN git clone --depth 1 --single-branch --branch release_80 https://github.com/l cd / && \ rm -rf /llvm # build boost -RUN curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --with-toolset=clang --prefix=/usr/local && \ diff --git a/.cicd/platforms/pinned/centos-7.7-pinned.dockerfile b/.cicd/platforms/pinned/centos-7.7-pinned.dockerfile index 4c825064195..00310a96b7a 100644 --- a/.cicd/platforms/pinned/centos-7.7-pinned.dockerfile +++ b/.cicd/platforms/pinned/centos-7.7-pinned.dockerfile @@ -52,7 +52,7 @@ RUN git clone --depth 1 --single-branch --branch release_80 https://github.com/l cd / && \ rm -rf /llvm # build boost -RUN curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --with-toolset=clang --prefix=/usr/local && \ diff --git a/.cicd/platforms/pinned/macos-10.14-pinned.sh b/.cicd/platforms/pinned/macos-10.14-pinned.sh index 7eea188b39c..779a566adb0 100755 --- a/.cicd/platforms/pinned/macos-10.14-pinned.sh +++ b/.cicd/platforms/pinned/macos-10.14-pinned.sh @@ -53,7 +53,7 @@ rm -rf clang8 # install boost from source # Boost Fix: eosio/install/bin/../include/c++/v1/stdlib.h:94:15: fatal error: 'stdlib.h' file not found export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" -curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 +curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 tar -xjf boost_1_71_0.tar.bz2 cd boost_1_71_0 ./bootstrap.sh --prefix=/usr/local diff --git a/.cicd/platforms/pinned/ubuntu-16.04-pinned.dockerfile b/.cicd/platforms/pinned/ubuntu-16.04-pinned.dockerfile index 5bebe55a956..012e5ea4688 100644 --- a/.cicd/platforms/pinned/ubuntu-16.04-pinned.dockerfile +++ b/.cicd/platforms/pinned/ubuntu-16.04-pinned.dockerfile @@ -44,7 +44,7 @@ RUN git clone --depth 1 --single-branch --branch release_80 https://github.com/l cd / && \ rm -rf /llvm # build boost -RUN curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --with-toolset=clang --prefix=/usr/local && \ diff --git a/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile b/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile index 2f771cb7a78..b76efc04dd4 100644 --- a/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile +++ b/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile @@ -46,7 +46,7 @@ RUN git clone --depth 1 --single-branch --branch release_80 https://github.com/l cd / && \ rm -rf /llvm # build boost -RUN curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --with-toolset=clang --prefix=/usr/local && \ diff --git a/.cicd/platforms/unpinned/amazon_linux-2-unpinned.dockerfile b/.cicd/platforms/unpinned/amazon_linux-2-unpinned.dockerfile index 00248b8ac44..38af1dbb519 100644 --- a/.cicd/platforms/unpinned/amazon_linux-2-unpinned.dockerfile +++ b/.cicd/platforms/unpinned/amazon_linux-2-unpinned.dockerfile @@ -16,7 +16,7 @@ RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ cd / && \ rm -rf cmake-3.13.2.tar.gz /cmake-3.13.2 # build boost -RUN curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --prefix=/usr/local && \ diff --git a/.cicd/platforms/unpinned/centos-7.7-unpinned.dockerfile b/.cicd/platforms/unpinned/centos-7.7-unpinned.dockerfile index d246dbd5063..91c243170b5 100644 --- a/.cicd/platforms/unpinned/centos-7.7-unpinned.dockerfile +++ b/.cicd/platforms/unpinned/centos-7.7-unpinned.dockerfile @@ -21,7 +21,7 @@ RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ cd / && \ rm -rf cmake-3.13.2.tar.gz /cmake-3.13.2 # build boost -RUN curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ source /opt/rh/devtoolset-8/enable && \ source /opt/rh/rh-python36/enable && \ tar -xjf boost_1_71_0.tar.bz2 && \ diff --git a/.cicd/platforms/unpinned/ubuntu-18.04-unpinned.dockerfile b/.cicd/platforms/unpinned/ubuntu-18.04-unpinned.dockerfile index e50343cc06b..36902c23f19 100644 --- a/.cicd/platforms/unpinned/ubuntu-18.04-unpinned.dockerfile +++ b/.cicd/platforms/unpinned/ubuntu-18.04-unpinned.dockerfile @@ -18,7 +18,7 @@ RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ cd / && \ rm -rf cmake-3.13.2.tar.gz /cmake-3.13.2 # build boost -RUN curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --prefix=/usr/local && \ diff --git a/docs/00_install/01_build-from-source/02_manual-build/03_platforms/amazon_linux-2.md b/docs/00_install/01_build-from-source/02_manual-build/03_platforms/amazon_linux-2.md index a117fbb8503..dbc27799114 100644 --- a/docs/00_install/01_build-from-source/02_manual-build/03_platforms/amazon_linux-2.md +++ b/docs/00_install/01_build-from-source/02_manual-build/03_platforms/amazon_linux-2.md @@ -51,7 +51,7 @@ cd $EOSIO_INSTALL_LOCATION && curl -LO https://cmake.org/files/v3.13/cmake-3.13. make install && \ rm -rf $EOSIO_INSTALL_LOCATION/cmake-3.13.2.tar.gz $EOSIO_INSTALL_LOCATION/cmake-3.13.2 # build boost -cd $EOSIO_INSTALL_LOCATION && curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +cd $EOSIO_INSTALL_LOCATION && curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --prefix=$EOSIO_INSTALL_LOCATION && \ diff --git a/docs/00_install/01_build-from-source/02_manual-build/03_platforms/centos-7.7.md b/docs/00_install/01_build-from-source/02_manual-build/03_platforms/centos-7.7.md index c807056a381..8f4222d3a6c 100644 --- a/docs/00_install/01_build-from-source/02_manual-build/03_platforms/centos-7.7.md +++ b/docs/00_install/01_build-from-source/02_manual-build/03_platforms/centos-7.7.md @@ -58,7 +58,7 @@ cd $EOSIO_INSTALL_LOCATION && curl -LO https://cmake.org/files/v3.13/cmake-3.13. # apply clang patch cp -f $EOSIO_LOCATION/scripts/clang-devtoolset8-support.patch /tmp/clang-devtoolset8-support.patch # build boost -cd $EOSIO_INSTALL_LOCATION && curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +cd $EOSIO_INSTALL_LOCATION && curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ source /opt/rh/devtoolset-8/enable && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ diff --git a/docs/00_install/01_build-from-source/02_manual-build/03_platforms/ubuntu-18.04.md b/docs/00_install/01_build-from-source/02_manual-build/03_platforms/ubuntu-18.04.md index c5b3bbda0dd..31659865aa7 100644 --- a/docs/00_install/01_build-from-source/02_manual-build/03_platforms/ubuntu-18.04.md +++ b/docs/00_install/01_build-from-source/02_manual-build/03_platforms/ubuntu-18.04.md @@ -51,7 +51,7 @@ cd $EOSIO_INSTALL_LOCATION && curl -LO https://cmake.org/files/v3.13/cmake-3.13. make install && \ rm -rf $EOSIO_INSTALL_LOCATION/cmake-3.13.2.tar.gz $EOSIO_INSTALL_LOCATION/cmake-3.13.2 # build boost -cd $EOSIO_INSTALL_LOCATION && curl -LO https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ +cd $EOSIO_INSTALL_LOCATION && curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \ tar -xjf boost_1_71_0.tar.bz2 && \ cd boost_1_71_0 && \ ./bootstrap.sh --prefix=$EOSIO_INSTALL_LOCATION && \ diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index d68373fc1db..0c9fd2ba86f 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -254,7 +254,7 @@ function ensure-boost() { local SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" fi execute bash -c "cd $SRC_DIR && \ - curl -LO https://dl.bintray.com/boostorg/release/$BOOST_VERSION_MAJOR.$BOOST_VERSION_MINOR.$BOOST_VERSION_PATCH/source/boost_$BOOST_VERSION.tar.bz2 \ + curl -LO https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION_MAJOR.$BOOST_VERSION_MINOR.$BOOST_VERSION_PATCH/source/boost_$BOOST_VERSION.tar.bz2 \ && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ && cd $BOOST_ROOT \ && SDKROOT="$SDKROOT" ./bootstrap.sh ${BOOTSTRAP_FLAGS} --prefix=$BOOST_ROOT \ From 628e72092d8fa8962317d3be7d2ca6b42b1962d5 Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Wed, 14 Apr 2021 17:11:34 -0400 Subject: [PATCH 14/23] Add subjective_cpu_bill to get_account_results --- .../chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index dc8a55bd4ee..c560019d3de 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -160,6 +160,8 @@ class read_only { account_resource_limit cpu_limit; int64_t ram_usage = 0; + uint32_t subjective_cpu_bill = 0; + vector permissions; fc::variant total_resources; @@ -797,7 +799,7 @@ FC_REFLECT( eosio::chain_apis::read_only::get_scheduled_transactions_result, (tr FC_REFLECT( eosio::chain_apis::read_only::get_account_results, (account_name)(head_block_num)(head_block_time)(privileged)(last_code_update)(created) - (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(permissions) + (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(subjective_cpu_bill)(permissions) (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info) ) // @swap code_hash FC_REFLECT( eosio::chain_apis::read_only::get_code_results, (account_name)(code_hash)(wast)(wasm)(abi) ) From 20608dcbb11ccfdce4644e46487d1bf2a71654b6 Mon Sep 17 00:00:00 2001 From: Keke Li Date: Wed, 14 Apr 2021 19:11:12 -0700 Subject: [PATCH 15/23] Add cleos support for cpu subjective billing --- .../chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp | 2 +- programs/cleos/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index c560019d3de..19a11bb6842 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -799,7 +799,7 @@ FC_REFLECT( eosio::chain_apis::read_only::get_scheduled_transactions_result, (tr FC_REFLECT( eosio::chain_apis::read_only::get_account_results, (account_name)(head_block_num)(head_block_time)(privileged)(last_code_update)(created) - (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(subjective_cpu_bill)(permissions) + (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(subjective_cpu_bill)(subjective_cpu_bill)(permissions) (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info) ) // @swap code_hash FC_REFLECT( eosio::chain_apis::read_only::get_code_results, (account_name)(code_hash)(wast)(wasm)(abi) ) diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 3cf0df39943..9c6cbd7bc9f 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -2304,9 +2304,9 @@ void get_account( const string& accountName, const string& coresym, bool json_fo } } - std::cout << std::fixed << setprecision(3); std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.used ) << "\n"; + if(res.subjective_cpu_bill > 0) std::cout << indent << std::left << std::setw(11) << "subjective used:" << std::right << std::setw(18) << to_pretty_time( res.subjective_cpu_bill) << "\n"; std::cout << indent << std::left << std::setw(11) << "available:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.available ) << "\n"; std::cout << indent << std::left << std::setw(11) << "limit:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.max ) << "\n"; std::cout << std::endl; From a61dd835f8445b9694008f8f386157cf71cccb31 Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 15 Apr 2021 09:21:20 -0400 Subject: [PATCH 16/23] Export get_subjective_bill from producer_plugin and populate subjective_cpu_bill field in get_account result --- plugins/chain_plugin/CMakeLists.txt | 4 ++-- plugins/chain_plugin/chain_plugin.cpp | 6 ++++++ .../include/eosio/chain_plugin/chain_plugin.hpp | 2 +- .../include/eosio/producer_plugin/producer_plugin.hpp | 1 + plugins/producer_plugin/producer_plugin.cpp | 5 +++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/chain_plugin/CMakeLists.txt b/plugins/chain_plugin/CMakeLists.txt index 2699292ddda..85603ef92e2 100644 --- a/plugins/chain_plugin/CMakeLists.txt +++ b/plugins/chain_plugin/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( chain_plugin chain_plugin.cpp ${HEADERS} ) -target_link_libraries( chain_plugin eosio_chain appbase ) -target_include_directories( chain_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/appbase/include") +target_link_libraries( chain_plugin producer_plugin eosio_chain appbase ) +target_include_directories( chain_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/appbase/include" "${CMAKE_CURRENT_SOURCE_DIR}/../producer_plugin/include") add_subdirectory( test ) diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index b43f6dd100a..cc82736dcba 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -2436,6 +2437,11 @@ read_only::get_account_results read_only::get_account( const get_account_params& result.cpu_limit = rm.get_account_cpu_limit_ex( result.account_name, greylist_limit).first; result.ram_usage = rm.get_account_ram_usage( result.account_name ); + producer_plugin* producer_plug = app().find_plugin(); + if ( producer_plug ) { + result.subjective_cpu_bill = producer_plug->get_subjective_bill( result.account_name, fc::time_point::now() ); + } + const auto& permissions = d.get_index(); auto perm = permissions.lower_bound( boost::make_tuple( params.account_name ) ); while( perm != permissions.end() && perm->owner == params.account_name ) { diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index 19a11bb6842..c560019d3de 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -799,7 +799,7 @@ FC_REFLECT( eosio::chain_apis::read_only::get_scheduled_transactions_result, (tr FC_REFLECT( eosio::chain_apis::read_only::get_account_results, (account_name)(head_block_num)(head_block_time)(privileged)(last_code_update)(created) - (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(subjective_cpu_bill)(subjective_cpu_bill)(permissions) + (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(subjective_cpu_bill)(permissions) (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info) ) // @swap code_hash FC_REFLECT( eosio::chain_apis::read_only::get_code_results, (account_name)(code_hash)(wast)(wasm)(abi) ) diff --git a/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp b/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp index efa7be2ee83..d3abdb02733 100644 --- a/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp +++ b/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp @@ -81,6 +81,7 @@ class producer_plugin : public appbase::plugin { bool is_producer_key(const chain::public_key_type& key) const; chain::signature_type sign_compact(const chain::public_key_type& key, const fc::sha256& digest) const; + uint32_t get_subjective_bill( const account_name& first_auth, const fc::time_point& now ) const; virtual void plugin_initialize(const boost::program_options::variables_map& options); virtual void plugin_startup(); diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index b33e3264cd8..68395bc9aab 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -731,6 +731,11 @@ bool producer_plugin::is_producer_key(const chain::public_key_type& key) const return false; } +uint32_t producer_plugin::get_subjective_bill( const account_name& first_auth, const fc::time_point& now ) const +{ + return my->_subjective_billing.get_subjective_bill( first_auth, now ); +} + chain::signature_type producer_plugin::sign_compact(const chain::public_key_type& key, const fc::sha256& digest) const { if(key != chain::public_key_type()) { From 878e52af6751560d460bd81d9ce193e2ad4a78ae Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 15 Apr 2021 09:58:59 -0400 Subject: [PATCH 17/23] Make subjective cpu billing a separate entity in cleos output so that it is easier to be seen --- programs/cleos/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 9c6cbd7bc9f..34282d380ec 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -2306,11 +2306,14 @@ void get_account( const string& accountName, const string& coresym, bool json_fo std::cout << std::fixed << setprecision(3); std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.used ) << "\n"; - if(res.subjective_cpu_bill > 0) std::cout << indent << std::left << std::setw(11) << "subjective used:" << std::right << std::setw(18) << to_pretty_time( res.subjective_cpu_bill) << "\n"; std::cout << indent << std::left << std::setw(11) << "available:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.available ) << "\n"; std::cout << indent << std::left << std::setw(11) << "limit:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.max ) << "\n"; std::cout << std::endl; + std::cout << "subjective cpu bandwidth:" << std::endl; + std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( res.subjective_cpu_bill ) << "\n"; + std::cout << std::endl; + if( res.refund_request.is_object() ) { auto obj = res.refund_request.get_object(); auto request_time = fc::time_point_sec::from_iso_string( obj["request_time"].as_string() ); From 25b0b37a220275b66885223aa18ff4fd44bd0391 Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 15 Apr 2021 15:07:51 -0400 Subject: [PATCH 18/23] Make subject_cpu_bill optional so all versions of cleos can work --- .../include/eosio/chain_plugin/chain_plugin.hpp | 8 ++++---- programs/cleos/main.cpp | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index c560019d3de..dcb718fec24 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -160,8 +160,6 @@ class read_only { account_resource_limit cpu_limit; int64_t ram_usage = 0; - uint32_t subjective_cpu_bill = 0; - vector permissions; fc::variant total_resources; @@ -169,6 +167,8 @@ class read_only { fc::variant refund_request; fc::variant voter_info; fc::variant rex_info; + + optional subjective_cpu_bill; }; struct get_account_params { @@ -799,8 +799,8 @@ FC_REFLECT( eosio::chain_apis::read_only::get_scheduled_transactions_result, (tr FC_REFLECT( eosio::chain_apis::read_only::get_account_results, (account_name)(head_block_num)(head_block_time)(privileged)(last_code_update)(created) - (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(subjective_cpu_bill)(permissions) - (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info) ) + (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(permissions) + (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info)(subjective_cpu_bill) ) // @swap code_hash FC_REFLECT( eosio::chain_apis::read_only::get_code_results, (account_name)(code_hash)(wast)(wasm)(abi) ) FC_REFLECT( eosio::chain_apis::read_only::get_code_hash_results, (account_name)(code_hash) ) diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 34282d380ec..eaeea996f93 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -2311,7 +2311,11 @@ void get_account( const string& accountName, const string& coresym, bool json_fo std::cout << std::endl; std::cout << "subjective cpu bandwidth:" << std::endl; - std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( res.subjective_cpu_bill ) << "\n"; + uint32_t subjective_cpu_bill = 0; + if( res.subjective_cpu_bill.valid() ) { + subjective_cpu_bill = *res.subjective_cpu_bill; + } + std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( subjective_cpu_bill ) << "\n"; std::cout << std::endl; if( res.refund_request.is_object() ) { From 4cc445a61bda3cc896688bb989a326b6b0991b4d Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 15 Apr 2021 18:25:53 -0400 Subject: [PATCH 19/23] Find producer_plugin at startup and display subjective cpu bandwidth only when it is greater than 0 --- plugins/chain_plugin/chain_plugin.cpp | 9 ++++++--- .../include/eosio/chain_plugin/chain_plugin.hpp | 8 ++++++-- programs/cleos/main.cpp | 10 ++++------ tests/chain_plugin_tests.cpp | 2 +- tests/get_table_tests.cpp | 8 ++++---- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index cc82736dcba..100e843f25a 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -186,6 +186,7 @@ class chain_plugin_impl { fc::optional _account_query_db; + const producer_plugin* producer_plug; }; chain_plugin::chain_plugin() @@ -1145,6 +1146,9 @@ void chain_plugin::plugin_startup() EOS_ASSERT( my->chain_config->read_mode != db_read_mode::IRREVERSIBLE || !accept_transactions(), plugin_config_exception, "read-mode = irreversible. transactions should not be enabled by enable_accept_transactions" ); try { + my->producer_plug = app().find_plugin(); + EOS_ASSERT(my->producer_plug, plugin_exception, "Failed to find producer_plugin"); + auto shutdown = [](){ return app().is_quiting(); }; if (my->snapshot_path) { auto infile = std::ifstream(my->snapshot_path->generic_string(), (std::ios::in | std::ios::binary)); @@ -1213,7 +1217,7 @@ void chain_apis::read_write::validate() const { } chain_apis::read_only chain_plugin::get_read_only_api() const { - return chain_apis::read_only(chain(), my->_account_query_db, get_abi_serializer_max_time()); + return chain_apis::read_only(chain(), my->_account_query_db, get_abi_serializer_max_time(), my->producer_plug); } @@ -2437,8 +2441,7 @@ read_only::get_account_results read_only::get_account( const get_account_params& result.cpu_limit = rm.get_account_cpu_limit_ex( result.account_name, greylist_limit).first; result.ram_usage = rm.get_account_ram_usage( result.account_name ); - producer_plugin* producer_plug = app().find_plugin(); - if ( producer_plug ) { + if ( producer_plug ) { // producer_plug is null when called from chain_plugin_tests.cpp and get_table_tests.cpp result.subjective_cpu_bill = producer_plug->get_subjective_bill( result.account_name, fc::time_point::now() ); } diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index dcb718fec24..95947d518bb 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -42,6 +42,8 @@ namespace eosio { using chain::abi_def; using chain::abi_serializer; +class producer_plugin; + namespace chain_apis { struct empty{}; @@ -83,12 +85,14 @@ class read_only { const fc::optional& aqdb; const fc::microseconds abi_serializer_max_time; bool shorten_abi_errors = true; + const producer_plugin* producer_plug; public: static const string KEYi64; - read_only(const controller& db, const fc::optional& aqdb, const fc::microseconds& abi_serializer_max_time) - : db(db), aqdb(aqdb), abi_serializer_max_time(abi_serializer_max_time) {} + read_only(const controller& db, const fc::optional& aqdb, const fc::microseconds& abi_serializer_max_time, const producer_plugin* producer_plug) + : db(db), aqdb(aqdb), abi_serializer_max_time(abi_serializer_max_time), producer_plug(producer_plug) { + } void validate() const {} diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index eaeea996f93..0071d983555 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -2310,13 +2310,11 @@ void get_account( const string& accountName, const string& coresym, bool json_fo std::cout << indent << std::left << std::setw(11) << "limit:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.max ) << "\n"; std::cout << std::endl; - std::cout << "subjective cpu bandwidth:" << std::endl; - uint32_t subjective_cpu_bill = 0; - if( res.subjective_cpu_bill.valid() ) { - subjective_cpu_bill = *res.subjective_cpu_bill; + if( res.subjective_cpu_bill.valid() && *res.subjective_cpu_bill > 0 ) { + std::cout << "subjective cpu bandwidth:" << std::endl; + std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( *res.subjective_cpu_bill ) << "\n"; + std::cout << std::endl; } - std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( subjective_cpu_bill ) << "\n"; - std::cout << std::endl; if( res.refund_request.is_object() ) { auto obj = res.refund_request.get_object(); diff --git a/tests/chain_plugin_tests.cpp b/tests/chain_plugin_tests.cpp index 36a0beb6871..30f5d857c7f 100644 --- a/tests/chain_plugin_tests.cpp +++ b/tests/chain_plugin_tests.cpp @@ -89,7 +89,7 @@ BOOST_FIXTURE_TEST_CASE( get_block_with_invalid_abi, TESTER ) try { char headnumstr[20]; sprintf(headnumstr, "%d", headnum); chain_apis::read_only::get_block_params param{headnumstr}; - chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); + chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum(), {}); // block should be decoded successfully std::string block_str = json::to_pretty_string(plugin.get_block(param)); diff --git a/tests/get_table_tests.cpp b/tests/get_table_tests.cpp index 3e48272e4be..531e43a4b36 100644 --- a/tests/get_table_tests.cpp +++ b/tests/get_table_tests.cpp @@ -89,7 +89,7 @@ BOOST_FIXTURE_TEST_CASE( get_scope_test, TESTER ) try { produce_blocks(1); // iterate over scope - eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); + eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum(), {}); eosio::chain_apis::read_only::get_table_by_scope_params param{N(eosio.token), N(accounts), "inita", "", 10}; eosio::chain_apis::read_only::get_table_by_scope_result result = plugin.read_only::get_table_by_scope(param); @@ -194,7 +194,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try { produce_blocks(1); // get table: normal case - eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); + eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum(), {}); eosio::chain_apis::read_only::get_table_rows_params p; p.code = N(eosio.token); p.scope = "inita"; @@ -363,7 +363,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_by_seckey_test, TESTER ) try { produce_blocks(1); // get table: normal case - eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); + eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum(), {}); eosio::chain_apis::read_only::get_table_rows_params p; p.code = N(eosio); p.scope = "eosio"; @@ -515,7 +515,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_next_key_test, TESTER ) try { // } - chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); + chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum(), {}); chain_apis::read_only::get_table_rows_params params{ .json=true, .code=N(test), From 810a28dc158a08e4468417d6cba85b9cc25f249d Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 15 Apr 2021 20:21:42 -0400 Subject: [PATCH 20/23] Use account_resource_limit to store subjective CPU billing limit and display subjective cpu bandwidth only when it is valid --- plugins/chain_plugin/chain_plugin.cpp | 6 ++++-- .../include/eosio/chain_plugin/chain_plugin.hpp | 4 ++-- programs/cleos/main.cpp | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index 100e843f25a..a5cd15e9cee 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -2442,8 +2442,10 @@ read_only::get_account_results read_only::get_account( const get_account_params& result.ram_usage = rm.get_account_ram_usage( result.account_name ); if ( producer_plug ) { // producer_plug is null when called from chain_plugin_tests.cpp and get_table_tests.cpp - result.subjective_cpu_bill = producer_plug->get_subjective_bill( result.account_name, fc::time_point::now() ); - } + account_resource_limit subjective_cpu_bill_limit; + subjective_cpu_bill_limit.used = producer_plug->get_subjective_bill( result.account_name, fc::time_point::now() ); + result.subjective_cpu_bill_limit = subjective_cpu_bill_limit; + } const auto& permissions = d.get_index(); auto perm = permissions.lower_bound( boost::make_tuple( params.account_name ) ); diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index 95947d518bb..db80a8262b9 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -172,7 +172,7 @@ class read_only { fc::variant voter_info; fc::variant rex_info; - optional subjective_cpu_bill; + optional subjective_cpu_bill_limit; }; struct get_account_params { @@ -804,7 +804,7 @@ FC_REFLECT( eosio::chain_apis::read_only::get_scheduled_transactions_result, (tr FC_REFLECT( eosio::chain_apis::read_only::get_account_results, (account_name)(head_block_num)(head_block_time)(privileged)(last_code_update)(created) (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(permissions) - (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info)(subjective_cpu_bill) ) + (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info)(subjective_cpu_bill_limit) ) // @swap code_hash FC_REFLECT( eosio::chain_apis::read_only::get_code_results, (account_name)(code_hash)(wast)(wasm)(abi) ) FC_REFLECT( eosio::chain_apis::read_only::get_code_hash_results, (account_name)(code_hash) ) diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 0071d983555..142b2f3534e 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -2310,9 +2310,9 @@ void get_account( const string& accountName, const string& coresym, bool json_fo std::cout << indent << std::left << std::setw(11) << "limit:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.max ) << "\n"; std::cout << std::endl; - if( res.subjective_cpu_bill.valid() && *res.subjective_cpu_bill > 0 ) { + if( res.subjective_cpu_bill.valid() ) { std::cout << "subjective cpu bandwidth:" << std::endl; - std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( *res.subjective_cpu_bill ) << "\n"; + std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( *(res.subjective_cpu_bill).used ) << "\n"; std::cout << std::endl; } From faaadc50ef31c21ca268384d0d87da6686b5762e Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 15 Apr 2021 22:04:35 -0400 Subject: [PATCH 21/23] Fix a missing compile error, sorry --- programs/cleos/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 142b2f3534e..2b5c6650e1b 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -2310,9 +2310,9 @@ void get_account( const string& accountName, const string& coresym, bool json_fo std::cout << indent << std::left << std::setw(11) << "limit:" << std::right << std::setw(18) << to_pretty_time( res.cpu_limit.max ) << "\n"; std::cout << std::endl; - if( res.subjective_cpu_bill.valid() ) { + if( res.subjective_cpu_bill_limit.valid() ) { std::cout << "subjective cpu bandwidth:" << std::endl; - std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( *(res.subjective_cpu_bill).used ) << "\n"; + std::cout << indent << std::left << std::setw(11) << "used:" << std::right << std::setw(18) << to_pretty_time( (res.subjective_cpu_bill_limit)->used ) << "\n"; std::cout << std::endl; } From 8eb09159713b4b1bb630cf625308a99bb94f7eee Mon Sep 17 00:00:00 2001 From: Jingjun Zhao Date: Mon, 19 Apr 2021 12:26:21 -0400 Subject: [PATCH 22/23] Consolidated Security Updates for 2.0.12 - Apply three-strikes rule to all transaction failures - Apply unconditional subjective CPU check along with some additional logging - Provide options to enable subjective CPU billing for P2P and API transactions ,and provide an option to disable it for individual accounts Co-Authored-By:Kevin Heifner heifnerk@objectcomputing.com Co-Authored-By:Lin Huang lin.huang@block.one --- .../eosio/chain/transaction_context.hpp | 3 +- libraries/chain/transaction_context.cpp | 51 ++++++-- .../producer_plugin/subjective_billing.hpp | 8 +- plugins/producer_plugin/producer_plugin.cpp | 120 ++++++++++++++---- unittests/wasm_tests.cpp | 73 +++++++++-- 5 files changed, 201 insertions(+), 54 deletions(-) diff --git a/libraries/chain/include/eosio/chain/transaction_context.hpp b/libraries/chain/include/eosio/chain/transaction_context.hpp index d9cdff7b5e4..4f3c10442f6 100644 --- a/libraries/chain/include/eosio/chain/transaction_context.hpp +++ b/libraries/chain/include/eosio/chain/transaction_context.hpp @@ -97,7 +97,8 @@ namespace eosio { namespace chain { void record_transaction( const transaction_id_type& id, fc::time_point_sec expire ); void validate_cpu_usage_to_bill( int64_t billed_us, int64_t account_cpu_limit, bool check_minimum )const; - void validate_account_cpu_usage( int64_t billed_us, int64_t account_cpu_limit, bool estimate )const; + void validate_account_cpu_usage( int64_t billed_us, int64_t account_cpu_limit )const; + void validate_account_cpu_usage_estimate( int64_t billed_us, int64_t account_cpu_limit )const; void disallow_transaction_extensions( const char* error_msg )const; diff --git a/libraries/chain/transaction_context.cpp b/libraries/chain/transaction_context.cpp index 17d09d4a4dc..63a6a78ea6e 100644 --- a/libraries/chain/transaction_context.cpp +++ b/libraries/chain/transaction_context.cpp @@ -174,11 +174,11 @@ namespace eosio { namespace chain { if( !explicit_billed_cpu_time ) { // Fail early if amount of the previous speculative execution is within 10% of remaining account cpu available - int64_t validate_account_cpu_limit = account_cpu_limit - subjective_cpu_bill_us; + int64_t validate_account_cpu_limit = account_cpu_limit - subjective_cpu_bill_us + leeway.count(); // Add leeway to allow powerup if( validate_account_cpu_limit > 0 ) validate_account_cpu_limit -= EOS_PERCENT( validate_account_cpu_limit, 10 * config::percent_1 ); if( validate_account_cpu_limit < 0 ) validate_account_cpu_limit = 0; - validate_account_cpu_usage( billed_cpu_time_us, validate_account_cpu_limit, true ); + validate_account_cpu_usage_estimate( billed_cpu_time_us, validate_account_cpu_limit ); } eager_net_limit = (eager_net_limit/8)*8; // Round down to nearest multiple of word size (8 bytes) so check_net_usage can be efficient @@ -439,34 +439,65 @@ namespace eosio { namespace chain { ); } - validate_account_cpu_usage( billed_us, account_cpu_limit, false ); + validate_account_cpu_usage( billed_us, account_cpu_limit ); } } - void transaction_context::validate_account_cpu_usage( int64_t billed_us, int64_t account_cpu_limit, bool estimate )const { + void transaction_context::validate_account_cpu_usage( int64_t billed_us, int64_t account_cpu_limit )const { if( (billed_us > 0) && !control.skip_trx_checks() ) { const bool cpu_limited_by_account = (account_cpu_limit <= objective_duration_limit.count()); if( !cpu_limited_by_account && (billing_timer_exception_code == block_cpu_usage_exceeded::code_value) ) { EOS_ASSERT( billed_us <= objective_duration_limit.count(), block_cpu_usage_exceeded, - "${desc} CPU time (${billed} us) is greater than the billable CPU time left in the block (${billable} us)", - ("desc", (estimate ? "estimated" : "billed"))("billed", billed_us)( "billable", objective_duration_limit.count() ) + "billed CPU time (${billed} us) is greater than the billable CPU time left in the block (${billable} us)", + ("billed", billed_us)( "billable", objective_duration_limit.count() ) ); } else { if( cpu_limit_due_to_greylist && cpu_limited_by_account ) { EOS_ASSERT( billed_us <= account_cpu_limit, greylist_cpu_usage_exceeded, - "${desc} CPU time (${billed} us) is greater than the maximum greylisted billable CPU time for the transaction (${billable} us)", - ("desc", (estimate ? "estimated" : "billed"))("billed", billed_us)( "billable", account_cpu_limit ) + "billed CPU time (${billed} us) is greater than the maximum greylisted billable CPU time for the transaction (${billable} us)", + ("billed", billed_us)( "billable", account_cpu_limit ) ); } else { // exceeds trx.max_cpu_usage_ms or cfg.max_transaction_cpu_usage if objective_duration_limit is greater const int64_t cpu_limit = (cpu_limited_by_account ? account_cpu_limit : objective_duration_limit.count()); EOS_ASSERT( billed_us <= cpu_limit, tx_cpu_usage_exceeded, - "${desc} CPU time (${billed} us) is greater than the maximum billable CPU time for the transaction (${billable} us)", - ("desc", (estimate ? "estimated" : "billed"))("billed", billed_us)( "billable", cpu_limit ) + "billed CPU time (${billed} us) is greater than the maximum billable CPU time for the transaction (${billable} us)", + ("billed", billed_us)( "billable", cpu_limit ) + ); + } + } + } + } + + void transaction_context::validate_account_cpu_usage_estimate( int64_t prev_billed_us, int64_t account_cpu_limit )const { + // prev_billed_us can be 0, but so can account_cpu_limit + if( (prev_billed_us >= 0) && !control.skip_trx_checks() ) { + const bool cpu_limited_by_account = (account_cpu_limit <= objective_duration_limit.count()); + + if( !cpu_limited_by_account && (billing_timer_exception_code == block_cpu_usage_exceeded::code_value) ) { + EOS_ASSERT( prev_billed_us < objective_duration_limit.count(), + block_cpu_usage_exceeded, + "estimated CPU time (${billed} us) is not less than the billable CPU time left in the block (${billable} us)", + ("billed", prev_billed_us)( "billable", objective_duration_limit.count() ) + ); + } else { + if( cpu_limit_due_to_greylist && cpu_limited_by_account ) { + EOS_ASSERT( prev_billed_us < account_cpu_limit, + greylist_cpu_usage_exceeded, + "estimated CPU time (${billed} us) is not less than the maximum greylisted billable CPU time for the transaction (${billable} us)", + ("billed", prev_billed_us)( "billable", account_cpu_limit ) + ); + } else { + // exceeds trx.max_cpu_usage_ms or cfg.max_transaction_cpu_usage if objective_duration_limit is greater + const int64_t cpu_limit = (cpu_limited_by_account ? account_cpu_limit : objective_duration_limit.count()); + EOS_ASSERT( prev_billed_us < cpu_limit, + tx_cpu_usage_exceeded, + "estimated CPU time (${billed} us) is not less than the maximum billable CPU time for the transaction (${billable} us)", + ("billed", prev_billed_us)( "billable", cpu_limit ) ); } } diff --git a/plugins/producer_plugin/include/eosio/producer_plugin/subjective_billing.hpp b/plugins/producer_plugin/include/eosio/producer_plugin/subjective_billing.hpp index 0be8de26983..911a99a177e 100644 --- a/plugins/producer_plugin/include/eosio/producer_plugin/subjective_billing.hpp +++ b/plugins/producer_plugin/include/eosio/producer_plugin/subjective_billing.hpp @@ -60,6 +60,7 @@ class subjective_billing { trx_cache_index _trx_cache_index; account_subjective_bill_cache _account_subjective_bill_cache; block_subjective_bill_cache _block_subjective_bill_cache; + std::set _disabled_accounts; private: uint32_t time_ordinal_for( const fc::time_point& t ) const { @@ -112,12 +113,13 @@ class subjective_billing { public: void disable() { _disabled = true; } + void disable_account( chain::account_name a ) { _disabled_accounts.emplace( a ); } /// @param in_pending_block pass true if pt's bill time is accounted for in the pending block void subjective_bill( const transaction_id_type& id, const fc::time_point& expire, const account_name& first_auth, const fc::microseconds& elapsed, bool in_pending_block ) { - if( !_disabled ) { + if( !_disabled && !_disabled_accounts.count( first_auth ) ) { uint32_t bill = std::max( 0, elapsed.count() ); auto p = _trx_cache_index.emplace( trx_cache_entry{id, @@ -135,7 +137,7 @@ class subjective_billing { void subjective_bill_failure( const account_name& first_auth, const fc::microseconds& elapsed, const fc::time_point& now ) { - if( !_disabled ) { + if( !_disabled && !_disabled_accounts.count( first_auth ) ) { uint32_t bill = std::max( 0, elapsed.count() ); const auto time_ordinal = time_ordinal_for(now); _account_subjective_bill_cache[first_auth].expired_accumulator.add(bill, time_ordinal, expired_accumulator_average_window); @@ -143,7 +145,7 @@ class subjective_billing { } uint32_t get_subjective_bill( const account_name& first_auth, const fc::time_point& now ) const { - if( _disabled ) return 0; + if( _disabled || _disabled_accounts.count( first_auth ) ) return 0; const auto time_ordinal = time_ordinal_for(now); const subjective_billing_info* sub_bill_info = nullptr; auto aitr = _account_subjective_bill_cache.find( first_auth ); diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index 68395bc9aab..6da601f263e 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -218,6 +218,8 @@ class producer_plugin_impl : public std::enable_shared_from_thisget_executor(), chain.get_chain_id(), fc::microseconds( max_trx_cpu_usage ), chain.configured_subjective_signature_length_limit() ); - auto trx_id = trx->id(); boost::asio::post(_thread_pool->get_executor(), [self = this, future{std::move(future)}, persist_until_expired, - next{std::move(next)}, trx_id]() mutable { + next{std::move(next)}, trx]() mutable { if( future.valid() ) { future.wait(); - app().post( priority::low, [self, future{std::move(future)}, persist_until_expired, next{std::move( next )}, trx_id]() mutable { - auto exception_handler = [&next, trx_id](fc::exception_ptr ex) { - fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid} : ${why} ", - ("txid", trx_id)("why",ex->what())); - fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid} : ${why} ", - ("txid", trx_id)("why",ex->what())); + app().post( priority::low, [self, future{std::move(future)}, persist_until_expired, next{std::move( next )}, trx{std::move(trx)}]() mutable { + auto exception_handler = [&next, trx{std::move(trx)}](fc::exception_ptr ex) { + fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid}, auth: ${a} : ${why} ", + ("txid", trx->id())("a",trx->get_transaction().first_authorizer())("why",ex->what())); + fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid}, auth: ${a} : ${why} ", + ("txid", trx->id())("a",trx->get_transaction().first_authorizer())("why",ex->what())); next(ex); }; try { @@ -473,34 +474,40 @@ class producer_plugin_impl : public std::enable_shared_from_this()) { _transaction_ack_channel.publish(priority::low, std::pair(response.get(), trx)); if (_pending_block_mode == pending_block_mode::producing) { - fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is REJECTING tx: ${txid} : ${why} ", + fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is REJECTING tx: ${txid}, auth: ${a} : ${why} ", ("block_num", chain.head_block_num() + 1) ("prod", get_pending_block_producer()) ("txid", trx->id()) + ("a", trx->packed_trx()->get_transaction().first_authorizer()) ("why",response.get()->what())); - fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is REJECTING tx: ${txid} : ${why} ", + fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is REJECTING tx: ${txid}, auth: ${a} : ${why} ", ("block_num", chain.head_block_num() + 1) ("prod", get_pending_block_producer()) ("txid", trx->id()) + ("a", trx->packed_trx()->get_transaction().first_authorizer()) ("why",response.get()->what())); } else { - fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid} : ${why} ", + fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid}, auth: ${a} : ${why} ", ("txid", trx->id()) + ("a", trx->packed_trx()->get_transaction().first_authorizer()) ("why",response.get()->what())); - fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid} : ${why} ", + fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid}, auth: ${a} : ${why} ", ("txid", trx->id()) + ("a", trx->packed_trx()->get_transaction().first_authorizer()) ("why",response.get()->what())); } } else { _transaction_ack_channel.publish(priority::low, std::pair(nullptr, trx)); if (_pending_block_mode == pending_block_mode::producing) { - fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is ACCEPTING tx: ${txid}", + fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is ACCEPTING tx: ${txid}, auth: ${a}", ("block_num", chain.head_block_num() + 1) ("prod", get_pending_block_producer()) - ("txid", trx->id())); + ("txid", trx->id()) + ("a", trx->packed_trx()->get_transaction().first_authorizer())); } else { - fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Speculative execution is ACCEPTING tx: ${txid}", - ("txid", trx->id())); + fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Speculative execution is ACCEPTING tx: ${txid}, auth: ${a}", + ("txid", trx->id()) + ("a", trx->packed_trx()->get_transaction().first_authorizer())); } } }; @@ -538,12 +545,17 @@ class producer_plugin_impl : public std::enable_shared_from_thispacked_trx()->get_transaction().first_authorizer(); uint32_t sub_bill = 0; - if( _pending_block_mode != pending_block_mode::producing) + if( !disable_subjective_billing ) sub_bill = _subjective_billing.get_subjective_bill( first_auth, fc::time_point::now() ); auto trace = chain.push_transaction( trx, deadline, trx->billed_cpu_time_us, false, sub_bill ); + fc_dlog( _trx_failed_trace_log, "Subjective bill for ${a}: ${b} elapsed ${t}us", ("a",first_auth)("b",sub_bill)("t",trace->elapsed)); if( trace->except ) { if( exception_is_exhausted( *trace->except, deadline_is_subjective )) { _pending_incoming_transactions.add( trx, persist_until_expired, next ); @@ -713,8 +725,14 @@ void producer_plugin::set_program_options( "Maximum size (in MiB) of the incoming transaction queue. Exceeding this value will subjectively drop transaction with resource exhaustion.") ("disable-api-persisted-trx", bpo::bool_switch()->default_value(false), "Disable the re-apply of API transactions.") - ("disable-subjective-billing", bpo::bool_switch()->default_value(false), - "Disable subjective billing.") + ("disable-subjective-billing", bpo::value()->default_value(true), + "Disable subjective CPU billing for API/P2P transactions") + ("disable-subjective-account-billing", boost::program_options::value>()->composing()->multitoken(), + "Account which is excluded from subjective CPU billing") + ("disable-subjective-p2p-billing", bpo::value()->default_value(true), + "Disable subjective CPU billing for P2P transactions") + ("disable-subjective-api-billing", bpo::value()->default_value(true), + "Disable subjective CPU billing for API transactions") ("producer-threads", bpo::value()->default_value(config::default_controller_thread_pool_size), "Number of worker threads in producer thread pool") ("snapshots-dir", bpo::value()->default_value("snapshots"), @@ -904,7 +922,25 @@ void producer_plugin::plugin_initialize(const boost::program_options::variables_ my->_incoming_defer_ratio = options.at("incoming-defer-ratio").as(); my->_disable_persist_until_expired = options.at("disable-api-persisted-trx").as(); - if( options.at("disable-subjective-billing").as() ) my->_subjective_billing.disable(); + bool disable_subjective_billing = options.at("disable-subjective-billing").as(); + my->_disable_subjective_p2p_billing = options.at("disable-subjective-p2p-billing").as(); + my->_disable_subjective_api_billing = options.at("disable-subjective-api-billing").as(); + dlog( "disable-subjective-billing: ${s}, disable-subjective-p2p-billing: ${p2p}, disable-subjective-api-billing: ${api}", + ("s", disable_subjective_billing)("p2p", my->_disable_subjective_p2p_billing)("api", my->_disable_subjective_api_billing) ); + if( !disable_subjective_billing ) { + my->_disable_subjective_p2p_billing = my->_disable_subjective_api_billing = false; + } else if( !my->_disable_subjective_p2p_billing || !my->_disable_subjective_api_billing ) { + disable_subjective_billing = false; + } + if( disable_subjective_billing ) { + my->_subjective_billing.disable(); + ilog( "Subjective CPU billing disabled" ); + } else if( !my->_disable_subjective_p2p_billing && !my->_disable_subjective_api_billing ) { + ilog( "Subjective CPU billing enabled" ); + } else { + if( my->_disable_subjective_p2p_billing ) ilog( "Subjective CPU billing of P2P trxs disabled " ); + if( my->_disable_subjective_api_billing ) ilog( "Subjective CPU billing of API trxs disabled " ); + } auto thread_pool_size = options.at( "producer-threads" ).as(); EOS_ASSERT( thread_pool_size > 0, plugin_config_exception, @@ -964,6 +1000,13 @@ void producer_plugin::plugin_initialize(const boost::program_options::variables_ chain.set_greylist_limit( greylist_limit ); } + if( options.count("disable-subjective-account-billing") ) { + std::vector accounts = options["disable-subjective-account-billing"].as>(); + for( const auto& a : accounts ) { + my->_subjective_billing.disable_account( account_name(a) ); + } + } + } FC_LOG_AND_RETHROW() } void producer_plugin::plugin_startup() @@ -1737,17 +1780,15 @@ bool producer_plugin_impl::remove_expired_blacklisted_trxs( const fc::time_point } namespace { -// track multiple deadline / transaction cpu exceeded exceptions on unapplied transactions +// track multiple failures on unapplied transactions class account_failures { public: constexpr static uint32_t max_failures_per_account = 3; void add( const account_name& n, int64_t exception_code ) { - if( exception_code == deadline_exception::code_value || exception_code == tx_cpu_usage_exceeded::code_value ) { - auto& fa = failed_accounts[n]; - ++fa.num_failures; - fa.add( exception_code ); - } + auto& fa = failed_accounts[n]; + ++fa.num_failures; + fa.add( n, exception_code ); } // return true if exceeds max_failures_per_account and should be dropped @@ -1771,6 +1812,14 @@ class account_failures { if( !reason.empty() ) reason += ", "; reason += "tx_cpu_usage"; } + if( e.second.is_eosio_assert() ) { + if( !reason.empty() ) reason += ", "; + reason += "assert"; + } + if( e.second.is_other() ) { + if( !reason.empty() ) reason += ", "; + reason += "other"; + } fc_dlog( _log, "Dropped ${n} trxs, account: ${a}, reason: ${r} exceeded", ("n", e.second.num_failures - max_failures_per_account)("a", e.first)("r", reason) ); } @@ -1782,18 +1831,30 @@ class account_failures { struct account_failure { enum class ex_fields : uint8_t { ex_deadline_exception = 1, - ex_tx_cpu_usage_exceeded = 2 + ex_tx_cpu_usage_exceeded = 2, + ex_eosio_assert_exception = 4, + ex_other_exception = 8 }; - void add(int64_t exception_code = 0) { + void add( const account_name& n, int64_t exception_code ) { if( exception_code == tx_cpu_usage_exceeded::code_value ) { ex_flags = set_field( ex_flags, ex_fields::ex_tx_cpu_usage_exceeded ); } else if( exception_code == deadline_exception::code_value ) { ex_flags = set_field( ex_flags, ex_fields::ex_deadline_exception ); + } else if( exception_code == eosio_assert_message_exception::code_value || + exception_code == eosio_assert_code_exception::code_value ) { + ex_flags = set_field( ex_flags, ex_fields::ex_eosio_assert_exception ); + } else { + ex_flags = set_field( ex_flags, ex_fields::ex_other_exception ); + fc_dlog( _log, "Failed trx, account: ${a}, reason: ${r}", + ("a", n)("r", exception_code) ); } } + bool is_deadline() const { return has_field( ex_flags, ex_fields::ex_deadline_exception ); } bool is_tx_cpu_usage() const { return has_field( ex_flags, ex_fields::ex_tx_cpu_usage_exceeded ); } + bool is_eosio_assert() const { return has_field( ex_flags, ex_fields::ex_eosio_assert_exception ); } + bool is_other() const { return has_field( ex_flags, ex_fields::ex_other_exception ); } uint32_t num_failures = 0; uint8_t ex_flags = 0; @@ -1852,6 +1913,7 @@ bool producer_plugin_impl::process_unapplied_trxs( const fc::time_point& deadlin const uint32_t sub_bill = 0; auto trace = chain.push_transaction( trx, trx_deadline, prev_billed_cpu_time_us, false, sub_bill ); + fc_dlog( _trx_failed_trace_log, "Subjective unapplied bill for ${a}: ${b} prev ${t}us", ("a",first_auth)("b",prev_billed_cpu_time_us)("t",trace->elapsed)); if( trace->except ) { if( exception_is_exhausted( *trace->except, deadline_is_subjective ) ) { if( block_is_exhausted() ) { @@ -1860,6 +1922,7 @@ bool producer_plugin_impl::process_unapplied_trxs( const fc::time_point& deadlin break; } } else { + fc_dlog( _trx_failed_trace_log, "Subjective unapplied bill for failed ${a}: ${b} prev ${t}us", ("a",first_auth)("b",prev_billed_cpu_time_us)("t",trace->elapsed)); auto failure_code = trace->except->code(); if( failure_code != tx_duplicate::code_value ) { // this failed our configured maximum transaction time, we don't want to replay it @@ -1874,6 +1937,7 @@ bool producer_plugin_impl::process_unapplied_trxs( const fc::time_point& deadlin continue; } } else { + fc_dlog( _trx_successful_trace_log, "Subjective unapplied bill for success ${a}: ${b} prev ${t}us", ("a",first_auth)("b",prev_billed_cpu_time_us)("t",trace->elapsed)); // if db_read_mode SPECULATIVE then trx is in the pending block and not immediately reverted _subjective_billing.subjective_bill( trx->id(), trx->packed_trx()->expiration(), first_auth, trace->elapsed, chain.get_read_mode() == chain::db_read_mode::SPECULATIVE ); diff --git a/unittests/wasm_tests.cpp b/unittests/wasm_tests.cpp index 655971bd64d..d816f85b54d 100644 --- a/unittests/wasm_tests.cpp +++ b/unittests/wasm_tests.cpp @@ -2009,20 +2009,11 @@ BOOST_AUTO_TEST_CASE( billed_cpu_test ) try { cpu_limit = mgr.get_account_cpu_limit_ex(acc).first.max; cpu_limit -= EOS_PERCENT( cpu_limit, 10 * config::percent_1 ); // transaction_context verifies within 10%, so subtract 10% out - ptrx = create_trx(0); - BOOST_CHECK_LT( cpu_limit+1, max_cpu_time_us ); // needs to be less or this just tests the same thing as max_cpu_time_us test above - // indicate non-explicit billing with 1 more than our account cpu limit, triggers optimization check #8638 and fails trx - BOOST_CHECK_EXCEPTION( push_trx( ptrx, fc::time_point::maximum(), cpu_limit+1, false, 0 ), tx_cpu_usage_exceeded, - fc_exception_message_starts_with("estimated") ); - // indicate non-explicit billing with 1 more (subjective) than our account cpu limit, triggers optimization check #8638 and fails trx - BOOST_CHECK_EXCEPTION( push_trx( ptrx, fc::time_point::maximum(), cpu_limit, false, 1 ), tx_cpu_usage_exceeded, - fc_exception_message_starts_with("estimated") ); - ptrx = create_trx(0); BOOST_CHECK_LT( cpu_limit, max_cpu_time_us ); - // indicate non-explicit billing at our account cpu limit, will allow this trx to run, but only bills for actual use - auto r = push_trx( ptrx, fc::time_point::maximum(), cpu_limit, false, 0 ); - BOOST_CHECK_LT( r->receipt->cpu_usage_us, cpu_limit ); // verify not billed at provided bill amount when explicit_billed_cpu_time=false + // indicate non-explicit billing at one less than our account cpu limit, will allow this trx to run, but only bills for actual use + auto r = push_trx( ptrx, fc::time_point::maximum(), cpu_limit-1, false, 0 ); + BOOST_CHECK_LT( r->receipt->cpu_usage_us, cpu_limit-1 ); // verify not billed at provided bill amount when explicit_billed_cpu_time=false chain.produce_block(); chain.produce_block( fc::days(1) ); // produce for one day to reset account cpu @@ -2034,6 +2025,64 @@ BOOST_AUTO_TEST_CASE( billed_cpu_test ) try { BOOST_CHECK_EXCEPTION( push_trx( ptrx, fc::time_point::maximum(), cpu_limit+1, true, 0 ), tx_cpu_usage_exceeded, fc_exception_message_starts_with("billed") ); + // leeway and subjective billing interaction tests + auto leeway = fc::microseconds(config::default_subjective_cpu_leeway_us); + chain.control->set_subjective_cpu_leeway(leeway); + + // Allow transaction with billed cpu less than 90% of (account cpu limit + leeway - subjective bill) + chain.produce_block(); + chain.produce_block( fc::days(1) ); // produce for one day to reset account cpu + ptrx = create_trx(0); + uint32_t combined_cpu_limit = mgr.get_account_cpu_limit_ex(acc).first.max + leeway.count(); + uint32_t subjective_cpu_bill_us = leeway.count(); + uint32_t billed_cpu_time_us = EOS_PERCENT( (combined_cpu_limit - subjective_cpu_bill_us), 89 *config::percent_1 ); + push_trx( ptrx, fc::time_point::maximum(), billed_cpu_time_us, false, subjective_cpu_bill_us ); + + // Allow transaction with billed cpu less than 90% of (account cpu limit + leeway) if subject bill is 0 + chain.control->set_subjective_cpu_leeway(leeway); + chain.produce_block(); + chain.produce_block( fc::days(1) ); // produce for one day to reset account cpu + ptrx = create_trx(0); + combined_cpu_limit = mgr.get_account_cpu_limit_ex(acc).first.max + leeway.count(); + subjective_cpu_bill_us = 0; + billed_cpu_time_us = EOS_PERCENT( combined_cpu_limit - subjective_cpu_bill_us, 89 *config::percent_1 ); + push_trx( ptrx, fc::time_point::maximum(), billed_cpu_time_us, false, subjective_cpu_bill_us ); + + // Disallow transaction with billed cpu equal to 90% of (account cpu limit + leeway - subjective bill) + chain.produce_block(); + chain.produce_block( fc::days(1) ); // produce for one day to reset account cpu + ptrx = create_trx(0); + cpu_limit = mgr.get_account_cpu_limit_ex(acc).first.max; + combined_cpu_limit = cpu_limit + leeway.count(); + subjective_cpu_bill_us = cpu_limit; + billed_cpu_time_us = EOS_PERCENT( combined_cpu_limit - subjective_cpu_bill_us, 90 * config::percent_1 ); + BOOST_CHECK_EXCEPTION(push_trx( ptrx, fc::time_point::maximum(), billed_cpu_time_us, false, subjective_cpu_bill_us ), tx_cpu_usage_exceeded, + fc_exception_message_starts_with("estimated") ); + + // Disallow transaction with billed cpu greater 90% of (account cpu limit + leeway - subjective bill) + subjective_cpu_bill_us = 0; + billed_cpu_time_us = EOS_PERCENT( combined_cpu_limit - subjective_cpu_bill_us, 91 * config::percent_1 ); + BOOST_CHECK_EXCEPTION(push_trx( ptrx, fc::time_point::maximum(), billed_cpu_time_us, false, subjective_cpu_bill_us ), tx_cpu_usage_exceeded, + fc_exception_message_starts_with("estimated") ); + + // Test when cpu limit is 0 + chain.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + ("account", acc) + ("ram_bytes", -1) + ("net_weight", 75) + ("cpu_weight", 0) + ); + + chain.produce_block(); + chain.produce_block( fc::days(1) ); // produce for one day to reset account cpu + + // Allow transaction with billed cpu less than 90% of leeway subjective bill being 0 to run but fail it if no cpu is staked afterwards + ptrx = create_trx(0); + subjective_cpu_bill_us = 0; + billed_cpu_time_us = EOS_PERCENT( leeway.count(), 89 *config::percent_1 ); + BOOST_CHECK_EXCEPTION(push_trx( ptrx, fc::time_point::maximum(), billed_cpu_time_us, false, subjective_cpu_bill_us ), tx_cpu_usage_exceeded, + fc_exception_message_starts_with("billed") ); + } FC_LOG_AND_RETHROW() From c36217be23da66d4ff7f2d96835b3bbbcf9c1937 Mon Sep 17 00:00:00 2001 From: Jingjun Zhao Date: Mon, 19 Apr 2021 13:11:48 -0400 Subject: [PATCH 23/23] Bump version to v2.0.12 --- CMakeLists.txt | 2 +- README.md | 12 ++++++------ docs/00_install/00_install-prebuilt-binaries.md | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31c962a89c3..f5396a82adf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set( CXX_STANDARD_REQUIRED ON) set(VERSION_MAJOR 2) set(VERSION_MINOR 0) -set(VERSION_PATCH 11) +set(VERSION_PATCH 12) #set(VERSION_SUFFIX rc3) if(VERSION_SUFFIX) diff --git a/README.md b/README.md index 4027ed9d4cc..3a1399cdc4e 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,13 @@ brew remove eosio #### Ubuntu 18.04 Package Install ```sh -wget https://github.com/eosio/eos/releases/download/v2.0.11/eosio_2.0.11-1-ubuntu-18.04_amd64.deb -sudo apt install ./eosio_2.0.11-1-ubuntu-18.04_amd64.deb +wget https://github.com/eosio/eos/releases/download/v2.0.12/eosio_2.0.12-1-ubuntu-18.04_amd64.deb +sudo apt install ./eosio_2.0.12-1-ubuntu-18.04_amd64.deb ``` #### Ubuntu 16.04 Package Install ```sh -wget https://github.com/eosio/eos/releases/download/v2.0.11/eosio_2.0.11-1-ubuntu-16.04_amd64.deb -sudo apt install ./eosio_2.0.11-1-ubuntu-16.04_amd64.deb +wget https://github.com/eosio/eos/releases/download/v2.0.12/eosio_2.0.12-1-ubuntu-16.04_amd64.deb +sudo apt install ./eosio_2.0.12-1-ubuntu-16.04_amd64.deb ``` #### Ubuntu Package Uninstall ```sh @@ -91,8 +91,8 @@ sudo apt remove eosio #### RPM Package Install ```sh -wget https://github.com/eosio/eos/releases/download/v2.0.11/eosio-2.0.11-1.el7.x86_64.rpm -sudo yum install ./eosio-2.0.11-1.el7.x86_64.rpm +wget https://github.com/eosio/eos/releases/download/v2.0.12/eosio-2.0.12-1.el7.x86_64.rpm +sudo yum install ./eosio-2.0.12-1.el7.x86_64.rpm ``` #### RPM Package Uninstall ```sh diff --git a/docs/00_install/00_install-prebuilt-binaries.md b/docs/00_install/00_install-prebuilt-binaries.md index 882d56d6463..d9e51f95174 100644 --- a/docs/00_install/00_install-prebuilt-binaries.md +++ b/docs/00_install/00_install-prebuilt-binaries.md @@ -25,13 +25,13 @@ brew remove eosio #### Ubuntu 18.04 Package Install ```sh -wget https://github.com/eosio/eos/releases/download/v2.0.11/eosio_2.0.11-1-ubuntu-18.04_amd64.deb -sudo apt install ./eosio_2.0.11-1-ubuntu-18.04_amd64.deb +wget https://github.com/eosio/eos/releases/download/v2.0.12/eosio_2.0.12-1-ubuntu-18.04_amd64.deb +sudo apt install ./eosio_2.0.12-1-ubuntu-18.04_amd64.deb ``` #### Ubuntu 16.04 Package Install ```sh -wget https://github.com/eosio/eos/releases/download/v2.0.11/eosio_2.0.11-1-ubuntu-16.04_amd64.deb -sudo apt install ./eosio_2.0.11-1-ubuntu-16.04_amd64.deb +wget https://github.com/eosio/eos/releases/download/v2.0.12/eosio_2.0.12-1-ubuntu-16.04_amd64.deb +sudo apt install ./eosio_2.0.12-1-ubuntu-16.04_amd64.deb ``` #### Ubuntu Package Uninstall ```sh @@ -42,8 +42,8 @@ sudo apt remove eosio #### RPM Package Install ```sh -wget https://github.com/eosio/eos/releases/download/v2.0.11/eosio-2.0.11-1.el7.x86_64.rpm -sudo yum install ./eosio-2.0.11-1.el7.x86_64.rpm +wget https://github.com/eosio/eos/releases/download/v2.0.12/eosio-2.0.12-1.el7.x86_64.rpm +sudo yum install ./eosio-2.0.12-1.el7.x86_64.rpm ``` #### RPM Package Uninstall ```sh