Skip to content

Commit

Permalink
merge: dev v0.10.9 into devnet (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
egonspace authored Sep 19, 2024
2 parents 58e75da + 255a595 commit 9a7d5ae
Show file tree
Hide file tree
Showing 113 changed files with 35,725 additions and 2,215 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:

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

Expand All @@ -18,19 +18,31 @@ jobs:
with:
go-version: '1.19'

- name: Setup packages
run: |
sudo apt-get update
sudo apt-get install -y libjemalloc-dev liblz4-dev libsnappy-dev libzstd-dev libudev-dev
sudo apt remove -y bzip2 libbz2-dev zlib1g-dev
- name: Build Go-WEMIX tarball
run: USE_ROCKSDB=YES make gwemix.tar.gz

- name: Stat Go-WEMIX tarball
- name: Set version
run: |
ls -l build/gwemix.tar.gz
tar tf build/gwemix.tar.gz
GWEMIX_VERSION_META="v$(build/bin/gwemix version | awk '/^Version/{ print $2 }')"
echo "GWEMIX_VERSION_META=$GWEMIX_VERSION_META" >> "$GITHUB_ENV"
echo "GWEMIX_VERSION=$(echo $GWEMIX_VERSION_META | cut -d'-' -f1)" >> "$GITHUB_ENV"
echo "GWEMIX_META=$(echo $GWEMIX_VERSION_META | cut -d'-' -f2-)" >> "$GITHUB_ENV"
echo "GWEMIX_COMMITHASH=$(echo ${{ github.sha }} | cut -c1-8)" >> "$GITHUB_ENV"
- name: Display ELF info
run: readelf -dV build/bin/gwemix

- name: Move results to artifact
run: mv build/gwemix.tar.gz gwemix-${{ github.ref_name }}-${{ github.sha }}-linux-amd64-rocksdb.tar.gz
run: mv build/gwemix.tar.gz gwemix-${{ env.GWEMIX_VERSION_META }}-${{ env.GWEMIX_COMMITHASH }}-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
name: artifact-${{ env.GWEMIX_VERSION_META }}-${{ env.GWEMIX_COMMITHASH }}
path: gwemix-${{ env.GWEMIX_VERSION_META }}-${{ env.GWEMIX_COMMITHASH }}-linux-amd64-rocksdb.tar.gz
7 changes: 5 additions & 2 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [1.17, 1.18, 1.19]
version: [1.18, 1.19]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
Expand All @@ -38,7 +38,7 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.version }}

- name: Check Lint
run: make lint

Expand All @@ -49,6 +49,9 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Wemix Submodules
run: git submodule update --init wemix/

- name: Set up Go
uses: actions/setup-go@v3
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/gwemix-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [1.17, 1.18, 1.19]
version: [1.18, 1.19]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
Expand All @@ -49,6 +49,9 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Wemix Submodules
run: git submodule update --init wemix/

- name: Set up Go
uses: actions/setup-go@v3
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/master-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [1.17, 1.18, 1.19]
version: [1.18, 1.19]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
Expand All @@ -49,6 +49,9 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Wemix Submodules
run: git submodule update --init wemix/

- name: Set up Go
uses: actions/setup-go@v3
with:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Release a tag as draft"

on:
push:
tags:
- w*

jobs:

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

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

- name: Setup packages
run: |
sudo apt-get update
sudo apt-get install -y libjemalloc-dev liblz4-dev libsnappy-dev libzstd-dev libudev-dev
sudo apt remove -y bzip2 libbz2-dev zlib1g-dev
- name: Build Go-WEMIX tarball (rocksdb)
run: USE_ROCKSDB=YES make gwemix.tar.gz

- name: Set version
run: |
GWEMIX_VERSION_META="v$(build/bin/gwemix version | awk '/^Version/{ print $2 }')"
echo "GWEMIX_VERSION_META=$GWEMIX_VERSION_META" >> "$GITHUB_ENV"
echo "GWEMIX_VERSION=$(echo $GWEMIX_VERSION_META | cut -d'-' -f1)" >> "$GITHUB_ENV"
echo "GWEMIX_META=$(echo $GWEMIX_VERSION_META | cut -d'-' -f2-)" >> "$GITHUB_ENV"
echo "GWEMIX_COMMITHASH=$(echo ${{ github.sha }} | cut -c1-8)" >> "$GITHUB_ENV"
- name: Display ELF info (rocksdb)
run: readelf -dV build/bin/gwemix

- name: Move results to artifact (rocksdb)
run: mv build/gwemix.tar.gz gwemix-${{ env.GWEMIX_VERSION_META }}-${{ env.GWEMIX_COMMITHASH }}-linux-amd64-rocksdb.tar.gz

- name: Build Go-WEMIX tarball (leveldb)
run: USE_ROCKSDB=NO make gwemix.tar.gz

- name: Display ELF info (leveldb)
run: readelf -dV build/bin/gwemix

- name: Move results to artifact (leveldb)
run: mv build/gwemix.tar.gz gwemix-${{ env.GWEMIX_VERSION_META }}-${{ env.GWEMIX_COMMITHASH }}-linux-amd64-leveldb.tar.gz

- name: GH Release
uses: softprops/action-gh-release@v2.0.5
with:
name: WEMIX3.0 Mainnet and Testnet Build (${{ env.GWEMIX_VERSION }})
draft: true
files: |
gwemix-${{ env.GWEMIX_VERSION_META }}-${{ env.GWEMIX_COMMITHASH }}-linux-amd64-rocksdb.tar.gz
gwemix-${{ env.GWEMIX_VERSION_META }}-${{ env.GWEMIX_COMMITHASH }}-linux-amd64-leveldb.tar.gz
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@
[submodule "etcd"]
path = etcd
url = https://github.com/metadium/etcd
[submodule "wemix/governance-contract/contracts/openzeppelin/contracts-upgradeable"]
path = wemix/governance-contract/contracts/openzeppelin/contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "wemix/governance-contract/contracts/openzeppelin/contracts"]
path = wemix/governance-contract/contracts/openzeppelin/contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
79 changes: 5 additions & 74 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ endif

gwemix.tar.gz: gwemix logrot
@[ -d build/conf ] || mkdir -p build/conf
@cp -p wemix/scripts/gwemix.sh wemix/scripts/solc.sh build/bin/
@cp -p wemix/scripts/gwemix.sh build/bin/
@cp -p wemix/scripts/config.json.example \
wemix/scripts/genesis-template.json \
wemix/contracts/WemixGovernance.js \
wemix/scripts/deploy-governance.js \
build/conf/
@(cd build; tar cfz gwemix.tar.gz bin conf)
@echo "Done building build/gwemix.tar.gz"

gwemix: rocksdb wemix/governance_abi.go
gwemix: rocksdb
ifeq ($(USE_ROCKSDB), NO)
$(GORUN) build/ci.go install $(ROCKSDB_TAG) ./cmd/gwemix
else
Expand Down Expand Up @@ -68,7 +66,7 @@ else
$(GORUN) build/ci.go install $(ROCKSDB_TAG) ./cmd/dbbench
endif

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

android:
Expand All @@ -89,12 +87,12 @@ test: all
test-short: all
$(GORUN) build/ci.go test -short

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

clean:
env GO111MODULE=on go clean -cache
rm -fr build/_workspace/pkg/ $(GOBIN)/* build/conf wemix/admin_abi.go wemix/governance_abi.go
rm -fr build/_workspace/pkg/ $(GOBIN)/* build/conf
@ROCKSDB_DIR=$(ROCKSDB_DIR); \
if [ -e $${ROCKSDB_DIR}/Makefile ]; then \
cd $${ROCKSDB_DIR}; \
Expand Down Expand Up @@ -132,70 +130,3 @@ rocksdb:
@[ ! -e rocksdb/.git ] && git submodule update --init rocksdb; \
cd $(ROCKSDB_DIR) && PORTABLE=1 make -j8 static_lib;
endif

AWK_CODE=' \
BEGIN { print "package wemix"; bin = 0; name = ""; abi = ""; } \
/^{/ { bin = 1; abi = ""; name = ""; } \
/^}/ { bin = 0; abi = abi "}"; print "var " name "Abi = `" abi "`"; } \
{ \
if (bin == 1) { \
abi = abi $$0; \
if ($$1 == "\"contractName\":") { \
name = $$2; \
gsub(",|\"", "", name); \
} \
} \
}'

wemix/admin_abi.go: wemix/contracts/WemixAdmin-template.sol build/bin/solc
@PATH=${PATH}:build/bin wemix/scripts/solc.sh -f abi $< /tmp/junk.$$$$; \
cat /tmp/junk.$$$$ | awk $(AWK_CODE) > $@; \
rm -f /tmp/junk.$$$$;

AWK_CODE_2=' \
BEGIN { print "package wemix\n"; } \
/^var Registry_contract/ { \
sub("^var[^(]*\\(","",$$0); sub("\\);$$","",$$0); \
n = "Registry"; \
print "var " n "Abi = `{ \"contractName\": \"" n "\", \"abi\": " $$0 "}`"; \
} \
/^var StakingImp_contract/ { \
sub("^var[^(]*\\(","",$$0); sub("\\);$$","",$$0); \
n = "Staking"; \
print "var " n "Abi = `{ \"contractName\": \"" n "\", \"abi\": " $$0 "}`"; \
} \
/^var EnvStorageImp_contract/ { \
sub("^var[^(]*\\(","",$$0); sub("\\);$$","",$$0); \
n = "EnvStorageImp"; \
print "var " n "Abi = `{ \"contractName\": \"" n "\", \"abi\": " $$0 "}`"; \
} \
/^var GovImp_contract/ { \
sub("^var[^(]*\\(","",$$0); sub("\\);$$","",$$0); \
n = "Gov"; \
print "var " n "Abi = `{ \"contractName\": \"" n "\", \"abi\": " $$0 "}`"; \
}'

wemix/governance_abi.go: wemix/contracts/WemixGovernance.js
@cat $< | awk $(AWK_CODE_2) > $@

ifneq ($(shell uname), Linux)

build/bin/solc:
@test 1

else

SOLC_URL=https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux
build/bin/solc:
@[ -d build/bin ] || mkdir -p build/bin; \
if [ ! -x build/bin/solc ]; then \
if which curl > /dev/null 2>&1; then \
curl -Ls -o build/bin/solc $(SOLC_URL); \
chmod +x build/bin/solc; \
elif which wget > /dev/null 2>&1; then \
wget -nv -o build/bin/solc $(SOLC_URL); \
chmod +x build/bin/solc; \
fi \
fi

endif
Loading

0 comments on commit 9a7d5ae

Please sign in to comment.