Update deps

This commit is contained in:
Łukasz Magiera 2020-01-14 03:04:33 +01:00
parent 2ca0c152ba
commit 94a21e3aeb
11 changed files with 32 additions and 30 deletions

View File

@ -64,7 +64,7 @@ func TestDealFlow(t *testing.T, b APIBuilder) {
go func() { go func() {
defer close(done) defer close(done)
for mine { for mine {
time.Sleep(100 * time.Millisecond) time.Sleep(10 * time.Millisecond)
fmt.Println("mining a block now") fmt.Println("mining a block now")
if err := sn[0].MineOne(ctx); err != nil { if err := sn[0].MineOne(ctx); err != nil {
t.Error(err) t.Error(err)

View File

@ -254,7 +254,7 @@ func getMinerSectorSet(ctx context.Context, st types.StateTree, bs blockstore.Bl
func (h *Harness) makeFakeDeal(t *testing.T, miner, worker, client address.Address, size uint64) *actors.StorageDealProposal { func (h *Harness) makeFakeDeal(t *testing.T, miner, worker, client address.Address, size uint64) *actors.StorageDealProposal {
data := make([]byte, size) data := make([]byte, size)
rand.Read(data) rand.Read(data)
commP, err := (&sectorbuilder.SectorBuilder{}).GeneratePieceCommitment(bytes.NewReader(data), size) commP, err := sectorbuilder.GeneratePieceCommitment(bytes.NewReader(data), size)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -800,7 +800,6 @@ func (cs *ChainStore) VMSys() *types.VMSyscalls {
return cs.vmcalls return cs.vmcalls
} }
func (cs *ChainStore) TryFillTipSet(ts *types.TipSet) (*FullTipSet, error) { func (cs *ChainStore) TryFillTipSet(ts *types.TipSet) (*FullTipSet, error) {
var out []*types.FullBlock var out []*types.FullBlock

View File

@ -24,6 +24,6 @@ func Syscalls(verifier sectorbuilder.Verifier) *types.VMSyscalls {
return ok, nil return ok, nil
}, },
VerifyFallbackPost: verifier.VerifyFallbackPost, VerifyFallbackPost: verifier.VerifyFallbackPost,
} }
} }

10
go.mod
View File

@ -16,10 +16,10 @@ require (
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42 github.com/filecoin-project/go-fil-markets v0.0.0-20200114015428-74d100f305f8
github.com/filecoin-project/go-paramfetch v0.0.1 github.com/filecoin-project/go-paramfetch v0.0.1
github.com/filecoin-project/go-sectorbuilder v0.0.0-20200109194458-9656ce473254 github.com/filecoin-project/go-sectorbuilder v0.0.1
github.com/filecoin-project/go-statestore v0.0.0-20200102200712-1f63c701c1e5 github.com/filecoin-project/go-statestore v0.1.0
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
github.com/go-ole/go-ole v1.2.4 // indirect github.com/go-ole/go-ole v1.2.4 // indirect
github.com/gorilla/mux v1.7.3 github.com/gorilla/mux v1.7.3
@ -109,7 +109,3 @@ require (
replace github.com/golangci/golangci-lint => github.com/golangci/golangci-lint v1.18.0 replace github.com/golangci/golangci-lint => github.com/golangci/golangci-lint v1.18.0
replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi
replace github.com/filecoin-project/go-sectorbuilder => /home/magik6k/gohack/github.com/filecoin-project/go-sectorbuilder
replace github.com/filecoin-project/go-fil-markets => /home/magik6k/gohack/github.com/filecoin-project/go-fil-markets

6
go.sum
View File

@ -111,6 +111,8 @@ github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww= github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww=
github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42 h1:7OW2AiWtwxwtYnC16CiXZ/idQ7w3W7W1hhX+N4YSAyQ= github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42 h1:7OW2AiWtwxwtYnC16CiXZ/idQ7w3W7W1hhX+N4YSAyQ=
github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42/go.mod h1:Q5fvJGMISyUIna19DpoqiqTas4L9RVD7w3Udv7uCrTo= github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42/go.mod h1:Q5fvJGMISyUIna19DpoqiqTas4L9RVD7w3Udv7uCrTo=
github.com/filecoin-project/go-fil-markets v0.0.0-20200114015428-74d100f305f8 h1:g3oodvSz+Ou+ObwcVBB2wyt8SHdWpwzMiNJ19U1zZNA=
github.com/filecoin-project/go-fil-markets v0.0.0-20200114015428-74d100f305f8/go.mod h1:c8NTjvFVy1Ud02mmGDjOiMeawY2t6ALfrrdvAB01FQc=
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA= github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA=
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA= github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA=
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU= github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
@ -120,9 +122,13 @@ github.com/filecoin-project/go-paramfetch v0.0.1 h1:gV7bs5YaqlgpGFMiLxInGK2L1FyC
github.com/filecoin-project/go-paramfetch v0.0.1/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc= github.com/filecoin-project/go-paramfetch v0.0.1/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc=
github.com/filecoin-project/go-sectorbuilder v0.0.0-20200109194458-9656ce473254 h1:4IvlPad82JaNBtqh8fEAUIKWv8I3tguAJjGvUyHNZS4= github.com/filecoin-project/go-sectorbuilder v0.0.0-20200109194458-9656ce473254 h1:4IvlPad82JaNBtqh8fEAUIKWv8I3tguAJjGvUyHNZS4=
github.com/filecoin-project/go-sectorbuilder v0.0.0-20200109194458-9656ce473254/go.mod h1:3OZ4E3B2OuwhJjtxR4r7hPU9bCfB+A+hm4alLEsaeDc= github.com/filecoin-project/go-sectorbuilder v0.0.0-20200109194458-9656ce473254/go.mod h1:3OZ4E3B2OuwhJjtxR4r7hPU9bCfB+A+hm4alLEsaeDc=
github.com/filecoin-project/go-sectorbuilder v0.0.1 h1:yiLSEprWA1E43DFTSCXLSuCstYuDKiI6RCXiYz4GaRs=
github.com/filecoin-project/go-sectorbuilder v0.0.1/go.mod h1:3OZ4E3B2OuwhJjtxR4r7hPU9bCfB+A+hm4alLEsaeDc=
github.com/filecoin-project/go-statestore v0.0.0-20191219195854-7a95521e8f15/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= github.com/filecoin-project/go-statestore v0.0.0-20191219195854-7a95521e8f15/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
github.com/filecoin-project/go-statestore v0.0.0-20200102200712-1f63c701c1e5 h1:NZXq90YlfakSmB2/84dGr0AVmKYFA97+yyViBIgTFbk= github.com/filecoin-project/go-statestore v0.0.0-20200102200712-1f63c701c1e5 h1:NZXq90YlfakSmB2/84dGr0AVmKYFA97+yyViBIgTFbk=
github.com/filecoin-project/go-statestore v0.0.0-20200102200712-1f63c701c1e5/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= github.com/filecoin-project/go-statestore v0.0.0-20200102200712-1f63c701c1e5/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIiWBRilQjQ+5IiwdQ=
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0= github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=

View File

@ -46,7 +46,7 @@ func init() {
build.MinimumMinerPower = 1024 build.MinimumMinerPower = 1024
} }
func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, act address.Address, pk crypto.PrivKey, tnd test.TestNode, mn mocknet.Mocknet) test.TestStorageNode { func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, act address.Address, pk crypto.PrivKey, tnd test.TestNode, mn mocknet.Mocknet, opts node.Option) test.TestStorageNode {
r := repo.NewMemory(nil) r := repo.NewMemory(nil)
lr, err := r.Lock(repo.StorageMiner) lr, err := r.Lock(repo.StorageMiner)
@ -103,10 +103,11 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a
node.Test(), node.Test(),
node.MockHost(mn), node.MockHost(mn),
node.Override(new(sectorbuilder.Interface), sbmock.NewMockSectorBuilder(5, build.SectorSizes[0])),
node.Override(new(api.FullNode), tnd), node.Override(new(api.FullNode), tnd),
node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, act)), node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, act)),
opts,
) )
if err != nil { if err != nil {
t.Fatalf("failed to construct node: %v", err) t.Fatalf("failed to construct node: %v", err)
@ -216,7 +217,7 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
genMiner := gmc.MinerAddrs[i] genMiner := gmc.MinerAddrs[i]
wa := gmc.PreSeals[genMiner.String()].Worker wa := gmc.PreSeals[genMiner.String()].Worker
storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn) storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn, node.Options())
sma := storers[i].StorageMiner.(*impl.StorageMinerAPI) sma := storers[i].StorageMiner.(*impl.StorageMinerAPI)
@ -337,12 +338,9 @@ func mockSbBuilder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []t
genMiner := gmc.MinerAddrs[i] genMiner := gmc.MinerAddrs[i]
wa := gmc.PreSeals[genMiner.String()].Worker wa := gmc.PreSeals[genMiner.String()].Worker
storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn) storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn, node.Options(
node.Override(new(sectorbuilder.Interface), sbmock.NewMockSectorBuilder(5, build.SectorSizes[0])),
/*if err := sma.SectorBuilder.ImportFrom(osb, false); err != nil { ))
t.Fatal(err)
}*/
} }
if err := mn.LinkAll(); err != nil { if err := mn.LinkAll(); err != nil {
@ -352,7 +350,6 @@ func mockSbBuilder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []t
return fulls, storers return fulls, storers
} }
func TestAPI(t *testing.T) { func TestAPI(t *testing.T) {
test.TestApis(t, builder) test.TestApis(t, builder)
} }
@ -395,8 +392,12 @@ func TestAPIRPC(t *testing.T) {
} }
func TestAPIDealFlow(t *testing.T) { func TestAPIDealFlow(t *testing.T) {
test.TestDealFlow(t, mockSbBuilder)
}
func TestAPIDealFlowReal(t *testing.T) {
if testing.Short() { if testing.Short() {
t.Skip("skipping test in short mode") t.Skip("skipping test in short mode")
} }
test.TestDealFlow(t, mockSbBuilder) test.TestDealFlow(t, builder)
} }

View File

@ -25,7 +25,7 @@ type SBMock struct {
lk sync.Mutex lk sync.Mutex
} }
type mockVerif struct {} type mockVerif struct{}
func NewMockSectorBuilder(threads int, ssize uint64) *SBMock { func NewMockSectorBuilder(threads int, ssize uint64) *SBMock {
return &SBMock{ return &SBMock{
@ -80,7 +80,7 @@ func (sb *SBMock) AddPiece(size uint64, sectorId uint64, r io.Reader, existingPi
ss.pieces = append(ss.pieces, b) ss.pieces = append(ss.pieces, b)
return sectorbuilder.PublicPieceInfo{ return sectorbuilder.PublicPieceInfo{
Size: size, Size: size,
CommP: commD(b), CommP: commD(b),
}, nil }, nil
} }
@ -160,7 +160,7 @@ func (sb *SBMock) SealPreCommit(ctx context.Context, sid uint64, ticket sectorbu
pis := make([]ffi.PublicPieceInfo, len(ss.pieces)) pis := make([]ffi.PublicPieceInfo, len(ss.pieces))
for i, piece := range ss.pieces { for i, piece := range ss.pieces {
pis[i] = ffi.PublicPieceInfo{ pis[i] = ffi.PublicPieceInfo{
Size: uint64(len(piece)), Size: uint64(len(piece)),
CommP: commD(piece), CommP: commD(piece),
} }
} }
@ -198,7 +198,7 @@ func (sb *SBMock) SealCommit(ctx context.Context, sid uint64, ticket sectorbuild
var out [32]byte var out [32]byte
for i := range out { for i := range out {
out[i] = precommit.CommD[i] + precommit.CommR[31 - i] - ticket.TicketBytes[i] * seed.TicketBytes[i] out[i] = precommit.CommD[i] + precommit.CommR[31-i] - ticket.TicketBytes[i]*seed.TicketBytes[i]
} }
return out[:], nil return out[:], nil
} }
@ -319,7 +319,7 @@ func (m mockVerif) VerifySeal(sectorSize uint64, commR, commD []byte, proverID a
} }
for i, b := range proof { for i, b := range proof {
if b != commD[i] + commR[31 - i] - ticket[i] * seed[i] { if b != commD[i]+commR[31-i]-ticket[i]*seed[i] {
return false, nil return false, nil
} }
} }

View File

@ -52,6 +52,6 @@ func (m *Miner) ListSectors() ([]SectorInfo, error) {
func (m *Miner) GetSectorInfo(sid uint64) (SectorInfo, error) { func (m *Miner) GetSectorInfo(sid uint64) (SectorInfo, error) {
var out SectorInfo var out SectorInfo
err := m.sectors.Get(sid, &out) err := m.sectors.Get(sid).Get(&out)
return out, err return out, err
} }

View File

@ -161,7 +161,7 @@ func (m *Miner) onSectorIncoming(sector *SectorInfo) {
func (m *Miner) onSectorUpdated(ctx context.Context, update sectorUpdate) { func (m *Miner) onSectorUpdated(ctx context.Context, update sectorUpdate) {
log.Infof("Sector %d updated state to %s", update.id, api.SectorStates[update.newState]) log.Infof("Sector %d updated state to %s", update.id, api.SectorStates[update.newState])
var sector SectorInfo var sector SectorInfo
err := m.sectors.Mutate(update.id, func(s *SectorInfo) error { err := m.sectors.Get(update.id).Mutate(func(s *SectorInfo) error {
if update.nonce < s.Nonce { if update.nonce < s.Nonce {
return xerrors.Errorf("update nonce too low, ignoring (%d < %d)", update.nonce, s.Nonce) return xerrors.Errorf("update nonce too low, ignoring (%d < %d)", update.nonce, s.Nonce)
} }