-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dbft: move payloads/block/tx/crypto interfaces to dbft package
Close #90. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
- Loading branch information
1 parent
4a2c44d
commit 5a8dfed
Showing
38 changed files
with
628 additions
and
611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package dbft | ||
|
||
// Block is a generic interface for a block used by dbft. | ||
type Block[H Hash, A Address] interface { | ||
// Hash returns block hash. | ||
Hash() H | ||
|
||
Version() uint32 | ||
// PrevHash returns previous block hash. | ||
PrevHash() H | ||
// MerkleRoot returns a merkle root of the transaction hashes. | ||
MerkleRoot() H | ||
// Timestamp returns block's proposal timestamp. | ||
Timestamp() uint64 | ||
// Index returns block index. | ||
Index() uint32 | ||
// ConsensusData is a random nonce. | ||
ConsensusData() uint64 | ||
// NextConsensus returns hash of the validators of the next block. | ||
NextConsensus() A | ||
|
||
// Signature returns block's signature. | ||
Signature() []byte | ||
// Sign signs block and sets it's signature. | ||
Sign(key PrivateKey) error | ||
// Verify checks if signature is correct. | ||
Verify(key PublicKey, sign []byte) error | ||
|
||
// Transactions returns block's transaction list. | ||
Transactions() []Transaction[H] | ||
// SetTransactions sets block's transaction list. | ||
SetTransactions([]Transaction[H]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dbft | ||
|
||
// ChangeView represents dBFT ChangeView message. | ||
type ChangeView interface { | ||
// NewViewNumber returns proposed view number. | ||
NewViewNumber() byte | ||
|
||
// SetNewViewNumber sets the proposed view number. | ||
SetNewViewNumber(view byte) | ||
|
||
// Timestamp returns message's timestamp. | ||
Timestamp() uint64 | ||
|
||
// SetTimestamp sets message's timestamp. | ||
SetTimestamp(ts uint64) | ||
|
||
// Reason returns change view reason. | ||
Reason() ChangeViewReason | ||
|
||
// SetReason sets change view reason. | ||
SetReason(reason ChangeViewReason) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package payload | ||
package dbft | ||
|
||
//go:generate stringer -type=ChangeViewReason -linecomment | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
payload/changeviewreason_string.go → change_view_reason_string.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dbft | ||
|
||
// Commit is an interface for dBFT Commit message. | ||
type Commit interface { | ||
// Signature returns commit's signature field | ||
// which is a block signature for the current epoch. | ||
Signature() []byte | ||
|
||
// SetSignature sets commit's signature. | ||
SetSignature(signature []byte) | ||
} |
Oops, something went wrong.