filecoin-project / go-amt-ipld

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

Set RetCode 200 for big ID #3

Closed taoshengshi closed 3 years ago

taoshengshi commented 4 years ago

@whyrusleeping could you please take a look at this issue ?

ssr.Set(sectorID, [][]byte{commR, commD}); here for big sector ID ,such as : 13882346955176149123 , ssr.Set will raise error : RetCode=200. in the lotus/chain/actors/actor_miner.go:510 :

func AddToSectorSet(ctx context.Context, s types.Storage, ss cid.Cid, sectorID uint64, commR, commD []byte) (cid.Cid, ActorError) {
    ssr, err := amt.LoadAMT(types.WrapStorage(s), ss)
    if err != nil {
        return cid.Undef, aerrors.HandleExternalError(err, "could not load sector set node")
    }

    if err := ssr.Set(sectorID, [][]byte{commR, commD}); err != nil {
        return cid.Undef, aerrors.HandleExternalError(err, "failed to set commitment in sector set")
    }

    ncid, err := ssr.Flush()
    if err != nil {
        return cid.Undef, aerrors.HandleExternalError(err, "failed to flush sector set")
    }

    return ncid, nil
}
Stebalien commented 3 years ago

The actors now validate sector IDs.