Skip to content

Commit

Permalink
Fix linter and failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yoomee1313 committed Dec 19, 2024
1 parent c0a2b92 commit a076be3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
18 changes: 9 additions & 9 deletions consensus/istanbul/backend/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,25 +1186,25 @@ func Test_BasedOnStaking(t *testing.T) {
[]int{},
},
{
[]uint64{5000000, 5000000, 5000000, 6000000},
[]uint64{6000000, 5000000, 5000000, 5000000},
true,
false,
[]int{3},
[]int{0, 1, 2},
[]int{0},
[]int{1, 2, 3},
},
{
[]uint64{5000000, 5000000, 6000000, 6000000},
[]uint64{6000000, 5000000, 5000000, 6000000},
true,
false,
[]int{2, 3},
[]int{0, 1},
[]int{0, 3},
[]int{1, 2},
},
{
[]uint64{5000000, 6000000, 6000000, 6000000},
[]uint64{6000000, 5000000, 6000000, 6000000},
true,
false,
[]int{1, 2, 3},
[]int{0},
[]int{0, 2, 3},
[]int{1},
},
{
[]uint64{6000000, 6000000, 6000000, 6000000},
Expand Down
12 changes: 7 additions & 5 deletions consensus/istanbul/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ func NewBlockValSet(council, qualified valset.AddressList) *BlockValSet {
func (cs *BlockValSet) Council() valset.AddressList { return cs.council }
func (cs *BlockValSet) Qualified() valset.AddressList { return cs.qualified }
func (cs *BlockValSet) Demoted() valset.AddressList { return cs.demoted }
func (cs *BlockValSet) IsQualifiedMember(addr common.Address) bool {
return cs.qualified.GetIdxByAddress(addr) >= 0
}
func (cs *BlockValSet) IsCouncilMember(addr common.Address) bool {
return cs.council.GetIdxByAddress(addr) >= 0
}

func (cs *BlockValSet) IsQualifiedMember(addr common.Address) bool {
return cs.qualified.GetIdxByAddress(addr) >= 0
}

func (cs *BlockValSet) CheckValidatorSignature(data []byte, sig []byte) (common.Address, error) {
// 1. Get signature address
signer, err := GetSignatureAddress(data, sig)
Expand Down Expand Up @@ -182,11 +184,11 @@ func (cs *RoundCommitteeState) Committee() valset.AddressList { return cs.commit
func (cs *RoundCommitteeState) NonCommittee() valset.AddressList {
return cs.qualified.Subtract(cs.committee)
}
func (cs *RoundCommitteeState) Proposer() common.Address { return cs.proposer }
func (cs *RoundCommitteeState) Proposer() common.Address { return cs.proposer }
func (cs *RoundCommitteeState) IsProposer(addr common.Address) bool { return cs.proposer == addr }
func (cs *RoundCommitteeState) IsCommitteeMember(addr common.Address) bool {
return cs.committee.GetIdxByAddress(addr) >= 0
}
func (cs *RoundCommitteeState) IsProposer(addr common.Address) bool { return cs.proposer == addr }

// RequiredMessageCount returns a minimum required number of consensus messages to proceed
func (cs *RoundCommitteeState) RequiredMessageCount() int {
Expand Down
2 changes: 1 addition & 1 deletion kaiax/valset/addressList.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (sc *AddressList) Remove(addr common.Address) bool {
}

func (sc AddressList) Copy() AddressList {
var copied AddressList
copied := make(AddressList, 0)
for _, val := range sc {
copied = append(copied, val)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/hard_fork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"encoding/json"
"errors"
"fmt"
valset_impl "github.com/kaiachain/kaia/kaiax/valset/impl"
"math/big"
"os"
"strings"
Expand All @@ -43,6 +42,7 @@ import (
gov_impl "github.com/kaiachain/kaia/kaiax/gov/impl"
reward_impl "github.com/kaiachain/kaia/kaiax/reward/impl"
staking_impl "github.com/kaiachain/kaia/kaiax/staking/impl"
valset_impl "github.com/kaiachain/kaia/kaiax/valset/impl"
"github.com/kaiachain/kaia/log"
"github.com/kaiachain/kaia/params"
"github.com/kaiachain/kaia/rlp"
Expand Down
12 changes: 5 additions & 7 deletions tests/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ var Forks = map[string]*params.ChainConfig{
Kip103CompatibleBlock: new(big.Int),
ShanghaiCompatibleBlock: new(big.Int),
CancunCompatibleBlock: new(big.Int),
//RandaoCompatibleBlock: new(big.Int),
KaiaCompatibleBlock: new(big.Int),
Kip160CompatibleBlock: new(big.Int),
KaiaCompatibleBlock: new(big.Int),
Kip160CompatibleBlock: new(big.Int),
},
"Prague": {
ChainID: big.NewInt(1),
Expand All @@ -108,10 +107,9 @@ var Forks = map[string]*params.ChainConfig{
Kip103CompatibleBlock: new(big.Int),
ShanghaiCompatibleBlock: new(big.Int),
CancunCompatibleBlock: new(big.Int),
//RandaoCompatibleBlock: new(big.Int),
KaiaCompatibleBlock: new(big.Int),
Kip160CompatibleBlock: new(big.Int),
PragueCompatibleBlock: new(big.Int),
KaiaCompatibleBlock: new(big.Int),
Kip160CompatibleBlock: new(big.Int),
PragueCompatibleBlock: new(big.Int),
},
}

Expand Down
4 changes: 2 additions & 2 deletions tests/tx_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ func TestInvalidBalance(t *testing.T) {
prof := profile.NewProfiler()

// Initialize blockchain
bcdata, err := NewBCData(6, 4)
bcdata, err := NewBCDataWithForkConfig(6, 4, Forks["Prague"])
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -1370,7 +1370,7 @@ func TestInvalidBalanceBlockTx(t *testing.T) {
prof := profile.NewProfiler()

// Initialize blockchain
bcdata, err := NewBCData(6, 4)
bcdata, err := NewBCDataWithForkConfig(6, 4, Forks["Prague"])
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit a076be3

Please sign in to comment.