-
Notifications
You must be signed in to change notification settings - Fork 267
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
p2p/ipld: LazyLedger ipld plugin #144
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
b6afb91
initial commit adding the lazyledger IPLD plugin
liamsi 37fabaf
Half the plugin works (writing to the dag)
liamsi 06c2c62
Add test to sanity check the returned Nodes / root node
liamsi 9d2c7fe
Fix RawData impls & implement node parser
liamsi 8e87848
Some minor readability cleanup and improved err message
liamsi b1d0033
Add another test that actually uses IPFS (wip)
liamsi feb1978
Does making the plugin a separate module help fighting the dep issue?…
liamsi 6075e3c
duplicate DA constants to avoid dependency issues
liamsi 61f57e0
reverse node collecting order: test passes ✅
liamsi b3b734f
use a helper function with less allocs to prepend nodes
liamsi c4a966f
fix bug when reading back (e.g. via `dag get`)
liamsi b7162ac
fix typo
liamsi 9fdf380
Add DagGet to test
liamsi 9f2c10c
Skip test as it requires a IPFS daemon with the plugin to run on the …
liamsi b877165
update to nmt v0.1.0
liamsi 7ee8e50
Address or remove TODOs
liamsi 607010e
Add a test with a erasure coded data
liamsi 4256e20
minor formatting improvement
liamsi 56ea940
update top-level module to same nmt version
liamsi 7c507ac
remove todo (addressed)
liamsi 3eddcde
Update Readme
liamsi 60518ea
add possibility to bubble up error
liamsi f00e4ae
change multihash const to a larger number
liamsi d957a48
minor doc/todo changes
liamsi ffe9ef6
Apply suggestions from code review
liamsi 763c8ea
fix glitch from committing github suggestions
liamsi 35da604
use errors.New instead of fmt.Errorf where it makes sense
liamsi 9f32984
review feedback: replace another if-else with a switch-case
liamsi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# LazyLedger ipld-plugin | ||
|
||
## Installation | ||
|
||
Usually, a simple `make install` should build and install the plugin locally. | ||
|
||
If you want to compile against a locally checked out version of IPFS, run: | ||
|
||
```sh | ||
cd plugin | ||
./set-target.sh REPLACE_WITH_YOUR_LOCAL_PATH/go-ipfs | ||
make install | ||
``` | ||
|
||
Running ipfs (e.g. `ipfs init` or `ipfs daemon`) loads the plugin automatically. | ||
|
||
Note, this plugin was only tested with IPFS [v0.7.0](https://github.com/ipfs/go-ipfs/releases/tag/v0.7.0). | ||
|
||
liamsi marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Force Go Modules | ||
GO111MODULE = on | ||
|
||
GOCC ?= go | ||
GOFLAGS ?= | ||
|
||
# If set, override the install location for plugins | ||
IPFS_PATH ?= $(HOME)/.ipfs | ||
|
||
# If set, override the IPFS version to build against. This _modifies_ the local | ||
# go.mod/go.sum files and permanently sets this version. | ||
IPFS_VERSION ?= $(lastword $(shell $(GOCC) list -m github.com/ipfs/go-ipfs)) | ||
|
||
# make reproducible | ||
ifneq ($(findstring /,$(IPFS_VERSION)),) | ||
# Locally built go-ipfs | ||
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)" | ||
else | ||
# Remote version of go-ipfs (e.g. via `go get -trimpath` or official distribution) | ||
GOFLAGS += -trimpath | ||
endif | ||
|
||
.PHONY: install build | ||
|
||
go.mod: FORCE | ||
./set-target.sh $(IPFS_VERSION) | ||
|
||
FORCE: | ||
|
||
lazyledger-plugin.so: plugin.go go.mod | ||
$(GOCC) build $(GOFLAGS) -buildmode=plugin -o "$@" "$<" | ||
chmod +x "$@" | ||
|
||
build: lazyledger-plugin.so | ||
@echo "Built against" $(IPFS_VERSION) | ||
|
||
install: build | ||
mkdir -p "$(IPFS_PATH)/plugins/" | ||
cp -f lazyledger-plugin.so "$(IPFS_PATH)/plugins/lazyledger-plugin.so" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module github.com/lazyledger-core/p2p/ipld/plugin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should instead be named:
Will fix when tackling #119 |
||
|
||
go 1.15 | ||
|
||
require ( | ||
github.com/ipfs/go-block-format v0.0.2 | ||
github.com/ipfs/go-cid v0.0.7 | ||
github.com/ipfs/go-ipfs v0.7.0 | ||
github.com/ipfs/go-ipfs-api v0.2.0 | ||
github.com/ipfs/go-ipld-format v0.2.0 | ||
github.com/lazyledger/nmt v0.1.0 | ||
// rsmt2d is only used in tests: | ||
github.com/lazyledger/rsmt2d v0.0.0-20201215203123-e5ec7910ddd4 | ||
github.com/multiformats/go-multihash v0.0.14 | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 actually had to do this (
./set-target.sh ~/go-projects/go-ipfs
). Otherwise, I'd get: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.
From my experience, this is the only working solution - you need path to actual source code. Even checking out exact tag of go-ipfs and, providing it as version didn't work for me.