types: change Commit to consist of just signatures (#4146)

* types: change `Commit` to consist of just signatures

These are final changes towards removing votes from commit and leaving
only signatures (see ADR-25)

Fixes #1648

* bring back TestCommitToVoteSetWithVotesForAnotherBlockOrNilBlock

+ add absent flag to Vote to indicate that it's for another block

* encode nil votes as CommitSig with BlockIDFlagAbsent

+ make Commit#Precommits array of non-pointers
because precommit will never be nil

* add NewCommitSigAbsent and Absent() funcs

* uncomment validation in CommitSig#ValidateBasic

* add comments to ValidatorSet funcs

* add a changelog entry

* break instead of continue

continue does not make sense in these cases

* types: rename Commit#Precommits to Signatures

* swagger: fix /commit response

* swagger: change block_id_flag type

* fix merge conflicts
This commit is contained in:
Anton Kaliaev
2019-11-26 14:10:38 +04:00
committed by GitHub
parent fb8b00f1d8
commit ad715fe966
30 changed files with 531 additions and 425 deletions

View File

@@ -1350,9 +1350,13 @@ definitions:
last_commit:
type: object
properties:
height:
type: number
round:
type: number
block_id:
$ref: "#/definitions/BlockID"
precommits:
signatures:
type: array
items:
$ref: "#/definitions/Commit"
@@ -1691,9 +1695,17 @@ definitions:
type: "object"
commit:
required:
- "height"
- "round"
- "block_id"
- "precommits"
- "signatures"
properties:
height:
type: "string"
example: "1311801"
round:
type: "string"
example: "0"
block_id:
required:
- "hash"
@@ -1715,50 +1727,20 @@ definitions:
example: "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
type: "object"
type: "object"
precommits:
signatures:
type: "array"
items:
type: "object"
properties:
type:
block_id_flag:
type: "number"
example: 2
height:
type: "string"
example: "12"
round:
type: "string"
example: "0"
block_id:
required:
- "hash"
- "parts"
properties:
hash:
type: "string"
example: "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7"
parts:
required:
- "total"
- "hash"
properties:
total:
type: "string"
example: "1"
hash:
type: "string"
example: "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
type: "object"
type: "object"
timestamp:
type: "string"
example: "2019-04-22T17:01:58.376629719Z"
validator_address:
type: "string"
example: "000001E443FD237E4B616E2FA69DF4EE3D49A94F"
validator_index:
timestamp:
type: "string"
example: "0"
example: "2019-04-22T17:01:58.376629719Z"
signature:
type: "string"
example: "14jaTQXYRt8kbLKEhdHq7AXycrFImiLuZx50uOjs2+Zv+2i7RTG/jnObD07Jo2ubZ8xd7bNBJMqkgtkd0oQHAw=="