Skip to content

Commit

Permalink
chore: merge rapha/funders-module
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed Oct 23, 2023
2 parents c05d95e + 92bf81b commit 3f12742
Show file tree
Hide file tree
Showing 29 changed files with 2,951 additions and 429 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.idea
.vscode
node_modules
release
.DS_Store
/scripts/
test/.env
chain

build
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# https://help.github.com/articles/about-codeowners

* @johnletey @mbreithecker @troykessler
* @mbreithecker @troykessler @shifty11
16 changes: 16 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,19 @@ You can verify the build information using the following command:
```shell
kyved info
```

### Building docker image

#### Root
To create a regular `kyve-network/kyve:${VERSION}` docker image with `kyved` binary only execute:
```bash
make docker-image
```
To create the corresponding debug image containing a `sh` shell execute `make docker-image-debug`.

#### Nonroot
To create a nonroot docker image `kyve-network/kyve:${VERSION}-nonroot` running with user `nonroot:65532`:
```bash
make docker-image-nonroot
```
To create the corresponding debug image `kyve-network/kyve:${VERSION}-debug-nonroot` execute `make docker-image-debug-nonroot`.
9 changes: 9 additions & 0 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: run all jobs
on: push

jobs:
lint:
uses: ./.github/workflows/lint.yml

test:
uses: ./.github/workflows/test.yml
44 changes: 27 additions & 17 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
on: push
name: lint
on:
workflow_call:

jobs:
buf:
runs-on: ubuntu-latest
steps:
# Run `git checkout`
- uses: actions/checkout@v3
# Checkout the repository
- name: Checkout the repository
uses: actions/checkout@v4
# Install `buf`
- uses: bufbuild/buf-setup-action@v1
- name: Install `buf`
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
# Lint Protobuf files
- uses: bufbuild/buf-lint-action@v1
- name: Lint Protobuf files
uses: bufbuild/buf-lint-action@v1
with:
buf_token: ${{ secrets.BUF_TOKEN }}

# TODO(@john): Figure out why linting passes locally but not here.
# golangci:
# runs-on: ubuntu-latest
# steps:
# # Run `git checkout`
# - uses: actions/checkout@v3
# # Install `go`
# - uses: actions/setup-go@v3
# # Lint Go files
# - uses: golangci/golangci-lint-action@v3
# with:
# args: --timeout=10m
golangci:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout the repository
uses: actions/checkout@v4
# Setup Golang
- name: 🐿 Setup Golang
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
# Lint go files with golangci-lint
- name: Lint go files with golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=10m
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test
on:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Check out repository code
uses: actions/checkout@v4
# Setup Golang
- name: 🐿 Setup Golang
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
# Test & coverage report creation
- name: Test & coverage report creation
run: go test -cover -mod=readonly ./x/...
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG IMG_TAG=latest

# Compile the kyved binary
FROM golang:1.20-alpine AS kyved-builder

# Install make
RUN apk add --no-cache make

WORKDIR /go/src

# Install dependencies
COPY go.mod go.sum* ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download
COPY . .

ENV ENV=mainnet
RUN make install

# Copy binary to a distroless container
FROM gcr.io/distroless/static-debian11:$IMG_TAG

COPY --from=kyved-builder "/go/bin/kyved" /usr/local/bin/
EXPOSE 26656 26657 1317 9090

ENTRYPOINT ["kyved"]
41 changes: 33 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
COMMIT := $(shell git log -1 --format='%H')
GO_VERSION := $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1,2)
VERSION := v1.4.0 # $(shell echo $(shell git describe --tags) | sed 's/^v//')

# VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
VERSION := v1.4.0

TEAM_ALLOCATION := 165000000000000
ifeq ($(ENV),kaon)
Expand Down Expand Up @@ -73,6 +75,36 @@ release: ensure_environment ensure_version
@rm kyved
@echo "✅ Completed release creation!"

###############################################################################
### Docker Build ###
###############################################################################

# Build a release image
docker-image:
@DOCKER_BUILDKIT=1 docker build -t kyve-network/kyve:${VERSION} .
@echo "✅ Completed docker image build!"

# Build a release nonroot image
docker-image-nonroot:
@DOCKER_BUILDKIT=1 docker build \
--build-arg IMG_TAG="nonroot" \
-t kyve-network/kyve:${VERSION}-nonroot .
@echo "✅ Completed docker image build! (nonroot)"

# Build a release debug image
docker-image-debug:
@DOCKER_BUILDKIT=1 docker build \
--build-arg IMG_TAG="debug" \
-t kyve-network/kyve:${VERSION}-debug .
@echo "✅ Completed docker image build! (debug)"

# Build a release debug-nonroot image
docker-image-debug-nonroot:
@DOCKER_BUILDKIT=1 docker build \
--build-arg IMG_TAG="debug-nonroot" \
-t kyve-network/kyve:${VERSION}-debug-nonroot .
@echo "✅ Completed docker image build! (debug-nonroot)"

###############################################################################
### Checks ###
###############################################################################
Expand All @@ -91,7 +123,6 @@ endif
### Development ###
###############################################################################

# TODO(@john): Switch to the Docker image?
dev:
@ignite chain serve --reset-once --skip-proto --verbose

Expand All @@ -112,12 +143,6 @@ lint:
@go run $(golangci_lint_cmd) run --skip-dirs scripts --timeout=10m
@echo "✅ Completed linting!"

# TODO(@john): Can we remove this since we use GolangCI?
vet:
@echo "🤖 Running vet..."
@go vet ./...
@echo "✅ Completed vet!"

###############################################################################
### Protobuf ###
###############################################################################
Expand Down
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ import (
group "github.com/cosmos/cosmos-sdk/x/group/module"
// IBC Core
ibc "github.com/cosmos/ibc-go/v7/modules/core"
ibcClientHandler "github.com/cosmos/ibc-go/v7/modules/core/02-client" // TODO
ibcClientHandler "github.com/cosmos/ibc-go/v7/modules/core/02-client"
ibcClientTypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
ibcPortTypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibcExported "github.com/cosmos/ibc-go/v7/modules/core/exported"
Expand Down Expand Up @@ -350,7 +350,7 @@ func NewKYVEApp(
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icaControllerTypes.SubModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icaHostTypes.SubModuleName)

// TODO(@john): Seal x/capability keeper.
app.CapabilityKeeper.Seal()

// add keepers
app.AccountKeeper = authKeeper.NewAccountKeeper(
Expand Down Expand Up @@ -389,7 +389,7 @@ func NewKYVEApp(
appCodec,
keys[mintTypes.StoreKey],
app.StakingKeeper,
&app.StakersKeeper, // TODO(@john)
&app.StakersKeeper, // This is a pointer because the stakers keeper is not initialized yet.
app.AccountKeeper,
app.BankKeeper,
authTypes.FeeCollectorName,
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v1_4/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const (
DefaultAmountPerBundle = uint64(10_000_000) // TODO(@rapha): how much?
)

//nolint:all
//goland:noinspection GoDeprecation
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
Expand Down
2 changes: 1 addition & 1 deletion cmd/kyved/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func NewRootCmd(encodingConfig kyveApp.EncodingConfig) *cobra.Command {
tmCli.NewCompletionCmd(rootCmd, true),
debug.Cmd(),
config.Cmd(),
pruning.PruningCmd(ac.createApp),
pruning.Cmd(ac.createApp, kyveApp.DefaultNodeHome),

rpc.StatusCommand(),
queryCommand(),
Expand Down
3 changes: 1 addition & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ genesis:
contact: "https://twitter.com/kyvenetwork"
moniker: "Alice"
description: "Alice is the first funder of the KYVE network."
logo: "https://avatars.githubusercontent.com/u/76891822?s=200&v=4"
website: "https://kyve.network"
identity: "0657A086E5201562"
funding_list:
Expand All @@ -197,4 +196,4 @@ validators:
config:
consensus:
timeout_commit: "2s"
timeout_propose: "2s"
timeout_propose: "2s"
Loading

0 comments on commit 3f12742

Please sign in to comment.