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 // Process TC
err := x.processTC(blockChainReader, timeoutCert) err := x.processTC(blockChainReader, timeoutCert)
if err != nil { 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 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 return nil
} }

View file

@ -104,7 +104,7 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
if header.MixDigest != (common.Hash{}) { if header.MixDigest != (common.Hash{}) {
return utils.ErrInvalidMixDigest 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 { if header.UncleHash != utils.UncleHash {
return utils.ErrInvalidUncleHash return utils.ErrInvalidUncleHash
} }

View file

@ -39,6 +39,8 @@ func (p *Pool) Get() map[string]map[common.Hash]PoolObj {
return dataCopy 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) { func (p *Pool) Add(obj PoolObj) (int, map[common.Hash]PoolObj) {
p.lock.Lock() p.lock.Lock()
defer p.lock.Unlock() defer p.lock.Unlock()

View file

@ -39,7 +39,7 @@ const (
TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. 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. 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. 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. LogDataGas uint64 = 8 // Per byte in a LOG* operation's data.
CallStipend uint64 = 2300 // Free gas given at beginning of call. 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. 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. 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. 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. EpochDuration uint64 = 30000 // Duration between proof-of-work epochs.
CallGas uint64 = 40 // Once per CALL operation & message call transaction. CallGas uint64 = 40 // Once per CALL operation & message call transaction.
CreateDataGas uint64 = 200 // CreateDataGas uint64 = 200 //