Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Oct 31, 2024
1 parent 45f0757 commit c92be0c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion x/asset/keeper/msg_server_authorize_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (ms msgServer) AuthorizeAddress(goCtx context.Context, msg *types.MsgAuthor
}

// assert that the manager account is the only signer of the message
if sdk.AccAddress(signers[0]).String() != token.Manager {
if msg.Manager != token.Manager {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "caller not authorized")
}

Expand Down
2 changes: 1 addition & 1 deletion x/asset/keeper/msg_server_un_authorize_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (ms msgServer) UnAuthorizeAddress(goCtx context.Context, msg *types.MsgUnAu
}

// assert that the manager account is the only signer of the message
if sdk.AccAddress(signers[0]).String() != token.Manager {
if msg.Manager != token.Manager {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "caller not authorized")
}

Expand Down
8 changes: 1 addition & 7 deletions x/asset/keeper/msg_server_update_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ func (ms msgServer) UpdateToken(goCtx context.Context, msg *types.MsgUpdateToken
return nil, errorsmod.Wrapf(sdkerrors.ErrKeyNotFound, "symbol %s does not exists: %s", msg.Symbol, err.Error())
}

// Checks if the token manager signed
signers, _, err := ms.cdc.GetMsgV1Signers(msg)
if err != nil {
return nil, err
}

// assert that the manager account is the only signer of the message
if sdk.AccAddress(signers[0]).String() != existing.Manager {
if msg.Manager != existing.Manager {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "caller not authorized")
}

Expand Down
4 changes: 3 additions & 1 deletion x/bridge/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -45,7 +46,8 @@ func BeginBlocker(goCtx context.Context, k keeper.Keeper) error {
epochInfo.CurrentEpochStartTime = epochInfo.CurrentEpochStartTime.Add(epochInfo.Duration)

err = k.RegisteredCoins.Walk(goCtx, nil, func(denom string, ratelimit types.RateLimit) (stop bool, err error) {
ratelimit.ResetInflow()
// Reset Inflow
ratelimit.CurrentInflow = math.ZeroInt()
err = k.RegisteredCoins.Set(goCtx, denom, ratelimit)
if err != nil {
k.Logger(goCtx).Error(fmt.Sprintf("Error reset ratelimit with denom %s at height %d", denom, epochInfo.CurrentEpochStartHeight))
Expand Down
4 changes: 0 additions & 4 deletions x/bridge/types/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,3 @@ func (r *RateLimit) CheckAddInflowThreshold(amount math.Int) error {
r.CurrentInflow = netInflow
return nil
}

func (r *RateLimit) ResetInflow() {
r.CurrentInflow = math.ZeroInt()
}

0 comments on commit c92be0c

Please sign in to comment.