Skip to content
Draft
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: 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/

### Breaking Changes

* (x/consensus) [#25607](https://github.com/cosmos/cosmos-sdk/pull/25607) Move authority management from individual module keepers to consensus params. Modules no longer accept an `authority` parameter in keeper constructors.
* [#25090](https://github.com/cosmos/cosmos-sdk/pull/25090) Moved deprecated modules to `./contrib`. These modules are still available but will no longer be actively maintained or supported in the Cosmos SDK Bug Bounty program.
* `x/group`
* `x/nft`
Expand Down
70 changes: 69 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,72 @@ Note, always read the **App Wiring Changes** section for more information on app

### TLDR

For a full list of changes, see the [Changelog](https://github.com/cosmos/cosmos-sdk/blob/release/v0.54.x/CHANGELOG.md).
For a full list of changes, see the [Changelog](https://github.com/cosmos/cosmos-sdk/blob/release/v0.54.x/CHANGELOG.md).

## Authority Parameter Removal

Authority management has been centralized to the `x/consensus` module. Individual module keepers no longer accept an `authority` parameter in their constructors.

### Affected Modules

The following modules have removed the `authority` parameter from their keeper constructors:

* `x/auth`
* `x/bank`
* `x/distribution`
* `x/gov`
* `x/mint`
* `x/protocolpool`
* `x/slashing`
* `x/staking`
* `x/upgrade`

### Migration

**Before:**

```go
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
runtime.NewKVStoreService(keys[banktypes.StoreKey]),
app.AccountKeeper,
blockedAddresses,
authtypes.NewModuleAddress(govtypes.ModuleName).String(), // authority parameter - REMOVE
logger,
)
```

**After:**

```go
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
runtime.NewKVStoreService(keys[banktypes.StoreKey]),
app.AccountKeeper,
blockedAddresses,
logger, // authority parameter removed
)
```

Apply this pattern to all affected modules listed above.

### How It Works

Modules now retrieve the authority from `ConsensusParams` via the context at runtime. The authority value is stored in consensus params and can be updated via governance proposals.

**Example - Authority Validation:**

```go
func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

// Retrieve and validate authority from consensus params
if sdkCtx.ConsensusParams().Authority.Authority != req.Authority {
return nil, errors.Wrapf(sdkerrors.ErrUnauthorized,
"invalid authority: expected %s, got %s",
req.Authority, sdkCtx.ConsensusParams().Authority.Authority)
}

// ... rest of the handler
}
```
162 changes: 128 additions & 34 deletions api/cosmos/consensus/v1/tx.pulsar.go

Large diffs are not rendered by default.

Loading
Loading