filecoin-project/go-amt-ipld

AMT fails to serialise as CBOR

iand opened this issue · 2 comments

iand commented

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

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

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