-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blockchain: introduce Fingerprint and change singing schema
So far signing schema was such that validators would sign Borsh-selialised block. This had two undesirable properties: 1. If the same validator signed blocks for two different blockchains, the could be accused of double signing since there was no way to distinguish that signatures belong to two different chains. 2. To prove misbehaviour, full block had to be transmitted. This becomes a bit of an issue for blocks which are final in an epoch since those include new epoch which may be couple KB in size. This commit introduces a Fingerprint which is what validators sign. The fingerprint is concatenation of a) genesis block hash, b) block height as little endian¹ and c) block hash. This addresses the above concerns: 1. Since fingerprint includes chain’s genesis hash (which uniquely identifies a chain) it’s now possible to distinguish signatures made for two different chains. 2. The fingerprint is always 72 bytes long so there’s never an issue of an unbound growth. The only concern is that rather than signing the serialised representation of the block, the validators sign just the hash. However, the assumption of any blockchain is that hash of a block uniquely identifies the block and it’s impossible to create two blocks with the same hash. As such, signing just the hash is equivalent to signing the whole block (regardless of the signing algorithm). ____ ¹ Little endian was chosen for consistency with borsh. Normally my preference is to use big endian representation but since we’re using Borsh for calculating hash and Borsh uses little endian I’ve figured it might be confusing if Fingerprint didn’t follow that format as well.
- Loading branch information
Showing
4 changed files
with
167 additions
and
50 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
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