Skip to content

Commit

Permalink
Merge pull request #7 from streamingfast/feature/standardize-dir
Browse files Browse the repository at this point in the history
standardize dir
  • Loading branch information
maoueh authored Sep 28, 2022
2 parents a488919 + 806ea58 commit 5f34975
Show file tree
Hide file tree
Showing 32 changed files with 162 additions and 143 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ms1.test.md
.DS_Store

# To facilitate development, you can use [direnv](https://direnv.net/) to auto-load
# some environment variables. We have in `devel` a shim script called directly `fireacme`
# some environment variables. We have in `devel` a shim script called directly `firearweave`
# (that should have been renamed to your specific chain like `fireeth`). This small shim
# compiles the project and then invoke resulting binary. This means that when using this
# .envrc file:
Expand All @@ -14,14 +14,14 @@ ms1.test.md
# export PATH="`pwd`/devel:$PATH"
# ```
#
# Each time you enter the project in your terminal (e.g. `cd ~/work/firehose-acme`) and then
# Each time you enter the project in your terminal (e.g. `cd ~/work/firehose-arweave`) and then
# do `firehose start --help`, then it first compiles all the Go source code and then invoke the
# resulting just compiled binary, meaning you are "always" freshly compiled, it's more or less
# equivalent to doing directly `go run ./cmd/fireacme start --help` (which is totally fine).
# equivalent to doing directly `go run ./cmd/firearweave start --help` (which is totally fine).
.envrc*

sf-data

/fireacme
/firearweave
/dist
fire-data
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Change log

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). See [MAINTAINERS.md](./MAINTAINERS.md)
for instructions to keep up to date.


## v1.0.0

#### Flags and environment variables

* Renamed the `mindreader` application to `reader`
* Renamed `common-one-blocks-store-url` to `common-one-block-store-url`
* Renamed all the `mindreader-node-*` flags to `reader-node-*`





38 changes: 19 additions & 19 deletions INTEGRATION.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Chain Integration Document

## Concepts
Blockchain data extraction occurs by two processes running conjunction a `Deepmind` & `Mindreader`. We run an instrumented version of a process (usually a node) to sync the chain referred to as `DeepMind`.
The DeepMind process instruments the blockchain and outputs logs over the standard output pipe, which is subsequently read and processed by the `Mindreader` process.
The MindReader process will read, and stitch together the output of `DeepMind` to create rich blockchain data models, which it will subsequently write to
Blockchain data extraction occurs by two processes running conjunction a `Firehose` & `Reader`. We run an instrumented version of a process (usually a node) to sync the chain referred to as `Firehose`.
The Firehose process instruments the blockchain and outputs logs over the standard output pipe, which is subsequently read and processed by the `Reader` process.
The Reader process will read, and stitch together the output of `Firehose` to create rich blockchain data models, which it will subsequently write to
files. The data models in question are [Google Protobuf Structures](https://developers.google.com/protocol-buffers).

#### Data Modeling
Expand All @@ -20,14 +20,14 @@ https://github.com/streamingfast/proto-ethereum/blob/develop/sf/ethereum/codec/v
We have built an end-to-end template, to start the on-boarding process of new chains. This solution consist of:

*firehose-acme*
As mentioned above, the `Mindreader` process consumes the data that is extracted and streamed from `Deeepmind`. In Actuality the MindReader
As mentioned above, the `Reader` process consumes the data that is extracted and streamed from `Deepmind`. In Actuality the Reader
is one process out of multiple ones that creates the _Firehose_. These processes are launched by one application. This application is
chain specific and by convention, we name is "firehose-<chain-name>". Though this application is chain specific, the structure of the application
is standardized and is quite similar from chain to chain. For convenience, we have create a boiler plate app to help you get started.
We named our chain `Acme` this the app is [firehose-acme](https://github.com/streamingfast/firehose-acme)

*DeepMind*
`Deepmind` consist of an instrumented syncing node. We have created a "dummy" chain to simulate a node process syncing that can be found [https://github.com/streamingfast/dummy-blockchain](https://github.com/streamingfast/dummy-blockchain).
*Firehose*
`Firehose` consist of an instrumented syncing node. We have created a "dummy" chain to simulate a node process syncing that can be found [https://github.com/streamingfast/dummy-blockchain](https://github.com/streamingfast/dummy-blockchain).

## Setting up the dummy chain

Expand Down Expand Up @@ -69,7 +69,7 @@ cd devel/standard/
vi standard.yaml
```

modify the flag `mindreader-node-path: "dchain"` to point to the path of your `dchain` binary you compiled above
modify the flag `reader-node-path: "dchain"` to point to the path of your `dchain` binary you compiled above

## Starting and testing Firehose

Expand All @@ -80,22 +80,22 @@ Start `fireacme`
./start.sh
```

This will launch `fireacme` application. Behind the scenes we are starting 3 sub processes: `mindreader-node`, `relayer`, `firehose`
This will launch `fireacme` application. Behind the scenes we are starting 3 sub processes: `reader-node`, `relayer`, `firehose`

*mindreader-node*
*reader-node*

The mindreader-node is a process that runs and manages the blockchain node Geth. It consumes the blockchain data that is
extracted from our instrumented Geth node. The instrumented Geth node outputs individual block data. The mindreader-node
The reader-node is a process that runs and manages the blockchain node Geth. It consumes the blockchain data that is
extracted from our instrumented Geth node. The instrumented Geth node outputs individual block data. The reader-node
process will either write individual block data into separate files called one-block files or merge 100 blocks data
together and write into a file called 100-block file.

This behaviour is configurable with the mindreader-node-merge-and-store-directly flag. When running the mindreader-node
process with mindreader-node-merge-and-store-directly flag enable, we say the “mindreader is running in merged mode”.
When the flag is disabled, we will refer to the mindreader as running in its normal mode of operation.
This behaviour is configurable with the reader-node-merge-and-store-directly flag. When running the reader-node
process with reader-node-merge-and-store-directly flag enable, we say the “reader is running in merged mode”.
When the flag is disabled, we will refer to the reader as running in its normal mode of operation.

In the scenario where the mindreader-node process stores one-block files. We can run a merger process on the side which
would merge the one-block files into 100-block files. When we are syncing the chain we will run the mindreader-node process
in merged mode. When we are synced we will run the mindreader-node in it’s regular mode of operation (storing one-block files)
In the scenario where the reader-node process stores one-block files. We can run a merger process on the side which
would merge the one-block files into 100-block files. When we are syncing the chain we will run the reader-node process
in merged mode. When we are synced we will run the reader-node in it’s regular mode of operation (storing one-block files)

The one-block files and 100-block files will be store in data-dir/storage/merged-blocks and data-dir/storage/one-blocks respectively.
The naming convention of the file is the number of the first block in the file.
Expand All @@ -111,8 +111,8 @@ We have also built tools that allow you to introspect block files:
go install ../../cmd/fireacme && fireacme tools print blocks --store ./fire-data/storage/merged-blocks 100
```

At this point we have `mindreader-node` process running as well a `relayer` & `firehose` process. Both of these processes work together to provide the Firehose data stream.
Once the firehose process is running, it will be listening on port 13042. At it’s core the firehose is a gRPC stream. We can list the available gRPC service
At this point we have `reader-node` process running as well a `relayer` & `firehose` process. Both of these processes work together to provide the Firehose data stream.
Once the Firehose process is running, it will be listening on port 13042. At it’s core the Firehose is a gRPC stream. We can list the available gRPC service

```bash
grpcurl -plaintext localhost:16042 list
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ of Arweave blocks.
```
# Arguments shared with both thegarii:
#
# --mindreader-node-start-block-num
# --mindreader-node-stop-block-num
./devel/standard/start.sh -- --mindreader-node-start-block-num 911988
# --reader-node-start-block-num
# --reader-node-stop-block-num
./devel/standard/start.sh -- --reader-node-start-block-num 911988
```

## Release
Expand Down
4 changes: 2 additions & 2 deletions cmd/firearweave/cli/common-flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
func init() {
launcher.RegisterCommonFlags = func(logger *zap.Logger, cmd *cobra.Command) error {
//Common stores configuration flags
cmd.Flags().String("common-merged-blocks-store-url", MergedBlocksStoreURL, "[COMMON] Store URL (with prefix) where to read/write. Used by: mindreader, merger, relayer and firehose")
cmd.Flags().String("common-merged-blocks-store-url", MergedBlocksStoreURL, "[COMMON] Store URL (with prefix) where to read/write. Used by: reader, merger, relayer and firehose")
cmd.Flags().String("common-forked-blocks-store-url", ForkedBlockStoreURL, "[COMMON] Store URL (with prefix) to read/write forked block files. Used by: merger, firehose")
cmd.Flags().String("common-one-blocks-store-url", OneBlockStoreURL, "[COMMON] Store URL (with prefix) to read/write one-block files. Used by: mindreader, merger")
cmd.Flags().String("common-one-block-store-url", OneBlockStoreURL, "[COMMON] Store URL (with prefix) to read/write one-block files. Used by: reader, merger")
cmd.Flags().String("common-live-source-addr", RelayerServingAddr, "[COMMON] gRPC endpoint to get real-time blocks. Used by: firehose")

cmd.Flags().Bool("common-blocks-cache-enabled", false, "[COMMON] enable ATM caching")
Expand Down
16 changes: 8 additions & 8 deletions cmd/firearweave/cli/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const (
// The current prefix is the one you should use for your chain. Once you have copied
// this whole repository, you should open a PR on firehose-arweave to bump it again
// so the next team supporting Firehose will use 16XXXX and so forth.
MindreaderGRPCAddr string = ":16010"
NodeManagerAPIAddr string = ":16041"
MindreaderNodeManagerAPIAddr string = ":16009"
MergerServingAddr string = ":16012"
RelayerServingAddr string = ":16011"
FirehoseGRPCServingAddr string = ":16042"
ReaderGRPCAddr string = ":16010"
NodeManagerAPIAddr string = ":16041"
ReaderNodeManagerAPIAddr string = ":16009"
MergerServingAddr string = ":16012"
RelayerServingAddr string = ":16011"
FirehoseGRPCServingAddr string = ":16042"

// Data storage default locations
ATMDirectory string = "file://{data-dir}/atm"
Expand All @@ -29,8 +29,8 @@ const (
// Native node instance port definitions, adjust those for your chain
// usually all chains have a P2P and RPC port available

MindreaderNodeP2PPort string = "30305"
MindreaderNodeRPCPort string = "8547"
ReaderNodeP2PPort string = "30305"
ReaderNodeRPCPort string = "8547"

NodeP2PPort string = "30303"
NodeRPCPort string = "3030"
Expand Down
2 changes: 1 addition & 1 deletion cmd/firearweave/cli/firehose.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func init() {
Title: "Block Firehose",
Description: "Provides on-demand filtered blocks, depends on mergd blocks and live source",
RegisterFlags: func(cmd *cobra.Command) error {
cmd.Flags().String("firehose-grpc-listen-addr", FirehoseGRPCServingAddr, "Address on which the firehose will listen, appending * to the end of the listen address will start the server over an insecure TLS connection. By default firehose will start in plain-text mode.")
cmd.Flags().String("firehose-grpc-listen-addr", FirehoseGRPCServingAddr, "Address on which the firehose will listen, appending * to the end of the listen address will start the server over an insecure TLS connection. By default Firehose will start in plain-text mode.")
return nil
},

Expand Down
2 changes: 1 addition & 1 deletion cmd/firearweave/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func Main() {
derr.Check("arweave-blockchain", RootCmd.Execute())
}

var startCmdExample = `firearweave start mindreader`
var startCmdExample = `firearweave start reader-node`
var startCmdHelpTemplate = `Usage:{{if .Runnable}}
{{.UseLine}}{{end}} [all|command1 [command2...]]{{if gt (len .Aliases) 0}}
Expand Down
Loading

0 comments on commit 5f34975

Please sign in to comment.