diff --git a/core/state/candidates/candidate_test.go b/core/state/candidates/candidate_test.go index 16aaa2f41..25bda862f 100644 --- a/core/state/candidates/candidate_test.go +++ b/core/state/candidates/candidate_test.go @@ -1006,8 +1006,8 @@ func TestCandidates_GetNewCandidates(t *testing.T) { { Owner: [20]byte{1}, Coin: 0, - Value: "1000000000000000", - BipValue: "1000000000000000", + Value: "1000000000000000000000", + BipValue: "1000000000000000000000", }, }, nil) candidates.SetOnline([32]byte{4}) @@ -1017,8 +1017,8 @@ func TestCandidates_GetNewCandidates(t *testing.T) { { Owner: [20]byte{1}, Coin: 0, - Value: "1000000000000000", - BipValue: "1000000000000000", + Value: "1000000000000000000000", + BipValue: "1000000000000000000000", }, }, nil) candidates.SetOnline([32]byte{5}) diff --git a/core/state/candidates/candidates.go b/core/state/candidates/candidates.go index 61d6debce..5bd91eaf9 100644 --- a/core/state/candidates/candidates.go +++ b/core/state/candidates/candidates.go @@ -37,7 +37,7 @@ const ( ) var ( - minValidatorBipStake = big.NewInt(1000) + minValidatorBipStake = helpers.BipToPip(big.NewInt(1000)) ) // RCandidates interface represents Candidates state diff --git a/core/state/candidates_test.go b/core/state/candidates_test.go index a32a9e210..0c9428fe0 100644 --- a/core/state/candidates_test.go +++ b/core/state/candidates_test.go @@ -338,7 +338,7 @@ func TestDoubleAbsentPenalty(t *testing.T) { pubkey := createTestCandidate(st) coin := types.GetBaseCoinID() - amount := big.NewInt(1000) + amount := helpers.BipToPip(big.NewInt(1000)) var addr types.Address binary.BigEndian.PutUint64(addr[:], 1) st.Candidates.Delegate(addr, pubkey, coin, amount, big.NewInt(0)) diff --git a/core/state/validators/validators_test.go b/core/state/validators/validators_test.go index 09e6327a5..09908d1f7 100644 --- a/core/state/validators/validators_test.go +++ b/core/state/validators/validators_test.go @@ -12,6 +12,7 @@ import ( "github.com/MinterTeam/minter-go-node/core/state/candidates" "github.com/MinterTeam/minter-go-node/core/state/checker" "github.com/MinterTeam/minter-go-node/core/types" + "github.com/MinterTeam/minter-go-node/helpers" "github.com/MinterTeam/minter-go-node/tree" db "github.com/tendermint/tm-db" "math/big" @@ -244,8 +245,8 @@ func TestValidators_PayRewards(t *testing.T) { { Owner: [20]byte{1}, Coin: 0, - Value: "10000", - BipValue: "10000", + Value: "1000000000000000000000", + BipValue: "1000000000000000000000", }, }, nil) candidatesS.RecalculateStakes(0) @@ -308,8 +309,8 @@ func TestValidators_SetValidatorAbsent(t *testing.T) { { Owner: [20]byte{1}, Coin: 0, - Value: "10000", - BipValue: "10000", + Value: "1000000000000000000000", + BipValue: "1000000000000000000000", }, }, nil) candidatesS.RecalculateStakes(0) @@ -402,7 +403,7 @@ func TestValidators_Export(t *testing.T) { newValidator := NewValidator( [32]byte{4}, types.NewBitArray(ValidatorMaxAbsentWindow), - big.NewInt(1000000), + helpers.BipToPip(big.NewInt(1000000)), big.NewInt(100), true, true, @@ -420,8 +421,8 @@ func TestValidators_Export(t *testing.T) { { Owner: [20]byte{1}, Coin: 0, - Value: "10000", - BipValue: "10000", + Value: "1000000000000000000000", + BipValue: "1000000000000000000000", }, }, nil) candidatesS.RecalculateStakes(0) @@ -440,7 +441,7 @@ func TestValidators_Export(t *testing.T) { t.Fatalf("version %d", version) } - if fmt.Sprintf("%X", hash) != "9387AD1250A4943193BCB44AFF1F4EBFEC626B53FD5A980181AFD7E03079862E" { + if fmt.Sprintf("%X", hash) != "1D50F5F03FAB5D800DBF8D9254DDC68AEAC589BD30F2839A3A5B68887CE0E34C" { t.Fatalf("hash %X", hash) } @@ -452,7 +453,7 @@ func TestValidators_Export(t *testing.T) { t.Fatal(err) } - if string(bytes) != "[{\"total_bip_stake\":\"10000\",\"public_key\":\"Mp0400000000000000000000000000000000000000000000000000000000000000\",\"accum_reward\":\"100\",\"absent_times\":\"________________________\"}]" { + if string(bytes) != "[{\"total_bip_stake\":\"1000000000000000000000\",\"public_key\":\"Mp0400000000000000000000000000000000000000000000000000000000000000\",\"accum_reward\":\"100\",\"absent_times\":\"________________________\"}]" { t.Log(string(bytes)) t.Fatal("not equal JSON") }