From 9579593438682c7ecc2fa3bf5a0d85c2cd377777 Mon Sep 17 00:00:00 2001 From: anunay-xin Date: Sat, 21 Mar 2026 17:22:44 +0530 Subject: [PATCH] fix(constants): update Devnet chain ID and block parameters for devnet-108 setup (#2205) * fix(constants): update Devnet chain ID and block parameters for devnet-108 setup * refactor(ci): update masternode deployment logic to skip specifically masternode-1 to masternode-25 * ci: update Slack webhook variable names for pull request notifications * ci: correct format for masternodeN * ci: enhance start script to handle bootnodes and miner gas limit configuration in new devnet * ci: update start script to set default netstats configuration and change network ID for devnet --- .github/workflows/ci.yml | 25 +++++++++++++++++-------- .github/workflows/pr-notify-slack.yml | 18 +++++++++--------- cicd/devnet/start.sh | 12 ++++++++++-- cicd/local/start.sh | 20 ++++++++++++++++++-- common/constants.devnet.go | 10 +++++----- params/config.go | 2 +- 6 files changed, 60 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f73f55dbeb..237e92c04c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,20 +138,29 @@ jobs: echo "${{ secrets.KUBE_CONFIG }}" | base64 --decode > $HOME/.kube/config chmod 600 $HOME/.kube/config git_hash=$(git rev-parse --short "$GITHUB_SHA") - masternodes=$(kubectl get deployment -o json| jq -r '.items[] | select(.metadata.name | test("devnet")) | "\(.metadata.name)"') + masternodes=$(kubectl get deployment -o json | jq -r '.items[] | select(.metadata.name | test("^masternode[0-9]")) | .metadata.name' | sort) rpcs=$(kubectl get deployment -o json| jq -r '.items[] | select(.metadata.name | test("rpc")) | "\(.metadata.name)"') echo "Masternodes: $masternodes" echo "RPCs: $rpcs" - skip_names=("devnet1" "devnet2" "devnet3" "devnet4" "devnet9" "devnet10" "devnet11" "devnet12" "devnetrpc" "devnetrpc2") - while read -r name; do - if [[ " ${skip_names[@]} " =~ " ${name} " ]]; then - echo "Skipping deployment: $name" - continue + # Skip masternode1 through masternode25, update the rest. + readarray -t mn_array <<< "$masternodes" + total=${#mn_array[@]} + echo "Total masternode deployments: $total, skipping masternode1..masternode25" + + for name in "${mn_array[@]}"; do + if [[ $name =~ ^masternode[0-9] ]]; then + num=${name#masternode} + num=${num%%-*} + if [[ $num =~ ^[0-9]+$ ]] && (( num >= 1 && num <= 25 )); then + echo "Skipping deployment: $name" + continue + fi fi + echo "Updating deployment: $name" - kubectl set image deployment/$name $name=xinfinorg/devnet:dev-upgrade-${git_hash} || true - done <<< "$masternodes" + kubectl set image "deployment/$name" "$name=xinfinorg/devnet:dev-upgrade-${git_hash}" || true + done while read -r name; do diff --git a/.github/workflows/pr-notify-slack.yml b/.github/workflows/pr-notify-slack.yml index 435327d44c..7812d1e712 100644 --- a/.github/workflows/pr-notify-slack.yml +++ b/.github/workflows/pr-notify-slack.yml @@ -14,14 +14,14 @@ jobs: steps: - name: Test Slack webhook env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_PULL_REQUEST_WEBHOOK_URL: ${{ secrets.SLACK_PULL_REQUEST_WEBHOOK_URL }} run: | - if [ -z "$SLACK_WEBHOOK_URL" ]; then - echo "SLACK_WEBHOOK_URL secret is not set. Add it in repo Settings → Secrets → Actions." + if [ -z "$SLACK_PULL_REQUEST_WEBHOOK_URL" ]; then + echo "SLACK_PULL_REQUEST_WEBHOOK_URL secret is not set. Add it in repo Settings → Secrets → Actions." exit 1 fi BODY=$(jq -n --arg text "Test: PR notify Slack webhook is working (from ${{ github.repository }})" '{text: $text}') - curl -sS -X POST -H 'Content-Type: application/json' --data "$BODY" "$SLACK_WEBHOOK_URL" + curl -sS -X POST -H 'Content-Type: application/json' --data "$BODY" "$SLACK_PULL_REQUEST_WEBHOOK_URL" echo "" echo "If you see this and no curl error, check your Slack channel for the test message." @@ -44,10 +44,10 @@ jobs: steps: - name: Send Slack notification env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_PULL_REQUEST_WEBHOOK_URL: ${{ secrets.SLACK_PULL_REQUEST_WEBHOOK_URL }} run: | - if [ -z "$SLACK_WEBHOOK_URL" ]; then - echo "SLACK_WEBHOOK_URL secret is not set; skipping notification." + if [ -z "$SLACK_PULL_REQUEST_WEBHOOK_URL" ]; then + echo "SLACK_PULL_REQUEST_WEBHOOK_URL secret is not set; skipping notification." exit 0 fi PR_URL="${{ github.event.pull_request.html_url }}" @@ -59,5 +59,5 @@ jobs: --arg title "$PR_TITLE" \ --arg author "$PR_AUTHOR" \ '{text: ("PR ready for review: <" + $url + "|" + $title + "> by " + $author)}') - curl -sS -X POST -H 'Content-Type: application/json' --data "$BODY" "$SLACK_WEBHOOK_URL" - if: env.SLACK_WEBHOOK_URL != '' + curl -sS -X POST -H 'Content-Type: application/json' --data "$BODY" "$SLACK_PULL_REQUEST_WEBHOOK_URL" + if: env.SLACK_PULL_REQUEST_WEBHOOK_URL != '' diff --git a/cicd/devnet/start.sh b/cicd/devnet/start.sh index 0033b71c5e..64ee9360a2 100755 --- a/cicd/devnet/start.sh +++ b/cicd/devnet/start.sh @@ -104,8 +104,16 @@ else miner_gaslimit=$MINER_GASLIMIT fi -netstats="${NODE_NAME}-${wallet}-${instance_ip}:xinfin_xdpos_hybrid_network_stats@devnetstats.hashlabs.apothem.network:1999" +netstats_default="${NODE_NAME}-${wallet}-${instance_ip}:xinfin_xdpos_hybrid_network_stats@devnetstats.hashlabs.apothem.network:1999" +if test -z "$NETSTATS_CONFIG" +then + echo "NETSTATS_CONFIG not set, default to hashlabs devnet stats" + netstats=$netstats_default +else + echo "NETSTATS_CONFIG found, set to $NETSTATS_CONFIG" + netstats="${NODE_NAME}-${wallet}-${instance_ip}:$NETSTATS_CONFIG" +fi echo "Running a node with wallet: ${wallet} at IP: ${instance_ip}" echo "Starting nodes with $bootnodes ..." @@ -117,7 +125,7 @@ XDC --ethstats ${netstats} \ --gcmode ${gc_mode} --syncmode ${sync_mode} \ --nat extip:${instance_ip} \ --bootnodes ${bootnodes} \ ---datadir /work/xdcchain --networkid 551 \ +--datadir /work/xdcchain --networkid 5551 \ --port $port --http --http-corsdomain "*" --http-addr 0.0.0.0 \ --http-port $rpc_port \ --http-api db,eth,net,txpool,web3,XDPoS \ diff --git a/cicd/local/start.sh b/cicd/local/start.sh index 8be3f5bca5..f786076727 100755 --- a/cicd/local/start.sh +++ b/cicd/local/start.sh @@ -24,6 +24,13 @@ do bootnodes="${bootnodes},$line" fi done < "$input" +#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}" ] +then + bootnodes=$line +else + bootnodes="${bootnodes},$line" +fi log_level=3 if test -z "$LOG_LEVEL" @@ -88,6 +95,15 @@ else gc_mode=$GC_MODE fi +miner_gaslimit=50000000 +if test -z "$MINER_GASLIMIT" +then + echo "MINER_GASLIMIT not set, default to $miner_gaslimit" +else + echo "MINER_GASLIMIT found, set to $MINER_GASLIMIT" + miner_gaslimit=$MINER_GASLIMIT +fi + ethstats_address=localhost:2000 if test -z "$STATS_ADDRESS" then @@ -108,7 +124,7 @@ fi netstats="${NODE_NAME}-${wallet}:$ethstats_secret@$ethstats_address" -echo "Running a node with wallet: ${wallet}" +echo "Running a node with wallet: ${wallet} at IP: ${instance_ip}" echo "Starting nodes with $bootnodes ..." # Note: --gcmode=archive means node will store all historical data. This will lead to high memory usage. But sync mode require archive to sync @@ -124,7 +140,7 @@ XDC \ --http-port $rpc_port \ --http-api db,eth,net,txpool,web3,XDPoS \ --http-vhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ ---miner-gasprice "1" --miner-gaslimit "50000000" --verbosity ${log_level} \ +--miner-gasprice "1" --miner-gaslimit "${miner_gaslimit}" --verbosity ${log_level} \ --debugdatadir /work/xdcchain \ --store-reward \ --ws --ws-addr=0.0.0.0 --ws-port $ws_port \ diff --git a/common/constants.devnet.go b/common/constants.devnet.go index da912bc711..b162c195c5 100644 --- a/common/constants.devnet.go +++ b/common/constants.devnet.go @@ -6,7 +6,7 @@ import ( ) var DevnetConstant = constant{ - chainID: 551, + chainID: 5551, denylistHFNumber: 0, maxMasternodesV2: 108, @@ -29,11 +29,11 @@ var DevnetConstant = constant{ tipXDCXReceiverDisable: big.NewInt(0), eip1559Block: big.NewInt(32400), cancunBlock: big.NewInt(43200), - pragueBlock: big.NewInt(45000), + pragueBlock: big.NewInt(math.MaxInt64), osakaBlock: big.NewInt(math.MaxInt64), - dynamicGasLimitBlock: big.NewInt(45000), - tipUpgradeReward: big.NewInt(45000), - tipUpgradePenalty: big.NewInt(45000), + dynamicGasLimitBlock: big.NewInt(math.MaxInt64), + tipUpgradeReward: big.NewInt(math.MaxInt64), + tipUpgradePenalty: big.NewInt(math.MaxInt64), tipEpochHalving: big.NewInt(math.MaxInt64), trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"), diff --git a/params/config.go b/params/config.go index c606847c26..40c6bef22b 100644 --- a/params/config.go +++ b/params/config.go @@ -293,7 +293,7 @@ var ( // DevnetChainConfig contains the chain parameters to run a node on the devnet. DevnetChainConfig = &ChainConfig{ - ChainID: big.NewInt(551), + ChainID: big.NewInt(5551), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0),