Skip to content

Commit

Permalink
add security param check to remove schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Sep 4, 2024
1 parent 46207d9 commit 2d2a169
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Binary file modified contracts/neutron_chain_manager.wasm
Binary file not shown.
9 changes: 6 additions & 3 deletions x/cron/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ func (k msgServer) RemoveSchedule(goCtx context.Context, req *types.MsgRemoveSch
return nil, errors.Wrap(err, "failed to validate MsgRemoveSchedule")
}

ctx := sdk.UnwrapSDKContext(goCtx)

params := k.keeper.GetParams(ctx)

authority := k.keeper.GetAuthority()
if authority != req.Authority {
return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority)
if authority != req.Authority && params.SecurityAddress != req.Authority {
return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority: only admin or security dao can remove schedule; expected %s or %s, got %s", authority, params.SecurityAddress, req.Authority)
}

ctx := sdk.UnwrapSDKContext(goCtx)
k.keeper.RemoveSchedule(ctx, req.Name)

return &types.MsgRemoveScheduleResponse{}, nil
Expand Down

0 comments on commit 2d2a169

Please sign in to comment.