diff --git a/.cicd/defaults.json b/.cicd/defaults.json index caf5c75be..9e15d6be2 100644 --- a/.cicd/defaults.json +++ b/.cicd/defaults.json @@ -1,5 +1,5 @@ { - "spring-dev":{ + "antelope-spring-dev":{ "target":"main", "prerelease":false } diff --git a/.cicd/platforms.json b/.cicd/platforms.json deleted file mode 100644 index a58fb7614..000000000 --- a/.cicd/platforms.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ubuntu20": { - "dockerfile": ".cicd/platforms/ubuntu20.Dockerfile" - }, - "ubuntu22": { - "dockerfile": ".cicd/platforms/ubuntu22.Dockerfile" - }, - "ubuntu22-llvm": { - "dockerfile": ".cicd/platforms/ubuntu22-llvm.Dockerfile" - }, - "ubuntu24": { - "dockerfile": ".cicd/platforms/ubuntu24.Dockerfile" - } -} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8629bb528..88068cea7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,12 +8,12 @@ on: pull_request: workflow_dispatch: inputs: - override-spring-dev: - description: Override spring-dev target + override-antelope-spring-dev: + description: Override antelope-spring-dev target type: string - override-spring-dev-prerelease: + override-antelope-spring-dev-prerelease: type: choice - description: Override spring-dev prelease + description: Override antelope-spring-dev prelease options: - default - true @@ -28,49 +28,22 @@ defaults: shell: bash jobs: - d: - name: Discover Platforms - runs-on: ubuntu-latest - outputs: - missing-platforms: ${{steps.discover.outputs.missing-platforms}} - p: ${{steps.discover.outputs.platforms}} - steps: - - name: Discover Platforms - id: discover - uses: AntelopeIO/discover-platforms-action@v1 - with: - platform-file: .cicd/platforms.json - password: ${{secrets.GITHUB_TOKEN}} - package-name: builders - build-platforms: - name: Build Platforms - needs: d - if: needs.d.outputs.missing-platforms != '[]' - strategy: - fail-fast: false - matrix: - platform: ${{fromJSON(needs.d.outputs.missing-platforms)}} - runs-on: ["self-hosted", "enf-x86-beefy"] - steps: - - name: Login to Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{github.repository_owner}} - password: ${{secrets.GITHUB_TOKEN}} - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} - file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}} + platform-cache: + name: Platform Cache + uses: AntelopeIO/platform-cache-workflow/.github/workflows/platformcache.yaml@v1 + permissions: + packages: write + contents: read + with: + runs-on: '["self-hosted", "enf-x86-beefy"]' + platform-files: .cicd/platforms versions: name: Determine Versions runs-on: ubuntu-latest outputs: - spring-dev-target: ${{steps.versions.outputs.spring-dev-target}} - spring-dev-prerelease: ${{steps.versions.outputs.spring-dev-prerelease}} + antelope-spring-dev-target: ${{steps.versions.outputs.antelope-spring-dev-target}} + antelope-spring-dev-prerelease: ${{steps.versions.outputs.antelope-spring-dev-prerelease}} steps: - name: Setup versions from input or defaults id: versions @@ -78,47 +51,46 @@ jobs: GH_TOKEN: ${{github.token}} run: | DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url)) - echo spring-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."spring-dev".target') >> $GITHUB_OUTPUT - echo spring-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."spring-dev".prerelease') >> $GITHUB_OUTPUT + echo antelope-spring-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".target') >> $GITHUB_OUTPUT + echo antelope-spring-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".prerelease') >> $GITHUB_OUTPUT - if [[ "${{inputs.override-spring-dev}}" != "" ]]; then - echo spring-dev-target=${{inputs.override-spring-dev}} >> $GITHUB_OUTPUT + if [[ "${{inputs.override-antelope-spring-dev}}" != "" ]]; then + echo antelope-spring-dev-target=${{inputs.override-antelope-spring-dev}} >> $GITHUB_OUTPUT fi - if [[ "${{inputs.override-spring-dev-prerelease}}" == +(true|false) ]]; then - echo spring-dev-prerelease=${{inputs.override-spring-dev-prerelease}} >> $GITHUB_OUTPUT + if [[ "${{inputs.override-antelope-spring-dev-prerelease}}" == +(true|false) ]]; then + echo antelope-spring-dev-prerelease=${{inputs.override-antelope-spring-dev-prerelease}} >> $GITHUB_OUTPUT fi Build: name: Build & Test - needs: [d, build-platforms, versions] - if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped') + needs: [platform-cache, versions] strategy: fail-fast: false matrix: platform: [ubuntu20, ubuntu22, ubuntu22-llvm, ubuntu24] runs-on: ["self-hosted", "enf-x86-beefy"] - container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} + container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - - name: Download spring-dev.deb (Ubuntu 22 only) + - name: Download antelope-spring-dev.deb (Ubuntu 22 only) if: matrix.platform == 'ubuntu22' uses: AntelopeIO/asset-artifact-download-action@v3 with: owner: AntelopeIO repo: spring - file: 'spring-dev.*ubuntu22\.04_amd64.deb' - target: '${{needs.versions.outputs.spring-dev-target}}' - prereleases: ${{fromJSON(needs.versions.outputs.spring-dev-prerelease)}} - artifact-name: spring-dev-ubuntu22-amd64 - container-package: experimental-binaries - - name: Install spring-dev.deb (Ubuntu 22 only) + file: 'antelope-spring-dev.*ubuntu22\.04_amd64.deb' + target: '${{needs.versions.outputs.antelope-spring-dev-target}}' + prereleases: ${{fromJSON(needs.versions.outputs.antelope-spring-dev-prerelease)}} + artifact-name: antelope-spring-dev-ubuntu22-amd64 + container-package: antelope-spring-experimental-binaries + - name: Install antelope-spring-dev.deb (Ubuntu 22 only) if: matrix.platform == 'ubuntu22' run: | apt-get update && apt-get upgrade -y - apt install -y ./spring-dev*.deb - rm ./spring-dev*.deb + apt install -y ./antelope-spring-dev*.deb + rm ./antelope-spring-dev*.deb - name: Build & Test run: | mkdir build @@ -134,7 +106,7 @@ jobs: bash generate_package.sh deb ubuntu amd64 - name: Upload (Ubuntu 20 only) if: matrix.platform == 'ubuntu20' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: cdt_ubuntu_package_amd64 path: build/packages/cdt*amd64.deb diff --git a/CMakeLists.txt b/CMakeLists.txt index 71cda7a16..cd7ac04cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ project(cdt) set(VERSION_MAJOR 4) set(VERSION_MINOR 1) set(VERSION_PATCH 1) -set(VERSION_SUFFIX "") +set(VERSION_SUFFIX "dev") if (VERSION_SUFFIX) set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}") diff --git a/README.md b/README.md index a21fbcd0d..9eb44d2d2 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ sudo apt remove cdt ## Building from source -Recent Ubuntu LTS releases are the only Linux distributions that we fully support. Other Linux distros and other POSIX operating systems (such as macOS) are tended to on a best-effort basis and may not be full featured. +Recent Ubuntu LTS releases are the only Linux distributions that we fully support. Other Linux distros and other POSIX operating systems (such as macOS) are tended to on a best-effort basis and may not be full featured. -The instructions below assume that you are building on Ubuntu 20.04. +The instructions below assume that you are building on Ubuntu 20.04. ### Install dependencies @@ -136,7 +136,7 @@ Installing CDT globally on your system will install the following tools in a loc * cdt-strip * eosio-pp * eosio-wasm2wast -* eosio-wast2wasm +* eosio-wast2wasm It will also install CMake files for CDT accessible within a `cmake/cdt` directory located within your system's `lib` directory. #### Manual installation diff --git a/libraries/eosiolib/capi/eosio/security_group.h b/libraries/eosiolib/capi/eosio/security_group.h deleted file mode 100644 index 9e362c63e..000000000 --- a/libraries/eosiolib/capi/eosio/security_group.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once -#include "types.h" -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Propose new participants to the security group. - * - * @param data - the buffer containing the packed participants. - * @param datalen - size of the packed participants - * @pre `data` is a valid pointer to a range of memory at least `datalen` bytes long that contains packed participants data - * - * @return -1 if proposing a new security group was unsuccessful, otherwise returns 0. -*/ -__attribute__((eosio_wasm_import)) -int64_t add_security_group_participants(const char* data, uint32_t datalen); - -/** - * Propose to remove participants from the security group. - * - * @param data - the buffer containing the packed participants. - * @param datalen - size of the packed participants - * @pre `data` is a valid pointer to a range of memory at least `datalen` bytes long that contains packed participants data - * - * @return -1 if proposing a new security group was unsuccessful, otherwise returns 0. -*/ -__attribute__((eosio_wasm_import)) -int64_t remove_security_group_participants(const char* data, uint32_t datalen); - -/** - * Check if the specified accounts are all in the active security group. - * - * @param data - the buffer containing the packed participants. - * @param datalen - size of the packed participants - * - * @return Returns true if the specified accounts are all in the active security group. -*/ -__attribute__((eosio_wasm_import)) -bool in_active_security_group(const char* data, uint32_t datalen); - -/** - * Gets the active security group - * - * @param[out] data - the output buffer containing the packed security group. - * @param datalen - size of the `data` buffer - * - * @return Returns the size required in the buffer (if the buffer is too small, nothing is written). - * -*/ -__attribute__((eosio_wasm_import)) -uint32_t get_active_security_group(char* data, uint32_t datalen); - -#ifdef __cplusplus -} -#endif diff --git a/libraries/eosiolib/contracts/eosio/security_group.hpp b/libraries/eosiolib/contracts/eosio/security_group.hpp deleted file mode 100644 index b5575b883..000000000 --- a/libraries/eosiolib/contracts/eosio/security_group.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once -#include -#include "../../core/eosio/name.hpp" -#include "../../core/eosio/serialize.hpp" - -namespace eosio { - -namespace internal_use_do_not_use { -extern "C" { -__attribute__((eosio_wasm_import)) int64_t add_security_group_participants(const char* data, uint32_t datalen); - -__attribute__((eosio_wasm_import)) int64_t remove_security_group_participants(const char* data, uint32_t datalen); - -__attribute__((eosio_wasm_import)) bool in_active_security_group(const char* data, uint32_t datalen); - -__attribute__((eosio_wasm_import)) uint32_t get_active_security_group(char* data, uint32_t datalen); -} -} // namespace internal_use_do_not_use - -/** - * @defgroup security_group Security Group - * @ingroup contracts - * @brief Defines C++ security group API - */ - -struct security_group { - uint32_t version; - std::set participants; - CDT_REFLECT(version, participants); -}; - -/** - * Propose new participants to the security group. - * - * @ingroup security_group - * @param participants - the participants. - * - * @return -1 if proposing a new security group was unsuccessful, otherwise returns 0. - */ -inline int64_t add_security_group_participants(const std::set& participants) { - auto packed_participants = eosio::pack( participants ); - return internal_use_do_not_use::add_security_group_participants( packed_participants.data(), packed_participants.size() ); -} - -/** - * Propose to remove participants from the security group. - *å - * @ingroup security_group - * @param participants - the participants. - *å - * @return -1 if proposing a new security group was unsuccessful, otherwise returns 0. - */ -inline int64_t remove_security_group_participants(const std::set& participants){ - auto packed_participants = eosio::pack( participants ); - return internal_use_do_not_use::remove_security_group_participants( packed_participants.data(), packed_participants.size() ); -} - -/** - * Check if the specified accounts are all in the active security group. - * - * @ingroup security_group - * @param participants - the participants. - * - * @return Returns true if the specified accounts are all in the active security group. - */ -inline bool in_active_security_group(const std::set& participants){ - auto packed_participants = eosio::pack( participants ); - return internal_use_do_not_use::in_active_security_group( packed_participants.data(), packed_participants.size() ); -} - -/** - * Gets the active security group - * - * @ingroup security_group - * @param[out] packed_security_group - the buffer containing the packed security_group. - * - * @return Returns the size required in the buffer (if the buffer is too small, nothing is written). - * - */ -inline security_group get_active_security_group() { - size_t buffer_size = internal_use_do_not_use::get_active_security_group(0, 0); - std::vector buffer(buffer_size); - internal_use_do_not_use::get_active_security_group(buffer.data(), buffer_size); - return eosio::unpack(buffer); -} -} // namespace eosio \ No newline at end of file diff --git a/libraries/eosiolib/contracts/eosio/singleton.hpp b/libraries/eosiolib/contracts/eosio/singleton.hpp index 17f70aa08..a9625b43e 100644 --- a/libraries/eosiolib/contracts/eosio/singleton.hpp +++ b/libraries/eosiolib/contracts/eosio/singleton.hpp @@ -62,7 +62,7 @@ namespace eosio { * @return true - if exists * @return false - otherwise */ - bool exists() { + bool exists() const { return _t.find( pk_value ) != _t.end(); } @@ -72,7 +72,7 @@ namespace eosio { * @brief Get the value stored inside the singleton table * @return T - The value stored */ - T get() { + T get() const { auto itr = _t.find( pk_value ); eosio::check( itr != _t.end(), "singleton does not exist" ); return itr->value; @@ -84,7 +84,7 @@ namespace eosio { * @param def - The default value to be returned in case the data doesn't exist * @return T - The value stored */ - T get_or_default( const T& def = T() ) { + T get_or_default( const T& def = T() ) const { auto itr = _t.find( pk_value ); return itr != _t.end() ? itr->value : def; } diff --git a/libraries/native/intrinsics.cpp b/libraries/native/intrinsics.cpp index 3f9ed470e..c28f7c574 100644 --- a/libraries/native/intrinsics.cpp +++ b/libraries/native/intrinsics.cpp @@ -890,22 +890,6 @@ extern "C" { } #pragma clang diagnostic pop - int64_t add_security_group_participants(const char* data, uint32_t datalen) { - return intrinsics::get().call(data, datalen); - } - - int64_t remove_security_group_participants(const char* data, uint32_t datalen){ - return intrinsics::get().call(data, datalen); - } - - bool in_active_security_group(const char* data, uint32_t datalen){ - return intrinsics::get().call(data, datalen); - } - - uint32_t get_active_security_group(char* data, uint32_t datalen){ - return intrinsics::get().call(data, datalen); - } - void set_finalizers(uint64_t packed_finalizer_format, const char* data, uint32_t len) { intrinsics::get().call(packed_finalizer_format, data, len); } diff --git a/libraries/native/native/eosio/intrinsics_def.hpp b/libraries/native/native/eosio/intrinsics_def.hpp index 5121017dd..27b0aa330 100644 --- a/libraries/native/native/eosio/intrinsics_def.hpp +++ b/libraries/native/native/eosio/intrinsics_def.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include @@ -164,10 +163,6 @@ intrinsic_macro(cancel_deferred) \ intrinsic_macro(get_context_free_data) \ intrinsic_macro(get_sender) \ intrinsic_macro(set_action_return_value) \ -intrinsic_macro(add_security_group_participants) \ -intrinsic_macro(remove_security_group_participants) \ -intrinsic_macro(in_active_security_group) \ -intrinsic_macro(get_active_security_group) \ intrinsic_macro(blake2_f) \ intrinsic_macro(sha3) \ intrinsic_macro(k1_recover) \ diff --git a/tests/integration/instant_finality_tests.cpp b/tests/integration/instant_finality_tests.cpp index b5367da24..f79ef7112 100644 --- a/tests/integration/instant_finality_tests.cpp +++ b/tests/integration/instant_finality_tests.cpp @@ -33,13 +33,14 @@ BOOST_FIXTURE_TEST_CASE(instant_finality_test, tester) try { fc::variant pretty_output; abi_serializer::to_variant( *cur_block, pretty_output, get_resolver(), fc::microseconds::maximum() ); std::cout << fc::json::to_string(pretty_output, fc::time_point::now() + abi_serializer_max_time) << std::endl; - BOOST_REQUIRE(pretty_output.get_object().contains("instant_finality_extension")); - BOOST_REQUIRE_EQUAL(pretty_output["instant_finality_extension"]["new_finalizer_policy"]["generation"], 1); - BOOST_REQUIRE_EQUAL(pretty_output["instant_finality_extension"]["new_finalizer_policy"]["threshold"], 1); - BOOST_REQUIRE_EQUAL(pretty_output["instant_finality_extension"]["new_finalizer_policy"]["finalizers"].size(), 1u); - BOOST_REQUIRE_EQUAL(pretty_output["instant_finality_extension"]["new_finalizer_policy"]["finalizers"][size_t(0)]["description"], "test_desc"); - BOOST_REQUIRE_EQUAL(pretty_output["instant_finality_extension"]["new_finalizer_policy"]["finalizers"][size_t(0)]["weight"], 1); - BOOST_REQUIRE_EQUAL(pretty_output["instant_finality_extension"]["new_finalizer_policy"]["finalizers"][size_t(0)]["public_key"], "PUB_BLS_dEvut0ydHevDGP6Ef3O4Iq6QXf9jUcMUT1nCJRX-JRYlFYrO_qKt_x439vUJ2DkZ32Od6AdJZ-S9dWRE9Sy-7Q6bNjpoIOP0cWzkKC1DqmhfE3paW-KThA3noLkV8SsILcfxpQ"); + + std::string output_json = fc::json::to_pretty_string(pretty_output); + BOOST_TEST(output_json.find("finality_extension") != std::string::npos); + BOOST_TEST(output_json.find("\"generation\": 2") != std::string::npos); + BOOST_TEST(output_json.find("\"threshold\": 1") != std::string::npos); + BOOST_TEST(output_json.find("\"description\": \"test_desc\"") != std::string::npos); + BOOST_TEST(output_json.find("\"weight\": 1") != std::string::npos); + BOOST_TEST(output_json.find("PUB_BLS_dEvut0ydHevDGP6Ef3O4Iq6QXf9jUcMUT1nCJRX-JRYlFYrO_qKt_x439vUJ2DkZ32Od6AdJZ-S9dWRE9Sy-7Q6bNjpoIOP0cWzkKC1DqmhfE3paW-KThA3noLkV8SsILcfxpQ") != std::string::npos); // testing wrong public key size BOOST_CHECK_THROW(push_action(config::system_account_name, "setfinalizer"_n, "test"_n, mvo()