Skip to content

Commit

Permalink
add params
Browse files Browse the repository at this point in the history
  • Loading branch information
fynn-0xc committed Feb 9, 2023
1 parent 030ca8d commit 50d7d3a
Showing 1 changed file with 92 additions and 1 deletion.
93 changes: 92 additions & 1 deletion x/gashub/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ const (
DefaultMsgCreateStorageProviderGas uint64 = 1e5
DefaultMsgEditStorageProviderGas uint64 = 1e5
DefaultMsgSpDepositGas uint64 = 1e5
DefaultMsgStorageCreateBucket uint64 = 1e5
DefaultMsgStorageDeleteBucket uint64 = 1e5
DefaultMsgStorageCreateObject uint64 = 1e5
DefaultMsgStorageDeleteObject uint64 = 1e5
DefaultMsgStorageSealObject uint64 = 1e5
DefaultMsgStorageCopyObject uint64 = 1e5
DefaultMsgStorageRejectSealObject uint64 = 1e5
DefaultMsgStorageCreateGroup uint64 = 1e5
DefaultMsgStorageDeleteGroup uint64 = 1e5
DefaultMsgStorageLeaveGroup uint64 = 1e5
DefaultMsgStorageUpdateGroupMember uint64 = 1e5
)

// Parameter keys
Expand Down Expand Up @@ -80,6 +91,17 @@ var (
KeyMsgCreateStorageProviderGas = []byte("MsgCreateStorageProviderGas")
KeyMsgEditStorageProviderGas = []byte("MsgEditStorageProviderGas")
KeyMsgSpDepositGas = []byte("MsgSpDepositGas")
KeyMsgStorageCreateBucket = []byte("MsgStorageCreateBucket")
KeyMsgStorageDeleteBucket = []byte("MsgStorageDeleteBucket")
KeyMsgStorageCreateObject = []byte("MsgStorageCreateObject")
KeyMsgStorageDeleteObject = []byte("MsgStorageDeleteObject")
KeyMsgStorageSealObject = []byte("MsgStorageSealObject")
KeyMsgStorageCopyObject = []byte("MsgStorageCopyObject")
KeyMsgStorageRejectSealObject = []byte("MsgStorageRejectSealObject")
KeyMsgStorageCreateGroup = []byte("MsgStorageCreateGroup")
KeyMsgStorageDeleteGroup = []byte("MsgStorageDeleteGroup")
KeyMsgStorageLeaveGroup = []byte("MsgStorageLeaveGroup")
KeyMsgStorageUpdateGroupMember = []byte("MsgStorageUpdateGroupMember")
)

var _ paramtypes.ParamSet = &Params{}
Expand All @@ -91,7 +113,9 @@ func NewParams(
msgFundCommunityPoolGas, msgGrantAllowanceFixedGas, msgGrantAllowancePerItemGas, msgRevokeAllowanceGas, msgSubmitProposalGas,
msgVoteGas, msgVoteWeightedGas, msgDepositGas, msgUnjailGas, msgImpeachGas, msgEditValidatorGas, msgDelegateGas,
msgUndelegateGas, msgBeginRedelegateGas, msgCancelUnbondingDelegationGas, msgCreateValidatorGas, msgClaimGas,
msgTransferOutGas, msgCreateStorageProviderGas, msgEditStorageProviderGas, msgSpDepositGas uint64,
msgTransferOutGas, msgCreateStorageProviderGas, msgEditStorageProviderGas, msgSpDepositGas, msgStorageCreateBucket,
msgStorageDeleteBucket, msgStorageCreateObject, msgStorageDeleteObject, msgStorageSealObject, msgStorageCopyObject,
msgStorageRejectSealObject, msgStorageCreateGroup, msgStorageDeleteGroup, msgStorageLeaveGroup, msgStorageUpdateGroupMember uint64,
) Params {
return Params{
MaxTxSize: maxTxSize,
Expand Down Expand Up @@ -127,6 +151,17 @@ func NewParams(
MsgCreateStorageProviderGas: msgCreateStorageProviderGas,
MsgEditStorageProviderGas: msgEditStorageProviderGas,
MsgSpDepositGas: msgSpDepositGas,
MsgStorageCreateBucket: msgStorageCreateBucket,
MsgStorageDeleteBucket: msgStorageDeleteBucket,
MsgStorageCreateObject: msgStorageCreateObject,
MsgStorageDeleteObject: msgStorageDeleteObject,
MsgStorageSealObject: msgStorageSealObject,
MsgStorageCopyObject: msgStorageCopyObject,
MsgStorageRejectSealObject: msgStorageRejectSealObject,
MsgStorageCreateGroup: msgStorageCreateGroup,
MsgStorageDeleteGroup: msgStorageDeleteGroup,
MsgStorageLeaveGroup: msgStorageLeaveGroup,
MsgStorageUpdateGroupMember: msgStorageUpdateGroupMember,
}
}

Expand Down Expand Up @@ -172,6 +207,18 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
paramtypes.NewParamSetPair(KeyMsgCreateStorageProviderGas, &p.MsgCreateStorageProviderGas, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgEditStorageProviderGas, &p.MsgEditStorageProviderGas, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgSpDepositGas, &p.MsgSpDepositGas, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageCreateBucket, &p.MsgStorageCreateBucket, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageDeleteBucket, &p.MsgStorageDeleteBucket, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageCreateObject, &p.MsgStorageCreateObject, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageDeleteObject, &p.MsgStorageDeleteObject, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageSealObject, &p.MsgStorageSealObject, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageCopyObject, &p.MsgStorageCopyObject, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageRejectSealObject, &p.MsgStorageRejectSealObject, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageCreateGroup, &p.MsgStorageCreateGroup, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgSpDepositGas, &p.MsgSpDepositGas, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageDeleteGroup, &p.MsgStorageDeleteGroup, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageLeaveGroup, &p.MsgStorageLeaveGroup, validateMsgGas),
paramtypes.NewParamSetPair(KeyMsgStorageUpdateGroupMember, &p.MsgStorageUpdateGroupMember, validateMsgGas),
}
}

Expand Down Expand Up @@ -211,6 +258,17 @@ func DefaultParams() Params {
MsgCreateStorageProviderGas: DefaultMsgCreateStorageProviderGas,
MsgEditStorageProviderGas: DefaultMsgEditStorageProviderGas,
MsgSpDepositGas: DefaultMsgSpDepositGas,
MsgStorageCreateBucket: DefaultMsgStorageCreateBucket,
MsgStorageDeleteBucket: DefaultMsgStorageDeleteBucket,
MsgStorageCreateObject: DefaultMsgStorageCreateObject,
MsgStorageDeleteObject: DefaultMsgStorageDeleteObject,
MsgStorageSealObject: DefaultMsgStorageSealObject,
MsgStorageCopyObject: DefaultMsgStorageCopyObject,
MsgStorageRejectSealObject: DefaultMsgStorageRejectSealObject,
MsgStorageCreateGroup: DefaultMsgStorageCreateGroup,
MsgStorageDeleteGroup: DefaultMsgStorageDeleteGroup,
MsgStorageLeaveGroup: DefaultMsgStorageLeaveGroup,
MsgStorageUpdateGroupMember: DefaultMsgStorageUpdateGroupMember,
}
}

Expand Down Expand Up @@ -360,6 +418,39 @@ func (p Params) Validate() error {
if err := validateMsgGas(p.MsgSpDepositGas); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageCreateBucket); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageDeleteBucket); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageCreateObject); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageDeleteObject); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageSealObject); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageCopyObject); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageRejectSealObject); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageCreateGroup); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageDeleteGroup); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageLeaveGroup); err != nil {
return err
}
if err := validateMsgGas(p.MsgStorageUpdateGroupMember); err != nil {
return err
}

return nil
}

0 comments on commit 50d7d3a

Please sign in to comment.