ccid, cmd: disable personal module by default (#1148)

This commit is contained in:
Daniel Liu 2025-06-25 16:58:46 +08:00 committed by GitHub
parent 8ba50ab2aa
commit 10c7e1d775
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 61 deletions

View file

@ -1,89 +1,78 @@
#!/bin/bash #!/bin/bash
if [ ! -d /work/xdcchain/XDC/chaindata ] if [ ! -d /work/xdcchain/XDC/chaindata ]; then
then if test -z "$PRIVATE_KEY"; then
if test -z "$PRIVATE_KEY"
then
echo "PRIVATE_KEY environment variable has not been set." echo "PRIVATE_KEY environment variable has not been set."
exit 1 exit 1
fi fi
echo $PRIVATE_KEY >> /tmp/key echo $PRIVATE_KEY >>/tmp/key
wallet=$(XDC account import --password .pwd --datadir /work/xdcchain /tmp/key | awk -F '[{}]' '{print $2}') wallet=$(XDC account import --password .pwd --datadir /work/xdcchain /tmp/key | awk -F '[{}]' '{print $2}')
XDC --datadir /work/xdcchain init /work/genesis.json XDC --datadir /work/xdcchain init /work/genesis.json
else else
wallet=$(XDC account list --datadir /work/xdcchain | head -n 1 | awk -F '[{}]' '{print $2}') wallet=$(XDC account list --datadir /work/xdcchain | head -n 1 | awk -F '[{}]' '{print $2}')
fi fi
input="/work/bootnodes.list" input="/work/bootnodes.list"
bootnodes="" bootnodes=""
while IFS= read -r line while IFS= read -r line; do
do if [ -z "${bootnodes}" ]; then
if [ -z "${bootnodes}" ]
then
bootnodes=$line bootnodes=$line
else else
bootnodes="${bootnodes},$line" bootnodes="${bootnodes},$line"
fi fi
done < "$input" done <"$input"
#check last line since it's not included in "read" command https://stackoverflow.com/questions/12916352/shell-script-read-missing-last-line #check last line since it's not included in "read" command https://stackoverflow.com/questions/12916352/shell-script-read-missing-last-line
if [ -z "${bootnodes}" ] if [ -z "${bootnodes}" ]; then
then
bootnodes=$line bootnodes=$line
else else
bootnodes="${bootnodes},$line" bootnodes="${bootnodes},$line"
fi fi
log_level=3 log_level=3
if test -z "$LOG_LEVEL" if test -z "$LOG_LEVEL"; then
then echo "Log level not set, default to verbosity of $log_level"
echo "Log level not set, default to verbosity of $log_level"
else else
echo "Log level found, set to $LOG_LEVEL" echo "Log level found, set to $LOG_LEVEL"
log_level=$LOG_LEVEL log_level=$LOG_LEVEL
fi fi
port=30303 port=30303
if test -z "$PORT" if test -z "$PORT"; then
then echo "PORT not set, default to $port"
echo "PORT not set, default to $port"
else else
echo "PORT found, set to $PORT" echo "PORT found, set to $PORT"
port=$PORT port=$PORT
fi fi
rpc_port=8545 rpc_port=8545
if test -z "$RPC_PORT" if test -z "$RPC_PORT"; then
then echo "RPC_PORT not set, default to $rpc_port"
echo "RPC_PORT not set, default to $rpc_port"
else else
echo "RPC_PORT found, set to $RPC_PORT" echo "RPC_PORT found, set to $RPC_PORT"
rpc_port=$RPC_PORT rpc_port=$RPC_PORT
fi fi
ws_port=8555 ws_port=8555
if test -z "$WS_PORT" if test -z "$WS_PORT"; then
then echo "WS_PORT not set, default to $ws_port"
echo "WS_PORT not set, default to $ws_port"
else else
echo "WS_PORT found, set to $WS_PORT" echo "WS_PORT found, set to $WS_PORT"
ws_port=$WS_PORT ws_port=$WS_PORT
fi fi
sync_mode=full sync_mode=full
if test -z "$SYNC_MODE" if test -z "$SYNC_MODE"; then
then echo "SYNC_MODE not set, default to full" #full or fast
echo "SYNC_MODE not set, default to full" #full or fast
else else
echo "SYNC_MODE found, set to $SYNC_MODE" echo "SYNC_MODE found, set to $SYNC_MODE"
sync_mode=$SYNC_MODE sync_mode=$SYNC_MODE
fi fi
gc_mode=archive gc_mode=archive
if test -z "$GC_MODE" if test -z "$GC_MODE"; then
then echo "GC_MODE not set, default to archive" #full or archive
echo "GC_MODE not set, default to archive" #full or archive
else else
echo "GC_MODE found, set to $GC_MODE" echo "GC_MODE found, set to $GC_MODE"
gc_mode=$GC_MODE gc_mode=$GC_MODE
fi fi
INSTANCE_IP=$(curl https://checkip.amazonaws.com) INSTANCE_IP=$(curl https://checkip.amazonaws.com)
@ -96,16 +85,16 @@ echo "Starting nodes with $bootnodes ..."
# https://github.com/XinFinOrg/XDPoSChain/issues/268 # https://github.com/XinFinOrg/XDPoSChain/issues/268
XDC --ethstats ${netstats} \ XDC --ethstats ${netstats} \
--gcmode ${gc_mode} --syncmode ${sync_mode} \ --gcmode ${gc_mode} --syncmode ${sync_mode} \
--nat extip:${INSTANCE_IP} \ --nat extip:${INSTANCE_IP} \
--bootnodes ${bootnodes} \ --bootnodes ${bootnodes} \
--datadir /work/xdcchain --networkid 50 \ --datadir /work/xdcchain --networkid 50 \
--port $port --http --http-corsdomain "*" --http-addr 0.0.0.0 \ --port $port --http --http-corsdomain "*" --http-addr 0.0.0.0 \
--http-port $rpc_port \ --http-port $rpc_port \
--http-api db,eth,debug,net,shh,txpool,personal,web3,XDPoS \ --http-api db,eth,debug,net,shh,txpool,web3,XDPoS \
--http-vhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ --http-vhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \
--miner-gasprice "1" --miner-gaslimit "420000000" --verbosity ${log_level} \ --miner-gasprice "1" --miner-gaslimit "420000000" --verbosity ${log_level} \
--debugdatadir /work/xdcchain \ --debugdatadir /work/xdcchain \
--store-reward \ --store-reward \
--ws --ws-addr=0.0.0.0 --ws-port $ws_port \ --ws --ws-addr=0.0.0.0 --ws-port $ws_port \
--ws-origins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log --ws-origins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log

View file

@ -496,7 +496,7 @@ var (
Name: "http-api", Name: "http-api",
Aliases: []string{"rpcapi"}, Aliases: []string{"rpcapi"},
Usage: "API's offered over the HTTP-RPC interface", Usage: "API's offered over the HTTP-RPC interface",
Value: "debug,eth,net,personal,txpool,web3,XDPoS", Value: "debug,eth,net,txpool,web3,XDPoS",
Category: flags.APICategory, Category: flags.APICategory,
} }
HTTPPathPrefixFlag = &cli.StringFlag{ HTTPPathPrefixFlag = &cli.StringFlag{
@ -556,7 +556,7 @@ var (
Name: "ws-api", Name: "ws-api",
Aliases: []string{"wsapi"}, Aliases: []string{"wsapi"},
Usage: "API's offered over the WS-RPC interface", Usage: "API's offered over the WS-RPC interface",
Value: "debug,eth,net,personal,txpool,web3,XDPoS", Value: "debug,eth,net,txpool,web3,XDPoS",
Category: flags.APICategory, Category: flags.APICategory,
} }
WSAllowedOriginsFlag = &cli.StringFlag{ WSAllowedOriginsFlag = &cli.StringFlag{