Skip to content
Closed
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
8 changes: 3 additions & 5 deletions build/buildconstants/f3manifest_calibnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
"Pause": false,
"ProtocolVersion": 7,
"InitialInstance": 0,
"BootstrapEpoch": 2081674,
"NetworkName": "calibrationnet",
"BootstrapEpoch": 3451774,
"NetworkName": "calibrationnet2",
"ExplicitPower": null,
"IgnoreECPower": false,
"InitialPowerTable": {
"/": "bafy2bzaceab236vmmb3n4q4tkvua2n4dphcbzzxerxuey3mot4g3cov5j3r2c"
},
"InitialPowerTable": null,
"CommitteeLookback": 10,
"CatchUpAlignment": 15000000000,
"Gpbft": {
Expand Down
22 changes: 4 additions & 18 deletions chain/lf3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ import (
"github.com/filecoin-project/go-state-types/abi"

"github.com/filecoin-project/lotus/build/buildconstants"
"github.com/filecoin-project/lotus/node/modules/dtypes"
)

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

// NewConfig creates a new F3 config based on the node's build parameters and the passed network
// name.
func NewConfig(nn dtypes.NetworkName) *Config {
// Use "filecoin" as the network name on mainnet, otherwise use the network name. Yes,
// mainnet is called testnetnet in state.
if nn == "testnetnet" {
nn = "filecoin"
// NewConfig creates a new F3 config based on the node's build parameters.
func NewConfig() *Config {
return &Config{
StaticManifest: buildconstants.F3Manifest(),
}
c := &Config{
BaseNetworkName: gpbft.NetworkName(nn),
StaticManifest: buildconstants.F3Manifest(),
}

return c
}
15 changes: 12 additions & 3 deletions chain/store/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"golang.org/x/xerrors"

"github.com/filecoin-project/go-f3/certstore"
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-state-types/abi"

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

log.Info("Importing F3Data to datastore")
if err := certstore.ImportSnapshotToDatastore(ctx, f3r, f3DsWrapper); err != nil {
return nil, nil, xerrors.Errorf("failed to import f3Data to datastore: %w", err)
var f3Manifest *manifest.Manifest = buildconstants.F3Manifest()
if f3Manifest == nil {
log.Warnf("Snapshot contains F3 data but F3 manifest is not available in this build. Skipping F3 data import.")
// Skip F3 import but continue with chain import
} else if !f3Manifest.InitialPowerTable.Defined() {
log.Warnf("Snapshot contains F3 data but InitialPowerTable in F3 manifest is not available in this build. Skipping F3 data import.")
} else {
log.Info("Importing F3Data to datastore")
if err := certstore.ImportSnapshotToDatastore(ctx, f3r, f3DsWrapper, f3Manifest); err != nil {
return nil, nil, xerrors.Errorf("failed to import f3Data to datastore: %w", err)
}
}
}

Expand Down
20 changes: 20 additions & 0 deletions chain/store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package store_test
import (
"bytes"
"context"
"encoding/json"
"io"
"testing"

Expand All @@ -15,10 +16,12 @@ import (
"github.com/filecoin-project/go-f3/certs"
"github.com/filecoin-project/go-f3/certstore"
"github.com/filecoin-project/go-f3/gpbft"
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto"

"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build/buildconstants"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/consensus"
"github.com/filecoin-project/lotus/chain/consensus/filcns"
Expand Down Expand Up @@ -270,6 +273,23 @@ func TestChainExportImportWithF3Data(t *testing.T) {
lc = cert
}

{
// patch out embedded manifest for testing
oldManifest := buildconstants.F3ManifestBytes

var manif manifest.Manifest
if err := json.Unmarshal(buildconstants.F3ManifestBytes, &manif); err != nil {
t.Fatal(err)
}
manif.InitialPowerTable = ptCid
defer func() {
buildconstants.F3ManifestBytes = oldManifest
}()
if buildconstants.F3ManifestBytes, err = json.Marshal(manif); err != nil {
t.Fatal(err)
}
}

certStore, err := certstore.OpenStore(context.TODO(), f3ds)
if err != nil {
t.Fatal(err)
Expand Down
46 changes: 23 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ require (
github.com/filecoin-project/go-cbor-util v0.0.2
github.com/filecoin-project/go-commp-utils/v2 v2.1.0
github.com/filecoin-project/go-crypto v0.1.0
github.com/filecoin-project/go-f3 v0.8.10
github.com/filecoin-project/go-f3 v0.8.12
github.com/filecoin-project/go-fil-commcid v0.3.1
github.com/filecoin-project/go-hamt-ipld/v3 v3.4.1
github.com/filecoin-project/go-jsonrpc v0.9.0
Expand Down Expand Up @@ -87,15 +87,15 @@ require (
github.com/ipfs/bbloom v0.0.4
github.com/ipfs/boxo v0.35.0
github.com/ipfs/go-block-format v0.2.3
github.com/ipfs/go-cid v0.5.0
github.com/ipfs/go-cid v0.6.0
github.com/ipfs/go-datastore v0.9.0
github.com/ipfs/go-ds-badger2 v0.1.5
github.com/ipfs/go-ds-leveldb v0.5.2
github.com/ipfs/go-ds-measure v0.2.2
github.com/ipfs/go-fs-lock v0.1.1
github.com/ipfs/go-ipld-cbor v0.2.1
github.com/ipfs/go-ipld-format v0.6.3
github.com/ipfs/go-log/v2 v2.8.2
github.com/ipfs/go-log/v2 v2.9.0
github.com/ipfs/go-metrics-interface v0.3.0
github.com/ipfs/go-metrics-prometheus v0.1.0
github.com/ipld/go-car v0.6.2
Expand All @@ -104,10 +104,10 @@ require (
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438
github.com/jpillora/backoff v1.0.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/klauspost/compress v1.18.0
github.com/klauspost/compress v1.18.2
github.com/koalacxr/quantile v0.0.1
github.com/libp2p/go-buffer-pool v0.1.0
github.com/libp2p/go-libp2p v0.44.0
github.com/libp2p/go-libp2p v0.46.0
github.com/libp2p/go-libp2p-kad-dht v0.35.1
github.com/libp2p/go-libp2p-pubsub v0.15.0
github.com/libp2p/go-libp2p-record v0.3.1
Expand Down Expand Up @@ -145,24 +145,24 @@ require (
github.com/zondax/ledger-filecoin-go v1.2.0
github.com/zyedidia/generic v1.2.1
go.opencensus.io v0.24.0
go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel v1.39.0
go.opentelemetry.io/otel/bridge/opencensus v1.28.0
go.opentelemetry.io/otel/exporters/jaeger v1.14.0
go.opentelemetry.io/otel/exporters/prometheus v0.50.0
go.opentelemetry.io/otel/metric v1.38.0
go.opentelemetry.io/otel/metric v1.39.0
go.opentelemetry.io/otel/sdk v1.38.0
go.opentelemetry.io/otel/sdk/metric v1.38.0
go.uber.org/fx v1.24.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.43.0
golang.org/x/mod v0.28.0
golang.org/x/net v0.45.0
golang.org/x/sync v0.17.0
golang.org/x/sys v0.37.0
golang.org/x/term v0.36.0
go.uber.org/zap v1.27.1
golang.org/x/crypto v0.47.0
golang.org/x/mod v0.31.0
golang.org/x/net v0.48.0
golang.org/x/sync v0.19.0
golang.org/x/sys v0.40.0
golang.org/x/term v0.39.0
golang.org/x/time v0.14.0
golang.org/x/tools v0.37.0
golang.org/x/tools v0.40.0
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
gotest.tools v2.2.0+incompatible
)
Expand Down Expand Up @@ -203,7 +203,6 @@ require (
github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
Expand Down Expand Up @@ -295,7 +294,7 @@ require (
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.17.0 // indirect
github.com/prometheus/statsd_exporter v0.22.7 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/webtransport-go v0.9.0 // indirect; dependency-check-ignore: unknown
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
Expand All @@ -320,17 +319,16 @@ require (
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
go.dedis.ch/fixbuf v1.0.3 // indirect
go.dedis.ch/kyber/v4 v4.0.0-pre2.0.20240924132404-4de33740016e // indirect; dependency-check-ignore: unknown
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.opentelemetry.io/otel/trace v1.39.0 // indirect
go.uber.org/dig v1.19.0 // indirect
go.uber.org/mock v0.5.2 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/text v0.33.0 // indirect
gonum.org/v1/gonum v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/grpc v1.75.0 // indirect
google.golang.org/protobuf v1.36.9 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -339,6 +337,7 @@ require (
)

require (
github.com/filecoin-project/go-keccak v0.1.0 // indirect
github.com/gammazero/chanqueue v1.1.1 // indirect
github.com/gammazero/deque v1.1.0 // indirect
github.com/ipfs/go-cidutil v0.1.0 // indirect
Expand All @@ -353,12 +352,13 @@ require (
github.com/pion/transport/v3 v3.0.7 // indirect
github.com/pion/turn/v4 v4.0.2 // indirect
github.com/pion/webrtc/v4 v4.1.2 // indirect
github.com/quic-go/quic-go v0.55.0 // indirect
github.com/quic-go/quic-go v0.57.1 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/zondax/golem v0.27.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect
golang.org/x/telemetry v0.0.0-20251203150158-8fff8a5912fc // indirect
)
Loading
Loading