Skip to content

Commit 7f16d5f

Browse files
rjan90Kubuxu
andcommitted
fix: update F3-calibnet name and bootstrap epoch Calibnet (#13469)
* fix: update F3-calibnet name and epoch fix: update F3-calibnet name and epoch * fix: unset `InitialPowerTable` fix: unset `InitialPowerTable` * fix: use manifest NetworkName for F3 pubsub topic filtering Remove BaseNetworkName from lf3.Config and use the manifest's NetworkName directly for pubsub topic filtering. This was the only remaining use of the Filecoin-to-F3 network name mapping, which is no longer needed now that the F3 network name is explicitly defined in the manifest. * chore: bump go-f3 version to v0.8.11 chore: bump go-f3 version to v0.8.11 * feat: F3 data import with manifest validation Added a check for the availability of the F3 manifest before importing F3 data into the datastore. If the manifest is not available, a warning is logged, and the import is skipped, allowing the chain import to continue. * fix(tests): patch F3ManifestBytes in TestChainExportImportWithF3Data Fixes an issue where we couldn't impport a test snapshot due to InitialPowerTable miss-match Signed-off-by: Jakub Sztandera <oss@kubuxu.com> * chore: bump go-f3 version to v0.8.12 chore: bump go-f3 version to v0.8.12 * fix: skip F3 data import when InitialPowerTable is undefined fix: skip F3 data import when InitialPowerTable is undefined * chore: update F3 calibnet BootstrapEpoch chore: update F3 calibnet BootstrapEpoch * chore: go-mod tidy chore: go-mod tidy --------- Signed-off-by: Jakub Sztandera <oss@kubuxu.com> Co-authored-by: Jakub Sztandera <oss@kubuxu.com>
1 parent 00f1983 commit 7f16d5f

File tree

8 files changed

+113
-198
lines changed

8 files changed

+113
-198
lines changed

build/buildconstants/f3manifest_calibnet.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
"Pause": false,
33
"ProtocolVersion": 7,
44
"InitialInstance": 0,
5-
"BootstrapEpoch": 2081674,
6-
"NetworkName": "calibrationnet",
5+
"BootstrapEpoch": 3451774,
6+
"NetworkName": "calibrationnet2",
77
"ExplicitPower": null,
88
"IgnoreECPower": false,
9-
"InitialPowerTable": {
10-
"/": "bafy2bzaceab236vmmb3n4q4tkvua2n4dphcbzzxerxuey3mot4g3cov5j3r2c"
11-
},
9+
"InitialPowerTable": null,
1210
"CommitteeLookback": 10,
1311
"CatchUpAlignment": 15000000000,
1412
"Gpbft": {

chain/lf3/config.go

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@ import (
1010
"github.com/filecoin-project/go-state-types/abi"
1111

1212
"github.com/filecoin-project/lotus/build/buildconstants"
13-
"github.com/filecoin-project/lotus/node/modules/dtypes"
1413
)
1514

1615
type Config struct {
17-
// BaseNetworkName is the base from which dynamic network names are defined and is usually
18-
// the name of the network defined by the static manifest. This must be set correctly or,
19-
// e.g., pubsub topic filters won't work correctly.
20-
BaseNetworkName gpbft.NetworkName
2116
// StaticManifest this instance's default manifest absent any dynamic manifests. Also see
2217
// PrioritizeStaticManifest.
2318
StaticManifest *manifest.Manifest
@@ -59,18 +54,9 @@ func NewManifest(
5954
}
6055
}
6156

62-
// NewConfig creates a new F3 config based on the node's build parameters and the passed network
63-
// name.
64-
func NewConfig(nn dtypes.NetworkName) *Config {
65-
// Use "filecoin" as the network name on mainnet, otherwise use the network name. Yes,
66-
// mainnet is called testnetnet in state.
67-
if nn == "testnetnet" {
68-
nn = "filecoin"
57+
// NewConfig creates a new F3 config based on the node's build parameters.
58+
func NewConfig() *Config {
59+
return &Config{
60+
StaticManifest: buildconstants.F3Manifest(),
6961
}
70-
c := &Config{
71-
BaseNetworkName: gpbft.NetworkName(nn),
72-
StaticManifest: buildconstants.F3Manifest(),
73-
}
74-
75-
return c
7662
}

chain/store/snapshot.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"golang.org/x/xerrors"
2929

3030
"github.com/filecoin-project/go-f3/certstore"
31+
"github.com/filecoin-project/go-f3/manifest"
3132
"github.com/filecoin-project/go-state-types/abi"
3233

3334
bstore "github.com/filecoin-project/lotus/blockstore"
@@ -236,9 +237,17 @@ func (cs *ChainStore) Import(ctx context.Context, f3Ds dtypes.F3DS, r io.Reader)
236237
prefix := F3DatastorePrefix()
237238
f3DsWrapper := namespace.Wrap(f3Ds, prefix)
238239

239-
log.Info("Importing F3Data to datastore")
240-
if err := certstore.ImportSnapshotToDatastore(ctx, f3r, f3DsWrapper); err != nil {
241-
return nil, nil, xerrors.Errorf("failed to import f3Data to datastore: %w", err)
240+
var f3Manifest *manifest.Manifest = buildconstants.F3Manifest()
241+
if f3Manifest == nil {
242+
log.Warnf("Snapshot contains F3 data but F3 manifest is not available in this build. Skipping F3 data import.")
243+
// Skip F3 import but continue with chain import
244+
} else if !f3Manifest.InitialPowerTable.Defined() {
245+
log.Warnf("Snapshot contains F3 data but InitialPowerTable in F3 manifest is not available in this build. Skipping F3 data import.")
246+
} else {
247+
log.Info("Importing F3Data to datastore")
248+
if err := certstore.ImportSnapshotToDatastore(ctx, f3r, f3DsWrapper, f3Manifest); err != nil {
249+
return nil, nil, xerrors.Errorf("failed to import f3Data to datastore: %w", err)
250+
}
242251
}
243252
}
244253

chain/store/store_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package store_test
33
import (
44
"bytes"
55
"context"
6+
"encoding/json"
67
"io"
78
"testing"
89

@@ -15,10 +16,12 @@ import (
1516
"github.com/filecoin-project/go-f3/certs"
1617
"github.com/filecoin-project/go-f3/certstore"
1718
"github.com/filecoin-project/go-f3/gpbft"
19+
"github.com/filecoin-project/go-f3/manifest"
1820
"github.com/filecoin-project/go-state-types/abi"
1921
"github.com/filecoin-project/go-state-types/crypto"
2022

2123
"github.com/filecoin-project/lotus/blockstore"
24+
"github.com/filecoin-project/lotus/build/buildconstants"
2225
"github.com/filecoin-project/lotus/chain/actors/policy"
2326
"github.com/filecoin-project/lotus/chain/consensus"
2427
"github.com/filecoin-project/lotus/chain/consensus/filcns"
@@ -270,6 +273,23 @@ func TestChainExportImportWithF3Data(t *testing.T) {
270273
lc = cert
271274
}
272275

276+
{
277+
// patch out embedded manifest for testing
278+
oldManifest := buildconstants.F3ManifestBytes
279+
280+
var manif manifest.Manifest
281+
if err := json.Unmarshal(buildconstants.F3ManifestBytes, &manif); err != nil {
282+
t.Fatal(err)
283+
}
284+
manif.InitialPowerTable = ptCid
285+
defer func() {
286+
buildconstants.F3ManifestBytes = oldManifest
287+
}()
288+
if buildconstants.F3ManifestBytes, err = json.Marshal(manif); err != nil {
289+
t.Fatal(err)
290+
}
291+
}
292+
273293
certStore, err := certstore.OpenStore(context.TODO(), f3ds)
274294
if err != nil {
275295
t.Fatal(err)

go.mod

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ require (
4545
github.com/filecoin-project/go-cbor-util v0.0.2
4646
github.com/filecoin-project/go-commp-utils/v2 v2.1.0
4747
github.com/filecoin-project/go-crypto v0.1.0
48-
github.com/filecoin-project/go-f3 v0.8.10
48+
github.com/filecoin-project/go-f3 v0.8.12
4949
github.com/filecoin-project/go-fil-commcid v0.3.1
5050
github.com/filecoin-project/go-hamt-ipld/v3 v3.4.1
5151
github.com/filecoin-project/go-jsonrpc v0.9.0
@@ -87,15 +87,15 @@ require (
8787
github.com/ipfs/bbloom v0.0.4
8888
github.com/ipfs/boxo v0.35.0
8989
github.com/ipfs/go-block-format v0.2.3
90-
github.com/ipfs/go-cid v0.5.0
90+
github.com/ipfs/go-cid v0.6.0
9191
github.com/ipfs/go-datastore v0.9.0
9292
github.com/ipfs/go-ds-badger2 v0.1.5
9393
github.com/ipfs/go-ds-leveldb v0.5.2
9494
github.com/ipfs/go-ds-measure v0.2.2
9595
github.com/ipfs/go-fs-lock v0.1.1
9696
github.com/ipfs/go-ipld-cbor v0.2.1
9797
github.com/ipfs/go-ipld-format v0.6.3
98-
github.com/ipfs/go-log/v2 v2.8.2
98+
github.com/ipfs/go-log/v2 v2.9.0
9999
github.com/ipfs/go-metrics-interface v0.3.0
100100
github.com/ipfs/go-metrics-prometheus v0.1.0
101101
github.com/ipld/go-car v0.6.2
@@ -104,10 +104,10 @@ require (
104104
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438
105105
github.com/jpillora/backoff v1.0.0
106106
github.com/kelseyhightower/envconfig v1.4.0
107-
github.com/klauspost/compress v1.18.0
107+
github.com/klauspost/compress v1.18.2
108108
github.com/koalacxr/quantile v0.0.1
109109
github.com/libp2p/go-buffer-pool v0.1.0
110-
github.com/libp2p/go-libp2p v0.44.0
110+
github.com/libp2p/go-libp2p v0.46.0
111111
github.com/libp2p/go-libp2p-kad-dht v0.35.1
112112
github.com/libp2p/go-libp2p-pubsub v0.15.0
113113
github.com/libp2p/go-libp2p-record v0.3.1
@@ -145,24 +145,24 @@ require (
145145
github.com/zondax/ledger-filecoin-go v1.2.0
146146
github.com/zyedidia/generic v1.2.1
147147
go.opencensus.io v0.24.0
148-
go.opentelemetry.io/otel v1.38.0
148+
go.opentelemetry.io/otel v1.39.0
149149
go.opentelemetry.io/otel/bridge/opencensus v1.28.0
150150
go.opentelemetry.io/otel/exporters/jaeger v1.14.0
151151
go.opentelemetry.io/otel/exporters/prometheus v0.50.0
152-
go.opentelemetry.io/otel/metric v1.38.0
152+
go.opentelemetry.io/otel/metric v1.39.0
153153
go.opentelemetry.io/otel/sdk v1.38.0
154154
go.opentelemetry.io/otel/sdk/metric v1.38.0
155155
go.uber.org/fx v1.24.0
156156
go.uber.org/multierr v1.11.0
157-
go.uber.org/zap v1.27.0
158-
golang.org/x/crypto v0.43.0
159-
golang.org/x/mod v0.28.0
160-
golang.org/x/net v0.45.0
161-
golang.org/x/sync v0.17.0
162-
golang.org/x/sys v0.37.0
163-
golang.org/x/term v0.36.0
157+
go.uber.org/zap v1.27.1
158+
golang.org/x/crypto v0.47.0
159+
golang.org/x/mod v0.31.0
160+
golang.org/x/net v0.48.0
161+
golang.org/x/sync v0.19.0
162+
golang.org/x/sys v0.40.0
163+
golang.org/x/term v0.39.0
164164
golang.org/x/time v0.14.0
165-
golang.org/x/tools v0.37.0
165+
golang.org/x/tools v0.40.0
166166
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
167167
gotest.tools v2.2.0+incompatible
168168
)
@@ -203,7 +203,6 @@ require (
203203
github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect
204204
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect
205205
github.com/flynn/noise v1.1.0 // indirect
206-
github.com/francoispqt/gojay v1.2.13 // indirect
207206
github.com/gdamore/encoding v1.0.0 // indirect
208207
github.com/go-kit/log v0.2.1 // indirect
209208
github.com/go-logfmt/logfmt v0.6.0 // indirect
@@ -295,7 +294,7 @@ require (
295294
github.com/prometheus/common v0.66.1 // indirect
296295
github.com/prometheus/procfs v0.17.0 // indirect
297296
github.com/prometheus/statsd_exporter v0.22.7 // indirect
298-
github.com/quic-go/qpack v0.5.1 // indirect
297+
github.com/quic-go/qpack v0.6.0 // indirect
299298
github.com/quic-go/webtransport-go v0.9.0 // indirect; dependency-check-ignore: unknown
300299
github.com/rivo/uniseg v0.4.7 // indirect
301300
github.com/russross/blackfriday/v2 v2.1.0 // indirect
@@ -320,17 +319,17 @@ require (
320319
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
321320
go.dedis.ch/fixbuf v1.0.3 // indirect
322321
go.dedis.ch/kyber/v4 v4.0.0-pre2.0.20240924132404-4de33740016e // indirect; dependency-check-ignore: unknown
323-
go.opentelemetry.io/otel/trace v1.38.0 // indirect
322+
go.opentelemetry.io/otel/trace v1.39.0 // indirect
324323
go.uber.org/atomic v1.11.0 // indirect
325324
go.uber.org/dig v1.19.0 // indirect
326325
go.uber.org/mock v0.5.2 // indirect
327326
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
328327
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
329-
golang.org/x/text v0.30.0 // indirect
328+
golang.org/x/text v0.33.0 // indirect
330329
gonum.org/v1/gonum v0.16.0 // indirect
331330
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
332331
google.golang.org/grpc v1.75.0 // indirect
333-
google.golang.org/protobuf v1.36.9 // indirect
332+
google.golang.org/protobuf v1.36.11 // indirect
334333
gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect
335334
gopkg.in/yaml.v2 v2.4.0 // indirect
336335
gopkg.in/yaml.v3 v3.0.1 // indirect
@@ -339,6 +338,7 @@ require (
339338
)
340339

341340
require (
341+
github.com/filecoin-project/go-keccak v0.1.0 // indirect
342342
github.com/gammazero/chanqueue v1.1.1 // indirect
343343
github.com/gammazero/deque v1.1.0 // indirect
344344
github.com/ipfs/go-cidutil v0.1.0 // indirect
@@ -353,12 +353,12 @@ require (
353353
github.com/pion/transport/v3 v3.0.7 // indirect
354354
github.com/pion/turn/v4 v4.0.2 // indirect
355355
github.com/pion/webrtc/v4 v4.1.2 // indirect
356-
github.com/quic-go/quic-go v0.55.0 // indirect
356+
github.com/quic-go/quic-go v0.57.1 // indirect
357357
github.com/tklauser/go-sysconf v0.3.15 // indirect
358358
github.com/tklauser/numcpus v0.10.0 // indirect
359359
github.com/yusufpapurcu/wmi v1.2.4 // indirect
360360
github.com/zondax/golem v0.27.0 // indirect
361361
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
362362
go.yaml.in/yaml/v2 v2.4.3 // indirect
363-
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect
363+
golang.org/x/telemetry v0.0.0-20251203150158-8fff8a5912fc // indirect
364364
)

0 commit comments

Comments
 (0)