Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use rialto to test builtin network logics #26

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ BSC_CHAIN_NAME=rialto
BSC_CHAIN_ID=714
INIT_HOLDER="0x04d63aBCd2b9b1baa327f2Dda0f873F197ccd186"
INIT_HOLDER_PRV="59ba8068eb256d520179e903f43dacf6d8d57d72bd306e1bd603fdb8c8da10e8"
HARD_FORK_DELAY=300
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ curl -X POST "http://localhost:8545" -H "Content-Type: application/json" --data

## Additional Commands

#### Background transactions
```bash
cd txbot
go build
./air-drops
```

#### Remove all nodes
```bash
bash +x ./setup_bc_node.sh uninstall_k8s
Expand All @@ -163,7 +170,7 @@ bash +x ./stop_cluster.sh

```bash
# one cmd to start bsc cluster all alone
bash +x ./setup_bsc_node.sh native_run_alone
bash +x ./setup_bsc_node.sh native_start_alone
```
#### Upgrade image
```bash
Expand Down
19 changes: 15 additions & 4 deletions setup_bsc_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ function prepare_config() {
fi

cd ${workspace}/genesis
hardforkTime=`expr $(date +%s) + ${HARD_FORK_DELAY}`
echo "hardforkTime "${hardforkTime} >${workspace}/.local/bsc/hardforkTime.txt
sed -i -e '/shanghaiTime/d' ./genesis-template.json
sed -i -e '/keplerTime/d' ./genesis-template.json
# use 714 as `chainId` by default
bash scripts/generate.sh local
}
Expand Down Expand Up @@ -224,6 +228,7 @@ function uninstall_k8s() {
}

function native_start() {
hardforkTime=`cat ${workspace}/.local/bsc/hardforkTime.txt|grep hardforkTime|awk -F" " '{print $NF}'`
for ((i=0;i<${size};i++));do
cp -R ${workspace}/.local/bsc/validator${i}/keystore ${workspace}/.local/bsc/clusterNetwork/node${i}
for j in ${workspace}/.local/bsc/validator${i}/keystore/*;do
Expand All @@ -235,8 +240,13 @@ function native_start() {
MetricsPort=$((6060 + i))

cp ${workspace}/bin/geth ${workspace}/.local/bsc/clusterNetwork/node${i}/geth${i}
# init genesis
${workspace}/.local/bsc/clusterNetwork/node${i}/geth${i} init --state.scheme ${stateSchem} --datadir ${workspace}/.local/bsc/clusterNetwork/node${i} genesis/genesis.json

initLog=${workspace}/.local/bsc/clusterNetwork/node${i}/init.log
if [ ! -f "$initLog" ]; then
# init genesis
${workspace}/.local/bsc/clusterNetwork/node${i}/geth${i} init --state.scheme ${stateSchem} --datadir ${workspace}/.local/bsc/clusterNetwork/node${i} genesis/genesis.json >${initLog} 2>&1
fi
rialtoHash=`cat ${initLog}|grep "lightchaindata hash="|awk -F"=" '{print $NF}'|awk -F'"' '{print $1}'`
# run BSC node
nohup ${workspace}/.local/bsc/clusterNetwork/node${i}/geth${i} --config ${workspace}/.local/bsc/clusterNetwork/node${i}/config.toml \
--datadir ${workspace}/.local/bsc/clusterNetwork/node${i} \
Expand All @@ -247,6 +257,7 @@ function native_start() {
--ws.addr 0.0.0.0 --ws.port ${WSPort} --http.addr 0.0.0.0 --http.port ${HTTPPort} --http.corsdomain "*" \
--metrics --metrics.addr localhost --metrics.port ${MetricsPort} --metrics.expensive \
--gcmode archive --syncmode=full --state.scheme ${stateSchem} --mine --vote --monitor.maliciousvote \
--rialtohash ${rialtoHash} --override.shanghai ${hardforkTime} --override.kepler ${hardforkTime} \
> ${workspace}/.local/bsc/clusterNetwork/node${i}/bsc-node.log 2>&1 &
done
}
Expand Down Expand Up @@ -300,7 +311,7 @@ native_init)
initNetwork
echo "===== end ===="
;;
native_run_alone)
native_start_alone)
standalone=true
echo "===== register ===="
register_validator
Expand Down Expand Up @@ -332,6 +343,6 @@ native_stop)
echo "===== stop native end ===="
;;
*)
echo "Usage: setup_bsc_node.sh register | generate | generate_k8s | clean | install_k8s | uninstall_k8s | native_init | native_run_alone | native_start | native_stop"
echo "Usage: setup_bsc_node.sh register | generate | generate_k8s | clean | install_k8s | uninstall_k8s | native_init | native_start_alone | native_start | native_stop"
;;
esac