Merge pull request #6 from filecoin-project/feat/update-actors
Update specs-actors, windowed post updates
This commit is contained in:
commit
9209a5f186
5
go.mod
5
go.mod
@ -4,13 +4,14 @@ go 1.13
|
||||
|
||||
require (
|
||||
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be
|
||||
github.com/filecoin-project/go-bitfield v0.0.0-20200415174627-536a2ee8529d // indirect
|
||||
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2
|
||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5
|
||||
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6
|
||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 // indirect
|
||||
github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9
|
||||
github.com/filecoin-project/sector-storage v0.0.0-20200411000242-61616264b16d
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200415170224-54c7b2a42e71
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275
|
||||
github.com/ipfs/go-cid v0.0.5
|
||||
github.com/ipfs/go-datastore v0.4.4
|
||||
@ -19,7 +20,7 @@ require (
|
||||
github.com/ipfs/go-log/v2 v2.0.3
|
||||
github.com/libp2p/go-libp2p-core v0.5.0 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200321164527-9340289d0ca7
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e
|
||||
go.uber.org/zap v1.14.1 // indirect
|
||||
golang.org/x/crypto v0.0.0-20200317142112-1b76d66859c6 // indirect
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
|
||||
|
8
go.sum
8
go.sum
@ -92,6 +92,8 @@ github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e
|
||||
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e/go.mod h1:boRtQhzmxNocrMxOXo1NYn4oUc1NGvR8tEa79wApNXg=
|
||||
github.com/filecoin-project/go-bitfield v0.0.0-20200309034705-8c7ac40bd550 h1:aockulLU8Qjkdj4FQz53WQpNosAIYk8DxRediRLkE5c=
|
||||
github.com/filecoin-project/go-bitfield v0.0.0-20200309034705-8c7ac40bd550/go.mod h1:iodsLxOFZnqKtjj2zkgqzoGNrv6vUqj69AT/J8DKXEw=
|
||||
github.com/filecoin-project/go-bitfield v0.0.0-20200415174627-536a2ee8529d h1:ufxUB1ssNdti7SgDNnHXZ863F8g04/yx+EW4ygvGcSU=
|
||||
github.com/filecoin-project/go-bitfield v0.0.0-20200415174627-536a2ee8529d/go.mod h1:iodsLxOFZnqKtjj2zkgqzoGNrv6vUqj69AT/J8DKXEw=
|
||||
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 h1:av5fw6wmm58FYMgJeoB/lK9XXrgdugYiTqkdxjTy9k8=
|
||||
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg=
|
||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMXdBnCiXjfCYx/hLqFxccPoqsSveQFxVLvNxy9bus=
|
||||
@ -119,6 +121,8 @@ github.com/filecoin-project/sector-storage v0.0.0-20200411000242-61616264b16d/go
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504 h1:mwuAaqxKThl70+7FkGdFKVLdwaQZQ8XmscKdhSBBtnc=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504/go.mod h1:mdJraXq5vMy0+/FqVQIrnNlpQ/Em6zeu06G/ltQ0/lA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200415170224-54c7b2a42e71 h1:kmU2Y+QIuUQG+1lELiLdcX/UMd+BVkSlX8jnii87+ZY=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200415170224-54c7b2a42e71/go.mod h1:M2HNOBpYbgXl/V4GmJFOsY7lQNuAmOtrCQMa6Yfpfrc=
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275 h1:6OTcpsTQBQM0f/A67oEi4E4YtYd6fzkMqbU8cPIWMMs=
|
||||
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
@ -633,8 +637,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0/go.mod h1:x
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200121162646-b63bacf5eaf8/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200206220010-03c9665e2a66/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200321164527-9340289d0ca7 h1:SVU2yhhHHamTPIMT9kk28KSYdO3ykTZeIp5p+6G9qNk=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200321164527-9340289d0ca7/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e h1:JY8o/ebUUrCYetWmjRCNghxC59cOEaili83rxPRQCLw=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
|
||||
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
|
||||
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
)
|
||||
|
||||
type PreCommitPolicy interface {
|
||||
@ -31,14 +32,16 @@ type Chain interface {
|
||||
type BasicPreCommitPolicy struct {
|
||||
api Chain
|
||||
|
||||
duration abi.ChainEpoch
|
||||
provingBoundary abi.ChainEpoch
|
||||
duration abi.ChainEpoch
|
||||
}
|
||||
|
||||
// NewBasicPreCommitPolicy produces a BasicPreCommitPolicy
|
||||
func NewBasicPreCommitPolicy(api Chain, duration abi.ChainEpoch) BasicPreCommitPolicy {
|
||||
func NewBasicPreCommitPolicy(api Chain, duration abi.ChainEpoch, provingBoundary abi.ChainEpoch) BasicPreCommitPolicy {
|
||||
return BasicPreCommitPolicy{
|
||||
api: api,
|
||||
duration: duration,
|
||||
api: api,
|
||||
provingBoundary: provingBoundary,
|
||||
duration: duration,
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +66,8 @@ func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi
|
||||
}
|
||||
|
||||
if end == nil || *end < p.DealInfo.DealSchedule.EndEpoch {
|
||||
end = &p.DealInfo.DealSchedule.EndEpoch
|
||||
tmp := p.DealInfo.DealSchedule.EndEpoch
|
||||
end = &tmp
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,5 +76,7 @@ func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi
|
||||
end = &tmp
|
||||
}
|
||||
|
||||
*end += miner.WPoStProvingPeriod - (*end % miner.WPoStProvingPeriod) + p.provingBoundary - 1
|
||||
|
||||
return *end, nil
|
||||
}
|
||||
|
@ -24,18 +24,18 @@ func (f *fakeChain) ChainHead(ctx context.Context) (sealing.TipSetToken, abi.Cha
|
||||
func TestBasicPolicyEmptySector(t *testing.T) {
|
||||
policy := sealing.NewBasicPreCommitPolicy(&fakeChain{
|
||||
h: abi.ChainEpoch(55),
|
||||
}, 10)
|
||||
}, 10, 0)
|
||||
|
||||
exp, err := policy.Expiration(context.Background())
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, 65, int(exp))
|
||||
assert.Equal(t, 3455, int(exp))
|
||||
}
|
||||
|
||||
func TestBasicPolicyMostConstrictiveSchedule(t *testing.T) {
|
||||
policy := sealing.NewBasicPreCommitPolicy(&fakeChain{
|
||||
h: abi.ChainEpoch(55),
|
||||
}, 100)
|
||||
}, 100, 11)
|
||||
|
||||
pieces := []sealing.Piece{
|
||||
{
|
||||
@ -69,13 +69,13 @@ func TestBasicPolicyMostConstrictiveSchedule(t *testing.T) {
|
||||
exp, err := policy.Expiration(context.Background(), pieces...)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, 100, int(exp))
|
||||
assert.Equal(t, 3466, int(exp))
|
||||
}
|
||||
|
||||
func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) {
|
||||
policy := sealing.NewBasicPreCommitPolicy(&fakeChain{
|
||||
h: abi.ChainEpoch(55),
|
||||
}, 100)
|
||||
}, 100, 0)
|
||||
|
||||
pieces := []sealing.Piece{
|
||||
{
|
||||
@ -96,13 +96,13 @@ func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) {
|
||||
exp, err := policy.Expiration(context.Background(), pieces...)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, 155, int(exp))
|
||||
assert.Equal(t, 3455, int(exp))
|
||||
}
|
||||
|
||||
func TestMissingDealIsIgnored(t *testing.T) {
|
||||
policy := sealing.NewBasicPreCommitPolicy(&fakeChain{
|
||||
h: abi.ChainEpoch(55),
|
||||
}, 100)
|
||||
}, 100, 11)
|
||||
|
||||
pieces := []sealing.Piece{
|
||||
{
|
||||
@ -130,5 +130,5 @@ func TestMissingDealIsIgnored(t *testing.T) {
|
||||
exp, err := policy.Expiration(context.Background(), pieces...)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, 155, int(exp))
|
||||
assert.Equal(t, 3466, int(exp))
|
||||
}
|
||||
|
@ -32,10 +32,12 @@ type SealingAPI interface {
|
||||
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*miner.SectorPreCommitOnChainInfo, error)
|
||||
StateMinerSectorSize(context.Context, address.Address, TipSetToken) (abi.SectorSize, error)
|
||||
StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok TipSetToken) (address.Address, error)
|
||||
StateMinerDeadlines(ctx context.Context, maddr address.Address, tok TipSetToken) (*miner.Deadlines, error)
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, TipSetToken) (market.DealProposal, market.DealState, error)
|
||||
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, gasPrice big.Int, gasLimit int64, params []byte) (cid.Cid, error)
|
||||
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error)
|
||||
ChainGetRandomness(ctx context.Context, tok TipSetToken, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
|
||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||
}
|
||||
|
||||
type Sealing struct {
|
||||
|
36
states.go
36
states.go
@ -290,12 +290,40 @@ func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) erro
|
||||
// TODO: check if the fault has already been reported, and that this sector is even valid
|
||||
|
||||
// TODO: coalesce faulty sector reporting
|
||||
|
||||
// TODO: ReportFaultFailed
|
||||
bf := abi.NewBitField()
|
||||
bf.Set(uint64(sector.SectorNumber))
|
||||
|
||||
params := &miner.DeclareTemporaryFaultsParams{
|
||||
SectorNumbers: bf,
|
||||
Duration: 99999999, // TODO: This is very unlikely to be the correct number
|
||||
deadlines, err := m.api.StateMinerDeadlines(ctx.Context(), m.maddr, nil)
|
||||
if err != nil {
|
||||
log.Errorf("handleFaulty: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
deadline := -1
|
||||
for d, field := range deadlines.Due {
|
||||
set, err := field.IsSet(uint64(sector.SectorNumber))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if set {
|
||||
deadline = d
|
||||
break
|
||||
}
|
||||
}
|
||||
if deadline == -1 {
|
||||
log.Errorf("handleFaulty: deadline not found")
|
||||
return nil
|
||||
}
|
||||
|
||||
params := &miner.DeclareFaultsParams{
|
||||
Faults: []miner.FaultDeclaration{
|
||||
{
|
||||
Deadline: uint64(deadline),
|
||||
Sectors: bf,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
enc := new(bytes.Buffer)
|
||||
@ -315,7 +343,7 @@ func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin.MethodsMiner.DeclareTemporaryFaults, big.NewInt(0), big.NewInt(1), 1000000, enc.Bytes())
|
||||
mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin.MethodsMiner.DeclareFaults, big.NewInt(0), big.NewInt(1), 1000000, enc.Bytes())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to push declare faults message to network: %w", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user