@@ -17,7 +17,6 @@ import (
1717 "github.com/ethereum/go-ethereum/common"
1818 "github.com/ethereum/go-ethereum/common/bidutil"
1919 "github.com/ethereum/go-ethereum/consensus"
20- "github.com/ethereum/go-ethereum/consensus/misc/eip1559"
2120 "github.com/ethereum/go-ethereum/consensus/misc/eip4844"
2221 "github.com/ethereum/go-ethereum/consensus/parlia"
2322 "github.com/ethereum/go-ethereum/core"
@@ -670,59 +669,31 @@ func (b *bidSimulator) GetBestBidBlock(parentHash common.Hash) *types.DecodedBid
670669 return b .bestBidBlock [parentHash ]
671670}
672671
673- // preSealVerifyBidBlock validates deterministic header fields before selection.
674- // Execution-result fields are deferred to InsertChain.
675- // TODO: extract shared deterministic Parlia header checks when this path grows.
672+ // preSealVerifyBidBlock validates a BidBlock before admission.
676673func (b * bidSimulator ) preSealVerifyBidBlock (decoded * types.DecodedBidBlock ) error {
677674 parliaEngine , ok := b .engine .(* parlia.Parlia )
678675 if ! ok {
679676 return errors .New ("consensus engine is not parlia" )
680677 }
681-
682678 header := decoded .Header
683- // RPC admission checks the parent hash, but pre-seal must not assume the lookup succeeds.
684- parent := b .chain .GetHeaderByHash (header .ParentHash )
685- if parent == nil {
686- return fmt .Errorf ("parent header not found: %s" , header .ParentHash .Hex ())
687- }
688679
689- // 1. Coinbase must be the in-turn validator (this node).
690- expectedCoinbase := b .bidWorker .etherbase ()
691- if header .Coinbase != expectedCoinbase {
680+ if header .Coinbase != b .bidWorker .etherbase () {
692681 return fmt .Errorf ("invalid coinbase: got %s, want %s" ,
693- header .Coinbase .Hex (), expectedCoinbase .Hex ())
682+ header .Coinbase .Hex (), b . bidWorker . etherbase () .Hex ())
694683 }
695-
696- // 2. TODO: add full GasLimit bounds check when BidBlock pre-seal rules define it.
697-
698- // 3. GasUsed must not exceed GasLimit (consensus hard rule).
699- if header .GasUsed > header .GasLimit {
700- return fmt .Errorf ("invalid gasUsed: %d > gasLimit %d" , header .GasUsed , header .GasLimit )
684+ if err := parliaEngine .VerifyUnsealedHeader (b .chain , header , nil ); err != nil {
685+ return fmt .Errorf ("invalid header: %v" , err )
701686 }
702-
703- // 4. BaseFee must match the EIP-1559 derived value.
704- expectedBaseFee := eip1559 .CalcBaseFee (b .chainConfig , parent )
705- if header .BaseFee == nil || header .BaseFee .Cmp (expectedBaseFee ) != 0 {
706- return fmt .Errorf ("invalid baseFee: got %v, want %v" , header .BaseFee , expectedBaseFee )
687+ if err := parliaEngine .VerifyExtraDataVanity (b .chain , header ); err != nil {
688+ return fmt .Errorf ("invalid extra-data vanity: %v" , err )
707689 }
708690
709- // 5. Difficulty must be in-turn.
710- if header .Difficulty == nil || header .Difficulty .Cmp (diffInTurn ) != 0 {
711- return fmt .Errorf ("invalid difficulty: got %v, want %v" , header .Difficulty , diffInTurn )
712- }
713-
714- // 6. Timestamp must match the deterministic BidBlock time.
715- if err := parliaEngine .VerifyBlockTime (b .chain , header , parent ); err != nil {
716- return fmt .Errorf ("invalid block time: %v" , err )
717- }
718-
719- // 7. GasFee is derived from the unsigned deposit tx.
720691 decoded .GasFee = parliaEngine .ExtractBidBlockDepositValue (decoded .Txs )
721692 if decoded .GasFee .Sign () <= 0 {
722693 return errors .New ("empty gasFee" )
723694 }
724695
725- // 8. Validate and locate the trailing unsigned system-tx region.
696+ parent := b . chain . GetHeaderByHash ( header . ParentHash )
726697 systemTxStart , err := parliaEngine .VerifyBidBlockSystemTxs (decoded , parent )
727698 if err != nil {
728699 return err
0 commit comments