Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The penalty mechanism of time and space proof #1288

Open
llifezou opened this issue Dec 20, 2021 · 0 comments
Open

The penalty mechanism of time and space proof #1288

llifezou opened this issue Dec 20, 2021 · 0 comments

Comments

@llifezou
Copy link

specs-actors v6

SubmitWindowedPoSt will update FaultyPower immediately

func (a Actor) SubmitWindowedPoSt(rt Runtime, params *SubmitWindowedPoStParams) *abi.EmptyValue {
	// ...

	postResult, err = deadline.RecordProvenSectors(store, sectors, info.SectorSize, QuantSpecForDeadline(currDeadline), faultExpiration, params.Partitions)
	builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to process post submission for deadline %d", params.Deadline)

	// ...

	return nil
}



func (dl *Deadline) RecordProvenSectors(
	store adt.Store, sectors Sectors,
	ssize abi.SectorSize, quant builtin.QuantSpec, faultExpiration abi.ChainEpoch,
	postPartitions []PoStPartition,
) (*PoStResult, error) {
	// ...

	// Save everything back.
	dl.FaultyPower = dl.FaultyPower.Sub(recoveredPowerTotal).Add(newFaultyPowerTotal)

	// ...

	return &PoStResult{
		Sectors:                allSectorNos,
		IgnoredSectors:         allIgnoredSectorNos,
		PowerDelta:             powerDelta,
		NewFaultyPower:         newFaultyPowerTotal,
		RecoveredPower:         recoveredPowerTotal,
		RetractedRecoveryPower: retractedRecoveryPowerTotal,
		Partitions:             partitionIndexes,
	}, nil
}

When calculating the penalty, the current FaultyPower is used

func (st *State) AdvanceDeadline(store adt.Store, currEpoch abi.ChainEpoch) (*AdvanceDeadlineResult, error) {
	// ...

	previouslyFaultyPower := deadline.FaultyPower

	// ...

	// Compute penalties all together.
	// Be very careful when changing these as any changes can affect rounding.
	return &AdvanceDeadlineResult{
		PledgeDelta:           pledgeDelta,
		PowerDelta:            powerDelta,
		PreviouslyFaultyPower: previouslyFaultyPower,
		DetectedFaultyPower:   detectedFaultyPower,
		TotalFaultyPower:      totalFaultyPower,
	}, nil
}


result, err := st.AdvanceDeadline(store, currEpoch)
builtin.RequireNoErr(rt, err, exitcode.ErrIllegalState, "failed to advance deadline")

// Faults detected by this missed PoSt pay no penalty, but sectors that were already faulty
// and remain faulty through this deadline pay the fault fee.
penaltyTarget := PledgePenaltyForContinuedFault(
	rewardSmoothed,
	qualityAdjPowerSmoothed,
	result.PreviouslyFaultyPower.QA,
)

There will be a phenomenon: I did not submit the entire partition, I have a chance of exemption from punishment, but if I submit the partition, but skip some sectors, I will be punished immediately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant