turbofish-org / merk

High-performance Merkle key/value store
Apache License 2.0
226 stars 36 forks source link

Fail early when exceeding maximum lengths #23

Open mappum opened 5 years ago

mappum commented 5 years ago

We use pretty conservative maximum lengths (255 bytes for keys, 65,535 bytes for values) for simplicity, compactness in the encoding, and to encourage efficient usage (large keys degrade performance and take up a lot of space in proofs). I could see these limits eventually changing if really necessary, but I'd like to keep them for now.

However, the limits are currently only enforced by panicking when encoding nodes - we should have earlier checks for these limits which error rather than panic.