Skip to content

Commit

Permalink
moved BypassIBCFeeDecorator to RDK
Browse files Browse the repository at this point in the history
  • Loading branch information
keruch committed Oct 29, 2024
1 parent 9333376 commit 169c9fc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 132 deletions.
8 changes: 4 additions & 4 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/ante"
conntypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
rdkante "github.com/dymensionxyz/dymension-rdk/server/ante"
distrkeeper "github.com/dymensionxyz/dymension-rdk/x/dist/keeper"
"github.com/dymensionxyz/dymension-rdk/x/gasless"
gaslesskeeper "github.com/dymensionxyz/dymension-rdk/x/gasless/keeper"
seqkeeper "github.com/dymensionxyz/dymension-rdk/x/sequencers/keeper"
cosmosante "github.com/evmos/evmos/v12/app/ante/cosmos"
evmostypes "github.com/evmos/evmos/v12/types"
evmtypes "github.com/evmos/evmos/v12/x/evm/types"
tmlog "github.com/tendermint/tendermint/libs/log"

"github.com/dymensionxyz/dymension-rdk/x/gasless"
gaslesskeeper "github.com/dymensionxyz/dymension-rdk/x/gasless/keeper"
)

// HandlerOptions are the options required for constructing a default SDK AnteHandler.
Expand Down Expand Up @@ -121,7 +121,7 @@ func cosmosHandler(options HandlerOptions, sigChecker sdk.AnteDecorator) sdk.Ant
ante.NewValidateMemoDecorator(options.AccountKeeper),
NewCreateAccountDecorator(options.AccountKeeper.(accountKeeper)),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
NewBypassIBCFeeDecorator(
rdkante.NewBypassIBCFeeDecorator(
gasless.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker, options.GaslessKeeper),
options.DistrKeeper,
options.SequencersKeeper,
Expand Down
8 changes: 6 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
evmosante "github.com/evmos/evmos/v12/app/ante"
"github.com/gogo/protobuf/proto"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -472,7 +473,10 @@ func NewRollapp(
)

app.SequencersKeeper = *seqkeeper.NewKeeper(
appCodec, keys[seqtypes.StoreKey], app.GetSubspace(seqtypes.ModuleName),
appCodec,
keys[seqtypes.StoreKey],
app.GetSubspace(seqtypes.ModuleName),
authtypes.NewModuleAddress(seqtypes.ModuleName).String(),
)

app.IBCKeeper = ibckeeper.NewKeeper(
Expand Down Expand Up @@ -840,7 +844,7 @@ func NewRollapp(

// Admission handler for consensus messages
app.setAdmissionHandler(consensus.AllowedMessagesHandler([]string{
// proto.MessageName(&banktypes.MsgSend{}), // Example of message allowed as consensus message
proto.MessageName(new(seqtypes.ConsensusMsgUpsertSequencer)),
}))

if loadLatest {
Expand Down
118 changes: 0 additions & 118 deletions app/bypass_ibc_fee_decorator.go

This file was deleted.

3 changes: 2 additions & 1 deletion app/create_account_decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/auth/types"
rdkante "github.com/dymensionxyz/dymension-rdk/server/ante"
)

type createAccountDecorator struct {
Expand Down Expand Up @@ -39,7 +40,7 @@ func (cad createAccountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat
return ctx, err
}

ibcRelayerMsg := isIBCRelayerMsg(tx.GetMsgs())
ibcRelayerMsg := rdkante.IsIBCRelayerMsg(tx.GetMsgs())

for i, pk := range pubkeys {
if pk == nil {
Expand Down
3 changes: 2 additions & 1 deletion app/sigcheck_decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
sdkerrors "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"
rdkante "github.com/dymensionxyz/dymension-rdk/server/ante"
)

type sigCheckDecorator struct {
Expand Down Expand Up @@ -41,7 +42,7 @@ func (svd sigCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate boo
return ctx, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "invalid number of signer; expected: %d, got %d", len(signerAddrs), len(sigs))
}

ibcRelayerMsg := isIBCRelayerMsg(tx.GetMsgs())
ibcRelayerMsg := rdkante.IsIBCRelayerMsg(tx.GetMsgs())

for i, sig := range sigs {
acc, err := authante.GetSignerAcc(ctx, svd.ak, signerAddrs[i])
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/cosmos/ibc-go/v6 v6.3.0
github.com/dvsekhvalnov/jose2go v1.5.0
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241020152926-b250db7af580
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241015102238-a827c3784461
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241024144934-db109b2859b4
github.com/ethereum/go-ethereum v1.12.0
github.com/evmos/evmos/v12 v12.1.6
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -349,6 +349,7 @@ replace (
github.com/CosmWasm/wasmd => github.com/decentrio/wasmd v0.33.0-sdk46.2
github.com/centrifuge/go-substrate-rpc-client/v4 => github.com/availproject/go-substrate-rpc-client/v4 v4.0.12-avail-1.4.0-rc1-5e286e3
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/dymensionxyz/dymension-rdk => ../dymension-rdk
// use Evmos geth fork
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26
github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.4.2
Expand All @@ -361,5 +362,4 @@ replace (
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
// use cometbft
github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20241008141942-63af9d24107f
github.com/dymensionxyz/dymension-rdk => ../dymension-rdk
)
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,8 @@ github.com/dymensionxyz/cometbft v0.34.29-0.20241008141942-63af9d24107f h1:CclWJ
github.com/dymensionxyz/cometbft v0.34.29-0.20241008141942-63af9d24107f/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw=
github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13 h1:u5yeve5jZR6TdRjjR+vYT/8PWKbhwCZxUmAu+/Tnxyg=
github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13/go.mod h1:jabDQYXrccscSE0fXkh7eQFYPWJCRiuWKonFGObVq6s=
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241020152926-b250db7af580 h1:bgECFCjc/8lVq9/UQ4qCTdD/znUgKEX7a0QBOcGuuNg=
github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241020152926-b250db7af580/go.mod h1:m9D/CACMkMAXKFeuU+1lkUIPWpMFb0EvGl7M5vV0HoA=
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241015102238-a827c3784461 h1:ZNh5s2dmfcgPE9g6OlhHBFtygiAxCRr+wPKSgpSo/Bw=
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241015102238-a827c3784461/go.mod h1:FNVdsvVhveAOeL0Mj9VIfGkAUKhGskEr0iRnoM+MAkU=
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241024144934-db109b2859b4 h1:DpfHfiqNJ0QgnPNq/nx2fAUDWwLlWORQ605uQyPPODU=
github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241024144934-db109b2859b4/go.mod h1:FNVdsvVhveAOeL0Mj9VIfGkAUKhGskEr0iRnoM+MAkU=
github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.4.2 h1:aVP3off7u2vsvRH7lHAUPTLdf9/AfnzC/rvvi0wC/co=
github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.4.2/go.mod h1:CI6D89pkoiIm4BjoMFNnEaCLdKBEobLuwvhS0c1zh7Y=
github.com/dymensionxyz/gerr-cosmos v1.0.0 h1:oi91rgOkpJWr41oX9JOyjvvBnhGY54tj513x8VlDAEc=
Expand Down

0 comments on commit 169c9fc

Please sign in to comment.