Skip to content

Commit

Permalink
copy over current changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed Nov 6, 2024
1 parent d9d795d commit edddbaf
Show file tree
Hide file tree
Showing 7 changed files with 250 additions and 9 deletions.
27 changes: 27 additions & 0 deletions cmd/fireacme/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
pbacme "github.com/streamingfast/firehose-acme/pb/sf/acme/type/v1"

Check failure on line 4 in cmd/fireacme/main.go

View workflow job for this annotation

GitHub Actions / Test (1.21.x, ubuntu-latest)

no required module provides package github.com/streamingfast/firehose-acme/pb/sf/acme/type/v1; to add it:

Check failure on line 4 in cmd/fireacme/main.go

View workflow job for this annotation

GitHub Actions / Test (1.21.x, macos-latest)

no required module provides package github.com/streamingfast/firehose-acme/pb/sf/acme/type/v1; to add it:
firecore "github.com/streamingfast/firehose-core"
fhCmd "github.com/streamingfast/firehose-core/cmd"
)

func main() {
fhCmd.Main(&firecore.Chain[*pbacme.Tipset]{
ShortName: "acme",
LongName: "Acme",
ExecutableName: "forest",
FullyQualifiedModule: "github.com/streamingfast/firehose-acme",
Version: version,

FirstStreamableBlock: 1,

BlockFactory: func() firecore.Block { return new(pbacme.Tipset) },
ConsoleReaderFactory: firecore.NewConsoleReader,

Tools: &firecore.ToolsConfig[*pbacme.Tipset]{},
})
}

// Version value, injected via go build `ldflags` at build time, **must** not be removed or inlined
var version = "dev"
8 changes: 3 additions & 5 deletions devel/standard/standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ start:
# Specifies the path to the binary, we assume you did
# `go install github.com/streamingfast/dummy-blockchain@latest` (and that you have value
# of `go env GOPATH` in your environment).
reader-node-path: "dummy-blockchain"
reader-node-path: "forest"
reader-node-data-dir: "{data-dir}/reader-node"

# Flags that will be added to the dummy chain process command
reader-node-arguments:
start
--tracer=firehose
--store-dir={node-data-dir}
--block-rate=60
--chain calibnet
--encrypt-keystore false
7 changes: 4 additions & 3 deletions devel/stdin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

clean=
firefil="$ROOT/../firefil"
fireacme="$ROOT/../fireacme"

main() {
pushd "$ROOT" &> /dev/null
Expand Down Expand Up @@ -33,7 +33,8 @@ main() {
# usage_error "The 'dummy-blockchain' executable must be found within your PATH, install it from source of 'https://github.com/streamingfast/dummy-blockchain'"
# fi

exec go run github.com/streamingfast/[email protected] start --tracer=firehose --block-rate=60 --store-dir "$chain_data" | $firefil -c $(basename $ROOT).yaml start "$@"
# exec go run github.com/streamingfast/[email protected] start --tracer=firehose --block-rate=60 --store-dir "$chain_data" | $fireacme -c $(basename $ROOT).yaml start "$@"
forest --chain calibnet --encrypt-keystore=false | $fireacme -c $(basename $ROOT).yaml start "$@"
}

usage_error() {
Expand All @@ -55,4 +56,4 @@ usage() {
echo " -c Clean actual data directory first"
}

main "$@"
main "$@"
2 changes: 1 addition & 1 deletion devel/stdin/stdin.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Invoked using:
#
# dummy-blockchain start --tracer=firehose --store-dir=./devel/stdin/firehose-data/reader-node --block-rate=60 | ./devel/stdin/start.sh
# forest --chain calibnet --encrypt-keystore=false | ./devel/stdin/start.sh
#
# The `./devel/stdin/start.sh` does the above invocation and pipes the output to the `stdin` process.
start:
Expand Down
33 changes: 33 additions & 0 deletions pb/sf/acme/type/v1/type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package pbacme

import (
"time"

firecore "github.com/streamingfast/firehose-core"
)

var _ firecore.Block = (*Tipset)(nil)

func (b *Tipset) GetFirehoseBlockID() string {
return "blah"
}

func (b *Tipset) GetFirehoseBlockNumber() uint64 {
return b.Height
}

func (b *Tipset) GetFirehoseBlockParentID() string {
return ""
}

func (b *Tipset) GetFirehoseBlockParentNumber() uint64 {
return *&b.Height - 1
}

func (b *Tipset) GetFirehoseBlockTime() time.Time {
return time.Unix(0, int64(b.Timestamp)).UTC()
}

func (b *Tipset) GetFirehoseBlockLIBNum() uint64 {
return b.Height
}
171 changes: 171 additions & 0 deletions pb/sf/acme/type/v1/type.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions proto/sf/acme/type/v1/type.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";

package sf.acme.type.v1;

option go_package = "github.com/streamingfast/firehose-acme/pb/sf/acme/type/v1;pbacme";

message Tipset {
uint64 height = 1;
uint64 block_count = 2;
uint64 timestamp = 3;
}

0 comments on commit edddbaf

Please sign in to comment.