Skip to content

Commit

Permalink
chore(linter): enable musttag (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy authored Aug 20, 2023
1 parent e421509 commit ed1875c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ linters:
- exhaustive # Consider to enable it
- exhaustruct # Consider to enable it
- forcetypeassert # Consider to enable it
- musttag # Consider to enable it (is i possible?)
- goerr113 # Consider to enable it
- errorlint # Consider to enable it
- errname # Consider to enable it
Expand Down
14 changes: 7 additions & 7 deletions genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func (n ChainType) String() string {
}

type genAccount struct {
Address string `cbor:"1,keyasint"`
Balance int64 `cbor:"2,keyasint"`
Address string `cbor:"1,keyasint" json:"address"`
Balance int64 `cbor:"2,keyasint" json:"balance"`
}

type genValidator struct {
PublicKey string `cbor:"1,keyasint"`
PublicKey string `cbor:"1,keyasint" json:"public_key"`
}

// Genesis is stored in the state database.
Expand All @@ -56,10 +56,10 @@ type Genesis struct {
}

type genesisData struct {
GenesisTime time.Time `cbor:"1,keyasint"`
Params param.Params `cbor:"2,keyasint"`
Accounts []genAccount `cbor:"3,keyasint"`
Validators []genValidator `cbor:"4,keyasint"`
GenesisTime time.Time `cbor:"1,keyasint" json:"genesis_time"`
Params param.Params `cbor:"2,keyasint" json:"params"`
Accounts []genAccount `cbor:"3,keyasint" json:"accounts"`
Validators []genValidator `cbor:"4,keyasint" json:"validators"`
}

func (gen *Genesis) Hash() hash.Hash {
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestGenesisTestNet(t *testing.T) {
genTime, _ := time.Parse("2006-01-02", "2023-05-08")
assert.Equal(t, g.GenesisTime(), genTime)
assert.Equal(t, g.Params().BondInterval, uint32(120))
expected, _ := hash.FromString("63f32d682050bd03eb832c9d99fc3b48855d7f4193e5c09205be68d6e16546af")
expected, _ := hash.FromString("f5718d6686a1a1066749a671b67b8e9506709c3e6326e6216a4a09ada56a6b01")
assert.Equal(t, g.Hash(), expected)
}

Expand Down
45 changes: 23 additions & 22 deletions genesis/testnet.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
{
"GenesisTime": "2023-05-08T00:00:00Z",
"Params": {
"BlockVersion": 63,
"BlockTimeInSecond": 10,
"CommitteeSize": 21,
"BlockReward": 1000000000,
"TransactionToLiveInterval": 2880,
"SortitionInterval": 7,
"BondInterval": 120,
"UnbondInterval": 60480,
"FeeFraction": 0.0001,
"MinimumFee": 1000,
"MaximumFee": 1000000,
"MaximumStake": 1000000000000
"genesis_time": "2023-05-08T00:00:00Z",
"params": {
"block_version": 63,
"block_time_in_second": 10,
"committee_size": 21,
"block_reward": 1000000000,
"transaction_to_live_interval": 2880,
"sortition_interval": 7,
"bond_interval": 120,
"unbond_interval": 60480,
"fee_fraction": 0.0001,
"minimum_fee": 1000,
"maximum_fee": 1000000,
"minimum_stake": 1000000000,
"maximum_stake": 1000000000000
},
"Accounts": [
"accounts": [
{
"Address": "000000000000000000000000000000000000000000",
"Balance": 21000000000000000
"address": "000000000000000000000000000000000000000000",
"balance": 21000000000000000
}
],
"Validators": [
"validators": [
{
"PublicKey": "tpublic1p5gw4naty9nyzqhqll3x6mk56d675908th62t3ezt2d822z3xzs2gl5907gu0fpeederje9ecks5lcrn2a8svatrsjwterv9hwzfqk7lf5rn43aee5kvfv8vfy87z9ecdnrzcv55zpt94xrgpm6nxkxxxfsadjr8q"
"public_key": "tpublic1p5gw4naty9nyzqhqll3x6mk56d675908th62t3ezt2d822z3xzs2gl5907gu0fpeederje9ecks5lcrn2a8svatrsjwterv9hwzfqk7lf5rn43aee5kvfv8vfy87z9ecdnrzcv55zpt94xrgpm6nxkxxxfsadjr8q"
},
{
"PublicKey": "tpublic1psxph0f83gx7ay26z948m8qutnal3qlmc79caacn3kgfl6gml7cqt3yrh3kgdkxqyxxl7vc9mpnutjxzt0nnkw2h4zzwlp264dznz0ssp2lytl79a395977065ygpqsm2cm3ln44ag0g28689xuwfj6u08qqu8wl6"
"public_key": "tpublic1psxph0f83gx7ay26z948m8qutnal3qlmc79caacn3kgfl6gml7cqt3yrh3kgdkxqyxxl7vc9mpnutjxzt0nnkw2h4zzwlp264dznz0ssp2lytl79a395977065ygpqsm2cm3ln44ag0g28689xuwfj6u08qqu8wl6"
},
{
"PublicKey": "tpublic1p42tae04aa40ltshyryeet7hm5050h0fdla9w988lr98emly8g9eqrkz8xg6qq3rqhg8pelps9zlrqz6xfge0w2uq6ksyxearzmha9zmdyzcagx0pe6kcfx57chfa8u4s37uftza0c75xj40x0w0khfha0cpgaua4"
"public_key": "tpublic1p42tae04aa40ltshyryeet7hm5050h0fdla9w988lr98emly8g9eqrkz8xg6qq3rqhg8pelps9zlrqz6xfge0w2uq6ksyxearzmha9zmdyzcagx0pe6kcfx57chfa8u4s37uftza0c75xj40x0w0khfha0cpgaua4"
},
{
"PublicKey": "tpublic1p5a77fv2rwgs6ywsutawwcpfqascd82nygmsnsdr7mghey0jp48q3qgywumtmelc4zurexua8kgqtyr829uqm8tju99sydxx5akhlgrdzz5lu0jgtepct4lglqhk446awj6h2nk49eweswhljkfs3dfe8esy0k6qa"
"public_key": "tpublic1p5a77fv2rwgs6ywsutawwcpfqascd82nygmsnsdr7mghey0jp48q3qgywumtmelc4zurexua8kgqtyr829uqm8tju99sydxx5akhlgrdzz5lu0jgtepct4lglqhk446awj6h2nk49eweswhljkfs3dfe8esy0k6qa"
}
]
}
26 changes: 13 additions & 13 deletions types/param/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ package param
import "time"

type Params struct {
BlockVersion uint8 `cbor:"1,keyasint"`
BlockTimeInSecond int `cbor:"2,keyasint"`
CommitteeSize int `cbor:"3,keyasint"`
BlockReward int64 `cbor:"4,keyasint"`
TransactionToLiveInterval uint32 `cbor:"5,keyasint"`
BondInterval uint32 `cbor:"6,keyasint"`
UnbondInterval uint32 `cbor:"7,keyasint"`
SortitionInterval uint32 `cbor:"8,keyasint"`
FeeFraction float64 `cbor:"9,keyasint"`
MinimumFee int64 `cbor:"10,keyasint"`
MaximumFee int64 `cbor:"11,keyasint"`
MinimumStake int64 `cobr:"12,keyasint"`
MaximumStake int64 `cbor:"13,keyasint"`
BlockVersion uint8 `cbor:"1,keyasint" json:"block_version"`
BlockTimeInSecond int `cbor:"2,keyasint" json:"block_time_in_second"`
CommitteeSize int `cbor:"3,keyasint" json:"committee_size"`
BlockReward int64 `cbor:"4,keyasint" json:"block_reward"`
TransactionToLiveInterval uint32 `cbor:"5,keyasint" json:"transaction_to_live_interval"`
BondInterval uint32 `cbor:"6,keyasint" json:"bond_interval"`
UnbondInterval uint32 `cbor:"7,keyasint" json:"unbond_interval"`
SortitionInterval uint32 `cbor:"8,keyasint" json:"sortition_interval"`
FeeFraction float64 `cbor:"9,keyasint" json:"fee_fraction"`
MinimumFee int64 `cbor:"10,keyasint" json:"minimum_fee"`
MaximumFee int64 `cbor:"11,keyasint" json:"maximum_fee"`
MinimumStake int64 `cobr:"12,keyasint" json:"minimum_stake"`
MaximumStake int64 `cbor:"13,keyasint" json:"maximum_stake"`
}

func DefaultParams() Params {
Expand Down

0 comments on commit ed1875c

Please sign in to comment.