From 64e7b0c2106b3cb1ea866403da52ac73c92e9af8 Mon Sep 17 00:00:00 2001 From: Hans Lee <38912532+0xHansLee@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:30:55 -0700 Subject: [PATCH] feat(evidence): add evidence module with singularity (#265) With [this](https://github.com/piplabs/cosmos-sdk/pull/18), slashing for double signing is also disabled during singularity. issue: none --- client/app/app.go | 2 ++ client/app/app_config.go | 8 ++++++++ client/app/keepers/types.go | 2 ++ go.mod | 6 +++++- go.sum | 6 ++++-- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client/app/app.go b/client/app/app.go index 01da31b5..0fe4c9d4 100644 --- a/client/app/app.go +++ b/client/app/app.go @@ -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 @@ -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, diff --git a/client/app/app_config.go b/client/app/app_config.go index a39dbc28..c378d36f 100644 --- a/client/app/app_config.go +++ b/client/app/app_config.go @@ -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" @@ -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" @@ -83,6 +85,7 @@ var ( minttypes.ModuleName, genutiltypes.ModuleName, upgradetypes.ModuleName, + evidencetypes.ModuleName, // Story modules evmenginetypes.ModuleName, evmstakingtypes.ModuleName, @@ -101,6 +104,7 @@ var ( minttypes.ModuleName, distrtypes.ModuleName, // Note: slashing happens after distr.BeginBlocker slashingtypes.ModuleName, + evidencetypes.ModuleName, stakingtypes.ModuleName, } @@ -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{}), diff --git a/client/app/keepers/types.go b/client/app/keepers/types.go index 574f4f20..204c4787 100644 --- a/client/app/keepers/types.go +++ b/client/app/keepers/types.go @@ -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" @@ -31,6 +32,7 @@ type Keepers struct { ConsensusParamsKeeper consensuskeeper.Keeper GovKeeper *govkeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper // Story EvmStakingKeeper *evmstakingkeeper.Keeper diff --git a/go.mod b/go.mod index 557f5442..6069075b 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 diff --git a/go.sum b/go.sum index a969b00c..c54dbf71 100644 --- a/go.sum +++ b/go.sum @@ -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=