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

Private/cosmos v50 #153

Merged
merged 63 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
fed15cf
cosmossdk.io/log
yoosah Sep 5, 2024
bffefdb
cosmossdk.io/store
yoosah Sep 5, 2024
3f18888
cosmossdk.io/x/feegrant
yoosah Sep 5, 2024
f860e40
cosmossdk.io/x/evidence
yoosah Sep 5, 2024
e820996
cosmossdk.io/x/upgrade
yoosah Sep 5, 2024
b28fe2d
ibc v8
yoosah Sep 5, 2024
a90ae3c
github.com/cosmos/ibc-go/modules/capability
yoosah Sep 5, 2024
8d4f0e4
cosmos-sdk/client/grpc/cmtservice
yoosah Sep 5, 2024
b66a85f
remove ibcclientclient, upgradeclient
yoosah Sep 6, 2024
839afb6
packet-forward-middleware v8
yoosah Sep 5, 2024
84913e7
bump cosmos-sdk v0.50.7
yoosah Sep 5, 2024
a9bf595
formatting
yoosah Sep 6, 2024
889fbfe
x/reward
yoosah Sep 9, 2024
2a8ae53
x/volunteer
yoosah Sep 10, 2024
2f688cc
x/staking
yoosah Sep 11, 2024
2d9b1cc
temp fix ante
yoosah Sep 11, 2024
d366cc1
app.go
yoosah Sep 12, 2024
136fb1a
fix app/keeper
yoosah Sep 13, 2024
4594fa4
app/keeper cont.
yoosah Sep 19, 2024
622888d
app/keeper cont.
yoosah Sep 30, 2024
81288b8
app/keeper cont.
yoosah Oct 2, 2024
59a4db4
mintkeeper for reward
yoosah Oct 7, 2024
d04a957
app/keeper/keys.go
yoosah Oct 8, 2024
9073bee
remove past upgrade
yoosah Oct 8, 2024
836c9ee
app/export.go
yoosah Oct 8, 2024
4c61950
app/modules.go
yoosah Oct 10, 2024
6384b58
app/params
yoosah Oct 11, 2024
b728ef3
app/app.go
yoosah Oct 11, 2024
6857324
app/helpers/test_helpers.go
yoosah Oct 11, 2024
8ac5282
update buf deps
yoosah Oct 11, 2024
7173427
cmd
yoosah Oct 11, 2024
681e41f
ante
yoosah Oct 11, 2024
aac1824
app.go cont.
yoosah Oct 14, 2024
f0e4305
tests/integration/testutil
yoosah Oct 15, 2024
0760b8f
temporary comment out for build
yoosah Oct 15, 2024
00520a1
apply cosmos.msg.v1.service proto annotation
yoosah Oct 16, 2024
b0bacce
go1.23.0
yoosah Oct 17, 2024
ce9b685
refine CreateTestInput
yoosah Oct 18, 2024
b19628a
apply custom getsigner
yoosah Oct 21, 2024
28ae307
x/reward test build
yoosah Oct 21, 2024
35728c7
cmd test build
yoosah Oct 21, 2024
19677b3
ante test build
yoosah Oct 21, 2024
4e4e06f
fix test ante
yoosah Oct 21, 2024
08d64c4
tests build
yoosah Oct 22, 2024
d19fe2e
tests/e2e build
yoosah Oct 22, 2024
2eb9931
tests all build
yoosah Oct 23, 2024
4789154
fix tests/integration params
yoosah Oct 24, 2024
23779d6
fix tests/staking
yoosah Oct 25, 2024
6da96d6
dockerfile
yoosah Oct 28, 2024
a7ad0f0
fix e2e test validator address type
yoosah Oct 29, 2024
0519a7b
fix GetVolunteerValidator
yoosah Oct 29, 2024
26eddcb
fix test tests/integration/reward
yoosah Oct 30, 2024
ccd497c
update go.mod
yoosah Oct 30, 2024
47ae416
update ethermint version
yoosah Oct 31, 2024
d4d3adb
update cosmos-sdk to v0.50.10-xpla
yoosah Oct 31, 2024
3b441da
update ledger-cosmos-go
yoosah Oct 31, 2024
ffc5242
add buildtag cgo for ledger
yoosah Oct 31, 2024
c115844
upgrade module for v1_7
yoosah Oct 31, 2024
d3e89cc
remove erc20 module
yoosah Nov 1, 2024
4432bc8
update protobuf dependencies
yoosah Nov 4, 2024
9681da3
remove erc20 docs
yoosah Nov 4, 2024
bdc1c71
clean testcache before test
yoosah Nov 4, 2024
7c2ddaf
formatting
yoosah Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
go-version: 1.23.x

- name: End-to-end test
run: cd tests/e2e && go test
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# docker run --rm -it --env-file=path/to/.env --name xpla-localnet xpladev/xpla

### BUILD
FROM golang:1.21-alpine3.17 AS build
FROM golang:1.23-alpine AS build

# Create appuser.
RUN adduser -D -g '' valiuser
# Install required binaries
RUN apk add --update --no-cache zip git make cmake build-base linux-headers musl-dev libc-dev
RUN apk add --update --no-cache zip git make cmake build-base linux-headers musl-dev libc-dev binutils-gold

WORKDIR /
RUN git clone --depth 1 https://github.com/microsoft/mimalloc; cd mimalloc; mkdir build; cd build; cmake ..; make -j$(nproc); make install
Expand All @@ -23,11 +23,11 @@ WORKDIR /workspace
# Copy source files
COPY . .
# Download dependencies and CosmWasm libwasmvm if found.
RUN set -eux; \
RUN set -eux; \
export ARCH=$(uname -m); \
WASM_VERSION=$(go list -mod=readonly -m all | grep github.com/CosmWasm/wasmvm | awk '{print $2}'); \
if [ ! -z "${WASM_VERSION}" ]; then \
wget -O /lib/libwasmvm_muslc.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.${ARCH}.a; \
wget -O /lib/libwasmvm_muslc.${ARCH}.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.${ARCH}.a; \
fi; \
go mod download;

Expand Down
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ifeq ($(LEDGER_ENABLED),true)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
build_tags += ledger cgo
endif
else
UNAME_S = $(shell uname -s)
Expand All @@ -46,7 +46,7 @@ ifeq ($(LEDGER_ENABLED),true)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
build_tags += ledger cgo
endif
endif
endif
Expand Down Expand Up @@ -141,7 +141,8 @@ build-release-arm64: go.sum $(BUILDDIR)/

.PHONY: test
test: go.sum
go test -short ./...
go clean -testcache
go test -short -p 1 ./...

go.sum: go.mod
@go mod verify
Expand All @@ -150,7 +151,7 @@ go.sum: go.mod
###############################################################################
### Protobuf ###
###############################################################################
PROTO_VERSION=0.11.6
PROTO_VERSION=0.13.0
PROTO_BUILDER_IMAGE=ghcr.io/cosmos/proto-builder:$(PROTO_VERSION)
PROTO_FORMATTER_IMAGE=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace --user 0 $(PROTO_BUILDER_IMAGE)

Expand All @@ -170,3 +171,7 @@ proto-swagger-gen:

proto-lint:
$(PROTO_FORMATTER_IMAGE) buf lint --error-format=json

proto-update-deps:
@echo "Updating Protobuf dependencies"
$(DOCKER) run --rm -v $(CURDIR)/proto:/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) buf mod update
66 changes: 32 additions & 34 deletions ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,52 @@ import (
"fmt"
"runtime/debug"

ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"

corestoretypes "cosmossdk.io/core/store"
errorsmod "cosmossdk.io/errors"
tmlog "github.com/cometbft/cometbft/libs/log"
tmlog "cosmossdk.io/log"
//storetypes "cosmossdk.io/store/types"
txsigning "cosmossdk.io/x/tx/signing"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"

evmante "github.com/xpladev/ethermint/app/ante"
evmtypes "github.com/xpladev/ethermint/x/evm/types"

volunteerante "github.com/xpladev/xpla/x/volunteer/ante"
)

// HandlerOptions extend the SDK's AnteHandler opts by requiring the IBC
// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
// channel keeper.
type HandlerOptions struct {
Cdc codec.BinaryCodec
AccountKeeper evmtypes.AccountKeeper
BankKeeper evmtypes.BankKeeper
IBCKeeper *ibckeeper.Keeper
EvmKeeper evmante.EVMKeeper
FeegrantKeeper authante.FeegrantKeeper
VolunteerKeeper volunteerante.VolunteerKeeper
ExtensionOptionChecker authante.ExtensionOptionChecker
SignModeHandler authsigning.SignModeHandler
FeegrantKeeper authante.FeegrantKeeper
SignModeHandler *txsigning.HandlerMap
SigGasConsumer authante.SignatureVerificationGasConsumer
FeeMarketKeeper evmante.FeeMarketKeeper
MaxTxGasWanted uint64
TxFeeChecker authante.TxFeeChecker

BypassMinFeeMsgTypes []string
TxCounterStoreKey storetypes.StoreKey
WasmKeeper *wasmkeeper.Keeper
WasmConfig wasmTypes.WasmConfig

AccountKeeper evmtypes.AccountKeeper
BankKeeper evmtypes.BankKeeper
Codec codec.BinaryCodec
IBCKeeper *ibckeeper.Keeper
EvmKeeper evmante.EVMKeeper
VolunteerKeeper volunteerante.VolunteerKeeper
BypassMinFeeMsgTypes []string
FeeMarketKeeper evmante.FeeMarketKeeper
MaxTxGasWanted uint64
TxFeeChecker authante.TxFeeChecker
TXCounterStoreService corestoretypes.KVStoreService
WasmConfig *wasmtypes.WasmConfig
}

var disabledAuthzMsgs = []string{
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
sdk.MsgTypeURL(&vestingtypes.MsgCreateVestingAccount{}),
}

// NewAnteHandler returns an 'AnteHandler' that will run actions before a tx is sent to a module's handler.
Expand All @@ -62,7 +61,7 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
return nil, errorsmod.Wrap(errortypes.ErrLogic, "bank keeper is required for AnteHandler")
}
if opts.SignModeHandler == nil {
return nil, errorsmod.Wrap(errortypes.ErrLogic, "sign mode handler is required for ante builder")
return nil, errorsmod.Wrap(errortypes.ErrLogic, "sign mode handler is required for AnteHandler")
}
if opts.IBCKeeper == nil {
return nil, errorsmod.Wrap(errortypes.ErrLogic, "IBC keeper is required for AnteHandler")
Expand All @@ -74,7 +73,7 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
return nil, errorsmod.Wrap(errortypes.ErrLogic, "Feegrant keeper is required for AnteHandler")
}
if opts.FeeMarketKeeper == nil {
return nil, errorsmod.Wrap(errortypes.ErrLogic, "Feemarket keeper is required for AnteHandler")
return nil, errorsmod.Wrap(errortypes.ErrLogic, "FeeMarket keeper is required for AnteHandler")
}
if opts.VolunteerKeeper == nil {
return nil, errorsmod.Wrap(errortypes.ErrLogic, "staking keeper is required for AnteHandler")
Expand Down Expand Up @@ -125,7 +124,7 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
}

func newCosmosAnteHandler(opts HandlerOptions) sdk.AnteHandler {
var sigGasConsumer = opts.SigGasConsumer
sigGasConsumer := opts.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = SigVerificationGasConsumer
}
Expand All @@ -136,10 +135,9 @@ func newCosmosAnteHandler(opts HandlerOptions) sdk.AnteHandler {
evmante.NewAuthzLimiterDecorator(disabledAuthzMsgs),
volunteerante.NewRejectDelegateVolunteerValidatorDecorator(opts.VolunteerKeeper),
authante.NewSetUpContextDecorator(), // second decorator. SetUpContext must be called before other decorators
authante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
wasmkeeper.NewLimitSimulationGasDecorator(opts.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(opts.TxCounterStoreKey),
wasmkeeper.NewGasRegisterDecorator(opts.WasmKeeper.GetGasRegister()),
wasmkeeper.NewCountTXDecorator(opts.TXCounterStoreService),
authante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
NewMinGasPriceDecorator(opts.FeeMarketKeeper, opts.EvmKeeper, opts.BypassMinFeeMsgTypes),
authante.NewValidateBasicDecorator(),
authante.NewTxTimeoutHeightDecorator(),
Expand All @@ -150,7 +148,7 @@ func newCosmosAnteHandler(opts HandlerOptions) sdk.AnteHandler {
authante.NewValidateSigCountDecorator(opts.AccountKeeper),
authante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer),
authante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler),
authante.NewIncrementSequenceDecorator(opts.AccountKeeper), // innermost AnteDecorator
authante.NewIncrementSequenceDecorator(opts.AccountKeeper),
ibcante.NewRedundantRelayDecorator(opts.IBCKeeper),
evmante.NewGasWantedDecorator(opts.EvmKeeper, opts.FeeMarketKeeper),
}
Expand Down
16 changes: 10 additions & 6 deletions ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/stretchr/testify/suite"

xplaapp "github.com/xpladev/xpla/app"
Expand All @@ -40,7 +40,7 @@ func (s *IntegrationTestSuite) SetupTest() {

app := xplahelpers.Setup(s.T(), chainId)

ctx := app.BaseApp.NewContext(false, tmproto.Header{
ctx := app.BaseApp.NewUncachedContext(false, tmproto.Header{
ChainID: chainId,
Height: 1,
})
Expand All @@ -54,13 +54,16 @@ func (s *IntegrationTestSuite) SetupTest() {
s.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig)
}

func (s *IntegrationTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (xauthsigning.Tx, error) {
func (s *IntegrationTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (authsigning.Tx, error) {
var sigsV2 []signing.SignatureV2
defaultSignMode, err := authsigning.APISignModeToInternal(s.clientCtx.TxConfig.SignModeHandler().DefaultMode())
s.Require().NoError(err)

for i, priv := range privs {
sigV2 := signing.SignatureV2{
PubKey: priv.PubKey(),
Data: &signing.SingleSignatureData{
SignMode: s.clientCtx.TxConfig.SignModeHandler().DefaultMode(),
SignMode: defaultSignMode,
Signature: nil,
},
Sequence: accSeqs[i],
Expand All @@ -75,13 +78,14 @@ func (s *IntegrationTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums

sigsV2 = []signing.SignatureV2{}
for i, priv := range privs {
signerData := xauthsigning.SignerData{
signerData := authsigning.SignerData{
ChainID: chainID,
AccountNumber: accNums[i],
Sequence: accSeqs[i],
}
sigV2, err := tx.SignWithPrivKey(
s.clientCtx.TxConfig.SignModeHandler().DefaultMode(),
s.ctx,
defaultSignMode,
signerData,
s.txBuilder,
priv,
Expand Down
9 changes: 6 additions & 3 deletions ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package ante
import (
"math/big"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"

tmstrings "github.com/cometbft/cometbft/libs/strings"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -31,7 +34,7 @@ func NewMinGasPriceDecorator(fk ethermintante.FeeMarketKeeper, ek ethermintante.
func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
}

minGasPrice := mpd.feesKeeper.GetParams(ctx).MinGasPrice
Expand All @@ -57,7 +60,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate

// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(gas))
gasLimit := sdkmath.LegacyNewDecFromBigInt(new(big.Int).SetUint64(gas))

for _, gp := range minGasPrices {
fee := gp.Amount.Mul(gasLimit).Ceil().RoundInt()
Expand All @@ -67,7 +70,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
}

if !feeCoins.IsAnyGTE(requiredFees) {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "provided fee < minimum global fee (%s < %s). Please increase the gas price.", feeCoins, requiredFees)
return ctx, errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "provided fee < minimum global fee (%s < %s). Please increase the gas price.", feeCoins, requiredFees)
}

return next(ctx, tx, simulate)
Expand Down
13 changes: 8 additions & 5 deletions ante/fee_test.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
package ante_test

import (
sdkmath "cosmossdk.io/math"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
ibcchanneltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"

ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcchanneltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"

feemarkettypes "github.com/xpladev/ethermint/x/feemarket/types"

"github.com/xpladev/xpla/ante"
)

func (s *IntegrationTestSuite) TestMinGasPriceDecorator() {
s.SetupTest()
s.txBuilder = s.clientCtx.TxConfig.NewTxBuilder()

s.app.FeeMarketKeeper.SetParams(s.ctx, feemarkettypes.NewParams(true, 8, 2, 0, 0, sdk.NewDec(200), sdk.MustNewDecFromStr("1.5")))
s.app.FeeMarketKeeper.SetParams(s.ctx, feemarkettypes.NewParams(true, 8, 2, 0, 0, sdkmath.LegacyNewDec(200), sdkmath.LegacyMustNewDecFromStr("1.5")))

mpd := ante.NewMinGasPriceDecorator(
s.app.FeeMarketKeeper,
Expand All @@ -40,7 +43,7 @@ func (s *IntegrationTestSuite) TestMinGasPriceDecorator() {
s.Require().NoError(err)

// Set high gas price so standard test fee fails
feeAmt := sdk.NewDecCoinFromDec("uatom", sdk.NewDec(200).Quo(sdk.NewDec(100000)))
feeAmt := sdk.NewDecCoinFromDec("uatom", sdkmath.LegacyNewDec(200).Quo(sdkmath.LegacyNewDec(100000)))
minGasPrice := []sdk.DecCoin{feeAmt}
s.ctx = s.ctx.WithMinGasPrices(minGasPrice).WithIsCheckTx(true)

Expand Down
12 changes: 7 additions & 5 deletions ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package ante
import (
"fmt"

errorsmod "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand All @@ -34,7 +36,7 @@ const (
//
// - multisig (Cosmos SDK multisigs)
func SigVerificationGasConsumer(
meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params,
meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params,
) error {
pubkey := sig.PubKey
switch pubkey := pubkey.(type) {
Expand All @@ -45,7 +47,7 @@ func SigVerificationGasConsumer(

case *ed25519.PubKey:
meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519")
return sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "ED25519 public keys are unsupported")
return errorsmod.Wrap(sdkerrors.ErrInvalidPubKey, "ED25519 public keys are unsupported")

case *secp256k1.PubKey:
meter.ConsumeGas(params.SigVerifyCostSecp256k1, "ante verify: secp256k1")
Expand All @@ -63,13 +65,13 @@ func SigVerificationGasConsumer(
return ConsumeMultisignatureVerificationGas(meter, multisignature, pubkey, params, sig.Sequence)

default:
return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized/unsupported public key type: %T", pubkey)
return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized/unsupported public key type: %T", pubkey)
}
}

// ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubkey signature
func ConsumeMultisignatureVerificationGas(
meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey,
meter storetypes.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey,
params authtypes.Params, accSeq uint64,
) error {
size := sig.BitArray.Count()
Expand Down
Loading
Loading