aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/types
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-27 20:47:32 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-15 22:09:55 +0800
commit8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47 (patch)
treeab7aed4bb7d580011469dda917483e785c234a32 /vendor/github.com/dexon-foundation/dexon-consensus/core/types
parentc52c9e04a916fac3550b0a3c3d8cdf979ab70bb8 (diff)
downloadgo-tangerine-8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47.tar
go-tangerine-8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47.tar.gz
go-tangerine-8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47.tar.bz2
go-tangerine-8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47.tar.lz
go-tangerine-8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47.tar.xz
go-tangerine-8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47.tar.zst
go-tangerine-8732c918f7b5d3dd9ac45b6e00995f5d74bc8a47.zip
core: merge notarySet and DKGSet (#265)
* vendor: sync to latest core * core: merge notarySet and dkgSet * dex: optimize network traffic for finalized block
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/types')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go31
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go5
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go6
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go8
4 files changed, 18 insertions, 32 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go
index 74360c735..b87e8a11d 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/block-randomness.go
@@ -26,27 +26,20 @@ import (
// AgreementResult describes an agremeent result.
type AgreementResult struct {
- BlockHash common.Hash `json:"block_hash"`
- Position Position `json:"position"`
- Votes []Vote `json:"votes"`
- IsEmptyBlock bool `json:"is_empty_block"`
+ BlockHash common.Hash `json:"block_hash"`
+ Position Position `json:"position"`
+ Votes []Vote `json:"votes"`
+ IsEmptyBlock bool `json:"is_empty_block"`
+ FinalizationHeight uint64 `json:"finalization_height"`
+ Randomness []byte `json:"randomness"`
}
func (r *AgreementResult) String() string {
- return fmt.Sprintf("agreementResult{Hash:%s %s}",
- r.BlockHash.String()[:6], r.Position)
-}
-
-// BlockRandomnessResult describes a block randomness result
-type BlockRandomnessResult struct {
- BlockHash common.Hash `json:"block_hash"`
- Position Position `json:"position"`
- Randomness []byte `json:"randomness"`
-}
-
-func (r *BlockRandomnessResult) String() string {
- return fmt.Sprintf("blockRandomness{Block:%s Pos:%s Rand:%s}",
+ if len(r.Randomness) == 0 {
+ return fmt.Sprintf("agreementResult{Block:%s Pos:%s}",
+ r.BlockHash.String()[:6], r.Position)
+ }
+ return fmt.Sprintf("agreementResult{Block:%s Pos:%s Rand:%s}",
r.BlockHash.String()[:6], r.Position,
- hex.EncodeToString(r.Randomness)[:6],
- )
+ hex.EncodeToString(r.Randomness)[:6])
}
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go
index eda09f06e..dce38369e 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/config.go
@@ -30,7 +30,6 @@ type Config struct {
// Set related.
NotarySetSize uint32
- DKGSetSize uint32
// Time related.
RoundLength uint64
@@ -43,7 +42,6 @@ func (c *Config) Clone() *Config {
LambdaBA: c.LambdaBA,
LambdaDKG: c.LambdaDKG,
NotarySetSize: c.NotarySetSize,
- DKGSetSize: c.DKGSetSize,
RoundLength: c.RoundLength,
MinBlockInterval: c.MinBlockInterval,
}
@@ -60,8 +58,6 @@ func (c *Config) Bytes() []byte {
binaryNotarySetSize := make([]byte, 4)
binary.LittleEndian.PutUint32(binaryNotarySetSize, c.NotarySetSize)
- binaryDKGSetSize := make([]byte, 4)
- binary.LittleEndian.PutUint32(binaryDKGSetSize, c.DKGSetSize)
binaryRoundLength := make([]byte, 8)
binary.LittleEndian.PutUint64(binaryRoundLength, c.RoundLength)
@@ -73,7 +69,6 @@ func (c *Config) Bytes() []byte {
enc = append(enc, binaryLambdaBA...)
enc = append(enc, binaryLambdaDKG...)
enc = append(enc, binaryNotarySetSize...)
- enc = append(enc, binaryDKGSetSize...)
enc = append(enc, binaryRoundLength...)
enc = append(enc, binaryMinBlockInterval...)
return enc
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go
index fccfbb6aa..806000763 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/nodeset.go
@@ -40,7 +40,6 @@ type subSetTargetType byte
const (
targetNotarySet subSetTargetType = iota
- targetDKGSet
targetNodeLeader
)
@@ -89,11 +88,6 @@ func NewNotarySetTarget(crs common.Hash) *SubSetTarget {
return newTarget(targetNotarySet, crs[:])
}
-// NewDKGSetTarget is the target for getting DKG Set.
-func NewDKGSetTarget(crs common.Hash) *SubSetTarget {
- return newTarget(targetDKGSet, crs[:])
-}
-
// NewNodeLeaderTarget is the target for getting leader of fast BA.
func NewNodeLeaderTarget(crs common.Hash, height uint64) *SubSetTarget {
binaryHeight := make([]byte, 8)
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go
index c4a625edd..8bc0c78c2 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/types/vote.go
@@ -22,6 +22,7 @@ import (
"github.com/dexon-foundation/dexon-consensus/common"
"github.com/dexon-foundation/dexon-consensus/core/crypto"
+ cryptoDKG "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg"
)
// VoteType is the type of vote.
@@ -61,8 +62,9 @@ type VoteHeader struct {
// Vote is the vote structure defined in Crypto Shuffle Algorithm.
type Vote struct {
- VoteHeader `json:"header"`
- Signature crypto.Signature `json:"signature"`
+ VoteHeader `json:"header"`
+ PartialSignature cryptoDKG.PartialSignature `json:"partial_signature"`
+ Signature crypto.Signature `json:"signature"`
}
func (v *Vote) String() string {
@@ -91,6 +93,8 @@ func (v *Vote) Clone() *Vote {
Period: v.Period,
Position: v.Position,
},
+ PartialSignature: cryptoDKG.PartialSignature(
+ crypto.Signature(v.PartialSignature).Clone()),
Signature: v.Signature.Clone(),
}
}