Skip to content
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

Implement Event observer and Settings for 3rd party dep injection #5693

Merged
merged 2 commits into from
Mar 23, 2021

Conversation

frrist
Copy link
Member

@frrist frrist commented Feb 26, 2021

What

  • Implement TipSetObserver interface for observing tipset events (apply/revert)
  • Implement Settings opts for 3rd party dep injection (allows Visor to instantiate a Lotus node)

@frrist frrist added kind/feature Kind: Feature area/api labels Feb 26, 2021
@frrist frrist self-assigned this Feb 26, 2021
@frrist frrist requested a review from iand February 26, 2021 21:56
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass - looks pretty good

(I'm assuming you want a review from @iand before merging)

Makefile Outdated
lotus-sentinel: $(BUILD_DEPS)
rm -f lotus-sentinel
go build -o lotus-sentinel ./cmd/lotus-sentinel
.PHONY: lotus-keygen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.PHONY: lotus-keygen
.PHONY: lotus-sentinel

},
}

func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd try to deduplicate this with the 'normal' daemon

Copy link
Member Author

@frrist frrist Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any preference for where this should live? In order for other packages to use it, we'll have to move it out of this file since it's in package main -- my first thought was the repo package.

This could also just be dropped as a feature from the lotus-sentinel binary and users would be required to perform the import with the lotus bin, thoughts @iand?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer not to have to make the user switch between binaries for this task. Let's find a new home for this function in a suitable lotus package.

node/builder.go Outdated
@@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/vm"
"github.com/filecoin-project/lotus/chain/wallet"
api2 "github.com/filecoin-project/lotus/cmd/lotus-sentinel/api"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
api2 "github.com/filecoin-project/lotus/cmd/lotus-sentinel/api"
sentinelapi "github.com/filecoin-project/lotus/cmd/lotus-sentinel/api"

Copy link
Contributor

@iand iand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty happy with how this turned out. Now the question is whether the binary needs to live in the lotus repo or can it live in sentinel's? The extension points and exposure of things like ImportChain obviously have to stay in Lotus but once we have those it seems by moving the binary elsewhere we could avoid Lotus depending on the all the visor and postgres packages. Plus we get to decouple the development processes of the two projects.

},
}

func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer not to have to make the user switch between binaries for this task. Let's find a new home for this function in a suitable lotus package.

@frrist
Copy link
Member Author

frrist commented Mar 3, 2021

I'm going to extract the lotus-sentinel binary code to the visor repo and modify this PR only to contain the changes required to make that work -- I suspect they will be minimal (sorry for the churn)

@frrist frrist force-pushed the sentinel/binary branch from 3e7a0f7 to 7145cca Compare March 3, 2021 21:16
@frrist frrist changed the title Implement lotus-sentinel binary for sentinel integration Implement Event observer and Settings for 3rd party dep injection Mar 3, 2021
@frrist frrist force-pushed the sentinel/binary branch from 7145cca to 568c93c Compare March 3, 2021 21:52
@frrist
Copy link
Member Author

frrist commented Mar 4, 2021

Converting to a draft as this will require more changes than I anticipated. The other half lives here: filecoin-project/lily#408

frrist added 2 commits March 22, 2021 15:37
- allows tipset apply and revert to be observed
- motivating use case running a lotus-sentinel node
@magik6k magik6k merged commit f145d4f into master Mar 23, 2021
@magik6k magik6k deleted the sentinel/binary branch March 23, 2021 10:15
@magik6k magik6k mentioned this pull request Apr 13, 2021
69 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants