Skip to content

Commit

Permalink
Double sign unit test (#2955)
Browse files Browse the repository at this point in the history
* [test] added schedule for sharding

* [test] refactored double_sign_test.go

* [test] comment out all test cases for now.

* [test] added record Copy method for testing

* [test] added the first test case in TestVerify

* [test] finished test TestVerify

* [test] Added test TestVerify, TestApplySlashRate, TestSetDifference

* [test] half through TestDelegatorSlashApply

* [test] fix the problem cause by unsafe usage of big.Int

* [staking] added the copy methods to validatorWrapper

* [test] added test cases for copy method for staking/validatorWrapper

* [test] added test case TestApply

* [test] added test case TestRate

* [test] fix the golint errors

* [test] removed commented out unit test code

* [test] remote the empty line in imports

* [test] moved copy methods to stake_testing module

* [test] removed usage of interface stateDB

* [test] removed empty lines in imports

* [test] fixed golint package name issues

* [test] removed a todo when writing code

* [test] moved record.Copy to staking/slash/test
  • Loading branch information
JackyWYX authored May 9, 2020
1 parent 211ed79 commit 1fce5cb
Show file tree
Hide file tree
Showing 13 changed files with 1,703 additions and 485 deletions.
3 changes: 1 addition & 2 deletions internal/configs/sharding/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package shardingconfig
import (
"math/big"

"github.com/harmony-one/harmony/numeric"

"github.com/harmony-one/harmony/internal/genesis"
"github.com/harmony-one/harmony/internal/params"
"github.com/harmony-one/harmony/numeric"
)

// TestnetSchedule is the long-running public testnet sharding
Expand Down
9 changes: 0 additions & 9 deletions staking/slash/double-sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ import (
consensus_sig "github.com/harmony-one/harmony/consensus/signature"
"github.com/harmony-one/harmony/consensus/votepower"
"github.com/harmony-one/harmony/core/state"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/crypto/hash"
common2 "github.com/harmony-one/harmony/internal/common"
"github.com/harmony-one/harmony/internal/params"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/numeric"
"github.com/harmony-one/harmony/shard"
Expand Down Expand Up @@ -143,13 +141,6 @@ func (r Record) String() string {
return string(s)
}

// CommitteeReader ..
type CommitteeReader interface {
Config() *params.ChainConfig
ReadShardState(epoch *big.Int) (*shard.State, error)
CurrentBlock() *types.Block
}

// Verify checks that the slash is valid
func Verify(
chain CommitteeReader,
Expand Down
Loading

0 comments on commit 1fce5cb

Please sign in to comment.