Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace stakingplus module with staking hooks #1271

Merged
merged 12 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ updates:
labels:
- "A:automerge"
- dependencies
- package-ecosystem: gomod
directory: "/x/stakingplus"
schedule:
interval: weekly
day: wednesday
time: "01:35"
labels:
- "A:automerge"
- dependencies
- package-ecosystem: gomod
directory: "/x/bankplus"
schedule:
Expand Down
2 changes: 0 additions & 2 deletions .github/pr_labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@
- x/collection/**/*
"C:x/foundation":
- x/foundation/**/*
"C:x/stakingplus":
- x/stakingplus/**/*
31 changes: 0 additions & 31 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,34 +323,3 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: x/foundation/

test-x-stakingplus:
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/stakingplus/go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
x/stakingplus/**/*.go
x/stakingplus/go.mod
x/stakingplus/go.sum
- name: tests
if: env.GIT_DIFF
run: |
cd x/stakingplus
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/stakingplus/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (chore) [\#1168](https://github.com/Finschia/finschia-sdk/pull/1168) Replace `ExactArgs(0)` with `NoArgs()` in `x/upgrade` module
* (server) [\#1175](https://github.com/Finschia/finschia-sdk/pull/1175) Use go embed for swagger
* (e2e) [\#1237](https://github.com/Finschia/finschia-sdk/pull/1237) Check tx result on x/foundation e2e test
* (x/foudation, staking) [\#1271](https://github.com/Finschia/finschia-sdk/pull/1271) replace stakingplus module with staking hooks

### Bug Fixes
* chore(deps) [\#1141](https://github.com/Finschia/finschia-sdk/pull/1141) Bump github.com/cosmos/ledger-cosmos-go from 0.12.2 to 0.13.2 to fix ledger signing issue
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion go.work.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ use (
./tests
./x/collection
./x/foundation
./x/stakingplus
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lbm.stakingplus.v1;

import "cosmos_proto/cosmos.proto";

option go_package = "github.com/Finschia/finschia-sdk/x/stakingplus";
option go_package = "github.com/Finschia/finschia-sdk/x/foundation";

// CreateValidatorAuthorization allows the grantee to create a new validator.
message CreateValidatorAuthorization {
Expand Down
1 change: 0 additions & 1 deletion scripts/mockgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

mockgen_cmd="mockgen"
$mockgen_cmd -source=x/foundation/expected_keepers.go -package testutil -destination x/foundation/testutil/expected_keepers_mocks.go
$mockgen_cmd -source=x/stakingplus/expected_keepers.go -package testutil -destination x/stakingplus/testutil/expected_keepers_mocks.go
4 changes: 2 additions & 2 deletions simapp/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ import (
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

collectionmodulev1 "github.com/Finschia/finschia-sdk/api/lbm/collection/module/v1"
foundationmodulev1 "github.com/Finschia/finschia-sdk/api/lbm/foundation/module/v1"
"github.com/Finschia/finschia-sdk/x/collection"
_ "github.com/Finschia/finschia-sdk/x/collection/module" // import for side-effects
"github.com/Finschia/finschia-sdk/x/foundation"
_ "github.com/Finschia/finschia-sdk/x/foundation/module" // import for side-effects
_ "github.com/Finschia/finschia-sdk/x/stakingplus/module" // import for side-effects
_ "github.com/Finschia/finschia-sdk/x/foundation/module" // import for side-effects
)

var (
Expand Down
6 changes: 3 additions & 3 deletions simapp/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"

collectionmodule "github.com/Finschia/finschia-sdk/x/collection/module"
foundationmodule "github.com/Finschia/finschia-sdk/x/foundation/module"
stakingplusmodule "github.com/Finschia/finschia-sdk/x/stakingplus/module"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestRunMigrations(t *testing.T) {
"bank": 1,
"auth": auth.AppModule{}.ConsensusVersion(),
"authz": authzmodule.AppModule{}.ConsensusVersion(),
"staking": stakingplusmodule.AppModule{}.ConsensusVersion(),
"staking": staking.AppModule{}.ConsensusVersion(),
"mint": mint.AppModule{}.ConsensusVersion(),
"distribution": distribution.AppModule{}.ConsensusVersion(),
"slashing": slashing.AppModule{}.ConsensusVersion(),
Expand Down Expand Up @@ -256,7 +256,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
"bank": bank.AppModule{}.ConsensusVersion(),
"auth": auth.AppModule{}.ConsensusVersion(),
"authz": authzmodule.AppModule{}.ConsensusVersion(),
"staking": stakingplusmodule.AppModule{}.ConsensusVersion(),
"staking": staking.AppModule{}.ConsensusVersion(),
"mint": mint.AppModule{}.ConsensusVersion(),
"distribution": distribution.AppModule{}.ConsensusVersion(),
"slashing": slashing.AppModule{}.ConsensusVersion(),
Expand Down
2 changes: 0 additions & 2 deletions simapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ require (
github.com/Finschia/finschia-sdk/x/collection v0.0.0-00010101000000-000000000000
github.com/Finschia/finschia-sdk/x/foundation v0.0.0-00010101000000-000000000000
github.com/cometbft/cometbft v0.38.3
github.com/Finschia/finschia-sdk/x/stakingplus v0.0.0-00010101000000-000000000000
github.com/cosmos/cosmos-db v1.0.0
// this version is not used as it is always replaced by the latest Cosmos SDK version
github.com/cosmos/cosmos-sdk v0.50.3
Expand Down Expand Up @@ -220,7 +219,6 @@ replace (
github.com/Finschia/finschia-sdk/api => ../api
github.com/Finschia/finschia-sdk/x/collection => ../x/collection
github.com/Finschia/finschia-sdk/x/foundation => ../x/foundation
github.com/Finschia/finschia-sdk/x/stakingplus => ../x/stakingplus
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/stakingplus/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/Finschia/finschia-sdk/x/foundation"
"github.com/Finschia/finschia-sdk/x/stakingplus"
)

type E2ETestSuite struct {
Expand Down Expand Up @@ -96,7 +95,7 @@ func (s *E2ETestSuite) SetupSuite() {
for _, grantee := range []sdk.AccAddress{s.grantee, val1} {
ga := foundation.GrantAuthorization{
Grantee: s.bytesToString(grantee),
}.WithAuthorization(&stakingplus.CreateValidatorAuthorization{
}.WithAuthorization(&foundation.CreateValidatorAuthorization{
ValidatorAddress: s.bytesToValString(grantee),
})
s.Require().NotNil(ga)
Expand Down
2 changes: 0 additions & 2 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ require (
require (
github.com/Finschia/finschia-sdk/simapp v0.0.0-00010101000000-000000000000
github.com/Finschia/finschia-sdk/x/foundation v0.0.0-00010101000000-000000000000
github.com/Finschia/finschia-sdk/x/stakingplus v0.0.0-00010101000000-000000000000
github.com/cosmos/go-bip39 v1.0.0
)

Expand Down Expand Up @@ -231,6 +230,5 @@ replace (
github.com/cosmos/cosmos-sdk => github.com/Finschia/cosmos-sdk v0.0.0-20231211060251-d8fb76d4c267

github.com/Finschia/finschia-sdk/x/foundation => ./../x/foundation
github.com/Finschia/finschia-sdk/x/stakingplus => ./../x/stakingplus
github.com/Finschia/finschia-sdk/x/collection => ./../x/collection
)
Loading
Loading