Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/api/buf.build/gen/go/c…
Browse files Browse the repository at this point in the history
…ometbft/cometbft/protocolbuffers/go-1.34.1-20240312114316-c0d3497e35d6.1
  • Loading branch information
tac0turtle committed May 15, 2024
2 parents 94e9a8f + 74f44b0 commit 4bd988c
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 3 deletions.
6 changes: 3 additions & 3 deletions testutil/mock/types_module_module.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions x/distribution/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ func SimulateMsgWithdrawDelegatorReward(txConfig client.TxConfig, ak types.Accou

msg := types.NewMsgWithdrawDelegatorReward(addr, validator.GetOperator())

// get outstanding rewards so we can first check if the withdrawable coins are sendable
outstanding, err := k.GetValidatorOutstandingRewardsCoins(ctx, sdk.ValAddress(delAddr))
if err != nil {
return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(&types.MsgWithdrawDelegatorReward{}), "error getting outstanding rewards"), nil, err
}

for _, v := range outstanding {
if !bk.IsSendEnabledDenom(ctx, v.Denom) {
return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "denom send not enabled: "+v.Denom), nil, nil
}
}

txCtx := simulation.OperationInput{
R: r,
App: app,
Expand Down
14 changes: 14 additions & 0 deletions x/distribution/testutil/expected_keepers_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions x/distribution/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type BankKeeper interface {
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error

BlockedAddr(addr sdk.AccAddress) bool
IsSendEnabledDenom(ctx context.Context, denom string) bool
}

// PoolKeeper defines the expected interface needed to fund & distribute pool balances.
Expand Down
8 changes: 8 additions & 0 deletions x/staking/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ func SimulateMsgUndelegate(
delAddr, val.GetOperator(), sdk.NewCoin(bondDenom, unbondAmt),
)

if !bk.IsSendEnabledDenom(ctx, bondDenom) {
return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "bond denom send not enabled"), nil, nil
}

// need to retrieve the simulation account associated with delegation to retrieve PrivKey
var simAccount simtypes.Account

Expand Down Expand Up @@ -712,6 +716,10 @@ func SimulateMsgBeginRedelegate(
return simtypes.NoOpMsg(types.ModuleName, msgType, "bond denom not found"), nil, err
}

if !bk.IsSendEnabledDenom(ctx, bondDenom) {
return simtypes.NoOpMsg(types.ModuleName, msgType, "bond denom send not enabled"), nil, nil
}

msg := types.NewMsgBeginRedelegate(
delAddr, srcVal.GetOperator(), destVal.GetOperator(),
sdk.NewCoin(bondDenom, redAmt),
Expand Down
14 changes: 14 additions & 0 deletions x/staking/testutil/expected_keepers_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions x/staking/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type BankKeeper interface {
DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error

BurnCoins(context.Context, []byte, sdk.Coins) error
IsSendEnabledDenom(ctx context.Context, denom string) bool
}

// ValidatorSet expected properties for the set of all validators (noalias)
Expand Down

0 comments on commit 4bd988c

Please sign in to comment.