Skip to content

Commit

Permalink
Merge pull request #662 from UnUniFi/newDevelop
Browse files Browse the repository at this point in the history
New develop
  • Loading branch information
kimurayu45z authored Aug 15, 2023
2 parents 1438f21 + a879ef8 commit 09b365f
Show file tree
Hide file tree
Showing 1,104 changed files with 179,897 additions and 66,377 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode/
go.work
go.work.sum
*.md
Dockerfile
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: bug
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
labels: enhancement
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/cr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
permissions:
contents: read
pull-requests: write

on:
workflow_dispatch:

jobs:
code-review:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Optional
LANGUAGE: English
MODEL: gpt-3.5-turbo
top_p: 1
temperature: 1
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
run: go test -v `go list ./... | grep -v -E 'x/nftbackedloan/|x/derivatives/|x/pricefeed/|x/ecosystemincentive/'`
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ build

node_modules
docs/node_modules
docs/.vuepress/dist
docs/.vuepress/dist
data
docker-build/*
cmd/ununifid/__debug_bin
5 changes: 4 additions & 1 deletion .vscode/extensions.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"docsmsft.docs-markdown",
"docsmsft.docs-yaml",
"ms-vsliveshare.vsliveshare",
"golang.go"
"golang.go",
"zxh404.vscode-proto3",
"eamodio.gitlens",
"streetsidesoftware.code-spell-checker"
]
}
33 changes: 33 additions & 0 deletions .vscode/go.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
// Place your uni_tmp_work workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"print clipborad for debugging": {
"scope": "go",
"prefix": [
"fmtl",
"log"
],
"body": [
"fmt.Println(\"$CLIPBOARD\");",
"fmt.Println($CLIPBOARD);",
],
"description": "print clipboard"
},
"print current number": {
"scope": "go",
"prefix": [
"ll",
"logLine",
"trace"
],
"body": [
"fmt.Println(\"$TM_FILENAME:$TM_LINE_NUMBER\");",
],
"description": "print line number"
}
}
76 changes: 76 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "build then Launch and auto throw Tx",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "./cmd/ununifid/main.go",
"args": [
"start",
"--home",
"./data/test"
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "prepare tx",
},
{
"name": "just Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "./cmd/ununifid/main.go",
"args": [
"start",
"--home",
"./data/test"
],
"cwd": "${workspaceFolder}",
},
{
"name": "build then Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "./cmd/ununifid/main.go",
"args": [
"start",
"--home",
"./data/test"
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "init config",
},
{
"name": "debug alpha node",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "./cmd/ununifid/main.go",
"args": [
"start",
"--home",
"./data/test"
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "copy_alpha_node_data",
},
{
"name": "debug debudata",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "./cmd/ununifid/main.go",
"args": [
"start",
"--home",
"./debug_data"
],
"cwd": "${workspaceFolder}",
},
]
}
30 changes: 28 additions & 2 deletions .vscode/settings.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
{
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.formatOnSave": true
}
"editor.formatOnSave": true,
"cSpell.enabled": true,
"go.lintTool": "golangci-lint",
"go.formatTool": "goimports",
"go.useLanguageServer": true,
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"[go]": {
"editor.snippetSuggestions": "top",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.suggest.snippetsPreventQuickSuggestions": true
},
"gopls": {
"local": "github.com/UnUniFi/chain"
},
"files.eol": "\n",
"[proto3]": {
"editor.defaultFormatter": "zxh404.vscode-proto3"
},
"clang-format.style": "{BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 120, AlignConsecutiveAssignments: true, AlignConsecutiveDeclarations: true, SpacesInSquareBrackets: true}"
}
55 changes: 55 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"cwd": "${workspaceFolder}",
"command": "make build -B",
"problemMatcher": [
"$go"
]
},
{
"label": "init config",
"type": "shell",
"cwd": "${workspaceFolder}",
"command": "scripts/setup/init.sh",
"problemMatcher": [
"$go"
],
"dependsOn": [
"build",
]
},
{
"label": "prepare tx",
"type": "shell",
"cwd": "${workspaceFolder}",
"command": "nohup scripts/commands/prepare.sh sleep ... & sleep 0.1",
"dependsOn": [
"init config",
],
},
{
"label": "prepare tx direct",
"type": "shell",
"cwd": "${workspaceFolder}",
"command": "scripts/commands/prepare.sh sleep",
},
{
"label": "run pricefeed",
"type": "shell",
"cwd": "${workspaceFolder}",
"command": "scripts/commands/derivatives/setup_pricefeed.sh",
},
{
"label": "copy_alpha_node_data",
"type": "shell",
"cwd": "${workspaceFolder}",
"command": "scripts/utils/get-backup-data.sh",
},
]
}
30 changes: 15 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# > docker build -t ununifid .
# > docker run -it -p 26656:26656 -p 26657:26657 -v ~/.ununifi:/root/.ununifi ghcr.io/ununifi/ununifid ununifid init
# > docker run -it -p 26656:26656 -p 26657:26657 -v ~/.ununifi:/root/.ununifi ghcr.io/ununifi/ununifid ununifid start
FROM golang:1.17-alpine AS build-env
FROM golang:1.19-alpine AS build-env

# Set up dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
Expand All @@ -16,20 +16,24 @@ COPY . .
RUN go version

# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apk add --no-cache $PACKAGES
RUN apk add $PACKAGES

# install and setup glibc
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-bin-2.25-r0.apk
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-i18n-2.25-r0.apk
RUN apk add --no-cache glibc-2.25-r0.apk glibc-bin-2.25-r0.apk glibc-i18n-2.25-r0.apk
ENV LD_LIBRARY_PATH /usr/glibc-compat/lib
RUN /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
RUN make install
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.2.4/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.2.4/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 682a54082e131eaff9beec80ba3e5908113916fcb8ddf7c668cb2d97cb94c13c
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ce3d892377d2523cf563e01120cb1436f9343f80be952c93f66aa94f5737b661
ARG arch=x86_64
RUN cp /lib/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.a

# for cosmwasm build option
RUN BUILD_TAGS=muslc LINK_STATICALLY=true make install

RUN apk add --update util-linux
RUN whereis ununifid

# Final image
FROM alpine:edge
FROM alpine:3.15

# Install ca-certificates
RUN apk add --update ca-certificates
Expand All @@ -38,10 +42,6 @@ WORKDIR /root

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/ununifid /usr/bin/ununifid
COPY --from=build-env /go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/libwasmvm.so /usr/lib/libwasmvm.so
COPY --from=build-env /lib/ld-musl-x86_64.so.1 /usr/lib/ld-musl-x86_64.so.1
COPY --from=build-env /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1
COPY --from=build-env /usr/glibc-compat/lib/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2

# Run ununifid by default, omit entrypoint to ease using container with ununificli
CMD ["ununifid"]
Loading

0 comments on commit 09b365f

Please sign in to comment.