Skip to content

Commit

Permalink
Merge pull request #6400 from filecoin-project/feat/initial-power-tab…
Browse files Browse the repository at this point in the history
…le-build-param

feat(f3): add a build parameter specifying F3's initial power table cid
  • Loading branch information
simlecode authored Oct 11, 2024
2 parents f0305bd + 9463a09 commit 04aeefa
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/submodule/network/network_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func NewNetworkSubmodule(ctx context.Context,
return nil, err
}

router, err := makeDHT(ctx, rawHost, config, networkName, bootNodes, cfg.PubsubConfig.Bootstrapper)
router, err := makeDHT(ctx, rawHost, config, networkName, cfg.PubsubConfig.Bootstrapper)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -401,7 +401,7 @@ func buildHost(_ context.Context, config networkConfig, libP2pOpts []libp2p.Opti
return libp2p.New(opts...)
}

func makeDHT(ctx context.Context, h types.RawHost, config networkConfig, networkName string, bootNodes []peer.AddrInfo, bootstrapper bool) (routing.Routing, error) {
func makeDHT(ctx context.Context, h types.RawHost, config networkConfig, networkName string, bootstrapper bool) (routing.Routing, error) {
mode := dht.ModeAuto
if bootstrapper {
mode = dht.ModeServer
Expand Down
2 changes: 2 additions & 0 deletions fixtures/networks/butterfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
"github.com/ipfs/go-cid"
)

func ButterflySnapNet() *NetworkConf {
Expand Down Expand Up @@ -73,6 +74,7 @@ func ButterflySnapNet() *NetworkConf {
F3BootstrapEpoch: 1000,
ManifestServerID: "12D3KooWJr9jy4ngtJNR7JC1xgLFra3DjEtyxskRYWvBK9TC3Yn6",
F3Consensus: true,
F3InitialPowerTableCID: cid.Undef,
},
}

Expand Down
2 changes: 2 additions & 0 deletions fixtures/networks/calibration.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
"github.com/ipfs/go-cid"
)

type NetworkConf struct {
Expand Down Expand Up @@ -76,6 +77,7 @@ func Calibration() *NetworkConf {
Eip155ChainID: 314159,
ActorDebugging: false,
F3Consensus: true,
F3InitialPowerTableCID: cid.Undef,
},
}

Expand Down
2 changes: 2 additions & 0 deletions fixtures/networks/forcenet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
"github.com/ipfs/go-cid"
)

func ForceNet() *NetworkConf {
Expand Down Expand Up @@ -75,6 +76,7 @@ func ForceNet() *NetworkConf {
F3BootstrapEpoch: 100,
ManifestServerID: "12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG",
F3Consensus: true,
F3InitialPowerTableCID: cid.Undef,
},
}

Expand Down
2 changes: 2 additions & 0 deletions fixtures/networks/integrationtestnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
"github.com/ipfs/go-cid"
)

func IntegrationNet() *NetworkConf {
Expand Down Expand Up @@ -67,6 +68,7 @@ func IntegrationNet() *NetworkConf {
F3BootstrapEpoch: -1,
ManifestServerID: "12D3KooWENMwUF9YxvQxar7uBWJtZkA6amvK4xWmKXfSiHUo2Qq7",
F3Consensus: true,
F3InitialPowerTableCID: cid.Undef,
},
}

Expand Down
2 changes: 2 additions & 0 deletions fixtures/networks/interopnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
"github.com/ipfs/go-cid"
)

func InteropNet() *NetworkConf {
Expand Down Expand Up @@ -73,6 +74,7 @@ func InteropNet() *NetworkConf {
F3BootstrapEpoch: 1000,
ManifestServerID: "12D3KooWQJ2rdVnG4okDUB6yHQhAjNutGNemcM7XzqC9Eo4z9Jce",
F3Consensus: true,
F3InitialPowerTableCID: cid.Undef,
},
}

Expand Down
2 changes: 2 additions & 0 deletions fixtures/networks/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
"github.com/ipfs/go-cid"
)

func Mainnet() *NetworkConf {
Expand Down Expand Up @@ -78,6 +79,7 @@ func Mainnet() *NetworkConf {
F3BootstrapEpoch: -1,
ManifestServerID: "12D3KooWENMwUF9YxvQxar7uBWJtZkA6amvK4xWmKXfSiHUo2Qq7",
F3Consensus: false,
F3InitialPowerTableCID: cid.Undef,
},
}

Expand Down
2 changes: 2 additions & 0 deletions fixtures/networks/net_2k.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
"github.com/ipfs/go-cid"
)

func Net2k() *NetworkConf {
Expand Down Expand Up @@ -69,6 +70,7 @@ func Net2k() *NetworkConf {
F3BootstrapEpoch: 1000,
ManifestServerID: "12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG",
F3Consensus: true,
F3InitialPowerTableCID: cid.Undef,
},
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/filecoin-project/go-state-types/network"
"github.com/ipfs/go-cid"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
Expand Down Expand Up @@ -313,6 +314,8 @@ type NetworkParamsConfig struct {
// F3Consensus set whether F3 should checkpoint tipsets finalized by F3. This
// flag has no effect if F3 is not enabled.
F3Consensus bool `json:"f3Consensus"`
// The initial F3 power table CID.
F3InitialPowerTableCID cid.Cid `json:"f3InitialPowerTableCID"`
}

// ForkUpgradeConfig record upgrade parameters
Expand Down
2 changes: 1 addition & 1 deletion pkg/vf3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewConfig(nn string, netCfg *config.NetworkParamsConfig) (*Config, error) {
policy.ChainFinality,
netCfg.F3BootstrapEpoch,
time.Duration(netCfg.BlockDelay)*time.Second,
cid.Undef,
netCfg.F3InitialPowerTableCID,
)
}
return c, nil
Expand Down

0 comments on commit 04aeefa

Please sign in to comment.