Skip to content

Commit

Permalink
app: fixed some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbeng committed Aug 15, 2024
1 parent 82217a6 commit f0cdae0
Show file tree
Hide file tree
Showing 57 changed files with 10,388 additions and 3,511 deletions.
2,640 changes: 2,640 additions & 0 deletions api/artela/evm/events.pulsar.go

Large diffs are not rendered by default.

6,879 changes: 6,879 additions & 0 deletions api/artela/evm/evm.pulsar.go

Large diffs are not rendered by default.

704 changes: 364 additions & 340 deletions api/artela/wordle/tx.pulsar.go → api/artela/fee/events.pulsar.go

Large diffs are not rendered by default.

594 changes: 0 additions & 594 deletions api/artela/wordle/genesis.pulsar.go

This file was deleted.

576 changes: 0 additions & 576 deletions api/artela/wordle/module/module.pulsar.go

This file was deleted.

498 changes: 0 additions & 498 deletions api/artela/wordle/params.pulsar.go

This file was deleted.

1,008 changes: 0 additions & 1,008 deletions api/artela/wordle/query.pulsar.go

This file was deleted.

112 changes: 0 additions & 112 deletions api/artela/wordle/query_grpc.pb.go

This file was deleted.

114 changes: 0 additions & 114 deletions api/artela/wordle/tx_grpc.pb.go

This file was deleted.

3 changes: 2 additions & 1 deletion app/ante/cosmos/fee_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
cosmos "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -190,7 +191,7 @@ func checkFeeCoinsAgainstMinGasPrices(ctx cosmos.Context, feeCoins cosmos.Coins,

// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
glDec := cosmos.NewDec(int64(gas)) // #nosec G701 -- gosec warning about integer overflow is not relevant here
glDec := sdkmath.LegacyNewDec(int64(gas)) // #nosec G701 -- gosec warning about integer overflow is not relevant here
for i, gp := range minGasPrices {
fee := gp.Amount.Mul(glDec)
requiredFees[i] = cosmos.NewCoin(gp.Denom, fee.Ceil().RoundInt())
Expand Down
3 changes: 2 additions & 1 deletion app/ante/cosmos/gas_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"math/big"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
cosmos "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"

Expand Down Expand Up @@ -54,7 +55,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(ctx cosmos.Context, tx cosmos.Tx, sim

// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
gasLimit := cosmos.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 Down
12 changes: 8 additions & 4 deletions app/ante/cosmos/interfaces.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package cosmos

import cosmos "github.com/cosmos/cosmos-sdk/types"
import (
"context"

cosmos "github.com/cosmos/cosmos-sdk/types"
)

// BankKeeper defines the exposed interface for using functionality of the bank keeper
// in the context of the cosmos AnteHandler package.
type BankKeeper interface {
GetBalance(ctx cosmos.Context, addr cosmos.AccAddress, denom string) cosmos.Coin
SendCoins(ctx cosmos.Context, from, to cosmos.AccAddress, amt cosmos.Coins) error
SendCoinsFromAccountToModule(ctx cosmos.Context, senderAddr cosmos.AccAddress, recipientModule string, amt cosmos.Coins) error
GetBalance(ctx context.Context, addr cosmos.AccAddress, denom string) cosmos.Coin
SendCoins(ctx context.Context, from, to cosmos.AccAddress, amt cosmos.Coins) error
SendCoinsFromAccountToModule(ctx context.Context, senderAddr cosmos.AccAddress, recipientModule string, amt cosmos.Coins) error
}
2 changes: 1 addition & 1 deletion app/ante/cosmos/msg_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
cosmos "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"

evmmodule "github.com/artela-network/artela-rollkit/x/evm/txs"
evmmodule "github.com/artela-network/artela-rollkit/x/evm/types"
)

// RejectMessagesDecorator prevents invalid msg types from being executed
Expand Down
17 changes: 8 additions & 9 deletions app/ante/cosmos/sig_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,15 @@ func init() {
// CONTRACT: Pubkeys are set in context for all signers before this decorator runs
// CONTRACT: Tx must implement SigVerifiableTx interface
type LegacyEip712SigVerificationDecorator struct {
ak evmmodule.AccountKeeper
signModeHandler authsigning.SignModeHandler
ak evmmodule.AccountKeeper
}

// Deprecated: NewLegacyEip712SigVerificationDecorator creates a new LegacyEip712SigVerificationDecorator
func NewLegacyEip712SigVerificationDecorator(
ak evmmodule.AccountKeeper,
signModeHandler authsigning.SignModeHandler,
) LegacyEip712SigVerificationDecorator {
return LegacyEip712SigVerificationDecorator{
ak: ak,
signModeHandler: signModeHandler,
ak: ak,
}
}

Expand Down Expand Up @@ -83,7 +80,10 @@ func (svd LegacyEip712SigVerificationDecorator) AnteHandle(ctx cosmos.Context,
return ctx, err
}

signerAddrs := sigTx.GetSigners()
signerAddrs, err := sigTx.GetSigners()
if err != nil {
return ctx, err
}

// EIP712 allows just one signature
if len(sigs) != 1 {
Expand Down Expand Up @@ -141,7 +141,7 @@ func (svd LegacyEip712SigVerificationDecorator) AnteHandle(ctx cosmos.Context,
return next(ctx, tx, simulate)
}

if err := VerifySignature(pubKey, signerData, sig.Data, svd.signModeHandler, authSignTx); err != nil {
if err := VerifySignature(pubKey, signerData, sig.Data, authSignTx); err != nil {
errMsg := fmt.Errorf("signature verification failed; please verify account number (%d) and chain-id (%s): %w", accNum, chainID, err)
return ctx, errorsmod.Wrap(errortypes.ErrUnauthorized, errMsg.Error())
}
Expand All @@ -155,7 +155,6 @@ func VerifySignature(
pubKey cryptotypes.PubKey,
signerData authsigning.SignerData,
sigData signing.SignatureData,
_ authsigning.SignModeHandler,
tx authsigning.Tx,
) error {
switch data := sigData.(type) {
Expand Down Expand Up @@ -186,7 +185,7 @@ func VerifySignature(
Amount: tx.GetFee(),
Gas: tx.GetGas(),
},
msgs, tx.GetMemo(), tx.GetTip(),
msgs, tx.GetMemo(),
)

signerChainID, err := artela.ParseChainID(signerData.ChainID)
Expand Down
Loading

0 comments on commit f0cdae0

Please sign in to comment.