hypercore-protocol / hypercore-next

Hypercore 10 is an append only log with multi-writer primitives built in.
MIT License
150 stars 15 forks source link

make keypair optional for later static cores and persist tree hash in header #25

Closed mafintosh closed 3 years ago

mafintosh commented 3 years ago

This is a minor breaking change that'll

  1. Make the key pair field optional in the header. This allows a) to make a breaking change later (doubt we will) b) more importantly to support static cores easily later on (ie no keypair -> static core)
  2. Always persist the tree hash in the header. This has negligle overhead (we are writing 32 bytes more on each upgrade, benchs showed no diff), but always static cores easily and to more easily do audits in the future, as the header is fully self describing.

By self describing we mean:

Has rootHash, length, fork and signature. From there we can checkout and verify the full stored merkle tree. From there we can verify which data blocks we have fully and from there we can generate the bitfield we have.

mafintosh commented 3 years ago

@andrewosh will do the length prefix later, but we need that. can you put that in an issue?

mafintosh commented 3 years ago

@chm-diederichs @davidmarkclements small breaking change on top of the oplog from yesterday