mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Restore check against Beacon Chain requests before TTD (#5234)
* getPayloadStatusFromHashIfPossible -> getQuickPayloadStatusIfPossible * Restore TTD check * Amend log warning * Restore full stop in comment * 3 Hive tests are fixed now
This commit is contained in:
parent
35687c0e2c
commit
4a7bcc73e1
@ -335,7 +335,7 @@ func (s *EthBackendServer) EngineNewPayloadV1(ctx context.Context, req *types2.E
|
||||
}
|
||||
block := types.NewBlockFromStorage(blockHash, &header, transactions, nil)
|
||||
|
||||
possibleStatus, err := s.getPayloadStatusFromHashIfPossible(blockHash, req.BlockNumber, header.ParentHash, nil, true)
|
||||
possibleStatus, err := s.getQuickPayloadStatusIfPossible(blockHash, req.BlockNumber, header.ParentHash, nil, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -359,8 +359,8 @@ func (s *EthBackendServer) EngineNewPayloadV1(ctx context.Context, req *types2.E
|
||||
return convertPayloadStatus(&payloadStatus), nil
|
||||
}
|
||||
|
||||
// Check if we can make out a status from the payload hash/head hash.
|
||||
func (s *EthBackendServer) getPayloadStatusFromHashIfPossible(blockHash common.Hash, blockNumber uint64, parentHash common.Hash, forkchoiceMessage *engineapi.ForkChoiceMessage, newPayload bool) (*engineapi.PayloadStatus, error) {
|
||||
// Check if we can quickly determine the status of a newPayload or forkchoiceUpdated.
|
||||
func (s *EthBackendServer) getQuickPayloadStatusIfPossible(blockHash common.Hash, blockNumber uint64, parentHash common.Hash, forkchoiceMessage *engineapi.ForkChoiceMessage, newPayload bool) (*engineapi.PayloadStatus, error) {
|
||||
// Determine which prefix to use for logs
|
||||
var prefix string
|
||||
if newPayload {
|
||||
@ -397,12 +397,23 @@ func (s *EthBackendServer) getPayloadStatusFromHashIfPossible(blockHash common.H
|
||||
}
|
||||
// Retrieve parent and total difficulty.
|
||||
var parent *types.Header
|
||||
var td *big.Int
|
||||
if newPayload {
|
||||
// Obtain TD
|
||||
parent, err = rawdb.ReadHeaderByHash(tx, parentHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
td, err = rawdb.ReadTdByHash(tx, parentHash)
|
||||
} else {
|
||||
td, err = rawdb.ReadTdByHash(tx, blockHash)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if td != nil && td.Cmp(s.config.TerminalTotalDifficulty) < 0 {
|
||||
log.Warn(fmt.Sprintf("[%s] Beacon Chain request before TTD", prefix), "hash", blockHash)
|
||||
return &engineapi.PayloadStatus{Status: remote.EngineStatus_INVALID, LatestValidHash: common.Hash{}}, nil
|
||||
}
|
||||
|
||||
if !s.hd.POSSync() {
|
||||
@ -549,7 +560,7 @@ func (s *EthBackendServer) EngineForkChoiceUpdatedV1(ctx context.Context, req *r
|
||||
FinalizedBlockHash: gointerfaces.ConvertH256ToHash(req.ForkchoiceState.FinalizedBlockHash),
|
||||
}
|
||||
|
||||
status, err := s.getPayloadStatusFromHashIfPossible(forkChoice.HeadBlockHash, 0, common.Hash{}, &forkChoice, false)
|
||||
status, err := s.getQuickPayloadStatusIfPossible(forkChoice.HeadBlockHash, 0, common.Hash{}, &forkChoice, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -7,15 +7,12 @@
|
||||
"Invalid Transition Payload Sync, Invalid Transaction Value",
|
||||
"Invalid Ancestor Chain Sync, Invalid Transaction Nonce, Invalid P9",
|
||||
"Invalid Ancestor Chain Sync, Invalid GasLimit, Invalid P9",
|
||||
"Pre-TTD ForkchoiceUpdated After PoS Switch",
|
||||
"Invalid Ancestor Chain Sync, Invalid ReceiptsRoot, Invalid P8",
|
||||
"Sidechain Reorg",
|
||||
"Invalid Transition Payload Sync, Invalid StateRoot",
|
||||
"Invalid Terminal Block in NewPayload",
|
||||
"Inconsistent Head in ForkchoiceState",
|
||||
"Invalid Transition Payload Sync, Invalid Transaction GasPrice",
|
||||
"Consecutive Payload Execution",
|
||||
"Invalid Terminal Block in ForkchoiceUpdated",
|
||||
"Invalid Ancestor Chain Sync, Invalid Ommers, Invalid P9",
|
||||
"Invalid Transition Payload Sync, Invalid Transaction Signature",
|
||||
"Invalid Ancestor Chain Sync, Invalid Transaction Value, Invalid P9'",
|
||||
|
Loading…
Reference in New Issue
Block a user