Skip to content

Commit

Permalink
Data Transfer V2 Integration
Browse files Browse the repository at this point in the history
Voucher refactor integration (#707)

* refactor(storagemarket): update storagemarket

* refactor(retrievalmarket): use new voucher system

refactor for predictability and correctness using new voucher system

* chore(deps): update go-data-transfer v2

* style(lint): prep for pr

* docs(retrievalmarket): add comments

* chore(deps): update go-statemachine

* style(imports): fix imports

chore(retrievalmarket): remove old types (#712)

feat(ipld): bindnode support for all voucher types (#713)

* feat(ipld): new data-transfer ipld vouchers + bindnode

* feat(ipld): simplify ipldutils API

* feat(ipld): use new bindnode registry in go-ipld-prime

Ref: ipld/go-ipld-prime#437

feat(deps): update data transfer 61f0756c

feat(deps): update data transfer and other deps

update to master data transfer with libp2p v0.22.0 plus associated other deps
  • Loading branch information
hannahhoward committed Oct 14, 2022
1 parent f6bef67 commit 05d76d3
Show file tree
Hide file tree
Showing 104 changed files with 2,788 additions and 5,759 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:
executors:
golang:
docker:
- image: cimg/go:1.17.9
- image: cimg/go:1.18.7-node
resource_class: large

commands:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import (
ipld "github.com/ipfs/go-ipld-format"
"github.com/stretchr/testify/assert"

datatransfer "github.com/filecoin-project/go-data-transfer"
datatransfer "github.com/filecoin-project/go-data-transfer/v2"

"github.com/filecoin-project/go-fil-markets/filestore/file"
)
Expand Down
62 changes: 1 addition & 61 deletions discovery/impl/local_test.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
package discoveryimpl_test

import (
"bytes"
"context"
"testing"
"time"

"github.com/ipfs/go-datastore"
dshelp "github.com/ipfs/go-ipfs-ds-help"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"

discoveryimpl "github.com/filecoin-project/go-fil-markets/discovery/impl"
"github.com/filecoin-project/go-fil-markets/discovery/migrations"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
retrievalmigrations "github.com/filecoin-project/go-fil-markets/retrievalmarket/migrations"
"github.com/filecoin-project/go-fil-markets/shared_testutil"
)

Expand Down Expand Up @@ -70,57 +64,3 @@ func TestLocal_AddPeer(t *testing.T) {
})
}
}

func TestLocalMigrations(t *testing.T) {
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
ds := datastore.NewMapDatastore()

peers := shared_testutil.GeneratePeers(4)
pieceCIDs := shared_testutil.GenerateCids(4)
payloadCids := shared_testutil.GenerateCids(2)
for i, c := range payloadCids {
rps := migrations.RetrievalPeers0{
Peers: []retrievalmigrations.RetrievalPeer0{
{
Address: address.TestAddress,
ID: peers[i*2],
PieceCID: &pieceCIDs[i*2],
},
{
Address: address.TestAddress2,
ID: peers[i*2+1],
PieceCID: &pieceCIDs[i*2+1],
},
},
}
buf := new(bytes.Buffer)
err := rps.MarshalCBOR(buf)
require.NoError(t, err)
err = ds.Put(ctx, dshelp.MultihashToDsKey(c.Hash()), buf.Bytes())
require.NoError(t, err)
}

l, err := discoveryimpl.NewLocal(ds)
require.NoError(t, err)
shared_testutil.StartAndWaitForReady(ctx, t, l)

for i, c := range payloadCids {
expectedPeers := []retrievalmarket.RetrievalPeer{
{
Address: address.TestAddress,
ID: peers[i*2],
PieceCID: &pieceCIDs[i*2],
},
{
Address: address.TestAddress2,
ID: peers[i*2+1],
PieceCID: &pieceCIDs[i*2+1],
},
}
peers, err := l.GetPeers(c)
require.NoError(t, err)
require.Equal(t, expectedPeers, peers)
}
}
31 changes: 1 addition & 30 deletions discovery/migrations/migrations.go
Original file line number Diff line number Diff line change
@@ -1,37 +1,8 @@
package migrations

import (
versioning "github.com/filecoin-project/go-ds-versioning/pkg"
"github.com/filecoin-project/go-ds-versioning/pkg/versioned"

"github.com/filecoin-project/go-fil-markets/discovery"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/migrations"
)

//go:generate cbor-gen-for RetrievalPeers0

// RetrievalPeers0 is version 0 of RetrievalPeers
type RetrievalPeers0 struct {
Peers []migrations.RetrievalPeer0
}

// MigrateRetrievalPeers0To1 migrates a tuple encoded list of retrieval peers to a map encoded list
func MigrateRetrievalPeers0To1(oldRps *RetrievalPeers0) (*discovery.RetrievalPeers, error) {
peers := make([]retrievalmarket.RetrievalPeer, 0, len(oldRps.Peers))
for _, oldRp := range oldRps.Peers {
peers = append(peers, retrievalmarket.RetrievalPeer{
Address: oldRp.Address,
ID: oldRp.ID,
PieceCID: oldRp.PieceCID,
})
}
return &discovery.RetrievalPeers{
Peers: peers,
}, nil
}

// RetrievalPeersMigrations are migrations for the store local discovery list of peers we can retrieve from
var RetrievalPeersMigrations = versioned.BuilderList{
versioned.NewVersionedBuilder(MigrateRetrievalPeers0To1, versioning.VersionKey("1")),
}
var RetrievalPeersMigrations = versioned.BuilderList{}
105 changes: 0 additions & 105 deletions discovery/migrations/migrations_cbor_gen.go

This file was deleted.

14 changes: 9 additions & 5 deletions docs/retrievalprovider.mmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ stateDiagram-v2
state "DealStatusCancelled" as DealStatusCancelled
DealStatusUnsealing : On entry runs UnsealData
DealStatusUnsealed : On entry runs UnpauseDeal
DealStatusFundsNeededUnseal : On entry runs TrackTransfer
DealStatusFundsNeededUnseal : On entry runs UpdateFunding
DealStatusFailing : On entry runs CancelDeal
DealStatusFundsNeeded : On entry runs UpdateFunding
DealStatusFundsNeededLastPayment : On entry runs UpdateFunding
DealStatusCompleting : On entry runs CleanupDeal
DealStatusCancelling : On entry runs CancelDeal
[*] --> DealStatusNew
note right of DealStatusNew
The following events are not shown cause they can trigger from any state.
ProviderEventProcessPayment - does not transition state
ProviderEventComplete - transitions state to DealStatusCompleting
ProviderEventDataTransferError - transitions state to DealStatusErrored
ProviderEventMultiStoreError - transitions state to DealStatusErrored
ProviderEventClientCancelled - transitions state to DealStatusCancelling
Expand All @@ -35,20 +39,20 @@ stateDiagram-v2
DealStatusUnsealing --> DealStatusUnsealed : ProviderEventUnsealComplete
DealStatusUnsealed --> DealStatusOngoing : ProviderEventBlockSent
DealStatusOngoing --> DealStatusOngoing : ProviderEventBlockSent
DealStatusOngoing --> DealStatusBlocksComplete : ProviderEventBlocksCompleted
DealStatusNew --> DealStatusFundsNeededUnseal : ProviderEventPaymentRequested
DealStatusUnsealed --> DealStatusFundsNeeded : ProviderEventPaymentRequested
DealStatusOngoing --> DealStatusFundsNeeded : ProviderEventPaymentRequested
DealStatusBlocksComplete --> DealStatusFundsNeededLastPayment : ProviderEventPaymentRequested
DealStatusUnsealed --> DealStatusFundsNeededLastPayment : ProviderEventLastPaymentRequested
DealStatusOngoing --> DealStatusFundsNeededLastPayment : ProviderEventLastPaymentRequested
DealStatusFundsNeededUnseal --> DealStatusFailing : ProviderEventSaveVoucherFailed
DealStatusFundsNeeded --> DealStatusFailing : ProviderEventSaveVoucherFailed
DealStatusFundsNeededLastPayment --> DealStatusFailing : ProviderEventSaveVoucherFailed
DealStatusFundsNeededUnseal --> DealStatusFundsNeededUnseal : ProviderEventPartialPaymentReceived
DealStatusFundsNeeded --> DealStatusFundsNeeded : ProviderEventPartialPaymentReceived
DealStatusFundsNeededLastPayment --> DealStatusFundsNeededLastPayment : ProviderEventPartialPaymentReceived
DealStatusFundsNeededUnseal --> DealStatusUnsealing : ProviderEventPaymentReceived
DealStatusFundsNeeded --> DealStatusOngoing : ProviderEventPaymentReceived
DealStatusFundsNeededLastPayment --> DealStatusFinalizing : ProviderEventPaymentReceived
DealStatusBlocksComplete --> DealStatusCompleting : ProviderEventComplete
DealStatusFinalizing --> DealStatusCompleting : ProviderEventComplete
DealStatusCompleting --> DealStatusCompleted : ProviderEventCleanupComplete
DealStatusFailing --> DealStatusErrored : ProviderEventCancelComplete
DealStatusCancelling --> DealStatusCancelled : ProviderEventCancelComplete
Expand Down
Binary file modified docs/retrievalprovider.mmd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/retrievalprovider.mmd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion extern/filecoin-ffi
Submodule filecoin-ffi updated 72 files
+46 −124 .circleci/config.yml
+4 −4 Makefile
+23 −13 README.md
+42 −80 bls.go
+14 −14 bls_test.go
+4 −4 build.sh
+157 −0 cgo/blockstore.go
+61 −0 cgo/bls.go
+55 −0 cgo/const.go
+25 −0 cgo/errors.go
+118 −0 cgo/extern.go
+89 −0 cgo/fvm.go
+275 −0 cgo/helpers.go
+66 −0 cgo/helpers_test.go
+37 −0 cgo/interface.go
+1 −2 cgo/libs.go
+383 −0 cgo/proofs.go
+49 −0 cgo/registry.go
+673 −0 cgo/types.go
+20 −0 cgo/util.go
+2 −1 cgoleakdetect/runner.go
+117 −74 distributed.go
+0 −39 filcrypto.yml
+231 −0 fvm.go
+36 −0 fvm_test.go
+0 −4,039 generated/cgo_helpers.go
+0 −9 generated/cgo_helpers.h
+0 −58 generated/const.go
+0 −882 generated/generated.go
+0 −358 generated/types.go
+52 −10 go.mod
+134 −101 go.sum
+9 −0 headerstubs/stdbool.h
+1 −0 headerstubs/stddef.h
+5 −2 headerstubs/stdint.h
+47 −16 install-filcrypto
+71 −1 parameters.json
+351 −417 proofs.go
+19 −22 proofs_test.go
+1,931 −872 rust/Cargo.lock
+37 −21 rust/Cargo.toml
+0 −11 rust/build.rs
+0 −23 rust/cbindgen.toml
+1 −1 rust/rust-toolchain
+31 −2 rust/scripts/build-release.sh
+1 −1 rust/scripts/publish-release.sh
+177 −296 rust/src/bls/api.rs
+0 −1 rust/src/bls/mod.rs
+0 −79 rust/src/bls/types.rs
+151 −0 rust/src/fvm/blockstore/cgo.rs
+100 −0 rust/src/fvm/blockstore/fake.rs
+7 −0 rust/src/fvm/blockstore/mod.rs
+76 −0 rust/src/fvm/blockstore/overlay.rs
+26 −0 rust/src/fvm/cgo/error.rs
+60 −0 rust/src/fvm/cgo/externs.rs
+5 −0 rust/src/fvm/cgo/mod.rs
+136 −0 rust/src/fvm/externs.rs
+496 −0 rust/src/fvm/machine.rs
+8 −0 rust/src/fvm/mod.rs
+44 −0 rust/src/fvm/types.rs
+20 −0 rust/src/lib.rs
+2,197 −1,670 rust/src/proofs/api.rs
+29 −61 rust/src/proofs/helpers.rs
+278 −527 rust/src/proofs/types.rs
+71 −89 rust/src/util/api.rs
+229 −33 rust/src/util/types.rs
+350 −0 sector_update.go
+7 −0 srs-inner-product.json
+0 −7 tools.go
+28 −12 types.go
+1 −1 version.go
+9 −7 workflows.go
Loading

0 comments on commit 05d76d3

Please sign in to comment.