Merge branch 'feat/nv21' into feat/implement-SyntheticPoRep
This commit is contained in:
@@ -128,6 +128,8 @@ const (
|
||||
SetupFallbackBlockstoresKey
|
||||
GoRPCServer
|
||||
|
||||
ConsensusReporterKey
|
||||
|
||||
SetApiEndpointKey
|
||||
|
||||
StoreEventsKey
|
||||
|
||||
@@ -280,6 +280,11 @@ func ConfigFullNode(c interface{}) Option {
|
||||
// enable message index for full node when configured by the user, otherwise use dummy.
|
||||
If(cfg.Index.EnableMsgIndex, Override(new(index.MsgIndex), modules.MsgIndex)),
|
||||
If(!cfg.Index.EnableMsgIndex, Override(new(index.MsgIndex), modules.DummyMsgIndex)),
|
||||
|
||||
// enable fault reporter when configured by the user
|
||||
If(cfg.FaultReporter.EnableConsensusFaultReporter,
|
||||
Override(ConsensusReporterKey, modules.RunConsensusFaultReporter(cfg.FaultReporter)),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@ func DefaultStorageMiner() *StorageMiner {
|
||||
AvailableBalanceBuffer: types.FIL(big.Zero()),
|
||||
DisableCollateralFallback: false,
|
||||
|
||||
BatchPreCommits: true,
|
||||
MaxPreCommitBatch: miner5.PreCommitSectorBatchMaxSize, // up to 256 sectors
|
||||
PreCommitBatchWait: Duration(24 * time.Hour), // this should be less than 31.5 hours, which is the expiration of a precommit ticket
|
||||
// XXX snap deals wait deals slack if first
|
||||
|
||||
+37
-7
@@ -394,6 +394,35 @@ the database must already exist and be writeable. If a relative path is provided
|
||||
relative to the CWD (current working directory).`,
|
||||
},
|
||||
},
|
||||
"FaultReporterConfig": []DocField{
|
||||
{
|
||||
Name: "EnableConsensusFaultReporter",
|
||||
Type: "bool",
|
||||
|
||||
Comment: `EnableConsensusFaultReporter controls whether the node will monitor and
|
||||
report consensus faults. When enabled, the node will watch for malicious
|
||||
behaviors like double-mining and parent grinding, and submit reports to the
|
||||
network. This can earn reporter rewards, but is not guaranteed. Nodes should
|
||||
enable fault reporting with care, as it may increase resource usage, and may
|
||||
generate gas fees without earning rewards.`,
|
||||
},
|
||||
{
|
||||
Name: "ConsensusFaultReporterDataDir",
|
||||
Type: "string",
|
||||
|
||||
Comment: `ConsensusFaultReporterDataDir is the path where fault reporter state will be
|
||||
persisted. This directory should have adequate space and permissions for the
|
||||
node process.`,
|
||||
},
|
||||
{
|
||||
Name: "ConsensusFaultReporterAddress",
|
||||
Type: "string",
|
||||
|
||||
Comment: `ConsensusFaultReporterAddress is the wallet address used for submitting
|
||||
ReportConsensusFault messages. It will pay for gas fees, and receive any
|
||||
rewards. This address should have adequate funds to cover gas fees.`,
|
||||
},
|
||||
},
|
||||
"FeeConfig": []DocField{
|
||||
{
|
||||
Name: "DefaultMaxFee",
|
||||
@@ -465,6 +494,12 @@ Set to 0 to keep all mappings`,
|
||||
Name: "Index",
|
||||
Type: "IndexConfig",
|
||||
|
||||
Comment: ``,
|
||||
},
|
||||
{
|
||||
Name: "FaultReporter",
|
||||
Type: "FaultReporterConfig",
|
||||
|
||||
Comment: ``,
|
||||
},
|
||||
},
|
||||
@@ -1169,12 +1204,6 @@ This is useful for forcing all deals to be assigned as snap deals to sectors mar
|
||||
|
||||
Comment: `Don't send collateral with messages even if there is no available balance in the miner actor`,
|
||||
},
|
||||
{
|
||||
Name: "BatchPreCommits",
|
||||
Type: "bool",
|
||||
|
||||
Comment: `enable / disable precommit batching (takes effect after nv13)`,
|
||||
},
|
||||
{
|
||||
Name: "MaxPreCommitBatch",
|
||||
Type: "int",
|
||||
@@ -1228,7 +1257,8 @@ This is useful for forcing all deals to be assigned as snap deals to sectors mar
|
||||
Type: "types.FIL",
|
||||
|
||||
Comment: `network BaseFee below which to stop doing precommit batching, instead
|
||||
sending precommit messages to the chain individually`,
|
||||
sending precommit messages to the chain individually. When the basefee is
|
||||
below this threshold, precommit messages will get sent out immediately.`,
|
||||
},
|
||||
{
|
||||
Name: "AggregateAboveBaseFee",
|
||||
|
||||
+30
-10
@@ -22,13 +22,14 @@ type Common struct {
|
||||
// FullNode is a full node config
|
||||
type FullNode struct {
|
||||
Common
|
||||
Client Client
|
||||
Wallet Wallet
|
||||
Fees FeeConfig
|
||||
Chainstore Chainstore
|
||||
Cluster UserRaftConfig
|
||||
Fevm FevmConfig
|
||||
Index IndexConfig
|
||||
Client Client
|
||||
Wallet Wallet
|
||||
Fees FeeConfig
|
||||
Chainstore Chainstore
|
||||
Cluster UserRaftConfig
|
||||
Fevm FevmConfig
|
||||
Index IndexConfig
|
||||
FaultReporter FaultReporterConfig
|
||||
}
|
||||
|
||||
// // Common
|
||||
@@ -386,8 +387,6 @@ type SealingConfig struct {
|
||||
// Don't send collateral with messages even if there is no available balance in the miner actor
|
||||
DisableCollateralFallback bool
|
||||
|
||||
// enable / disable precommit batching (takes effect after nv13)
|
||||
BatchPreCommits bool
|
||||
// maximum precommit batch size - batches will be sent immediately above this size
|
||||
MaxPreCommitBatch int
|
||||
// how long to wait before submitting a batch after crossing the minimum batch size
|
||||
@@ -407,7 +406,8 @@ type SealingConfig struct {
|
||||
CommitBatchSlack Duration
|
||||
|
||||
// network BaseFee below which to stop doing precommit batching, instead
|
||||
// sending precommit messages to the chain individually
|
||||
// sending precommit messages to the chain individually. When the basefee is
|
||||
// below this threshold, precommit messages will get sent out immediately.
|
||||
BatchPreCommitAboveBaseFee types.FIL
|
||||
|
||||
// network BaseFee below which to stop doing commit aggregation, instead
|
||||
@@ -737,3 +737,23 @@ type IndexConfig struct {
|
||||
// EnableMsgIndex enables indexing of messages on chain.
|
||||
EnableMsgIndex bool
|
||||
}
|
||||
|
||||
type FaultReporterConfig struct {
|
||||
// EnableConsensusFaultReporter controls whether the node will monitor and
|
||||
// report consensus faults. When enabled, the node will watch for malicious
|
||||
// behaviors like double-mining and parent grinding, and submit reports to the
|
||||
// network. This can earn reporter rewards, but is not guaranteed. Nodes should
|
||||
// enable fault reporting with care, as it may increase resource usage, and may
|
||||
// generate gas fees without earning rewards.
|
||||
EnableConsensusFaultReporter bool
|
||||
|
||||
// ConsensusFaultReporterDataDir is the path where fault reporter state will be
|
||||
// persisted. This directory should have adequate space and permissions for the
|
||||
// node process.
|
||||
ConsensusFaultReporterDataDir string
|
||||
|
||||
// ConsensusFaultReporterAddress is the wallet address used for submitting
|
||||
// ReportConsensusFault messages. It will pay for gas fees, and receive any
|
||||
// rewards. This address should have adequate funds to cover gas fees.
|
||||
ConsensusFaultReporterAddress string
|
||||
}
|
||||
|
||||
+32
-7
@@ -19,8 +19,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
@@ -794,7 +792,7 @@ func (a *StateAPI) StateGetAllocationForPendingDeal(ctx context.Context, dealId
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if allocationId == verifregtypes.NoAllocationID {
|
||||
if allocationId == verifreg.NoAllocationID {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -1040,7 +1038,7 @@ func (a *StateAPI) StateMinerAllocated(ctx context.Context, addr address.Address
|
||||
return mas.GetAllocatedSectors()
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||
@@ -1315,7 +1313,7 @@ func (m *StateModule) MsigGetPending(ctx context.Context, addr address.Address,
|
||||
var initialPledgeNum = types.NewInt(110)
|
||||
var initialPledgeDen = types.NewInt(100)
|
||||
|
||||
func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci minertypes.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
|
||||
func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
|
||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||
if err != nil {
|
||||
return types.EmptyInt, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||
@@ -1347,7 +1345,7 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
|
||||
sectorWeight = builtin.QAPowerForWeight(ssize, duration, w, vw)
|
||||
}
|
||||
} else {
|
||||
sectorWeight = minertypes.QAPowerMax(ssize)
|
||||
sectorWeight = miner.QAPowerMax(ssize)
|
||||
}
|
||||
|
||||
var powerSmoothed builtin.FilterEstimate
|
||||
@@ -1379,7 +1377,7 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
|
||||
return types.BigDiv(types.BigMul(deposit, initialPledgeNum), initialPledgeDen), nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci minertypes.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
|
||||
func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) {
|
||||
// TODO: this repeats a lot of the previous function. Fix that.
|
||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||
if err != nil {
|
||||
@@ -1752,7 +1750,34 @@ func (a *StateAPI) StateGetRandomnessFromTickets(ctx context.Context, personaliz
|
||||
|
||||
func (a *StateAPI) StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) {
|
||||
return a.StateManager.GetRandomnessFromBeacon(ctx, personalization, randEpoch, entropy, tsk)
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateGetRandomnessDigestFromTickets(ctx context.Context, randEpoch abi.ChainEpoch, tsk types.TipSetKey) (abi.Randomness, error) {
|
||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||
}
|
||||
|
||||
ret, err := a.StateManager.GetRandomnessDigestFromTickets(ctx, randEpoch, ts.Key())
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to get randomness digest from tickets: %w", err)
|
||||
}
|
||||
|
||||
return ret[:], nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateGetRandomnessDigestFromBeacon(ctx context.Context, randEpoch abi.ChainEpoch, tsk types.TipSetKey) (abi.Randomness, error) {
|
||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||
}
|
||||
|
||||
ret, err := a.StateManager.GetRandomnessDigestFromBeacon(ctx, randEpoch, ts.Key())
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to get randomness digest from tickets: %w", err)
|
||||
}
|
||||
|
||||
return ret[:], nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateGetBeaconEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) {
|
||||
|
||||
+10
-3
@@ -58,9 +58,16 @@ func (a *SyncAPI) SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) erro
|
||||
}
|
||||
|
||||
if a.SlashFilter != nil && os.Getenv("LOTUS_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" {
|
||||
if _, err = a.SlashFilter.MinedBlock(ctx, blk.Header, parent.Height); err != nil {
|
||||
log.Errorf("<!!> SLASH FILTER ERROR: %s", err)
|
||||
return xerrors.Errorf("<!!> SLASH FILTER ERROR: %w", err)
|
||||
witness, fault, err := a.SlashFilter.MinedBlock(ctx, blk.Header, parent.Height)
|
||||
if err != nil {
|
||||
log.Errorf("<!!> SLASH FILTER ERRORED: %s", err)
|
||||
// Return an error here, because it's _probably_ wiser to not submit this block
|
||||
return xerrors.Errorf("<!!> SLASH FILTER ERRORED: %w", err)
|
||||
}
|
||||
|
||||
if fault {
|
||||
log.Errorf("<!!> SLASH FILTER DETECTED FAULT due to witness %s", witness)
|
||||
return xerrors.Errorf("<!!> SLASH FILTER DETECTED FAULT due to witness %s", witness)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@@ -43,6 +42,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
mktsdagstore "github.com/filecoin-project/lotus/markets/dagstore"
|
||||
@@ -488,7 +488,7 @@ func (sm *StorageMinerAPI) SectorReceive(ctx context.Context, meta api.RemoteSec
|
||||
return err
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]minertypes.SubmitWindowedPoStParams, error) {
|
||||
func (sm *StorageMinerAPI) ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]lminer.SubmitWindowedPoStParams, error) {
|
||||
var ts *types.TipSet
|
||||
var err error
|
||||
if tsk == types.EmptyTSK {
|
||||
@@ -1395,7 +1395,7 @@ func (sm *StorageMinerAPI) withdrawBalance(ctx context.Context, amount abi.Token
|
||||
amount = available
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&minertypes.WithdrawBalanceParams{
|
||||
params, err := actors.SerializeParams(&lminer.WithdrawBalanceParams{
|
||||
AmountRequested: amount,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package modules
|
||||
|
||||
import (
|
||||
"go.uber.org/fx"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/gen/slashfilter/slashsvc"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/node/impl/full"
|
||||
"github.com/filecoin-project/lotus/node/modules/helpers"
|
||||
)
|
||||
|
||||
type consensusReporterModules struct {
|
||||
fx.In
|
||||
|
||||
full.WalletAPI
|
||||
full.ChainAPI
|
||||
full.MpoolAPI
|
||||
full.SyncAPI
|
||||
}
|
||||
|
||||
func RunConsensusFaultReporter(config config.FaultReporterConfig) func(mctx helpers.MetricsCtx, lc fx.Lifecycle, mod consensusReporterModules) error {
|
||||
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, mod consensusReporterModules) error {
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
|
||||
return slashsvc.SlashConsensus(ctx, &mod, config.ConsensusFaultReporterDataDir, config.ConsensusFaultReporterAddress)
|
||||
}
|
||||
}
|
||||
@@ -1001,7 +1001,6 @@ func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error
|
||||
AvailableBalanceBuffer: types.FIL(cfg.AvailableBalanceBuffer),
|
||||
DisableCollateralFallback: cfg.DisableCollateralFallback,
|
||||
|
||||
BatchPreCommits: cfg.BatchPreCommits,
|
||||
MaxPreCommitBatch: cfg.MaxPreCommitBatch,
|
||||
PreCommitBatchWait: config.Duration(cfg.PreCommitBatchWait),
|
||||
PreCommitBatchSlack: config.Duration(cfg.PreCommitBatchSlack),
|
||||
@@ -1047,7 +1046,6 @@ func ToSealingConfig(dealmakingCfg config.DealmakingConfig, sealingCfg config.Se
|
||||
AvailableBalanceBuffer: types.BigInt(sealingCfg.AvailableBalanceBuffer),
|
||||
DisableCollateralFallback: sealingCfg.DisableCollateralFallback,
|
||||
|
||||
BatchPreCommits: sealingCfg.BatchPreCommits,
|
||||
MaxPreCommitBatch: sealingCfg.MaxPreCommitBatch,
|
||||
PreCommitBatchWait: time.Duration(sealingCfg.PreCommitBatchWait),
|
||||
PreCommitBatchSlack: time.Duration(sealingCfg.PreCommitBatchSlack),
|
||||
|
||||
Reference in New Issue
Block a user