holepunchto / hypercore

Hypercore is a secure, distributed append-only log.
https://docs.holepunch.to
MIT License
2.56k stars 183 forks source link

Ease of use signature update #260

Closed mafintosh closed 4 years ago

mafintosh commented 4 years ago

As part of v9 we are tweaking the data that is signed to explicitly contain the feed.length. This is a bit redundant as the signature already signs a hash of the merkle state which implicitly verifies the feed length through the merkle peak indexes.

However having it explicitly in the signature data has a couple of benefits:

For downsides... well we sign 8 extra bytes so not too bad but obviously this is a breaking change. To avoid too much disruption Hypercore v9 ships with a compat mode so it can still verify the old signatures, whilst signing new ones with the updated scheme.

This means Hypercore 9 can speak with Hypercore 8, storage format wise, but Hypercore 8 cannot speak with Hypercore 9's format if an append was made with 9.

For implementers the update means this:

Before we signed treeHash, now we sign concat(treeHash, uint64be(feed.length))

mafintosh commented 4 years ago

cc @Frando, relevant for rust impl

mafintosh commented 4 years ago

fixed in v9