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

Commit 203e13e

Browse files
author
Brad Hart
authored
Merge pull request #773 from EOSIO/release/21.0.x
Promoting release/21.0.x features to latest version
2 parents f514726 + c7989e4 commit 203e13e

File tree

84 files changed

+8434
-5502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+8434
-5502
lines changed

.babelrc

-19
This file was deleted.

.eslintrc

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": "@blockone/blockone",
3+
"rules": {
4+
"no-bitwise": "off",
5+
"semi": ["error", "always"],
6+
"indent": ["error", 4]
7+
},
8+
"overrides": [
9+
{
10+
"files": ["**/*.ts", "**/*.tsx"],
11+
"rules":{
12+
"indent": "off",
13+
"@typescript-eslint/indent": ["error", 4],
14+
"@typescript-eslint/no-var-requires": "off",
15+
"semi": "off",
16+
"@typescript-eslint/semi": ["error", "always"]
17+
}
18+
}
19+
]
20+
}

.github/eosjs-ci/Dockerfile

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
FROM ubuntu:18.04
2+
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"]
3+
4+
### base
5+
RUN yes | unminimize \
6+
&& apt-get update \
7+
&& apt-get install -yq \
8+
binutils-gold \
9+
build-essential \
10+
clang-tools-8 \
11+
curl \
12+
g++-8 \
13+
git \
14+
libcurl4-gnutls-dev \
15+
libgflags-dev \
16+
libgmp3-dev \
17+
libssl-dev \
18+
libusb-1.0-0-dev \
19+
lld-8 \
20+
llvm-7 \
21+
llvm-7-dev \
22+
locales \
23+
ninja-build \
24+
pkg-config \
25+
python \
26+
software-properties-common \
27+
wget \
28+
xz-utils \
29+
zlib1g-dev \
30+
&& update-alternatives --remove-all cc \
31+
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-8 100 \
32+
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 \
33+
&& update-alternatives --remove-all c++ \
34+
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 100 \
35+
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 100 \
36+
&& update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-8 100 \
37+
&& locale-gen en_US.UTF-8 \
38+
&& curl -sL https://deb.nodesource.com/setup_10.x | bash -
39+
40+
ENV LANG=en_US.UTF-8
41+
42+
### cmake
43+
WORKDIR /root
44+
RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz \
45+
&& tar -xzf cmake-3.13.2.tar.gz \
46+
&& cd cmake-3.13.2 \
47+
&& ./bootstrap --prefix=/usr/local --parallel=8 \
48+
&& make -j8 \
49+
&& make install \
50+
&& cd /root \
51+
&& rm -rf cmake-3.13.2.tar.gz cmake-3.13.2
52+
53+
### boost
54+
RUN curl -LO https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2 \
55+
&& tar -xjf boost_1_72_0.tar.bz2 \
56+
&& cd boost_1_72_0 \
57+
&& ./bootstrap.sh --prefix=/usr/local \
58+
&& ./b2 --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -j$(nproc) install \
59+
&& cd /root \
60+
&& rm -rf boost_1_72_0.tar.bz2 boost_1_72_0
61+
62+
### eosio.cdt
63+
RUN git clone https://github.com/EOSIO/eosio.cdt.git \
64+
&& cd eosio.cdt \
65+
&& git checkout eosio-cdt-2.1-staging-c \
66+
&& git submodule update --init --recursive \
67+
&& mkdir build \
68+
&& cd build \
69+
&& cmake -GNinja .. \
70+
&& ninja -j8
71+
72+
### eos
73+
RUN git clone https://github.com/EOSIO/eos.git \
74+
&& cd eos \
75+
&& git checkout develop \
76+
&& git submodule update --init --recursive \
77+
&& mkdir build \
78+
&& cd build \
79+
&& 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 .. \
80+
&& CC=clang-8 CXX=clang++-8 ninja -j8
81+
82+
ENV PATH="/root/eos/build/bin/:/root/eosio.cdt/build/bin/:${PATH}"
83+
84+
RUN mkdir -p "/opt/eosio/bin/contracts"
85+
86+
COPY ./ /opt/eosio/bin
87+
88+
RUN mkdir -p "/opt/eosio/bin/config-dir"
89+
RUN /bin/bash /opt/eosio/bin/scripts/deploy_contracts.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
#!/usr/bin/env bash
2+
NODEOS_RUNNING=$1
3+
4+
set -m
5+
6+
# CAUTION: Never use these development keys for a production account!
7+
# Doing so will most certainly result in the loss of access to your account, these private keys are publicly known.
8+
SYSTEM_ACCOUNT_PRIVATE_KEY="5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
9+
SYSTEM_ACCOUNT_PUBLIC_KEY="EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
10+
11+
EXAMPLE_ACCOUNT_PRIVATE_KEY="5JuH9fCXmU3xbj8nRmhPZaVrxxXrdPaRmZLW1cznNTmTQR2Kg5Z"
12+
EXAMPLE_ACCOUNT_PUBLIC_KEY="EOS7bxrQUTbQ4mqcoefhWPz1aFieN4fA9RQAiozRz7FrUChHZ7Rb8"
13+
14+
R1_EXAMPLE_ACCOUNT_PRIVATE_KEY="PVT_R1_GrfEfbv5at9kbeHcGagQmvbFLdm6jqEpgE1wsGbrfbZNjpVgT"
15+
R1_EXAMPLE_ACCOUNT_PUBLIC_KEY="PUB_R1_4ztaVy8L9zbmzTdpfq5GcaFYwGwXTNmN3qW7qcgHMmfUZhpzQQ"
16+
17+
ROOT_DIR="/opt"
18+
CONTRACTS_DIR="$ROOT_DIR/eosio/bin/contracts"
19+
BLOCKCHAIN_DATA_DIR=/root/.local/share
20+
BLOCKCHAIN_CONFIG_DIR=/opt/eosio/bin/config-dir
21+
WALLET_DIR="/root/eosio-wallet/"
22+
23+
mkdir -p $ROOT_DIR/bin
24+
25+
# Set PATH
26+
PATH="$PATH:$ROOT_DIR/bin:$ROOT_DIR/bin/scripts"
27+
CONFIG_DIR="$ROOT_DIR/bin/config-dir"
28+
29+
function start_wallet {
30+
echo "Starting the wallet"
31+
rm -rf $WALLET_DIR
32+
mkdir -p $WALLET_DIR
33+
nohup keosd --unlock-timeout 999999999 --wallet-dir $WALLET_DIR --http-server-address 127.0.0.1:8900 2>&1 &
34+
sleep 1s
35+
wallet_password=$(cleos wallet create --to-console | awk 'FNR > 3 { print $1 }' | tr -d '"')
36+
echo $wallet_password > "$CONFIG_DIR"/keys/default_wallet_password.txt
37+
38+
cleos wallet import --private-key $SYSTEM_ACCOUNT_PRIVATE_KEY
39+
}
40+
41+
function post_preactivate {
42+
curl -X POST http://127.0.0.1:8888/v1/producer/schedule_protocol_feature_activations -d '{"protocol_features_to_activate": ["0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"]}'
43+
}
44+
45+
# $1 feature disgest to activate
46+
function activate_feature {
47+
cleos push action eosio activate '["'"$1"'"]' -p eosio
48+
if [ $? -ne 0 ]; then
49+
exit 1
50+
fi
51+
}
52+
53+
# $1 account name
54+
# $2 contract directory
55+
# $3 wasm file name
56+
# $4 abi file name
57+
function setcode {
58+
retry_count="4"
59+
60+
while [ $retry_count -gt 0 ]; do
61+
cleos set code $1 $2 -p $1@active
62+
if [ $? -eq 0 ]; then
63+
break
64+
fi
65+
66+
echo "setcode failed retrying..."
67+
sleep 1s
68+
retry_count=$[$retry_count-1]
69+
done
70+
71+
if [ $retry_count -eq 0 ]; then
72+
echo "setcode failed too many times, bailing."
73+
exit 1
74+
fi
75+
}
76+
77+
# $1 account name
78+
# $2 contract directory
79+
# $3 abi file name
80+
function setabi {
81+
retry_count="4"
82+
83+
while [ $retry_count -gt 0 ]; do
84+
cleos set abi $1 $2 -p $1@active
85+
if [ $? -eq 0 ]; then
86+
break
87+
fi
88+
89+
echo "setcode failed retrying..."
90+
sleep 1s
91+
retry_count=$[$retry_count-1]
92+
done
93+
94+
if [ $retry_count -eq 0 ]; then
95+
echo "setcode failed too many times, bailing."
96+
exit 1
97+
fi
98+
}
99+
100+
# $1 - account name
101+
# $2 - public key
102+
# $3 - private key
103+
function create_account {
104+
cleos wallet import --private-key $3
105+
cleos create account eosio $1 $2
106+
}
107+
108+
# Move into the executable directory
109+
cd $ROOT_DIR/bin/
110+
mkdir -p $CONFIG_DIR
111+
mkdir -p $BLOCKCHAIN_DATA_DIR
112+
mkdir -p $BLOCKCHAIN_CONFIG_DIR
113+
114+
if [ -z "$NODEOS_RUNNING" ]; then
115+
echo "Starting the chain for setup"
116+
nodeos -e -p eosio \
117+
--data-dir $BLOCKCHAIN_DATA_DIR \
118+
--config-dir $BLOCKCHAIN_CONFIG_DIR \
119+
--http-validate-host=false \
120+
--plugin eosio::producer_api_plugin \
121+
--plugin eosio::chain_api_plugin \
122+
--plugin eosio::http_plugin \
123+
--http-server-address=0.0.0.0:8888 \
124+
--access-control-allow-origin=* \
125+
--contracts-console \
126+
--max-transaction-time=100000 \
127+
--verbose-http-errors &
128+
fi
129+
130+
mkdir -p "$CONFIG_DIR"/keys
131+
132+
sleep 1s
133+
134+
echo "Waiting for the chain to finish startup"
135+
until curl localhost:8888/v1/chain/get_info
136+
do
137+
echo "Still waiting"
138+
sleep 1s
139+
done
140+
141+
# Sleep for 2s to allow time for 4 blocks to be created so we have blocks to reference when sending transactions
142+
sleep 2s
143+
echo "Creating accounts and deploying contracts"
144+
145+
start_wallet
146+
147+
# preactivate concensus upgrades
148+
post_preactivate
149+
150+
sleep 1s
151+
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
152+
setabi eosio $CONTRACTS_DIR/boot/boot.abi
153+
setcode eosio $CONTRACTS_DIR/boot/boot.wasm
154+
sleep 2s
155+
cleos push action eosio boot "[]" -p eosio@active
156+
157+
sleep 1s
158+
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
159+
setcode eosio $CONTRACTS_DIR/system/system.wasm
160+
setabi eosio $CONTRACTS_DIR/system/system.abi
161+
162+
# token
163+
sleep 1s
164+
cleos wallet unlock --password $(cat "$CONFIG_DIR"/keys/default_wallet_password.txt) || true
165+
create_account eosio.token $SYSTEM_ACCOUNT_PUBLIC_KEY $SYSTEM_ACCOUNT_PRIVATE_KEY
166+
create_account bob $EXAMPLE_ACCOUNT_PUBLIC_KEY $EXAMPLE_ACCOUNT_PRIVATE_KEY
167+
create_account alice $EXAMPLE_ACCOUNT_PUBLIC_KEY $EXAMPLE_ACCOUNT_PRIVATE_KEY
168+
create_account bobr1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
169+
create_account alicer1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY $R1_EXAMPLE_ACCOUNT_PRIVATE_KEY
170+
171+
sleep 1s
172+
cleos set abi eosio.token $CONTRACTS_DIR/token/token.abi -p eosio.token@active -p eosio@active
173+
cleos set code eosio.token $CONTRACTS_DIR/token/token.wasm -p eosio.token@active -p eosio@active
174+
175+
cleos push action eosio.token create '["bob", "10000000000.0000 SYS"]' -p eosio.token
176+
cleos push action eosio.token issue '["bob", "5000000000.0000 SYS", "Half of available supply"]' -p bob
177+
cleos push action eosio.token transfer '["bob", "alice", "1000000.0000 SYS", "memo"]' -p bob
178+
cleos push action eosio.token transfer '["bob", "bobr1", "1000000.0000 SYS", "memo"]' -p bob
179+
cleos push action eosio.token transfer '["bob", "alicer1", "1000000.0000 SYS", "memo"]' -p bob
180+
181+
cleos push action eosio init "[]" -p eosio@active
182+
183+
echo "All done initializing the blockchain"
184+
185+
if [[ -z $NODEOS_RUNNING ]]; then
186+
echo "Shut down Nodeos, sleeping for 2 seconds to allow time for at least 4 blocks to be created after deploying contracts"
187+
sleep 2s
188+
kill %1
189+
fg %1
190+
fi

0 commit comments

Comments
 (0)