Skip to content

Commit

Permalink
merge: dev into devnet (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
egonspace authored Jun 10, 2024
2 parents f3e362a + 61ec9ac commit 40910c4
Show file tree
Hide file tree
Showing 59 changed files with 2,286 additions and 287 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: artifacts

on:
push:
branches:
- devnet
- master

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: Build Go-WEMIX tarball
run: USE_ROCKSDB=YES make gwemix.tar.gz

- name: Stat Go-WEMIX tarball
run: |
ls -l build/gwemix.tar.gz
tar tf build/gwemix.tar.gz
- name: Move results to artifact
run: mv build/gwemix.tar.gz gwemix-${{ github.ref_name }}-${{ github.sha }}-linux-amd64-rocksdb.tar.gz

- name: Upload Go-WEMIX
uses: actions/upload-artifact@v4
with:
name: artifact-${{ github.ref_name }}-${{ github.sha }}
path: gwemix-${{ github.ref_name }}-${{ github.sha }}-linux-amd64-rocksdb.tar.gz
104 changes: 87 additions & 17 deletions Dockerfile.wemix
Original file line number Diff line number Diff line change
@@ -1,24 +1,94 @@
# builder image
# Stage 1: Build stage
FROM golang:1.19 as builder

FROM ubuntu:focal as base
# Set environment variables
ENV PATH=/usr/local/go/bin:$PATH

SHELL ["/bin/bash", "-c"]
# Update and upgrade the package list
RUN apt-get update && \
apt-get upgrade -q -y

RUN apt-get update -q -y && apt-get upgrade -q -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential ca-certificates curl libjemalloc-dev liblz4-dev libsnappy-dev libzstd-dev libudev-dev git
# Install required packages
RUN apt-get install -y --no-install-recommends \
git \
ca-certificates \
openssl \
make && \
rm -rf /var/lib/apt/lists/*

# golang
RUN curl -sL -o /tmp/go.tar.gz https://dl.google.com/go/$(curl -sL https://golang.org/VERSION?m=text | head -1).linux-amd64.tar.gz && \
pushd /usr/local/ && \
tar xfz /tmp/go.tar.gz && \
cd /usr/local/bin/ && \
ln -sf ../go/bin/* . && \
popd && \
rm /tmp/go.tar.gz
# Define the location for custom certificates
ARG cert_location=/usr/local/share/ca-certificates

RUN apt autoremove && apt autoclean
# Fetch and install certificates for github.com and proxy.golang.org
RUN openssl s_client -showcerts -connect github.com:443 </dev/null 2>/dev/null | \
openssl x509 -outform PEM > ${cert_location}/github.crt && \
openssl s_client -showcerts -connect proxy.golang.org:443 </dev/null 2>/dev/null | \
openssl x509 -outform PEM > ${cert_location}/proxy.golang.crt && \
update-ca-certificates

ENTRYPOINT ["/bin/bash", "-c"]
# Clone the repository, install dependencies, and build the project
RUN git clone https://github.com/wemixarchive/go-wemix.git /go-wemix && \
cd /go-wemix && \
go mod download && \
make

# EOF
# Clean up unnecessary packages and files after building
RUN apt-get remove -y \
git \
ca-certificates \
openssl \
make && \
apt autoremove -y && \
apt-get clean

# Stage 2: Runtime stage
FROM ubuntu:22.04

# Set environment variables
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

# Update and upgrade the package list
RUN apt-get update && \
apt-get upgrade -q -y

# Install required runtime packages
RUN apt-get install -y --no-install-recommends \
g++ \
libc-dev \
ca-certificates \
bash \
wget && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*

# Create directories for wemix
RUN mkdir -p /usr/local/wemix /usr/local/wemix/keystore

# Set environment variables
ENV PATH=/usr/local/wemix/bin:$PATH

# Copy the built binaries and configuration files from the builder stage
COPY --from=builder /go-wemix/build /usr/local/wemix/

# Download and install solc
RUN wget -nv -O /usr/local/bin/solc https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux && \
chmod a+x /usr/local/bin/solc

# Create new accounts for wemix
RUN bash -c 'for i in 1 2 3 4; do \
/usr/local/wemix/bin/gwemix wemix new-account --password <(echo demo) --out /usr/local/wemix/keystore/account-$i; \
done'

# Clean up unnecessary packages
RUN apt-get remove -y \
g++ \
libc-dev \
wget && \
apt autoremove -y && \
apt-get clean

# Expose necessary ports
EXPOSE 8588 8589 8598

# Set the entrypoint
ENTRYPOINT ["/usr/local/wemix/bin/gwemix"]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ After getting enodes of mining nodes, run gwemix as follows.

bin/gwemix --syncmode full --datadir <data-directory> --bootnodes <enodes> --http --http.addr 0.0.0.0

### Starting Nodes With Docker

See documentation [here](docs/container.md)

### The original go-ethereum README follows...

## Go Ethereum
Expand Down
50 changes: 49 additions & 1 deletion build/checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,52 @@ e9cb6f691e62a4d8b28dd52d2eab57cca72acfd5083b3c5417a72d2eb64def09 golangci-lint-
d058dfb0c7fbd73be70f285d3f8d4d424192fe9b19760ddbb0b2c4b743b8656c golangci-lint-1.49.0-windows-amd64.zip
c049d80297228db7065eabeac5114f77f04415dcd9b944e8d7c6426d9dd6e9dd golangci-lint-1.49.0-windows-arm64.zip
ec9164bab7134ddb94f51c17fd37c109b0801ecd5494b6c0e27ca7898fbd7469 golangci-lint-1.49.0-windows-armv6.zip
68fd9e880d98073f436c58b6f6d2c141881ef49b06ca31137bc19da4e4e3b996 golangci-lint-1.49.0-windows-armv7.zip
68fd9e880d98073f436c58b6f6d2c141881ef49b06ca31137bc19da4e4e3b996 golangci-lint-1.49.0-windows-armv7.zip

01301af199161c5ea33a0350581e1bed43289a56b2fbed7539f99fca2f898278 golangci-lint-1.54.2-freebsd-amd64.tar.gz
03f1962e95066105476b8eb88b5685a95aba8ee0b41f5e986f2a61a4e1834738 golangci-lint-1.54.2-linux-mips64le.tar.gz
0a57b225c621b465bd67b7cab87e9e13063704468eb382653b5c163ec23abaa4 golangci-lint-1.54.2-windows-armv6.zip
1762e02abd5d2d7997c04682d8efe9faaa23760fa73b8a50cffc57e68f1b1173 golangci-lint-1.54.2-linux-386.deb
17c9ca05253efe833d47f38caf670aad2202b5e6515879a99873fabd4c7452b3 golangci-lint-1.54.2-linux-amd64.tar.gz
18172629827a2d595fff6a9933d9d20dc8e8ec140ad00a38e4d5723dcb7ed305 golangci-lint-1.54.2-linux-armv6.deb
19b389bc965b1fc687087dc34f09e7188f582d106c88c6c506b384be1e6656f6 golangci-lint-1.54.2-linux-amd64.rpm
2268895575ac5921633c8dd94844dea5765f1011c7814bcb73429120849a8f67 golangci-lint-1.54.2-linux-mips64le.deb
2e1a11787b08137ba16c3be6ab87de3ef5de470758b7a42441497f259e8e5a1d golangci-lint-1.54.2-windows-386.zip
30e7440fa14e2a9f4a9b9b825c61c1d6858073c74ea0aba3b2d42f08a81f4c4b golangci-lint417421bc38ff51dc18a75aa132df94a67ea078b2af2d973cdf3b1badca4b58bc golangci-lint-1.54.2-linux-ppc64le.tar.gz
42eb5bf1c935eb98f6c9ee1ce282ca0abe48475ea6bc8f682967855bd0bc5bdc golangci-lint-1.54.2-linux-mips64.rpm
50aaf3eb9b51efd2cb8ebab91725fbb1fae55d3399b66b3733118facb5087828 golangci-lint-1.54.2-source.tar.gz
522d26f9f2fefa28cc229d4acdef47e436637b7c5eaec4426217afa9061825c0 golangci-lint-1.54.2-linux-ppc64le.deb
58e0cd3b77cf0d30f59be804796a7fcae96b9fbd80c0ca7c824ec4b09de804c0 golangci-lint-1.54.2-linux-386.rpm
6a324882e39b47939b8bec23f04449c730123c9d2ff771c3f40942ab37a26d8d golangci-lint-1.54.2-windows-arm64.zip
7038b5c5cd477efbb1c828fbdf075704033f96f33598d72765f23aa87c286583 golangci-lint-1.54.2-linux-arm64.rpm
78c9f1acc357b8f9ba2a57dac40d61a091299877b1eeef6d1599f8a8715c023e golangci-lint-1.54.2-linux-loong64.tar.gz
7b11ea9de9aad90e55c66434a8a4cd30da0792b45e12a4bb5fbfd684042176fe golangci-lint-1.54.2-freebsd-armv6.tar.gz
7b33fb1be2f26b7e3d1f3c10ce9b2b5ce6d13bb1d8468a4b2ba794f05b4445e1 golangci-lint-1.54.2-darwin-arm64.tar.gz
7ce3a9e62a8835907300830aa9ac3c2e8e424c2bf98a4dcfe7e5221bd0272a89 golangci-lint-1.54.2-linux-riscv64.rpm
7eda41281f5fd722f4b60c86259bd6ece5eeef08d94c73e55987b45763d5ac9f golangci-lint-1.54.2-freebsd-armv7.tar.gz
8125ce58581d795356a09c71f82ce4fb9368e06b7ce393676907661b62c1c55b golangci-lint-1.54.2-linux-riscv64.tar.gz
839b4b620f75d9d827ec4f7ed1cf592f730a3fc5c6e2bf01f64c03ddd8d4d76c golangci-lint-1.54.2-netbsd-386.tar.gz
85674f50113bb49ffae80733b4ad493c7b58a6031ee7ded3fda2a0ae1bf94c88 golangci-lint-1.54.2-linux-loong64.rpm
860e2ab2453e7fa81d28487b91b6e479d9414baa464abac8ce1bb8f203affeec golangci-lint-1.54.2-linux-s390x.deb
8b3e8c296a9714641961e87403e4865787f16bfdce6e1ea31d46978cfbdb64e7 golangci-lint-1.54.2-linux-arm64.deb
8e42c8204dc2441b5f6873032f1f674b6b6946042d759bc244194d14da8ee7c5 golangci-lint-1.54.2-linux-riscv64.deb
8e8754108de4d8accf6bf209780b8a31ffee0d04eff6393e5a3c84c84991cd39 golangci-lint-1.54.2-linux-s390x.tar.gz
8fc12d9ab18982968a568619290c02c6a9622e29eb475db8b6eac4c1ffc1121a golangci-lint-1.54.2-linux-mips64.deb
9124be2628a93e4d4a65bf48dd049f85c20d1236e66ac321169490745f5de20e golangci-lint-1.54.2-netbsd-armv6.tar.gz
925c4097eae9e035b0b052a66d0a149f861e2ab611a4e677c7ffd2d4e05b9b89 golangci-lint-1.54.2-darwin-amd64.tar.gz
9db1154c2bfdab52822afb7ea8d505ef9e3d519402258f93a9809f4b871b9446 golangci-lint-1.54.2-freebsd-386.tar.gz
9fadc9ed7fe9a2c3abcb9113a580004d3262dbdef0d44d4271d1b7ad89657e7b golangci-lint-1.54.2-linux-s390x.rpm
a0fb8740e9771ff0b96511b04017940ada4c3d1e07b2e3c246a5078514c1be9e golangci-lint-1.54.2-illumos-amd64.tar.gz
a47ed1a6473ff9ccd2cc29d85fc197b6718fad8afcec3ae804070002f5d5f8a8 golangci-lint-1.54.2-netbsd-amd64.tar.gz
a9f14b33473c65fcfbf411ec054b53a87dbb849f4e09ee438f1ee76dbf3f3d4e golangci-lint-1.54.2-linux-arm64.tar.gz
abf8e2164bca508ab68e520ca51e887ca26498ff4c57e904a27cce05b426c81d golangci-lint-1.54.2-lintae6c9e000cdac4f39b64d01b4e8091a1600d97ffccbd1883a342e4693aade68f golangci-lint-1.54.2-linux-mips64le.rpm
b6352e83cc781c5f7e7b74d1e0e6dc137a9a200c3e852bb14009c01b8b19a7b1 golangci-lint-1.54.2-linux-armv6.tar.gz
c3a693f657488a928fc0bdd76ea242b33e2b0e77748b1f31db8a85eb84cf7954 golangci-lint-1.54.2-linux-ppc64le.rpm
c5fd737f6e3c49e168ff764b48ad4c212131d933538aa5973a60d85b8d030926 golangci-lint-1.54.2-linux-armv7.tar.gz
ce17d122f3f93e0a9e52009d2c03cc1c1a1ae28338c2702a1f53eccd10a1afa3 golangci-lint-1.54.2-windows-amd64.zip
d00b58c3fea03e314b5f0f8680606781d3c3a3428e6a4c8645997d537acd1992 golangci-lint-1.54.2-linux-mips64.tar.gz
e3091e11f040a7177f6c227514b61301189fb1bf37f4fb9da2efa041456ab81d golangci-lint-1.54.2-linux-armv7.deb
e4cfe85c6e39b7dab9d8b7f668222d9066ee8f064cd3dbd4153d15b280d636f4 golangci-lint-1.54.2-netbsd-armv7.tar.gz
f0df36248c26e30f8dd516ffc0f2158d450df733f684ddd429e3aa2d5cc23bfb golangci-lint-1.54.2-linux-armv6.rpm
f2b801c93ccfbd3d17132360f632c0281f78e5780f02727115172a33afd0b08e golangci-lint-1.54.2-linux-loong64.deb
f67b8fa171605747da66f93892257337d7ae71be59ca7b07548555f025abe836 golangci-lint-1.54.2-linux-386.tar.gz
2 changes: 1 addition & 1 deletion build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func doLint(cmdline []string) {

// downloadLinter downloads and unpacks golangci-lint.
func downloadLinter(cachedir string) string {
const version = "1.49.0"
const version = "1.54.2"

csdb := build.MustLoadChecksums("build/checksums.txt")
arch := runtime.GOARCH
Expand Down
6 changes: 3 additions & 3 deletions cmd/geth/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"sort"
"strconv"
"strings"
"syscall"
"time"

"github.com/ethereum/go-ethereum/cmd/utils"
Expand All @@ -40,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie"
"github.com/olekukonko/tablewriter"
"golang.org/x/sys/unix"
"gopkg.in/urfave/cli.v1"
)

Expand Down Expand Up @@ -597,7 +597,7 @@ func importLDBdata(ctx *cli.Context) error {
stop = make(chan struct{})
)
defer stack.Close()
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(interrupt, unix.SIGINT, unix.SIGTERM)
defer signal.Stop(interrupt)
defer close(interrupt)
go func() {
Expand Down Expand Up @@ -693,7 +693,7 @@ func exportChaindata(ctx *cli.Context) error {
stop = make(chan struct{})
)
defer stack.Close()
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(interrupt, unix.SIGINT, unix.SIGTERM)
defer signal.Stop(interrupt)
defer close(interrupt)
go func() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"sort"
"strconv"
"strings"
"syscall"
"time"

"github.com/elastic/gosigar"
Expand All @@ -45,6 +44,7 @@ import (
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/wemix"
"golang.org/x/sys/unix"

// Force-load the tracer engines to trigger registration
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
Expand Down Expand Up @@ -514,8 +514,8 @@ func limitMaxRss(max int64) {
timer := time.NewTimer(interval)
for {
<-timer.C
rusage := syscall.Rusage{}
err := syscall.Getrusage(syscall.RUSAGE_SELF, &rusage)
rusage := unix.Rusage{}
err := unix.Getrusage(unix.RUSAGE_SELF, &rusage)
if err != nil {
log.Error("Getrusage() failed:", "reason", err)
} else {
Expand Down
10 changes: 5 additions & 5 deletions cmd/geth/wemixcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"path/filepath"
"strconv"
"strings"
"syscall"

"github.com/charlanxcc/logrot"
"github.com/ethereum/go-ethereum/accounts/keystore"
Expand All @@ -29,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/wemix/metclient"
"golang.org/x/sys/unix"
"gopkg.in/urfave/cli.v1"
)

Expand Down Expand Up @@ -667,10 +667,10 @@ func logrota(ctx *cli.Context) error {
if err != nil {
return err
}
syscall.Close(syscall.Stdout)
syscall.Close(syscall.Stdout)
syscall.Dup2(int(w.Fd()), syscall.Stdout)
syscall.Dup2(int(w.Fd()), syscall.Stderr)
unix.Close(unix.Stdout)
unix.Close(unix.Stdout)
unix.Dup2(int(w.Fd()), unix.Stdout)
unix.Dup2(int(w.Fd()), unix.Stderr)

go logrot.LogRotate(r, logFile, logSize, logCount)

Expand Down
10 changes: 5 additions & 5 deletions cmd/utils/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"os/signal"
"runtime"
"strings"
"syscall"
"time"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -41,6 +40,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rlp"
"golang.org/x/sys/unix"
"gopkg.in/urfave/cli.v1"
)

Expand Down Expand Up @@ -74,7 +74,7 @@ func StartNode(ctx *cli.Context, stack *node.Node, isConsole bool) {
}
go func() {
sigc := make(chan os.Signal, 1)
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(sigc, unix.SIGINT, unix.SIGTERM)
defer signal.Stop(sigc)

minFreeDiskSpace := 2 * ethconfig.Defaults.TrieDirtyCache // Default 2 * 256Mb
Expand Down Expand Up @@ -105,7 +105,7 @@ func StartNode(ctx *cli.Context, stack *node.Node, isConsole bool) {
// However, SIGTERM still shuts down the node.
for {
sig := <-sigc
if sig == syscall.SIGTERM {
if sig == unix.SIGTERM {
shutdown()
return
}
Expand All @@ -126,7 +126,7 @@ func monitorFreeDiskSpace(sigc chan os.Signal, path string, freeDiskSpaceCritica
}
if freeSpace < freeDiskSpaceCritical {
log.Error("Low disk space. Gracefully shutting down Geth to prevent database corruption.", "available", common.StorageSize(freeSpace))
sigc <- syscall.SIGTERM
sigc <- unix.SIGTERM
break
} else if freeSpace < 2*freeDiskSpaceCritical {
log.Warn("Disk space is running low. Geth will shutdown if disk space runs below critical level.", "available", common.StorageSize(freeSpace), "critical_level", common.StorageSize(freeDiskSpaceCritical))
Expand All @@ -140,7 +140,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
// If a signal is received, the import will stop at the next batch.
interrupt := make(chan os.Signal, 1)
stop := make(chan struct{})
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(interrupt, unix.SIGINT, unix.SIGTERM)
defer signal.Stop(interrupt)
defer close(interrupt)
go func() {
Expand Down
3 changes: 3 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,9 @@ func setRandomBootstrapNodes(ctx *cli.Context, bootnodes []string) []string {
}
// select random bootnodes
selectcount := params.BootnodeCount
if selectcount > bootnodeslen {
selectcount = bootnodeslen
}
urls := make([]string, selectcount)
tempnode := make([]string, bootnodeslen)
copy(tempnode, bootnodes)
Expand Down
Loading

0 comments on commit 40910c4

Please sign in to comment.