soft fail messages that cause precomitted sectors map to become too large

This commit is contained in:
whyrusleeping 2019-12-13 00:00:20 +01:00
parent cf9edae000
commit 28a325efe6
11 changed files with 23 additions and 9 deletions

View File

@ -9,7 +9,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf

View File

@ -264,6 +264,10 @@ func (sma StorageMinerActor) PreCommitSector(act *types.Actor, vmctx types.VMCon
ReceivedEpoch: vmctx.BlockHeight(),
}
if len(self.PreCommittedSectors) > 4096 {
return nil, aerrors.New(5, "too many precommitted sectors")
}
nstate, err := vmctx.Storage().Put(self)
if err != nil {
return nil, err

View File

@ -12,7 +12,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf
@ -204,6 +204,10 @@ func (t *StorageMinerActorState) MarshalCBOR(w io.Writer) error {
// t.PreCommittedSectors (map[string]*actors.PreCommittedSector) (map)
{
if len(t.PreCommittedSectors) > 4096 {
return xerrors.Errorf("cannot marshal t.PreCommittedSectors map too large")
}
if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.PreCommittedSectors))); err != nil {
return err
}
@ -1979,6 +1983,10 @@ func (t *PaymentChannelActorState) MarshalCBOR(w io.Writer) error {
// t.LaneStates (map[string]*actors.LaneState) (map)
{
if len(t.LaneStates) > 4096 {
return xerrors.Errorf("cannot marshal t.LaneStates map too large")
}
if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.LaneStates))); err != nil {
return err
}

View File

@ -10,7 +10,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf

View File

@ -11,7 +11,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf

View File

@ -10,7 +10,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf

2
go.mod
View File

@ -87,7 +87,7 @@ require (
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
github.com/stretchr/testify v1.4.0
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba
github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa
github.com/whyrusleeping/cbor-gen v0.0.0-20191212224538-d370462a7e8a
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d
go.opencensus.io v0.22.1

2
go.sum
View File

@ -590,6 +590,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d h1:NRa/Vs7+
github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa h1:iuIvC21JR4TcHtdCtkXz2jG8KCAK9ZJQQQxbDkFxkNE=
github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20191212224538-d370462a7e8a h1:xc8sbWMwBsvi8OrxFZR8zxw/fdCneHBLFDJJaV14eaE=
github.com/whyrusleeping/cbor-gen v0.0.0-20191212224538-d370462a7e8a/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=

View File

@ -9,7 +9,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf

View File

@ -8,7 +8,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf

View File

@ -8,7 +8,7 @@ import (
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
var _ = xerrors.Errorf