diff --git a/api/api_full.go b/api/api_full.go index bcdfdad1009..2a113dbaff6 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -592,6 +592,9 @@ type FullNode interface { // StateGetRandomnessFromBeacon is used to sample the beacon for randomness. StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) //perm:read + // StateGetNetworkParams return current network params + StateGetNetworkParams(ctx context.Context) (*NetworkParams, error) //perm:read + // MethodGroup: Msig // The Msig methods are used to interact with multisig wallets on the // filecoin network diff --git a/api/mocks/mock_full.go b/api/mocks/mock_full.go index 5db190ba62f..f8ab754ed7a 100644 --- a/api/mocks/mock_full.go +++ b/api/mocks/mock_full.go @@ -2406,6 +2406,21 @@ func (mr *MockFullNodeMockRecorder) StateGetActor(arg0, arg1, arg2 interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetActor", reflect.TypeOf((*MockFullNode)(nil).StateGetActor), arg0, arg1, arg2) } +// StateGetNetworkParams mocks base method. +func (m *MockFullNode) StateGetNetworkParams(arg0 context.Context) (*api.NetworkParams, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StateGetNetworkParams", arg0) + ret0, _ := ret[0].(*api.NetworkParams) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StateGetNetworkParams indicates an expected call of StateGetNetworkParams. +func (mr *MockFullNodeMockRecorder) StateGetNetworkParams(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetNetworkParams", reflect.TypeOf((*MockFullNode)(nil).StateGetNetworkParams), arg0) +} + // StateGetRandomnessFromBeacon mocks base method. func (m *MockFullNode) StateGetRandomnessFromBeacon(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 types.TipSetKey) (abi.Randomness, error) { m.ctrl.T.Helper() diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 300e6755528..7542ac36726 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -352,6 +352,8 @@ type FullNodeStruct struct { StateGetActor func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*types.Actor, error) `perm:"read"` + StateGetNetworkParams func(p0 context.Context) (*NetworkParams, error) `perm:"read"` + StateGetRandomnessFromBeacon func(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) `perm:"read"` StateGetRandomnessFromTickets func(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) `perm:"read"` @@ -2470,6 +2472,17 @@ func (s *FullNodeStub) StateGetActor(p0 context.Context, p1 address.Address, p2 return nil, ErrNotSupported } +func (s *FullNodeStruct) StateGetNetworkParams(p0 context.Context) (*NetworkParams, error) { + if s.Internal.StateGetNetworkParams == nil { + return nil, ErrNotSupported + } + return s.Internal.StateGetNetworkParams(p0) +} + +func (s *FullNodeStub) StateGetNetworkParams(p0 context.Context) (*NetworkParams, error) { + return nil, ErrNotSupported +} + func (s *FullNodeStruct) StateGetRandomnessFromBeacon(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) { if s.Internal.StateGetRandomnessFromBeacon == nil { return *new(abi.Randomness), ErrNotSupported diff --git a/api/types.go b/api/types.go index 9125744ba3d..d0b7c7cb930 100644 --- a/api/types.go +++ b/api/types.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/ipfs/go-cid" "github.com/ipfs/go-graphsync" @@ -284,3 +285,35 @@ type ExportRef struct { FromLocalCAR string // if specified, get data from a local CARv2 file. DealID retrievalmarket.DealID } + +type NetworkParams struct { + NetworkName dtypes.NetworkName + BlockDelaySecs uint64 + ConsensusMinerMinPower abi.StoragePower + SupportedProofTypes []abi.RegisteredSealProof + PreCommitChallengeDelay abi.ChainEpoch + ForkUpgradeParams ForkUpgradeParams +} + +type ForkUpgradeParams struct { + UpgradeSmokeHeight abi.ChainEpoch + UpgradeBreezeHeight abi.ChainEpoch + UpgradeIgnitionHeight abi.ChainEpoch + UpgradeLiftoffHeight abi.ChainEpoch + UpgradeAssemblyHeight abi.ChainEpoch + UpgradeRefuelHeight abi.ChainEpoch + UpgradeTapeHeight abi.ChainEpoch + UpgradeKumquatHeight abi.ChainEpoch + UpgradePriceListOopsHeight abi.ChainEpoch + BreezeGasTampingDuration abi.ChainEpoch + UpgradeCalicoHeight abi.ChainEpoch + UpgradePersianHeight abi.ChainEpoch + UpgradeOrangeHeight abi.ChainEpoch + UpgradeClausHeight abi.ChainEpoch + UpgradeTrustHeight abi.ChainEpoch + UpgradeNorwegianHeight abi.ChainEpoch + UpgradeTurboHeight abi.ChainEpoch + UpgradeHyperdriveHeight abi.ChainEpoch + UpgradeChocolateHeight abi.ChainEpoch + UpgradeOhSnapHeight abi.ChainEpoch +} diff --git a/api/v0api/full.go b/api/v0api/full.go index b37e89155c5..c1aa69a7764 100644 --- a/api/v0api/full.go +++ b/api/v0api/full.go @@ -604,6 +604,9 @@ type FullNode interface { // StateGetRandomnessFromBeacon is used to sample the beacon for randomness. StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) //perm:read + // StateGetNetworkParams return current network params + StateGetNetworkParams(ctx context.Context) (*api.NetworkParams, error) //perm:read + // MethodGroup: Msig // The Msig methods are used to interact with multisig wallets on the // filecoin network diff --git a/api/v0api/proxy_gen.go b/api/v0api/proxy_gen.go index 49ebad42892..6ac74904f4d 100644 --- a/api/v0api/proxy_gen.go +++ b/api/v0api/proxy_gen.go @@ -267,6 +267,8 @@ type FullNodeStruct struct { StateGetActor func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*types.Actor, error) `perm:"read"` + StateGetNetworkParams func(p0 context.Context) (*api.NetworkParams, error) `perm:"read"` + StateGetRandomnessFromBeacon func(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) `perm:"read"` StateGetRandomnessFromTickets func(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) `perm:"read"` @@ -1746,6 +1748,17 @@ func (s *FullNodeStub) StateGetActor(p0 context.Context, p1 address.Address, p2 return nil, ErrNotSupported } +func (s *FullNodeStruct) StateGetNetworkParams(p0 context.Context) (*api.NetworkParams, error) { + if s.Internal.StateGetNetworkParams == nil { + return nil, ErrNotSupported + } + return s.Internal.StateGetNetworkParams(p0) +} + +func (s *FullNodeStub) StateGetNetworkParams(p0 context.Context) (*api.NetworkParams, error) { + return nil, ErrNotSupported +} + func (s *FullNodeStruct) StateGetRandomnessFromBeacon(p0 context.Context, p1 crypto.DomainSeparationTag, p2 abi.ChainEpoch, p3 []byte, p4 types.TipSetKey) (abi.Randomness, error) { if s.Internal.StateGetRandomnessFromBeacon == nil { return *new(abi.Randomness), ErrNotSupported diff --git a/api/v0api/v0mocks/mock_full.go b/api/v0api/v0mocks/mock_full.go index 6cb80d8942b..7301b8aecdc 100644 --- a/api/v0api/v0mocks/mock_full.go +++ b/api/v0api/v0mocks/mock_full.go @@ -2275,6 +2275,21 @@ func (mr *MockFullNodeMockRecorder) StateGetActor(arg0, arg1, arg2 interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetActor", reflect.TypeOf((*MockFullNode)(nil).StateGetActor), arg0, arg1, arg2) } +// StateGetNetworkParams mocks base method. +func (m *MockFullNode) StateGetNetworkParams(arg0 context.Context) (*api.NetworkParams, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StateGetNetworkParams", arg0) + ret0, _ := ret[0].(*api.NetworkParams) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StateGetNetworkParams indicates an expected call of StateGetNetworkParams. +func (mr *MockFullNodeMockRecorder) StateGetNetworkParams(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateGetNetworkParams", reflect.TypeOf((*MockFullNode)(nil).StateGetNetworkParams), arg0) +} + // StateGetRandomnessFromBeacon mocks base method. func (m *MockFullNode) StateGetRandomnessFromBeacon(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 types.TipSetKey) (abi.Randomness, error) { m.ctrl.T.Helper() diff --git a/build/openrpc/full.json.gz b/build/openrpc/full.json.gz index c27a0fc28a1..92731a5f6c7 100644 Binary files a/build/openrpc/full.json.gz and b/build/openrpc/full.json.gz differ diff --git a/build/openrpc/miner.json.gz b/build/openrpc/miner.json.gz index 952c771ca2d..43b182dfa58 100644 Binary files a/build/openrpc/miner.json.gz and b/build/openrpc/miner.json.gz differ diff --git a/build/openrpc/worker.json.gz b/build/openrpc/worker.json.gz index f1372a6602a..cbbeec7d1e4 100644 Binary files a/build/openrpc/worker.json.gz and b/build/openrpc/worker.json.gz differ diff --git a/build/params_2k.go b/build/params_2k.go index aa1beed36a0..60006cede6d 100644 --- a/build/params_2k.go +++ b/build/params_2k.go @@ -53,11 +53,19 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, } +var SupportedProofTypes = []abi.RegisteredSealProof{ + abi.RegisteredSealProof_StackedDrg2KiBV1, + abi.RegisteredSealProof_StackedDrg8MiBV1, +} +var ConsensusMinerMinPower = abi.NewStoragePower(2048) +var MinVerifiedDealSize = abi.NewStoragePower(256) +var PreCommitChallengeDelay = abi.ChainEpoch(10) + func init() { - policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1, abi.RegisteredSealProof_StackedDrg8MiBV1) - policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) - policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) - policy.SetPreCommitChallengeDelay(abi.ChainEpoch(10)) + policy.SetSupportedProofTypes(SupportedProofTypes...) + policy.SetConsensusMinerMinPower(ConsensusMinerMinPower) + policy.SetMinVerifiedDealSize(MinVerifiedDealSize) + policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay) getUpgradeHeight := func(ev string, def abi.ChainEpoch) abi.ChainEpoch { hs, found := os.LookupEnv(ev) diff --git a/build/params_butterfly.go b/build/params_butterfly.go index 804bdde93ac..d74e17305e1 100644 --- a/build/params_butterfly.go +++ b/build/params_butterfly.go @@ -44,13 +44,20 @@ const UpgradeChocolateHeight = -17 const UpgradeOhSnapHeight = 240 +var SupportedProofTypes = []abi.RegisteredSealProof{ + abi.RegisteredSealProof_StackedDrg512MiBV1, + abi.RegisteredSealProof_StackedDrg32GiBV1, + abi.RegisteredSealProof_StackedDrg64GiBV1, +} +var ConsensusMinerMinPower = abi.NewStoragePower(2 << 30) +var MinVerifiedDealSize = abi.NewStoragePower(1 << 20) +var PreCommitChallengeDelay = abi.ChainEpoch(150) + func init() { - policy.SetConsensusMinerMinPower(abi.NewStoragePower(2 << 30)) - policy.SetSupportedProofTypes( - abi.RegisteredSealProof_StackedDrg512MiBV1, - abi.RegisteredSealProof_StackedDrg32GiBV1, - abi.RegisteredSealProof_StackedDrg64GiBV1, - ) + policy.SetSupportedProofTypes(SupportedProofTypes...) + policy.SetConsensusMinerMinPower(ConsensusMinerMinPower) + policy.SetMinVerifiedDealSize(MinVerifiedDealSize) + policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay) SetAddressNetwork(address.Testnet) diff --git a/build/params_calibnet.go b/build/params_calibnet.go index a8f5b472049..5ff8bd85392 100644 --- a/build/params_calibnet.go +++ b/build/params_calibnet.go @@ -57,12 +57,19 @@ const UpgradeChocolateHeight = 312746 // 2022-02-10T19:23:00Z const UpgradeOhSnapHeight = 682006 +var SupportedProofTypes = []abi.RegisteredSealProof{ + abi.RegisteredSealProof_StackedDrg32GiBV1, + abi.RegisteredSealProof_StackedDrg64GiBV1, +} +var ConsensusMinerMinPower = abi.NewStoragePower(32 << 30) +var MinVerifiedDealSize = abi.NewStoragePower(1 << 20) +var PreCommitChallengeDelay = abi.ChainEpoch(150) + func init() { - policy.SetConsensusMinerMinPower(abi.NewStoragePower(32 << 30)) - policy.SetSupportedProofTypes( - abi.RegisteredSealProof_StackedDrg32GiBV1, - abi.RegisteredSealProof_StackedDrg64GiBV1, - ) + policy.SetSupportedProofTypes(SupportedProofTypes...) + policy.SetConsensusMinerMinPower(ConsensusMinerMinPower) + policy.SetMinVerifiedDealSize(MinVerifiedDealSize) + policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay) SetAddressNetwork(address.Testnet) diff --git a/build/params_interop.go b/build/params_interop.go index a483e7188d5..ad051570c9d 100644 --- a/build/params_interop.go +++ b/build/params_interop.go @@ -53,15 +53,20 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, } +var SupportedProofTypes = []abi.RegisteredSealProof{ + abi.RegisteredSealProof_StackedDrg2KiBV1, + abi.RegisteredSealProof_StackedDrg8MiBV1, + abi.RegisteredSealProof_StackedDrg512MiBV1, +} +var ConsensusMinerMinPower = abi.NewStoragePower(2048) +var MinVerifiedDealSize = abi.NewStoragePower(256) +var PreCommitChallengeDelay = abi.ChainEpoch(10) + func init() { - policy.SetSupportedProofTypes( - abi.RegisteredSealProof_StackedDrg2KiBV1, - abi.RegisteredSealProof_StackedDrg8MiBV1, - abi.RegisteredSealProof_StackedDrg512MiBV1, - ) - policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) - policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) - policy.SetPreCommitChallengeDelay(abi.ChainEpoch(10)) + policy.SetSupportedProofTypes(SupportedProofTypes...) + policy.SetConsensusMinerMinPower(ConsensusMinerMinPower) + policy.SetMinVerifiedDealSize(MinVerifiedDealSize) + policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay) getUpgradeHeight := func(ev string, def abi.ChainEpoch) abi.ChainEpoch { hs, found := os.LookupEnv(ev) diff --git a/build/params_mainnet.go b/build/params_mainnet.go index 0a9f6e77552..72e25f2fb49 100644 --- a/build/params_mainnet.go +++ b/build/params_mainnet.go @@ -70,6 +70,14 @@ const UpgradeChocolateHeight = 1231620 // 2022-03-01T15:00:00Z var UpgradeOhSnapHeight = abi.ChainEpoch(1594680) +var SupportedProofTypes = []abi.RegisteredSealProof{ + abi.RegisteredSealProof_StackedDrg32GiBV1, + abi.RegisteredSealProof_StackedDrg64GiBV1, +} +var ConsensusMinerMinPower = abi.NewStoragePower(10 << 40) +var MinVerifiedDealSize = abi.NewStoragePower(1 << 20) +var PreCommitChallengeDelay = abi.ChainEpoch(150) + func init() { if os.Getenv("LOTUS_USE_TEST_ADDRESSES") != "1" { SetAddressNetwork(address.Mainnet) diff --git a/build/params_nerpanet.go b/build/params_nerpanet.go index 0e2913adcab..4621a727192 100644 --- a/build/params_nerpanet.go +++ b/build/params_nerpanet.go @@ -50,23 +50,29 @@ const UpgradeHyperdriveHeight = 379178 const UpgradeChocolateHeight = 999999999 +var SupportedProofTypes = []abi.RegisteredSealProof{ + abi.RegisteredSealProof_StackedDrg512MiBV1, + abi.RegisteredSealProof_StackedDrg32GiBV1, + abi.RegisteredSealProof_StackedDrg64GiBV1, +} + +// Minimum block production power is set to 4 TiB +// Rationale is to discourage small-scale miners from trying to take over the network +// One needs to invest in ~2.3x the compute to break consensus, making it not worth it +// +// DOWNSIDE: the fake-seals need to be kept alive/protected, otherwise network will seize +// +var ConsensusMinerMinPower = abi.NewStoragePower(4 << 40) +var MinVerifiedDealSize = abi.NewStoragePower(1 << 20) + +// Lower the most time-consuming parts of PoRep +var PreCommitChallengeDelay = abi.ChainEpoch(10) + func init() { - // Minimum block production power is set to 4 TiB - // Rationale is to discourage small-scale miners from trying to take over the network - // One needs to invest in ~2.3x the compute to break consensus, making it not worth it - // - // DOWNSIDE: the fake-seals need to be kept alive/protected, otherwise network will seize - // - policy.SetConsensusMinerMinPower(abi.NewStoragePower(4 << 40)) - - policy.SetSupportedProofTypes( - abi.RegisteredSealProof_StackedDrg512MiBV1, - abi.RegisteredSealProof_StackedDrg32GiBV1, - abi.RegisteredSealProof_StackedDrg64GiBV1, - ) - - // Lower the most time-consuming parts of PoRep - policy.SetPreCommitChallengeDelay(10) + policy.SetSupportedProofTypes(SupportedProofTypes...) + policy.SetConsensusMinerMinPower(ConsensusMinerMinPower) + policy.SetMinVerifiedDealSize(MinVerifiedDealSize) + policy.SetPreCommitChallengeDelay(PreCommitChallengeDelay) // TODO - make this a variable //miner.WPoStChallengeLookback = abi.ChainEpoch(2) diff --git a/build/params_testground.go b/build/params_testground.go index 41c46d41edf..46e90f49472 100644 --- a/build/params_testground.go +++ b/build/params_testground.go @@ -33,6 +33,12 @@ var ( MinimumBaseFee = int64(100) BlockDelaySecs = uint64(builtin2.EpochDurationSeconds) PropagationDelaySecs = uint64(6) + SupportedProofTypes = []abi.RegisteredSealProof{ + abi.RegisteredSealProof_StackedDrg32GiBV1, + abi.RegisteredSealProof_StackedDrg64GiBV1, + } + ConsensusMinerMinPower = abi.NewStoragePower(10 << 40) + PreCommitChallengeDelay = abi.ChainEpoch(150) AllowableClockDriftSecs = uint64(1) diff --git a/documentation/en/api-v0-methods.md b/documentation/en/api-v0-methods.md index 6973a665100..6f3e5c8eee9 100644 --- a/documentation/en/api-v0-methods.md +++ b/documentation/en/api-v0-methods.md @@ -165,6 +165,7 @@ * [StateDealProviderCollateralBounds](#StateDealProviderCollateralBounds) * [StateDecodeParams](#StateDecodeParams) * [StateGetActor](#StateGetActor) + * [StateGetNetworkParams](#StateGetNetworkParams) * [StateGetRandomnessFromBeacon](#StateGetRandomnessFromBeacon) * [StateGetRandomnessFromTickets](#StateGetRandomnessFromTickets) * [StateGetReceipt](#StateGetReceipt) @@ -5185,6 +5186,49 @@ Response: } ``` +### StateGetNetworkParams +StateGetNetworkParams return current network params + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "NetworkName": "lotus", + "BlockDelaySecs": 42, + "ConsensusMinerMinPower": "0", + "SupportedProofTypes": [ + 8 + ], + "PreCommitChallengeDelay": 10101, + "ForkUpgradeParams": { + "UpgradeSmokeHeight": 10101, + "UpgradeBreezeHeight": 10101, + "UpgradeIgnitionHeight": 10101, + "UpgradeLiftoffHeight": 10101, + "UpgradeAssemblyHeight": 10101, + "UpgradeRefuelHeight": 10101, + "UpgradeTapeHeight": 10101, + "UpgradeKumquatHeight": 10101, + "UpgradePriceListOopsHeight": 10101, + "BreezeGasTampingDuration": 10101, + "UpgradeCalicoHeight": 10101, + "UpgradePersianHeight": 10101, + "UpgradeOrangeHeight": 10101, + "UpgradeClausHeight": 10101, + "UpgradeTrustHeight": 10101, + "UpgradeNorwegianHeight": 10101, + "UpgradeTurboHeight": 10101, + "UpgradeHyperdriveHeight": 10101, + "UpgradeChocolateHeight": 10101, + "UpgradeOhSnapHeight": 10101 + } +} +``` + ### StateGetRandomnessFromBeacon StateGetRandomnessFromBeacon is used to sample the beacon for randomness. diff --git a/documentation/en/api-v1-unstable-methods.md b/documentation/en/api-v1-unstable-methods.md index 5d4dab5339c..b08c8734811 100644 --- a/documentation/en/api-v1-unstable-methods.md +++ b/documentation/en/api-v1-unstable-methods.md @@ -175,6 +175,7 @@ * [StateDecodeParams](#StateDecodeParams) * [StateEncodeParams](#StateEncodeParams) * [StateGetActor](#StateGetActor) + * [StateGetNetworkParams](#StateGetNetworkParams) * [StateGetRandomnessFromBeacon](#StateGetRandomnessFromBeacon) * [StateGetRandomnessFromTickets](#StateGetRandomnessFromTickets) * [StateListActors](#StateListActors) @@ -5642,6 +5643,49 @@ Response: } ``` +### StateGetNetworkParams +StateGetNetworkParams return current network params + + +Perms: read + +Inputs: `null` + +Response: +```json +{ + "NetworkName": "lotus", + "BlockDelaySecs": 42, + "ConsensusMinerMinPower": "0", + "SupportedProofTypes": [ + 8 + ], + "PreCommitChallengeDelay": 10101, + "ForkUpgradeParams": { + "UpgradeSmokeHeight": 10101, + "UpgradeBreezeHeight": 10101, + "UpgradeIgnitionHeight": 10101, + "UpgradeLiftoffHeight": 10101, + "UpgradeAssemblyHeight": 10101, + "UpgradeRefuelHeight": 10101, + "UpgradeTapeHeight": 10101, + "UpgradeKumquatHeight": 10101, + "UpgradePriceListOopsHeight": 10101, + "BreezeGasTampingDuration": 10101, + "UpgradeCalicoHeight": 10101, + "UpgradePersianHeight": 10101, + "UpgradeOrangeHeight": 10101, + "UpgradeClausHeight": 10101, + "UpgradeTrustHeight": 10101, + "UpgradeNorwegianHeight": 10101, + "UpgradeTurboHeight": 10101, + "UpgradeHyperdriveHeight": 10101, + "UpgradeChocolateHeight": 10101, + "UpgradeOhSnapHeight": 10101 + } +} +``` + ### StateGetRandomnessFromBeacon StateGetRandomnessFromBeacon is used to sample the beacon for randomness. diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 51cb0dfbc3b..648b3e76e11 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -19,6 +19,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" + "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/api" @@ -1438,3 +1439,39 @@ func (a *StateAPI) StateGetRandomnessFromBeacon(ctx context.Context, personaliza return a.StateManager.GetRandomnessFromBeacon(ctx, personalization, randEpoch, entropy, tsk) } + +func (a *StateAPI) StateGetNetworkParams(ctx context.Context) (*api.NetworkParams, error) { + networkName, err := a.StateNetworkName(ctx) + if err != nil { + return nil, err + } + + return &api.NetworkParams{ + NetworkName: networkName, + BlockDelaySecs: build.BlockDelaySecs, + ConsensusMinerMinPower: build.ConsensusMinerMinPower, + SupportedProofTypes: build.SupportedProofTypes, + PreCommitChallengeDelay: build.PreCommitChallengeDelay, + ForkUpgradeParams: api.ForkUpgradeParams{ + UpgradeSmokeHeight: build.UpgradeSmokeHeight, + UpgradeBreezeHeight: build.UpgradeBreezeHeight, + UpgradeIgnitionHeight: build.UpgradeIgnitionHeight, + UpgradeLiftoffHeight: build.UpgradeLiftoffHeight, + UpgradeAssemblyHeight: build.UpgradeAssemblyHeight, + UpgradeRefuelHeight: build.UpgradeRefuelHeight, + UpgradeTapeHeight: build.UpgradeTapeHeight, + UpgradeKumquatHeight: build.UpgradeKumquatHeight, + BreezeGasTampingDuration: build.BreezeGasTampingDuration, + UpgradeCalicoHeight: build.UpgradeCalicoHeight, + UpgradePersianHeight: build.UpgradePersianHeight, + UpgradeOrangeHeight: build.UpgradeOrangeHeight, + UpgradeClausHeight: build.UpgradeClausHeight, + UpgradeTrustHeight: build.UpgradeTrustHeight, + UpgradeNorwegianHeight: build.UpgradeNorwegianHeight, + UpgradeTurboHeight: build.UpgradeTurboHeight, + UpgradeHyperdriveHeight: build.UpgradeHyperdriveHeight, + UpgradeChocolateHeight: build.UpgradeChocolateHeight, + UpgradeOhSnapHeight: build.UpgradeOhSnapHeight, + }, + }, nil +}