consensus/XDPoS, params: fix some comments, close XFN-125 (#1733)

This commit is contained in:
Daniel Liu 2025-11-15 19:14:39 +08:00 committed by GitHub
parent f24e68b015
commit 650047c81e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 7 deletions

View file

@ -108,11 +108,11 @@ func (x *XDPoS_v2) onTimeoutPoolThresholdReached(blockChainReader consensus.Chai
// Process TC
err := x.processTC(blockChainReader, timeoutCert)
if err != nil {
log.Error("[onTimeoutPoolThresholdReached] Error while processing TC in the Timeout handler after reaching pool threshold", "TcRound", timeoutCert.Round, "NumberOfTcSig", len(timeoutCert.Signatures), "GapNumber", gapNumber, "Error", err)
log.Error("[onTimeoutPoolThresholdReached] Fail to process TC", "TcRound", timeoutCert.Round, "NumberOfTcSig", len(timeoutCert.Signatures), "GapNumber", gapNumber, "Error", err)
return err
}
log.Info("[onTimeoutPoolThresholdReached] Successfully processed the timeout message and produced TC!", "TcRound", timeoutCert.Round, "NumberOfTcSig", len(timeoutCert.Signatures))
log.Info("[onTimeoutPoolThresholdReached] process TC successfully", "TcRound", timeoutCert.Round, "NumberOfTcSig", len(timeoutCert.Signatures))
return nil
}

View file

@ -104,7 +104,7 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
if header.MixDigest != (common.Hash{}) {
return utils.ErrInvalidMixDigest
}
// Ensure that the block doesn't contain any uncles which are meaningless in XDPoS_v1
// Ensure that the block doesn't contain any uncles which are meaningless in XDPoS_v2.
if header.UncleHash != utils.UncleHash {
return utils.ErrInvalidUncleHash
}

View file

@ -39,6 +39,8 @@ func (p *Pool) Get() map[string]map[common.Hash]PoolObj {
return dataCopy
}
// Add adds the object to the pool, returns the number of items
// and the map of objects under the same pool key
func (p *Pool) Add(obj PoolObj) (int, map[common.Hash]PoolObj) {
p.lock.Lock()
defer p.lock.Unlock()

View file

@ -19,8 +19,8 @@ package params
import "math/big"
var (
TargetGasLimit uint64 = XDCGenesisGasLimit // The artificial target
V2TestsGasLimit uint64 = 1200000000 // The gas limit used in the v2 consensus tests
TargetGasLimit uint64 = XDCGenesisGasLimit // The artificial target
V2TestsGasLimit uint64 = 1200000000 // The gas limit used in the v2 consensus tests
)
const (
@ -39,7 +39,7 @@ const (
TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions.
TxDataZeroGas uint64 = 4 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions.
QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation.
SstoreSetGas uint64 = 20000 // Once per SLOAD operation.
SstoreSetGas uint64 = 20000 // Once per SSTORE operation.
LogDataGas uint64 = 8 // Per byte in a LOG* operation's data.
CallStipend uint64 = 2300 // Free gas given at beginning of call.
@ -50,7 +50,7 @@ const (
SstoreResetGas uint64 = 5000 // Once per SSTORE operation if the zeroness changes from zero.
SstoreClearGas uint64 = 5000 // Once per SSTORE operation if the zeroness doesn't change.
SstoreRefundGas uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero.
JumpdestGas uint64 = 1 // Refunded gas, once per SSTORE operation if the zeroness changes to zero.
JumpdestGas uint64 = 1 // Once per JUMPDEST operation.
EpochDuration uint64 = 30000 // Duration between proof-of-work epochs.
CallGas uint64 = 40 // Once per CALL operation & message call transaction.
CreateDataGas uint64 = 200 //