filecoin-project / go-amt-ipld

Implementation of an array mapped trie using go and ipld
Other
9 stars 15 forks source link

AMT fails to serialise as CBOR #64

Open iand opened 2 years ago

iand commented 2 years ago

When bitwidth is 14 or 15 CBOR marshalliing fails with error Slice value in field t.Values was too long

Only noticeable in benchmarks:

WIDTH 14
BenchmarkAMTInsertBulk-8              72      16396264 ns/op             1.000 gets/op           1.000 puts/op   2631620 B/op      80052 allocs/op
BenchmarkAMTLoadAndInsert-8     --- FAIL: BenchmarkAMTLoadAndInsert-8
    amt_test.go:692: Slice value in field t.Values was too long
BenchmarkNodesForHeight-8       1000000000           0.2395 ns/op          0 B/op          0 allocs/op
FAIL
WIDTH 15
BenchmarkAMTInsertBulk-8              74      16356505 ns/op             1.000 gets/op           1.000 puts/op   2895588 B/op      80051 allocs/op
BenchmarkAMTLoadAndInsert-8     --- FAIL: BenchmarkAMTLoadAndInsert-8
    amt_test.go:692: Slice value in field t.Values was too long
Stebalien commented 2 years ago

We probably want the maximum to be, like, 10.

Stebalien commented 2 years ago

With 14, we're allowing 2^14 entries.