Skip to content

Commit

Permalink
<feat>: update wecross demo and scripts to support BCOS3 WASM. (#577)
Browse files Browse the repository at this point in the history
* feat: update wecross demo and scripts to support BCOS3 WASM.

* fix: update ci ubuntu version and typo error

* fix: demo script incorrect bcos 3 account adding logic。

* fix: demo script by Codacy Static Code Analysis issue 。

* fix: demo script by Codacy Static Code Analysis issue 。

* fix: demo script bcos3 account generation issue, account folder will be removed by bcos3 build_chain.sh script.

* fix: add missed hello_world folder

---------

Co-authored-by: dwzhan <[email protected]>
  • Loading branch information
HelloAldis and dwzhan authored Jul 18, 2023
1 parent 6303fc0 commit 389df02
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_check_bcos3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: bcos3-normal-gm
on: [pull_request]

jobs:
normal-gm:
bcos3-normal-gm:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand All @@ -21,7 +21,7 @@ jobs:
mysql -u root --password=123456 -h 127.0.0.1 -P 3306 -e 'status;'
mysql --host 127.0.0.1 --port 3306 -uroot -p123456 -e "SHOW DATABASES"
- name: run ci_cross_gm_demo_check.sh
- name: run ci_cross_bcos3_demo_check.sh
# The script only use ${1} as branch name. if GITHUB_BASE_REF is blank use GITHUB_REF
run: bash -x .ci/ci_cross_bcos3_demo_check.sh ${GITHUB_BASE_REF} ${GITHUB_REF#refs/heads/}
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_check_bcos_fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]

jobs:
bcos-fabric:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_check_bcos_fabric2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]

jobs:
bcos-fabric2:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_check_cross_all.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: all-2groups-gm-fabric
name: cross-all

on: [pull_request]

jobs:
cross-all:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_check_group_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]

jobs:
group-group:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_check_normal_gm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]

jobs:
normal-gm:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_check_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on: [push, pull_request]

jobs:
unittest:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand Down
10 changes: 5 additions & 5 deletions demo/bcos3/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ build_accounts() {

chmod u+x get_account.sh

# generate accounts
mkdir -p accounts
cd accounts
# generate bcos3 normal accounts
mkdir -p bcos3accounts
cd bcos3accounts

bash ../get_account.sh # normal
mv accounts bcos_user1
mv accounts bcos3_user1
cd -
}

main() {
build_bcos_chain "$1"
build_accounts
LOG_INFO "SUCCESS: Build FISCO BCOS demo finish."
LOG_INFO "SUCCESS: Build FISCO BCOS3 normal demo finish."
}

main "$1"
16 changes: 7 additions & 9 deletions demo/bcos3/build_gm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ build_bcos_chain() {
# Build chain
LOG_INFO "Build chain ..."
# Setting to build 1 groups
bash build_chain.sh -p 30500,20400 -l 127.0.0.1:1 -o ./nodes_gm -s
bash build_chain.sh -p 30500,20400 -l 127.0.0.1:1 -o ./nodes_gm -s -w

./nodes_gm/127.0.0.1/start_all.sh
}
Expand All @@ -54,26 +54,24 @@ build_accounts() {
if [ ! -e get_gm_account.sh ]; then
# Download
LOG_INFO "Download get_gm_account.sh ..."
Download https://${GITHUB_PROXY}raw.githubusercontent.com/FISCO-BCOS/console/${BCOS_VERSION}/tools/get_gm_account.sh
Download "https://${GITHUB_PROXY}raw.githubusercontent.com/FISCO-BCOS/console/${BCOS3_VERSION}/tools/get_gm_account.sh"
fi

chmod u+x get_gm_account.sh

# generate accounts
mkdir -p accounts
cd accounts
# generate bcos3 gm accounts
mkdir -p bcos3accounts
cd bcos3accounts

bash ../get_gm_account.sh # gm
mv accounts_gm bcos_gm_user1
bash ../get_gm_account.sh # gm2
mv accounts_gm bcos_gm_user2
mv accounts_gm bcos3_gm_user1
cd -
}

main() {
build_bcos_chain "$1"
build_accounts
LOG_INFO "SUCCESS: Build FISCO BCOS GM demo finish."
LOG_INFO "SUCCESS: Build FISCO BCOS GM WASM demo finish."
}

main "$1"
2 changes: 1 addition & 1 deletion demo/bcos3/clear.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ if [ -e nodes_gm/127.0.0.1/stop_all.sh ]; then
bash nodes_gm/127.0.0.1/stop_all.sh
fi

rm -rf accounts console ipconf nodes nodes_gm accounts ledger-tool
rm -rf bcos3accounts console ipconf nodes nodes_gm ledger-tool
2 changes: 1 addition & 1 deletion demo/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ main() {

LOG_INFO "Success! WeCross demo network is running. Framework:"
echo -e "
FISCO BCOS Fabric
FISCO BCOS2 Fabric
(4node pbft) (first-network)
(HelloWorld.sol) (sacc.go)
| |
Expand Down
2 changes: 1 addition & 1 deletion demo/build_cross_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ main() {

LOG_INFO "Success! WeCross demo network is running. Framework:"
echo -e "
FISCO BCOS FISCO BCOS FISCO BCOS Fabric
FISCO BCOS2 FISCO BCOS2 FISCO BCOS2 Fabric
Group 1 Group 2 Guomi first-network
(HelloWorldGroup1) (HelloWorldGroup2) (HelloWorld) (sacc.go)
\ / \ /
Expand Down
23 changes: 12 additions & 11 deletions demo/build_cross_bcos3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,16 @@ config_router_8251() {
cd ${router_dir}

# stubs bcos3_gm
bash add_chain.sh -t BCOS3_GM_EVM -n bcos3_gm -d conf/chains
bash add_chain.sh -t BCOS3_GM_WASM -n bcos3_gm -d conf/chains
# copy cert
cp ${ROOT}/bcos3/nodes_gm/127.0.0.1/sdk/* conf/chains/bcos3_gm/

# configure to port
sed_i 's/20200/20400/g' conf/chains/bcos3_gm/stub.toml

# deploy system contracts
bash deploy_system_contract.sh -t BCOS3_GM_EVM -c chains/bcos3_gm -P
bash deploy_system_contract.sh -t BCOS3_GM_EVM -c chains/bcos3_gm -H
bash deploy_system_contract.sh -t BCOS3_GM_WASM -c chains/bcos3_gm -P
bash deploy_system_contract.sh -t BCOS3_GM_WASM -c chains/bcos3_gm -H


# stubs bcos2_gm
Expand Down Expand Up @@ -435,8 +435,8 @@ deploy_bcos_sample_resource() {

bash start.sh <<EOF
login
bcosDeploy payment.bcos3.HelloWorld conf/contracts/solidity/HelloWorld.sol HelloWorld 1.0
bcosDeploy payment.bcos3_gm.HelloWorld conf/contracts/solidity/HelloWorld.sol HelloWorld 1.0
bcosDeploy payment.bcos3.HelloWorld conf/contracts/solidity/HelloWorld.sol HelloWorld
bcosDeploy payment.bcos3_gm.HelloWorld conf/contracts/liquid/hello_world/hello_world_gm.wasm conf/contracts/liquid/hello_world/hello_world.abi
bcosDeploy payment.bcos2_gm.HelloWorld conf/contracts/solidity/HelloWorld.sol HelloWorld 1.0
quit
EOF
Expand Down Expand Up @@ -474,7 +474,7 @@ add_bcos3_gm_account() {
cd ${ROOT}/WeCross-Console/
bash start.sh <<EOF
login
addChainAccount BCOS3_GM_EVM conf/accounts/${name}/${address}.public.pem conf/accounts/${name}/${address}.pem ${address} true
addChainAccount BCOS3_GM_WASM conf/accounts/${name}/${address}.public.pem conf/accounts/${name}/${address}.pem ${address} true
quit
EOF
cd -
Expand Down Expand Up @@ -503,11 +503,12 @@ EOF
deploy_chain_account() {
mkdir -p ${ROOT}/WeCross-Console/conf/accounts/
cd ${ROOT}/WeCross-Console/conf/accounts/ && rm -rf $(ls | grep -v .sh) && cd -
cp -r ${ROOT}/bcos3/accounts/* ${ROOT}/WeCross-Console/conf/accounts/
cp -r "${ROOT}"/bcos3/bcos3accounts/* "${ROOT}"/WeCross-Console/conf/accounts/
cp -r "${ROOT}"/bcos/accounts/* "${ROOT}"/WeCross-Console/conf/accounts/

add_bcos3_account bcos_user1
add_bcos3_gm_account bcos_gm_user1
add_bcos2_gm_account bcos_gm_user2
add_bcos3_account bcos3_user1
add_bcos3_gm_account bcos3_gm_user1
add_bcos2_gm_account bcos_gm_user1
}

deploy_sample_resource() {
Expand Down Expand Up @@ -551,7 +552,7 @@ main() {
LOG_INFO "Success! WeCross demo network is running. Framework:"
echo -e "
FISCO BCOS3 FISCO BCOS3 FISCO BCOS2
Normal Guomi Guomi
Normal Guomi wasm Guomi
(HelloWorld) (HelloWorld) (HelloWorld)
| \ /
| \ /
Expand Down
2 changes: 1 addition & 1 deletion demo/build_cross_fabric2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ main() {

LOG_INFO "Success! WeCross demo network is running. Framework:"
echo -e "
FISCO BCOS Fabric2
FISCO BCOS2 Fabric2
(4node pbft) (test-network)
(HelloWorld.sol) (sacc.go)
| |
Expand Down
2 changes: 1 addition & 1 deletion demo/build_cross_gm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ main() {

LOG_INFO "Success! WeCross demo network is running. Framework:"
echo -e "
FISCO BCOS
FISCO BCOS2
Normal Guomi
(HelloWorld) (HelloWorld)
| |
Expand Down
2 changes: 1 addition & 1 deletion demo/build_cross_groups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ main() {

LOG_INFO "Success! WeCross demo network is running. Framework:"
echo -e "
FISCO BCOS
FISCO BCOS2
Group 1 Group 2
(HelloWorldGroup1) (HelloWorldGroup2)
| |
Expand Down
4 changes: 2 additions & 2 deletions demo/profile_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ WECROSS_JAVA_SDK_VERSION=v1.3.0
# FISCO BCOS
BCOS_VERSION=v2.9.1
# FISCO BCOS 3.0
BCOS3_VERSION=v3.2.0
BCOS3_VERSION=v3.4.0
# FISCO BCOS Console
BCOS3_CONSOLE_VERSION=v3.2.0
BCOS3_CONSOLE_VERSION=v3.4.0

GIT_URL_BASE='github.com'
GITHUB_PROXY=''
2 changes: 1 addition & 1 deletion scripts/add_account.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ help() {
echo $1
cat <<EOF
Usage:
-t <type> [Required] type of account, BCOS2.0 or GM_BCOS2.0 BCOS3_ECDSA_EVM or BCOS3_GM_EVM or Fabric1.4
-t <type> [Required] type of account, support: BCOS2.0, GM_BCOS2.0, Fabric1.4, Fabric2.0, BCOS3_ECDSA_EVM, BCOS3_GM_EVM, BCOS3_ECDSA_WASM, BCOS3_GM_WASM
-n <name> [Required] name of account
-d <dir> [Optional] generated target_directory, default conf/accounts/
-h [Optional] Help
Expand Down
2 changes: 1 addition & 1 deletion scripts/add_chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ help() {
echo $1
cat <<EOF
Usage:
-t <type> [Required] type of chain: BCOS2.0, GM_BCOS2.0, BCOS3_ECDSA_EVM, BCOS3_GM_EVM, Fabric1.4, Fabric2.0
-t <type> [Required] type of chain: BCOS2.0, GM_BCOS2.0, Fabric1.4, Fabric2.0, BCOS3_ECDSA_EVM, BCOS3_GM_EVM, BCOS3_ECDSA_WASM, BCOS3_GM_WASM
-n <name> [Required] name of chain
-d <dir> [Optional] generated target_directory, default conf/chains/
-h [Optional] Help
Expand Down
8 changes: 4 additions & 4 deletions scripts/deploy_system_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ help() {
Usage:
-c <chain name> [Required] chain name
-u <upgrade> [Optional] upgrade proxy/hub contract if proxy/hub contract has been deployed, default deploy proxy/hub contract
-t <type> [Required] type of chain, support: BCOS2.0, GM_BCOS2.0, Fabric1.4, Fabric2.0, BCOS3_ECDSA_EVM, BCOS3_GM_EVM
-t <type> [Required] type of chain, support: BCOS2.0, GM_BCOS2.0, Fabric1.4, Fabric2.0, BCOS3_ECDSA_EVM, BCOS3_GM_EVM, BCOS3_ECDSA_WASM, BCOS3_GM_WASM
-P <proxy contract> [Optional] upgrade/deploy operation on proxy contract
-H <hub contract> [Optional] upgrade/deploy operation on hub contract
-h [Optional] Help
Expand Down Expand Up @@ -69,7 +69,7 @@ bcos_proxy_contract() {
"GM_BCOS2.0")
packageName="bcos.guomi"
;;
"BCOS3_ECDSA_EVM" | "BCOS3_GM_EVM")
"BCOS3_ECDSA_EVM" | "BCOS3_GM_EVM" | "BCOS3_ECDSA_WASM" | "BCOS3_GM_WASM")
packageName="bcos3"
;;
esac
Expand All @@ -93,7 +93,7 @@ bcos_hub_contract() {
"GM_BCOS2.0")
packageName="bcos.guomi"
;;
"BCOS3_ECDSA_EVM" | "BCOS3_GM_EVM")
"BCOS3_ECDSA_EVM" | "BCOS3_GM_EVM" | "BCOS3_ECDSA_WASM" | "BCOS3_GM_WASM")
packageName="bcos3"
;;
esac
Expand Down Expand Up @@ -201,7 +201,7 @@ main() {
LOG_INFO " deploy_system_contract, type: ${type}, chain: ${chain}, deploy: ${deploy}, contract: ${contract}"

case $type in
"BCOS2.0" | "BCOS3_ECDSA_EVM" | "GM_BCOS2.0" | "BCOS3_GM_EVM")
"BCOS2.0" | "BCOS3_ECDSA_EVM" | "GM_BCOS2.0" | "BCOS3_GM_EVM" | "BCOS3_ECDSA_WASM" | "BCOS3_GM_WASM")
if [[ "${contract}" == "proxy" ]]; then
bcos_proxy_contract "${chain}" "${deploy}" "${type}"
elif [[ "${contract}" == "hub" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/download_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Usage:
bash $0 <name> <tag/branch>
<name>: BCOS2 -> Repo: WeCross-BCOS2-Stub ( BCOS2.0 & GM_BCOS2.0 )
BCOS3 -> Repo: WeCross-BCOS3-Stub ( BCOS3_ECDSA_EVM & BCOS3_GM_EVM )
BCOS3 -> Repo: WeCross-BCOS3-Stub ( BCOS3_ECDSA_EVM & BCOS3_GM_EVM & BCOS3_ECDSA_WASM &BCOS3_GM_WASM )
Fabric1 -> Repo: WeCross-Fabric1-Stub ( Fabric1.4 )
Fabric2 -> Repo: WeCross-Fabric2-Stub ( Fabric2.0 )
Expand Down

0 comments on commit 389df02

Please sign in to comment.