Skip to content

Commit

Permalink
chore: update force
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Oct 21, 2024
1 parent 31be8b7 commit 64ff217
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 107 deletions.
4 changes: 4 additions & 0 deletions build/buildconstants/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const (
BuildInteropnet
unusedFormerNerpanet // removed in https://github.com/filecoin-project/lotus/pull/7373/files#diff-4592eccb93b506c1e7e175be9b631c7ccdeed4c1c5c4173a1ecd6d974e105190L15
BuildButterflynet

BuildForce = 100
)

var BuildType int
Expand All @@ -31,6 +33,8 @@ func BuildTypeString() string {
return "+interopnet"
case BuildButterflynet:
return "+butterflynet"
case BuildForce:
return "+force"
default:
return "+huh?"
}
Expand Down
84 changes: 59 additions & 25 deletions build/params_force.go → build/buildconstants/params_force.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
//go:build force
// +build force

package build
package buildconstants

import (
"os"
"strconv"
"strings"

"github.com/ipfs/go-cid"

"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"

"github.com/filecoin-project/lotus/chain/actors/policy"
)

const BootstrappersFile = ""
const GenesisFile = ""

var NetworkBundle = "testing"
var BundleOverrides map[actorstypes.Version]string
var ActorDebugging = true

const GenesisNetworkVersion = network.Version22
var GenesisNetworkVersion = network.Version23

var UpgradeBreezeHeight = abi.ChainEpoch(-1)

Expand Down Expand Up @@ -67,17 +64,24 @@ var UpgradeThunderHeight = abi.ChainEpoch(-23)

var UpgradeWatermelonHeight = abi.ChainEpoch(-24)

var UpgradeDragonHeight = abi.ChainEpoch(-25)
var UpgradeDragonHeight = abi.ChainEpoch(-24)

var UpgradePhoenixHeight = abi.ChainEpoch(-25)

var UpgradePhoenixHeight = abi.ChainEpoch(-26)
var UpgradeWaffleHeight = abi.ChainEpoch(-26)

var UpgradeWaffleHeight = abi.ChainEpoch(200)
var UpgradeTuktukHeight = abi.ChainEpoch(200)

// FIP-0081: for the power actor state for pledge calculations.
// UpgradeTuktukPowerRampDurationEpochs ends up in the power actor state after
// Tuktuk migration. along with a RampStartEpoch matching the upgrade height.
var UpgradeTuktukPowerRampDurationEpochs uint64 = 200

// This fix upgrade only ran on calibrationnet
var UpgradeWatermelonFixHeight = abi.ChainEpoch(-100)
const UpgradeWatermelonFixHeight = -100

// This fix upgrade only ran on calibrationnet
var UpgradeWatermelonFix2Height = abi.ChainEpoch(-101)
const UpgradeWatermelonFix2Height = -101

// This fix upgrade only ran on calibrationnet
const UpgradeCalibrationDragonFixHeight = -102
Expand All @@ -87,19 +91,39 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
}

var SupportedProofTypes = []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg2KiBV1,
abi.RegisteredSealProof_StackedDrg8MiBV1,
abi.RegisteredSealProof_StackedDrg512MiBV1,
abi.RegisteredSealProof_StackedDrg32GiBV1,
}
var ConsensusMinerMinPower = abi.NewStoragePower(2048)
var MinVerifiedDealSize = abi.NewStoragePower(256)
var PreCommitChallengeDelay = abi.ChainEpoch(10)

func init() {
policy.SetSupportedProofTypes(SupportedProofTypes...)
policy.SetConsensusMinerMinPower(ConsensusMinerMinPower)
policy.SetMinVerifiedDealSize(MinVerifiedDealSize)
policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay)
getGenesisNetworkVersion := func(ev string, def network.Version) network.Version {
hs, found := os.LookupEnv(ev)
if found {
h, err := strconv.Atoi(hs)
if err != nil {
log.Panicf("failed to parse %s env var", ev)
}

return network.Version(h)
}

return def
}

GenesisNetworkVersion = getGenesisNetworkVersion("LOTUS_GENESIS_NETWORK_VERSION", GenesisNetworkVersion)

getBoolean := func(ev string, def bool) bool {
hs, found := os.LookupEnv(ev)
if found {
return hs == "1" || strings.ToLower(hs) == "true"
}

return def
}

getUpgradeHeight := func(ev string, def abi.ChainEpoch) abi.ChainEpoch {
hs, found := os.LookupEnv(ev)
Expand Down Expand Up @@ -138,23 +162,24 @@ func init() {
UpgradeHyggeHeight = getUpgradeHeight("LOTUS_HYGGE_HEIGHT", UpgradeHyggeHeight)
UpgradeLightningHeight = getUpgradeHeight("LOTUS_LIGHTNING_HEIGHT", UpgradeLightningHeight)
UpgradeThunderHeight = getUpgradeHeight("LOTUS_THUNDER_HEIGHT", UpgradeThunderHeight)
UpgradeWatermelonHeight = getUpgradeHeight("LOTUS_WATERMELON_HEIGHT", UpgradeWatermelonHeight)
UpgradeDragonHeight = getUpgradeHeight("LOTUS_DRAGON_HEIGHT", UpgradeDragonHeight)
UpgradeWaffleHeight = getUpgradeHeight("LOTUS_WAFFLE_HEIGHT", UpgradeWaffleHeight)

UpgradePhoenixHeight = getUpgradeHeight("LOTUS_PHOENIX_HEIGHT", UpgradePhoenixHeight)
UpgradeTuktukHeight = getUpgradeHeight("LOTUS_TUKTUK_HEIGHT", UpgradeTuktukHeight)

DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandQuicknet,
}

F3Enabled = getBoolean("LOTUS_F3_ENABLED", F3Enabled)
F3BootstrapEpoch = getUpgradeHeight("LOTUS_F3_BOOTSTRAP_EPOCH", F3BootstrapEpoch)

BuildType |= BuildForce

newBlockDelaySecs := uint64(getUpgradeHeight("LOTUS_BLOCK_DELAY_SECS", 30))
if newBlockDelaySecs < BlockDelaySecs {
BlockDelaySecs = newBlockDelaySecs
}
}

var BlockDelaySecs = uint64(30)
const BlockDelaySecs = uint64(30)

const PropagationDelaySecs = uint64(1)

Expand All @@ -177,6 +202,15 @@ const Eip155ChainId = 31415926

var WhitelistedBlock = cid.Undef

const f3Enabled = true
const ManifestServerID = "12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG"
const F3BootstrapEpoch abi.ChainEpoch = 1000
var F3Enabled = true

var F3ManifestServerID = MustParseID("12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG")

// The initial F3 power table CID.
var F3InitialPowerTableCID cid.Cid = cid.Undef

var F3BootstrapEpoch abi.ChainEpoch = 1000

// F3Consensus set whether F3 should checkpoint tipsets finalized by F3. This
// flag has no effect if F3 is not enabled.
const F3Consensus = true
1 change: 1 addition & 0 deletions cmd/lotus-seed/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/filecoin-project/go-state-types/network"

"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/build/buildconstants"
"github.com/filecoin-project/lotus/chain/gen"
genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis"
Expand Down
5 changes: 3 additions & 2 deletions gateway/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ func Handler(gwapi lapi.Gateway, api lapi.FullNode, options ...HandlerOption) (S
}

m := mux.NewRouter()

rpcopts := append(opts.jsonrpcServerOptions, jsonrpc.WithReverseClient[lapi.EthSubscriberMethods]("Filecoin"), jsonrpc.WithServerErrors(lapi.RPCErrors))
// todo: add api.RPCErrors
// rpcopts := append(opts.jsonrpcServerOptions, jsonrpc.WithReverseClient[lapi.EthSubscriberMethods]("Filecoin"), jsonrpc.WithServerErrors(lapi.RPCErrors))
rpcopts := append(opts.jsonrpcServerOptions, jsonrpc.WithReverseClient[lapi.EthSubscriberMethods]("Filecoin"))
serveRpc := func(path string, hnd interface{}) {
rpcServer := jsonrpc.NewServer(rpcopts...)
rpcServer.Register("Filecoin", hnd)
Expand Down
6 changes: 3 additions & 3 deletions gateway/proxy_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,9 @@ func (gw *Node) addUserFilterLimited(
}

func getStatefulTracker(ctx context.Context) (*statefulCallTracker, error) {
if jsonrpc.GetConnectionType(ctx) != jsonrpc.ConnectionTypeWS {
return nil, xerrors.New("stateful methods are only available on websocket connections")
}
// if jsonrpc.GetConnectionType(ctx) != jsonrpc.ConnectionTypeWS {
// return nil, xerrors.New("stateful methods are only available on websocket connections")
// }

if ct, ok := ctx.Value(statefulCallTrackerKey).(*statefulCallTracker); !ok {
return nil, xerrors.New("stateful tracking is not available for this call")
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ require (
github.com/icza/backscanner v0.0.0-20210726202459-ac2ffc679f94
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
github.com/invopop/jsonschema v0.12.0
github.com/ipfs-force-community/sophon-auth v1.16.0-rc1
github.com/ipfs-force-community/sophon-auth v1.16.0
github.com/ipfs/bbloom v0.0.4
github.com/ipfs/boxo v0.20.0
github.com/ipfs/go-block-format v0.2.0
Expand Down Expand Up @@ -252,7 +252,7 @@ require (
github.com/iancoleman/orderedmap v0.1.0 // indirect
github.com/influxdata/influxdb-client-go/v2 v2.2.2 // indirect
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect
github.com/ipfs-force-community/metrics v1.0.1-0.20231205060849-0b0d16ed0e8d // indirect
github.com/ipfs-force-community/metrics v1.0.1-0.20240725062356-39b286636574 // indirect
github.com/ipfs/go-blockservice v0.5.2 // indirect
github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect
github.com/ipfs/go-ipfs-delay v0.0.1 // indirect
Expand Down
Loading

0 comments on commit 64ff217

Please sign in to comment.