Skip to content
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
5 changes: 3 additions & 2 deletions f3-sidecar/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"

"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-jsonrpc"
"github.com/ipfs/go-datastore/namespace"
Expand All @@ -22,8 +23,8 @@ func importSnap(ctx context.Context, rpcEndpoint string, f3Root string, snapshot
}
defer closer()
rawNetworkName := waitRawNetworkName(ctx, &f3api)
networkName := getNetworkName(rawNetworkName)
m := Network2PredefinedManifestMappings[networkName]
networkName := gpbft.NetworkName(rawNetworkName)
m := RawNetwork2PredefinedManifestMappings[networkName]
if m == nil {
m2 := manifest.LocalDevnetManifest()
m = &m2
Expand Down
10 changes: 5 additions & 5 deletions f3-sidecar/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"github.com/filecoin-project/go-f3/manifest"
)

var Network2PredefinedManifestMappings map[gpbft.NetworkName]*manifest.Manifest = make(map[gpbft.NetworkName]*manifest.Manifest)
var RawNetwork2PredefinedManifestMappings map[gpbft.NetworkName]*manifest.Manifest = make(map[gpbft.NetworkName]*manifest.Manifest)

func init() {
for _, bytes := range [][]byte{F3ManifestBytes2K, F3ManifestBytesButterfly, F3ManifestBytesCalibnet, F3ManifestBytesMainnet} {
m := loadManifest(bytes)
Network2PredefinedManifestMappings[m.NetworkName] = m
}
RawNetwork2PredefinedManifestMappings["testnetnet"] = loadManifest(F3ManifestBytesMainnet)
RawNetwork2PredefinedManifestMappings["calibrationnet"] = loadManifest(F3ManifestBytesCalibnet)
RawNetwork2PredefinedManifestMappings["butterflynet"] = loadManifest(F3ManifestBytesButterfly)
RawNetwork2PredefinedManifestMappings["2k"] = loadManifest(F3ManifestBytes2K)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

//go:embed f3manifest_2k.json
Expand Down
4 changes: 2 additions & 2 deletions f3-sidecar/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func run(ctx context.Context, rpcEndpoint string, jwt string, f3RpcEndpoint stri
}
}()
verif := blssig.VerifierWithKeyOnG1()
networkName := getNetworkName(rawNetwork)
m := Network2PredefinedManifestMappings[networkName]
networkName := gpbft.NetworkName(rawNetwork)
m := RawNetwork2PredefinedManifestMappings[networkName]
if m == nil {
m2 := manifest.LocalDevnetManifest()
m = &m2
Expand Down
12 changes: 0 additions & 12 deletions f3-sidecar/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"path/filepath"
"time"

"github.com/filecoin-project/go-f3/gpbft"
"github.com/ipfs/go-cid"
leveldb "github.com/ipfs/go-ds-leveldb"
logging "github.com/ipfs/go-log/v2"
Expand Down Expand Up @@ -39,17 +38,6 @@ func waitRawNetworkName(ctx context.Context, f3api *F3Api) string {
}
}

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" {
networkName = "filecoin"
}
return networkName
}

func setLogLevel(name string, level string) error {
if err := logging.SetLogLevel(name, level); err != nil {
return fmt.Errorf("%s %w", name, err)
Expand Down
Loading