Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add local test scripts #113

Merged
merged 99 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
268a97f
migrate : governance-contract
felix-shin-wt May 16, 2024
406f0c4
panic: core.GenerateChain
felix-shin-wt May 22, 2024
f4a9c06
fix: test panic
egonspace May 22, 2024
34c9455
fix : FakeMode, escape futureBlock
felix-shin-wt May 24, 2024
ef1e67d
fix : panic bad block
felix-shin-wt May 28, 2024
c91f6ac
refact : mv wemix_backends -> wemix package
felix-shin-wt May 28, 2024
0591aea
refact : remove common/bn
felix-shin-wt May 28, 2024
5bd98c3
refact : GovContracts
felix-shin-wt May 29, 2024
d4b4368
fix : remove unused
felix-shin-wt May 29, 2024
14f0489
Merge branch 'dev' into feat/governance-simulationbackend
felix-shin-wt May 29, 2024
277407a
fix : rename confusing variable
felix-shin-wt May 29, 2024
8f55544
fix : unhandled error
felix-shin-wt May 29, 2024
2a13ec5
fix : code style
felix-shin-wt May 30, 2024
f7bb72a
refact: migrate openzeppelin contract:v4.6.0, contracts-upgrade:v4.7.0
felix-shin-wt May 30, 2024
4e39897
feat : update governancedeploy use wemix/bind
felix-shin-wt May 30, 2024
42e0ace
fix : remove unused
felix-shin-wt May 30, 2024
8d130ab
fix : default init envstorage values
felix-shin-wt May 31, 2024
6bd6aaf
fix : gwemix.sh
felix-shin-wt May 31, 2024
f482f1a
fix : compare fixed bytes
felix-shin-wt May 31, 2024
55e90e7
fix : compare fixed bytes
felix-shin-wt May 31, 2024
b89bc2e
fix : typo
felix-shin-wt May 31, 2024
c195e54
fix : Flag type
felix-shin-wt May 31, 2024
9c5dae9
feat : update genesisConfig
felix-shin-wt May 31, 2024
1c4100d
fix : remove unused code
felix-shin-wt May 31, 2024
befb235
fix : deploy log
felix-shin-wt May 31, 2024
b4572da
feat : wemix simulated OptionFn
felix-shin-wt May 31, 2024
df4684c
feat : install solc
felix-shin-wt Jun 3, 2024
3130e56
Merge branch 'feat/governance-simulationbackend' into feat/deploy-gov…
felix-shin-wt Jun 3, 2024
47c57b6
fix : typo
felix-shin-wt Jun 3, 2024
95eb72f
fix : typo
felix-shin-wt Jun 3, 2024
bb298bb
Merge branch 'feat/governance-simulationbackend' into feat/deploy-gov…
felix-shin-wt Jun 3, 2024
9137384
fix : error verifyBlockSig
felix-shin-wt Jun 3, 2024
c2d8e44
fix : remove unused file
felix-shin-wt Jun 3, 2024
dcdf721
fix : gwemix.sh
felix-shin-wt Jun 3, 2024
708228b
fix: go.mod
felix-shin-wt Jun 3, 2024
dc29a65
update governance deploy (#96)
felix-shin-wt Jun 4, 2024
87d3221
refact : using bind structs
felix-shin-wt Jun 4, 2024
a4c1c89
docs : gwemix.sh comment
felix-shin-wt Jun 5, 2024
e6d0ce6
refact : submodule openzeppelin
felix-shin-wt Jun 5, 2024
12c8e74
feat : using NCPExit
felix-shin-wt Jun 5, 2024
752b49f
Refact governance simulationbackend (#107)
felix-shin-wt Jun 7, 2024
5c3b855
wip : dev-ci
felix-shin-wt Jun 7, 2024
eaee291
fix : unuse generic
felix-shin-wt Jun 7, 2024
f7ee599
fix : TestWemixBackends$
felix-shin-wt Jun 7, 2024
0da8bb6
feat : using generic, remove lint_test go@1.17
felix-shin-wt Jun 17, 2024
1e8f79c
fix: go:generate
felix-shin-wt Jun 17, 2024
5d04149
fix : clean code
felix-shin-wt Jun 17, 2024
9be03e1
fix : remove comment
felix-shin-wt Jun 17, 2024
e901f4d
fix : clean code
felix-shin-wt Jun 18, 2024
62f6725
feat : (governance abigen) compare data before writing to the file
felix-shin-wt Jun 18, 2024
c4052f4
refact : using compiledTy
felix-shin-wt Jun 18, 2024
1cafddd
feat : include sigs wemix/bind contracts
felix-shin-wt Jun 18, 2024
9e06591
refacet : move compiled, remove simulated-backend
felix-shin-wt Jun 20, 2024
27c85f5
fix : clean code
felix-shin-wt Jun 20, 2024
2d2c950
fix : clean code
felix-shin-wt Jun 23, 2024
ed75adf
fix : detailed tick processing
felix-shin-wt Jun 24, 2024
9851def
Feat: add local test scripts
paul-ahn-wm Jun 25, 2024
6de0f67
Fix: minor fix
paul-ahn-wm Jun 25, 2024
01b10ae
feat : [init-gov] add option password
felix-shin-wt Jun 25, 2024
0b564d1
fix : gwemix.sh init-gov params
felix-shin-wt Jun 25, 2024
f0725bd
Chore: typo fix
paul-ahn-wm Jun 25, 2024
b3df4c2
fix : [init-gov] add option password
felix-shin-wt Jun 25, 2024
8de3d71
Fix: fix set-nodekey.sh
paul-ahn-wm Jun 25, 2024
0633c6d
Chore: push for test
paul-ahn-wm Jun 25, 2024
97a0a72
refact : use const
felix-shin-wt Jun 25, 2024
0260d7a
Feat: add init-boot.sh
paul-ahn-wm Jun 26, 2024
523ae5c
Merge branch 'feat/governance-simulationbackend' into feat/local-test
paul-ahn-wm Jun 26, 2024
ab12a9b
Fix: minor fix
paul-ahn-wm Jun 26, 2024
b6387f8
chore: minor typo
paul-ahn-wm Jun 26, 2024
32f10ab
chore: add waiting message for port to open in init-boot.sh
paul-ahn-wm Jun 26, 2024
5bf6b0d
Chore: minor test
paul-ahn-wm Jun 26, 2024
182458f
chore: improve waiting message for port to open in init-boot.sh
paul-ahn-wm Jun 26, 2024
b5eeff8
feat: add executable permission to gwemix.sh in init-boot.sh
paul-ahn-wm Jun 26, 2024
16bab74
chore: improve gwemix start confirmation in init-boot.sh
paul-ahn-wm Jun 26, 2024
7012e61
chore: update log file path and success message in init-boot.sh
paul-ahn-wm Jun 26, 2024
3a6f6a8
chore: Update init-boot.sh to improve gwemix start confirmation
paul-ahn-wm Jun 26, 2024
33b96d6
chore: Add pcscd service to Dockerfile.local.boot and start it in ini…
paul-ahn-wm Jun 26, 2024
6ff27fc
chore: Update init-boot.sh to start gwemix service and improve start …
paul-ahn-wm Jun 27, 2024
5eaf4f8
chore: Update Dockerfile and gen-docker-compose.sh for wemix node con…
paul-ahn-wm Jun 27, 2024
3b495b9
chore: Refactor key generation and configuration scripts
paul-ahn-wm Jun 27, 2024
d6bf899
chore: Clean up unnecessary files and improve entrypoint in Dockerfil…
paul-ahn-wm Jun 27, 2024
618575e
chore: Update init-boot.sh to start gwemix service and improve start …
paul-ahn-wm Jun 27, 2024
3140aea
chore: Update init-boot.sh to improve gwemix start confirmation
paul-ahn-wm Jun 28, 2024
a339f1d
chore: Update Makefile and Dockerfile.local.boot to include init-node…
paul-ahn-wm Jun 28, 2024
b469a07
chore: Update init-node.sh to check if the boot node has started befo…
paul-ahn-wm Jun 28, 2024
d2f1e8f
chore: Update init-node.sh to include datadir for wemix
paul-ahn-wm Jun 28, 2024
70678c0
chore: Improve gwemix start confirmation and add etcd initialization
paul-ahn-wm Jun 28, 2024
07bdd13
chore: Update init-boot.sh to use console command for etcd initializa…
paul-ahn-wm Jun 28, 2024
f6f63ec
chore: Add curl and netcat-traditional to Dockerfile
paul-ahn-wm Jun 28, 2024
1463194
chore: Refactor local-docker-env scripts for key generation and confi…
paul-ahn-wm Jun 30, 2024
6ab012a
chore: Update Makefile-local-env to include wemix configuration files…
paul-ahn-wm Jun 30, 2024
13b1ebf
Feat: Refactor local-docker-env scripts for key generation and config…
paul-ahn-wm Jun 30, 2024
248188b
Chore: revert makefile
paul-ahn-wm Jun 30, 2024
fdec057
chore: Update local-docker-env scripts for key generation and configu…
paul-ahn-wm Jun 30, 2024
eab9adb
chore: Update Dockerfile to include missing command for updating CA c…
paul-ahn-wm Jun 30, 2024
72fbcf2
Merge branch 'dev' into feat/local-test
paul-ahn-wm Jul 3, 2024
26dae7d
chore: change local test readme to english
paul-ahn-wm Jul 3, 2024
bf489bf
chore: Refactor local-docker-env scripts for key generation and confi…
paul-ahn-wm Jul 4, 2024
35ad901
chore: Update Dockerfile to use specified Ubuntu version in the Docke…
paul-ahn-wm Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions Makefile-local-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# This Makefile is meant to be used by people that do not usually work
# with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make.

.PHONY: geth android ios evm all test clean rocksdb
.PHONY: gwemix-linux

GOBIN = ./build/bin
GO ?= latest
GORUN = env GO111MODULE=on go run

# USE_ROCKSDB
# - undefined | "NO": Do not use
# - "YES": build a static lib from rocksdb directory, and use that one
# - "EXISTING": use existing rocksdb shared lib.
ifndef USE_ROCKSDB
ifeq ($(shell uname), Linux)
USE_ROCKSDB = YES
else
USE_ROCKSDB = NO
endif
endif
ifneq ($(shell uname), Linux)
USE_ROCKSDB = NO
endif

ifneq ($(USE_ROCKSDB), NO)
ROCKSDB_DIR=$(shell pwd)/rocksdb
ROCKSDB_TAG=-tags rocksdb
endif

gwemix.tar.gz: gwemix logrot
@[ -d build/conf ] || mkdir -p build/conf
@cp -p local-docker-env/gwemix.sh local-docker-env/set-nodekey.sh local-docker-env/init-boot.sh local-docker-env/init-node.sh build/bin/
@cp -p wemix/scripts/config.json.example \
wemix/scripts/genesis-template.json \
build/conf/
@(cd build; tar cfz gwemix.tar.gz bin conf)
@echo "Done building build/gwemix.tar.gz"

gwemix: rocksdb
ifeq ($(USE_ROCKSDB), NO)
$(GORUN) build/ci.go install $(ROCKSDB_TAG) ./cmd/gwemix
else
CGO_CFLAGS=-I$(ROCKSDB_DIR)/include \
CGO_LDFLAGS="-L$(ROCKSDB_DIR) -lrocksdb -lm -lstdc++ $(shell awk '/PLATFORM_LDFLAGS/ {sub("PLATFORM_LDFLAGS=", ""); print} /JEMALLOC=1/ {print "-ljemalloc"}' < $(ROCKSDB_DIR)/make_config.mk)" \
$(GORUN) build/ci.go install $(ROCKSDB_TAG) ./cmd/gwemix
endif
@echo "Done building."
@echo "Run \"$(GOBIN)/gwemix\" to launch gwemix."

logrot:
$(GORUN) build/ci.go install ./cmd/logrot

geth:
$(GORUN) build/ci.go install ./cmd/geth
@echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth."

dbbench: rocksdb
ifeq ($(USE_ROCKSDB), NO)
$(GORUN) build/ci.go install $(ROCKSDB_TAG) ./cmd/dbbench
else
CGO_CFLAGS=-I$(ROCKSDB_DIR)/include \
CGO_LDFLAGS="-L$(ROCKSDB_DIR) -lrocksdb -lm -lstdc++ $(shell awk '/PLATFORM_LDFLAGS/ {sub("PLATFORM_LDFLAGS=", ""); print} /JEMALLOC=1/ {print "-ljemalloc"}' < $(ROCKSDB_DIR)/make_config.mk)" \
$(GORUN) build/ci.go install $(ROCKSDB_TAG) ./cmd/dbbench
endif

all:
$(GORUN) build/ci.go install

android:
$(GORUN) build/ci.go aar --local
@echo "Done building."
@echo "Import \"$(GOBIN)/geth.aar\" to use the library."
@echo "Import \"$(GOBIN)/geth-sources.jar\" to add javadocs"
@echo "For more info see https://stackoverflow.com/questions/20994336/android-studio-how-to-attach-javadoc"

ios:
$(GORUN) build/ci.go xcode --local
@echo "Done building."
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."

test: all
$(GORUN) build/ci.go test

test-short: all
$(GORUN) build/ci.go test -short

lint: ## Run linters.
$(GORUN) build/ci.go lint

clean:
env GO111MODULE=on go clean -cache
rm -fr build/_workspace/pkg/ $(GOBIN)/* build/conf
@ROCKSDB_DIR=$(ROCKSDB_DIR); \
if [ -e $${ROCKSDB_DIR}/Makefile ]; then \
cd $${ROCKSDB_DIR}; \
make clean; \
fi

# The devtools target installs tools required for 'go generate'.
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.

devtools:
env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
env GOBIN= go install github.com/fjl/gencodec@latest
env GOBIN= go install github.com/golang/protobuf/protoc-gen-go@latest
env GOBIN= go install ./cmd/abigen
@type "solc" 2> /dev/null || echo 'Please install solc'
@type "protoc" 2> /dev/null || echo 'Please install protoc'

gwemix-linux:
@docker --version > /dev/null 2>&1; \
if [ ! $$? = 0 ]; then \
echo "Docker not found."; \
else \
docker build -t wemix/builder:local \
-f Dockerfile.wemix . && \
docker run -e HOME=/tmp --rm -v $(shell pwd):/data \
-w /data wemix/builder:local \
"git config --global --add safe.directory /data;\
make USE_ROCKSDB=$(USE_ROCKSDB)"; \
fi

ifneq ($(USE_ROCKSDB), YES)
rocksdb:
else
rocksdb:
@[ ! -e rocksdb/.git ] && git submodule update --init rocksdb; \
cd $(ROCKSDB_DIR) && PORTABLE=1 make -j8 static_lib;
endif
3 changes: 2 additions & 1 deletion containers/docker/wemix/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ ARG cert_location=/usr/local/share/ca-certificates
# 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 | \
update-ca-certificates
RUN 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

Expand Down
101 changes: 101 additions & 0 deletions local-docker-env/Dockerfile.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Stage 1: Build stage
FROM golang:1.19 as builder

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

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

# Install required packages
RUN apt-get install -y --no-install-recommends \
ca-certificates \
make && \
rm -rf /var/lib/apt/lists/*

# Define the location for custom certificates
ARG cert_location=/usr/local/share/ca-certificates

# Fetch and install certificates for proxy.golang.org
RUN 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

# Set work directory
WORKDIR /gwemix

# Copy the source code
COPY . /gwemix

# Build wemix
RUN USE_ROCKSDB=NO make -f Makefile-local-env

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

# Stage 2: Runtime stage
FROM ubuntu:latest

# 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 \
bash \
jq \
wget \
netcat-traditional && \
rm -rf /var/lib/apt/lists/*

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

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

# Set work directory
WORKDIR /usr/local/wemix

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

# Copy config.json & key file
COPY local-docker-env/config.json ./conf/config.json
COPY local-docker-env/keystore/ ./keystore/
COPY local-docker-env/nodekey/ ./nodekey/

# Define variables to be used at build time
ARG NODE_NUM
ENV NODE_NUM=${NODE_NUM}

# Run set-nodekey.sh
RUN chmod a+x bin/set-nodekey.sh && \
./bin/set-nodekey.sh -a ${NODE_NUM}

# Clean up unnecessary files
RUN rm -rf nodekey

# Run init-boot.sh
RUN chmod a+x bin/init-boot.sh
CMD ./bin/init-boot.sh && tail -f /dev/null

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

# Expose necessary ports
EXPOSE 8588 8589 8598

# # Define the entrypoint
# ENTRYPOINT ["bash"]
123 changes: 123 additions & 0 deletions local-docker-env/Dockerfile.boot.git
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Stage 1: Build stage
FROM golang:1.19 as builder

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

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

# Install required packages
RUN apt-get install -y --no-install-recommends \
git \
openssl \
ca-certificates \
make && \
rm -rf /var/lib/apt/lists/*

# Define the location for custom certificates
ARG cert_location=/usr/local/share/ca-certificates

# 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 && \
update-ca-certificates
RUN 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

# Define variables to be used at build time
ARG REPO
ARG BRANCH
ENV REPO=${REPO}
ENV BRANCH=${BRANCH}

# Clone the repository, install dependencies, and build the project
RUN git clone -b ${BRANCH} ${REPO} /go-wemix && \
cd /go-wemix && \
go mod download && \
USE_ROCKSDB=NO make -f Makefile-local-env

# 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:latest

# 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 \
jq \
wget \
pcscd \
curl \
netcat-traditional && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*

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

# 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

# Set work directory
WORKDIR /usr/local/wemix

# Copy config.json & key file
COPY local-docker-env/config.json ./conf/config.json
COPY local-docker-env/keystore/ ./keystore/
COPY local-docker-env/nodekey/ ./nodekey/

# Define variables to be used at build time
ARG NODE_NUM
ENV NODE_NUM=${NODE_NUM}

# Run set-nodekey.sh
RUN chmod a+x bin/set-nodekey.sh && \
./bin/set-nodekey.sh -a ${NODE_NUM}

# Clean up unnecessary files
RUN rm -rf nodekey

# Run init-boot.sh
RUN chmod a+x bin/init-boot.sh
CMD ./bin/init-boot.sh && tail -f /dev/null

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

# Expose necessary ports
EXPOSE 8588 8589 8598

# # Define the entrypoint
# ENTRYPOINT ["bash"]
Loading
Loading