Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
temaniarpit27 committed Jan 24, 2022
2 parents 28963d5 + 2d84249 commit 560ad7d
Show file tree
Hide file tree
Showing 73 changed files with 2,629 additions and 1,300 deletions.
36 changes: 28 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ builds:
env:
- CC=o64-clang
- CXX=o64-clang++
tags:
- netgo
ldflags:
-s -w

- id: darwin-arm64
main: ./cmd/geth
binary: bor
Expand All @@ -29,9 +31,11 @@ builds:
env:
- CC=oa64-clang
- CXX=oa64-clang++
tags:
- netgo
ldflags:
-s -w

- id: linux-amd64
main: ./cmd/geth
binary: bor
Expand All @@ -42,9 +46,11 @@ builds:
env:
- CC=gcc
- CXX=g++
tags:
- netgo
ldflags:
# We need to build a static binary because we are building in a glibc based system and running in a musl container
-s -w -linkmode external -extldflags "-static"
# We need to build a static binary because we are building in a glibc based system and running in a musl container
-s -w -extldflags "-static"

- id: linux-arm64
main: ./cmd/geth
Expand All @@ -56,9 +62,11 @@ builds:
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
tags:
- netgo
ldflags:
# We need to build a static binary because we are building in a glibc based system and running in a musl container
-s -w -linkmode external -extldflags "-static"
# We need to build a static binary because we are building in a glibc based system and running in a musl container
-s -w -extldflags "-static"

nfpms:
- vendor: 0xPolygon
Expand All @@ -76,6 +84,12 @@ nfpms:
- src: builder/files/bor.service
dst: /lib/systemd/system/bor.service
type: config
- src: builder/files/genesis-mainnet-v1.json
dst: /etc/bor/genesis-mainnet-v1.json
type: config
- src: builder/files/genesis-testnet-v4.json
dst: /etc/bor/genesis-testnet-v4.json
type: config

overrides:
rpm:
Expand All @@ -95,7 +109,10 @@ dockers:
- linux-amd64
build_flag_templates:
- --platform=linux/amd64

extra_files:
- builder/files/genesis-mainnet-v1.json
- builder/files/genesis-testnet-v4.json

- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
dockerfile: Dockerfile.release
Expand All @@ -104,7 +121,10 @@ dockers:
ids:
- linux-arm64
build_flag_templates:
- --platform=linux/arm64
- --platform=linux/arm64/v8
extra_files:
- builder/files/genesis-mainnet-v1.json
- builder/files/genesis-testnet-v4.json

docker_manifests:
- name_template: 0xpolygon/{{ .ProjectName }}:{{ .Version }}
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM alpine:3.14

RUN apk add --no-cache ca-certificates
RUN apk add --no-cache ca-certificates && \
mkdir -p /etc/bor
COPY bor /usr/local/bin/
COPY builder/files/genesis-mainnet-v1.json /etc/bor/
COPY builder/files/genesis-testnet-v4.json /etc/bor/

EXPOSE 8545 8546 8547 30303 30303/udp
ENTRYPOINT ["bor"]
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ GO ?= latest
GORUN = env GO111MODULE=on go run
GOPATH = $(shell go env GOPATH)

protoc:
protoc --go_out=. --go-grpc_out=. ./command/server/proto/*.proto

bor:
$(GORUN) build/ci.go install ./cmd/geth
mkdir -p $(GOPATH)/bin/
Expand All @@ -28,6 +25,9 @@ bor-all:
cp $(GOBIN)/geth $(GOBIN)/bor
cp $(GOBIN)/* $(GOPATH)/bin/

protoc:
protoc --go_out=. --go-grpc_out=. ./command/server/proto/*.proto

geth:
$(GORUN) build/ci.go install ./cmd/geth
@echo "Done building."
Expand All @@ -48,10 +48,9 @@ ios:
@echo "Done building."
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."

test: all
# $(GORUN) build/ci.go test
go test github.com/ethereum/go-ethereum/consensus/bor -v
go test github.com/ethereum/go-ethereum/tests/bor -v
test:
# Skip mobile and cmd tests since they are being deprecated
go test -v $$(go list ./... | grep -v go-ethereum/cmd/)

lint: ## Run linters.
$(GORUN) build/ci.go lint
Expand Down
18 changes: 14 additions & 4 deletions builder/files/bor.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@
[Service]
Restart=on-failure
RestartSec=5s
WorkingDirectory=$NODE_DIR
EnvironmentFile=/etc/matic/metadata
ExecStart=/usr/local/bin/bor $VALIDATOR_ADDRESS
ExecStart=/usr/local/bin/bor \
--bor-mumbai \
# --bor-mainnet \
--datadir /var/lib/bor/data \
--bootnodes "enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303,enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303"
# Validator params
# Uncomment and configure the following lines in case you run a validator
# --keystore /var/lib/bor/keystore \
# --unlock [VALIDATOR ADDRESS] \
# --password /var/lib/bor/password.txt \
# --allow-insecure-unlock \
# --nodiscover --maxpeers 1 \
# --mine
Type=simple
User=$USER
User=root
KillSignal=SIGINT
TimeoutStopSec=120

Expand Down
11 changes: 11 additions & 0 deletions builder/files/genesis-mainnet-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@
"londonBlock": 23850000,
"bor": {
"jaipurBlock": 23850000,
<<<<<<< HEAD
"period": 2,
"producerDelay": 6,
"sprint": 64,
"backupMultiplier": 2,
=======
"period": {
"0": 2
},
"producerDelay": 6,
"sprint": 64,
"backupMultiplier": {
"0": 2
},
>>>>>>> 2d84249492818622540ddf5136234fa734e5950a
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
"overrideStateSyncRecords": {
Expand Down
80 changes: 80 additions & 0 deletions builder/files/genesys-testnet-v4.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
"os"

"github.com/ethereum/go-ethereum/internal/cli"
)

func main() {
os.Exit(cli.Run(os.Args[1:]))
}
4 changes: 2 additions & 2 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func setDefaultMumbaiGethConfig(ctx *cli.Context, config *gethConfig) {
config.Node.HTTPPort = 8545
config.Node.IPCPath = utils.MakeDataDir(ctx) + "/bor.ipc"
config.Node.HTTPModules = []string{"eth", "net", "web3", "txpool", "bor"}
config.Eth.SyncMode = downloader.SnapSync
config.Eth.SyncMode = downloader.FullSync
config.Eth.NetworkId = 80001
config.Eth.Miner.GasCeil = 20000000
//--miner.gastarget is depreceated, No longed used
Expand All @@ -370,7 +370,7 @@ func setDefaultBorMainnetGethConfig(ctx *cli.Context, config *gethConfig) {
config.Node.HTTPPort = 8545
config.Node.IPCPath = utils.MakeDataDir(ctx) + "/bor.ipc"
config.Node.HTTPModules = []string{"eth", "net", "web3", "txpool", "bor"}
config.Eth.SyncMode = downloader.SnapSync
config.Eth.SyncMode = downloader.FullSync
config.Eth.NetworkId = 137
config.Eth.Miner.GasCeil = 20000000
//--miner.gastarget is depreceated, No longed used
Expand Down
2 changes: 0 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1645,13 +1645,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
cfg.NetworkId = 80001
}
cfg.Genesis = core.DefaultMumbaiGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.MumbaiGenesisHash)
case ctx.GlobalBool(BorMainnetFlag.Name):
if !ctx.GlobalIsSet(BorMainnetFlag.Name) {
cfg.NetworkId = 137
}
cfg.Genesis = core.DefaultBorMainnetGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.BorMainnetGenesisHash)
case ctx.GlobalBool(DeveloperFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1337
Expand Down
Loading

0 comments on commit 560ad7d

Please sign in to comment.