Skip to content

Commit

Permalink
feat: update x/foundation to use Finschia/cosmos-sdk (#1198)
Browse files Browse the repository at this point in the history
* Copy x/foundation

* Update imports

* Update logic

* Add module proto

* Wire x/foundation

* Update tests

* Update go.mod

* Lint

* Use Finschia/cometbft

* Refactor address codec

* Proto gen

* Add x/foundation to pr labeler

* Cover x/foundation

* Add e2e tests

* Update mocks

* Gosec

* Update CHANGELOG.md

* Fix test workflow

* Fix protobuf break checking workflow

* Stop using interface for keeper

* Remove GetSignBytes

* ci: downgrade pr labeler to v4 because of broken version(v5 and above)

* Remove legacy simapp

* Update x/foundation/README.md

Co-authored-by: Shogo Hyodo <[email protected]>

* Remove testing legacy simapp

* go mod tidy simapp

---------

Co-authored-by: jaeseung.bae <[email protected]>
Co-authored-by: Shogo Hyodo <[email protected]>
  • Loading branch information
3 people authored Feb 2, 2024
1 parent 742cd17 commit d9ebe72
Show file tree
Hide file tree
Showing 92 changed files with 37,814 additions and 989 deletions.
2 changes: 2 additions & 0 deletions .github/pr_labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
# - x/*/client/**/*
# "Type: ADR":
# - docs/architecture/**/*
"C:x/foundation":
- x/foundation/**/*
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,3 @@ jobs:
- name: Build
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} make build
- name: Build Legacy
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS=legacy make build
2 changes: 1 addition & 1 deletion .github/workflows/pr_labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
pull-requests: write # for actions/labeler to add labels to PRs
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
- uses: actions/labeler@v4
with:
configuration-path: .github/pr_labeler.yml
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- uses: bufbuild/buf-breaking-action@v1
with:
input: "proto"
against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto"
against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},subdir=proto"
109 changes: 68 additions & 41 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,40 +113,41 @@ jobs:
# name: "${{ github.sha }}-integration-coverage"
# path: ./tests/integration-profile.out

# test-e2e:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v4
# with:
# go-version: "1.21"
# check-latest: true
# cache: true
# cache-dependency-path: go.sum
# - uses: technote-space/[email protected]
# id: git_diff
# with:
# PATTERNS: |
# **/*.go
# go.mod
# go.sum
# **/go.mod
# **/go.sum
# **/Makefile
# Makefile
# - name: e2e tests
# if: env.GIT_DIFF
# run: |
# make test-e2e-cov
# - uses: actions/upload-artifact@v3
# if: env.GIT_DIFF
# with:
# name: "${{ github.sha }}-e2e-coverage"
# path: ./tests/e2e-profile.out
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- name: e2e tests
if: env.GIT_DIFF
run: |
make test-e2e-cov
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-e2e-coverage"
path: ./tests/e2e-profile.out

repo-analysis:
runs-on: ubuntu-latest
needs: [tests, test-integration, test-e2e]
# needs: [tests, test-integration, test-e2e]
needs: [tests, test-e2e]
steps:
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
Expand Down Expand Up @@ -178,11 +179,11 @@ jobs:
# if: env.GIT_DIFF
# with:
# name: "${{ github.sha }}-integration-coverage"
# - uses: actions/download-artifact@v3
# if: env.GIT_DIFF
# with:
# name: "${{ github.sha }}-e2e-coverage"
# continue-on-error: true
- uses: actions/download-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-e2e-coverage"
continue-on-error: true
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }}
uses: SonarSource/sonarcloud-github-action@master
Expand Down Expand Up @@ -276,11 +277,6 @@ jobs:
run: |
cd simapp
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
- name: tests simapp v1
if: env.GIT_DIFF
run: |
cd simapp
go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock rocksdb_build' ./...
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
uses: SonarSource/sonarcloud-github-action@master
Expand All @@ -296,3 +292,34 @@ jobs:

# NOTE: The following jobs are used to test the Finschia SDK Go submodules present under x/{module}.
# They run when there is a diff in their respective directories.

test-x-foundation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
cache: true
cache-dependency-path: x/foundation/go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
x/foundation/**/*.go
x/foundation/go.mod
x/foundation/go.sum
- name: tests
if: env.GIT_DIFF
run: |
cd x/foundation
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: x/foundation/
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ issues:
- text: "SA1019: codec.NewAminoCodec is deprecated" # TODO remove once migration path is set out
linters:
- staticcheck
- path: "client/cli" # TODO(@0Tech): remove after foundation exec proposal removed
text: "SA1019: govcli.FlagDescription is deprecated"
linters:
- staticcheck
- text: "leading space"
linters:
- nolintlint
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased](https://github.com/Finschia/finschia-sdk/compare/v0.48.0...HEAD)

### Features
* (x/foundation) [\#1198](https://github.com/Finschia/finschia-sdk/pull/1198) update x/foundation to use Finschia/cosmos-sdk
* (all) [\#1205](https://github.com/Finschia/finschia-sdk/pull/1205) delegate native logics to Finschia/cosmos-sdk
* (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24

Expand Down
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
toolchain go1.21.5

require (
cosmossdk.io/api v0.7.2
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.50.2
github.com/cosmos/gogoproto v1.4.11
Expand All @@ -14,7 +15,6 @@ require (
)

require (
cosmossdk.io/api v0.7.2 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.11.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
Expand Down
Loading

0 comments on commit d9ebe72

Please sign in to comment.