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

feat: add selective gas exemption whitelist #1332

Merged
merged 4 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 13 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ import (
palomaclient "github.com/palomachain/paloma/v2/x/paloma/client"
palomamodulekeeper "github.com/palomachain/paloma/v2/x/paloma/keeper"
palomamoduletypes "github.com/palomachain/paloma/v2/x/paloma/types"
palomatypes "github.com/palomachain/paloma/v2/x/paloma/types"
schedulermodule "github.com/palomachain/paloma/v2/x/scheduler"
schedulerbindings "github.com/palomachain/paloma/v2/x/scheduler/bindings"
schedulermodulekeeper "github.com/palomachain/paloma/v2/x/scheduler/keeper"
Expand Down Expand Up @@ -623,6 +624,7 @@ func New(
app.ValsetKeeper,
app.UpgradeKeeper,
authcodec.NewBech32Codec(chainparams.ValidatorAddressPrefix),
authorityAddress,
)

app.PalomaKeeper.ExternalChains = []palomamoduletypes.ExternalChainSupporterKeeper{
Expand Down Expand Up @@ -1069,6 +1071,7 @@ func New(
anteDecorators = append(anteDecorators,
palomamodule.NewLogMsgDecorator(app.appCodec),
palomamodule.NewVerifyAuthorisedSignatureDecorator(app.FeeGrantKeeper),
palomamodule.NewGasExemptAddressDecorator(app.PalomaKeeper),
)
anteHandler := sdk.ChainAnteDecorators(
anteDecorators...,
Expand Down Expand Up @@ -1274,20 +1277,21 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino

paramsKeeper.Subspace(authtypes.ModuleName)
paramsKeeper.Subspace(banktypes.ModuleName)
paramsKeeper.Subspace(stakingtypes.ModuleName)
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(consensusmoduletypes.ModuleName)
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(evmmoduletypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName)
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(metrixmoduletypes.ModuleName)
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(palomatypes.ModuleName)
paramsKeeper.Subspace(schedulermoduletypes.ModuleName)
paramsKeeper.Subspace(consensusmoduletypes.ModuleName)
paramsKeeper.Subspace(valsetmoduletypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(evmmoduletypes.ModuleName)
paramsKeeper.Subspace(skywaymoduletypes.ModuleName).WithKeyTable(skywaymoduletypes.ParamKeyTable())
paramsKeeper.Subspace(metrixmoduletypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(stakingtypes.ModuleName)
paramsKeeper.Subspace(tokenfactorymoduletypes.ModuleName)
paramsKeeper.Subspace(valsetmoduletypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)

paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable)
paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())
Expand Down
7 changes: 6 additions & 1 deletion proto/palomachain/paloma/paloma/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ syntax = "proto3";
package palomachain.paloma.paloma;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/palomachain/paloma/v2/x/paloma/types";

// Params defines the parameters for the module.
message Params { option (gogoproto.goproto_stringer) = false; }
message Params {
option (gogoproto.goproto_stringer) = false;

repeated string GasExemptAddresses = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}
26 changes: 25 additions & 1 deletion proto/palomachain/paloma/paloma/tx.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
syntax = "proto3";
package palomachain.paloma.paloma;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";

import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

import "palomachain/paloma/valset/common.proto";
import "palomachain/paloma/paloma/params.proto";

option go_package = "github.com/palomachain/paloma/v2/x/paloma/types";

Expand All @@ -23,6 +27,11 @@ service Msg {

rpc SetLegacyLightNodeClients(MsgSetLegacyLightNodeClients)
returns (EmptyResponse);

rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (google.api.http).put =
"/palomachain/paloma/params";
}
}

message MsgAddStatusUpdate {
Expand Down Expand Up @@ -75,3 +84,18 @@ message MsgSetLegacyLightNodeClients {
palomachain.paloma.valset.MsgMetadata metadata = 1
[ (gogoproto.nullable) = false ];
}

message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];

palomachain.paloma.valset.MsgMetadata metadata = 3
[ (gogoproto.nullable) = false ];
}

message MsgUpdateParamsResponse {}
11 changes: 6 additions & 5 deletions tests/integration/evm/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
g "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/palomachain/paloma/v2/tests/integration/helper"
keepertest "github.com/palomachain/paloma/v2/testutil/keeper"
"github.com/palomachain/paloma/v2/testutil/nullify"
"github.com/palomachain/paloma/v2/x/evm"
Expand Down Expand Up @@ -37,12 +38,12 @@ var _ = g.Describe("genesis", func() {
var genesisState types.GenesisState
var k *keeper.Keeper
var ctx sdk.Context
var a *fixture
var a *helper.Fixture

g.BeforeEach(func() {
a = initFixture(t)
ctx = a.ctx.WithBlockHeight(5)
k = &a.evmKeeper
a = helper.InitFixture(t)
ctx = a.Ctx.WithBlockHeight(5)
k = &a.EvmKeeper
})

g.BeforeEach(func() {
Expand Down Expand Up @@ -71,7 +72,7 @@ var _ = g.Describe("genesis", func() {
[]byte("abc"),
)
Expect(err).To(BeNil())
err = a.evmKeeper.SetFeeManagerAddress(ctx, ci.ChainReferenceID, cDummyFeeMgrAddress)
err = a.EvmKeeper.SetFeeManagerAddress(ctx, ci.ChainReferenceID, cDummyFeeMgrAddress)
require.NoError(t, err)
}
}
Expand Down
Loading
Loading