This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add local wallet management to Motion
Add functionality to create and configure a local wallet with local disk key storage. The changes introduce two new flags: * `--localWalletDir` - defaulting to `~/.motion/wallet` indicates where the wallet keys are stored. * `--localWalletGenerateIfNotExist` - defaulting to `true` automatically instantiates a FileCoin wallet if none exists. The wallet functionality would also automatically set the default wallet address to the first address found in the key store if no default is specified. Upgrade to the latest ribs dependency which introduces opotions to set the previously hardcoded local wallet, and connect it to the new Motion wallet. Other blob store implementations that wish to store keys in database should implement an instance of `types.KeyStore` and set it to Motion wallet via `WithKeyStoreOpener` option. The build is adjusted to accommodate filecoin-ffi dependency with replace directive and adjustments are made to the unified CI to work around issues in filecoin-ffi which otherwise get picked up by the CI runs in Motion. The builds on MacOS and Window
- Loading branch information
Showing
16 changed files
with
625 additions
and
41 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.github | ||
extern | ||
*.md |
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,20 @@ | ||
name: Go Check Setup | ||
description: Set up the environment for go check | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install filecoin-ffi dependencies | ||
shell: bash | ||
if: ${{ runner.os == 'Linux' }} | ||
run: sudo apt-get install -y libhwloc-dev ocl-icd-opencl-dev | ||
- name: Install filecoin-ffi | ||
shell: bash | ||
run: | | ||
make extern/filecoin-ffi | ||
rm -rf extern/filecoin-ffi/.git | ||
# Fix what we can and silence filecoin-ffi staticcheck since there is no way of instructing the unified CI to skip a directory. | ||
- name: Silence checks | ||
shell: bash | ||
run: | | ||
echo 'checks = ["none"]' > extern/filecoin-ffi/staticcheck.conf | ||
cd extern/filecoin-ffi && go mod tidy && gofmt -w . |
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,19 @@ | ||
name: Go Test Setup | ||
description: Set up the environment for go test | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install filecoin-ffi dependencies | ||
shell: bash | ||
if: ${{ runner.os == 'Linux' }} | ||
run: sudo apt-get install -y libhwloc-dev ocl-icd-opencl-dev | ||
- name: Install filecoin-ffi | ||
shell: bash | ||
if: ${{ runner.os == 'Linux' }} | ||
run: make extern/filecoin-ffi | ||
# Removes all go test files to stop the unified CI from running ffi tests as part of the build. | ||
# See: https://github.com/protocol/multiple-go-modules/issues/11 | ||
- name: Remove filecoin-ffi tests | ||
shell: bash | ||
if: ${{ runner.os == 'Linux' }} | ||
run: find extern/filecoin-ffi -name '*_test.go' -exec rm {} \; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"skip32bit": true | ||
"skip32bit": true, | ||
"skipOSes": ["windows", "macos"] | ||
} |
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 @@ | ||
extern |
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 |
---|---|---|
@@ -1,13 +1,23 @@ | ||
FROM golang:1.20-bullseye as build | ||
|
||
WORKDIR /go/src/motion | ||
COPY go.* ./ | ||
|
||
RUN apt-get update && apt-get install -y libhwloc-dev ocl-icd-opencl-dev jq | ||
COPY Makefile . | ||
RUN make extern/filecoin-ffi | ||
|
||
COPY go.* . | ||
RUN go mod download | ||
|
||
COPY . . | ||
RUN CGO_ENABLED=1 go build -o /go/bin/motion ./cmd/motion | ||
|
||
FROM gcr.io/distroless/base-debian11 | ||
COPY --from=build /go/bin/motion /usr/bin/ | ||
COPY --from=build /go/src/motion/extern/filecoin-ffi/filcrypto.h \ | ||
/go/src/motion/extern/filecoin-ffi/filcrypto.pc \ | ||
/go/src/motion/extern/filecoin-ffi/libfilcrypto.a \ | ||
/usr/lib/*/libhwloc.so.15 \ | ||
/usr/lib/ | ||
|
||
ENTRYPOINT ["/usr/bin/motion"] |
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,21 @@ | ||
SHELL=/usr/bin/env bash | ||
.DEFAULT_GOAL := build | ||
|
||
FILECOIN_FFI_VERSION=de34caff946d598e | ||
FILECOIN_FFI_HOME=extern/filecoin-ffi | ||
|
||
.PHONY: build | ||
build: extern/filecoin-ffi | ||
go build ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf ./$(FILECOIN_FFI_HOME) | ||
|
||
extern/filecoin-ffi: | ||
git clone --depth 1 https://github.com/filecoin-project/filecoin-ffi.git $(FILECOIN_FFI_HOME) && \ | ||
cd $(FILECOIN_FFI_HOME) && \ | ||
git fetch origin $(FILECOIN_FFI_VERSION) && \ | ||
git checkout $(FILECOIN_FFI_VERSION) && \ | ||
$(MAKE) | ||
|
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
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
Oops, something went wrong.