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: block distribution module account to receive ZETA #1522

Merged
merged 6 commits into from
Jan 4, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 20 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ var (
emissionsModuleTypes.UndistributedObserverRewardsPool: nil,
emissionsModuleTypes.UndistributedTssRewardsPool: nil,
}

// module accounts that are NOT allowed to receive tokens
blockedReceivingModAcc = map[string]bool{
kingpinXD marked this conversation as resolved.
Show resolved Hide resolved
distrtypes.ModuleName: true,
authtypes.FeeCollectorName: true,
stakingtypes.BondedPoolName: true,
stakingtypes.NotBondedPoolName: true,
govtypes.ModuleName: true,
}
)

var _ simapp.App = (*App)(nil)
Expand Down Expand Up @@ -306,8 +315,9 @@ func New(
maccPerms,
sdk.GetConfig().GetBech32AccountAddrPrefix(),
)
logger.Info("bank keeper blocklist addresses", "addresses", app.BlockedAddrs())
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), nil,
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.BlockedAddrs(),
)
stakingKeeper := stakingkeeper.NewKeeper(
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
Expand Down Expand Up @@ -780,3 +790,12 @@ func VerifyAddressFormat(bz []byte) error {
func (app *App) SimulationManager() *module.SimulationManager {
return app.sm
}

func (app *App) BlockedAddrs() map[string]bool {
blockList := make(map[string]bool)
for k, v := range blockedReceivingModAcc {
addr := authtypes.NewModuleAddress(k)
blockList[addr.String()] = v
}
return blockList
}
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* add check to verify new tss has been produced when triggering tss funds migration
* fix Athens-3 log print issue - avoid posting uncessary outtx confirmation
* fix docker build issues with version: golang:1.20-alpine3.18
* [1522](https://github.com/zeta-chain/node/pull/1522/files) - block `distribution` module account from receiving zeta

### Refactoring

Expand Down