Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 committed Sep 13, 2024
1 parent cc24927 commit 3088243
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/create_account_decorator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -30,7 +31,7 @@ func CtxKeyNewAccount(acc string) string {
func (cad createAccountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
sigTx, ok := tx.(authsigning.SigVerifiableTx)
if !ok {
return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid tx type")
return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid tx type")
}

pubkeys, err := sigTx.GetPubKeys()
Expand Down
11 changes: 6 additions & 5 deletions app/sigcheck_decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"fmt"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand All @@ -23,7 +24,7 @@ func NewSigCheckDecorator(ak accountKeeper, signModeHandler authsigning.SignMode
func (svd sigCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
sigTx, ok := tx.(authsigning.SigVerifiableTx)
if !ok {
return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type")
return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type")
}

// stdSigs contains the sequence number, account number, and signatures.
Expand All @@ -37,7 +38,7 @@ func (svd sigCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate boo

// check that signer length and signature length are the same
if len(sigs) != len(signerAddrs) {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "invalid number of signer; expected: %d, got %d", len(signerAddrs), len(sigs))
return ctx, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "invalid number of signer; expected: %d, got %d", len(signerAddrs), len(sigs))
}

ibcRelayerMsg := isIBCRelayerMsg(tx.GetMsgs())
Expand All @@ -51,12 +52,12 @@ func (svd sigCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate boo
// retrieve pubkey
pubKey := acc.GetPubKey()
if !simulate && pubKey == nil {
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "pubkey on account is not set")
return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidPubKey, "pubkey on account is not set")
}

// Check account sequence number.
if sig.Sequence != acc.GetSequence() {
return ctx, sdkerrors.Wrapf(
return ctx, errorsmod.Wrapf(
sdkerrors.ErrWrongSequence,
"account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.Sequence,
)
Expand Down Expand Up @@ -95,7 +96,7 @@ func (svd sigCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate boo
} else {
errMsg = fmt.Sprintf("signature verification failed; please verify account number (%d) and chain-id (%s)", accNum, chainID)
}
return ctx, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, errMsg)
return ctx, errorsmod.Wrap(sdkerrors.ErrUnauthorized, errMsg)

}
}
Expand Down
1 change: 0 additions & 1 deletion scripts/ibc/setup_ibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ rly paths new "$SETTLEMENT_CHAIN_ID" "$ROLLAPP_CHAIN_ID" "$RELAYER_PATH" --src-p
dasel put -r yaml -f "$RLY_CONFIG_FILE" "chains.$SETTLEMENT_CHAIN_ID.value.http-addr" -v "$HUB_REST_URL";
dasel put -r yaml -f "$RLY_CONFIG_FILE" "chains.$SETTLEMENT_CHAIN_ID.value.is-dym-hub" -v true -t bool;
dasel put -r yaml -f "$RLY_CONFIG_FILE" "chains.$ROLLAPP_CHAIN_ID.value.is-dym-rollapp" -v true -t bool;
dasel put -r yaml -f "$RLY_CONFIG_FILE" "chains.$ROLLAPP_CHAIN_ID.value.trust-period" -v "240h"; # 10 days

rly tx link "$RELAYER_PATH" --src-port "$IBC_PORT" --dst-port "$IBC_PORT" --version "$IBC_VERSION" --max-clock-drift 70m

Expand Down
1 change: 1 addition & 0 deletions x/callback/keeper/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func (k Keeper) SaveCallback(ctx sdk.Context, callback types.Callback) error {
return k.Callbacks.Set(ctx, collections.Join3(callback.CallbackHeight, contractAddress.Bytes(), callback.JobId), callback)
}

// nolint: gosimple
func isAuthorizedToModify(ctx sdk.Context, k Keeper, contractAddress sdk.AccAddress, sender string) bool {
if k.bankKeeper.BlockedAddr(sdk.MustAccAddressFromBech32(sender)) { // Blocked addresses cannot create/delete callbacks as we cant refund to these addresses. And they are module accounts anyway
return false
Expand Down
1 change: 1 addition & 0 deletions x/cwerrors/keeper/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (k Keeper) PruneSubscriptionsEndBlock(ctx sdk.Context) (err error) {
return k.SubscriptionEndBlock.Clear(ctx, rng)
}

// nolint: gosimple
// isAuthorizedToSubscribe checks if the sender is authorized to subscribe to the contract
func isAuthorizedToSubscribe(ctx sdk.Context, k Keeper, contractAddress sdk.AccAddress, sender string) bool {
if strings.EqualFold(sender, contractAddress.String()) { // A contract can set subscriptions for itself
Expand Down

0 comments on commit 3088243

Please sign in to comment.