mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
chore(cicd,common): unify XDC runtime binary across networks (#2147)
Package a single XDC binary for all networks and remove binary-switching logic from the CI/CD flow.
Changes:
- cicd/Dockerfile: build once and copy only /usr/bin/XDC
- cicd/entry.sh: validate NETWORK and remove runtime relink
- Makefile: make XDC-devnet-local depend on XDC; remove constants file swap
- common/constants: delete duplicated constants.go.{testnet,devnet,local}
Impact:
- network differences are now driven by runtime config, not separate binaries
This commit is contained in:
parent
d8fd0923a9
commit
be40f8ac21
7 changed files with 21 additions and 138 deletions
10
Makefile
10
Makefile
|
|
@ -10,18 +10,12 @@ GORUN = go run
|
|||
|
||||
#? XDC: Build XDC.
|
||||
XDC:
|
||||
@echo "Rebuild the XDC"
|
||||
go run build/ci.go install ./cmd/XDC
|
||||
@echo "Done building."
|
||||
@echo "Run \"$(GOBIN)/XDC\" to launch XDC."
|
||||
|
||||
XDC-devnet-local:
|
||||
@echo "Rebuild the XDC first"
|
||||
mv common/constants.go common/constants.go.tmp
|
||||
cp common/constants/constants.go.devnet common/constants.go
|
||||
make XDC
|
||||
rm -rf common/constants.go
|
||||
mv common/constants.go.tmp common/constants.go
|
||||
|
||||
XDC-devnet-local: XDC
|
||||
@echo "Run the devnet script in local"
|
||||
cd cicd/devnet && ./start-local-devnet.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -5,20 +5,11 @@ FROM golang:1.25-alpine AS builder
|
|||
|
||||
RUN apk add make build-base linux-headers
|
||||
|
||||
COPY . /builder
|
||||
WORKDIR /builder
|
||||
|
||||
RUN cd /builder && make puppeth
|
||||
COPY . .
|
||||
|
||||
RUN cd /builder && make && mv /builder/build/bin/XDC /builder/build/bin/XDC-mainnet
|
||||
|
||||
RUN mv /builder/common/constants/constants.go.testnet /builder/common/constants.go
|
||||
RUN cd /builder && make && mv /builder/build/bin/XDC /builder/build/bin/XDC-testnet
|
||||
|
||||
RUN mv /builder/common/constants/constants.go.devnet /builder/common/constants.go
|
||||
RUN cd /builder && make && mv /builder/build/bin/XDC /builder/build/bin/XDC-devnet
|
||||
|
||||
RUN mv /builder/common/constants/constants.go.local /builder/common/constants.go
|
||||
RUN cd /builder && make && mv /builder/build/bin/XDC /builder/build/bin/XDC-local
|
||||
RUN make puppeth && make
|
||||
|
||||
# The runtime image
|
||||
FROM alpine:3
|
||||
|
|
@ -30,10 +21,7 @@ WORKDIR /work
|
|||
RUN apk add --no-cache bash curl
|
||||
|
||||
COPY --from=builder /builder/build/bin/puppeth /usr/bin
|
||||
COPY --from=builder /builder/build/bin/XDC-local /usr/bin
|
||||
COPY --from=builder /builder/build/bin/XDC-devnet /usr/bin
|
||||
COPY --from=builder /builder/build/bin/XDC-testnet /usr/bin
|
||||
COPY --from=builder /builder/build/bin/XDC-mainnet /usr/bin
|
||||
COPY --from=builder /builder/build/bin/XDC /usr/bin/XDC
|
||||
|
||||
# # Copy over files
|
||||
ADD cicd/local /work/local
|
||||
|
|
|
|||
|
|
@ -1,13 +1,20 @@
|
|||
#!/bin/bash
|
||||
if test -z "$NETWORK"
|
||||
then
|
||||
echo "NETWORK env Must be set, mainnet/testnet/devnet/local"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$NETWORK" in
|
||||
"")
|
||||
echo "NETWORK environment variable must be set. Allowed values: mainnet/testnet/devnet/local"
|
||||
exit 1
|
||||
;;
|
||||
mainnet|testnet|devnet|local)
|
||||
;;
|
||||
*)
|
||||
echo "Invalid NETWORK: $NETWORK. Allowed: mainnet/testnet/devnet/local"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Select to run $NETWORK..."
|
||||
ln -s /usr/bin/XDC-$NETWORK /usr/bin/XDC
|
||||
cp -n /work/$NETWORK/* /work
|
||||
cp -n /work/"$NETWORK"/* /work
|
||||
|
||||
echo "Start Node..."
|
||||
/work/start.sh
|
||||
/work/start.sh
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
// Notice: this file only saves const variables for all network.
|
||||
// Please run the following commands after modify this file:
|
||||
// cp common/constants.go common/constants/constants.go.testnet
|
||||
// cp common/constants.go common/constants/constants.go.devnet
|
||||
// cp common/constants.go common/constants/constants.go.local
|
||||
|
||||
package common
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
// Notice: this file only saves const variables for all network.
|
||||
// Please run the following commands after modify this file:
|
||||
// cp common/constants.go common/constants/constants.go.testnet
|
||||
// cp common/constants.go common/constants/constants.go.devnet
|
||||
// cp common/constants.go common/constants/constants.go.local
|
||||
|
||||
package common
|
||||
|
||||
// const variables for all network.
|
||||
const (
|
||||
RewardMasterPercent = 90
|
||||
RewardVoterPercent = 0
|
||||
RewardFoundationPercent = 10
|
||||
EpocBlockSecret = 800
|
||||
EpocBlockOpening = 850
|
||||
EpocBlockRandomize = 900
|
||||
MaxMasternodes = 18
|
||||
LimitPenaltyEpoch = 4
|
||||
LimitPenaltyEpochV2 = 0
|
||||
LimitThresholdNonceInQueue = 10
|
||||
DefaultMinGasPrice = 250000000
|
||||
MergeSignRange = 15
|
||||
RangeReturnSigner = 150
|
||||
MinimunMinerBlockPerEpoch = 1
|
||||
BlocksPerYearTest = uint64(200000)
|
||||
BlocksPerYear = uint64(15768000)
|
||||
OneYear = uint64(365 * 86400)
|
||||
LiquidateLendingTradeBlock = uint64(100)
|
||||
LimitTimeFinality = uint64(30) // limit in 30 block
|
||||
|
||||
HexSignMethod = "e341eaa4"
|
||||
HexSetSecret = "34d38600"
|
||||
HexSetOpening = "e11f5ba2"
|
||||
)
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
// Notice: this file only saves const variables for all network.
|
||||
// Please run the following commands after modify this file:
|
||||
// cp common/constants.go common/constants/constants.go.testnet
|
||||
// cp common/constants.go common/constants/constants.go.devnet
|
||||
// cp common/constants.go common/constants/constants.go.local
|
||||
|
||||
package common
|
||||
|
||||
// const variables for all network.
|
||||
const (
|
||||
RewardMasterPercent = 90
|
||||
RewardVoterPercent = 0
|
||||
RewardFoundationPercent = 10
|
||||
EpocBlockSecret = 800
|
||||
EpocBlockOpening = 850
|
||||
EpocBlockRandomize = 900
|
||||
MaxMasternodes = 18
|
||||
LimitPenaltyEpoch = 4
|
||||
LimitPenaltyEpochV2 = 0
|
||||
LimitThresholdNonceInQueue = 10
|
||||
DefaultMinGasPrice = 250000000
|
||||
MergeSignRange = 15
|
||||
RangeReturnSigner = 150
|
||||
MinimunMinerBlockPerEpoch = 1
|
||||
BlocksPerYearTest = uint64(200000)
|
||||
BlocksPerYear = uint64(15768000)
|
||||
OneYear = uint64(365 * 86400)
|
||||
LiquidateLendingTradeBlock = uint64(100)
|
||||
LimitTimeFinality = uint64(30) // limit in 30 block
|
||||
|
||||
HexSignMethod = "e341eaa4"
|
||||
HexSetSecret = "34d38600"
|
||||
HexSetOpening = "e11f5ba2"
|
||||
)
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
// Notice: this file only saves const variables for all network.
|
||||
// Please run the following commands after modify this file:
|
||||
// cp common/constants.go common/constants/constants.go.testnet
|
||||
// cp common/constants.go common/constants/constants.go.devnet
|
||||
// cp common/constants.go common/constants/constants.go.local
|
||||
|
||||
package common
|
||||
|
||||
// const variables for all network.
|
||||
const (
|
||||
RewardMasterPercent = 90
|
||||
RewardVoterPercent = 0
|
||||
RewardFoundationPercent = 10
|
||||
EpocBlockSecret = 800
|
||||
EpocBlockOpening = 850
|
||||
EpocBlockRandomize = 900
|
||||
MaxMasternodes = 18
|
||||
LimitPenaltyEpoch = 4
|
||||
LimitPenaltyEpochV2 = 0
|
||||
LimitThresholdNonceInQueue = 10
|
||||
DefaultMinGasPrice = 250000000
|
||||
MergeSignRange = 15
|
||||
RangeReturnSigner = 150
|
||||
MinimunMinerBlockPerEpoch = 1
|
||||
BlocksPerYearTest = uint64(200000)
|
||||
BlocksPerYear = uint64(15768000)
|
||||
OneYear = uint64(365 * 86400)
|
||||
LiquidateLendingTradeBlock = uint64(100)
|
||||
LimitTimeFinality = uint64(30) // limit in 30 block
|
||||
|
||||
HexSignMethod = "e341eaa4"
|
||||
HexSetSecret = "34d38600"
|
||||
HexSetOpening = "e11f5ba2"
|
||||
)
|
||||
Loading…
Reference in a new issue