Skip to content

Commit

Permalink
move aggregation out of EndBlock (#451)
Browse files Browse the repository at this point in the history
* chore: remove unused files

* reduce for loops in WeightedMode

* explore removing aggregation from endBlock

* add different indexes, fix tests plus more

* uncomment test

* add case to TestAddReport

* add test, rename fields, cleanup

* remove aggregate_report_index field

* chore: cleanup comments and prints

* fix cyclelist rewards

* block bridge deposit report for claimed ids

* rate limit snapshot creation

* wip test

* chore: remove unused files

* mv reward calculations from end block (#457)

* first commit

* refactor and fix getter

* handle leftover fraction plus tests

* change docker image for test

* fix workflow cfg

* separate workflow jobs

* fix x/reporter/autocli

* lint

* upgrade handling

* register handler

* lint

* add msg_server_withdraw_tip_legacy for tips before
upgrade

* fix migrations method

* lint

* fix migrations

* add query to fetch report ids and query_ids

* small test

* add query to autocli
  • Loading branch information
akremstudy authored Dec 11, 2024
1 parent 1f84b0c commit 0669b5f
Show file tree
Hide file tree
Showing 178 changed files with 11,283 additions and 24,649 deletions.
80 changes: 63 additions & 17 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,79 @@ on:

env:
TAR_PATH: heighliner.tar
IBC_TAR_PATH: heighliner-ibc.tar

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

build-primary:
runs-on: ubuntu-latest
steps:
- name: Build Docker Image
- name: Checkout Repository
uses: actions/checkout@v4

- name: Build Primary Docker Image
uses: strangelove-ventures/[email protected]
with:
registry: "" # empty registry, image only shared for e2e testing
tag: local # emulate local environment for consistency in interchaintest cases
tar-export-path: ${{ env.TAR_PATH }} # export a tarball that can be uploaded as an artifact for the e2e jobs
platform: linux/amd64 # test runner architecture only
git-ref: ${{ github.head_ref }} # source code ref

# Heighliner chains.yaml config
registry: ""
tag: local
tar-export-path: ${{ env.TAR_PATH }}
platform: linux/amd64
git-ref: ${{ github.head_ref }}
chain: layer
dockerfile: cosmos
build-target: make install
binaries: |
- /go/bin/layerd
- name: Publish Tarball as Artifact
- name: Publish Primary Tarball as Artifact
uses: actions/upload-artifact@v4
with:
name: layer-docker-image
path: ${{ env.TAR_PATH }}

# Second job: Build the IBC image, depends on the primary image job
build-ibc:
runs-on: ubuntu-latest
needs: build-primary
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Switch to IBC branch
run: |
git fetch --all
git checkout ibc
- name: Build IBC Docker Image
uses: strangelove-ventures/[email protected]
with:
registry: ""
tag: local
tar-export-path: ${{ env.IBC_TAR_PATH }}
platform: linux/amd64
git-ref: ibc
chain: layer-icq
dockerfile: cosmos
build-target: make install
binaries: |
- /go/bin/layerd
- name: Publish IBC Tarball as Artifact
uses: actions/upload-artifact@v4
with:
name: layer-icq-docker-image
path: ${{ env.IBC_TAR_PATH }}

# Prepare job (depends on both build jobs)
prepare:
runs-on: ubuntu-latest
needs:
- build-primary
- build-ibc
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
Expand All @@ -52,19 +92,17 @@ jobs:
- name: Generate Matrix
id: set-matrix
run: |
# Run the command and convert its output to a JSON array
TESTS=$(cd e2e && go test -list . | grep -v "^ok " | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=${TESTS}" >> $GITHUB_OUTPUT
# Test job (depends on prepare, which in turn depends on both build jobs)
test:
runs-on: ubuntu-latest
needs:
- build
- prepare
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test: ${{fromJson(needs.prepare.outputs.matrix)}}
test: ${{ fromJson(needs.prepare.outputs.matrix) }}
fail-fast: false

steps:
Expand All @@ -76,13 +114,21 @@ jobs:
with:
go-version: '1.22'

- name: Download Tarball Artifact
- name: Download Primary Tarball
uses: actions/download-artifact@v4
with:
name: layer-docker-image

- name: Load Docker Image
- name: Download IBC Tarball
uses: actions/download-artifact@v4
with:
name: layer-icq-docker-image

- name: Load Primary Docker Image
run: docker image load -i ${{ env.TAR_PATH }}

- name: Load IBC Docker Image
run: docker image load -i ${{ env.IBC_TAR_PATH }}

- name: Run Tests
run: cd e2e && go test -race -v -timeout 10m -run ^${{ matrix.test }}$ .
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ linters:
- dogsled
- errcheck
- errorlint
- copyloopvar
# - copyloopvar
- gci
- goconst
- gocritic
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ mock-gen-mint:
mock-gen-oracle:
@go run github.com/vektra/mockery/v2 --name=AccountKeeper --dir=$(CURDIR)/x/oracle/types --recursive --output=./x/oracle/mocks
@go run github.com/vektra/mockery/v2 --name=BankKeeper --dir=$(CURDIR)/x/oracle/types --recursive --output=./x/oracle/mocks
@go run github.com/vektra/mockery/v2 --name=BridgeKeeper --dir=$(CURDIR)/x/oracle/types --recursive --output=./x/oracle/mocks
@go run github.com/vektra/mockery/v2 --name=RegistryKeeper --dir=$(CURDIR)/x/oracle/types --recursive --output=./x/oracle/mocks
@go run github.com/vektra/mockery/v2 --name=ReporterKeeper --dir=$(CURDIR)/x/oracle/types --recursive --output=./x/oracle/mocks

Expand All @@ -194,6 +195,7 @@ mock-gen-registry:
mock-gen-reporter:
@go run github.com/vektra/mockery/v2 --name=AccountKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks
@go run github.com/vektra/mockery/v2 --name=BankKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks
@go run github.com/vektra/mockery/v2 --name=OracleKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks
@go run github.com/vektra/mockery/v2 --name=StakingKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks
@go run github.com/vektra/mockery/v2 --name=StakingHooks --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks
@go run github.com/vektra/mockery/v2 --name=RegistryKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks
Expand Down
Loading

0 comments on commit 0669b5f

Please sign in to comment.