Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #939 from EOSIO/release/22.0.x
Browse files Browse the repository at this point in the history
Merging release/22.0.x into master
  • Loading branch information
Brad Hart authored May 20, 2021
2 parents 0c2dc24 + 83d3504 commit 31ac222
Show file tree
Hide file tree
Showing 36 changed files with 4,293 additions and 897 deletions.
112 changes: 37 additions & 75 deletions .github/eosjs-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,89 +1,51 @@
FROM ubuntu:18.04
ENTRYPOINT ["nodeos", "--data-dir", "/root/.local/share", "-e", "-p", "eosio", "--replay-blockchain", "--plugin", "eosio::producer_plugin", "--plugin", "eosio::chain_api_plugin", "--plugin", "eosio::http_plugin", "--http-server-address=0.0.0.0:8888", "--access-control-allow-origin=*", "--contracts-console", "--http-validate-host=false", "--verbose-http-errors", "--max-transaction-time=100"]
### Test:
#### docker build --tag eosjs-ci:test ./.github/eosjs-ci
#### docker run --publish 8888:8888 eosjs-ci:test

ARG EOSBRANCH=develop
ARG CDTBRANCH=develop
FROM eosio/eosio.cdt:${CDTBRANCH} as contracts
WORKDIR /root
### base
RUN yes | unminimize \
&& apt-get update \
&& apt-get install -yq \
binutils-gold \
build-essential \
clang-tools-8 \
curl \
g++-8 \
git \
libcurl4-gnutls-dev \
libgflags-dev \
libgmp3-dev \
libssl-dev \
libusb-1.0-0-dev \
lld-8 \
llvm-7 \
llvm-7-dev \
locales \
ninja-build \
pkg-config \
python \
software-properties-common \
wget \
xz-utils \
zlib1g-dev \
&& update-alternatives --remove-all cc \
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-8 100 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 \
&& update-alternatives --remove-all c++ \
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 100 \
&& update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-8 100 \
&& locale-gen en_US.UTF-8 \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get update \
&& apt-get install -yq curl git

ENV LANG=en_US.UTF-8
RUN git clone https://github.com/EOSIO/eos \
&& cd eos \
&& git checkout develop

### cmake
WORKDIR /root
RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz \
&& tar -xzf cmake-3.13.2.tar.gz \
&& cd cmake-3.13.2 \
&& ./bootstrap --prefix=/usr/local --parallel=8 \
&& make -j8 \
&& make install \
&& cd /root \
&& rm -rf cmake-3.13.2.tar.gz cmake-3.13.2
RUN git clone https://github.com/EOSIO/eosio.contracts \
&& cd eosio.contracts \
&& git checkout develop \
&& mkdir build && cd build && mkdir eosio.token && cd .. \
&& eosio-cpp -abigen ./contracts/eosio.token/src/eosio.token.cpp -o ./build/eosio.token/eosio.token.wasm -R ./contracts/eosio.token/ricardian/ -I ./contracts/eosio.token/include/

### boost
RUN curl -LO https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2 \
&& tar -xjf boost_1_72_0.tar.bz2 \
&& cd boost_1_72_0 \
&& ./bootstrap.sh --prefix=/usr/local \
&& ./b2 --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -j$(nproc) install \
&& cd /root \
&& rm -rf boost_1_72_0.tar.bz2 boost_1_72_0
RUN git clone https://github.com/EOSIO/key-value-example-app.git \
&& cd key-value-example-app \
&& eosio-cpp -abigen ./contracts/kv_todo/src/kv_todo.cpp -o ./contracts/kv_todo/build/kv_todo.wasm -R ./contracts/kv_todo/ricardian/ -I ./contracts/kv_todo/include/

### eosio.cdt
RUN git clone https://github.com/EOSIO/eosio.cdt.git \
&& cd eosio.cdt \
&& git checkout eosio-cdt-2.1-staging-c \
&& git submodule update --init --recursive \
&& mkdir build \
&& cd build \
&& cmake -GNinja .. \
&& ninja -j8
RUN git clone https://github.com/EOSIO/return-values-example-app.git \
&& cd return-values-example-app \
&& eosio-cpp -abigen ./contracts/action_return_value/src/action_return_value.cpp -o ./contracts/action_return_value/build/action_return_value.wasm -R ./contracts/action_return_value/ricardian/

### eos
RUN git clone https://github.com/EOSIO/eos.git \
&& cd eos \
&& git checkout develop \
&& git submodule update --init --recursive \
RUN mkdir cfhello
COPY ./contracts/cfhello.cpp /root/cfhello
RUN cd cfhello \
&& mkdir build \
&& cd build \
&& CC=clang-8 CXX=clang++-8 cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_AR=/usr/bin/llvm-ar-8 -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-8 -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld .. \
&& CC=clang-8 CXX=clang++-8 ninja -j8
&& eosio-cpp -abigen ./cfhello.cpp -o ./build/cfhello.wasm

ENV PATH="/root/eos/build/bin/:/root/eosio.cdt/build/bin/:${PATH}"

FROM eosio/eosio:${EOSBRANCH}
ENTRYPOINT ["nodeos", "--data-dir", "/root/.local/share", "-e", "-p", "eosio", "--replay-blockchain", "--plugin", "eosio::producer_plugin", "--plugin", "eosio::chain_api_plugin", "--plugin", "eosio::trace_api_plugin", "--trace-no-abis", "--plugin", "eosio::db_size_api_plugin", "--plugin", "eosio::http_plugin", "--http-server-address=0.0.0.0:8888", "--access-control-allow-origin=*", "--contracts-console", "--http-validate-host=false", "--enable-account-queries=true", "--verbose-http-errors", "--max-transaction-time=100"]
WORKDIR /root
RUN mkdir -p "/opt/eosio/bin/contracts"

COPY ./ /opt/eosio/bin
COPY --from=contracts /root/eos/contracts/contracts/eosio.bios/bin/* /opt/eosio/bin/contracts/eosio.bios/
COPY --from=contracts /root/eos/contracts/contracts/eosio.boot/bin/* /opt/eosio/bin/contracts/eosio.boot/
COPY --from=contracts /root/eosio.contracts/build/ /opt/eosio/bin/contracts
COPY --from=contracts /root/key-value-example-app/contracts/kv_todo/build/* /opt/eosio/bin/contracts/kv_todo/
COPY --from=contracts /root/return-values-example-app/contracts/action_return_value/build/* /opt/eosio/bin/contracts/action_return_value/
COPY --from=contracts /root/cfhello/build/* /opt/eosio/bin/contracts/cfhello/
COPY ./ /opt/eosio/bin/

RUN mkdir -p "/opt/eosio/bin/config-dir"
RUN /bin/bash /opt/eosio/bin/scripts/deploy_contracts.sh
35 changes: 35 additions & 0 deletions .github/eosjs-ci/contracts/cfhello.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Import necessary libraries
#include <eosio/eosio.hpp>
#include <eosio/transaction.hpp>

using namespace eosio;

class [[eosio::contract("cfhello")]] cfhello : public contract {
public:
using contract::contract;

[[eosio::action]]
void contextfree() {
int cfd_index = 0;
while(true) {
int read_size = get_context_free_data( cfd_index, nullptr, 0 );
if (read_size == -1) {
if (cfd_index == 0) {
print("No context free data found");
}
break;
}

char* context_free_data = new char[read_size];
get_context_free_data( cfd_index, context_free_data, read_size );

print("CFD ", std::to_string(cfd_index), ":", context_free_data, "\n");
cfd_index++;
}
}

[[eosio::action]]
void normal( name user ) {
print( "Hi, ", user);
}
};
101 changes: 75 additions & 26 deletions .github/eosjs-ci/scripts/deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ EXAMPLE_ACCOUNT_PUBLIC_KEY="EOS7bxrQUTbQ4mqcoefhWPz1aFieN4fA9RQAiozRz7FrUChHZ7Rb
R1_EXAMPLE_ACCOUNT_PRIVATE_KEY="PVT_R1_GrfEfbv5at9kbeHcGagQmvbFLdm6jqEpgE1wsGbrfbZNjpVgT"
R1_EXAMPLE_ACCOUNT_PUBLIC_KEY="PUB_R1_4ztaVy8L9zbmzTdpfq5GcaFYwGwXTNmN3qW7qcgHMmfUZhpzQQ"

CFHELLO_PRIVATE_KEY="5KYjzAywvTnkSDDyvCBoXAiEsjtDEMRzJ3yrXRhyF6VDs9b5RBj"
CFHELLO_PUBLIC_KEY="EOS6nVrBASwwviMy3CntKsb1cD5Ai2gRZnyrxJDqypL3JLL7KCKrK"

CFACTOR_PRIVATE_KEY="5K8Sm2bB2b7ZC8tJMefrk1GFa4jgtHxxHRcjX49maMk9AEwq8hN"
CFACTOR_PUBLIC_KEY="EOS8Gyj8LpmSXxGVkGCd1rrroV9K5wtouCuwwABpyVKQno6LbSV3C"

ROOT_DIR="/opt"
CONTRACTS_DIR="$ROOT_DIR/eosio/bin/contracts"
BLOCKCHAIN_DATA_DIR=/root/.local/share
Expand Down Expand Up @@ -97,14 +103,6 @@ function setabi {
fi
}

# $1 - account name
# $2 - public key
# $3 - private key
function create_account {
cleos wallet import --private-key $3
cleos create account eosio $1 $2
}

# Move into the executable directory
cd $ROOT_DIR/bin/
mkdir -p $CONFIG_DIR
Expand All @@ -119,10 +117,14 @@ if [ -z "$NODEOS_RUNNING" ]; then
--http-validate-host=false \
--plugin eosio::producer_api_plugin \
--plugin eosio::chain_api_plugin \
--plugin eosio::trace_api_plugin \
--trace-no-abis \
--plugin eosio::db_size_api_plugin \
--plugin eosio::http_plugin \
--http-server-address=0.0.0.0:8888 \
--access-control-allow-origin=* \
--contracts-console \
--enable-account-queries=true \
--max-transaction-time=100000 \
--verbose-http-errors &
fi
Expand All @@ -144,41 +146,88 @@ echo "Creating accounts and deploying contracts"

start_wallet

sleep 1s
cleos wallet import --private-key $EXAMPLE_ACCOUNT_PRIVATE_KEY
cleos wallet import --private-key $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
cleos wallet import --private-key $CFHELLO_PRIVATE_KEY
cleos wallet import --private-key $CFACTOR_PRIVATE_KEY
cleos create account eosio eosio.bpay $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.msig $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.names $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.ram $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.ramfee $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.saving $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.stake $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.vpay $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.rex $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.token $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio returnvalue $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio todo $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio bob $EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio alice $EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio bobr1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio alicer1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio cfhello $CFHELLO_PUBLIC_KEY
cleos create account cfhello cfactor $CFACTOR_PUBLIC_KEY

# preactivate concensus upgrades
post_preactivate

sleep 1s
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
setabi eosio $CONTRACTS_DIR/boot/boot.abi
setcode eosio $CONTRACTS_DIR/boot/boot.wasm
sleep 2s
cleos push action eosio boot "[]" -p eosio@active
setabi eosio $CONTRACTS_DIR/eosio.boot/eosio.boot.abi
setcode eosio $CONTRACTS_DIR/eosio.boot/eosio.boot.wasm

sleep 1s
activate_feature "299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"
activate_feature "825ee6288fb1373eab1b5187ec2f04f6eacb39cb3a97f356a07c91622dd61d16"
activate_feature "c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071"
activate_feature "4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d67"
activate_feature "f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d"
activate_feature "2652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25"
activate_feature "8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405"
activate_feature "ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43"
activate_feature "68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a297428"
activate_feature "e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526"
activate_feature "ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99"
activate_feature "4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f"
activate_feature "1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b7241"
activate_feature "bf61537fd21c61a60e542a5d66c3f6a78da0589336868307f94a82bccea84e88"
activate_feature "5443fcf88330c586bc0e5f3dee10e7f63c76c00249c87fe4fbf7f38c082006b4"

sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.abi
setcode eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.wasm

sleep 1s
cleos push action eosio setkvparams '[{"max_key_size":1024, "max_value_size":4096, "max_iterators":1024}]' -p eosio@active
cleos push action eosio setpparams '["01110000400100000000"]' -p eosio@active

sleep 1s
setabi cfhello $CONTRACTS_DIR/cfhello/cfhello.abi
setcode cfhello $CONTRACTS_DIR/cfhello/cfhello.wasm

sleep 1s
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
setcode eosio $CONTRACTS_DIR/system/system.wasm
setabi eosio $CONTRACTS_DIR/system/system.abi
setabi todo $CONTRACTS_DIR/kv_todo/kv_todo.abi
setcode todo $CONTRACTS_DIR/kv_todo/kv_todo.wasm

# token
sleep 1s
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
create_account eosio.token $SYSTEM_ACCOUNT_PUBLIC_KEY $SYSTEM_ACCOUNT_PRIVATE_KEY
create_account bob $EXAMPLE_ACCOUNT_PUBLIC_KEY $EXAMPLE_ACCOUNT_PRIVATE_KEY
create_account alice $EXAMPLE_ACCOUNT_PUBLIC_KEY $EXAMPLE_ACCOUNT_PRIVATE_KEY
create_account bobr1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
create_account alicer1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
setabi returnvalue $CONTRACTS_DIR/action_return_value/action_return_value.abi
setcode returnvalue $CONTRACTS_DIR/action_return_value/action_return_value.wasm

sleep 1s
cleos set abi eosio.token $CONTRACTS_DIR/token/token.abi -p eosio.token@active -p eosio@active
cleos set code eosio.token $CONTRACTS_DIR/token/token.wasm -p eosio.token@active -p eosio@active
setabi eosio.token $CONTRACTS_DIR/eosio.token/eosio.token.abi
setcode eosio.token $CONTRACTS_DIR/eosio.token/eosio.token.wasm

sleep 1s
cleos push action eosio.token create '["bob", "10000000000.0000 SYS"]' -p eosio.token
cleos push action eosio.token issue '["bob", "5000000000.0000 SYS", "Half of available supply"]' -p bob
cleos push action eosio.token transfer '["bob", "alice", "1000000.0000 SYS", "memo"]' -p bob
cleos push action eosio.token transfer '["bob", "bobr1", "1000000.0000 SYS", "memo"]' -p bob
cleos push action eosio.token transfer '["bob", "alicer1", "1000000.0000 SYS", "memo"]' -p bob

cleos push action eosio init "[]" -p eosio@active
cleos push action todo upsert '["bf581bee-9f2c-447b-94ad-78e4984b6f51", "todo", "Write Hello World Contract", false]' -p todo@active
cleos push action todo upsert '["b7b0d09d-a82b-44d9-b067-3bae2d02917e", "todo", "Start Blockchain", false]' -p todo@active
cleos push action todo upsert '["ac8acfe7-cd4e-4d22-8400-218b697a4517", "todo", "Deploy Hello World Contract", false]' -p todo@active

echo "All done initializing the blockchain"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-docker-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
ref: develop
token: ${{ github.token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@6520a2d2cb6db42c90c297c8025839c98e531268
uses: docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609
uses: docker/setup-buildx-action@0d135e0c2fc0dba0729c1a47ecfcf5a3c7f8579e
- name: Login to DockerHub
uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
ref: release/22.0.x
token: ${{ github.token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@6520a2d2cb6db42c90c297c8025839c98e531268
uses: docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609
uses: docker/setup-buildx-action@0d135e0c2fc0dba0729c1a47ecfcf5a3c7f8579e
- name: Login to DockerHub
uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ jobs:
- name: Test Node
run: |
yarn test-node
- name: Test Types
run: |
yarn test-types
- name: Build
run: |
yarn build-web
- name: Test Web
uses: cypress-io/github-action@89161930792c0050baeba2737caa058c395ecfcb
uses: cypress-io/github-action@1db146275576798796bc39ef83d739924145298a
with:
spec: cypress/integration/index.spec.js
- name: Get Protected Status
Expand All @@ -73,7 +76,7 @@ jobs:
git push origin ${GITHUB_REF#refs/*/}
services:
nodeos:
image: eosio/eosjs-ci:v0.2.1
image: eosio/eosjs-ci:release_22.0.x

ports:
- 8888:8888
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
yarn build-web
- name: Test Web
uses: cypress-io/github-action@89161930792c0050baeba2737caa058c395ecfcb
uses: cypress-io/github-action@1db146275576798796bc39ef83d739924145298a
with:
spec: cypress/integration/index.spec.js
services:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
yarn build-web
- name: Test Web
uses: cypress-io/github-action@89161930792c0050baeba2737caa058c395ecfcb
uses: cypress-io/github-action@1db146275576798796bc39ef83d739924145298a
with:
spec: cypress/integration/index.spec.js
services:
Expand Down
Loading

0 comments on commit 31ac222

Please sign in to comment.