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: migrate minfee module to use self managed params #59

Open
wants to merge 30 commits into
base: sdk-v0.50.x
Choose a base branch
from

Conversation

chatton
Copy link

@chatton chatton commented Mar 13, 2025

This PR updates the minfee module to use self managed params. The diff is quite large as some files needed to be moved around to make the package structure work correctly and there are a lot of proto changes.

  • Add a minfeekeeper type which implements the MsgServer and the QueryServer
  • replaced the existing Params struct (which implemented ParamSet) with a proto Params type.
  • updated ValidateTxFee ante handler to look at params instead of subspace.
  • Created all the required proto types.
  • Split logic out into keeper/type packages
  • Bumped consensus version and added/registered migration

follow up for cel-5

chatton added 30 commits March 12, 2025 09:02
Comment on lines -29 to -31
type Params struct {
NetworkMinGasPrice math.LegacyDec
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the non-proto type that implemented the ParamSet interface, and has been replaced with proto Params

@@ -9,14 +9,11 @@ import (
"github.com/celestiaorg/celestia-app/v4/pkg/appconsts"
)

const ModuleName = "minfee"
// TODO: this file can be removed once the upgrade to self managed modules has been completed.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is TBD based on if we want to support the fallback mechanism.

// DefaultGenesis returns the default genesis state.
func DefaultGenesis() *GenesisState {
return &GenesisState{
NetworkMinGasPrice: DefaultNetworkMinGasPrice, // TODO: remove this field
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will eventually be safe to remove this in a GenesisStaet v2, but the current logic should basically ignore this value, and only read from params.

if !exists {
panic("minfee subspace not set")
}
RegisterMinFeeParamTable(subspace)
types.RegisterMinFeeParamTable(subspace)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we don't do a fallback, all this can be removed after the migration.

sdkCtx := sdk.UnwrapSDKContext(ctx)
genesis := types.DefaultGenesis()
// TODO: genesis should hold params not this field.
genesis.NetworkMinGasPrice = k.GetParams(sdkCtx).NetworkMinGasPrice
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous GenesisState basically was just params, need to decide on cleanest approach to handle the field existing at the genesis. root level and also the new param level.

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

option go_package = "github.com/celestiaorg/celestia-app/x/minfee";
option go_package = "github.com/celestiaorg/celestia-app/x/minfee/types";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this breakage a problem? Would we be better off doing a proto v2 here

@chatton chatton changed the title [WIP] feat: migrate minfee module to use self managed params feat: migrate minfee module to use self managed params Mar 13, 2025
@chatton chatton marked this pull request as ready for review March 13, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant