From 4d8f8d260065284dc42bba3b7c9c93d744ffc546 Mon Sep 17 00:00:00 2001 From: zenground0 Date: Thu, 20 Jul 2023 16:37:03 -0600 Subject: [PATCH] Review Response --- cmd/lotus-bench/amt_internal.go | 9 ++++++--- cmd/lotus-bench/main.go | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/lotus-bench/amt_internal.go b/cmd/lotus-bench/amt_internal.go index ca45f92f3..f0e3035b7 100644 --- a/cmd/lotus-bench/amt_internal.go +++ b/cmd/lotus-bench/amt_internal.go @@ -1,3 +1,6 @@ +// Copied from go-amt-ipld https://github.com/filecoin-project/go-amt-ipld/tree/master/internal +// which for some reason is a go internal package and therefore cannot be imported + package main import ( @@ -59,7 +62,7 @@ func (t *AMTRoot) MarshalCBOR(w io.Writer) error { // t.Count (uint64) (uint64) - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Count)); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, t.Count); err != nil { return err } @@ -104,7 +107,7 @@ func (t *AMTRoot) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.BitWidth = uint64(extra) + t.BitWidth = extra } // t.Height (uint64) (uint64) @@ -118,7 +121,7 @@ func (t *AMTRoot) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.Height = uint64(extra) + t.Height = extra } // t.Count (uint64) (uint64) diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index cb3948e94..fc484c4e3 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -298,12 +298,14 @@ var amtBenchCmd = &cli.Command{ } for i := j; i < 40000000; i += interval { if i%interval == j { - array.Set(uint64(i), &market.DealState{ + if err := array.Set(uint64(i), &market.DealState{ SectorStartEpoch: abi.ChainEpoch(2000000 + i), LastUpdatedEpoch: abi.ChainEpoch(1), SlashEpoch: -1, VerifiedClaim: verifreg.AllocationId(i), - }) + }); err != nil { + return err + } } } roots[j], err = array.Root()