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

[Main] Remove group module #499

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* (chain) Remove `gogoproto.goproto_stringer` option on param
* (chain) Return error on AllocationToken at beginblock instead of panic
* (chain) Migrate REST Endpoint to GRPC
* (chain) Add group module from cosmos-sdk
* (chain) Change the allocation of remaining tokens from the community pool to the Proposer
* (chain) Add consensus module to handle managing Tendermint consensus parameters
* (chain) Add autocli for oracle module
Expand Down
611 changes: 306 additions & 305 deletions api/band/base/oracle/v1/proof.pulsar.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ import (
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/group"
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -124,7 +122,6 @@ func NewDefaultGenesisState(cdc codec.Codec) GenesisState {
evidencetypes.ModuleName: evidence.AppModuleBasic{}.DefaultGenesis(cdc),
authz.ModuleName: authzmodule.AppModuleBasic{}.DefaultGenesis(cdc),
feegrant.ModuleName: feegrantmodule.AppModuleBasic{}.DefaultGenesis(cdc),
group.ModuleName: groupmodule.AppModuleBasic{}.DefaultGenesis(cdc),
ibctransafertypes.ModuleName: ibctransfer.AppModuleBasic{}.DefaultGenesis(cdc),
icatypes.ModuleName: cdc.MustMarshalJSON(icaGenesis),
ibcfeetypes.ModuleName: ibcfee.AppModuleBasic{}.DefaultGenesis(cdc),
Expand Down
12 changes: 0 additions & 12 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/group"
groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
Expand Down Expand Up @@ -113,7 +111,6 @@ type AppKeepers struct {
FeeGrantKeeper feegrantkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
AuthzKeeper authzkeeper.Keeper
GroupKeeper groupkeeper.Keeper
RollingseedKeeper rollingseedkeeper.Keeper
OracleKeeper oraclekeeper.Keeper
TSSKeeper *tsskeeper.Keeper
Expand Down Expand Up @@ -336,15 +333,6 @@ func NewAppKeeper(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

groupConfig := group.DefaultConfig()
appKeepers.GroupKeeper = groupkeeper.NewKeeper(
appKeepers.keys[group.StoreKey],
appCodec,
bApp.MsgServiceRouter(),
appKeepers.AccountKeeper,
groupConfig,
)

govConfig := govtypes.DefaultConfig()
// set the MaxMetadataLen for proposals to the same value as it was pre-sdk v0.47.x
govConfig.MaxMetadataLen = 10200
Expand Down
2 changes: 0 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/group"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
Expand Down Expand Up @@ -57,7 +56,6 @@ func (appKeepers *AppKeepers) GenerateKeys() {
feegrant.StoreKey,
authzkeeper.StoreKey,
icahosttypes.StoreKey,
group.StoreKey,
oracletypes.StoreKey,
globalfeetypes.StoreKey,
ibcfeetypes.StoreKey,
Expand Down
7 changes: 0 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/group"
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
"github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
sdkparams "github.com/cosmos/cosmos-sdk/x/params"
Expand Down Expand Up @@ -152,7 +150,6 @@ func appModules(
ibctm.NewAppModule(),
sdkparams.NewAppModule(app.ParamsKeeper),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
oracle.NewAppModule(
appCodec,
app.OracleKeeper,
Expand Down Expand Up @@ -256,7 +253,6 @@ func simulationModules(
sdkparams.NewAppModule(app.ParamsKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
oracle.NewAppModule(
appCodec,
app.OracleKeeper,
Expand Down Expand Up @@ -296,7 +292,6 @@ func orderBeginBlockers() []string {
genutiltypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
group.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
Expand Down Expand Up @@ -338,7 +333,6 @@ func orderEndBlockers() []string {
evidencetypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
group.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
Expand Down Expand Up @@ -374,7 +368,6 @@ func orderInitBlockers() []string {
evidencetypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
group.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
Expand Down
17 changes: 0 additions & 17 deletions app/upgrades/v3/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/group"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/bandprotocol/chain/v3/app/upgrades"
Expand Down Expand Up @@ -45,7 +44,6 @@ var Upgrade = upgrades.Upgrade{
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: storetypes.StoreUpgrades{
Added: []string{
group.StoreKey,
globalfeetypes.StoreKey,
consensusparamtypes.StoreKey,
crisistypes.StoreKey,
Expand Down Expand Up @@ -77,21 +75,6 @@ var ICAAllowMessages = []string{
sdk.MsgTypeURL(&govv1beta1.MsgSubmitProposal{}),
sdk.MsgTypeURL(&govv1beta1.MsgDeposit{}),
sdk.MsgTypeURL(&govv1beta1.MsgVote{}),
// Change: add messages from Group module
sdk.MsgTypeURL(&group.MsgCreateGroupPolicy{}),
sdk.MsgTypeURL(&group.MsgCreateGroupWithPolicy{}),
sdk.MsgTypeURL(&group.MsgCreateGroup{}),
sdk.MsgTypeURL(&group.MsgExec{}),
sdk.MsgTypeURL(&group.MsgLeaveGroup{}),
sdk.MsgTypeURL(&group.MsgSubmitProposal{}),
sdk.MsgTypeURL(&group.MsgUpdateGroupAdmin{}),
sdk.MsgTypeURL(&group.MsgUpdateGroupMembers{}),
sdk.MsgTypeURL(&group.MsgUpdateGroupMetadata{}),
sdk.MsgTypeURL(&group.MsgUpdateGroupPolicyAdmin{}),
sdk.MsgTypeURL(&group.MsgUpdateGroupPolicyDecisionPolicy{}),
sdk.MsgTypeURL(&group.MsgUpdateGroupPolicyMetadata{}),
sdk.MsgTypeURL(&group.MsgVote{}),
sdk.MsgTypeURL(&group.MsgWithdrawProposal{}),
// Change: add messages from Oracle module
sdk.MsgTypeURL(&oracletypes.MsgActivate{}),
sdk.MsgTypeURL(&oracletypes.MsgCreateDataSource{}),
Expand Down
10 changes: 5 additions & 5 deletions client/grpc/oracle/proof/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ var relayFormat = []byte(`
},
{
"internalType": "bytes32",
"name": "paramsStoreMerkleHash",
"name": "mintStoreMerkleHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "icahostToMintStoresMerkleHash",
"name": "paramsToRestakeStoresMerkleHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "restakeToStakingStoresMerkleHash",
"name": "rollingseedToTransferStoresMerkleHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "transferToUpgradeStoresMerkleHash",
"name": "tssToUpgradeStoresMerkleHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "authToIbcStoresMerkleHash",
"name": "authToIcahostStoresMerkleHash",
"type": "bytes32"
}
],
Expand Down
36 changes: 18 additions & 18 deletions client/grpc/oracle/proof/multi_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ import (

// MultiStoreProofEthereum is an Ethereum version of MultiStoreProof for solidity ABI-encoding.
type MultiStoreProofEthereum struct {
OracleIAVLStateHash common.Hash
ParamsStoreMerkleHash common.Hash
IcahostToMintStoresMerkleHash common.Hash
RestakeToStakingStoresMerkleHash common.Hash
TransferToUpgradeStoresMerkleHash common.Hash
AuthToIbcStoresMerkleHash common.Hash
OracleIAVLStateHash common.Hash
MintStoreMerkleHash common.Hash
ParamsToRestakeStoresMerkleHash common.Hash
RollingseedToTransferStoresMerkleHash common.Hash
TssToUpgradeStoresMerkleHash common.Hash
AuthToIcahostStoresMerkleHash common.Hash
}

func (m *MultiStoreProof) encodeToEthFormat() MultiStoreProofEthereum {
return MultiStoreProofEthereum{
OracleIAVLStateHash: common.BytesToHash(m.OracleIAVLStateHash),
ParamsStoreMerkleHash: common.BytesToHash(m.ParamsStoreMerkleHash),
IcahostToMintStoresMerkleHash: common.BytesToHash(m.IcahostToMintStoresMerkleHash),
RestakeToStakingStoresMerkleHash: common.BytesToHash(m.RestakeToStakingStoresMerkleHash),
TransferToUpgradeStoresMerkleHash: common.BytesToHash(m.TransferToUpgradeStoresMerkleHash),
AuthToIbcStoresMerkleHash: common.BytesToHash(m.AuthToIbcStoresMerkleHash),
OracleIAVLStateHash: common.BytesToHash(m.OracleIAVLStateHash),
MintStoreMerkleHash: common.BytesToHash(m.MintStoreMerkleHash),
ParamsToRestakeStoresMerkleHash: common.BytesToHash(m.ParamsToRestakeStoresMerkleHash),
RollingseedToTransferStoresMerkleHash: common.BytesToHash(m.RollingseedToTransferStoresMerkleHash),
TssToUpgradeStoresMerkleHash: common.BytesToHash(m.TssToUpgradeStoresMerkleHash),
AuthToIcahostStoresMerkleHash: common.BytesToHash(m.AuthToIcahostStoresMerkleHash),
}
}

// GetMultiStoreProof compacts Multi store proof from Tendermint to MultiStoreProof version.
func GetMultiStoreProof(multiStoreEp *ics23.ExistenceProof) MultiStoreProof {
return MultiStoreProof{
OracleIAVLStateHash: tmbytes.HexBytes(multiStoreEp.Value),
ParamsStoreMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[0].Suffix),
IcahostToMintStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[1].Prefix[1:]),
RestakeToStakingStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[2].Suffix),
TransferToUpgradeStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[3].Suffix),
AuthToIbcStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[4].Prefix[1:]),
OracleIAVLStateHash: tmbytes.HexBytes(multiStoreEp.Value),
MintStoreMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[0].Prefix[1:]),
ParamsToRestakeStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[1].Suffix),
RollingseedToTransferStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[2].Suffix),
TssToUpgradeStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[3].Suffix),
AuthToIcahostStoresMerkleHash: tmbytes.HexBytes(multiStoreEp.Path[4].Prefix[1:]),
}
}
18 changes: 9 additions & 9 deletions client/grpc/oracle/proof/multi_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ query at localhost:26657/abci_query?path="/store/oracle/key"&data=0xc00000000000
{
"type": "ics23:iavl",
"key": "wAAAAAAAAAA=",
"data": "EpADCgjAAAAAAAAAABK2AQoBBhIdCBAQEBiAAiCABChkMNCGA0ADSEZQgOCllrsRWAEaDAgBGAEgASoEAAKYASIsCAESBQQG7hAgGiEgL9OKizGo0Z4tLP9KaLTbPfPi2jAZVEgXXK18Znu4V9EiKggBEiYGCu4QIGlHkf33ommIkdMfhPuQ14UG07Xp7lKmlq9ZNJSfVOlzICIqCAESJggY0GcgWmuKQaZpAh5otqBxJfSoJWrASawo/qPB1V5shwYbbgYgGsoBCgHwEgZvcmFjbGUaCwgBGAEgASoDAAICIiwIARIFAgTuECAaISAeDSwCB2vKaX7NoctkSGZ+6OCw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EIE+ms2MlXWKvAFKRT3fs="
"data": "Cv4BCgZvcmFjbGUSILWuAqi7QA1Y943STZKRzdhqI/oM/3sihXiy0WvbYyjtGgkIARgBIAEqAQAiJQgBEiEBXVOth1oJa51+x41GKsXabapY7uL7OJssOImGEiPT298iJwgBEgEBGiDAh+1I3Z5vtDdvCoqbjqdXtDqMS2OQUuNb9RLtMehqtiInCAESAQEaIDqK5Rpdb442lPE4nvtBIBBC+gc6duYo7pQ4EWrTGTZjIicIARIBARogxinvyHFSBjSggcRdbDRvGaaNqaNLpwZ36rA6wxPCgW8iJQgBEiEBPO/QdDCqwo6da1w04OySSpstZJxfeGYlKuwfwmlBFOI="
}
]
},
"height": "6632",
"height": "139",
"codespace": ""
}
}
Expand All @@ -49,7 +49,7 @@ query at localhost:26657/abci_query?path="/store/oracle/key"&data=0xc00000000000
func TestGetMultiStoreProof(t *testing.T) {
key := []byte("oracle")
data := base64ToBytes(
"Cv4BCgZvcmFjbGUSIKlGw34VS+Fki9oMhwxL5Augva71DvOvN6SD4WqsMjAjGgkIARgBIAEqAQAiJwgBEgEBGiCI0bT8lYEcR7qf3dcswRSJQN0ZgJdSo0ioy2uIsi/bZSIlCAESIQFjDp0uLX5qOZ6OLF4/FVCnrviBSSHovSU4TVjJiaS2myInCAESAQEaICjBhguC1q2OSs82GtyruVNh5egqJ15XXOcnOk6HMuJcIicIARIBARogaTJx7rOygthReqj7mtQImvchyp0oRDKbBMhhEN/zjpUiJQgBEiEB8dVwesb0WvvZh6/6bec9nDEIE+ms2MlXWKvAFKRT3fs=",
"Cv4BCgZvcmFjbGUSILWuAqi7QA1Y943STZKRzdhqI/oM/3sihXiy0WvbYyjtGgkIARgBIAEqAQAiJQgBEiEBXVOth1oJa51+x41GKsXabapY7uL7OJssOImGEiPT298iJwgBEgEBGiDAh+1I3Z5vtDdvCoqbjqdXtDqMS2OQUuNb9RLtMehqtiInCAESAQEaIDqK5Rpdb442lPE4nvtBIBBC+gc6duYo7pQ4EWrTGTZjIicIARIBARogxinvyHFSBjSggcRdbDRvGaaNqaNLpwZ36rA6wxPCgW8iJQgBEiEBPO/QdDCqwo6da1w04OySSpstZJxfeGYlKuwfwmlBFOI=",
)

var multistoreOps storetypes.CommitmentOp
Expand All @@ -74,19 +74,19 @@ func TestGetMultiStoreProof(t *testing.T) {
prefix = append(prefix, 32) // size of result hash must be 32

apphash := innerHash(
m.AuthToIbcStoresMerkleHash,
m.AuthToIcahostStoresMerkleHash,
innerHash(
innerHash(
innerHash(
m.IcahostToMintStoresMerkleHash,
innerHash(
m.MintStoreMerkleHash,
leafHash(append(prefix, tmhash.Sum(m.OracleIAVLStateHash)...)),
m.ParamsStoreMerkleHash,
),
m.ParamsToRestakeStoresMerkleHash,
),
m.RestakeToStakingStoresMerkleHash,
m.RollingseedToTransferStoresMerkleHash,
),
m.TransferToUpgradeStoresMerkleHash,
m.TssToUpgradeStoresMerkleHash,
),
)

Expand Down
Loading
Loading