-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitswap support in Libp2p helper #9626
Conversation
1479013
to
1876539
Compare
6d04c0b
to
ba52882
Compare
ba52882
to
bd63db8
Compare
fbf0a5c
to
9234741
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall, just some small suggestions. I haven't fully reviewed the tests yet, but all of the implementation looks good.
@@ -1,3 +0,0 @@ | |||
load("@bazel_gazelle//:def.bzl", "gazelle") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were the bazel build related files removed? AFAIK, we have a contractor that's working on bazel support for the repository, so doing this will probably step on their toes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are broken now. If someone is working on these, let them commit working build files once they're ready, maybe?
src/app/libp2p_helper/Makefile
Outdated
../../libp2p_ipc/libp2p_ipc.capnp.go: | ||
make -C ../../libp2p_ipc libp2p_ipc.capnp.go | ||
|
||
libp2p_helper: ../../libp2p_ipc/libp2p_ipc.capnp.go | ||
$(WRAPAPP) ../../../scripts/build-go-helper.sh libp2p_helper | ||
|
||
test: ../../libp2p_ipc/libp2p_ipc.capnp.go | ||
$(WRAPAPP) ../../../scripts/build-go-helper.sh --test libp2p_helper | ||
cd src/libp2p_helper && $(GO) test -short -timeout 15m # && $(GO) test -timeout 40m -run "^TestBitswapJumbo$$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the commented version of the test command running different tests? Should we provide multiple Makefile targets for different kinds of tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I will experiment with these a bit more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to run BitswapMedium
and BitswapJumbo
tests in CI, so left them as make test-large
which can be executed on a developer machine.
Other tests are now being executed in CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P.S. BitswapMedium
and BitswapJumbo
tests timeout in CI, on my laptop both of them complete in an hour, occupying 90% of 32 GB RAM and a chunk of processor power though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. These seem like good candidates for nightly CI tests, once we have those setup. Perhaps we can revisit putting them in CI once that infrastructure exists.
} | ||
delete(states, root) | ||
state.allDescedants.ForEach(func(c cid.Cid) error { | ||
np, hasNp := nodeParams[c] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth noting in a comment that this will need modified when we wish to support shared nodes across Bitswap DAGs (which we will want/need to whenever we put ledger into Bitswap).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nholland94 could you expand on this please? I'm not following you here.
Shared nodes are already supported or at least were meant to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this algorithm, whenever you clear the download state for a root, you clear that state for all descendants as well. If in the future we have shared nodes across roots, then you would need to keep a refcount for all the descendant nodes and only clear their download state when the refcount reaches 0.
rootDownloadStates := bs.RootDownloadStates() | ||
depthIndices := bs.DepthIndices() | ||
oldPs, foundRoot := nodeDownloadParams[id] | ||
delete(nodeDownloadParams, id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if we a processing the same downloaded block in parallel? Is that possible? I'm worried about potential race conditions on accessing the node download params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check that Loop
is only ran once. All these data structures are accessed only from functions called from within the Loop()
. These are most importantly kickStartRootDownload
and processDownloadedBlock
. You can check that within these functions no new goroutines are produced.
So, basically, the execution is single-threaded by design.
3a3e46b
to
3116ffc
Compare
Plus allow to configure Bitswap with Config message and fix Daemon compilation.
+ Some bugfix
+ abstract block downloading logic from irrelevant implementation details
Implement test for big-step semantic of block download state machine.
Problem: jumbo test is resource-intensive and is better to be executed separately. Solution: skip jumbo test in "short" mode.
They fail in CI due to lack of resources currently, but can be executed on developer's laptop.
Problem: case of non-empty block storage is not well covered. An existing bug wasn't caught due to this (was caught only via PR review). Solution: add test (which fails).
Some stylistic changes + bugfix
3116ffc
to
53318b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Product review is good otherwise
@@ -1,201 +0,0 @@ | |||
Apache License |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you un-remove the license?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkase my intuition was that LICENSE at the root of Mina repository applies here unless specified otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good 👍
Explain your changes:
This PR adds support of Bitswap in libp2p helper:
Explain how you tested your changes:
There are four layers of testing
Testing on network involves random resource generation and random requesting of the resource by different nodes, deleting some resources from some nodes and then retrying random resource requesting.
Note that testing requires up to 30 GB of RAM and
ulimit
set to some large value (tested on 100000).Checklist: