aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-09-26 18:19:12 +0800
committerGitHub <noreply@github.com>2018-09-26 18:19:12 +0800
commit9c2f700be09c27e8a8d12fc5bc0ccd017d408a32 (patch)
treebde8e80468af8535c8652210017553e2ed830d62 /core
parent0398468051068720688199442f53984b4071f4b2 (diff)
downloadtangerine-consensus-9c2f700be09c27e8a8d12fc5bc0ccd017d408a32.tar
tangerine-consensus-9c2f700be09c27e8a8d12fc5bc0ccd017d408a32.tar.gz
tangerine-consensus-9c2f700be09c27e8a8d12fc5bc0ccd017d408a32.tar.bz2
tangerine-consensus-9c2f700be09c27e8a8d12fc5bc0ccd017d408a32.tar.lz
tangerine-consensus-9c2f700be09c27e8a8d12fc5bc0ccd017d408a32.tar.xz
tangerine-consensus-9c2f700be09c27e8a8d12fc5bc0ccd017d408a32.tar.zst
tangerine-consensus-9c2f700be09c27e8a8d12fc5bc0ccd017d408a32.zip
core: rename crypto/eth to crypto/ecdsa (#144)
Diffstat (limited to 'core')
-rw-r--r--core/agreement-state_test.go10
-rw-r--r--core/agreement_test.go6
-rw-r--r--core/authenticator_test.go4
-rw-r--r--core/compaction-chain_test.go8
-rw-r--r--core/configuration-chain_test.go4
-rw-r--r--core/crypto/ecdsa/ecdsa.go (renamed from core/crypto/eth/eth.go)4
-rw-r--r--core/crypto/ecdsa/ecdsa_test.go (renamed from core/crypto/eth/eth_test.go)2
-rw-r--r--core/crypto_test.go12
-rw-r--r--core/dkg-tsig-protocol_test.go4
-rw-r--r--core/leader-selector_test.go12
-rw-r--r--core/shard_test.go4
-rw-r--r--core/test/blocks-generator.go4
-rw-r--r--core/test/governance.go4
13 files changed, 39 insertions, 39 deletions
diff --git a/core/agreement-state_test.go b/core/agreement-state_test.go
index 9c8c226..74ed7a0 100644
--- a/core/agreement-state_test.go
+++ b/core/agreement-state_test.go
@@ -25,7 +25,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/common"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
@@ -85,7 +85,7 @@ func (s *AgreementStateTestSuite) prepareVote(
}
func (s *AgreementStateTestSuite) SetupTest() {
- prvKey, err := eth.NewPrivateKey()
+ prvKey, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
s.ID = types.NewNodeID(prvKey.PublicKey())
s.prvKey = map[types.NodeID]crypto.PrivateKey{
@@ -105,7 +105,7 @@ func (s *AgreementStateTestSuite) newAgreement(numNode int) *agreement {
notarySet := make(types.NodeIDs, numNode-1)
for i := range notarySet {
- prvKey, err := eth.NewPrivateKey()
+ prvKey, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
notarySet[i] = types.NewNodeID(prvKey.PublicKey())
s.prvKey[notarySet[i]] = prvKey
@@ -156,7 +156,7 @@ func (s *AgreementStateTestSuite) TestPrepareState() {
// is more than 2f+1, proposing the block v.
a.data.period = 3
block := s.proposeBlock(a.data.leader)
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
block.ProposerID = types.NewNodeID(prv.PublicKey())
s.Require().Nil(a.data.leader.prepareBlock(block, prv))
@@ -180,7 +180,7 @@ func (s *AgreementStateTestSuite) TestAckState() {
blocks := make([]*types.Block, 3)
for i := range blocks {
blocks[i] = s.proposeBlock(a.data.leader)
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
blocks[i].ProposerID = types.NewNodeID(prv.PublicKey())
s.Require().Nil(a.data.leader.prepareBlock(blocks[i], prv))
diff --git a/core/agreement_test.go b/core/agreement_test.go
index 7780b94..2c98181 100644
--- a/core/agreement_test.go
+++ b/core/agreement_test.go
@@ -22,7 +22,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/common"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
"github.com/stretchr/testify/suite"
)
@@ -67,7 +67,7 @@ type AgreementTestSuite struct {
}
func (s *AgreementTestSuite) SetupTest() {
- prvKey, err := eth.NewPrivateKey()
+ prvKey, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
s.ID = types.NewNodeID(prvKey.PublicKey())
s.prvKey = map[types.NodeID]crypto.PrivateKey{
@@ -88,7 +88,7 @@ func (s *AgreementTestSuite) newAgreement(numNotarySet int) *agreement {
notarySet := make(types.NodeIDs, numNotarySet-1)
for i := range notarySet {
- prvKey, err := eth.NewPrivateKey()
+ prvKey, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
notarySet[i] = types.NewNodeID(prvKey.PublicKey())
s.prvKey[notarySet[i]] = prvKey
diff --git a/core/authenticator_test.go b/core/authenticator_test.go
index 08a9179..b6c08d7 100644
--- a/core/authenticator_test.go
+++ b/core/authenticator_test.go
@@ -22,7 +22,7 @@ import (
"time"
"github.com/dexon-foundation/dexon-consensus-core/common"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
"github.com/stretchr/testify/suite"
)
@@ -32,7 +32,7 @@ type AuthenticatorTestSuite struct {
}
func (s *AuthenticatorTestSuite) setupAuthenticator() *Authenticator {
- k, err := eth.NewPrivateKey()
+ k, err := ecdsa.NewPrivateKey()
s.NoError(err)
return NewAuthenticator(k)
}
diff --git a/core/compaction-chain_test.go b/core/compaction-chain_test.go
index 3664c81..6c8ec85 100644
--- a/core/compaction-chain_test.go
+++ b/core/compaction-chain_test.go
@@ -23,7 +23,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/common"
"github.com/dexon-foundation/dexon-consensus-core/core/blockdb"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
"github.com/stretchr/testify/suite"
)
@@ -94,7 +94,7 @@ func (s *CompactionChainTestSuite) TestProcessBlock() {
func (s *CompactionChainTestSuite) TestPrepareWitnessAck() {
cc := s.newCompactionChain()
blocks := s.generateBlocks(2, cc)
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
block := blocks[1]
@@ -113,9 +113,9 @@ func (s *CompactionChainTestSuite) TestPrepareWitnessAck() {
func (s *CompactionChainTestSuite) TestProcessWitnessAck() {
cc := s.newCompactionChain()
blocks := s.generateBlocks(10, cc)
- prv1, err := eth.NewPrivateKey()
+ prv1, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
- prv2, err := eth.NewPrivateKey()
+ prv2, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
nID1 := types.NewNodeID(prv1.PublicKey())
nID2 := types.NewNodeID(prv2.PublicKey())
diff --git a/core/configuration-chain_test.go b/core/configuration-chain_test.go
index 4c1e62d..fa3e2df 100644
--- a/core/configuration-chain_test.go
+++ b/core/configuration-chain_test.go
@@ -27,7 +27,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto/dkg"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/test"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
@@ -130,7 +130,7 @@ func (s *ConfigurationChainTestSuite) setupNodes(n int) {
s.dkgIDs = make(map[types.NodeID]dkg.ID)
ids := make(dkg.IDs, 0, n)
for i := 0; i < n; i++ {
- prvKey, err := eth.NewPrivateKey()
+ prvKey, err := ecdsa.NewPrivateKey()
s.Require().NoError(err)
nID := types.NewNodeID(prvKey.PublicKey())
s.nIDs = append(s.nIDs, nID)
diff --git a/core/crypto/eth/eth.go b/core/crypto/ecdsa/ecdsa.go
index 41d05eb..5f98395 100644
--- a/core/crypto/eth/eth.go
+++ b/core/crypto/ecdsa/ecdsa.go
@@ -15,7 +15,7 @@
// along with the dexon-consensus-core library. If not, see
// <http://www.gnu.org/licenses/>.
-package eth
+package ecdsa
import (
"crypto/ecdsa"
@@ -26,7 +26,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
)
-const cryptoType = "eth"
+const cryptoType = "ecdsa"
func init() {
crypto.RegisterSigToPub(cryptoType, SigToPub)
diff --git a/core/crypto/eth/eth_test.go b/core/crypto/ecdsa/ecdsa_test.go
index acda1a8..3543b04 100644
--- a/core/crypto/eth/eth_test.go
+++ b/core/crypto/ecdsa/ecdsa_test.go
@@ -15,7 +15,7 @@
// along with the dexon-consensus-core library. If not, see
// <http://www.gnu.org/licenses/>.
-package eth
+package ecdsa
import (
"testing"
diff --git a/core/crypto_test.go b/core/crypto_test.go
index 0d472cc..4c4955b 100644
--- a/core/crypto_test.go
+++ b/core/crypto_test.go
@@ -24,7 +24,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/common"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto/dkg"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
"github.com/stretchr/testify/suite"
)
@@ -99,7 +99,7 @@ func (s *CryptoTestSuite) generateCompactionChain(
}
func (s *CryptoTestSuite) TestWitnessAckSignature() {
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
pub := prv.PublicKey()
s.Require().Nil(err)
blocks, witnessAcks := s.generateCompactionChain(10, prv)
@@ -150,7 +150,7 @@ func (s *CryptoTestSuite) generateBlockChain(
}
func (s *CryptoTestSuite) TestBlockSignature() {
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
pub := prv.PublicKey()
s.Require().Nil(err)
blocks := s.generateBlockChain(10, prv)
@@ -178,7 +178,7 @@ func (s *CryptoTestSuite) TestBlockSignature() {
}
func (s *CryptoTestSuite) TestVoteSignature() {
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
pub := prv.PublicKey()
nID := types.NewNodeID(pub)
@@ -197,7 +197,7 @@ func (s *CryptoTestSuite) TestVoteSignature() {
func (s *CryptoTestSuite) TestCRSSignature() {
crs := common.NewRandomHash()
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
pub := prv.PublicKey()
nID := types.NewNodeID(pub)
@@ -212,7 +212,7 @@ func (s *CryptoTestSuite) TestCRSSignature() {
}
func (s *CryptoTestSuite) TestDKGSignature() {
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
nID := types.NewNodeID(prv.PublicKey())
prvShare := &types.DKGPrivateShare{
diff --git a/core/dkg-tsig-protocol_test.go b/core/dkg-tsig-protocol_test.go
index f7edcc2..967e07e 100644
--- a/core/dkg-tsig-protocol_test.go
+++ b/core/dkg-tsig-protocol_test.go
@@ -25,7 +25,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/common"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto/dkg"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/test"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
@@ -96,7 +96,7 @@ func (s *DKGTSIGProtocolTestSuite) setupDKGParticipants(n int) {
s.dkgIDs = make(map[types.NodeID]dkg.ID)
ids := make(dkg.IDs, 0, n)
for i := 0; i < n; i++ {
- prvKey, err := eth.NewPrivateKey()
+ prvKey, err := ecdsa.NewPrivateKey()
s.Require().NoError(err)
nID := types.NewNodeID(prvKey.PublicKey())
s.nIDs = append(s.nIDs, nID)
diff --git a/core/leader-selector_test.go b/core/leader-selector_test.go
index 2bc1847..8da7e2a 100644
--- a/core/leader-selector_test.go
+++ b/core/leader-selector_test.go
@@ -23,7 +23,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/dexon-foundation/dexon-consensus-core/common"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
@@ -38,7 +38,7 @@ func (s *LeaderSelectorTestSuite) newLeader() *leaderSelector {
func (s *LeaderSelectorTestSuite) TestDistance() {
leader := s.newLeader()
hash := common.NewRandomHash()
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
sig, err := prv.Sign(hash)
s.Require().Nil(err)
@@ -48,9 +48,9 @@ func (s *LeaderSelectorTestSuite) TestDistance() {
func (s *LeaderSelectorTestSuite) TestProbability() {
leader := s.newLeader()
- prv1, err := eth.NewPrivateKey()
+ prv1, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
- prv2, err := eth.NewPrivateKey()
+ prv2, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
for {
hash := common.NewRandomHash()
@@ -82,7 +82,7 @@ func (s *LeaderSelectorTestSuite) TestLeaderBlockHash() {
leader := s.newLeader()
blocks := make(map[common.Hash]*types.Block)
for i := 0; i < 10; i++ {
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
block := &types.Block{
ProposerID: types.NewNodeID(prv.PublicKey()),
@@ -107,7 +107,7 @@ func (s *LeaderSelectorTestSuite) TestLeaderBlockHash() {
func (s *LeaderSelectorTestSuite) TestPrepareBlock() {
leader := s.newLeader()
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
s.Require().Nil(err)
block := &types.Block{
ProposerID: types.NewNodeID(prv.PublicKey()),
diff --git a/core/shard_test.go b/core/shard_test.go
index 2a15f53..1b524ba 100644
--- a/core/shard_test.go
+++ b/core/shard_test.go
@@ -23,7 +23,7 @@ import (
"time"
"github.com/dexon-foundation/dexon-consensus-core/core/blockdb"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/test"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
"github.com/stretchr/testify/suite"
@@ -92,7 +92,7 @@ type ShardTestSuite struct {
func (s *ShardTestSuite) newTestShardMgr(cfg *types.Config) *testShardMgr {
var req = s.Require()
// Setup private key.
- prvKey, err := eth.NewPrivateKey()
+ prvKey, err := ecdsa.NewPrivateKey()
req.Nil(err)
// Setup blockdb.
db, err := blockdb.NewMemBackedBlockDB()
diff --git a/core/test/blocks-generator.go b/core/test/blocks-generator.go
index eacc436..904ee7a 100644
--- a/core/test/blocks-generator.go
+++ b/core/test/blocks-generator.go
@@ -26,7 +26,7 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/common"
"github.com/dexon-foundation/dexon-consensus-core/core/blockdb"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
@@ -276,7 +276,7 @@ func (gen *BlocksGenerator) Generate(
}
nodePrvKeys = map[types.NodeID]crypto.PrivateKey{}
for i := uint32(0); i < chainNum; i++ {
- if prvKey, err = eth.NewPrivateKey(); err != nil {
+ if prvKey, err = ecdsa.NewPrivateKey(); err != nil {
return
}
id := types.NewNodeID(prvKey.PublicKey())
diff --git a/core/test/governance.go b/core/test/governance.go
index 81b71e5..7eca6f6 100644
--- a/core/test/governance.go
+++ b/core/test/governance.go
@@ -23,7 +23,7 @@ import (
"time"
"github.com/dexon-foundation/dexon-consensus-core/core/crypto"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto/eth"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
@@ -58,7 +58,7 @@ func NewGovernance(nodeCount int, lambda time.Duration) (
DKGMasterPublicKey: make(map[uint64][]*types.DKGMasterPublicKey),
}
for i := 0; i < nodeCount; i++ {
- prv, err := eth.NewPrivateKey()
+ prv, err := ecdsa.NewPrivateKey()
if err != nil {
return nil, err
}