From 94d5044606226a8bc773f592b4a0db8e128c837d Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 2 May 2024 08:44:58 -0500 Subject: [PATCH] Update to use Spring instead of Leap --- .cicd/defaults.json | 6 ++-- .github/workflows/build.yaml | 36 +++++++++---------- CMakeLists.txt | 4 +-- README.md | 22 ++++++------ build.sh | 18 +++++----- docs/01_key-concepts/02_ram.md | 2 +- docs/01_key-concepts/05_stake.md | 4 +-- ...ow-to-create-issue-and-transfer-a-token.md | 2 +- tests/CMakeLists.txt | 16 ++++----- tests/eosio.bios_inst_fin_tests.cpp | 4 +-- 10 files changed, 57 insertions(+), 57 deletions(-) diff --git a/.cicd/defaults.json b/.cicd/defaults.json index 136b822d..48fecb15 100644 --- a/.cicd/defaults.json +++ b/.cicd/defaults.json @@ -1,10 +1,10 @@ { - "leap-dev":{ - "target":"hotstuff_integration", + "spring-dev":{ + "target":"main", "prerelease":false }, "cdt":{ - "target":"hotstuff_integration", + "target":"main", "prerelease":false } } diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe54b8f0..338a200c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,12 +8,12 @@ on: pull_request: workflow_dispatch: inputs: - override-leap-dev: - description: Override leap-dev target + override-spring-dev: + description: Override spring-dev target type: string - override-leap-dev-prerelease: + override-spring-dev-prerelease: type: choice - description: Override leap-dev prelease + description: Override spring-dev prelease options: - default - true @@ -38,22 +38,22 @@ jobs: name: Build & Test runs-on: ubuntu-22.04 steps: - - name: Setup leap-dev & cdt versions + - name: Setup spring-dev & cdt versions id: versions env: GH_TOKEN: ${{secrets.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 leap-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".target') >> $GITHUB_OUTPUT - echo leap-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".prerelease') >> $GITHUB_OUTPUT + 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 cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.target') >> $GITHUB_OUTPUT echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.prerelease') >> $GITHUB_OUTPUT - if [[ "${{inputs.override-leap-dev}}" != "" ]]; then - echo leap-dev-target=${{inputs.override-leap-dev}} >> $GITHUB_OUTPUT + if [[ "${{inputs.override-spring-dev}}" != "" ]]; then + echo spring-dev-target=${{inputs.override-spring-dev}} >> $GITHUB_OUTPUT fi - if [[ "${{inputs.override-leap-dev-prerelease}}" == +(true|false) ]]; then - echo leap-dev-prerelease=${{inputs.override-leap-dev-prerelease}} >> $GITHUB_OUTPUT + if [[ "${{inputs.override-spring-dev-prerelease}}" == +(true|false) ]]; then + echo spring-dev-prerelease=${{inputs.override-spring-dev-prerelease}} >> $GITHUB_OUTPUT fi if [[ "${{inputs.override-cdt}}" != "" ]]; then echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT @@ -70,15 +70,15 @@ jobs: target: '${{steps.versions.outputs.cdt-target}}' prereleases: ${{fromJSON(steps.versions.outputs.cdt-prerelease)}} artifact-name: cdt_ubuntu_package_amd64 - - name: Download leap-dev + - name: Download spring-dev uses: AntelopeIO/asset-artifact-download-action@v3 with: owner: AntelopeIO - repo: leap - file: 'leap-dev.*ubuntu22\.04_amd64.deb' - target: '${{steps.versions.outputs.leap-dev-target}}' - prereleases: ${{fromJSON(steps.versions.outputs.leap-dev-prerelease)}} - artifact-name: leap-dev-ubuntu22-amd64 + repo: spring + file: 'spring-dev.*ubuntu22\.04_amd64.deb' + target: '${{steps.versions.outputs.spring-dev-target}}' + prereleases: ${{fromJSON(steps.versions.outputs.spring-dev-prerelease)}} + artifact-name: spring-dev-ubuntu22-amd64 container-package: experimental-binaries - name: Install packages run: | @@ -91,7 +91,7 @@ jobs: path: src - name: Build & Test run: | - cmake -S src -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_LEAP_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off + cmake -S src -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_SPRING_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off cmake --build build -- -j $(nproc) tar zcf build.tar.gz build ctest --test-dir build/tests --output-on-failure -j $(nproc) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88f985f6..0c26caaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,8 @@ option(SYSTEM_CONFIGURABLE_WASM_LIMITS option(SYSTEM_BLOCKCHAIN_PARAMETERS "Enables use of the host functions activated by the BLOCKCHAIN_PARAMETERS protocol feature" ON) -option(SYSTEM_ENABLE_LEAP_VERSION_CHECK - "Enables a configure-time check that the version of Leap's tester library is compatible with this project's unit tests" ON) +option(SYSTEM_ENABLE_SPRING_VERSION_CHECK + "Enables a configure-time check that the version of Spring's tester library is compatible with this project's unit tests" ON) option(SYSTEM_ENABLE_CDT_VERSION_CHECK "Enables a configure-time check that the version of CDT is compatible with this project's contracts" ON) diff --git a/README.md b/README.md index 5f69467f..398f3e18 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The `main` branch contains the latest state of development; do not use this for [CDT](https://github.com/AntelopeIO/cdt) is required to build contracts. Any operating systems supported by CDT is sufficient to build the reference contracts. -To build and run the tests as well, [Leap](https://github.com/AntelopeIO/leap) is also required as a dependency, which may have its further restrictions on supported operating systems. +To build and run the tests as well, [Spring](https://github.com/AntelopeIO/spring) is also required as a dependency, which may have its further restrictions on supported operating systems. ## Building The build guide below will assume you are running Ubuntu 20.04. However, as mentioned above, other operating systems may also be supported. @@ -49,40 +49,40 @@ The easiest way to satisfy this dependency is to install CDT on your system thro Alternatively, you can build CDT from source. Please refer to the guide in the [CDT README](https://github.com/AntelopeIO/cdt#building-from-source) for instructions on how to do this. If you choose to go with building CDT from source, please keep the path to the build directory in the shell environment variable `CDT_BUILD_PATH` for later use when building the reference contracts. -### Optionally build Leap dependency +### Optionally build Spring dependency -The Leap dependency is optional. It is only needed if you wish to also build the tests using the `BUILD_TESTS` CMake flag. +The Spring dependency is optional. It is only needed if you wish to also build the tests using the `BUILD_TESTS` CMake flag. -Unfortunately, it is not currently possible to satisfy the contract testing dependencies through the Leap packages made available from the [Leap releases page](https://github.com/AntelopeIO/leap/releases). So if you want to build the contract tests, you will first need to build Leap from source. +Unfortunately, it is not currently possible to satisfy the contract testing dependencies through the Spring packages made available from the [Spring releases page](https://github.com/AntelopeIO/spring/releases). So if you want to build the contract tests, you will first need to build Spring from source. -Please refer to the guide in the [Leap README](https://github.com/AntelopeIO/leap#building-from-source) for instructions on how to do this. If you choose to go with building Leap from source, please keep the path to the build directory in the shell environment variable `LEAP_BUILD_PATH` for later use when building the reference contracts. +Please refer to the guide in the [Spring README](https://github.com/AntelopeIO/spring#building-from-source) for instructions on how to do this. If you choose to go with building Spring from source, please keep the path to the build directory in the shell environment variable `SPRING_BUILD_PATH` for later use when building the reference contracts. ### Build reference contracts -Beyond CDT and optionally Leap (if also building the tests), no additional dependencies are required to build the reference contracts. +Beyond CDT and optionally Spring (if also building the tests), no additional dependencies are required to build the reference contracts. -The instructions below assume you are building the reference contracts with tests, have already built Leap from source, and have the CDT dependency installed on your system. For some other configurations, expand the hidden panels placed lower within this section. +The instructions below assume you are building the reference contracts with tests, have already built Spring from source, and have the CDT dependency installed on your system. For some other configurations, expand the hidden panels placed lower within this section. For all configurations, you should first `cd` into the directory containing cloned reference contracts repository. -Build reference contracts with tests using Leap built from source and with installed CDT package: +Build reference contracts with tests using Spring built from source and with installed CDT package: ``` mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -Dleap_DIR="${LEAP_BUILD_PATH}/lib/cmake/leap" .. +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -Dspring_DIR="${SPRING_BUILD_PATH}/lib/cmake/spring" .. make -j $(nproc) ``` **Note:** `CMAKE_BUILD_TYPE` has no impact on the WASM files generated for the contracts. It only impacts how the test binaries are built. Use `-DCMAKE_BUILD_TYPE=Debug` if you want to create test binaries that you can debug.
-Build reference contracts with tests using Leap and CDT both built from source +Build reference contracts with tests using Spring and CDT both built from source ``` mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -Dcdt_DIR="${CDT_BUILD_PATH}/lib/cmake/cdt" -Dleap_DIR="${LEAP_BUILD_PATH}/lib/cmake/leap" .. +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -Dcdt_DIR="${CDT_BUILD_PATH}/lib/cmake/cdt" -Dspring_DIR="${SPRING_BUILD_PATH}/lib/cmake/spring" .. make -j $(nproc) ```
diff --git a/build.sh b/build.sh index 154c7df7..a463f7d4 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ set -eo pipefail function usage() { printf "Usage: $0 OPTION... -c DIR Path to CDT installation/build directory. (Optional if using CDT installled at standard system location.) - -l DIR Path to Leap build directory. Optional, but must be specified to build tests. + -l DIR Path to Spring build directory. Optional, but must be specified to build tests. -h Print this help menu. \\n" "$0" 1>&2 exit 1 @@ -19,7 +19,7 @@ if [ $# -ne 0 ]; then CDT_INSTALL_DIR=$(realpath $OPTARG) ;; l ) - LEAP_BUILD_DIR=$(realpath $OPTARG) + SPRING_BUILD_DIR=$(realpath $OPTARG) BUILD_TESTS=ON ;; h ) @@ -40,19 +40,19 @@ if [ $# -ne 0 ]; then done fi -LEAP_DIR_CMAKE_OPTION='' +SPRING_DIR_CMAKE_OPTION='' if [[ "${BUILD_TESTS}" == "ON" ]]; then - if [[ ! -f "$LEAP_BUILD_DIR/lib/cmake/leap/leap-config.cmake" ]]; then - echo "Invalid path to Leap build directory: $LEAP_BUILD_DIR" - echo "Leap build directory is required to build tests. If you do not wish to build tests, leave off the -l option." + if [[ ! -f "$SPRING_BUILD_DIR/lib/cmake/spring/spring-config.cmake" ]]; then + echo "Invalid path to Spring build directory: $SPRING_BUILD_DIR" + echo "Spring build directory is required to build tests. If you do not wish to build tests, leave off the -l option." echo "Cannot proceed. Exiting..." exit 1; fi - echo "Using Leap build directory at: $LEAP_BUILD_DIR" + echo "Using Spring build directory at: $SPRING_BUILD_DIR" echo "" - LEAP_DIR_CMAKE_OPTION="-Dleap_DIR=${LEAP_BUILD_DIR}/lib/cmake/leap" + SPRING_DIR_CMAKE_OPTION="-Dspring_DIR=${SPRING_BUILD_DIR}/lib/cmake/spring" fi CDT_DIR_CMAKE_OPTION='' @@ -79,6 +79,6 @@ NC='\033[0m' CPU_CORES=$(getconf _NPROCESSORS_ONLN) mkdir -p build pushd build &> /dev/null -cmake -DBUILD_TESTS=${BUILD_TESTS} ${LEAP_DIR_CMAKE_OPTION} ${CDT_DIR_CMAKE_OPTION} ../ +cmake -DBUILD_TESTS=${BUILD_TESTS} ${SPRING_DIR_CMAKE_OPTION} ${CDT_DIR_CMAKE_OPTION} ../ make -j $CPU_CORES popd &> /dev/null diff --git a/docs/01_key-concepts/02_ram.md b/docs/01_key-concepts/02_ram.md index a669eb97..274c1600 100644 --- a/docs/01_key-concepts/02_ram.md +++ b/docs/01_key-concepts/02_ram.md @@ -35,4 +35,4 @@ RAM is a very important system resource because of the following reasons: RAM is a scarce resource priced according to the unique Bancor liquidity algorithm which is implemented in the system contract [here](https://github.com/AntelopeIO/reference-contracts/blob/main/contracts/eosio.system/include/eosio.system/exchange_state.hpp). -The RAM system resource must be purchased using the system token. Refer to the [cleos manual](https://github.com/AntelopeIO/leap/blob/main/docs/02_cleos/02_how-to-guides/how-to-buy-ram.md) to learn how to buy RAM via the command line interface. +The RAM system resource must be purchased using the system token. Refer to the [cleos manual](https://github.com/AntelopeIO/spring/blob/main/docs/02_cleos/02_how-to-guides/how-to-buy-ram.md) to learn how to buy RAM via the command line interface. diff --git a/docs/01_key-concepts/05_stake.md b/docs/01_key-concepts/05_stake.md index bd49b3f2..a486e00a 100644 --- a/docs/01_key-concepts/05_stake.md +++ b/docs/01_key-concepts/05_stake.md @@ -16,7 +16,7 @@ Antelope-based blockchain accounts need sufficient system resources, RAM, CPU an ### Stake NET and CPU -The CPU and NET system resources are allocated by the account owner via the staking mechanism. Refer to the [cleos manual](https://github.com/AntelopeIO/leap/blob/main/docs/02_cleos/02_how-to-guides/how-to-stake-resource.md) on how to do it via the command line interface. +The CPU and NET system resources are allocated by the account owner via the staking mechanism. Refer to the [cleos manual](https://github.com/AntelopeIO/spring/blob/main/docs/02_cleos/02_how-to-guides/how-to-stake-resource.md) on how to do it via the command line interface. You will also find that staking/unstaking is at times referred to as delegating/undelegating. The economics of staking is also to provably commit to a promise that you will hold the staked tokens, either for NET or CPU, for a pre-established period of time, in spite of inflation caused by minting new tokens in order to reward BPs for their services every 24 hours. @@ -46,4 +46,4 @@ This formula has the following outcomes: ### Buy RAM -The RAM resource must be bought using the system token. Refer to the [cleos manual](https://github.com/AntelopeIO/leap/blob/main/docs/02_cleos/02_how-to-guides/how-to-buy-ram.md) to learn how to do it via the command line interface. When an account consumes all its allocated RAM can not store any additional information on the blockchain database until it frees some of the occupied RAM or more RAM is allocated to the account through the RAM buying process. +The RAM resource must be bought using the system token. Refer to the [cleos manual](https://github.com/AntelopeIO/spring/blob/main/docs/02_cleos/02_how-to-guides/how-to-buy-ram.md) to learn how to do it via the command line interface. When an account consumes all its allocated RAM can not store any additional information on the blockchain database until it frees some of the occupied RAM or more RAM is allocated to the account through the RAM buying process. diff --git a/docs/04_guides/05_how-to-create-issue-and-transfer-a-token.md b/docs/04_guides/05_how-to-create-issue-and-transfer-a-token.md index a3de0950..29218db2 100644 --- a/docs/04_guides/05_how-to-create-issue-and-transfer-a-token.md +++ b/docs/04_guides/05_how-to-create-issue-and-transfer-a-token.md @@ -105,7 +105,7 @@ executed transaction: 60d334850151cb95c35fe31ce2e8b536b51441c5fd4c3f2fea98edcc6d # bob <= eosio.token::transfer {"from":"eosio","to":"bob","quantity":"25.0000 SYS","memo":"m"} warning: transaction executed locally, but may not be confirmed by the network yet ] ``` -Now check if "bob" got the tokens using [cleos get currency balance](https://github.com/AntelopeIO/leap/blob/main/docs/02_cleos/03_command-reference/get/currency-balance.md) +Now check if "bob" got the tokens using [cleos get currency balance](https://github.com/AntelopeIO/spring/blob/main/docs/02_cleos/03_command-reference/get/currency-balance.md) ```shell cleos get currency balance eosio.token bob SYS diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f5875dbf..fde7fb1b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,27 +1,27 @@ cmake_minimum_required(VERSION 3.5) -set(EOSIO_VERSION_MIN "3.1") -set(EOSIO_VERSION_SOFT_MAX "5.0") +set(EOSIO_VERSION_MIN "1.0") +set(EOSIO_VERSION_SOFT_MAX "1.0") # set(EOSIO_VERSION_HARD_MAX "") -find_package(leap) +find_package(spring) -# Check the version of Leap -if(SYSTEM_ENABLE_LEAP_VERSION_CHECK) +# Check the version of Spring +if(SYSTEM_ENABLE_SPRING_VERSION_CHECK) set(VERSION_MATCH_ERROR_MSG "") eosio_check_version(VERSION_OUTPUT "${EOSIO_VERSION}" "${EOSIO_VERSION_MIN}" "${EOSIO_VERSION_SOFT_MAX}" "${EOSIO_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG) if(VERSION_OUTPUT STREQUAL "MATCH") - message(STATUS "Using Leap version ${EOSIO_VERSION}") + message(STATUS "Using Spring version ${EOSIO_VERSION}") elseif(VERSION_OUTPUT STREQUAL "WARN") message( WARNING - "Using Leap version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Leap version ${EOSIO_VERSION_SOFT_MAX}.x" + "Using Spring version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Spring version ${EOSIO_VERSION_SOFT_MAX}.x" ) else() # INVALID OR MISMATCH message( FATAL_ERROR - "Found Leap version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Leap version ${EOSIO_VERSION_SOFT_MAX}.x" + "Found Spring version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Spring version ${EOSIO_VERSION_SOFT_MAX}.x" ) endif(VERSION_OUTPUT STREQUAL "MATCH") endif() diff --git a/tests/eosio.bios_inst_fin_tests.cpp b/tests/eosio.bios_inst_fin_tests.cpp index 4c986b05..4317db67 100644 --- a/tests/eosio.bios_inst_fin_tests.cpp +++ b/tests/eosio.bios_inst_fin_tests.cpp @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_SUITE(eosio_bios_if_tests) // one finalizer in finalizer policy BOOST_FIXTURE_TEST_CASE( set_1_finalizer, eosio_bios_if_tester ) try { - // public_key and pop are generated by leap-util + // public_key and pop are generated by spring-util push_action("iftester"_n, "setfinalizer"_n, "iftester"_n, mvo() ("finalizer_policy", mvo() ("threshold", 2) @@ -65,7 +65,7 @@ BOOST_FIXTURE_TEST_CASE( set_1_finalizer, eosio_bios_if_tester ) try { // two finalizers in finalizer policy BOOST_FIXTURE_TEST_CASE( set_2_finalizers, eosio_bios_if_tester ) try { - // public_key and pop are generated by leap-util + // public_key and pop are generated by spring-util push_action("iftester"_n, "setfinalizer"_n, "iftester"_n, mvo() ("finalizer_policy", mvo() ("threshold", 5)