Skip to content

Commit

Permalink
fix(app): reorder the EndBlockers (#98)
Browse files Browse the repository at this point in the history
* chore: update go version to 1.21.11

* fix(ci): disable buggy workflows

till they can be fixed

* fix(app): reorder the EndBlockers

The `EndBlockers` do the following jobs:
- `x/operator` saves the USD value for delegations, indexed by operator.
- `x/dogfood` uses the USD value obtained from `x/operator` to calculate
  the new voting power and forwards the new validator set to Tendermint.
  It also decreases the hold count on pending undelegations maturing at
  that epoch, from the perspective of the dogfood-AVS.
- `x/delegation` releases any matured undelegations and makes assets
  available for withdrawal.
- `x/oracle` fetches the new voting power from `x/dogfood` and prepares
  for the next round.

The new order is updated to reflect the above functions. As a
consequence, delegations made during blocks just before the epoch ends
will also accurately update the vote power of the validators.

* chore: lint

* fix(docker): update to new alpine

* feat(ci): add `docker build` CI

* chore(ci): run `lint` on workflows

* chore(ci): run `lint` on workflows again

* fix(ci): trigger Dockerbuild only if file changes

* fix(ci): remove backticks from workflow name

* fix(ci): lint the workflow again

* fix(ci): use correct path to trigger
  • Loading branch information
MaxMustermann2 authored Jun 13, 2024
1 parent d6410b2 commit 324070f
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ante-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true

- name: Run benchmark tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true
- uses: technote-space/[email protected]
id: git_diff
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true
- name: "Checkout Repository"
uses: actions/checkout@v4
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/docker-localnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker build for localnet
on:
pull_request:
paths:
- networks/local/exocore/Dockerfile
- networks/Makefile
push:
paths:
- networks/local/exocore/Dockerfile
- networks/Makefile
branches:
- develop
- main
- master
- release/**

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: make -C ./networks
30 changes: 30 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Docker build in root directory
on:
pull_request:
paths:
- Dockerfile
push:
paths:
- Dockerfile
branches:
- develop
- main
- master
- release/**

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: docker build .
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true
- name: release dry run
run: make release-dry-run
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
- uses: actions/setup-go@v5
with:
go-version: '1.21.9'
go-version: '1.21.11'
# Use pinned versions, not git versions
check-latest: false
# Match `golangci-lint-action` recommendation
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/proto-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ on:
jobs:
download-artifact-and-comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success'
if: ${{ false }}
steps:
- name: 'Download artifact'
uses: actions/[email protected]
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ on:
jobs:
download-artifact-and-comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
if: ${{ false }}
steps:
- name: Download artifact
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ run:
tests: false
timeout: 5m
concurrency: 4
go: "1.21.9"
go: "1.21.11"

linters:
enable:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This is the published docker image for exocore.

FROM golang:1.21.9-alpine3.18 AS build-env
FROM golang:1.21.11-alpine3.19 AS build-env

WORKDIR /go/src/github.com/ExocoreNetwork/exocore

COPY go.mod go.sum ./

RUN apk add --no-cache ca-certificates=20230506-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0
RUN apk add --no-cache ca-certificates=20240226-r0 build-base=0.5-r3 git=2.43.4-r0 linux-headers=6.5-r0

RUN --mount=type=bind,target=. --mount=type=secret,id=GITHUB_TOKEN \
git config --global url."https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/".insteadOf "https://github.com/"; \
Expand All @@ -16,14 +16,14 @@ COPY . .

RUN make build && go install github.com/MinseokOh/toml-cli@latest

FROM alpine:3.18
FROM alpine:3.19

WORKDIR /root

COPY --from=build-env /go/src/github.com/ExocoreNetwork/exocore/build/exocored /usr/bin/exocored
COPY --from=build-env /go/bin/toml-cli /usr/bin/toml-cli

RUN apk add --no-cache ca-certificates=20230506-r0 libstdc++=12.2.1_git20220924-r10 jq=1.6-r4 curl=8.5.0-r0 bash=5.2.15-r5 vim=9.0.2073-r0 lz4=1.9.4-r4 rclone=1.62.2-r6 \
RUN apk add --no-cache ca-certificates=20240226-r0 libstdc++=13.2.1_git20231014-r0 jq=1.7.1-r0 curl=8.5.0-r0 bash=5.2.21-r0 vim=9.0.2127-r0 lz4=1.9.4-r5 rclone=1.65.0-r3 \
&& addgroup -g 1000 exocore \
&& adduser -S -h /home/exocore -D exocore -u 1000 -G exocore

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ localnet-show-logstream:
###############################################################################

PACKAGE_NAME:=github.com/ExocoreNetwork/exocore
GOLANG_CROSS_VERSION = v1.21.9
GOLANG_CROSS_VERSION = v1.21.11
GOPATH ?= '$(HOME)/go'
release-dry-run:
docker run \
Expand Down
10 changes: 5 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,12 +939,12 @@ func NewExocoreApp(

app.mm.SetOrderEndBlockers(
capabilitytypes.ModuleName,
crisistypes.ModuleName, // easy quit
stakingtypes.ModuleName,
operatorTypes.ModuleName, // after staking keeper
delegationTypes.ModuleName, // after operator keeper
crisistypes.ModuleName, // easy quit
operatorTypes.ModuleName, // first, so that USD value is recorded
stakingtypes.ModuleName, // uses the USD value recorded in operator to calculate vote power
delegationTypes.ModuleName, // process the undelegations matured by dogfood
govtypes.ModuleName, // after staking keeper to ensure new vote powers
oracleTypes.ModuleName, // after staking keeper to ensure new vote powers
oracleTypes.ModuleName, // prepares for next round with new vote powers from staking keeper
evmtypes.ModuleName, // can be anywhere
feegrant.ModuleName, // can be anywhere
// no-op modules
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ExocoreNetwork/exocore

go 1.21.9
go 1.21.11

require (
cosmossdk.io/errors v1.0.1
Expand Down
8 changes: 4 additions & 4 deletions networks/local/exocore/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM golang:1.21.9-alpine3.18 AS build
RUN apk add --no-cache build-base=0.5-r3 linux-headers=6.3-r0 git=2.40.1-r0
FROM golang:1.21.11-alpine3.19 AS build
RUN apk add --no-cache build-base=0.5-r3 git=2.43.4-r0 linux-headers=6.5-r0
# Set working directory for the build
WORKDIR /go/work
# Add source files
Expand All @@ -9,8 +9,8 @@ COPY . ./
RUN LEDGER_ENABLED=false make build

#####################################
FROM alpine:3.18 AS run
RUN apk add --no-cache libstdc++=12.2.1_git20220924-r10 bash=5.2.15-r5 curl=8.5.0-r0 jq=1.6-r4 \
FROM alpine:3.19 AS run
RUN apk add --no-cache libstdc++=13.2.1_git20231014-r0 bash=5.2.21-r0 curl=8.5.0-r0 jq=1.7.1-r0 \
&& addgroup -g 1000 exocore \
&& adduser -S -h /home/exocore -D exocore -u 1000 -G exocore
EXPOSE 26656 26657 1317 9090 8545 8546
Expand Down

0 comments on commit 324070f

Please sign in to comment.