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:
If you share a tuple of (treeHash, feedLength, signature) you can easily verify this independently without having to replicate any extra merkle data. This is important for "strong links" where you want to strongly link against a hypercore's history.
Having an extra step of small metadata to sign opens up for adding a potential fork resolution vector clock in the future.
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))
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:
(treeHash, feedLength, signature)
you can easily verify this independently without having to replicate any extra merkle data. This is important for "strong links" where you want to strongly link against a hypercore's history.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 signconcat(treeHash, uint64be(feed.length))