-
Notifications
You must be signed in to change notification settings - Fork 45
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
Create a Lily node by embedding lotus into visor to observe tipset apply and revert events #408
Conversation
52a025b
to
fb11208
Compare
-- will allow lotus binary to be built in following commit
aa4d49f
to
ba1e22f
Compare
- allows a lotus node to be instanciated and for visor to observe tipsets applied and reverted by the lotus node.
ba1e22f
to
656b012
Compare
node/impl/lily.go
Outdated
|
||
obs := observer.NewIndexingTipSetObserver(indexer, tsCache) | ||
|
||
if err := m.Events.Observe(obs); err != nil { |
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 think we can avoid this dependency in lotus if we go back to using the chain notify API call that is already present in the impl.FullNodeAPI
.
node/api/apistruct/struct.go
Outdated
@@ -0,0 +1,26 @@ | |||
package apistruct |
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.
Does this need to be a separate package?
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.
It does not -- I had everything broken into packages like this to make it easier to mimic lotus's layout. I have sense created a "lily" lens and moved the LilyNode API and struct into it.
node/cli/daemon.go
Outdated
@@ -0,0 +1,282 @@ | |||
package cli |
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 we move this to our commands package?
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.
Done.
node/cli/daemon.go
Outdated
return opts | ||
} | ||
|
||
func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool) (err error) { |
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 this just a copy of what is in Lotus? We talked about exporting it in Lotus but copying it here means one less change on the Lotus side which is good.
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.
We should find a better package for this function, although it's not urgent to do that
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.
Yes, a copy from lotus; I agree copying this code isn't ideal but I would prefer to punt on extraction in lotus since this copy is low risk.
node/main.go
Outdated
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "repo", | ||
EnvVars: []string{"SENTINEL_LOTUS_PATH"}, |
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.
SENTINEL_REPO
perhaps? Let's start being consistent so a flag called xxx
has an env variable called SENTINEL_XXX
node/api/apistruct/struct.go
Outdated
|
||
var log = logging.Logger("lily-api") | ||
|
||
type LilyNodeStruct struct { |
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.
Since this is the start of the new JSON-RPC API that visor will expose to allow the daemon to be controlled we should name it more concretely, e.g. just API.
Would be nice if we could stop using the word node
in other places where we mean lens.Interface
and we should try to stop using it here too.
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.
Dropped the "node" word and moved this all to the lens package
node/api/apistruct/struct.go
Outdated
var log = logging.Logger("lily-api") | ||
|
||
type LilyNodeStruct struct { | ||
lotusstruct.FullNodeStruct |
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.
We don't need all of this. What is the minimum we need?
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.
We need the following API's from lotus:
common.CommonAPI
for the RPC and authentication/permissions.full.ChainAPI
for chain event notification and chain inspection.full.StateAPI
for actor state extraction and inspection.
I have redeclared the LilyAPI
to require only these.
54395bb
to
fc2ad2d
Compare
@@ -0,0 +1,148 @@ | |||
package util |
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.
mostly copy-paste from lotus to get the injection working.
Name: "lens", | ||
EnvVars: []string{"VISOR_LENS"}, | ||
Value: "lotus", | ||
Destination: &commands.VisorCmdFlags.Lens, |
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.
Destination
looks like a cleaner way (imo) to pass values to subcommands, e.g. lily watch start
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 maybe. I'm not 100% sold on it but willing to try it out.
Codecov Report
@@ Coverage Diff @@
## lily #408 +/- ##
=======================================
- Coverage 43.9% 43.6% -0.3%
=======================================
Files 28 29 +1
Lines 2246 2261 +15
=======================================
Hits 986 986
- Misses 1076 1091 +15
Partials 184 184 |
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'm happy to merge this to lily
and use it as a basis for the next steps.
return nil | ||
} | ||
|
||
var _ events.TipSetObserver = (*IndexingTipSetObserver)(nil) |
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.
This line is the only reason for importing the events package. I don't think we need it since we can't compile without it satisfying the interface anyway
"github.com/filecoin-project/lotus/chain/types" | ||
) | ||
|
||
func NewIndexingTipSetObserver(obs TipSetObserver, cache *TipSetCache) *IndexingTipSetObserver { |
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.
As you mentioned before, we could simply revert to using ChainNotify and then this type is redundant with Watcher. For now let's keep it and work on refactoring to a more optimized lens interface that could work by calling ChainNotiify or could hook into events directly.
After: destroy, | ||
Flags: []cli.Flag{ | ||
&cli.IntFlag{ | ||
Name: "indexhead-confidence", |
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.
We'll refine the names of the params later
Name: "lens", | ||
EnvVars: []string{"VISOR_LENS"}, | ||
Value: "lotus", | ||
Destination: &commands.VisorCmdFlags.Lens, |
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 maybe. I'm not 100% sold on it but willing to try it out.
…ply and revert events (#408) chore: reuse watcher in lily watch command (#422) Merge master into lily (#425) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names fix(linter): make deps before linting in CI (#437) merge master into lily (#432) * fix(indexer): only close TIpSetIndexer in walk and watch * chore: increase linter timeout in ci scheduler job control + watch, walk, and job cli (#414) merge master into lily (#442) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names * Chore/sqlotus dag prefetch option (#430) * Disable preloader by default, toggle with LOTUS_CHAINSTORE_PRELOAD_RECENTS * Switch to a cli string as suggested by @iand * Remove one more inefficiency for the R/O lens filecoin-project/go-bs-postgres-chainnotated@b8b5d500e368d2ed * Forgotten option/helptext spec * Add support for static Get() prefetch * close TipSetObs in walker and watcher * fix(indexer): only close TIpSetIndexer in walk and watch - subsequent calls to close will hang forever * chore: increase linter timout in ci * chore: update for Lotus 1.5.3 (#439) * chore: update for Lotus 1.5.3 * fixup! chore: update for Lotus 1.5.3 * Update statediff version Co-authored-by: frrist <[email protected]> Co-authored-by: Ian Davis <[email protected]> Co-authored-by: Peter Rabbitson <[email protected]> chore: remove confidence argument from lily walk command (#444) chore: reorganise visor commands (#445) feat: add storage configuration to daemon (#446) * feat: add storage configuration to daemon * Start wiring up storage to config * Finish wiring up storage config * check error return when ensuring config * Close config file on error feat: Add --api parameter to daemon client commands (#450) * feat: Add --api parameter to daemon client commands * Make api default value a valid multiaddr * Add api token parameter Merge master into lily (#463) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names * Chore/sqlotus dag prefetch option (#430) * Disable preloader by default, toggle with LOTUS_CHAINSTORE_PRELOAD_RECENTS * Switch to a cli string as suggested by @iand * Remove one more inefficiency for the R/O lens filecoin-project/go-bs-postgres-chainnotated@b8b5d500e368d2ed * Forgotten option/helptext spec * Add support for static Get() prefetch * close TipSetObs in walker and watcher * fix(indexer): only close TIpSetIndexer in walk and watch - subsequent calls to close will hang forever * chore: increase linter timout in ci * chore: update for Lotus 1.5.3 (#439) * chore: update for Lotus 1.5.3 * fixup! chore: update for Lotus 1.5.3 * Update statediff version Co-authored-by: frrist <[email protected]> * Release notes for v0.5.5 (#440) * chore: update lotus to 1.6.0 (#443) * chore: upgrade lotus dependency to 1.6.0-rc1 (#447) * chore: update lotus to 1.6.0 (#455) * Release notes for v0.5.6 (#456) * fix: ensure persistence semaphore channel is drained on close (#457) * fix: ensure persistence semaphore channel is drained on close * Add hidden window flag for testing * Reduce actor happy path logging * Make sure actor errors reported are appended to correct list * Release notes for v0.5.7 (#458) * Update to latest lotus commit * Add missing support/tools/go.sum * Fix merge bugs in makefile * Fix merge bugs in makefile Co-authored-by: Peter Rabbitson <[email protected]> Co-authored-by: frrist <[email protected]> feat: clean up command line flags for single-run jobs (#464) * feat: clean up command line flags for single-run jobs * Fix dockerfile Co-authored-by: frrist <[email protected]> polish(lily): add job name flag (#467) - closes #452 polish(job): print job type, params, and errors in list (#468) - closes #451 fix: ensure event channel is initialised before watch starts (#471) chore: merge master into lily branch (#472) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names * Chore/sqlotus dag prefetch option (#430) * Disable preloader by default, toggle with LOTUS_CHAINSTORE_PRELOAD_RECENTS * Switch to a cli string as suggested by @iand * Remove one more inefficiency for the R/O lens filecoin-project/go-bs-postgres-chainnotated@b8b5d500e368d2ed * Forgotten option/helptext spec * Add support for static Get() prefetch * close TipSetObs in walker and watcher * fix(indexer): only close TIpSetIndexer in walk and watch - subsequent calls to close will hang forever * chore: increase linter timout in ci * chore: update for Lotus 1.5.3 (#439) * chore: update for Lotus 1.5.3 * fixup! chore: update for Lotus 1.5.3 * Update statediff version Co-authored-by: frrist <[email protected]> * Release notes for v0.5.5 (#440) * chore: update lotus to 1.6.0 (#443) * chore: upgrade lotus dependency to 1.6.0-rc1 (#447) * chore: update lotus to 1.6.0 (#455) * Release notes for v0.5.6 (#456) * fix: ensure persistence semaphore channel is drained on close (#457) * fix: ensure persistence semaphore channel is drained on close * Add hidden window flag for testing * Reduce actor happy path logging * Make sure actor errors reported are appended to correct list * Release notes for v0.5.7 (#458) * fix(tasks): use correct ActorInfo for actor state extraction (#449) * fix(tasks): use corret actor info for actor state extraction - fixes #273 * fix(lens): remove OptimizedStateGetActorWithFallback - fixes #405 * fix(market-task): fix market actor task and gen vector - fixes #465 * polish(vector): support msapproval model validation * test(vector): generate new test vectors * ci: increase instance size due to test vectors * Add MinerSectorInfo for extended sectors (#448) Fixes #441. Extended sectors have new deadlines but this is not recorded anywhere. * Fix makefile conflicts Co-authored-by: Peter Rabbitson <[email protected]> Co-authored-by: frrist <[email protected]> Co-authored-by: Hector Sanjuan <[email protected]>
* Create a Lily node by embedding lotus into visor to observe tipset apply and revert events (#408) * chore: reuse watcher in lily watch command (#422) * Merge master into lily (#425) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names * fix(linter): make deps before linting in CI (#437) * merge master into lily (#432) * fix(indexer): only close TIpSetIndexer in walk and watch * chore: increase linter timeout in ci * scheduler job control + watch, walk, and job cli (#414) * merge master into lily (#442) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names * Chore/sqlotus dag prefetch option (#430) * Disable preloader by default, toggle with LOTUS_CHAINSTORE_PRELOAD_RECENTS * Switch to a cli string as suggested by @iand * Remove one more inefficiency for the R/O lens filecoin-project/go-bs-postgres-chainnotated@b8b5d500e368d2ed * Forgotten option/helptext spec * Add support for static Get() prefetch * close TipSetObs in walker and watcher * fix(indexer): only close TIpSetIndexer in walk and watch - subsequent calls to close will hang forever * chore: increase linter timout in ci * chore: update for Lotus 1.5.3 (#439) * chore: update for Lotus 1.5.3 * fixup! chore: update for Lotus 1.5.3 * Update statediff version Co-authored-by: frrist <[email protected]> Co-authored-by: Ian Davis <[email protected]> Co-authored-by: Peter Rabbitson <[email protected]> * chore: remove confidence argument from lily walk command (#444) * chore: reorganise visor commands (#445) * feat: add storage configuration to daemon (#446) * feat: add storage configuration to daemon * Start wiring up storage to config * Finish wiring up storage config * check error return when ensuring config * Close config file on error * feat: Add --api parameter to daemon client commands (#450) * feat: Add --api parameter to daemon client commands * Make api default value a valid multiaddr * Add api token parameter * Merge master into lily (#463) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names * Chore/sqlotus dag prefetch option (#430) * Disable preloader by default, toggle with LOTUS_CHAINSTORE_PRELOAD_RECENTS * Switch to a cli string as suggested by @iand * Remove one more inefficiency for the R/O lens filecoin-project/go-bs-postgres-chainnotated@b8b5d500e368d2ed * Forgotten option/helptext spec * Add support for static Get() prefetch * close TipSetObs in walker and watcher * fix(indexer): only close TIpSetIndexer in walk and watch - subsequent calls to close will hang forever * chore: increase linter timout in ci * chore: update for Lotus 1.5.3 (#439) * chore: update for Lotus 1.5.3 * fixup! chore: update for Lotus 1.5.3 * Update statediff version Co-authored-by: frrist <[email protected]> * Release notes for v0.5.5 (#440) * chore: update lotus to 1.6.0 (#443) * chore: upgrade lotus dependency to 1.6.0-rc1 (#447) * chore: update lotus to 1.6.0 (#455) * Release notes for v0.5.6 (#456) * fix: ensure persistence semaphore channel is drained on close (#457) * fix: ensure persistence semaphore channel is drained on close * Add hidden window flag for testing * Reduce actor happy path logging * Make sure actor errors reported are appended to correct list * Release notes for v0.5.7 (#458) * Update to latest lotus commit * Add missing support/tools/go.sum * Fix merge bugs in makefile * Fix merge bugs in makefile Co-authored-by: Peter Rabbitson <[email protected]> Co-authored-by: frrist <[email protected]> * feat: clean up command line flags for single-run jobs (#464) * feat: clean up command line flags for single-run jobs * Fix dockerfile Co-authored-by: frrist <[email protected]> * polish(lily): add job name flag (#467) - closes #452 * polish(job): print job type, params, and errors in list (#468) - closes #451 * fix: ensure event channel is initialised before watch starts (#471) * chore: merge master into lily branch (#472) * fix: ignore false positive gosec failure in wait package (#421) * fix: embed genesis block in executable (#420) * feat: add benchmarking of vectors (#423) * feat: add benchmarking of vectors * feat: add benchmarking of vectors * Use nicer test and benchmark names * Chore/sqlotus dag prefetch option (#430) * Disable preloader by default, toggle with LOTUS_CHAINSTORE_PRELOAD_RECENTS * Switch to a cli string as suggested by @iand * Remove one more inefficiency for the R/O lens filecoin-project/go-bs-postgres-chainnotated@b8b5d500e368d2ed * Forgotten option/helptext spec * Add support for static Get() prefetch * close TipSetObs in walker and watcher * fix(indexer): only close TIpSetIndexer in walk and watch - subsequent calls to close will hang forever * chore: increase linter timout in ci * chore: update for Lotus 1.5.3 (#439) * chore: update for Lotus 1.5.3 * fixup! chore: update for Lotus 1.5.3 * Update statediff version Co-authored-by: frrist <[email protected]> * Release notes for v0.5.5 (#440) * chore: update lotus to 1.6.0 (#443) * chore: upgrade lotus dependency to 1.6.0-rc1 (#447) * chore: update lotus to 1.6.0 (#455) * Release notes for v0.5.6 (#456) * fix: ensure persistence semaphore channel is drained on close (#457) * fix: ensure persistence semaphore channel is drained on close * Add hidden window flag for testing * Reduce actor happy path logging * Make sure actor errors reported are appended to correct list * Release notes for v0.5.7 (#458) * fix(tasks): use correct ActorInfo for actor state extraction (#449) * fix(tasks): use corret actor info for actor state extraction - fixes #273 * fix(lens): remove OptimizedStateGetActorWithFallback - fixes #405 * fix(market-task): fix market actor task and gen vector - fixes #465 * polish(vector): support msapproval model validation * test(vector): generate new test vectors * ci: increase instance size due to test vectors * Add MinerSectorInfo for extended sectors (#448) Fixes #441. Extended sectors have new deadlines but this is not recorded anywhere. * Fix makefile conflicts Co-authored-by: Peter Rabbitson <[email protected]> Co-authored-by: frrist <[email protected]> Co-authored-by: Hector Sanjuan <[email protected]> Co-authored-by: Ian Davis <[email protected]> Co-authored-by: Peter Rabbitson <[email protected]> Co-authored-by: Hector Sanjuan <[email protected]>
What
The PR imports and embeds the lotus daemon into Visro; currently, this node is called Lily.
Changes required to lotus live here: filecoin-project/lotus#5693
Usage
make
(may need to rungit submodule update --init --recursive
first)./visor lily daemon --import-snapshot minimal_finality_stateroots_517061_2021-02-20_11-00-00.car
make dockerup
to create a database./visor lily watch start
will instruct lily to start watching and processing the Filecoin blockchain and indexing it to the database.