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

add 'substreams-tier1-quicksave-store' and bump substreams for quicksave support #89

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@ Operators, you should copy/paste content of this content straight to your projec

If you were at `firehose-core` version `1.0.0` and are bumping to `1.1.0`, you should copy the content between those 2 version to your own repository, replacing placeholder value `fire{chain}` with your chain's own binary.

## Unreleased
## v1.9.0

### Substreams

* Rust modules will now be executed with `wasmtime` by default instead of `wazero`.
- Prevents the whole server from stalling in certain memory-intensive operations in wazero.
- Speed improvement: cuts the execution time in half in some circumstances.
- Wazero is still used for modules with `wbindgen` and modules compiled with `tinygo`.
- Set env var `SUBSTREAMS_WASM_RUNTIME=wazero` to revert to previous behavior.

* Implement "QuickSave" feature to save the state of "live running" substreams stores when shutting down, and then resume processing from that point if the cursor matches.
- Added flag `substreams-tier1-quicksave-store` to enable quicksave when non-empty
(requires `--common-system-shutdown-signal-delay` to be set to a long enough value to save the in-flight stores)

### Misc

* The `firecore tools print one-block` is now able to print from a file directly.

Expand All @@ -34,10 +48,11 @@ If you were at `firehose-core` version `1.0.0` and are bumping to `1.1.0`, you s

#### Performance

* Fixed a regression since "v1.7.3" where the SkipEmptyOutput instruction was ignored in substreams mappers
* Add shared cache for tier1 execution near HEAD, to prevent multiple tier1 instances from reprocessing the same module on the same block when it comes in (ex: foundational modules)
* Improved fetching of state caches on tier1 requests to speed up "time to first data"

* Fixed a regression since "v1.7.3" where the SkipEmptyOutput instruction was ignored in substreams mappers

### Tools

* make 'compare-blocks' command support one-blocks stores as well as merged-blocks
Expand Down
11 changes: 4 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23.4-alpine as build
FROM golang:1.24.0-bookworm as build
WORKDIR /app

COPY go.mod go.sum ./
Expand All @@ -7,17 +7,14 @@ RUN go mod download
COPY . ./

ARG VERSION="dev"
RUN apk --no-cache add git
RUN apt-get update && apt-get install git
RUN go build -v -ldflags "-X main.version=${VERSION}" ./cmd/firecore

####

FROM alpine:3
FROM ubuntu:24.04


RUN apk --no-cache add \
ca-certificates htop iotop sysstat \
strace lsof curl jq tzdata
RUN apt-get update && apt-get -y install ca-certificates htop iotop sysstat strace lsof curl jq tzdata

RUN mkdir -p /app/ && curl -Lo /app/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.12/grpc_health_probe-linux-amd64 && chmod +x /app/grpc_health_probe

Expand Down
2 changes: 2 additions & 0 deletions cmd/apps/substreams_tier1.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func RegisterSubstreamsTier1App[B firecore.Block](chain *firecore.Chain[B], root
This is useful to prevent the tier1 from being overwhelmed by too many requests, most client auto-reconnects on 'Unavailable' code
so they should end up on another tier1 instance, assuming you have proper auto-scaling of the number of instances available.
`))
cmd.Flags().String("substreams-tier1-quicksave-store", "", "If enabled, substreams will use this store to put 'quicksave' data when shutting down while running requests with 'stores'. Use this flag with a non-zero --common-system-shutdown-signal-delay")
cmd.Flags().String("substreams-tier1-global-worker-pool-address", "", "Address of the global worker pool to use for the substreams tier1. (disabled if empty)")
cmd.Flags().String("substreams-tier1-global-request-pool-address", "", "Address of the global worker pool to use for the substreams tier1. (disabled if empty)")
cmd.Flags().Duration("substreams-tier1-global-worker-pool-keep-alive-delay", 25*time.Second, "Delay between two keep alive call to the global worker pool. Default is 25s")
Expand Down Expand Up @@ -163,6 +164,7 @@ func RegisterSubstreamsTier1App[B firecore.Block](chain *firecore.Chain[B], root
config.GRPCListenAddr = viper.GetString("substreams-tier1-grpc-listen-addr")
config.GRPCShutdownGracePeriod = time.Second
config.ServiceDiscoveryURL = serviceDiscoveryURL
config.QuickSaveStoreURL = viper.GetString("substreams-tier1-quicksave-store")

subRequestsClientConfig := client.NewSubstreamsClientConfig(
config.SubrequestsEndpoint,
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/streamingfast/bstream v0.0.2-0.20250129191551-5539724f4b12
github.com/streamingfast/bstream v0.0.2-0.20250221181559-fb0809660f91
github.com/streamingfast/cli v0.0.4-0.20250116003948-fbf66c930cce
github.com/streamingfast/dauth v0.0.0-20250130223258-c615a033a660
github.com/streamingfast/dbin v0.9.1-0.20231117225723-59790c798e2c
Expand All @@ -31,7 +31,7 @@ require (
github.com/streamingfast/payment-gateway v0.0.0-20240426151444-581e930c76e2
github.com/streamingfast/pbgo v0.0.6-0.20250114182320-0b43084f4000
github.com/streamingfast/snapshotter v0.0.0-20230316190750-5bcadfde44d0
github.com/streamingfast/substreams v1.12.5-0.20250220140015-91e8dc3e5576
github.com/streamingfast/substreams v1.13.1-0.20250226131308-66bde512c25e
github.com/streamingfast/worker-pool-protocol v0.0.0-20250218145136-4ad271e36e39
github.com/stretchr/testify v1.10.0
github.com/test-go/testify v1.1.4
Expand All @@ -54,6 +54,7 @@ require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/bobg/go-generics/v3 v3.5.0 // indirect
github.com/bufbuild/protocompile v0.4.0 // indirect
github.com/bytecodealliance/wasmtime-go/v30 v30.0.0 // indirect
github.com/charmbracelet/lipgloss v1.0.0 // indirect
github.com/charmbracelet/x/ansi v0.4.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand Down Expand Up @@ -217,7 +218,6 @@ require (
replace (
cloud.google.com/go => github.com/streamingfast/google-cloud-go v0.0.0-20241202194114-f77ff78d4f66
github.com/ShinyTrinkets/overseer => github.com/streamingfast/overseer v0.2.1-0.20210326144022-ee491780e3ef
github.com/bytecodealliance/wasmtime-go/v4 => github.com/streamingfast/wasmtime-go/v4 v4.0.0-freemem3
github.com/jhump/protoreflect => github.com/streamingfast/protoreflect v0.0.0-20231205191344-4b629d20ce8d
github.com/tetratelabs/wazero => github.com/streamingfast/wazero v0.0.0-20241202185309-91287c3640ed

Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,8 @@ github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
github.com/bytecodealliance/wasmtime-go/v30 v30.0.0 h1:e/niRqzC1keW4Z3yLK3k3gyEKdVyzFWhYAMhTFgEx+4=
github.com/bytecodealliance/wasmtime-go/v30 v30.0.0/go.mod h1:eLGFEIgQI47f/3/RK1MNY5knv85j6lsCoVG3/edFD0M=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g=
Expand Down Expand Up @@ -2152,8 +2154,8 @@ github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
github.com/streamingfast/bstream v0.0.2-0.20250129191551-5539724f4b12 h1:Kh4ZxZwv/bccTLFNugEbj9wfxuukbLkE6Mmkqc3OACw=
github.com/streamingfast/bstream v0.0.2-0.20250129191551-5539724f4b12/go.mod h1:n5wy+Vmwp4xbjXO7B81MAkAgjnf1vJ/lI2y6hWWyFbg=
github.com/streamingfast/bstream v0.0.2-0.20250221181559-fb0809660f91 h1:n4Ws5vS8dF4J6WYP7mE0C9DsE1Inju7BKd6XWI4T18c=
github.com/streamingfast/bstream v0.0.2-0.20250221181559-fb0809660f91/go.mod h1:n5wy+Vmwp4xbjXO7B81MAkAgjnf1vJ/lI2y6hWWyFbg=
github.com/streamingfast/cli v0.0.4-0.20250116003948-fbf66c930cce h1:RWla1PaRrlDf/MOwVoN/dJhIM/dXa9O4rmKZkv9T5bg=
github.com/streamingfast/cli v0.0.4-0.20250116003948-fbf66c930cce/go.mod h1:qOksW3DPhHVYBo8dcYxS7K3Q09wlcOChSdopeOjLWng=
github.com/streamingfast/dauth v0.0.0-20250130223258-c615a033a660 h1:QwuploKvaXyvwpxhFWKmPFrvesJRJb7gK+gsgEbAY5c=
Expand Down Expand Up @@ -2197,8 +2199,8 @@ github.com/streamingfast/shutter v1.5.0 h1:NpzDYzj0HVpSiDJVO/FFSL6QIK/YKOxY0gJAt
github.com/streamingfast/shutter v1.5.0/go.mod h1:B/T6efqdeMGbGwjzPS1ToXzYZI4kDzI5/u4I+7qbjY8=
github.com/streamingfast/snapshotter v0.0.0-20230316190750-5bcadfde44d0 h1:Y15G1Z4fpEdm2b+/70owI7TLuXadlqBtGM7rk4Hxrzk=
github.com/streamingfast/snapshotter v0.0.0-20230316190750-5bcadfde44d0/go.mod h1:/Rnz2TJvaShjUct0scZ9kKV2Jr9/+KBAoWy4UMYxgv4=
github.com/streamingfast/substreams v1.12.5-0.20250220140015-91e8dc3e5576 h1:7g3xTNv5C3w5+3l8/IvM5RbF+fwZRsaIE66f7+uZm1s=
github.com/streamingfast/substreams v1.12.5-0.20250220140015-91e8dc3e5576/go.mod h1:2/yOQAnNP4EQ66buwMF4eOVUgPN6RWrh8VxHT5LL5vc=
github.com/streamingfast/substreams v1.13.1-0.20250226131308-66bde512c25e h1:lFzj1E8g5gPYnUeMSp5qG+uCJyuQRRUtTTZumzIqXWc=
github.com/streamingfast/substreams v1.13.1-0.20250226131308-66bde512c25e/go.mod h1:ObwCa5VmHsSiGLmjdzDNIwvDLDslrqrheC08FOl61+g=
github.com/streamingfast/wazero v0.0.0-20241202185309-91287c3640ed h1:LU6/c376zP1cMAo9L6rFLyjo0W7RU+hIh7BegH8Zo5M=
github.com/streamingfast/wazero v0.0.0-20241202185309-91287c3640ed/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs=
github.com/streamingfast/worker-pool-protocol v0.0.0-20250218145136-4ad271e36e39 h1:NBBLx99rrGz/hxwHjHi+QyN07DfqcDC4zzuBEsH0/vE=
Expand Down
Loading