Skip to content

Commit

Permalink
fix(genesis,params): making genesis params private
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Aug 7, 2024
1 parent 38eaf62 commit 3bb1f5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Genesis struct {

type genesisData struct {
GenesisTime time.Time `cbor:"1,keyasint" json:"genesis_time"`
Params *GenParams `cbor:"2,keyasint" json:"params"`
Params *genParams `cbor:"2,keyasint" json:"params"`
Accounts []genAccount `cbor:"3,keyasint" json:"accounts"`
Validators []genValidator `cbor:"4,keyasint" json:"validators"`
}
Expand All @@ -71,7 +71,7 @@ func (gen *Genesis) GenesisTime() time.Time {
return gen.data.GenesisTime
}

func (gen *Genesis) Params() *GenParams {
func (gen *Genesis) Params() *genParams {

Check failure on line 74 in genesis/genesis.go

View workflow job for this annotation

GitHub Actions / linting

unexported-return: exported method Params returns unexported type *genesis.genParams, which can be annoying to use (revive)

Check failure on line 74 in genesis/genesis.go

View workflow job for this annotation

GitHub Actions / build-linux

unexported-return: exported method Params returns unexported type *genesis.genParams, which can be annoying to use (revive)
return gen.data.Params
}

Expand Down Expand Up @@ -123,7 +123,7 @@ func makeGenesisValidator(val *validator.Validator) genValidator {
}

func MakeGenesis(genesisTime time.Time, accounts map[crypto.Address]*account.Account,
validators []*validator.Validator, params *GenParams,
validators []*validator.Validator, params *genParams,
) *Genesis {
genAccs := make([]genAccount, len(accounts))
for addr, acc := range accounts {
Expand Down
8 changes: 4 additions & 4 deletions genesis/genesis_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/pactus-project/pactus/types/amount"
)

type GenParams struct {
type genParams struct {
BlockVersion uint8 `cbor:"1,keyasint" json:"block_version"`
BlockIntervalInSecond int `cbor:"2,keyasint" json:"block_interval_in_second"`
CommitteeSize int `cbor:"3,keyasint" json:"committee_size"`
Expand All @@ -22,8 +22,8 @@ type GenParams struct {
MaximumStake amount.Amount `cbor:"13,keyasint" json:"maximum_stake"`
}

func DefaultGenParams() *GenParams {
return &GenParams{
func DefaultGenParams() *genParams {

Check failure on line 25 in genesis/genesis_param.go

View workflow job for this annotation

GitHub Actions / linting

unexported-return: exported func DefaultGenParams returns unexported type *genesis.genParams, which can be annoying to use (revive)

Check failure on line 25 in genesis/genesis_param.go

View workflow job for this annotation

GitHub Actions / build-linux

unexported-return: exported func DefaultGenParams returns unexported type *genesis.genParams, which can be annoying to use (revive)
return &genParams{
BlockVersion: 1,
BlockIntervalInSecond: 10,
CommitteeSize: 51,
Expand All @@ -40,6 +40,6 @@ func DefaultGenParams() *GenParams {
}
}

func (p *GenParams) BlockInterval() time.Duration {
func (p *genParams) BlockInterval() time.Duration {
return time.Duration(p.BlockIntervalInSecond) * time.Second
}

0 comments on commit 3bb1f5e

Please sign in to comment.