Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
eef772f
feat: add `--v2` flag to `forest-cli snapshot export`
hanabi1224 Jul 15, 2025
972914f
snapshot metadata API for plain CAR
hanabi1224 Jul 16, 2025
6408398
forest-tool archive metadata
hanabi1224 Jul 16, 2025
d07fa89
fix link checker
hanabi1224 Jul 16, 2025
c370d04
fix typo
hanabi1224 Jul 16, 2025
246e3a0
Merge branch 'main' into hm/export-snapshot-v2
hanabi1224 Jul 16, 2025
5f8ecae
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 Jul 17, 2025
13e63dd
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 Jul 22, 2025
918d590
resolve comments
hanabi1224 Jul 22, 2025
b8f8e6d
address AI comment
hanabi1224 Jul 22, 2025
6d41c27
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 Jul 28, 2025
4a36686
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 Jul 29, 2025
6323cb7
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 Jul 29, 2025
f3ccbdb
resolve comments
hanabi1224 Jul 29, 2025
2a28182
Merge branch 'main' into hm/export-snapshot-v2
hanabi1224 Jul 29, 2025
c60e6b1
resolve comments
hanabi1224 Jul 30, 2025
b6720fe
tests
hanabi1224 Jul 30, 2025
142d027
Merge branch 'main' into hm/export-snapshot-v2
hanabi1224 Jul 30, 2025
dc127ca
speed up snapshot export check
hanabi1224 Jul 30, 2025
0203c96
chore(deps): bump go-f3 and Go deps
hanabi1224 Jul 31, 2025
cec3d5c
Merge remote-tracking branch 'origin/hm/bump-go-deps' into hm/export-…
hanabi1224 Jul 31, 2025
f7c631f
integrate with go-f3
hanabi1224 Jul 31, 2025
fa83aaa
f3 snap import
hanabi1224 Aug 1, 2025
0a59dde
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 1, 2025
fb63dfa
integrity check of f3 data
hanabi1224 Aug 1, 2025
7713315
fix f3 snap import
hanabi1224 Aug 1, 2025
bdd6dc0
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 1, 2025
93c4d7c
bump go-f3
hanabi1224 Aug 1, 2025
9ffd7c9
bump go-f3
hanabi1224 Aug 1, 2025
de4aa85
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 4, 2025
d68fa83
bump go-f3
hanabi1224 Aug 4, 2025
963503f
Merge branch 'main' into hm/export-f3-data
hanabi1224 Aug 5, 2025
d1ad868
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 6, 2025
374c38d
no go mod replace
hanabi1224 Aug 6, 2025
0a1ca02
fix comments and small tweaks
hanabi1224 Aug 6, 2025
725f233
add tests
hanabi1224 Aug 6, 2025
baf3d42
changelog
hanabi1224 Aug 6, 2025
9181ead
unit test coverage for get_reader & resolve AI comments
hanabi1224 Aug 6, 2025
4996b33
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 6, 2025
e18e351
update doc gen script
hanabi1224 Aug 7, 2025
51b9f75
Merge branch 'main' into hm/export-f3-data
hanabi1224 Aug 7, 2025
e9b6572
print size and speed in `merge-f3` command output
hanabi1224 Aug 7, 2025
9b8395b
chore(ci): add go linter
hanabi1224 Aug 7, 2025
379633d
Potential fix for code scanning alert no. 63: Workflow does not conta…
hanabi1224 Aug 7, 2025
88b50d6
Merge remote-tracking branch 'origin/hm/go-linter' into hm/export-f3-…
hanabi1224 Aug 7, 2025
b481cf8
fix go lint errors
hanabi1224 Aug 7, 2025
5d4130d
use ProgressBar
hanabi1224 Aug 7, 2025
4e2b96d
resolve comments
hanabi1224 Aug 7, 2025
34910b1
Merge branch 'main' into hm/export-f3-data
hanabi1224 Aug 7, 2025
fefc3f2
update CI umbrella job
hanabi1224 Aug 7, 2025
faf4439
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 8, 2025
86bc855
Update src/tool/subcommands/archive_cmd.rs
hanabi1224 Aug 11, 2025
ca4e52d
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 11, 2025
5243383
resolve comments
hanabi1224 Aug 11, 2025
196c884
fix rpc endpoint in tests
hanabi1224 Aug 11, 2025
c42b224
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 Aug 11, 2025
c2621bc
Merge branch 'main' into hm/export-f3-data
hanabi1224 Aug 13, 2025
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
5 changes: 3 additions & 2 deletions .github/workflows/forest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ jobs:
calibnet-export-check-v2:
needs:
- build-ubuntu
name: Snapshot export checks v2
name: Snapshot export checks v2 with F3 data
runs-on: ubuntu-24.04
steps:
- run: lscpu
Expand All @@ -304,7 +304,7 @@ jobs:
run: |
chmod +x ~/.cargo/bin/forest*
- name: Snapshot export check v2
run: ./scripts/tests/calibnet_export_check.sh v2
run: ./scripts/tests/calibnet_export_f3_check.sh
timeout-minutes: ${{ fromJSON(env.SCRIPT_TIMEOUT_MINUTES) }}
calibnet-no-discovery-checks:
needs:
Expand Down Expand Up @@ -576,6 +576,7 @@ jobs:
- state-migrations-check
- calibnet-wallet-check
- calibnet-export-check
- calibnet-export-check-v2
- calibnet-no-discovery-checks
- calibnet-kademlia-checks
- calibnet-eth-mapping-check
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@

- [#5859](https://github.com/ChainSafe/forest/pull/5859) Added size metrics for zstd frame cache and made max size configurable via `FOREST_ZSTD_FRAME_CACHE_DEFAULT_MAX_SIZE` environment variable.

- [#5886](https://github.com/ChainSafe/forest/issues/5886) Add `forest-tool archive merge-f3` subcommand for merging a v1 Filecoin snapshot and an F3 snapshot into a v2 Filecoin snapshot.

- [#4976](https://github.com/ChainSafe/forest/issues/4976) Add support for the `Filecoin.EthSubscribe` and `Filecoin.EthUnsubscribe` API methods to enable subscriptions to Ethereum event types: `heads` and `logs`.

### Changed

- [#5886](https://github.com/ChainSafe/forest/issues/5886) Updated `forest-tool archive metadata` to print F3 snapshot header info when applicable.

- [#5869](https://github.com/ChainSafe/forest/pull/5869) Updated `forest-cli snapshot export` to print average speed.

### Removed
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/users/reference/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ generate_markdown_section "forest-tool" "archive"
generate_markdown_section "forest-tool" "archive info"
generate_markdown_section "forest-tool" "archive export"
generate_markdown_section "forest-tool" "archive checkpoints"
generate_markdown_section "forest-tool" "archive metadata"
generate_markdown_section "forest-tool" "archive merge"
generate_markdown_section "forest-tool" "archive merge-f3"
generate_markdown_section "forest-tool" "archive diff"
generate_markdown_section "forest-tool" "archive sync-bucket"

Expand Down
33 changes: 33 additions & 0 deletions f3-sidecar/api.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package main

import (
"bufio"
"context"
"errors"
"os"

"github.com/filecoin-project/go-f3"
"github.com/filecoin-project/go-f3/certs"
"github.com/filecoin-project/go-f3/gpbft"
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/peer"
)

Expand Down Expand Up @@ -51,6 +55,35 @@ func (h *F3ServerHandler) F3GetF3PowerTable(ctx context.Context, tsk []byte) (gp
return h.f3.GetPowerTable(ctx, tsk)
}

func (h *F3ServerHandler) F3ExportLatestSnapshot(ctx context.Context, path string) (_ *cid.Cid, err error) {
cs, err := h.f3.GetCertStore()
if err != nil {
return nil, err
}

f, err := os.Create(path)
if err != nil {
return nil, err
}
defer func() {
if closeErr := f.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
}
}()

writer := bufio.NewWriter(f)
defer func() {
if flushErr := writer.Flush(); flushErr != nil {
err = errors.Join(err, flushErr)
}
}()
cid, _, err := cs.ExportLatestSnapshot(ctx, writer)
if err != nil {
return nil, err
}
return &cid, nil
}

// F3GetF3PowerTableByInstance retrieves the power table for a specific consensus instance.
// It returns the power entries associated with the given instance number.
//
Expand Down
14 changes: 14 additions & 0 deletions f3-sidecar/ffi_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var GoF3NodeImpl GoF3Node

type GoF3Node interface {
run(rpc_endpoint *string, jwt *string, f3_rpc_endpoint *string, initial_power_table *string, bootstrap_epoch *int64, finality *int64, f3_root *string) bool
import_snap(f3_rpc_endpoint *string, f3_root *string, snapshot_path *string) string
}

//export CGoF3Node_run
Expand All @@ -49,6 +50,19 @@ func CGoF3Node_run(rpc_endpoint C.StringRef, jwt C.StringRef, f3_rpc_endpoint C.
runtime.KeepAlive(buffer)
}

//export CGoF3Node_import_snap
func CGoF3Node_import_snap(f3_rpc_endpoint C.StringRef, f3_root C.StringRef, snapshot_path C.StringRef, slot *C.void, cb *C.void) {
_new_f3_rpc_endpoint := newString(f3_rpc_endpoint)
_new_f3_root := newString(f3_root)
_new_snapshot_path := newString(snapshot_path)
resp := GoF3NodeImpl.import_snap(&_new_f3_rpc_endpoint, &_new_f3_root, &_new_snapshot_path)
resp_ref, buffer := cvt_ref(cntString, refString)(&resp)
asmcall.CallFuncG0P2(unsafe.Pointer(cb), unsafe.Pointer(&resp_ref), unsafe.Pointer(slot))
runtime.KeepAlive(resp_ref)
runtime.KeepAlive(resp)
runtime.KeepAlive(buffer)
}

func newString(s_ref C.StringRef) string {
return unsafe.String((*byte)(unsafe.Pointer(s_ref.ptr)), s_ref.len)
}
Expand Down
7 changes: 7 additions & 0 deletions f3-sidecar/ffi_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ func (f3 *f3Impl) run(rpc_endpoint *string, jwt *string, f3_rpc_endpoint *string
return err == nil
}

func (f3 *f3Impl) import_snap(f3_rpc_endpoint *string, f3_root *string, snapshot_path *string) string {
if err := importSnap(f3.ctx, *f3_rpc_endpoint, *f3_root, *snapshot_path); err != nil {
return err.Error()
}
return ""
}

func checkError(err error) {
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions f3-sidecar/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ module f3-sidecar/v2
go 1.24.5

require (
github.com/filecoin-project/go-f3 v0.8.9
github.com/filecoin-project/go-f3 v0.8.10-0.20250801124500-9288fba86c47
github.com/filecoin-project/go-jsonrpc v0.8.0
github.com/filecoin-project/go-state-types v0.16.0
github.com/ihciah/rust2go v0.0.0-20250726175549-557d7a3a4e27
github.com/ipfs/go-cid v0.5.0
github.com/ipfs/go-datastore v0.8.2
github.com/ipfs/go-ds-leveldb v0.5.2
github.com/ipfs/go-log/v2 v2.8.0
github.com/libp2p/go-libp2p v0.42.1
Expand Down Expand Up @@ -44,7 +45,6 @@ require (
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/ipfs/boxo v0.33.0 // indirect
github.com/ipfs/go-datastore v0.8.2 // indirect
github.com/ipld/go-ipld-prime v0.21.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions f3-sidecar/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ github.com/filecoin-project/go-bitfield v0.2.4 h1:uZ7MeE+XfM5lqrHJZ93OnhQKc/rveW
github.com/filecoin-project/go-bitfield v0.2.4/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU=
github.com/filecoin-project/go-clock v0.1.0/go.mod h1:4uB/O4PvOjlx1VCMdZ9MyDZXRm//gkj1ELEbxfI1AZs=
github.com/filecoin-project/go-f3 v0.8.9 h1:0SHqwWmcVAL02Or7uE4P7qG1feopyVBSlgrUxkHkQBM=
github.com/filecoin-project/go-f3 v0.8.9/go.mod h1:hFvb2CMxHDmlJAVzfiIL/V8zCtNMQqfSnhP5TyM6CHI=
github.com/filecoin-project/go-f3 v0.8.10-0.20250801124500-9288fba86c47 h1:qf5j5kHyTfwivaXjXlySjS5Nax6wufrUiomE4elcW3s=
github.com/filecoin-project/go-f3 v0.8.10-0.20250801124500-9288fba86c47/go.mod h1:hFvb2CMxHDmlJAVzfiIL/V8zCtNMQqfSnhP5TyM6CHI=
github.com/filecoin-project/go-jsonrpc v0.8.0 h1:2yqlN3Vd8Gx5UtA3fib7tQu2aW1cSOJt253LEBWExo4=
github.com/filecoin-project/go-jsonrpc v0.8.0/go.mod h1:p8WGOwQGYbFugSdK7qKIGhhb1VVcQ2rtBLdEiik1QWI=
github.com/filecoin-project/go-state-types v0.16.0 h1:ajIREDzTGfq71ofIQ29iZR1WXxmkvd2nQNc6ApcP1wI=
Expand Down
59 changes: 59 additions & 0 deletions f3-sidecar/import.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package main

import (
"bufio"
"context"
"errors"
"os"

"github.com/filecoin-project/go-f3/certstore"
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-jsonrpc"
"github.com/ipfs/go-datastore/namespace"
)

func importSnap(ctx context.Context, rpcEndpoint string, f3Root string, snapshotPath string) (err error) {
logger.Infof("importing F3 snapshot at %s", snapshotPath)

f3api := F3Api{}
closer, err := jsonrpc.NewClient(ctx, rpcEndpoint, "F3", &f3api, nil)
Comment thread
akaladarshi marked this conversation as resolved.
if err != nil {
return err
}
defer closer()
rawNetworkName := waitRawNetworkName(ctx, &f3api)
networkName := getNetworkName(rawNetworkName)
m := Network2PredefinedManifestMappings[networkName]
if m == nil {
m2 := manifest.LocalDevnetManifest()
m = &m2
m.NetworkName = networkName
}

ds, err := getDatastore(f3Root)
if err != nil {
return err
}
defer func() {
if closeErr := ds.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
}
}()
dsWrapper := namespace.Wrap(ds, m.DatastorePrefix())
defer func() {
if closeErr := dsWrapper.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
}
}()

f, err := os.Open(snapshotPath)
if err != nil {
return err
}
defer func() {
if closeErr := f.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
}
}()
return certstore.ImportSnapshotToDatastore(ctx, bufio.NewReader(f), dsWrapper)
}
14 changes: 11 additions & 3 deletions f3-sidecar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ func main() {
flag.Int64Var(&bootstrapEpoch, "bootstrap", -1, "F3 bootstrap epoch")
var finality int64
flag.Int64Var(&finality, "finality", 900, "chain finality epochs")
var root string
flag.StringVar(&root, "root", "f3-data", "path to the f3 data directory")
var f3Root string
flag.StringVar(&f3Root, "root", "f3-data", "path to the f3 data directory")
var snapshotPath string
flag.StringVar(&snapshotPath, "snapshot", "", "path to the f3 snapshot file")

flag.Parse()

ctx := context.Background()

err := run(ctx, rpcEndpoint, jwt, f3RpcEndpoint, initialPowerTable, bootstrapEpoch, finality, root)
if len(snapshotPath) > 0 {
if err := importSnap(ctx, rpcEndpoint, f3Root, snapshotPath); err != nil {
panic(err)
}
}

err := run(ctx, rpcEndpoint, jwt, f3RpcEndpoint, initialPowerTable, bootstrapEpoch, finality, f3Root)
if err != nil {
panic(err)
}
Expand Down
30 changes: 9 additions & 21 deletions f3-sidecar/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"net"
"net/http"
"path/filepath"
"time"

"github.com/filecoin-project/go-f3"
Expand All @@ -15,10 +14,9 @@ import (
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-jsonrpc"
"github.com/ipfs/go-cid"
leveldb "github.com/ipfs/go-ds-leveldb"
)

func run(ctx context.Context, rpcEndpoint string, jwt string, f3RpcEndpoint string, initialPowerTable string, bootstrapEpoch int64, finality int64, f3Root string) error {
func run(ctx context.Context, rpcEndpoint string, jwt string, f3RpcEndpoint string, initialPowerTable string, bootstrapEpoch int64, finality int64, f3Root string) (err error) {
api := FilecoinApi{}
isJwtProvided := len(jwt) > 0
closer, err := jsonrpc.NewClient(ctx, rpcEndpoint, "Filecoin", &api, nil)
Expand All @@ -32,17 +30,7 @@ func run(ctx context.Context, rpcEndpoint string, jwt string, f3RpcEndpoint stri
return err
}

var rawNetwork string
for {
rawNetwork, err = ec.f3api.GetRawNetworkName(ctx)
if err == nil {
logger.Infoln("Forest RPC server is online")
break
} else {
logger.Warnln("waiting for Forest RPC server")
time.Sleep(5 * time.Second)
}
}
rawNetwork := waitRawNetworkName(ctx, &ec.f3api)
listenAddrs, err := api.NetAddrsListen(ctx)
if err != nil {
return err
Expand All @@ -60,17 +48,17 @@ func run(ctx context.Context, rpcEndpoint string, jwt string, f3RpcEndpoint stri
if err != nil {
return err
}
ds, err := leveldb.NewDatastore(filepath.Join(f3Root, "db"), nil)
ds, err := getDatastore(f3Root)
if err != nil {
return err
}
defer func() {
if closeErr := ds.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
}
}()
verif := blssig.VerifierWithKeyOnG1()
networkName := gpbft.NetworkName(rawNetwork)
// Use "filecoin" as the network name on mainnet, otherwise use the network name. Yes,
// mainnet is called testnetnet in state.
if networkName == "testnetnet" {
networkName = "filecoin"
}
networkName := getNetworkName(rawNetwork)
m := Network2PredefinedManifestMappings[networkName]
if m == nil {
m2 := manifest.LocalDevnetManifest()
Expand Down
39 changes: 38 additions & 1 deletion f3-sidecar/utils.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
package main

import "github.com/ipfs/go-cid"
import (
"context"
"path/filepath"
"time"

"github.com/filecoin-project/go-f3/gpbft"
"github.com/ipfs/go-cid"
leveldb "github.com/ipfs/go-ds-leveldb"
)

var CID_UNDEF_RUST = cid.MustParse("baeaaaaa")

func isCidDefined(c cid.Cid) bool {
return c.Defined() && c != CID_UNDEF_RUST
}

func getDatastore(f3Root string) (*leveldb.Datastore, error) {
return leveldb.NewDatastore(filepath.Join(f3Root, "db"), nil)
}

func waitRawNetworkName(ctx context.Context, f3api *F3Api) string {
for {
rawNetwork, err := f3api.GetRawNetworkName(ctx)
if err != nil {
logger.Warnln("waiting for Forest RPC server")
time.Sleep(5 * time.Second)
continue
}

logger.Infoln("Forest RPC server is online")
return rawNetwork
}
}

func getNetworkName(rawNetworkName string) gpbft.NetworkName {
networkName := gpbft.NetworkName(rawNetworkName)
// See <https://github.com/filecoin-project/lotus/blob/v1.33.1/chain/lf3/config.go#L65>
// Use "filecoin" as the network name on mainnet, otherwise use the network name. Yes,
// mainnet is called testnetnet in state.
if networkName == "testnetnet" {
Comment thread
akaladarshi marked this conversation as resolved.
networkName = "filecoin"
}
return networkName
}
3 changes: 1 addition & 2 deletions scripts/tests/calibnet_eth_mapping_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ done

echo "Done"

echo "Waiting to be ready for serving"
$FOREST_CLI_PATH healthcheck ready --wait
forest_wait_for_healthcheck_ready
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Aug 6, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Readiness check should precede first CLI call to avoid flakiness

forest_wait_for_healthcheck_ready is invoked only after multiple RPC/CLI interactions (info show, block-hash queries). If the node is still warming up, those earlier calls may intermittently fail and make the test brittle.

Consider moving the readiness check immediately after forest_init (or embedding it inside that helper) and before the first $FOREST_CLI_PATH … invocation:

-forest_init --backfill-db 200
+# initialise and wait until the node is ready
+forest_init --backfill-db 200
+forest_wait_for_healthcheck_ready   # <-- moved up

-OUTPUT=$($FOREST_CLI_PATH info show)
+# safe to query now
+OUTPUT=$($FOREST_CLI_PATH info show)

This keeps the happy-path identical while tightening race conditions in CI runs.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In scripts/tests/calibnet_eth_mapping_check.sh at line 49, the readiness check
function forest_wait_for_healthcheck_ready is currently called after several
RPC/CLI commands, which can cause intermittent failures if the node is not fully
ready. To fix this, move the call to forest_wait_for_healthcheck_ready to
immediately after the forest_init call and before any CLI commands are executed.
This ensures the node is ready before making RPC/CLI calls, reducing flakiness
in tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

forest_wait_api in forest_init ensures RPC service is ready. forest_wait_for_healthcheck_ready does more checks like the db backfill success in this script

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@hanabi1224 Thank you for the clarification! That makes perfect sense. I understand now that forest_wait_api within forest_init ensures basic RPC readiness, while forest_wait_for_healthcheck_ready performs the more comprehensive checks including DB backfill completion.

Given that this script uses --backfill-db 200, the current placement is indeed correct - the initial RPC calls for gathering block hashes can proceed once the basic RPC service is ready, but the Ethereum mapping tests require the full DB backfill to be complete, hence the placement of forest_wait_for_healthcheck_ready right before those tests.

I appreciate you explaining this distinction in the Forest initialization sequence.


✏️ Learnings added
Learnt from: hanabi1224
PR: ChainSafe/forest#5886
File: scripts/tests/calibnet_eth_mapping_check.sh:49-49
Timestamp: 2025-08-07T09:37:03.055Z
Learning: In Forest project scripts, `forest_wait_api` (called within `forest_init`) ensures basic RPC service readiness, while `forest_wait_for_healthcheck_ready` performs additional comprehensive checks including DB backfill completion. When using `--backfill-db` flag, basic RPC operations can proceed after `forest_init`, but operations requiring complete DB backfill should wait for `forest_wait_for_healthcheck_ready`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: LesnyRumcajs
PR: ChainSafe/forest#5907
File: Cargo.toml:25-36
Timestamp: 2025-08-06T15:42:43.476Z
Learning: Forest project requires fvm_ipld_amt version 0.7.5 functionality which is available in the Git revision a633547ae414a333b2d076beef87d4d30cdb7fb4 of the ref-fvm repository, but version 0.7.5 is not yet published to crates.io (only 0.7.4 is available). The Git patch must remain until 0.7.5 is published.


ERROR=0
echo "Testing Ethereum mappings"
Expand Down
Loading
Loading