Skip to content

Commit

Permalink
Merge branch 'main' into feat/gateway-backend-more-explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Sep 11, 2023
2 parents f6996a8 + 574df96 commit b7b9648
Show file tree
Hide file tree
Showing 45 changed files with 1,434 additions and 946 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/gateway-sharness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
shell: bash
steps:
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19.1
- name: Checkout boxo
Expand All @@ -30,10 +30,6 @@ jobs:
path: kubo
- name: Install Missing Tools
run: sudo apt install -y socat net-tools fish libxml2-utils
- name: Restore Go Cache
uses: protocol/cache-go-action@v1
with:
name: ${{ github.job }}
- name: Replace boxo in Kubo go.mod
run: |
go mod edit -replace=github.com/ipfs/boxo=../boxo
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,30 @@ The following emojis are used to highlight certain changes:

### Added

* ✨ The `routing/http` implements Delegated Peer Routing introduced in [IPIP-417](https://github.com/ipfs/specs/pull/417).

### Changed

* 🛠 The `routing/http` package received the following modifications:
* Client `GetIPNSRecord` and `PutIPNSRecord` have been renamed to `GetIPNS` and
`PutIPNS`, respectively. Similarly, the required function names in the server
`ContentRouter` have also been updated.
* `ReadBitswapProviderRecord` has been renamed to `BitswapRecord` and marked as deprecated.
From now on, please use the protocol-agnostic `PeerRecord` for most use cases. The new
Peer Schema has been introduced in [IPIP-417](https://github.com/ipfs/specs/pull/417).
* `boxo/gateway`
* 🛠 The `IPFSBackend` interface was updated to make the responses of the
`Head` method more explicit. It now returns a `HeadResponse` instead of a
`files.Node`.

### Removed

* 🛠 The `routing/http` package experienced following removals:
* Server and client no longer support the experimental `Provide` method.
`ProvideBitswap` is still usable, but marked as deprecated. A protocol-agnostic
provide mechanism is being worked on in [IPIP-378](https://github.com/ipfs/specs/pull/378).
* Server no longer exports `FindProvidersPath` and `ProvidePath`.

### Fixed

### Security
Expand All @@ -37,7 +52,7 @@ The following emojis are used to highlight certain changes:
as per [IPIP-379](https://specs.ipfs.tech/ipips/ipip-0379/).
* 🛠 The `verifycid` package has been updated with the new Allowlist interface as part of
reducing globals efforts.
* The `blockservice` and `provider` packages has been updated to accommodate for
* The `blockservice` and `provider` packages has been updated to accommodate for
changes in `verifycid`.

### Changed
Expand Down
35 changes: 0 additions & 35 deletions bitswap/bitswap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/ipfs/boxo/bitswap/server"
testinstance "github.com/ipfs/boxo/bitswap/testinstance"
tn "github.com/ipfs/boxo/bitswap/testnet"
"github.com/ipfs/boxo/internal/test"
mockrouting "github.com/ipfs/boxo/routing/mock"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
Expand Down Expand Up @@ -49,8 +48,6 @@ func addBlock(t *testing.T, ctx context.Context, inst testinstance.Instance, blk
const kNetworkDelay = 0 * time.Millisecond

func TestClose(t *testing.T) {
test.Flaky(t)

vnet := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(vnet, nil, nil)
defer ig.Close()
Expand All @@ -67,8 +64,6 @@ func TestClose(t *testing.T) {
}

func TestProviderForKeyButNetworkCannotFind(t *testing.T) { // TODO revisit this
test.Flaky(t)

rs := mockrouting.NewServer()
net := tn.VirtualNetwork(rs, delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
Expand All @@ -94,8 +89,6 @@ func TestProviderForKeyButNetworkCannotFind(t *testing.T) { // TODO revisit this
}

func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
block := blocks.NewBlock([]byte("block"))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
Expand Down Expand Up @@ -124,8 +117,6 @@ func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
}

func TestDoesNotProvideWhenConfiguredNotTo(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
block := blocks.NewBlock([]byte("block"))
bsOpts := []bitswap.Option{bitswap.ProvideEnabled(false), bitswap.ProviderSearchDelay(50 * time.Millisecond)}
Expand Down Expand Up @@ -158,8 +149,6 @@ func TestDoesNotProvideWhenConfiguredNotTo(t *testing.T) {
// Tests that a received block is not stored in the blockstore if the block was
// not requested by the client
func TestUnwantedBlockNotAdded(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
block := blocks.NewBlock([]byte("block"))
bsMessage := bsmsg.New(true)
Expand Down Expand Up @@ -195,8 +184,6 @@ func TestUnwantedBlockNotAdded(t *testing.T) {
//
// (because the live request queue is full)
func TestPendingBlockAdded(t *testing.T) {
test.Flaky(t)

ctx := context.Background()
net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
bg := blocksutil.NewBlockGenerator()
Expand Down Expand Up @@ -245,8 +232,6 @@ func TestPendingBlockAdded(t *testing.T) {
}

func TestLargeSwarm(t *testing.T) {
test.Flaky(t)

if testing.Short() {
t.SkipNow()
}
Expand Down Expand Up @@ -279,8 +264,6 @@ func TestLargeFile(t *testing.T) {
}

func TestLargeFileTwoPeers(t *testing.T) {
test.Flaky(t)

if testing.Short() {
t.SkipNow()
}
Expand All @@ -290,8 +273,6 @@ func TestLargeFileTwoPeers(t *testing.T) {
}

func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {
test.Flaky(t)

ctx := context.Background()
if testing.Short() {
t.SkipNow()
Expand Down Expand Up @@ -349,8 +330,6 @@ func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {

// TODO simplify this test. get to the _essence_!
func TestSendToWantingPeer(t *testing.T) {
test.Flaky(t)

if testing.Short() {
t.SkipNow()
}
Expand Down Expand Up @@ -393,8 +372,6 @@ func TestSendToWantingPeer(t *testing.T) {
}

func TestEmptyKey(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -428,8 +405,6 @@ func assertStat(t *testing.T, st *bitswap.Stat, sblks, rblks, sdata, rdata uint6
}

func TestBasicBitswap(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -502,8 +477,6 @@ func TestBasicBitswap(t *testing.T) {
}

func TestDoubleGet(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -569,8 +542,6 @@ func TestDoubleGet(t *testing.T) {
}

func TestWantlistCleanup(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -693,8 +664,6 @@ func newReceipt(sent, recv, exchanged uint64) *server.Receipt {
}

func TestBitswapLedgerOneWay(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -744,8 +713,6 @@ func TestBitswapLedgerOneWay(t *testing.T) {
}

func TestBitswapLedgerTwoWay(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -834,8 +801,6 @@ func (tsl *testingScoreLedger) Stop() {

// Tests start and stop of a custom decision logic
func TestWithScoreLedger(t *testing.T) {
test.Flaky(t)

tsl := newTestingScoreLedger()
net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
bsOpts := []bitswap.Option{bitswap.WithScoreLedger(tsl)}
Expand Down
19 changes: 0 additions & 19 deletions bitswap/client/bitswap_with_sessions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/ipfs/boxo/bitswap/client/traceability"
testinstance "github.com/ipfs/boxo/bitswap/testinstance"
tn "github.com/ipfs/boxo/bitswap/testnet"
"github.com/ipfs/boxo/internal/test"
mockrouting "github.com/ipfs/boxo/routing/mock"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
Expand Down Expand Up @@ -40,8 +39,6 @@ func addBlock(t *testing.T, ctx context.Context, inst testinstance.Instance, blk
}

func TestBasicSessions(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -109,8 +106,6 @@ func assertBlockListsFrom(from peer.ID, got, exp []blocks.Block) error {
}

func TestSessionBetweenPeers(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -171,8 +166,6 @@ func TestSessionBetweenPeers(t *testing.T) {
}

func TestSessionSplitFetch(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -217,8 +210,6 @@ func TestSessionSplitFetch(t *testing.T) {
}

func TestFetchNotConnected(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

Expand Down Expand Up @@ -262,8 +253,6 @@ func TestFetchNotConnected(t *testing.T) {
}

func TestFetchAfterDisconnect(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

Expand Down Expand Up @@ -342,8 +331,6 @@ func TestFetchAfterDisconnect(t *testing.T) {
}

func TestInterestCacheOverflow(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -394,8 +381,6 @@ func TestInterestCacheOverflow(t *testing.T) {
}

func TestPutAfterSessionCacheEvict(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -434,8 +419,6 @@ func TestPutAfterSessionCacheEvict(t *testing.T) {
}

func TestMultipleSessions(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -477,8 +460,6 @@ func TestMultipleSessions(t *testing.T) {
}

func TestWantlistClearsOnCancel(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

"github.com/ipfs/boxo/bitswap/internal/testutil"
"github.com/ipfs/boxo/internal/test"
cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p/core/peer"
)
Expand All @@ -17,8 +16,6 @@ const (
)

func TestBlockPresenceManager(t *testing.T) {
test.Flaky(t)

bpm := New()

p := testutil.GeneratePeers(1)[0]
Expand Down Expand Up @@ -99,8 +96,6 @@ func TestBlockPresenceManager(t *testing.T) {
}

func TestAddRemoveMulti(t *testing.T) {
test.Flaky(t)

bpm := New()

peers := testutil.GeneratePeers(2)
Expand Down Expand Up @@ -184,8 +179,6 @@ func TestAddRemoveMulti(t *testing.T) {
}

func TestAllPeersDoNotHaveBlock(t *testing.T) {
test.Flaky(t)

bpm := New()

peers := testutil.GeneratePeers(3)
Expand Down
Loading

0 comments on commit b7b9648

Please sign in to comment.