Skip to content

Commit

Permalink
feat(evidence): add evidence module with singularity (#265)
Browse files Browse the repository at this point in the history
With [this](piplabs/cosmos-sdk#18), slashing for
double signing is also disabled during singularity.

issue: none
  • Loading branch information
0xHansLee authored Oct 22, 2024
1 parent a4918f6 commit 64e7b0c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions client/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/piplabs/story/lib/ethclient"

_ "cosmossdk.io/api/cosmos/tx/config/v1" // import for side-effects
_ "cosmossdk.io/x/evidence" // import for side-effects
_ "cosmossdk.io/x/upgrade" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/auth" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects
Expand Down Expand Up @@ -89,6 +90,7 @@ func newApp(
&app.Keepers.StakingKeeper,
&app.Keepers.SlashingKeeper,
&app.Keepers.DistrKeeper,
&app.Keepers.EvidenceKeeper,
&app.Keepers.ConsensusParamsKeeper,
&app.Keepers.GovKeeper,
&app.Keepers.UpgradeKeeper,
Expand Down
8 changes: 8 additions & 0 deletions client/app/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1"
consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1"
distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1"
evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1"
genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1"
govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1"
slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1"
Expand All @@ -15,6 +16,7 @@ import (
upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1"
"cosmossdk.io/core/appconfig"
"cosmossdk.io/depinject"
evidencetypes "cosmossdk.io/x/evidence/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/runtime"
Expand Down Expand Up @@ -83,6 +85,7 @@ var (
minttypes.ModuleName,
genutiltypes.ModuleName,
upgradetypes.ModuleName,
evidencetypes.ModuleName,
// Story modules
evmenginetypes.ModuleName,
evmstakingtypes.ModuleName,
Expand All @@ -101,6 +104,7 @@ var (
minttypes.ModuleName,
distrtypes.ModuleName, // Note: slashing happens after distr.BeginBlocker
slashingtypes.ModuleName,
evidencetypes.ModuleName,
stakingtypes.ModuleName,
}

Expand Down Expand Up @@ -192,6 +196,10 @@ var (
Name: stakingtypes.ModuleName,
Config: appconfig.WrapAny(&stakingmodulev1.Module{}),
},
{
Name: evidencetypes.ModuleName,
Config: appconfig.WrapAny(&evidencemodulev1.Module{}),
},
{
Name: upgradetypes.ModuleName,
Config: appconfig.WrapAny(&upgrademodulev1.Module{}),
Expand Down
2 changes: 2 additions & 0 deletions client/app/keepers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package keepers
// When performing `ignite scaffold` the keeper will be added to `app.go`. Please move them here.

import (
evidencekeeper "cosmossdk.io/x/evidence/keeper"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"

authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
Expand All @@ -31,6 +32,7 @@ type Keepers struct {
ConsensusParamsKeeper consensuskeeper.Keeper
GovKeeper *govkeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper

// Story
EvmStakingKeeper *evmstakingkeeper.Keeper
Expand Down
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ require (
)

require (
cosmossdk.io/x/evidence v0.1.0
cosmossdk.io/x/upgrade v0.1.4
github.com/decred/dcrd/dcrec/secp256k1 v1.0.4
github.com/go-playground/validator/v10 v10.11.1
Expand Down Expand Up @@ -294,8 +295,11 @@ replace (
// should use v0.11.0. The Cosmos build fails with types/context.go:65:29: undefined: comet.BlockInfo otherwise.
cosmossdk.io/core v0.12.0 => cosmossdk.io/core v0.11.0

// replace evidence module to the story's evidence module
cosmossdk.io/x/evidence => github.com/piplabs/cosmos-sdk/x/evidence v0.1.0

// Direct cosmos-sdk branch link: https://github.com/piplabs/cosmos-sdk/tree/piplabs/v0.50.7, current branch: piplabs/v0.50.7
github.com/cosmos/cosmos-sdk => github.com/piplabs/cosmos-sdk v0.50.8-0.20241020215712-ca039d442878
github.com/cosmos/cosmos-sdk => github.com/piplabs/cosmos-sdk v0.50.7-piplabs-v0.16

// See https://github.com/cosmos/cosmos-sdk/pull/14952
// Also https://github.com/cosmos/cosmos-db/blob/main/go.mod#L11-L12
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,10 @@ github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/piplabs/cosmos-sdk v0.50.8-0.20241020215712-ca039d442878 h1:a49PS8MHEtZKtO/UoolwXEQl2QwKC+hZkVbmOFMPMaI=
github.com/piplabs/cosmos-sdk v0.50.8-0.20241020215712-ca039d442878/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s=
github.com/piplabs/cosmos-sdk v0.50.7-piplabs-v0.16 h1:BSnu6Sxi1FySN8RukXJ7Hr589/G3ifMdWEPXmJMSsuA=
github.com/piplabs/cosmos-sdk v0.50.7-piplabs-v0.16/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s=
github.com/piplabs/cosmos-sdk/x/evidence v0.1.0 h1:zkP1KkXtGKKU1GT2O1ygGWRnNM+Fff/PYiEmovBWQBQ=
github.com/piplabs/cosmos-sdk/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down

0 comments on commit 64e7b0c

Please sign in to comment.