From b5bf4ad4d5fe9c71746f282ffc1d768d0dcb9a06 Mon Sep 17 00:00:00 2001 From: Qing Zhang Date: Mon, 26 Oct 2020 14:00:47 -0700 Subject: [PATCH 1/8] add KV Table iterator bool operator --- libraries/eosiolib/contracts/eosio/key_value.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/eosiolib/contracts/eosio/key_value.hpp b/libraries/eosiolib/contracts/eosio/key_value.hpp index a8e3737593..4529f2d232 100644 --- a/libraries/eosiolib/contracts/eosio/key_value.hpp +++ b/libraries/eosiolib/contracts/eosio/key_value.hpp @@ -587,6 +587,10 @@ class table : internal::table_base { bool operator>=(const iterator& b) const { return base_iterator::compare(b) >= 0; } + + explicit operator bool() { + return base_iterator::compare(this) != 0; + } }; class reverse_iterator : public base_iterator { From f81ca95d4fdf2c5777d0e49d97341479d189de23 Mon Sep 17 00:00:00 2001 From: Qing Zhang Date: Tue, 27 Oct 2020 10:45:49 -0700 Subject: [PATCH 2/8] kv table iterator bool operator calls valid function --- libraries/eosiolib/contracts/eosio/key_value.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/eosiolib/contracts/eosio/key_value.hpp b/libraries/eosiolib/contracts/eosio/key_value.hpp index 4529f2d232..cf14e0bc73 100644 --- a/libraries/eosiolib/contracts/eosio/key_value.hpp +++ b/libraries/eosiolib/contracts/eosio/key_value.hpp @@ -462,6 +462,11 @@ namespace internal { return eosio::key_type{(char*)buffer, actual_value_size}; } + bool valid() const { + eosio::check(itr_stat != status::iterator_erased, "Iterator was erased"); + return true; + } + protected: uint32_t itr; status itr_stat; @@ -589,7 +594,7 @@ class table : internal::table_base { } explicit operator bool() { - return base_iterator::compare(this) != 0; + return this.valid(); } }; From 5da6713a329cfda76eff949ccf44f7d37fd80211 Mon Sep 17 00:00:00 2001 From: Qing Zhang Date: Tue, 27 Oct 2020 12:15:09 -0700 Subject: [PATCH 3/8] return true/false instead of eosio::check --- libraries/eosiolib/contracts/eosio/key_value.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libraries/eosiolib/contracts/eosio/key_value.hpp b/libraries/eosiolib/contracts/eosio/key_value.hpp index cf14e0bc73..c237637486 100644 --- a/libraries/eosiolib/contracts/eosio/key_value.hpp +++ b/libraries/eosiolib/contracts/eosio/key_value.hpp @@ -462,10 +462,7 @@ namespace internal { return eosio::key_type{(char*)buffer, actual_value_size}; } - bool valid() const { - eosio::check(itr_stat != status::iterator_erased, "Iterator was erased"); - return true; - } + bool valid() const { return itr_stat != status::iterator_erased; } protected: uint32_t itr; @@ -593,7 +590,7 @@ class table : internal::table_base { return base_iterator::compare(b) >= 0; } - explicit operator bool() { + explicit operator bool() const { return this.valid(); } }; From 8763f37f9cc203ea980601848dee2fd5dd3dd0f2 Mon Sep 17 00:00:00 2001 From: Qing Zhang Date: Wed, 28 Oct 2020 07:43:03 -0700 Subject: [PATCH 4/8] fix a syntax error --- libraries/eosiolib/contracts/eosio/key_value.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/eosiolib/contracts/eosio/key_value.hpp b/libraries/eosiolib/contracts/eosio/key_value.hpp index c237637486..d701dcaecd 100644 --- a/libraries/eosiolib/contracts/eosio/key_value.hpp +++ b/libraries/eosiolib/contracts/eosio/key_value.hpp @@ -591,7 +591,7 @@ class table : internal::table_base { } explicit operator bool() const { - return this.valid(); + return this->valid(); } }; From fb5bb2c2e2d33bbd57f741c733705d23a345206b Mon Sep 17 00:00:00 2001 From: Qing Zhang Date: Tue, 10 Nov 2020 08:58:21 -0800 Subject: [PATCH 5/8] iterator end should return boolean false --- libraries/eosiolib/contracts/eosio/key_value.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/eosiolib/contracts/eosio/key_value.hpp b/libraries/eosiolib/contracts/eosio/key_value.hpp index d701dcaecd..eee927c383 100644 --- a/libraries/eosiolib/contracts/eosio/key_value.hpp +++ b/libraries/eosiolib/contracts/eosio/key_value.hpp @@ -462,7 +462,7 @@ namespace internal { return eosio::key_type{(char*)buffer, actual_value_size}; } - bool valid() const { return itr_stat != status::iterator_erased; } + bool valid() const { return itr_stat == status::iterator_ok; } protected: uint32_t itr; From 05fe019870f6b24a98276b562f16f4b2e4fa59e7 Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Fri, 6 Nov 2020 16:23:52 -0500 Subject: [PATCH 6/8] Fix specification of contract builder for Buildkite build and integration test steps. --- .cicd/build.sh | 2 ++ .cicd/integration-tests.sh | 7 ++++++- .cicd/pipeline.yml | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.cicd/build.sh b/.cicd/build.sh index 3e37840dc7..f1d5a8cfbc 100755 --- a/.cicd/build.sh +++ b/.cicd/build.sh @@ -29,6 +29,8 @@ else # Linux if [[ $BUILDKITE == true ]]; then # Generate Base Images $CICD_DIR/generate-base-images.sh + if [[ "$IMAGE_TAG" == 'ubuntu-18.04' ]]; then + FULL_TAG='eosio/ci-contracts-builder:base-ubuntu-18.04-develop' fi COMMANDS="$PRE_COMMANDS && $BUILD_COMMANDS" diff --git a/.cicd/integration-tests.sh b/.cicd/integration-tests.sh index ad00d9a6ff..9c42c86bc7 100755 --- a/.cicd/integration-tests.sh +++ b/.cicd/integration-tests.sh @@ -20,7 +20,12 @@ if [[ -f $BUILDKITE_ENV_FILE ]]; then done < "$BUILDKITE_ENV_FILE" fi set +e -eval docker run $ARGS $evars $IMAGE_TAG bash -c \"$COMMANDS\" + +if [[ "$BUILDKITE" == 'true' && "$IMAGE_TAG" == 'ubuntu-18.04' ]]; then + FULL_TAG='eosio/ci-contracts-builder:base-ubuntu-18.04-develop' +fi + +eval docker run $ARGS $evars $FULL_TAG bash -c \"$COMMANDS\" EXIT_STATUS=$? # buildkite diff --git a/.cicd/pipeline.yml b/.cicd/pipeline.yml index 3c5b31aaeb..97e6744fec 100644 --- a/.cicd/pipeline.yml +++ b/.cicd/pipeline.yml @@ -40,7 +40,7 @@ steps: - "./.cicd/build-integration.sh" - "tar -pczf build.tar.gz build && buildkite-agent artifact upload build.tar.gz" env: - IMAGE_TAG: "eosio/ci-contracts-builder:base-ubuntu-18.04-develop" + IMAGE_TAG: "ubuntu-18.04" agents: queue: "automation-eks-eos-builder-fleet" timeout: ${TIMEOUT:-60} @@ -321,7 +321,7 @@ steps: - "buildkite-agent artifact download build.tar.gz . --step ':ubuntu: Ubuntu 18.04 - Build' --agent-access-token $$BUILDKITE_AGENT_ACCESS_TOKEN && tar -xzf build.tar.gz" - "./.cicd/integration-tests.sh" env: - IMAGE_TAG: "eosio/ci-contracts-builder:base-ubuntu-18.04-develop" + IMAGE_TAG: "ubuntu-18.04" agents: queue: "automation-eks-eos-tester-fleet" timeout: ${TIMEOUT:-10} From 92e2607ef909173c5e6733c0b77f633416388e7f Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Fri, 6 Nov 2020 16:26:39 -0500 Subject: [PATCH 7/8] Fix set placement in integration test script. --- .cicd/integration-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cicd/integration-tests.sh b/.cicd/integration-tests.sh index 9c42c86bc7..6ae9b85c00 100755 --- a/.cicd/integration-tests.sh +++ b/.cicd/integration-tests.sh @@ -19,12 +19,12 @@ if [[ -f $BUILDKITE_ENV_FILE ]]; then evars="$evars --env ${var%%=*}" done < "$BUILDKITE_ENV_FILE" fi -set +e if [[ "$BUILDKITE" == 'true' && "$IMAGE_TAG" == 'ubuntu-18.04' ]]; then FULL_TAG='eosio/ci-contracts-builder:base-ubuntu-18.04-develop' fi +set +e eval docker run $ARGS $evars $FULL_TAG bash -c \"$COMMANDS\" EXIT_STATUS=$? From 48db9b1a0a8bd2fc3157a487c64f5f4a931a567a Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Fri, 6 Nov 2020 16:32:39 -0500 Subject: [PATCH 8/8] Thanks Mike! --- .cicd/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.cicd/build.sh b/.cicd/build.sh index f1d5a8cfbc..7f210c132c 100755 --- a/.cicd/build.sh +++ b/.cicd/build.sh @@ -31,6 +31,7 @@ else # Linux $CICD_DIR/generate-base-images.sh if [[ "$IMAGE_TAG" == 'ubuntu-18.04' ]]; then FULL_TAG='eosio/ci-contracts-builder:base-ubuntu-18.04-develop' + fi fi COMMANDS="$PRE_COMMANDS && $BUILD_COMMANDS"