Skip to content

Commit

Permalink
merge upstream changes + version bumps
Browse files Browse the repository at this point in the history
merge upstream changes + version bumps
  • Loading branch information
pwnfoo authored Nov 29, 2023
2 parents 77753d2 + 4fb9631 commit a2e7014
Show file tree
Hide file tree
Showing 223 changed files with 4,805 additions and 2,227 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Create a report to help us improve
title: ''
labels: 'kind/bug'
assignees: 'RiccardoM'
assignees: 'MonikaCat'

---
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ updates:
interval: daily
open-pull-requests-limit: 10
reviewers:
- riccardom
- MonikaCat
labels:
- automerge
- dependencies
54 changes: 31 additions & 23 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@ name: docker-build
on:
push:
branches:
- cosmos/*/*
- chains/*/*

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set bdjuno chain_name
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Set BDJuno chain name 🔧
shell: bash
run: echo "CHAIN_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV
-
name: Set bdjuno version

- name: Set BDJuno version 🔧
shell: bash
run: echo "GITHUB_VERSION=$(git describe --tags)" >> $GITHUB_ENV
-
name: Prepare tags

- name: Prepare tags 🏷️
id: prep
run: |
DOCKER_IMAGE=${{ secrets.DOCKERHUB_BDJUNO_REPO }}
Expand All @@ -33,19 +31,29 @@ jobs:
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
- name: Determine Dockerfile to use 🔍
run: |
if [[ -f Dockerfile.cosmwasm ]]; then
export DOCKERFILE=Dockerfile.cosmwasm
else
export DOCKERFILE=Dockerfile.default
fi
echo "DOCKERFILE=${DOCKERFILE}" >> $GITHUB_ENV
- name: Set up Docker Buildx 🧰
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub 👤
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push 📤
uses: docker/build-push-action@v5
with:
context: .
file: "./${{ env.DOCKERFILE }}"
push: true
tags: ${{ steps.prep.outputs.tags }}
tags: ${{ steps.prep.outputs.tags }}
2 changes: 1 addition & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4.5.0
- uses: amannn/action-semantic-pull-request@v5.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 16 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,31 @@ on:
pull_request:
push:
branches:
- master
- chains/*
- cosmos/*

jobs:
GolangCI:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 6
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup Go 🧰
uses: actions/setup-go@v4
with:
go-version: "1.20"

- name: Compute diff 📜
uses: technote-space/[email protected]
with:
SUFFIX_FILTER: |
.go
.mod
.sum
- uses: golangci/[email protected]
with:
version: v1.28
args: --timeout 10m
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run lint ✅
if: "env.GIT_DIFF != ''"
run: make lint
40 changes: 29 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
pull_request:
push:
branches:
- master
- chains/*
- cosmos/*

jobs:
Cleanup-runs:
Expand All @@ -14,21 +15,38 @@ jobs:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
if: "!startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/cosmos')"

Unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup Go 🧰
uses: actions/setup-go@v4
with:
go-version: "1.20"

- name: Compute diff 📜
uses: technote-space/[email protected]
id: git_diff
with:
go-version: 1.17
- name: Test & Create coverage report
run: make install test-unit stop-docker-test
- name: Upload cove coverage
uses: codecov/codecov-action@v3
SUFFIX_FILTER: |
.go
.mod
.sum
- name: Build 🔨
if: "env.GIT_DIFF != ''"
run: make build

- name: Test & Coverage report creation 🧪
run: make test-unit stop-docker-test

- name: Upload coverage 📤
if: "env.GIT_DIFF != ''"
uses: codecov/codecov-action@v4-beta
with:
file: ./coverage.txt
5 changes: 4 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ linters:
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- gocritic
- gofmt
Expand Down Expand Up @@ -51,6 +50,10 @@ issues:
- text: "ST1016:"
linters:
- stylecheck
# Disable until Msg-based gov proposals are fully implemented
- text: "SA1019:"
linters:
- staticcheck
max-issues-per-linter: 10000
max-same-issues: 10000

Expand Down
4 changes: 2 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ queue_rules:
pull_request_rules:
- name: automerge with label automerge and branch protection passing
conditions:
- "#approved-reviews-by>1"
- "#approved-reviews-by>0"
- label=automerge
actions:
queue:
Expand All @@ -17,4 +17,4 @@ pull_request_rules:
commit_message_template: >
{{ title }} (#{{ number }})
{{ body }}
{{ body }}
41 changes: 40 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
## Unreleased
- ([\#610](https://github.com/forbole/bdjuno/pull/610)) Add support for gov `v1` proposals
- ([\#652](https://github.com/forbole/bdjuno/pull/652)) Update gov module parsing

## Version v4.0.0
## Notes
This version is thought to be used with Cosmos SDK `v0.47.x`.

### Changes

#### Parse Command
- ([\#492](https://github.com/forbole/bdjuno/pull/492)) Add parse command for periodic tasks: `x/bank` total supply, `x/distribution` community pool, `x/mint` inflation, `pricefeed` token price and price history, `x/staking` staking pool

#### Upgrade Module
- ([\#467](https://github.com/forbole/bdjuno/pull/467)) Store software upgrade plan and refresh data at upgrade height

#### Staking Module
- ([\#443](https://github.com/forbole/bdjuno/pull/443)) Remove tombstone status from staking module(already stored in slashing module)
- ([\#455](https://github.com/forbole/bdjuno/pull/455)) Added `unbonding_tokens` and `staked_not_bonded_tokens` values to staking pool table
- ([\#536](https://github.com/forbole/bdjuno/pull/536)) Fix `PoolSnapshot` tokens type from `sdk.Int` to `sdkmath.Int`

#### Gov Module
- ([\#461](https://github.com/forbole/bdjuno/pull/461)) Parse `x/gov` genesis with `genesisDoc.InitialHeight` instead of the hard-coded height 1
- ([\#465](https://github.com/forbole/bdjuno/pull/465)) Get open proposal ids in deposit or voting period by block time instead of current time
- ([\#489](https://github.com/forbole/bdjuno/pull/489)) Remove block height foreign key from proposal_vote and proposal_deposit tables and add column timestamp
- ([\#499](https://github.com/forbole/bdjuno/pull/499)) Check if proposal has passed voting end time before marking it invalid
- ([\#523](https://github.com/forbole/bdjuno/pull/523)) Update proposal snapshots handling on block

#### Daily refetch
- ([\#454](https://github.com/forbole/bdjuno/pull/454)) Added `daily refetch` module to refetch missing blocks every day

#### Hasura
- ([\#473](https://github.com/forbole/bdjuno/pull/473)) Improved Hasura permissions
- ([\#491](https://github.com/forbole/bdjuno/pull/491)) Add host address to Hasura actions

### Dependencies
- ([\#542](https://github.com/forbole/bdjuno/pull/542)) Updated Juno to `v5.1.0`


## Version v3.2.0
### Changes
#### Mint module
Expand Down Expand Up @@ -97,4 +136,4 @@ This version introduces breaking changes to certain address-specific data that i
- ([\#276](https://github.com/forbole/bdjuno/pull/276)) Added `fee_grant_allowance` table (v0.44.x)

#### Modules
- ([\#353](https://github.com/forbole/bdjuno/pull/353)) Removed the support for the `history` module
- ([\#353](https://github.com/forbole/bdjuno/pull/353)) Removed the support for the `history` module
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ RUN go mod download
RUN make build
RUN ldd build/bdjuno > /deps.txt
RUN echo $(ldd build/bdjuno | grep libwasmvm.so | awk '{ print $3 }')
RUN cat /deps.txt

FROM debian:bullseye
WORKDIR /root
RUN apt-get update && apt-get install ca-certificates -y
COPY --from=builder /deps.txt /root/deps.txt
COPY --from=builder /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.0.0-beta5/api/libwasmvm.so /root
COPY --from=builder /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.4.1/internal/api/libwasmvm.x86_64.so /root
COPY --from=builder /go/src/github.com/forbole/bdjuno/build/bdjuno /root/bdjuno
ENV LD_LIBRARY_PATH=/root
CMD [ "bdjuno" ]

22 changes: 22 additions & 0 deletions Dockerfile.cosmwasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@


FROM golang:1.20-alpine AS builder
RUN apk update && apk add --no-cache make git
WORKDIR /go/src/github.com/forbole/bdjuno
COPY . ./

RUN apk update && apk add --no-cache ca-certificates build-base git
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.4.1/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.4.1/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep a8259ba852f1b68f2a5f8eb666a9c7f1680196562022f71bb361be1472a83cfd
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 324c1073cb988478d644861783ed5a7de21cfd090976ccc6b1de0559098fbbad
## Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
RUN cp /lib/libwasmvm_muslc.$(uname -m).a /lib/libwasmvm_muslc.a
RUN go mod download
RUN LINK_STATICALLY=true BUILD_TAGS="muslc" make build

FROM alpine:latest
RUN apk update && apk add --no-cache ca-certificates build-base
WORKDIR /bdjuno
COPY --from=builder /go/src/github.com/forbole/bdjuno/build/bdjuno /usr/bin/bdjuno
CMD [ "bdjuno" ]
11 changes: 11 additions & 0 deletions Dockerfile.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.20-alpine AS builder
RUN apk update && apk add --no-cache make git
WORKDIR /go/src/github.com/forbole/bdjuno
COPY . ./
RUN go mod download
RUN make build

FROM alpine:latest
WORKDIR /bdjuno
COPY --from=builder /go/src/github.com/forbole/bdjuno/build/bdjuno /usr/bin/bdjuno
CMD [ "bdjuno" ]
30 changes: 23 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ all: lint build test-unit
### Build flags ###
###############################################################################

LD_FLAGS = -X github.com/forbole/juno/v3/cmd.Version=$(VERSION) \
-X github.com/forbole/juno/v3/cmd.Commit=$(COMMIT)
LD_FLAGS = -X github.com/forbole/juno/v5/cmd.Version=$(VERSION) \
-X github.com/forbole/juno/v5/cmd.Commit=$(COMMIT)
BUILD_FLAGS := -ldflags '$(LD_FLAGS)'

ifeq ($(LINK_STATICALLY),true)
LD_FLAGS += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
endif

build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

BUILD_FLAGS := -ldflags '$(LD_FLAGS)' -tags "$(build_tags)"

###############################################################################
### Build ###
Expand Down Expand Up @@ -60,17 +68,25 @@ test-unit: start-docker-test
@go test -mod=readonly -v -coverprofile coverage.txt ./...
.PHONY: test-unit

###############################################################################
### Linting ###
###############################################################################
golangci_lint_cmd=github.com/golangci/golangci-lint/cmd/golangci-lint

lint:
golangci-lint run --out-format=tab
@echo "--> Running linter"
@go run $(golangci_lint_cmd) run --timeout=10m

lint-fix:
golangci-lint run --fix --out-format=tab --issues-exit-code=0
@echo "--> Running linter"
@go run $(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0

.PHONY: lint lint-fix

format:
find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "*.git*" | xargs misspell -w
find . -name '*.go' -type f -not -path "*.git*" | xargs goimports -w -local github.com/forbole/bdjuno
find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*_mocks.go' | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*_mocks.go' | xargs misspell -w
find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*_mocks.go' | xargs goimports -w -local github.com/forbole/bdjuno
.PHONY: format

clean:
Expand Down
Loading

0 comments on commit a2e7014

Please sign in to comment.