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

style: remove unused params code #255

Merged
merged 2 commits into from
Mar 8, 2024
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
51 changes: 0 additions & 51 deletions tests/store/subspace_test.go

This file was deleted.

56 changes: 0 additions & 56 deletions x/crosschain/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"

fxtypes "github.com/functionx/fx-core/v7/types"
)
Expand All @@ -30,41 +29,8 @@ var (
AttestationVotesPowerThreshold = sdkmath.NewInt(66)

AttestationProposalOracleChangePowerThreshold = sdkmath.NewInt(30)

// ParamsStoreKeyGravityID stores the gravity id
ParamsStoreKeyGravityID = []byte("GravityID")

// ParamsStoreKeyAverageBlockTime stores the signed blocks window
ParamsStoreKeyAverageBlockTime = []byte("AverageBlockTime")

// ParamsStoreKeyExternalBatchTimeout stores the signed blocks window
ParamsStoreKeyExternalBatchTimeout = []byte("ExternalBatchTimeout")

// ParamsStoreKeyAverageExternalBlockTime stores the signed blocks window
ParamsStoreKeyAverageExternalBlockTime = []byte("AverageExternalBlockTime")

// ParamsStoreKeySignedWindow stores the signed blocks window
ParamsStoreKeySignedWindow = []byte("SignedWindow")

// ParamsStoreSlashFraction stores the slash fraction oracle set
ParamsStoreSlashFraction = []byte("SlashFraction")

// ParamStoreOracleSetUpdatePowerChangePercent oracle set update power change percent
ParamStoreOracleSetUpdatePowerChangePercent = []byte("OracleSetUpdatePowerChangePercent")

// ParamStoreIbcTransferTimeoutHeight gravity and ibc transfer timeout height
ParamStoreIbcTransferTimeoutHeight = []byte("IbcTransferTimeoutHeight")

// ParamOracleDelegateThreshold stores the oracle delegate threshold
ParamOracleDelegateThreshold = []byte("OracleDelegateThreshold")

// ParamOracleDelegateMultiple stores the oracle delegate multiple
ParamOracleDelegateMultiple = []byte("OracleDelegateMultiple")
)

// Ensure that params implements the proper interface
var _ paramtypes.ParamSet = &Params{}

func DefaultParams() Params {
return Params{
GravityId: "fx-gravity-id",
Expand Down Expand Up @@ -116,28 +82,6 @@ func (m *Params) ValidateBasic() error {
return nil
}

// ParamKeyTable for auth module
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}

// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs
// pairs of auth module's parameters.
func (m *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(ParamsStoreKeyGravityID, &m.GravityId, validateGravityID),
paramtypes.NewParamSetPair(ParamsStoreKeyAverageBlockTime, &m.AverageBlockTime, validateAverageBlockTime),
paramtypes.NewParamSetPair(ParamsStoreKeyExternalBatchTimeout, &m.ExternalBatchTimeout, validateExternalBatchTimeout),
paramtypes.NewParamSetPair(ParamsStoreKeyAverageExternalBlockTime, &m.AverageExternalBlockTime, validateAverageExternalBlockTime),
paramtypes.NewParamSetPair(ParamsStoreKeySignedWindow, &m.SignedWindow, validateSignedWindow),
paramtypes.NewParamSetPair(ParamsStoreSlashFraction, &m.SlashFraction, validateSlashFraction),
paramtypes.NewParamSetPair(ParamStoreOracleSetUpdatePowerChangePercent, &m.OracleSetUpdatePowerChangePercent, validateOracleSetUpdatePowerChangePercent),
paramtypes.NewParamSetPair(ParamStoreIbcTransferTimeoutHeight, &m.IbcTransferTimeoutHeight, validateIbcTransferTimeoutHeight),
paramtypes.NewParamSetPair(ParamOracleDelegateThreshold, &m.DelegateThreshold, validateOracleDelegateThreshold),
paramtypes.NewParamSetPair(ParamOracleDelegateMultiple, &m.DelegateMultiple, validateOracleDelegateMultiple),
}
}

func validateGravityID(i interface{}) error {
v, ok := i.(string)
if !ok {
Expand Down
43 changes: 0 additions & 43 deletions x/erc20/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,8 @@ package types
import (
"fmt"
"time"

paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)

// Parameter store key
var (
ParamStoreKeyEnableErc20 = []byte("EnableErc20")
ParamStoreKeyEnableEVMHook = []byte("EnableEVMHook")
ParamStoreKeyIBCTimeout = []byte("IBCTimeout")
)

var _ paramtypes.ParamSet = &Params{}

// ParamKeyTable returns the parameter key table.
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}

// NewParams creates a new Params object
func NewParams(enableErc20 bool, enableEVMHook bool, ibcTimeout time.Duration) Params {
return Params{
Expand All @@ -38,33 +22,6 @@ func DefaultParams() Params {
}
}

func validateBool(i interface{}) error {
_, ok := i.(bool)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}

return nil
}

func validateTimeDuration(i interface{}) error {
_, ok := i.(time.Duration)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}

return nil
}

// ParamSetPairs returns the parameter set pairs.
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(ParamStoreKeyEnableErc20, &p.EnableErc20, validateBool),
paramtypes.NewParamSetPair(ParamStoreKeyEnableEVMHook, &p.EnableEVMHook, validateBool),
paramtypes.NewParamSetPair(ParamStoreKeyIBCTimeout, &p.IbcTimeout, validateTimeDuration),
}
}

func (p *Params) Validate() error {
if p.IbcTimeout <= 0 {
return fmt.Errorf("ibc timeout cannot be 0")
Expand Down
58 changes: 0 additions & 58 deletions x/erc20/types/params_test.go

This file was deleted.

Loading