Skip to content

Commit

Permalink
Merge pull request #46 from bnb-chain/develop
Browse files Browse the repository at this point in the history
release: add changelog for release v0.0.5
  • Loading branch information
unclezoro authored Feb 10, 2023
2 parents bf69c59 + b403b05 commit 5b72432
Show file tree
Hide file tree
Showing 285 changed files with 49,718 additions and 1,420 deletions.
2 changes: 0 additions & 2 deletions .github/generate_change_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ while read line; do
done < ${change_log_file}
LINUX_BIN_SUM="$(checksum ./linux/linux)"
MAC_BIN_SUM="$(checksum ./macos/macos)"
WINDOWS_BIN_SUM="$(checksum ./windows/windows.exe)"
OUTPUT=$(cat <<-END
${CHANGE_LOG}\n
## Assets\n
| Assets | Sha256 Checksum |\n
| :-----------: |------------|\n
| linux | ${LINUX_BIN_SUM} |\n
| mac | ${MAC_BIN_SUM} |\n
| windows | ${WINDOWS_BIN_SUM} |\n
END
)

Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/buf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Protobuf files lint and backwards compatibility check job
# reference: <https://docs.buf.build/ci-cd/github-actions>
name: protobuf-check

on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop

jobs:
protobuf-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v1
- run: buf format --diff --exit-code
49 changes: 49 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Docker

on:
push:
# Publish `v1.2.3` tags as releases.
tags:
- v*

env:
IMAGE_NAME: ghcr.io/bnb-chain/greenfield
IMAGE_SOURCE: https://github.com/bnb-chain/greenfield

jobs:
# Push image to GitHub Packages.
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v3

- name: Build image
run: |
docker build . \
--build-arg "GH_TOKEN=${{ secrets.GH_ACCESS_SECRET }}" \
--label "org.opencontainers.image.source=${IMAGE_SOURCE}" \
--label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
--label "org.opencontainers.image.version=$(git describe --tags --abbrev=0)" \
--label "org.opencontainers.image.licenses=LGPL-3.0,GPL-3.0" \
-f ./Dockerfile -t "${IMAGE_NAME}"
- name: Log into registry
run: echo "${{ secrets.GH_ACCESS_SECRET }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_NAME=$IMAGE_NAME
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_NAME:$VERSION
docker tag $IMAGE_NAME $IMAGE_NAME:latest
docker push $IMAGE_NAME:$VERSION
docker push $IMAGE_NAME:latest
54 changes: 54 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: End to End Test

on:
push:
branches:
- master
- develop

pull_request:
branches:
- master
- develop

jobs:
end-to-end-test:
strategy:
matrix:
go-version: [1.18.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
GOPRIVATE: github.com/bnb-chain
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_SECRET }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup GitHub Token
run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- name: Build
run: |
make build
- name: run local chain
run: bash ./deployment/localup/localup.sh all 1
- name: run cli test
run: bash ./e2e/cli_test.sh
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ release/
.idea/
.vscode/
.DS_Store
spec/
Taskfile.yaml
build/
vendor/
.local
.local
.task
19 changes: 19 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
linters:
enable:
- gofmt
- goimports
- errcheck
- govet
- staticcheck

linters-settings:
gofmt:
# Simplify code: gofmt with `-s` option.
# Default: true
simplify: true
# Apply the rewrite rules to the source before reformatting.
# https://pkg.go.dev/cmd/gofmt
# Default: []
rewrite-rules:
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## v0.0.5
This release includes features, mainly:
1. Implement payment module;
2. Implement storage provider module;
3. Implement storage management module.

* [\#42](https://github.com/bnb-chain/greenfield/pull/42) chore: run goimportssort over the repo
* [\#18](https://github.com/bnb-chain/greenfield/pull/18) feat: add storage module
* [\#5](https://github.com/bnb-chain/greenfield/pull/5) feats: init payment module
* [\#39](https://github.com/bnb-chain/greenfield/pull/39) doc: add events doc for the whole project
* [\#41](https://github.com/bnb-chain/greenfield/pull/41) feat: add more field of storage event
* [\#40](https://github.com/bnb-chain/greenfield/pull/40) feat: add comments for the events of bridge module
* [\#38](https://github.com/bnb-chain/greenfield/pull/38) ci: fix Dockerfile and add docker image release job
* [\#35](https://github.com/bnb-chain/greenfield/pull/35) deploy: update deployment scripts
* [\#46](https://github.com/bnb-chain/greenfield/pull/36) deployment: add bls env to setup script
* [\#34](https://github.com/bnb-chain/greenfield/pull/34) feat: add gashub module
* [\#6](https://github.com/bnb-chain/greenfield/pull/6) feat: add sp module
* [\#32](https://github.com/bnb-chain/greenfield/pull/32) feat: add support for EVM jsonrpc
* [\#33](https://github.com/bnb-chain/greenfield/pull/33) fix: revert gashub module and fix build error

## v0.0.4
This release is for rebranding from `inscription` to `greenfield`, renaming is applied to all packages, files.

Expand Down
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
FROM golang:1.18-alpine as builder

RUN apk add --no-cache make git bash
RUN apk add --no-cache make git bash build-base linux-headers libc-dev

ADD . /greenfield

ENV CGO_ENABLED=0
ENV CGO_ENABLED=1
ENV GO111MODULE=on

# For Private REPO
ARG GH_TOKEN=""
RUN go env -w GOPRIVATE="github.com/bnb-chain/*"
RUN git config --global url."https://${GH_TOKEN}@github.com".insteadOf "https://github.com"

RUN cd /greenfield && make build

# Pull greenfield into a second stage deploy alpine container
FROM alpine:3.16
FROM alpine:3.17

ARG USER=greenfield
ARG USER_UID=1000
ARG USER_GID=1000

ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__"
ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"

ENV PACKAGES ca-certificates bash curl libstdc++
ENV WORKDIR=/server
ENV WORKDIR=/app

RUN apk add --no-cache $PACKAGES \
&& rm -rf /var/cache/apk/* \
Expand All @@ -30,10 +38,10 @@ RUN echo "[ ! -z \"\$TERM\" -a -r /etc/motd ] && cat /etc/motd" >> /etc/bash/bas

WORKDIR ${WORKDIR}

COPY --from=builder /greenfield/build/bin/greenfieldd ${WORKDIR}/
COPY --from=builder /greenfield/build/bin/gnfd ${WORKDIR}/
RUN chown -R ${USER_UID}:${USER_GID} ${WORKDIR}
USER ${USER_UID}:${USER_GID}

EXPOSE 26656 26657 9090 1317 6060 4500

ENTRYPOINT ["/server/greenfieldd"]
ENTRYPOINT ["/app/gnfd"]
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: build build-linux build-macos build-windows
.PHONY: tools proto test
.PHONY: tools proto-gen proto-format test

VERSION=$(shell git describe --tags)
VERSION=$(shell git describe --tags --always)
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_COMMIT_DATE=$(shell git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
REPO=github.com/bnb-chain/greenfield
Expand All @@ -12,18 +12,24 @@ ldflags = -X $(REPO)/version.AppVersion=$(VERSION) \
-X $(REPO)/version.GitCommit=$(GIT_COMMIT) \
-X $(REPO)/version.GitCommitDate=$(GIT_COMMIT_DATE)

format:
bash scripts/format.sh

tools:
curl https://get.ignite.com/cli! | bash

proto:
ignite generate proto-go
proto-gen:
cd proto && buf generate && cp -r github.com/bnb-chain/greenfield/x/* ../x && rm -rf github.com

proto-format:
buf format -w

build:
go build -o build/bin/gnfd -ldflags="$(ldflags)" ./cmd/gnfd/main.go
build:
CGO_CFLAGS="-O -D__BLST_PORTABLE__" CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" go build -o build/bin/gnfd -ldflags="$(ldflags)" ./cmd/gnfd/main.go

docker-image:
go mod vendor # temporary, should be removed after open source
docker build . -t ${IMAGE_NAME}

test:
go test ./...
go test ./...
18 changes: 15 additions & 3 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

// HandlerOptions are the options required for constructing a greenfield AnteHandler.
type HandlerOptions struct {
AccountKeeper ante.AccountKeeper
BankKeeper authtypes.BankKeeper
ExtensionOptionChecker ante.ExtensionOptionChecker
FeegrantKeeper ante.FeegrantKeeper
SignModeHandler authsigning.SignModeHandler
TxFeeChecker ante.TxFeeChecker
GashubKeeper ante.GashubKeeper
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(options ante.HandlerOptions) (sdk.AnteHandler, error) {
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
}
Expand All @@ -33,11 +45,11 @@ func NewAnteHandler(options ante.HandlerOptions) (sdk.AnteHandler, error) {
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewValidateTxSizeDecorator(options.AccountKeeper, options.GashubKeeper),
ante.NewConsumeMsgGasDecorator(options.AccountKeeper, options.GashubKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
}
Expand Down
Loading

0 comments on commit 5b72432

Please sign in to comment.